<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>This and that about computer stuff...</title>
	<atom:link href="http://grapz.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://grapz.wordpress.com</link>
	<description>Random useful stuff for the computer guys...</description>
	<lastBuildDate>Tue, 04 Oct 2011 17:17:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='grapz.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>This and that about computer stuff...</title>
		<link>http://grapz.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://grapz.wordpress.com/osd.xml" title="This and that about computer stuff..." />
	<atom:link rel='hub' href='http://grapz.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Compiling x264, FFMpeg &amp; XBMC on Ubuntu</title>
		<link>http://grapz.wordpress.com/2010/08/13/compiling-x264-ffmpeg-xbmc-on-ubuntu/</link>
		<comments>http://grapz.wordpress.com/2010/08/13/compiling-x264-ffmpeg-xbmc-on-ubuntu/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 14:21:49 +0000</pubDate>
		<dc:creator>grapz</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[x264]]></category>
		<category><![CDATA[xbmc]]></category>

		<guid isPermaLink="false">http://grapz.wordpress.com/?p=25</guid>
		<description><![CDATA[So here the other day, I was doing some updates on my media center (Acer Revo box), running Ubuntu 10.04, when I found out that there wasn&#8217;t any XBMC packages for PAE anymore. So I had to compile my own. The following is just a compilation of the various steps I took, and is gathered [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=25&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So here the other day, I was doing some updates on my media center (Acer Revo box), running Ubuntu 10.04, when I found out that there wasn&#8217;t any XBMC packages for PAE anymore. So I had to compile my own.</p>
<p>The following is just a compilation of the various steps I took, and is gathered from different sites around the web.</p>
<p>First, make a directory to have all the source code in, and change to it. I use ~/Source<br />
Then do:<br />
<pre class="brush: bash;">sudo apt-get update
sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
git clone git://git.videolan.org/x264.git
git clone git://review.webmproject.org/libvpx.git
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
svn co https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/ xbmc
</pre><br />
And you&#8217;ll also need the build deps for XBMC. The code block below is one command:<br />
<pre class="brush: bash;">
sudo apt-get install debhelper quilt python-support cmake autotools-dev automake unzip libboost-dev libgl1-mesa-dev libglu-dev libglew-dev libmad0-dev libjpeg-dev libsamplerate-dev libogg-dev libvorbis-dev libvorbisenc2 libfreetype6-dev libfontconfig-dev libbz2-dev libfribidi-dev libsqlite3-dev libmysqlclient-dev libasound-dev libpng-dev libpcre3-dev liblzo2-dev libcdio-dev libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libenca-dev libjasper-dev libxt-dev libxtst-dev libxmu-dev libxinerama-dev libcurl3 libcurl4-openssl-dev libdbus-1-dev libhal-storage-dev libhal-dev libpulse-dev libavahi-common-dev libavahi-client-dev libxrandr-dev libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev liba52-dev libdts-dev libfaad-dev libmpeg2-4-dev libass-dev libflac-dev libwavpack-dev python-dev gawk gperf nasm libcwiid1-dev libbluetooth-dev zlib1g-dev libmms-dev libsmbclient-dev libtiff4-dev libiso9660-dev libssl-dev libmicrohttpd-dev libmodplug-dev libssh-dev gettext cvs libtool libvdpau-dev</pre></p>
<p>Ok, so now we have all the source files, and hopefully all the deps needed. Let&#8217;s start compiling.<br />
First, we&#8217;re gonna do x264:<br />
<pre class="brush: bash;">
cd x264
./configure
make
sudo checkinstall --pkgname=x264 --pkgversion &quot;2:0.`grep X264_BUILD x264.h -m1 | cut -d' ' -f3`.`git rev-list HEAD | wc -l`+git`git rev-list HEAD -n 1 | head -c 7`&quot; --backup=no --default
</pre></p>
<p>Ok, x264 is installed, now let&#8217;s do libvpx:<br />
<pre class="brush: bash;">
cd ..
cd libvpx
./configure
make
sudo checkinstall --pkgname=libvpx --pkgversion=&quot;`date +%Y%m%d%H%M`-git&quot; --backup=no --default
</pre></p>
<p>Then, FFMpeg:<br />
<pre class="brush: bash;">
cd ..
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion &quot;4:SVN-r`svn info | grep Revision | awk '{ print $NF }'`&quot; --backup=no --default
hash x264 ffmpeg ffplay
make tools/qt-faststart
sudo checkinstall --pkgname=qt-faststart --pkgversion &quot;4:SVN-r`svn info | grep Revision | awk '{ print $NF }'`&quot; --backup=no --default install -D -m755 tools/qt-faststart /usr/local/bin/qt-faststart
</pre></p>
<p>And then, XBMC (this takes about 1 hour on my Acer Revo):<br />
<pre class="brush: bash;">
cd ..
cd xbmc
./bootstrap
./configure --enable-external-libraries
make
sudo checkinstall --pkgname=xbmc --pkgversion=&quot;`date +%Y%m%d%H%M`-git&quot; --backup=no --default
</pre></p>
<p>And there you go. Now you&#8217;ll have the latest x264, FFMpeg and XBMC <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Sources:<br />
<a href="http://ubuntuforums.org/showthread.php?t=786095">http://ubuntuforums.org/showthread.php?t=786095</a><br />
<a href="http://wiki.xbmc.org/index.php?title=HOW-TO_compile_XBMC_for_Linux_on_Debian/Ubuntu">http://wiki.xbmc.org/index.php?title=HOW-TO_compile_XBMC_for_Linux_on_Debian/Ubuntu</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grapz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grapz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grapz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grapz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/grapz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/grapz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/grapz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/grapz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grapz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grapz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grapz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grapz.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grapz.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grapz.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=25&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grapz.wordpress.com/2010/08/13/compiling-x264-ffmpeg-xbmc-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">grapz</media:title>
		</media:content>
	</item>
		<item>
		<title>iPod Touch as Universal Remote</title>
		<link>http://grapz.wordpress.com/2009/03/05/ipod-touch-as-universal-remote/</link>
		<comments>http://grapz.wordpress.com/2009/03/05/ipod-touch-as-universal-remote/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 18:04:38 +0000</pubDate>
		<dc:creator>grapz</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[iPod]]></category>

		<guid isPermaLink="false">http://grapz.wordpress.com/?p=16</guid>
		<description><![CDATA[For some time (actually several years), I&#8217;ve been looking for what I consider to be the ultimate universal remote control. So far I haven&#8217;t found any. After some thinking, I came to the conclusion to try and make my own. After some research, I&#8217;ve decided to try and &#8220;transform&#8221; a iPod Touch into a universal [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=16&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For some time (actually several years), I&#8217;ve been looking for what I consider to be the ultimate universal remote control. So far I haven&#8217;t found any.<br />
After some thinking, I came to the conclusion to try and make my own. After some research, I&#8217;ve decided to try and &#8220;transform&#8221; a iPod Touch into a universal remote control.</p>
<p>This is the main parts of the project:<br />
<strong><em>iPod Touch</em></strong><br />
This part of the project is the software on my iPod that is going to control and send IR codes. For this I need to jailbreak a iPod Touch to get serial i/o access (if only Apple could allow developers serial access to access external devices).<br />
For version 1.0 I&#8217;m thinking about these features:</p>
<ul>
<li>XML Parser</li>
<li>Serial I/O</li>
<li>A basic UI with some icons and sub-menus to control the devices. All this is to be read from a xml config file, including IR codes.</li>
<li>Handshake code to talk to my microcontroller</li>
<li>Code to send different IR codes to my microcontroller</li>
<li>Battery status?</li>
<li>A home made iPodserial cable</li>
</ul>
<p><strong><em>Microcontroller:</em></strong><br />
The microcontroller is going to consist of the following parts:</p>
<ul>
<li>AVR 8Bit Microcontroller with picoPower technology (I want max duration from my battery)</li>
<li>A Serial port</li>
<li>An IR Transmitter</li>
<li>Battery</li>
<li>Breadboard or something to assemble it all on</li>
</ul>
<p><strong><em>Microcontroller code</em></strong><br />
To begin with, this is going to be written in C if possible. First I want to make a &#8220;proof-of-concept&#8221; code to transmit some hardcoded IR codes to make sure I can get this to work. Afterwards the remaining code will be implemented. So the main part of the code will be:</p>
<ul>
<li>Serial interface</li>
<li>IR Interface</li>
<li>Main loop that listens on the serial interface. If it recieves a valid IR code (determined by SOM and EOM), it will send it out the IR transmitter, and then send back an &#8216;ok&#8217; signal.</li>
<li>Enter power-save mode after 20 seconds, with an interrupt on the serial interface to wake on data</li>
<li>Handshake and possibly battery status code</li>
</ul>
<p>If all this goes according to plan, I&#8217;m looking to add more functionality like:</p>
<ul>
<li>Bluetooth support (mainly to controll my PS3)</li>
<li>WiFi support (to control lights and other stuff that uses WiFi)</li>
<li>Menu editor</li>
</ul>
<p>Unfortunately I don&#8217;t got too much spare time now, so to begin with I&#8217;m going to play around with the iPod/iPhone SDK and make some basic UI and stuff to see what I can do.</p>
<p>Well, I&#8217;ll keep you posted, but it&#8217;ll probably be a while until next update&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grapz.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grapz.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grapz.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grapz.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/grapz.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/grapz.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/grapz.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/grapz.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grapz.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grapz.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grapz.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grapz.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grapz.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grapz.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=16&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grapz.wordpress.com/2009/03/05/ipod-touch-as-universal-remote/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">grapz</media:title>
		</media:content>
	</item>
		<item>
		<title>New to OpenSolaris 2008.05 &#8211; I was</title>
		<link>http://grapz.wordpress.com/2008/07/23/new-to-opensolaris-200805-i-was/</link>
		<comments>http://grapz.wordpress.com/2008/07/23/new-to-opensolaris-200805-i-was/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 06:07:29 +0000</pubDate>
		<dc:creator>grapz</dc:creator>
				<category><![CDATA[OpenSolaris]]></category>

		<guid isPermaLink="false">http://grapz.wordpress.com/?p=5</guid>
		<description><![CDATA[Well, for my file server I decided to go with OpenSolaris because of ZFS. I&#8217;ve read several good things about it, so I wanted to test it out. After using several Linux distros over the last years, I was a bit skeptic about the whole Solaris thing, but oh well&#8230; The install went smooth, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=5&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, for my file server I decided to go with OpenSolaris because of <a href="http://www.wikipedia.org/ZFS">ZFS</a>. I&#8217;ve read several good things about it, so I wanted to test it out.</p>
<p>After using several Linux distros over the last years, I was a bit skeptic about the whole Solaris thing, but oh well&#8230;</p>
<p>The install went smooth, and after some poking around I decided to turn of the GUI (GDM/X). I didn&#8217;t need it since I&#8217;m just using SSH/PuTTY to log in to my server, so why do I want it running ?</p>
<p>After looking around on the net, I found the command to disable GDM:</p>
<blockquote><p>
pfexec svcadm disable gdm
</p></blockquote>
<p>Next problem, installing/updating packages. I&#8217;ve been used to apt for a long while now, and this was one of my bigger concerns when deciding to try OpenSolaris. But luckily they&#8217;d just added IPS (Integrated Package System I think), a system that reminds me of a package tool I&#8217;m used to using.<br />
So, how does it work?</p>
<p>Refresh the package list:</p>
<blockquote><p>pfexec pkg refresh</p></blockquote>
<p>Search for a package (gcc in this case):</p>
<blockquote><p>pfexec pkg search -r gcc
</p></blockquote>
<blockquote><p>
Generated this output at my system:<br />
INDEX      ACTION    VALUE                     PACKAGE<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.86<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.79<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.75<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.86<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.89<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.90<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.91<br />
basename   link      usr/bin/gcc               pkg:/SUNWgcc@3.4.3-0.93
</p></blockquote>
<p>Then, to install a package (gcc in this case):</p>
<blockquote><p>
pfexec pkg install SUNWgcc
</p></blockquote>
<p>Then I found out that there are other IPS repository&#8217;s that I can use (<a href="http://www.blastwave.org">www.blastwave.org</a> and <a href="http://sunfreeware.com">sunfreeware.com</a>). Now, how do I add them?</p>
<blockquote><p>
pfexec pkg set-authority -O http://pkg.sunfreeware.com:9000/ Companion<br />
pfexec pkg set-authority -O http://blastwave.network.com:10000/ Blastwave
</p></blockquote>
<p>To see what repositories you have in your system, do:</p>
<blockquote><p>
pkg authority
</p></blockquote>
<p>I&#8217;ve noticed that it&#8217;s not always &#8220;pkg search&#8221; will find the package I&#8217;m looking for, so now I always check the package sites (<a href="http://blastwave.network.com:10000/">http://blastwave.network.com:10000/</a> and <a href="http://pkg.sunfreeware.com:9000/">http://pkg.sunfreeware.com:9000/</a>) manually if I don&#8217;t get a hit with &#8220;pkg search&#8221;.</p>
<p>To do a &#8216;full&#8217; update of your system:</p>
<p>It it always recommended to upgrade PKG to the latest version first so do this:</p>
<blockquote><p>
BUILD=`uname -v | sed s/snv_//`<br />
pfexec pkg refresh<br />
pfexec pkg install SUNWipkg@0.5.11-0.$BUILD<br />
pfexec pkg install entire@0.5.11-0.$BUILD</p>
<p>pfexec pkg image-update</p>
<p>This will also create a ZFS snapshot of your current system before the upgrade, and then do a update.<br />
<strong>Important:</strong><br />
Remeber to update GRUB afterwards like this:</p>
<p>beadm list (you&#8217;ll see an BE that has &#8216;Activate on reboot&#8217;=YES, notice this name.)
</p></blockquote>
<p>In the last versions, this won&#8217;t be the case by default. Then do &#8216;pfexec beadm activate name (name is the last entry, like opensolaris-x)</p>
<blockquote><p>
pfexec beadm mount opensolaris-x /mnt<br />
pfexec /mnt/boot/solaris/bin/update_grub -R /mnt<br />
pfexec beadm unmount opensolaris-x
</p></blockquote>
<p><strong>Important:</strong><br />
If you have a pre build 93 system (run: &#8216;uname -v&#8217; to see what you have), you <em>MUST</em> read this page: <a href="http://mail.opensolaris.org/pipermail/indiana-discuss/2008-July/007664.html">http://mail.opensolaris.org/pipermail/indiana-discuss/2008-July/007664.html</a>. And it&#8217;s even more important if you have build 86 (as I had when installing from the latest OS2008.05).</p>
<p>Edit: Added some stuff to the &#8216;image-update&#8217; part.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/grapz.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/grapz.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grapz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grapz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grapz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grapz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/grapz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/grapz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/grapz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/grapz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grapz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grapz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grapz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grapz.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grapz.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grapz.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=5&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grapz.wordpress.com/2008/07/23/new-to-opensolaris-200805-i-was/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">grapz</media:title>
		</media:content>
	</item>
		<item>
		<title>Perl script to change desktop background in GNOME</title>
		<link>http://grapz.wordpress.com/2008/07/23/perl-script-to-change-desktop-background-in-gnome/</link>
		<comments>http://grapz.wordpress.com/2008/07/23/perl-script-to-change-desktop-background-in-gnome/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 05:04:24 +0000</pubDate>
		<dc:creator>grapz</dc:creator>
				<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://grapz.wordpress.com/?p=3</guid>
		<description><![CDATA[This doesn&#8217;t work in the latest releases of Gnome. For some reason, I don’t like having the same background for an extended amount of time (as in, more than 15 minutes). Call me crazy, but that’s just how it is. So when I bought my current laptop (Asus G1S), it came pre-installed with Windows Vista [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=3&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="entry">
<p><strong>This doesn&#8217;t work in the latest releases of Gnome.</strong></p>
<p>For some reason, I don’t like having the same background for an extended amount of time (as in, more than 15 minutes). Call me crazy, but that’s just how it is.</p>
<p>So when I bought my current laptop (Asus G1S), it came pre-installed with Windows Vista Ultimate, so I figured I’d give it a try. With the sidebar thing I found an widget that changed my desktop background every 15 minutes or whatever I liked. Hmm, cool enough, but I don’t like that sidebar, and for some reason Win Vista always seem to run awfully slow on my computers (maybe it’s just me abusing them).</p>
<p>Anyways, after a few days, I’ve had enough with Vista. So I decided to give good old Win XP SP2 a try on this brand new baby. After an install, things are flying like crazy, but nothing is changing my desktop background :\</p>
<p>After some checking around, it seems that in a vanilla XP, it ain’t possible to change the desktop background by command line or even by API as far as I found. So I was stuck changing it manually.</p>
<p>A few weeks ago, I’d had enough of Windows XP (as I always do after a little while). I downloaded Ubunty Hardy, installed it, and always I was happy when I saw the comforting GNOME desktop. Ahhh.</p>
<p>But still, my background isn’t changing by itself <img class="wp-smiley" src="http://blog.grapz.net/wp-includes/images/smilies/icon_surprised.gif" alt="o" /> Must fix.<br />
The “easy” solution (atleast in my head), write a perl script that manages it for me.</p>
<p>My starting point was this:</p>
<ul>
<li>All my wallpapers are in one folder.</li>
<li>Not all images matches my desktop resolution.</li>
<li>I don’t really wanna think about what resolution I’m running, I want the script to figure it out themself.</li>
</ul>
<p>So, this is what I ended up with:</p>
<p>You need Image:Size to be able to use this script. If you&#8217;re running Ubuntu, just do:<br />
sudo apt-get install libimage-size-perl</p>
<blockquote><p>
#!/usr/bin/perl<br />
use Image::Size;## Set this to 0 if you don’t want this program to do anything<br />
$go = 1;</p>
<p>## Desktop background changer for GNOME<br />
## By Anders Østhus (grapz666+perl@gmail.com)<br />
## 27-04-2008<br />
##<br />
## You are free to use and spread this code as you like<br />
## If you are spreading this code, or hacking on it for your own use<br />
## I would appreciate a e-mail about it, just so I know that someone<br />
## is actually useing it for something.<br />
##<br />
## Usage: ./wallpaper.pl /path/to/wallpapers/</p>
<p>if ($go eq 0) {<br />
  exit();<br />
}</p>
<p>## Some variable declarations<br />
@files = ();<br />
$dir = “”;<br />
$dir = @ARGV[0];<br />
$previmg = “”;<br />
$wall = “”;</p>
<p>## If you want a different background color, you can chage it here.<br />
$bgcolor1 = “#000000″;<br />
$bgcolor2 = “#000000″;</p>
<p>## Get the current image<br />
$previmg = `gconftool -g /desktop/gnome/background/picture_filename`;<br />
$wall = $previmg;</p>
<p>opendir(BIN, $dir) or die “Can’t open $dir: $!”;</p>
<p>while( defined ($file = readdir BIN) ) {<br />
  if ( $file eq “..”) {<br />
  } elsif ( $file eq “.”) {<br />
  } elsif ( $file eq “Thumbs.db”) {<br />
  } else {<br />
    push(@files, $file);<br />
  }<br />
}</p>
<p>## Find out what resolution we are running…<br />
## Current resolution ends up in $tmpres[3]<br />
$res = `/usr/bin/xrandr | grep ‘*’`;<br />
@tmpres = split(/ /, $res);<br />
@subres = split(/x/, $tmpres[3]);</p>
<p>## As long as the selected image is the same as the previous image<br />
## we select a new one<br />
while ($wall eq $previmg) {<br />
  $wall = $dir . @files[&amp;getRand];<br />
}</p>
<p>## Get the resolution of the image<br />
my ($size_x, $size_y) = Image::Size::imgsize($wall);</p>
<p>## Sets the background image<br />
$cmd = `gconftool -s /desktop/gnome/background/picture_filename “$wall” -t string`;</p>
<p>## If the image is the same resolution as the desktop, set it centered<br />
## If the image is smaller than the desktop, we keep it centered<br />
## If the image is larger than the desktop, we set it to scaled<br />
if ($subres[0] &gt; $size_x || $subres[1] &gt; $size_y) {<br />
  $cent = “centered”;<br />
}<br />
if ($subres[0] &lt; $size_x || $subres[1] &lt; $size_y) {<br />
  $cent = &#8220;scaled&#8221;;<br />
}<br />
if ($subres[0] eq $size_x &amp;&amp; $subres[1] eq $size_y) {<br />
  $cent = &#8220;centered&#8221;;<br />
}</p>
<p>## Sets scaling option and background color(s).<br />
## Also sets &#8216;draw_background&#8217; to &#8217;1&#8242;, incase something has turned it off.<br />
$cmd2 = `gconftool -s /desktop/gnome/background/picture_options $cent -t string`;<br />
$cmd3 = `gconftool -s /desktop/gnome/background/primary_color $bgcolor1 -t string`;<br />
$cmd4 = `gconftool -s /desktop/gnome/background/secondary_color $bgcolor2 -t string`;<br />
$cmd5 = `gconftool -s /desktop/gnome/background/draw_background 1 -t bool`;</p>
<p>closedir(BIN);</p>
<p>## The function that returns a random image from the image array<br />
sub getRand {<br />
  my $range = scalar(@files);<br />
  return int(rand($range));<br />
}
</p></blockquote>
<p>And then I’ve just added this line in my crontab:</p>
<blockquote><p>
*/5 * * * * /home/grapz/devel/perl/wallpaper.pl /media/sda5/wallpaper/
</p></blockquote>
<p>This makes sure that this script runs every 5 minutes, every day of the week, every week of the month, every month of the year and so on.</p></div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/grapz.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/grapz.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/grapz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/grapz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/grapz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/grapz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/grapz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/grapz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/grapz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/grapz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/grapz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/grapz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/grapz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/grapz.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/grapz.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/grapz.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=grapz.wordpress.com&amp;blog=4299919&amp;post=3&amp;subd=grapz&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://grapz.wordpress.com/2008/07/23/perl-script-to-change-desktop-background-in-gnome/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">grapz</media:title>
		</media:content>

		<media:content url="http://blog.grapz.net/wp-includes/images/smilies/icon_surprised.gif" medium="image">
			<media:title type="html">o</media:title>
		</media:content>
	</item>
	</channel>
</rss>
