<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ruizs Place &#187; tech</title>
	<atom:link href="http://www.ruizs.org/archives/category/tech/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ruizs.org</link>
	<description>The ramblings of Steve-0</description>
	<lastBuildDate>Wed, 07 Apr 2010 17:17:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PostgreSQL: Debugging &#8220;missing chunk number X for toast value Y&#8221; errors</title>
		<link>http://www.ruizs.org/archives/138</link>
		<comments>http://www.ruizs.org/archives/138#comments</comments>
		<pubDate>Wed, 07 Apr 2010 17:17:07 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=138</guid>
		<description><![CDATA[If you found this through a search, you probably have seen something like this in your logs: ERROR: missing chunk number 0 for toast value 87246446 Searching for this issue on the net, I found that this is usually caused by a corrupt row in the database. The solution is to find the corrupt row, [...]]]></description>
			<content:encoded><![CDATA[<p>If you found this through a search, you probably have seen something like this in your logs:<br />
ERROR:  missing chunk number 0 for toast value 87246446</p>
<p>Searching for this issue on the net, I found that this is usually caused by a corrupt row in the database.  The solution is to find the corrupt row, and delete it (and/or update it with proper, non-corrupt values).</p>
<p>Unfortunately, there is no easy way to find the row that is giving you grief (or even the table if you don&#8217;t know what is causing this error).  You basically have to narrow down your search by looking at parts of the database.  If you have some sort of date or timestamp column in your table, you can narrow it down a lot more easily, if you know approximately when the error started:</p>
<p><code><br />
mydb=# select id from mytable where date_created > timestamp '2009-02-27 00:00:00'  and date_created < timestamp '2009-03-01 23:59:00';<br />
                  id<br />
--------------------------------------<br />
 3ab226cf-a972-463d-b5a1-148fe39672b5<br />
 10daca73-b2b3-470c-a258-5c92d21cfbb6<br />
(2 rows)<br />
</code></p>
<p>Luckily it's only two rows, and the first one is the culprit:<br />
</code><code><br />
mydb=# select * from mytable where id='3ab226cf-a972-463d-b5a1-148fe39672b5';<br />
ERROR:  missing chunk number 0 for toast value 87246446<br />
</code></p>
<p>Now, on to delete it:<br />
<code>mydb=# delete from mytable where id='3ab226cf-a972-463d-b5a1-148fe39672b5';</code></p>
<p>If you don&#8217;t have a date/timestamp column in your table, you could use LIMIT and OFFSET to narrow it down. I.e. a series of statements like (increasing the offset each time):<br />
<code><br />
select * from mytable order by id limit 1000 offset 5000;<br />
</code></p>
<p>
<script type="text/javascript"><!--
google_ad_client = "pub-7750346334646598";
/* 468x60, created 2/22/08 */
google_ad_slot = "6581891645";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/138/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Terminal tips for OSX</title>
		<link>http://www.ruizs.org/archives/127</link>
		<comments>http://www.ruizs.org/archives/127#comments</comments>
		<pubDate>Tue, 06 Apr 2010 21:36:13 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=127</guid>
		<description><![CDATA[I&#8217;ve been meaning to get around to it for the longest time, but I finally switched over my Mac&#8217;s to use bash as the default shell (previously I had it set to tcsh). I&#8217;ve become more accustomed to bash the past few years as its the default shell on pretty much any unix/linux nowadays, so [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to get around to it for the longest time, but I finally switched over my Mac&#8217;s to use bash as the default shell (previously I had it set to tcsh).  I&#8217;ve become more accustomed to bash the past few years as its the default shell on pretty much any unix/linux nowadays, so it was time to migrate.</p>
<p>The migration itself was pretty easy, but I wanted to gain some of bash&#8217;s features, specifically the emac-like keystrokes for moving forward/back a word in the command line, and also to the beginning and end of the line.  The keystrokes, among others, are:<br />
<code><br />
ctrl-a	 Move cursor to beginning of line<br />
ctrl-e	 Move cursor to end of line<br />
meta-b	 Move cursor back one word<br />
meta-f	 Move cursor forward one word<br />
ctrl-w	 Cut the last word<br />
ctrl-u	 Cut everything before the cursor<br />
ctrl-k	 Cut everything after the cursor<br />
ctrl-y	 Paste the last thing to be cut<br />
ctrl-_	 Undo<br />
</code></p>
<p>I&#8217;m a big fan of <a href="http://iterm.sourceforge.net/">iTerm</a> &#8211; I use it as my primary terminal and have been for the last few years, as it matured in terms of performance and has a lot of great features.  The most compelling feature it has over the built in OSX Terminal.app, for me, is that you can specify which characters to include when selecting words.  A common operation in a terminal is to select a path, i.e. /home/myuser/testfile.  In Terminal.app, if you double click on home, it will just select home &#8211; so you have to go back, double click on the first &#8220;/&#8221; character, and mouse right to get the whole word.  With iTerm, you can set a preference with characters to include when connecting, i.e. &#8220;/&#8221;, so when I double click on home in iTerm, it selects the full path.  Specifically, in iTerm -> Preferences -> Mouse, i have &#8220;Characters considered part of word:&#8221; set to /-_.  </p>
<p>One thing I couldn&#8217;t figure out was how to get the &#8220;meta&#8221; key in iterm set to the alt/option key on the mac keyboard.  Turns out it&#8217;s buried in a non-intuitive place, but it can be done.  In iTerm, go to Bookmarks->Manage Profiles, and under Keyboard Profiles select Global.  On the right side, you need to set Option Key as &#8220;+Esc&#8221; for this to work &#8211; yes, its strange that it has to be Esc instead of Meta, but hey, at least it all works.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-7750346334646598";
/* 468x60, created 2/22/08 */
google_ad_slot = "6581891645";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/127/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Oracle VM Server 2.2 with a NFS Repository</title>
		<link>http://www.ruizs.org/archives/129</link>
		<comments>http://www.ruizs.org/archives/129#comments</comments>
		<pubDate>Thu, 25 Mar 2010 21:50:08 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oraclevm]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=129</guid>
		<description><![CDATA[Oracle&#8217;s documentation on this is a not very well organized, and simply doesn&#8217;t work out of the box, at least with the 2.2 install CD that&#8217;s available for download. The main problem is that the version of ovs-agent that ships with Oracle VM 2.2 is broken, so following the instructions you&#8217;ll end up frustrated and [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle&#8217;s documentation on this is a not very well organized, and simply doesn&#8217;t work out of the box, at least with the 2.2 install CD that&#8217;s available for download.  The main problem is that the version of ovs-agent that ships with Oracle VM 2.2 is broken, so following the instructions you&#8217;ll end up frustrated and wondering what you did wrong, i.e.:<br />
<code>[root@oraclevm8 /]# /opt/ovs-agent-2.3/utils/repos.py --init<br />
Cluster not available.</code></p>
<p>To set up OracleVM 2.2 Server, with a NFS repository for VM&#8217;s:</p>
<ul>
<li>Download the ISO, and run through the install process</li>
<li>Once it is up and you are logged in:</li>
<li>Download and install the updated ovs-agent rpm from oracle here: <a href="http://oss.oracle.com/oraclevm/server/2.2/RPMS/ovs-agent-2.3-31.noarch.rpm">http://oss.oracle.com/oraclevm/server/2.2/RPMS/ovs-agent-2.3-31.noarch.rpm</a>
<ul>
<li>wget http://oss.oracle.com/oraclevm/server/2.2/RPMS/ovs-agent-2.3-31.noarch.rpm</li>
<li>rpm -Uvh ovs-agent-2.3-31.noarch.rpm</li>
</ul>
</li>
<li>Add your repository with the repos.py tool, make it the root repository, and initialize it:<br />
<code><br />
# /opt/ovs-agent-2.3/utils/repos.py --new mynfsserver.company.com:/volumes/datavol/ovs<br />
# /opt/ovs-agent-2.3/utils/repos.py -l<br />
# /opt/ovs-agent-2.3/utils/repos.py -r 7c885f7e-7dfe-4108-bae4-4dc329e2f017<br />
# /opt/ovs-agent-2.3/utils/repos.py -i<br />
</code></li>
</ul>
<p>At this point, you are ready to go, and can continue setting things up (including your Oracle VM Manager VM).</p>
<p>
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/129/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an NFS-root VM template for Xen / Oracle VM</title>
		<link>http://www.ruizs.org/archives/116</link>
		<comments>http://www.ruizs.org/archives/116#comments</comments>
		<pubDate>Mon, 15 Mar 2010 19:06:48 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oraclevm]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=116</guid>
		<description><![CDATA[Following up on my previous post about building a Xen / NFS-root kernel, this will take you through creating a VM template capable of using that kernel (or a P2V process for converting existing VM&#8217;s / linux servers to nfs-root). I think the intro from the last article still applies, so I&#8217;ll include it here: [...]]]></description>
			<content:encoded><![CDATA[<p>Following up on my previous post about building a Xen / NFS-root kernel, this will take you through creating a VM template capable of using that kernel (or a P2V process for converting existing VM&#8217;s / linux servers to nfs-root).  I think the intro from the last article still applies, so I&#8217;ll include it here:</p>
<blockquote><p>Over the past year or two, we have transitioned all our servers and hosting to Xen &#8211; specifically, we use the Oracle VM management tools on top of xen, and most of our VM&#8217;s are Centos 5 x86_64.  Since we use NFS NAS&#8217; as storage across our infrastructure, it would be very convenient if we could use a NFS volume as the root drive for VM&#8217;s.  With the NFS root, we gain things like easy use of filer snapshots, and on-the-fly volume resizing &#8211; if we&#8217;re ever running short on space in a given VM, its a single command (or a click on a web page) to expand the root drive.</p>
<p>The steps below are the result of a lot of work &#8211; the RHEL5 kernel has code in it for an NFS root, but I was never able to get it work correctly, at least under xen.  In the end, after lots of experimenting, I was able to build a new kernel from kernel source, that is compatible with Xen and a NFS-Root.  Repeat: you cannot build a custom RHEL5 kernel that is capable of booting from NFS under xen.</p>
<p>There are shortcomings/tradeoffs with this approach &#8211; you are not able to do any NFS exports from the nfs-root vm, and there is a bit more performance overhead with an NFS-root vm.  If you are using a VM to host a high-transaction DB, for instance, I wouldn&#8217;t recommend a NFS-root, but for most purposes, it works and performs just fine.</p></blockquote>
<li> Install linux / kickstart / etc to get a good, minimal install of linux, and configure it as you would any linux server.  I would suggest a minimal install for your requirements, turn off any unneeded services, lock down permissions, firewall, and any other deployment process you usually go through.  Since this is going to be a template, you want this to be ready for any task with minimal configuration changes.</li>
<li>On that configured linux system, mount a NFS share that will serve as your future NFS root (or storage for your VM template) to /mnt/tmp  </li>
<li>Shut down as many running services as possible, so there are no file conflicts/open databases/etc.</li>
<li>Copy over the kernel modules from your nfs-root kernel build:<code>rsync -av /path/to/kernel/modules/kernel-ver /mnt/tmp/lib/modules/</code></li>
<li><code>#copy all files over to nfs mount<br />
cd /<br />
cp -ax /{bin,dev,etc,lib,lib64,opt,root,sbin,usr,var,folders} /mnt/tmp<br />
mkdir /mnt/tmp/{home,proc,sys,tmp}<br />
chmod 777 /mnt/tmp/tmp</code></li>
<li>Edit /mnt/tmp/etc/fstab to look something like this, main change here is to /:<br />
<code><br />
/dev/nfs                /                       rootfs  defaults        0 0<br />
tmpfs                   /dev/shm                tmpfs   defaults        0 0<br />
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0<br />
sysfs                   /sys                    sysfs   defaults        0 0<br />
proc                    /proc                   proc    defaults        0 0<br />
rpc_pipefs              /var/lib/nfs/rpc_pipefs rpc_pipefs defaults     0 0<br />
</code></li>
<li>Edit /mnt/tmp/etc/sysconfig/network-scripts/ifcfg-eth0 as needed to setup the network</li>
<li>Create a vm.cfg file for the Xen vm.  If using this is an Oracle VM template, make sure to add a zero-byte disk image, and put this under the seed_pool directory.  Edit options as needed for your infrastructure.<br />
<code> dhcp = 'off'<br />
extra = 'nfsroot=10.0.0.1:/vol/nfsroot,noacl,nfsvers=3,tcp,rsize=32768,wsize=32768 selinux=0 acpi=off noapic'<br />
gateway = '10.0.0.254'<br />
hostname = 'nfsroot-vm.mycompany.com'<br />
ip = '10.0.0.10'<br />
kernel = '/OVS/P2V_STUFF/nfsboot-custom/vmlinuz-2.6.31.1nfsboot'<br />
memory = '512'<br />
name = 'nfsroot-vm'<br />
netmask = '255.255.255.0'<br />
on_crash = 'restart'<br />
on_reboot = 'restart'<br />
root = '/dev/nfs'<br />
uuid = '9af0a816-0123-4567-ad50-bc32be92bff7'<br />
vcpus = 2<br />
vfb = ['type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=password']<br />
vif = ['bridge=vlan100,mac=00:16:3E:31:FF:37,type=netfront']<br />
vif_other_config = []<br />
</code></li>
<li>Start up the vm with Oracle VM manager, or start on the command line with xm create vm.cfg, and cross your fingers!</li>
<p>
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/116/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build a custom Xen kernel capable of booting from a NFS Root Filesystem</title>
		<link>http://www.ruizs.org/archives/110</link>
		<comments>http://www.ruizs.org/archives/110#comments</comments>
		<pubDate>Mon, 15 Mar 2010 18:26:31 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oraclevm]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=110</guid>
		<description><![CDATA[Since we use NFS NAS' as storage across our infrastructure, it would be very convenient if we could use a NFS volume as the root drive for VM's.  With the NFS root, we gain things like easy use of filer snapshots, and on-the-fly volume resizing - if we're ever running short on space in a given VM, its a single command (or a click on a web page) to expand the root drive.]]></description>
			<content:encoded><![CDATA[<p>Over the past year or two, we have transitioned all our servers and hosting to Xen &#8211; specifically, we use the Oracle VM management tools on top of xen, and most of our VM&#8217;s are Centos 5 x86_64.  Since we use NFS NAS&#8217; as storage across our infrastructure, it would be very convenient if we could use a NFS volume as the root drive for VM&#8217;s.  With the NFS root, we gain things like easy use of filer snapshots, and on-the-fly volume resizing &#8211; if we&#8217;re ever running short on space in a given VM, its a single command (or a click on a web page) to expand the root drive.</p>
<p>The steps below are the result of a lot of work &#8211; the RHEL5 kernel has code in it for an NFS root, but I was never able to get it work correctly, at least under xen.  In the end, after lots of experimenting, I was able to build a new kernel from kernel source, that is compatible with Xen and a NFS-Root.  Repeat: you cannot build a custom RHEL5 kernel that is capable of booting from NFS under xen.</p>
<p>There are shortcomings/tradeoffs with this approach &#8211; you are not able to do any NFS exports from the nfs-root vm, and there is a bit more performance overhead with an NFS-root vm.  If you are using a VM to host a high-transaction DB, for instance, I wouldn&#8217;t recommend a NFS-root, but for most purposes, it works and performs just fine.</p>
<p>First, you need to build a kernel that supports both xen and an NFS-root &#8211; you&#8217;ll need a linux machine with a complete build environment, i.e. gcc, make, etc.  I have been through this process with 2.6.31, but I would guess that the latest stable kernel version available at http://kernel.org will work just fine.<br />
- Download the latest kernel source<br />
- unzip, cd into source directory<br />
- Copy in attached .config as starting point ( copy as …./linux-(version)/.config )<br />
- make menuconfig</p>
<p>Important config options are listed here:</p>
<p>http://www.virtuatopia.com/index.php/CentOS_5_-_Build_a_Custom_Xen_Kernel_with_NFS_Root_Filesystem_(CONFIG_ROOT_NFS)_Support</p>
<p>Most importantly, nfs client options and nfs_root need to be built into kernel (not as modules).  Also need to make sure to build Xen modules, and select most of the iptables filters (state is an important one). </p>
<p>- make<br />
- make modules_install</p>
<p>Once the make and install is complete, you will have a kernel capable of nfs-booting under xen.  To collect all the pieces needed:<br />
- copy over the file vmlinux in the base build directory (this one is ~85MB), this is the kernel  (can&#8217;t use bzImage with xen nfs boot).<br />
- Tar up /lib/modules/kernelVer to distribute to nfs client vm.</p>
<p> See the next article for creating a proper vm.cfg under xen / Oracle VM.</p>
<p>
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/110/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting a xen disk image file on dom0</title>
		<link>http://www.ruizs.org/archives/104</link>
		<comments>http://www.ruizs.org/archives/104#comments</comments>
		<pubDate>Tue, 15 Sep 2009 22:14:33 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oraclevm]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=104</guid>
		<description><![CDATA[If you need to get in and edit some files on your xen domU instance, i.e. it isn&#8217;t booting up properly, etc, here&#8217;s how to mount it on dom0. In this case, we want to mount the second partion on the virtual disk (our root partition): Print out the partition layout: fdisk -l /path/to/img/file.img Disk [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to get in and edit some files on your xen domU instance, i.e. it isn&#8217;t booting up properly, etc, here&#8217;s how to mount it on dom0.  In this case, we want to mount the second partion on the virtual disk (our root partition):</p>
<li>Print out the partition layout:<br />
<code>fdisk -l /path/to/img/file.img</p>
<p>Disk System.img: 0 MB, 0 bytes<br />
255 heads, 63 sectors/track, 0 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>     Device Boot      Start         End      Blocks   Id  System<br />
System.img1               1           4       32098+  83  Linux<br />
System.img2   *           <b>5</b>         619     4939987+  83  Linux<br />
System.img3             620         750     1052257+  82  Linux swap / Solaris</code>
</li>
<li>create directory to mount image under: <code>mkdir /mnt/tmp</code></li>
<li>mount the image using the offset from the fdisk output, the start block (in this case 5)<br />
<code>mount mount -o loop,offset=$((512*<b>5</b>) /path/to/img/file.img /mnt/tmp</code></li>
<li>Edit files as needed, and unmount when done.</li>
<p><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/104/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synchronizing multiple iTunes libraries</title>
		<link>http://www.ruizs.org/archives/98</link>
		<comments>http://www.ruizs.org/archives/98#comments</comments>
		<pubDate>Fri, 11 Sep 2009 21:54:32 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=98</guid>
		<description><![CDATA[On and off over the past few years, I&#8217;ve looked for a good way to synchronize 2 or more iTunes libraries, and until recently, never found a good solution. The main problem is synchronizing library metadata &#8211; syncing files isn&#8217;t that difficult, but things like ratings, play counts, etc. is. My previous solution was simple [...]]]></description>
			<content:encoded><![CDATA[<p>On and off over the past few years, I&#8217;ve looked for a good way to synchronize 2 or more iTunes libraries, and until recently, never found a good solution.  The main problem is synchronizing library metadata &#8211; syncing files isn&#8217;t that difficult, but things like ratings, play counts, etc. is.  </p>
<p>My previous solution was simple &#8211; I considered one computer my &#8220;master&#8221;, and simply sync&#8217;ed all the files from it to my other computers.  Since I do most of my itunes listening (and rating) at work, I used my iMac as the master and my macbook and home desktop were the slaves.  This has its downfalls though, as anything I added or rated on my other systems never made its way back to the master system, and I had to make those changes manually.<br />
I decided to search again a few days ago, and found two applications that do exactly what I want:</p>
<p><a href="https://www.socketheadstudios.com/mytunesync/home.html">myTuneSync from SocketHead studios</a><br />
<a href="http://www.sonzea.com/syncopation/">Syncopation from Sonzea</a></p>
<p>I checked them both out, and they both work as advertised (both offer free time-limited trials).  You install the application, point it at the other itunes library to keep in sync with, and set them up for automatic updates.  Syncopation is the clear winner for me, with its cleaner interface, faster performance, and ability to synchronize file deletions as well.  Syncopation works only on macs, so if you have a mix of mac and Windows (or only Windows), myTuneSync is for you.  </p>
<p>Interestingly, I found these programs two days before the new iTunes 9 was released, and looking at the keynote, I wondered if I just wasted money on something that was now a standard feature of iTunes.  (Unfortunately) It turns out that the syncing included with iTunes is limited to purchases from the iTunes store, and doesn&#8217;t include anything added by you.  It also seems that the metadata does not get transferred over, only the purchased song files.<br />
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/98/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating a true read-only user in PostgreSQL</title>
		<link>http://www.ruizs.org/archives/89</link>
		<comments>http://www.ruizs.org/archives/89#comments</comments>
		<pubDate>Tue, 25 Aug 2009 06:39:45 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=89</guid>
		<description><![CDATA[Since PostgreSQL is our database of choice, I started researching the process, thinking it would be a couple mysql-esqe GRANT statements and that would be it.  Turns out that it is a huge PITA in postgres - even my solution I'm documenting here has its shortcomings, but as far as I know is the best / only way to accomplish this task.]]></description>
			<content:encoded><![CDATA[<p>I develop a product at work that (among many other things) allows users to easily create and manage databases to interact with other packages on their appliance.  One feature that was requested and green-lighted is the ability to create a read-only user for existing databases- a user that can connect to a given database and access all tables and views in that DB, and nothing else.</p>
<p>Since PostgreSQL is our database of choice, I started researching the process, thinking it would be a couple mysql-esqe GRANT statements and that would be it.  Turns out that it is a huge PITA in postgres &#8211; even my solution I&#8217;m documenting here has its shortcomings, but as far as I know is the best / only way to accomplish this task.  I ran across quite a few sites that helped with pieces of this, but none that actually tied the process together for production usage.  I am by no means a Postgres expert, but do have a good bit of experience mucking around with back-end settings and figuring how to script common tasks.</p>
<p>There are two main things to watch out for when trying to create a read-only user in PostgreSQL, especially if you come from a DB like MySQL:</p>
<li>PostgreSQL only sets permissions on objects, not on databases, so you need to grant read access to all your tables/views/etc, and if you add a table down the line, you need to remember to manully grant read access to it after creating the table. </li>
<li>I&#8217;m guessing 95% of postgres users just use the default &#8220;public&#8221; schema, and as such, you need to revoke create privileges from the PUBLIC group.  Otherwise, your &#8220;read-only&#8221; user will still be allowed to create tables that it owns, even if you&#8217;ve only given it read only access to all other objects in your database.</li>
<p>For this example, we&#8217;ll use database name &#8220;mydb&#8221;, database user/owner &#8220;mydbuser&#8221;, and we&#8217;ll create a read-only user named &#8220;mydbuser_ro&#8221;.  This assumes that you did not define a schema for your database and are using the default &#8220;public&#8221; schema.</p>
<li>Revoke default permissions from public group:<br />
<code> REVOKE CREATE ON SCHEMA public FROM PUBLIC;<br />
REVOKE USAGE ON SCHEMA public FROM PUBLIC;</code></li>
<li>Add back permissions for your database owner:<br />
<code> GRANT CREATE ON SCHEMA public TO mydbuser;<br />
GRANT USAGE ON SCHEMA public TO mydbuser;</code></li>
<li>Create the new user via the command line, or pgadmin/etc:<br />
<code>psql -U postgres -t -c  "create role mydbuser_ro password 'abc123' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;</code></li>
<li>Grant usage permissions for your read-only user:<br />
<code> GRANT USAGE ON SCHEMA public TO mydbuser_ro;</code></li>
<li>Grant select permissions on all database tables from the command line:<br />
<code>psql -U postgres -qAt -c "select 'grant select on ' || tablename || ' to \"mydbuser_ro\";' from pg_tables where schemaname = 'public'" mydb | psql -U postgres mydb</code></li>
<li>Setup remote access for the read only user in pg_hba.conf as appropriate</li>
<p>Once complete, you can verify the settings with a quick sql query.  You should see something like this, with the user=UC (for Usage/Create), and user_ro=U (for Usage):<br />
<code> mydb=> select * from pg_namespace where nspname='public';<br />
 nspname | nspowner |                              nspacl<br />
---------+----------+------------------------------------------------------------------<br />
 public  |       10 |<br />
{postgres=UC/postgres,mydbuser=UC/postgres,mydbuser_ro=U/postgres}<br />
</code></p>
<p>
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/89/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Syncing Adium chat logs across multiple Macs, v2.0</title>
		<link>http://www.ruizs.org/archives/80</link>
		<comments>http://www.ruizs.org/archives/80#comments</comments>
		<pubDate>Wed, 05 Aug 2009 04:26:02 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=80</guid>
		<description><![CDATA[... a new solution to the same problem that is very simple, costs nothing, and performs great.  Basically, let dropbox do the syncing for you.]]></description>
			<content:encoded><![CDATA[<p>I previously posted about a rather convoluted method to use mobileme and idisk to sync adium logs across computers, but after using that for a while, it turned into an exercise in frustration, as it was not reliable, and idisk is horribly slow.<br />
I just came across a new solution to the same problem that is very simple, costs nothing, and performs great.  Basically, let dropbox do the syncing for you.  Instructions as follows:<br />
- <a href="https://www.getdropbox.com/referrals/NTkzNTEzOQ">Sign up, download and install dropbox here</a><br />
- Shutdown adium (or other chat client)<br />
- Open a Terminal session<br />
- Move your adium logs folder to dropbox:<br />
<code>mv ~/Library/Application\ Support/Adium\ 2.0/Users/Default/Logs ~/Dropbox/Private/AdiumLogs</code><br />
-create a symbolic link from your adium folder to your dropbox private folder:<br />
<code>ln -s ~/Dropbox/Private/AdiumLogs  ~/Library/Application\ Support/Adium\ 2.0/Users/Default/Logs</code></p>
<p>On any other computer you&#8217;d like to keep in sync with:<br />
- sync over your existing logs with rsync:<br />
<code>rsync -avl ~/Library/Application\ Support/Adium\ 2.0/Users/Default/Logs/ ~/Dropbox/Private/AdiumLogs</code><br />
- Move your old logs folder out of the way:<br />
<code>mv ~/Library/Application\ Support/Adium\ 2.0/Users/Default/Logs ~/Library/Application\ Support/Adium\ 2.0/Users/Default/Logs.old<br />
-create a symbolic link from your adium folder to your dropbox private folder:<br />
</code><code>ln -s ~/Dropbox/Private/AdiumLogs  ~/Library/Application\ Support/Adium\ 2.0/Users/Default/Logs</code></p>
<p>It really is that simple, and works great &#8211; thanks Dropbox for a great bit of software.</p>
<p>
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/80/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Converting a Physical Windows Server to Xen / Oracle VM, by way of VMware</title>
		<link>http://www.ruizs.org/archives/63</link>
		<comments>http://www.ruizs.org/archives/63#comments</comments>
		<pubDate>Mon, 08 Dec 2008 18:37:08 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[oraclevm]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.ruizs.org/?p=63</guid>
		<description><![CDATA[At work, we are moving from a huge datacenter space (about 12&#8242; x 12&#8242;, 12 cabinets) to less than 1 cabinet. This will be a great change in all respects, mostly financially, for all the saved space, but also environmentally, for all the saved power. We probably use about the same amount of power to [...]]]></description>
			<content:encoded><![CDATA[<p>At work, we are moving from a huge datacenter space (about 12&#8242; x 12&#8242;, 12 cabinets) to less than 1 cabinet.  This will be a great change in all respects, mostly financially, for all the saved space, but also environmentally, for all the saved power.  We probably use about the same amount of power to run our whole infrastructure as we used to to run two or three servers.
<p>We are using an IBM Bladecenter, with fully loaded blades &#8211; 5 for now, expandable to 14.   Each blade has 8 CPU cores, and 32GB of memory.  It would be a waste to run a server OS on the blade itself, it would definitely not be properly utilized and we&#8217;d be wasting compute power, electrical power, and space.  So, we&#8217;re moving ahead with deploying everything on Oracle VM Server &#8211; a Xen based virtualization platform, that does some cool stuff like load balancing, failover, live migration, etc.</p>
<p>In our old infrastructure, we have a few Windows servers, whose functionality we need to keep around, but we&#8217;re not too excited to move over these old, Pentium III waste-of-space servers.  Last week my main task was to figure out how to get these old servers moved into Xen virtual machines.</p>
<p>There&#8217;s not much information out there on making this conversion &#8211; there are some commercial tools that will do everything for you, but they are quite expensive.  The included P2V functionality in Oracle VM is documented only for linux, and for systems with large hard drives with lots of free space, is pretty wasteful.</p>
<p>The process I came up with requires no downtime on the server to be cloned, only minimal changes beforehand (installing the VMware converter software package), and allows you to resize hard disks as needed.  Once you get the hard disk cloned, you change the drivers, installed software, etc. on the VM only, so the original machine still works and is your backup/fail safe.  The process isn&#8217;t all that time consuming either &#8211; it mostly depends on your network and disk speed to clone the image, and convert it.</p>
<p>The basic process is as follows:<br />
- Clone the physical server using VMware converter &#8211; you need to install the VMware converter software on a management host, and the agent on the physical server to clone.  You need to provide proper login credentials, and a samba/cifs share that both machines can access.  Full instructions are available here:<br />
 <a href="http://www.howtoforge.com/vmware_converter_windows_linux">http://www.howtoforge.com/vmware_converter_windows_linux</a></p>
<p>- Once you have the vmware image (.vmdk and .vmx files) open them in vmware server, fusion, or whatever version of VMware you have install / converted to.<br />
- Install vmware tools to make your life easier.<br />
- Just in case, install the Windows recovery console: http://support.microsoft.com/kb/307654<br />
- Run MergeIDE: <a href='http://www.ruizs.org/wordpress/wp-content/uploads/2009/03/mergeide.zip'>MergeIDE</a> &#8212; This is the secret sauce that copies in and installs the proper basic drivers in the Windows registry.<br />
- Shutdown the VM.<br />
- Copy vmdk files over to Oracle VM server (or Xen flavor of choice)<br />
- Create a new windows VM in Oracle VM manager, power off after creating<br />
- Delete the created disk file (System.img)<br />
- Convert the vmware images with qemu-img: <code>qemu-img convert vmwarefile.vmx System.img</code><br />
- Start vm in Oracle VM, let it detect devices and install drivers<br />
- Use and enjoy being unbound from crappy old hardware!
</p>
<p>
<!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ruizs.org/archives/63/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
