<?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>J-Doc &#187; Open Source</title>
	<atom:link href="http://jsilva.komodoopenlab.com/blog/archives/category/open-source/feed" rel="self" type="application/rss+xml" />
	<link>http://jsilva.komodoopenlab.com/blog</link>
	<description>inclusion, equity, open source</description>
	<lastBuildDate>Sun, 21 Feb 2010 00:14:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>J-Doc got Sparked</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/369</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/369#comments</comments>
		<pubDate>Wed, 17 Jun 2009 01:35:37 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[Disability]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Research]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[assistive]]></category>
		<category><![CDATA[ATRC]]></category>
		<category><![CDATA[cbc]]></category>
		<category><![CDATA[head tracking]]></category>
		<category><![CDATA[radio]]></category>
		<category><![CDATA[spark]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[UofT]]></category>
		<category><![CDATA[wii]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=369</guid>
		<description><![CDATA[Pretty cool piece by Nora Young and the rest of the CBC Spark team about some of the work we have been doing over at the Adaptive Technology Resource Centre.
Check out the podcast here:
http://www.cbc.ca/spark/2009/06/episode-82-june-17-20-2009/
and the video clip Nora mentioned here:

]]></description>
			<content:encoded><![CDATA[<p>Pretty cool piece by Nora Young and the rest of the <a href="http://www.cbc.ca/spark/">CBC Spark</a> team about some of the work we have been doing over at the <a href="http://atrc.utoronto.ca/">Adaptive Technology Resource Centre</a>.</p>
<p>Check out the podcast here:<br />
<a href="http://www.cbc.ca/spark/2009/06/episode-82-june-17-20-2009/">http://www.cbc.ca/spark/2009/06/episode-82-june-17-20-2009/</a></p>
<p>and the video clip Nora mentioned here:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/O9agFWeFf_A&#038;hl=en&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/O9agFWeFf_A&#038;hl=en&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/369/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grab video from a DV camera with Kino</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/359</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/359#comments</comments>
		<pubDate>Wed, 10 Jun 2009 14:59:49 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[dv]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[ieee1394]]></category>
		<category><![CDATA[kino]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=359</guid>
		<description><![CDATA[First, you need to make sure you have kino installed:
$ sudo apt-get install kino
then, connect your camera with the firewire cable and make sure the iee1394 module is loaded. Doing:
$ lsmod &#124; grep ieee1394
should give you:
ieee1394              108288  4 dv1394,raw1394,sbp2,ohci1394
Now make sure [...]]]></description>
			<content:encoded><![CDATA[<p>First, you need to make sure you have kino installed:</p>
<pre>$ sudo apt-get install kino</pre>
<p>then, connect your camera with the firewire cable and make sure the <code>iee1394</code> module is loaded. Doing:</p>
<pre>$ lsmod | grep ieee1394</pre>
<p>should give you:</p>
<pre>ieee1394              108288  4 dv1394,raw1394,sbp2,ohci1394</pre>
<p>Now make sure the device <code>/dev/raw1394</code> has been created. Doing:</p>
<pre>$ ls -all /dev/raw1394</pre>
<p>should give you something like:</p>
<pre>crw-rw---- 1 root disk 171, 0 2009-06-10 09:56 /dev/raw1394</pre>
<p>Also, make sure <code>/dev/raw1394</code> belongs to either the <code>disk</code> or <code>video</code> groups. You will notice in the output above that my <code>/dev/raw1394</code> belongs to the <code>disk</code> group, so it&#8217;s ok, but if this is not the case for you, then you can fix it by doing:</p>
<pre>$ sudo chown root.disk /dev/raw1394</pre>
<p>Finally, add yourself to the <code>disk</code> or <code>video</code> groups (whichever group you added the device to):</p>
<pre>$sudo useradd -G [group-name] [user-name]</pre>
<p>Now Kino should be able to recognize the camera and you should be able to transfer your videos to your computer!</p>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/359/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hi-Res Duke Nukem 3D on Linux</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/250</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/250#comments</comments>
		<pubDate>Sun, 29 Mar 2009 14:52:24 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Duke Nukem 3D]]></category>
		<category><![CDATA[FPS]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[Ubuntu 8.04]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=250</guid>
		<description><![CDATA[A long, long time ago in a country far, far away, I used to spend hours playing one of the first 3D first person shooter games that allowed me to do just about anything I wanted. It was so cool to be able to turn lights on and off, look at your own reflection in [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_252" class="wp-caption alignleft" style="width: 277px"><a href="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2009/03/dukenukemss.png"><img class="size-medium wp-image-252" title="Duke Nukem 3D" src="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2009/03/dukenukemss-300x225.png" alt="Screenshot of Duke Nukem 3D with eDuke32" width="267" height="200" /></a><p class="wp-caption-text">Screenshot of Duke Nukem 3D on Linux with eDuke32</p></div>
<p>A long, long time ago in a country far, far away, I used to spend hours playing one of the first 3D first person shooter games that allowed me to do just about anything I wanted. It was so cool to be able to turn lights on and off, look at your own reflection in the mirrors (even if the reflection was carrying the wrong gun) and, yes of course, pee, if you felt like it. All of this was possible in the wonderful world of Duke Nukem 3D. So you can imagine my surprise when I discovered I could turn back the clock to my teenage years and enjoy, once again, the full agency of my virtual presence in post-apocalyptic Hollywood, thanks, of course, to the magic of Linux.</p>
<p>The code that will make this happen for you is located on the <a title="eduke32 source code" href="http://wiki.eduke32.com/stuff/source_code/">eDuke32 wiki page</a>. <a title="eDuke32" href="http://www.eduke32.com/">eDuke32</a> is an open source port of the original engine and it works like a charm. This is how you make it work:</p>
<ol>
<li>Download and extract the most recent source package. It should be named something like: <code>eduke32_src_YYYYMMDD.zip</code>, where YYYYMMDD is the release date.</li>
<li>It is also a good idea to download the most recent patch, which will be named <code>eduke32_src_YYYYMMDD.diff</code>, into the same directory where you extracted the source code.</li>
<li> To apply the patch, do:
<pre><code>$ patch -p3 &lt; eduke32_src_YYYYMMDD.diff</code></pre>
<p>from the directory where you extracted the source code.</li>
<li>Make sure you have the required dependencies:
<pre><code>$ sudo aptitude install libsdl1.2-all libsdl1.2-dev libsdl-mixer1.2-dev libsdl-sound1.2-dev nasm</code></pre>
</li>
<li>Now <code>cd</code> into the <code>eduke32_src_YYYYMMDD</code> directory and type <code>make</code> like this:
<pre><code>$ cd eduke32_src_YYYYMMDD/
$ make</code></pre>
</li>
<li>More detailed information is available on the <a title="eDuke32 site" href="http://www.eduke32.com/">eDuke32 site</a>, the <a title="eDuke32 wiki" href="http://wiki.eduke32.com/wiki/Installation_and_configuration">eDuke32 wiki</a> and the <a title="Hi-Res pack site" href="http://hrp.duke4.net/">high resolution pack site</a>. Enjoy!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/250/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video editing with Linux</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/245</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/245#comments</comments>
		<pubDate>Sun, 22 Feb 2009 23:17:16 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[mencoder]]></category>
		<category><![CDATA[Ubuntu 8.04]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=245</guid>
		<description><![CDATA[Join multiple videos:
$ mencoder -oac copy -ovc copy -o joined.avi clip1.avi clip2.avi [...]
Extract a clip from a video:
$ ffmpeg -qscale 1 -acodec mp3 -ab 256k -ss [start time in hh:mm:ss] \
   -t [length in hh:mm:ss] -i video.avi clip.avi 
Dump the audio:
$ mplayer -vc null -vo null -ao pcm -benchmark test.avi 
Grab an image [...]]]></description>
			<content:encoded><![CDATA[<p>Join multiple videos:</p>
<pre>$ mencoder -oac copy -ovc copy -o joined.avi clip1.avi clip2.avi [...]</pre>
<p>Extract a clip from a video:</p>
<pre>$ ffmpeg -qscale 1 -acodec mp3 -ab 256k -ss [start time in hh:mm:ss] \
   -t [length in hh:mm:ss] -i video.avi clip.avi </pre>
<p>Dump the audio:</p>
<pre>$ mplayer -vc null -vo null -ao pcm -benchmark test.avi </pre>
<p>Grab an image from a video:</p>
<pre>$ ffmpeg -i movie.avi -ss [time-in-seconds] -vframes 1 -f image2 frame.jpg</pre>
<p>Overlay an image on a video:</p>
<pre>$ ffmpeg -i input.avi -vhook '/usr/lib/vhook/imlib2.so -x 0 -y 0 -i overlay.png' output.avi</pre>
<p>Encode a Windows-compatible video:</p>
<pre>$ mencoder -oac mp3lame -ovc lavc -lavcopts vcodec=msmpeg4v2:vhq:vbitrate=1600
  -o videoout.avi videoin.xxx</pre>
<p>with a separate audio file:</p>
<pre>$ mencoder -audiofile audiofile.wav -oac mp3lame -ovc lavc
-lavcopts codec=msmpeg4v2:vhq:vbitrate=1600 -o videoout.avi videoin.xxx</pre>
<p>There is also a good guide on how use <code>ffmpeg</code> to create FLV videos for posting online here:<br />
<a href="http://scott.yang.id.au/2006/07/flash-video-ffmpeg-flowplayer/">http://scott.yang.id.au/2006/07/flash-video-ffmpeg-flowplayer/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/245/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy scripts and configurations for Gnome-Compiz</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/182</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/182#comments</comments>
		<pubDate>Sun, 04 Jan 2009 03:34:48 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[audacity]]></category>
		<category><![CDATA[avidemux]]></category>
		<category><![CDATA[compiz]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[thunderbird]]></category>
		<category><![CDATA[Ubuntu 8.04]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=182</guid>
		<description><![CDATA[Change Gnome panel font color
To change the colour of the fast user switching applet, open the file to edit the colours with:
$ gedit .gtkrc-2.0
Then add these lines into the file (#FFFFFF for white):
style "modpanel" {
    fg[NORMAL] = "#FFFFFF"
}
widget "*PanelWidget*" style "modpanel"
widget "*PanelApplet*" style "modpanel"
widget "*fast-user-switch-applet*" style "modpanel"
Now run this code to reload [...]]]></description>
			<content:encoded><![CDATA[<h2>Change Gnome panel font color</h2>
<p>To change the colour of the fast user switching applet, open the file to edit the colours with:</p>
<pre>$ gedit .gtkrc-2.0</pre>
<p>Then add these lines into the file (<code>#FFFFFF</code> for white):</p>
<pre>style "modpanel" {
    fg[NORMAL] = "#FFFFFF"
}
widget "*PanelWidget*" style "modpanel"
widget "*PanelApplet*" style "modpanel"
widget "*fast-user-switch-applet*" style "modpanel"</pre>
<p>Now run this code to reload the panels:</p>
<pre>$ killall gnome-panel</pre>
<p style="text-align: center;">(Taken from http://ubuntuforums.org/showpost.php?p=4315463&amp;postcount=10)</p>
<h2>Change desktop folder in Gnome</h2>
<p>You need to edit the file <code>~/.config/user-dirs.dirs</code>:</p>
<pre>$ nano ~/.config/user-dirs.dirs</pre>
<p>Modify the <code>XDG_DESKTOP_DIR</code> entry as needed. For instance:</p>
<pre>XDG_DESKTOP_DIR="$HOME/.desktop"</pre>
<h2>Make Audacity work with Pulseaudio</h2>
<p>Rename the file <code>/usr/bin/audacity</code> to <code>/usr/bin/audacity.original</code>:</p>
<pre>$ sudo mv /usr/bin/audacity /usr/bin/audacity.original</pre>
<p>Create a new <code>/usr/bin/audacity</code> file using:</p>
<pre>$ sudo gedit /usr/bin/audacity</pre>
<p>Then write the following lines into the file:</p>
<pre>#!/bin/bash

padsp audacity.original "$@"</pre>
<p>Save the file and make it executable:</p>
<pre>$ sudo chmod +x /usr/bin/audacity</pre>
<p>Enjoy! You can use the same trick with Skype and avidemux</p>
<h2>Make Thunderbird the preferred email application for KDE</h2>
<p>Modify the file <code>$ ~/.kde/share/config/emaildefaults</code> so it looks like this:</p>
<pre>[Defaults]
Profile=Default

[PROFILE_Default]
EmailAddress=
EmailClient[$e]=thunderbird
FullName=First Last
Organization=
ReplyAddr=
ServerType=
TerminalClient=false</pre>
<h2>Change Icon Size in Konqueror</h2>
<p>Under the <code>[Settings]</code> section in <code>$ ~/.kde/share/config/konqiconviewrc</code> modify the following parameter:</p>
<pre>IconSize=48</pre>
<h2>Turn off the PC Speaker (Bell)</h2>
<ol>
<li>Uncomment the following line on <code>/etc/inputrc</code>:
<pre>set bell-style visible</pre>
</li>
<li>Restart</li>
</ol>
<h2>Custom Icons</h2>
<p>A complete tutorial is <a title="Custom icons in gnome" href="http://ubuntu-tutorials.com/2008/06/19/adding-custom-icons-and-disabling-desktop-icons-in-gnome/">available here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/182/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make compiz-fusion work with xscreensaver (the quick &amp; dirty way)</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/187</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/187#comments</comments>
		<pubDate>Mon, 24 Nov 2008 04:09:59 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[compiz]]></category>
		<category><![CDATA[compiz-fusion]]></category>
		<category><![CDATA[gkrellm]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[metacity]]></category>
		<category><![CDATA[Ubuntu 8.04]]></category>
		<category><![CDATA[wmctrl]]></category>
		<category><![CDATA[xscreensaver]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=187</guid>
		<description><![CDATA[The beautiful desktop experience provided by compiz-fusion represents a significant aesthetic contribution to the pleasure of using Linux. Besides, it makes it really easy to impress even the most committed Apple disciple. The same is true for the cool gl screensavers written for xscreensavers. Unfortunately, these two don&#8217;t really work together (my computer freezes everytime [...]]]></description>
			<content:encoded><![CDATA[<p>The beautiful desktop experience provided by <a title="compiz-fusion compositing engine" href="http://www.compiz-fusion.org/">compiz-fusion</a> represents a significant aesthetic contribution to the pleasure of using Linux. Besides, it makes it really easy to impress even the most committed Apple disciple. The same is true for the cool gl screensavers written for <a title="xscreensaver homepage" href="http://www.jwz.org/xscreensaver/">xscreensavers</a>. Unfortunately, these two don&#8217;t really work together (my computer freezes everytime xscreensaver comes up while running compiz-fusion) and although the screensaver plugin for compiz-fusion shows <a title="compiz fusion screensaver plugin" href="http://www.youtube.com/watch?v=sigmLNbF0AU">great potential</a>, the gl collection for xscreensaver is still a bit ahead and has a lot more variety, so I really wanted to make them work together.</p>
<p>Here is what I did:</p>
<ol>
<li>You can use <code>xscreensaver-command -watch</code> to monitor xscreensaver events, so you can actually run a program when xscreensaver is activated (for example, to disable compiz-fusion), and another one when it is deactivated (to bring compiz-fusion back). I modified the following script available from the <a title="xscreensaver man pages" href="http://www.jwz.org/xscreensaver/man3.html">xscreensaver man pages</a> and saved it as <code>~/bin/fixscreensaver</code>:
<pre>#!/usr/bin/perl

# Fixes xscreensaver when compiz is running

my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while () {
  if (m/^(BLANK|LOCK)/) {
    if (!$blanked) {
      system "usemetacity";
      $blanked = 1;
    }
  } elsif (m/^UNBLANK/) {
    system "usecompiz";
    $blanked = 0;
  }
}</pre>
</li>
<li>As you can see, the script above calls <code>usemetacity</code> when xscreensaver is activated and <code>usecompiz</code> when it is deactivated. Save the following script as <code>~/bin/usemetacity</code>:
<pre>#!/bin/bash

#killall gkrellm
metacity --replace &amp;
#sleep 1
#gkrellm &amp;</pre>
</li>
<li>Now save this one as <code>~/bin/usecompiz</code>:
<pre>#!/bin/bash

#killall gkrellm
compiz --replace &amp;
#sleep 2
#gkrellm &amp;
#windowranger</pre>
</li>
<li>Add <code>~/bin/fixscreensaver</code> to the list of startup applications (System &gt; Preferences &gt; Sessions &gt; Startup programs) and also make sure that <code>~/bin/</code> is in your $PATH environment variable.</li>
<li><strong>Optional</strong>: If you use gkrellm, you should uncomment the corresponding lines in the scripts above. Those lines will prevent metacity (the default gnome window manager) and compiz-fusion from changing the position of the gkrellm window, which happens everytime you switch between the two because these window managers use different ways to describe desktop geometry.</li>
<li><strong>Optional</strong>: You can also use the <code>usecompiz</code> and <code>usemetacity</code> scripts to manage any other application that misbehaves when metacity or compiz-fusion take over your desktop. In fact, I use the <code>windowranger</code> script below to automatically put windows back into their corresponding viewports since everything gets shoved into the first viewport once you go back into compiz from metacity (thanks for pointing it out <strong>darken</strong>). You will need <code>wmctrl</code> for this to work properly:
<pre>#!/usr/bin/python

import os, time, wnck, sys

def dec2hex(n):
  #"""return the hexadecimal string representation of integer n"""#
  return "%X" % n

def hex2dec(s):
  #"""return the integer value of a hexadecimal string s"""#
  return int(s, 16)

def MoveWindow(wID, wtitle, xpos, ypos):

    time.sleep(0.2)
    os.system('wmctrl -i -r ' + wID + ' -e 0,'+str(xpos)+','+str(ypos)+',-1,-1')
    #time.sleep(0.4)
    #os.system('wmctrl -i -a ' + wID)
    if DEBUG: print "Moved to", xpos, ypos, 'n'

def Place(x, y, wID, wclass, wtitle):

  fin,dout = os.popen4('wmctrl -d')   # output desktop geometry
  for line in dout:
    line = line[line.find('VP: ') + 4:len(line)]  # get current viewport offset
    line = line[0:line.find(' ')]
    offset = line.split(',')      # split in x,y viewport offset coordinates
    vpxpos = int(offset[0])       # convert into integer
    vpypos = int(offset[1])       # convert into integer
    absxpos = vpxpos+x            # absolute window position (x)
    absypos = vpypos+y            # absolute window position (y)
    wxpos = absxpos
    wypos = absypos
    while wxpos &gt;= width:
      wxpos = wxpos - width       # relative window position (x)
    while wypos &gt;= height:
      wypos = wypos - height      # relative window position (y)
    if (wxpos &gt;= 0)&amp;(wxpos &lt;= 2): wxpos = 0
    if (wypos &gt;= 0)&amp;(wypos &lt;= 2): wypos = 0

  dout.close()                    # close command output
  if DEBUG: print 'Position:', absxpos, 'x', absypos

  #Send Firefox to viewport 1
  if wclass.find('Firefox') != -1:
    # Flash fullscreen windows are titled 'Firefox' so we need to ignore them...
    if wtitle != 'Firefox':
      MoveWindow(wID, wtitle, wxpos - vpxpos + vpx1, wypos - vpypos + vpy1)

  #Send GYachI to viewport 2
  elif wclass.find('GYachI') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx2, wypos - vpypos + vpy2)

  #Send VirtualBox to viewport 5
  elif wclass.find('VirtualBox') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx5, wypos - vpypos + vpy5)

  #Send Amarok to viewport 6
  elif wclass.find('Amarokapp') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx6, wypos - vpypos + vpy6)

  #Send Azureus to viewport 6
  elif wclass.find('SWT') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx6, wypos - vpypos + vpy6)

  #Send Qbittorrent to viewport 6
  elif wclass.find('Qbittorrent') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx6, wypos - vpypos + vpy6)

  #Send Pidgin to viewport 7
  elif wclass.find('Pidgin') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx7, wypos - vpypos + vpy7)

  #Send Skype to viewport 7
  elif wclass.find('Skype') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx7, wypos - vpypos + vpy7)

  #Send Thunderbird to viewport 8
  elif wclass.find('Thunderbird-bin') != -1:
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx8, wypos - vpypos + vpy8)

  #Send all other windows in viewport 1 to viewport 2
  elif (wclass.find('Gnome-panel')==-1)&amp;(wtitle != 'Desktop')&amp;(wclass.find('Gkrellm')==-1)&amp;(wclass.find('Launcher')==-1)&amp;(absxpos &lt; width)&amp;(absypos &lt;= height):
    MoveWindow(wID, wtitle, wxpos - vpxpos + vpx2, wypos - vpypos + vpy2)

  else:
    if DEBUG: print 'Ignoredn'

#---------------------------- MAIN -------------------------------------
s = wnck.screen_get_default()
width = s.get_width()
height = s.get_height()
vpx1 = (width * 0);vpy1 = (height * 0)
vpx2 = (width * 1);vpy2 = (height * 0)
vpx3 = (width * 2);vpy3 = (height * 0)
vpx4 = (width * 3);vpy4 = (height * 0)
vpx5 = (width * 0);vpy5 = (height * 1)
vpx6 = (width * 1);vpy6 = (height * 1)
vpx7 = (width * 2);vpy7 = (height * 1)
vpx8 = (width * 3);vpy8 = (height * 1)
DEBUG = False;

for arg in sys.argv:
  if arg=='--debug':
    DEBUG=True;

if DEBUG: print 'Viewport geometry:', width, 'x', height, 'n'

fin,wout = os.popen4('wmctrl -lGx')
for line in wout:
  wID = line[0:line.find(' ')]                      # get the window ID
  line = line[line.find(' '):len(line)]
  line = line.lstrip()
  wdesk = line[0:line.find(' ')]                    # get the window desktop
  line = line[line.find(' '):len(line)]
  line = line.lstrip()
  wxoffset = line[0:line.find(' ')]                 # get the window x offset
  wxoffset = (int(wxoffset) / 2)
  line = line[line.find(' '):len(line)]
  line = line.lstrip()
  wyoffset = line[0:line.find(' ')]                 # get the window y offset
  wyoffset = (int(wyoffset) / 2) - 24
  line = line[line.find(' '):len(line)]
  line = line.lstrip()
  wwidth = line[0:line.find(' ')]                   # get the window width
  line = line[line.find(' '):len(line)]
  line = line.lstrip()
  wheight = line[0:line.find(' ')]                  # get the window height
  line = line[line.find(' '):len(line)]
  line = line.lstrip()
  wclass = line[0:line.find(' jsilva')]             # get the window class
  line = line[line.find(' jsilva'):len(line)]
  line = line.lstrip()
  whost = line[0:line.find(' ')]                    # get the window host
  line = line[line.find(' '):len(line)]
  line = line.lstrip()
  wtitle = line[0:len(line) - 1]                    # get the window title
  if DEBUG:
    print 'Class:', wclass
    print 'Host:', whost
    print 'Title:', wtitle
  Place(wxoffset,wyoffset,wID,wclass,wtitle)  # place window
wout.close()</pre>
</li>
<li>Enjoy!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/187/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Activate spelling check in OpenOffice 2.4</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/66</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/66#comments</comments>
		<pubDate>Fri, 07 Nov 2008 16:09:29 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[spellcheck]]></category>
		<category><![CDATA[Ubuntu 8.04]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=66</guid>
		<description><![CDATA[For some weird reason, activating the spellcheck on OpenOffice 2.4 seems to be more challenging than it should, and since I just got it working in Ubuntu Hardy Heron, I thougth I should post the solution here:

Go to Tools &#62; Options&#8230;

Select Language Settings &#62; Writing Aids and click on the Edit&#8230; button

Check the boxes for [...]]]></description>
			<content:encoded><![CDATA[<p>For some weird reason, activating the spellcheck on OpenOffice 2.4 seems to be more challenging than it should, and since I just got it working in Ubuntu Hardy Heron, I thougth I should post the solution here:</p>
<ol>
<li>Go to <em>Tools &gt; Options&#8230;</em>
<p><div id="attachment_68" class="wp-caption alignnone" style="width: 293px"><a href="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/oo-tools.png"><img class="size-medium wp-image-68" title="oo-tools" src="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/oo-tools-283x300.png" alt="Openoffice tools menu with options entry highlighted" width="283" height="300" /></a><p class="wp-caption-text">OpenOffice tools menu with options entry highlighted</p></div></li>
<li>Select <em>Language Settings &gt; Writing Aids</em> and click on the <em>Edit&#8230;</em> button
<p><div id="attachment_69" class="wp-caption alignnone" style="width: 310px"><a href="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/writingaids-dialogue.png"><img class="size-medium wp-image-69" title="writingaids-dialogue" src="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/writingaids-dialogue-300x144.png" alt="Writing aids dialogue with edit button highlighted" width="300" height="144" /></a><p class="wp-caption-text">Writing aids dialogue with edit button highlighted</p></div></li>
<li>Check the boxes for the Spelling and Thresaurus modules. This will enable the spellcheck for the language in the <em>Language</em> field, so you should repeat this process with each of the languages you want to use.
<p><div id="attachment_70" class="wp-caption alignnone" style="width: 310px"><a href="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/edit-dialogue.png"><img class="size-medium wp-image-70" title="edit-dialogue" src="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/edit-dialogue-300x144.png" alt="Language module editing dialogue with spelling and thesaurus entries highlighted" width="300" height="144" /></a><p class="wp-caption-text">Language module editing dialogue with spelling and thesaurus entries highlighted</p></div></li>
<li>You should now see the spellcheck symbol beside your chosen language in the language settings dialogue at <em>Tools &gt; Options&#8230; &gt; Language Settings &gt; Language</em>. Enjoy!
<p><div id="attachment_71" class="wp-caption alignnone" style="width: 310px"><a href="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/language-settings-dialogue.png"><img class="size-medium wp-image-71" title="language-settings-dialogue" src="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/language-settings-dialogue-300x144.png" alt="Language settings dialogue with spellcheck symbol highlighted" width="300" height="144" /></a><p class="wp-caption-text">Language settings dialogue with spellcheck symbol highlighted</p></div></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/66/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Encode a windows-compatible video</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/151</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/151#comments</comments>
		<pubDate>Fri, 07 Nov 2008 14:32:33 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=151</guid>
		<description><![CDATA[There are a lot of constantly updated video and audio codecs available in Linux. Unfortunately, the choice in Windows is way more limited. Because of this, it is common that videos compressed with the best and latests codecs in Linux cannot be read by common Windows applications. Luckily, You can encode windows-compatible videos in Linux [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of constantly updated video and audio codecs available in Linux. Unfortunately, the choice in Windows is way more limited. Because of this, it is common that videos compressed with the best and latests codecs in Linux cannot be read by common Windows applications. Luckily, You can encode windows-compatible videos in Linux with <code class="escaped">mencoder</code> by typing the following command:</p>
<pre class="escaped">$ mencoder -oac mp3lame -ovc lavc -lavcopts vcodec=msmpeg4v2:vhq:vbitrate=1600
  -o videoout.avi videoin.xxx</pre>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/151/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Dell D610 lid switch on Ubuntu 8.04</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/119</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/119#comments</comments>
		<pubDate>Tue, 07 Oct 2008 19:10:58 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[GNU | Linux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[D610]]></category>
		<category><![CDATA[GNU linux]]></category>
		<category><![CDATA[Ubuntu 8.04]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=119</guid>
		<description><![CDATA[The lid switch makes the laptop’s screen turn off when the lid is closed and turns it back on when the lid opens. This already worked well in Ubuntu but I needed to tweak the behavior a bit. Sometimes I use a projector as the main display and turn off the laptop’s screen to save [...]]]></description>
			<content:encoded><![CDATA[<p>The lid switch makes the laptop’s screen turn off when the lid is closed and turns it back on when the lid opens. This already worked well in Ubuntu but I needed to tweak the behavior a bit. Sometimes I use a projector as the main display and turn off the laptop’s screen to save some battery, however, Ubuntu turns off ALL displays (including the analog output) when the panel lid is closed, which then leaves me with no screen at all!</p>
<h2>How it Works</h2>
<p>You can determine the state of the lid switch by doing:</p>
<pre>$ cat /proc/acpi/button/lid/LID/state</pre>
<p>In order to turn on/off the backlight of the LCD panel, you can use <code>radeontool</code>. This tool is part of the Ubuntu distribution so you can install it with <a href="https://help.ubuntu.com/community/SynapticHowto">Synaptic</a> (if it is not already installed). After installing both, the <code>laptop-mode-tools</code> (also part of Ubuntu) and <code>radeontool</code> packages, I created the following script:</p>
<pre>#!/bin/bash

LIGHT=$(radeontool light | grep "looks on")

if [ "$LIGHT" = "" ]; then
        radeontool light on
else
        radeontool light off
fi</pre>
<p>This script toggles on/off the backlight of the LCD panel. You can then use <a href="http://hocwp.free.fr/xbindkeys/xbindkeys.html"><code>xbindkeys</code></a> to assign a keyboard shortcut and control the LCD backlight at will.</p>
<h2>Tweaking the Lid Switch Behavior</h2>
<p>In order to set and maintain the state of the backlight when the lid is closed, you can create a daemon and call it with <code>laptop-mode-tools.</code> This is specially handy if some of your applications (usually games) like to turn the panel backlight back on when resetting the video resolution or when going into full screen.</p>
<h3>Step 1</h3>
<p>Comment everything on <code>/etc/acpi/lid.sh</code> and add the following at the end of the script:</p>
<pre>LID_CLOSED=$(cat /proc/acpi/button/lid/LID/state | grep open)
if [ "$LID_CLOSED" = "" ]; then
  /usr/sbin/blightoffd &amp;
else
  /usr/sbin/radeontool light on
fi</pre>
<h3>Step 2</h3>
<p>Save the following script as <code>/usr/sbin/blightoffd</code></p>
<pre>#!/bin/bash

#
# Keeps panel backlight off when computer lid is closed.
#

LID_CLOSED=$(cat /proc/acpi/button/lid/LID/state | grep open)

while [ "$LID_CLOSED" = "" ]; do

  LIGHT_ON=$(/usr/sbin/radeontool light | grep "looks off")
  if [ "$LIGHT_ON" = "" ]; then
    /usr/sbin/radeontool light off
  fi
  sleep 1
  LID_CLOSED=$(cat /proc/acpi/button/lid/LID/state | grep open)

done</pre>
<h3>Step 3</h3>
<p>Disable or uninstall both <code>kpowersave</code> and <code>klaptop</code>.</p>
<h2>Making it all work with <code>powersave</code></h2>
<p>I installed <code>powersaved</code> which is great tool for enabling dynamic control of the CPU speed and save additional power. However, that bugger messed up the scripts controlling the lid switch events. Here is how to fix the problem:</p>
<p>Find the following line in <code>/etc/powersave/events</code>:</p>
<pre>EVENT_BUTTON_LID_CLOSED="xxxxxxx"</pre>
<p>and make sure it says:</p>
<pre>EVENT_BUTTON_LID_CLOSED="ignore"</pre>
<p>This will make <code>powersave</code> ignore lid switch events</p>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/119/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ukelele tuner for the Gameboy Advance</title>
		<link>http://jsilva.komodoopenlab.com/blog/archives/13</link>
		<comments>http://jsilva.komodoopenlab.com/blog/archives/13#comments</comments>
		<pubDate>Wed, 06 Aug 2008 02:30:00 +0000</pubDate>
		<dc:creator>Jorge</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[GameBoy]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://jsilva.komodoopenlab.com/blog/?p=13</guid>
		<description><![CDATA[This weekend I went for a relaxing vacation in a cottage somewhere around Haliburton, Ontario. This is usually also a good opportunity for me to try and remember some chords on the Ukelele that my girlfriend bought for my birthday a couple of years ago. The only problem I have is that I don&#8217;t know [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_163" class="wp-caption alignleft" style="width: 310px"><a href="http://jsilva.komodoopenlab.com/pub/src/ukelele-advance-0.1.tar.gz"><img class="size-medium wp-image-163" title="ukelele_shot_75" src="http://jsilva.komodoopenlab.com/blog/wp-content/uploads/2008/11/ukelele_shot_75-300x225.png" alt="GameBoy ukelele tuner screenshot" width="300" height="225" /></a><p class="wp-caption-text">GameBoy ukelele tuner screenshot</p></div>
<p>This weekend I went for a relaxing vacation in a cottage somewhere around Haliburton, Ontario. This is usually also a good opportunity for me to try and remember some chords on the Ukelele that my girlfriend bought for my birthday a couple of years ago. The only problem I have is that I don&#8217;t know how to tune the thing. Normally, I would go to a site like the <a href="http://www.get-tuned.com/ukulele_tuner.php">online Ukelele tuner</a> before I get started. But without a computer and internet access, I would be stuck with no way to tune the Ukelele in the cottage.</p>
<p>Luckily, after a bit of thinking and half an hour of coding, I came up with a tuner that I flashed into one of the Gameboy Advance units I have for the <a href="http://www.komodoopenlab.com/index.php/Portfolio/OpenEADL">OpenEADL project</a> (check it out). The tuner worked great, and because the Gameboy is so power efficient, I didn&#8217;t have to charge it even once in the whole weekend!</p>
<p>You can <a href="http://www.komodoopenlab.com/jsilva/pub/src/ukelele-advance-0.1.tar.gz">download the code for the tuner from here</a> (I included the compiled <code class="escaped">ukelele-advance.gba</code> ROM). If you want to know how to modify, compile and flash the ROM into a Gameboy cartridge, read <a href="http://wiki.komodoopenlab.com/index.php/Tutorials/OpenEADL">this tutorial</a>. You can also run the ROM in an emulator like <a href="http://vba.ngemu.com/">VisualBoy Advance</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jsilva.komodoopenlab.com/blog/archives/13/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
