<?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>Gubatron.com &#187; Code</title>
	<atom:link href="http://www.gubatron.com/blog/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gubatron.com/blog</link>
	<description>Another Venezuelan Geek in New York</description>
	<lastBuildDate>Mon, 15 Mar 2010 02:48:07 +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>Quick N Dirty way to Map Commands to remote servers via ssh</title>
		<link>http://www.gubatron.com/blog/2009/10/10/map-commands-to-servers-via-ssh/</link>
		<comments>http://www.gubatron.com/blog/2009/10/10/map-commands-to-servers-via-ssh/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 18:19:15 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[convenience]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1457</guid>
		<description><![CDATA[You may be running several independent but similar servers at the same time and wasting time by executing commands in all of them one by one.
Wouldn&#8217;t it be nice to send a command to all of them at once? or to monitor all of them at once.
The following script can be used as a building [...]]]></description>
			<content:encoded><![CDATA[<p>You may be running several independent but similar servers at the same time and wasting time by executing commands in all of them one by one.</p>
<p>Wouldn&#8217;t it be nice to send a command to all of them at once? or to monitor all of them at once.</p>
<p>The following script can be used as a building block to more complex automation tasks for a small size set of servers. (If you&#8217;re managing over 50 servers, I&#8217;d probably consider looking a different way to arrange servers (map/reduce cluster), but if you&#8217;re doing something below that number this might suffice)</p>
<pre>
#!/usr/bin/python                                                                                                                                                                                                                                                      

#########################################################
# Author: Angel Leon (gubatron@gmail.com) - October 2009
#
# Invokes a command locally and invokes the same command
# in all machines under the specified username, servers
#
# Requirement: Have a public ssh_key for that user on all
# the other machines so you don't have to authenticate
# on all the other machines.
#########################################################
import sys
import os

# set the username that has access to all the machines here
user='safeuser'

# add all your server names here
servers=['server1.mydomain.com','server2.mydomain.com','server3.mydomain.com']

if __name__ == "__main__":
  if len(sys.argv) < 2:
    print "Usage: ssh_map_command <cmd>"
    sys.exit(0)

  cmd= ' '.join(sys.argv[1:])

  #Execute locally first
  print cmd
  os.system(cmd)

  #Execute for all the servers in the list
  for server in servers:
    remote_cmd="ssh %s@%s %s" % (user,server,cmd)
    print remote_cmd
    os.system(remote_cmd)
    print
</pre>
<p>Save as ssh_map_command and chmod +x it. </p>
<p><strong>Sample uses</strong><br />
Check the average load of all machines at once (then use output to mitigate high load issues)</p>
<pre>$ ssh_map_command uptime</pre>
<p>Send HUP signal to all your web servers (put it in an alias or other script&#8230; and that&#8217;s how you start building more complex scripts)</p>
<pre>$ ssh_map_command ps aux | grep [l]ighttpd | kill -HUP `awk {'print $2'}`</pre>
<p>Check if processes are alive, check memory usage on processes across different machines, <a href="http://en.wikipedia.org/wiki/Grep" target="_blank" rel="nofollow">grep</a> remote all logs at once, <a href="http://subversion.tigris.org/" target="_blank" rel="nofollow">svn up</a> on all machines, <a href="http://samba.anu.edu.au/rsync/" target="_blank" rel="nofollow">rsync</a> from one to many, hey, you can even <a href="http://en.wikipedia.org/wiki/Tail_%28Unix%29" target="_blank" rel="nofollow">tail -f</a> and grep all the logs at once, you can go nuts with this thing. Depends on what you need to do.</p>
<p><strong>Requirements</strong></p>
<ul>
<li>For convenience you should probably <a href="http://linuxproblem.org/art_9.html" target="_blank" rel="nofollow">set up ssh public/private keys between the main machine and the other machines</a> (or they can all trust each other and you can execute on any) so that you can execute commands on all the machines without having to enter passwords.</li>
<li>Put the script on your $PATH.</li>
<li><a href="http://python.org/" target="_blank" rel="nofollow">python</a></li>
</ul>
<p><strong>Security Advisory</strong><br />
Make sure only the desired user has read/write/execute access to it and keep your private ssh keys safe (preferably only read and execute for the owner, and no permissions whatsoever to anybody else <strong>chmod 500 ssh_mod_map</strong>), if possible change them as often as possible, for it may become a big security whole if an attacker can manage to write code on this script, specially if you have <strong>cronjobs</strong> invoking it. Your attacker would only need to change code here to mess up all of your machines.</p>
<p><strong>Disclaimer and Call for Knowledge</strong><br />
<img src="http://farm4.static.flickr.com/3607/3677330708_6d68fc4ce0_m.jpg" class="alignleft"/>Please, if someone knows of a standard way to map commands to multiple servers, please let me know in the comment section, in my case I needed a solution and I wrote a quick and dirty python script and tried to secure it as best as I could, by no means I&#8217;m saying that this is the best solution to mapping commands, in fact I believe it might be the least efficient way, however it works good enough for my personal needs.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F&amp;title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F&amp;title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F&amp;title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F&amp;headline=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F&amp;title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fmap-commands-to-servers-via-ssh%2F&amp;title=Quick+N+Dirty+way+to+Map+Commands+to+remote+servers+via+ssh"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/10/10/map-commands-to-servers-via-ssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu/Debian Quick Reference: How To Change Your Server&#8217;s UTC Timezone on the command line</title>
		<link>http://www.gubatron.com/blog/2009/10/10/ubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line/</link>
		<comments>http://www.gubatron.com/blog/2009/10/10/ubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 16:27:00 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[time zone]]></category>
		<category><![CDATA[time zones]]></category>
		<category><![CDATA[timezone]]></category>
		<category><![CDATA[timezones]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[utc]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1447</guid>
		<description><![CDATA[Just Type&#8230;
sudo dpkg-reconfigure tzdata

&#8230;and follow the instructions on screen.
The process should look something like the following:


Select your Region

Select a city on your time zone

You&#8217;re done.
Tip
You can always check the status of your configuration using
sudo debconf-show tzdata
You could for example map that command via ssh to several machines and grep for &#8220;*&#8221;, that way you could [...]]]></description>
			<content:encoded><![CDATA[<p>Just Type&#8230;<br />
<strong><code>sudo dpkg-reconfigure tzdata</code><br />
</strong></p>
<p>&#8230;and follow the instructions on screen.</p>
<p>The process should look something like the following:</p>
<p><img src="http://www.gubatron.com/blog/wp-content/uploads/2009/10/tzdata_sshot_01.png"/></p>
<p><img src="http://www.gubatron.com/blog/wp-content/uploads/2009/10/tzdata_sshot_02.png"/><br />
Select your Region</p>
<p><img src="http://www.gubatron.com/blog/wp-content/uploads/2009/10/tzdata_sshot_03.png"/><br />
Select a city on your time zone</p>
<p><img src="http://www.gubatron.com/blog/wp-content/uploads/2009/10/tzdata_sshot_04.png"/><br />
You&#8217;re done.</p>
<p><strong>Tip</strong><br />
You can always check the status of your configuration using<br />
<code>sudo debconf-show tzdata</code></p>
<p>You could for example map that command via ssh to several machines and grep for &#8220;*&#8221;, that way you could easily spot servers with wrong timezones very quickly.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Ubuntu%2F...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F&amp;title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F&amp;title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F&amp;title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F&amp;headline=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F&amp;title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F10%2F10%2Fubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line%2F&amp;title=Ubuntu%2FDebian+Quick+Reference%3A+How+To+Change+Your+Server%27s+UTC+Timezone+on+the+command+line"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/10/10/ubuntudebian-quick-reference-how-to-change-your-servers-utc-timezone-on-the-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Check the Top 10 Linux Commands you can&#8217;t live without</title>
		<link>http://www.gubatron.com/blog/2009/09/28/check-the-top-10-linux-commands-you-cant-live-without/</link>
		<comments>http://www.gubatron.com/blog/2009/09/28/check-the-top-10-linux-commands-you-cant-live-without/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 02:36:13 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[favorite]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1419</guid>
		<description><![CDATA[Type the following on your cmd line (or make into an alias)

cat ~/.bash_history &#124; sort &#124; uniq -c &#124; sort -r &#124; head

In my case they are (for this week)
ls
fg
svnSync (script I created)
stats_fetch; stats_display (other scripts)
cd
crontab -e
ps aux &#124; grep
ssh_map_command (another script)
python
emacs -nw

]]></description>
			<content:encoded><![CDATA[<p>Type the following on your cmd line (or make into an alias)</p>
<pre>
cat ~/.bash_history | sort | uniq -c | sort -r | head
</pre>
<p>In my case they are (for this week)</p>
<pre>ls
fg
svnSync (script I created)
stats_fetch; stats_display (other scripts)
cd
crontab -e
ps aux | grep
ssh_map_command (another script)
python
emacs -nw
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Check+the+Top+10+Linux+Commands+you+can%26%238...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F&amp;title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F&amp;title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F&amp;title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F&amp;headline=Check+the+Top+10+Linux+Commands+you+can%27t+live+without"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Check+the+Top+10+Linux+Commands+you+can%27t+live+without&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F&amp;title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F09%2F28%2Fcheck-the-top-10-linux-commands-you-cant-live-without%2F&amp;title=Check+the+Top+10+Linux+Commands+you+can%27t+live+without"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/09/28/check-the-top-10-linux-commands-you-cant-live-without/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML 5 is out and about</title>
		<link>http://www.gubatron.com/blog/2009/07/11/html-5-is-out-and-about/</link>
		<comments>http://www.gubatron.com/blog/2009/07/11/html-5-is-out-and-about/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 11:59:03 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1324</guid>
		<description><![CDATA[I believe that the &#60;canvas>, &#60;audio>and &#60;video> tags will make the web a pretty exciting place. A lot of Flash components will be rewritten or converted into Javascript+HTML5 Object components making available more reusable elements for a graphical and interactive web, all being open sourced (javascript) and with no extra plugins needed.
Some places where we [...]]]></description>
			<content:encoded><![CDATA[<p>I believe that the &lt;canvas>, &lt;audio>and &lt;video> tags will make the web a pretty exciting place. A lot of Flash components will be rewritten or <a href="http://www.jangaroo.net/home/">converted</a> into <a href="http://www.blarnee.com/projects/cflow/" target="_blank">Javascript+HTML5 Object components</a> making available more reusable elements for a graphical and interactive web, all being open sourced (javascript) and with no extra plugins needed.</p>
<p>Some places where we can already see (or will) the use of HTML 5 tags and javascript on those elements are:</p>
<ul>
<li>GMail Mobile for iPhone and Android</li>
<li><a href="http://pipes.yahoo.com">Yahoo! Pipes</a></li>
<li><a href="http://vimeo.com/3195079">Bespin, a code editor created by Mozilla lab</a>, they basically rewrote the text editing component using the canvas tag so that its a high performance text editing component, with a nice look, selection highlighting, new scrollbars, command support, it can be extended with your own commands (reminds me of emacs)</li>
<li>Google Waves</li>
<li>Some blogs that are already using the &lt;article>, &lt;nav>, &lt;footer> and other new HTML 5 tags</li>
<li><a href="http://www.youtube.com/html5">YouTube</a> is getting ready for the video tag</li>
</ul>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=HTML+5+is+out+and+about+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F&amp;title=HTML+5+is+out+and+about"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F&amp;title=HTML+5+is+out+and+about"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F&amp;title=HTML+5+is+out+and+about"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F&amp;headline=HTML+5+is+out+and+about"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=HTML+5+is+out+and+about&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=HTML+5+is+out+and+about&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=HTML+5+is+out+and+about&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=HTML+5+is+out+and+about&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=HTML+5+is+out+and+about&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F&amp;title=HTML+5+is+out+and+about&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F07%2F11%2Fhtml-5-is-out-and-about%2F&amp;title=HTML+5+is+out+and+about"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/07/11/html-5-is-out-and-about/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a Quick &amp; Dirty HexViewer &#8211; Updated</title>
		<link>http://www.gubatron.com/blog/2009/04/20/how-to-make-a-quick-dirty-hexviewer-updated/</link>
		<comments>http://www.gubatron.com/blog/2009/04/20/how-to-make-a-quick-dirty-hexviewer-updated/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 12:13:55 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[java hex hexviewer programming]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1269</guid>
		<description><![CDATA[After I received comments from ispak on Flickr I made a few fixes.
ispak pointed out that it was a bad idea reading one byte at the time, also I had a gay ass try/catch that didn&#8217;t catch any exception :p
So now I read 16 byte chunks, and I also take care of the file ending. [...]]]></description>
			<content:encoded><![CDATA[<p>After I received comments from <a rel="nofollow" href="http://www.flickr.com/photos/gubatron/3452721506/">ispak on Flickr</a> I made a few fixes.</p>
<p>ispak pointed out that it was a bad idea reading one byte at the time, also I had a gay ass try/catch that didn&#8217;t catch any exception :p</p>
<p>So now I read 16 byte chunks, and I also take care of the file ending. The previous version used to print the file ending with a bunch of null bytes. Now it stops reading at the end, and formats the output accordingly.</p>
<p>Here&#8217;s the new source:</p>
<pre>
//HexViewer.java
import java.io.*;

public final class HexViewer {
    public final static void printFile(String filePath) {
        try {
            File f = new File(filePath);
            BufferedInputStream bis =
                new BufferedInputStream(new FileInputStream(f));

            byte[] chunk = null;
            int readStatus = 0;
            while (true) {
                chunk = new byte[16];
                readStatus = bis.read(chunk, 0, 16);
                char[] line = new char[16];

                if (readStatus == -1)
                    break;

                for (byte i=0; i < readStatus; i++) {
                    int readByte = (chunk[i] < 0) ? (-1 * (int) chunk[i]) : chunk[i];
                    String paddingZero = (readByte < 16) ? "0" : "";
                    System.out.print(paddingZero + Integer.toHexString(readByte).toUpperCase() + " ");
                    line[i] = (readByte >= 33 &#038;&#038; readByte <= 126) ? (char) readByte : '.';
                }

                //We add some padding to print the text line right below the one above.
                String padding = new String();
                if (readStatus < 16) {
                    for (byte i=0; i < 16-readStatus; i++) {
                        padding += "   ";
                    }
                }

                System.out.println(padding + new String(line));
            }
        } catch (Exception e1) { e1.printStackTrace(); }
    }

    public final static void main(String[] args) {
        if (args.length == 0)
            return;

        printFile(args[0]);
    }
}
</pre>
<p><a href="http://www.flickr.com/photos/gubatron/3458529439/" title="HexViewer - r2 by Gubatron, on Flickr"><img src="http://farm4.static.flickr.com/3486/3458529439_31357e0afe_o.png" width="570" height="641" alt="HexViewer - r2" /></a></p>
<p>And see how it now handles file endings when the file size is not a multiple of 16 :p</p>
<p><a href="http://www.flickr.com/photos/gubatron/3459348222/" title="Picture 2 by Gubatron, on Flickr"><img src="http://farm4.static.flickr.com/3578/3459348222_ee4b427d5e_o.png" width="464" height="91" alt="Picture 2" /></a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=How+to+make+a+Quick+%26%23038%3B+Dirty+HexViewer+%26%238211%3B+U...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F&amp;title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F&amp;title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F&amp;title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F&amp;headline=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F&amp;title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F20%2Fhow-to-make-a-quick-dirty-hexviewer-updated%2F&amp;title=How+to+make+a+Quick+%26+Dirty+HexViewer+-+Updated"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/04/20/how-to-make-a-quick-dirty-hexviewer-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to make your own Quick &amp; Dirty Hex File Viewer in Java</title>
		<link>http://www.gubatron.com/blog/2009/04/18/how-to-make-your-own-quick-dirty-hex-file-viewer-in-java/</link>
		<comments>http://www.gubatron.com/blog/2009/04/18/how-to-make-your-own-quick-dirty-hex-file-viewer-in-java/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 13:04:33 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Random Stuff]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[hex editor]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1252</guid>
		<description><![CDATA[Update: You might want to read this new version of the code  instead. Thanks ispak
I was playing with a hex editor recently and then I thought it would be pretty easy to make a program to output what you see on a text editor. Here&#8217;s a quick &#038; dirty Hex Visor I wrote in [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> You might want to read this <a href="http://www.gubatron.com/blog/2009/04/20/how-to-make-a-quick-dirty-hexviewer-updated/">new version of the code </a> instead. Thanks ispak</p>
<p>I was playing with a hex editor recently and then I thought it would be pretty easy to make a program to output what you see on a text editor. Here&#8217;s a quick &#038; dirty Hex Visor I wrote in like 5 minutes with Java. It shows 15 bytes per line, and on the right side it prints all the visible characters of the ascii table, the non-visible ones are replaced with &#8220;.&#8221;</p>
<p>Enjoy:</p>
<pre>
//HexViewer.java
import java.io.*;

public final class HexViewer {
    public final static void printFile(String filePath) {
        File f;
        try {
            f = new File(filePath);
        } catch (Exception e) {
            return;
        }

        try {

            FileInputStream fis = new FileInputStream(f);
            while (fis.available() > 0) {
                char[] line = new char[16];
                for (int i=0; i < 16; i++) {
                    int readByte = fis.read();
                    String paddingZero = (readByte < 16) ? "0" : "";
                    System.out.print(paddingZero + Integer.toHexString(readByte) + " ");
                    line[i] = (readByte >= 33 &#038;&#038; readByte <= 126) ? (char) readByte : '.';
                }
                System.out.println(new String(line));
            }
        } catch (Exception e1) { e1.printStackTrace(); }
    }

    public final static void main(String[] args) {
        if (args.length == 0)
            return;

        printFile(args[0]);
    }
}
</pre>
<p>Usage:</p>
<pre>
java HexViewer &lt;path to file> | less

java HexViewer Desktop/Puppet.wmv | less

30 26 b2 75 8e 66 cf 11 a6 d9 00 aa 00 62 ce 6c 0&#038;.u.f.......b.l
74 14 00 00 00 00 00 00 07 00 00 00 01 02 a1 dc t...............
ab 8c 47 a9 cf 11 8e e4 00 c0 0c 20 53 65 68 00 ..G.........Seh.
00 00 00 00 00 00 f4 10 68 f9 49 76 2e 43 b5 9f ........h.Iv.C..
09 0a 2d 19 45 7c 32 3a 24 00 00 00 00 00 70 ee ..-.E|2:$.....p.
14 06 fb da c7 01 28 01 00 00 00 00 00 00 00 8c ......(.........
bb 53 00 00 00 00 10 88 dd 52 00 00 00 00 b8 0b .S.......R......
00 00 00 00 00 00 02 00 00 00 40 1f 00 00 40 1f ..........@...@.
00 00 90 50 02 00 b5 03 bf 5f 2e a9 cf 11 8e e3 ...P....._......
00 c0 0c 20 53 65 61 10 00 00 00 00 00 00 11 d2 ....Sea.........
d3 ab ba a9 cf 11 8e e6 00 c0 0c 20 53 65 06 00 ............Se..
33 10 00 00 a9 46 43 7c e0 ef fc 4b b2 29 39 3e 3....FC|...K.)9>
de 41 5c 85 27 00 00 00 00 00 00 00 01 00 0c 65 .A\.'..........e
00 6e 00 2d 00 61 00 75 00 00 00 5d 8b f1 26 84 .n.-.a.u...]..&#038;.
45 ec 47 9f 5f 0e 65 1f 04 52 c9 1a 00 00 00 00 E.G._.e..R......
00 00 00 02 01 ea cb f8 c5 af 5b 77 48 84 67 aa ..........[wH.g.
8c 44 fa 4c ca 62 01 00 00 00 00 00 00 06 00 00 .D.L.b..........
00 01 00 0c 00 02 00 02 00 00 00 49 00 73 00 56 ...........I.s.V
00 42 00 52 00 00 00 00 00 00 00 01 00 34 00 00 .B.R.........4..
00 06 00 00 00 44 00 65 00 76 00 69 00 63 00 65 .....D.e.v.i.c.e
00 43 00 6f 00 6e 00 66 00 6f 00 72 00 6d 00 61 .C.o.n.f.o.r.m.a
00 6e 00 63 00 65 00 54 00 65 00 6d 00 70 00 6c .n.c.e.T.e.m.p.l
00 61 00 74 00 65 00 00 00 4c 00 31 00 00 00 00 .a.t.e...L.1....
00 02 00 0c 00 02 00 02 00 00 00 49 00 73 00 56 ...........I.s.V
00 42 00 52 00 00 00 01 00 00 00 02 00 34 00 00 .B.R.........4..
00 0c 00 00 00 44 00 65 00 76 00 69 00 63 00 65 .....D.e.v.i.c.e
00 43 00 6f 00 6e 00 66 00 6f 00 72 00 6d 00 61 .C.o.n.f.o.r.m.a
00 6e 00 63 00 65 00 54 00 65 00 6d 00 70 00 6c .n.c.e.T.e.m.p.l
00 61 00 74 00 65 00 00 00 4d 00 50 00 40 00 4d .a.t.e...M.P.@.M
00 4c 00 00 00 00 00 01 00 2e 00 03 00 04 00 00 .L..............
00 57 00 4d 00 2f 00 57 00 4d 00 41 00 44 00 52 .W.M./.W.M.A.D.R
00 43 00 50 00 65 00 61 00 6b 00 52 00 65 00 66 .C.P.e.a.k.R.e.f
00 65 00 72 00 65 00 6e 00 63 00 65 00 00 00 a7 .e.r.e.n.c.e....
3f 00 00 00 00 01 00 34 00 03 00 04 00 00 00 57 ?......4.......W
00 4d 00 2f 00 57 00 4d 00 41 00 44 00 52 00 43 .M./.W.M.A.D.R.C
00 41 00 76 00 65 00 72 00 61 00 67 00 65 00 52 .A.v.e.r.a.g.e.R
00 65 00 66 00 65 00 72 00 65 00 6e 00 63 00 65 .e.f.e.r.e.n.c.e
00 00 00 b0 06 00 00 74 d4 06 18 df ca 09 45 a4 .......t......E.
ba 9a ab cb 96 aa e8 a4 0d 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
</pre>
<p>This how it looks on a full blown hex editor like HexEdit:<br />
<a href="http://www.flickr.com/photos/gubatron/3452718760/" title="Same file on HexEdit by Gubatron, on Flickr"><img src="http://farm4.static.flickr.com/3634/3452718760_995edb5218_o.png" width="558" height="569" alt="Same file on HexEdit" /></a></p>
<p>The Code of HexViewer.java on emacs:<br />
<a href="http://www.flickr.com/photos/gubatron/3452721506/" title="HexViewer.java on emacs by Gubatron, on Flickr"><img src="http://farm4.static.flickr.com/3379/3452721506_abbcfd5dbf_o.png" width="580" height="665" alt="HexViewer.java on emacs" /></a></p>
<p>Screenshot of the output:<br />
<a href="http://www.flickr.com/photos/gubatron/3452720154/" title="HexViewer in action by Gubatron, on Flickr"><img src="http://farm4.static.flickr.com/3582/3452720154_6153a04a63_o.png" width="450" height="721" alt="HexViewer in action" /></a></p>
<p><strong>Homework</strong><br />
Hack the code so that it ouputs the first column shown on the HexEdit screenshot. That column represents the byte position of each row. It's basically a counter incremented 16 units at the time, and shown in Hex.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=How+to+make+your+own+Quick+%26%23038%3B+Dirty...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F&amp;title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F&amp;title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F&amp;title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F&amp;headline=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F&amp;title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F04%2F18%2Fhow-to-make-your-own-quick-dirty-hex-file-viewer-in-java%2F&amp;title=How+to+make+your+own+Quick+%26+Dirty+Hex+File+Viewer+in+Java"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/04/18/how-to-make-your-own-quick-dirty-hex-file-viewer-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OnLive could change the video game industry</title>
		<link>http://www.gubatron.com/blog/2009/03/25/onlive-could-change-the-video-game-industry/</link>
		<comments>http://www.gubatron.com/blog/2009/03/25/onlive-could-change-the-video-game-industry/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 04:23:39 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[Video Games]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloud gaming]]></category>
		<category><![CDATA[cloud rendering]]></category>
		<category><![CDATA[onlive]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1188</guid>
		<description><![CDATA[
I feel it&#8217;s my geek given duty to make a post about this presentation. I was lucky to finally have the time to watch their hour long presentation and Q&#038;A session at the Game Developer Conference 2009 (which ends a couple of days from today). They could have not picked a better place to finally [...]]]></description>
			<content:encoded><![CDATA[<p><embed id="mymovie" width="432" height="362" flashvars="playerMode=embedded&#038;movieAspect=4.3&#038;flavor=EmbeddedPlayerVersion&#038;skin=http://image.com.com/gamespot/images/cne_flash/production/media_player/proteus/one/skins/gamespot.png&#038;paramsURI=http%3A%2F%2Fwww.gamespot.com%2Fpages%2Fvideo_player%2Fxml.php%3Fid%3D6206692%26mode%3Dembedded%26width%3D432%26height%3D362" wmode="transparent" allowscriptaccess="always" quality="high" name="mymovie" style="" src="http://image.com.com/gamespot/images/cne_flash/production/media_player/proteus/one/proteus2.swf" type="application/x-shockwave-flash"/></p>
<p>I feel it&#8217;s my geek given duty to make a post about this presentation. I was lucky to finally have the time to watch their hour long presentation and Q&#038;A session at the Game Developer Conference 2009 (which ends a couple of days from today). They could have not picked a better place to finally demo their technology.</p>
<p>In short, they&#8217;ve introduced a huge new concept to the video game industry, I&#8217;d call it &#8220;Cloud Gaming&#8221; to not only host the games, but also host the processing juice. You won&#8217;t need a console anymore, they keep the hardware to execute and stream the game to your screen. They support TV (with a miniconsole), PC and Mac.</p>
<p>So bear with me, they say they have solved the issue that you&#8217;re thinking about now, Lag. The people behind this worked on apple to create Quicktime, and they identified differences between what it takes to compress linear (regular) video, vs Interactive Video. They say their compression algorithm doesn&#8217;t take seconds of lag (like when you stream over a webcam), but miliseconds. They have custom chips to process the graphics, and I bet they might even built their own network protocol right on top of IP.</p>
<p>So what are some of the implications of this:</p>
<ul>
<li>We&#8217;ll all be able to finally play Crysis and even more demanding games on low end PCs</li>
<li>No more buying more hardware, no more upgrading your PC to be able to run games, no more buying consoles</li>
<li>All your games live on the platform, so you can play from any computer, and you&#8217;ll keep the state of your game until the last time you hit the Pause button</li>
<li>Your friends can see you play, live. I bet we&#8217;ll be able to see live tournaments,  we&#8217;ll start seeing a new breed of famous people get more attention, the Elite gamers. Imagine seeing the best Call of Duty player in the world playing live</li>
<li>New Genres of video games will emerge on this platform, maybe even new genres of entertainment, think new Live Broadcast shows where participants use an avatar to either act or compete (game show)</li>
<li>Game Developers not need to think of the rendering limitations that they might have nowadays, and will be able to design games that could only be imagined in the past. Render quality only thought for movies will now exist for video games, think of virtual reality now</li>
<li>There&#8217;s about 100 million PCs/Macs/Laptops out there that are not ready today to play high end games, now they&#8217;ll have the possibility of playing virtually any game by installing a 1Mb plugin from OnLive.com</li>
<li>Takes Piracy out of the Business Equation</li>
<li>A bigger gaming audience makes an even better case for companies placing advertisement in video games, maybe there will be a lot more high end free games with bigger audiences, think the next Grand Theft Auto coming out for free with <a href="http://www.mova.com/gallery.php">superb real life like graphics rendering</a>, all ad sponsored and free to the consumer. The amount of people that you could have playing a great game for free would make other developers think twice about charging for their games and having their virtual worlds ad sponsored.</li>
<li>No more installs</li>
<li>Now multiplayer will have almost no latency since all players live inside their datacenter, you only get the latency of your ISP if there&#8217;s any</li>
<li>Nintendo, Sony and Microsoft must be shitting their pants</li>
<li>Services that sell used games are going to be selling vintage and their business will be reduced</li>
</ul>
<p>However I think there will always be room for the old consoles. This is the biggest entertainment industry in the world, we have grown up with consoles for almost 30 years and there&#8217;s a lot of changes to push into people&#8217;s minds:</p>
<ul>
<li>How do you convince me, that finally made up my  mind after years and dropped $500 on a PS3 to play with my friends in latin america online to switch to this, if my friends will probably have no way to even have access to the system in years to come?</li>
<li>How do you convince PC gamers that rather pay for the hardware and pirate the games? (There&#8217;s plenty of those, probably the majority of the PC gaming population outside the US never plays for a PC game, and doesn&#8217;t get into consoles because they pirate the games) into renting or buying games on the cloud?</li>
<li>How do you convince all the people that they should switch when their gaming experience depends entirely on being connected to the internet. So If the ISP is having issues I can&#8217;t play? isn&#8217;t my console awesome?</li>
</ul>
<p>It seems that many of these complains are similar to all the complains brought upon business models that didn&#8217;t exist online and that are now thriving. This presentation left me with my mouth wide open, and I highly recommend you watch it. You&#8217;ll be blown away by the power of the UI, and how as you Browse for games, you can even see how other people are playing live, it&#8217;s like streaming video is nothing for OnLive. Really sick technology.</p>
<p>In the case that they succeed, I just can&#8217;t wait for them to have competition by the existing big brands, it&#8217;s going to get so interesting once cloud gaming becomes the defacto platform, maybe we as consumers will end up playing games for free, all sponsored with in game ads.</p>
<p>Just by listening to the guy if you&#8217;re a techie, your mind will start to fly to barely start to imagine the awesomeness of the technology that should be behind this. I can imagine anything from custom virtualization technology, to custom GPUs, custom network cards, custom network protocols on top of IP, deals with major internet backbone networks, ISPs, deals with game publishers, sick level API development, incomprehensible comprehension technology for my retard brain&#8230; when I see shit like this, I always think&#8230; how the hell is there people that still believe in god? Mankind is the closest thing there is to something like that! I&#8217;m thankful for people in this world that can think so big.</p>
<p>The service is supposed to launch next Winter 2009, but you can <a rel="nofollow" href="http://www.onlive.com/beta_program.html">sign up to be a beta tester</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=OnLive+could+change+the+video+game+industry+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F&amp;title=OnLive+could+change+the+video+game+industry"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F&amp;title=OnLive+could+change+the+video+game+industry"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F&amp;title=OnLive+could+change+the+video+game+industry"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F&amp;headline=OnLive+could+change+the+video+game+industry"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=OnLive+could+change+the+video+game+industry&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=OnLive+could+change+the+video+game+industry&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=OnLive+could+change+the+video+game+industry&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=OnLive+could+change+the+video+game+industry&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=OnLive+could+change+the+video+game+industry&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F&amp;title=OnLive+could+change+the+video+game+industry&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F03%2F25%2Fonlive-could-change-the-video-game-industry%2F&amp;title=OnLive+could+change+the+video+game+industry"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/03/25/onlive-could-change-the-video-game-industry/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Delete All Direct Messages of your Twitter Account at once (or at least try!)</title>
		<link>http://www.gubatron.com/blog/2009/02/13/delete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try/</link>
		<comments>http://www.gubatron.com/blog/2009/02/13/delete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 04:39:27 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Application programming interface]]></category>
		<category><![CDATA[Delete]]></category>
		<category><![CDATA[On the Web]]></category>
		<category><![CDATA[Online Communities]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Social Networking]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1118</guid>
		<description><![CDATA[Since Twitter doesn&#8217;t provide with a &#8220;Delete All Direct Messages&#8221; functionality, Here&#8217;s a Python script that attempts to delete all the direct messages stored on your Twitter account.
Limitations
The only problem with it is that given the limitations of the Twitter REST API, I was forced to send a request per message to be deleted, and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3421/3278210662_801cd1a20e_o.png" class="alignleft">Since Twitter doesn&#8217;t provide with a &#8220;Delete All Direct Messages&#8221; functionality, <a href="http://www.gubatron.com/blog/wp-content/uploads/2009/02/twitter_delete_direct_messages.txt">Here&#8217;s a Python script</a> that attempts to delete all the direct messages stored on your Twitter account.</p>
<p><strong>Limitations</strong><br />
The only problem with it is that given the limitations of the <a href="http://apiwiki.twitter.com/REST+API+Documentation">Twitter REST API</a>, I was forced to send a request per message to be deleted, and it seems that Twitter will only allow 100 requests per hour (per client).</p>
<p>So in theory you will be able to delete 100 an hour, although I have seen it delete over 400 messages Twitter gets all grumpy on me.</p>
<p><strong>Usage</strong><br />
Just save the script as <strong>twitter_delete_direct_messages.py</strong>, open a terminal and run it:</p>
<p><code>python twitter_delete_direct_messages.py</code></p>
<p>After that just follow the instructions on screen and enjoy as messages get wiped out.</p>
<p>If you find this useful, you can thank me by <a href="http://twitter.com/gubatron">following me</a> on Twitter.</p>
<p><a href="http://www.gubatron.com/blog/wp-content/uploads/2009/02/twitter_delete_direct_messages.txt">Get The Script</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Delete+All+Direct+Mes...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F&amp;title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F&amp;title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F&amp;title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F&amp;headline=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F&amp;title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F02%2F13%2Fdelete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try%2F&amp;title=Delete+All+Direct+Messages+of+your+Twitter+Account+at+once+%28or+at+least+try%21%29"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/02/13/delete-all-direct-messages-of-your-twitter-account-at-once-or-at-least-try/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using a linear array as a bidimensional matrix</title>
		<link>http://www.gubatron.com/blog/2009/01/27/using-a-linear-array-as-a-bidimensional-matrix/</link>
		<comments>http://www.gubatron.com/blog/2009/01/27/using-a-linear-array-as-a-bidimensional-matrix/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:18:12 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[utils]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1114</guid>
		<description><![CDATA[Often times I find the need to use a list or linear array as if it was a table.
Everytime I need to do so, I always end up coding functions to convert a (x,y) coordinate to the real index n in the array.
Let me illustrate, with an example. You have a string that defines the [...]]]></description>
			<content:encoded><![CDATA[<p>Often times I find the need to use a list or linear array as if it was a table.</p>
<p>Everytime I need to do so, I always end up coding functions to convert a (x,y) coordinate to the real index n in the array.</p>
<p>Let me illustrate, with an example. You have a string that defines the elements of a game board, and you want to work using (x,y) coordinates.</p>
<pre>
s="xxxxx@xx@xxx@@xx"
</pre>
<p>If you were to look at it as a matrix (width=4), it&#8217;d be something like this</p>
<pre>
s="xxxx
   x@xx
   @xxx
   @@xx"
</pre>
<p>However, I can&#8217;t do<br />
s[x,y], since it&#8217;s a linear array, it&#8217;s a string.</p>
<p>You need to convert from (x,y) to a number that represents an index in the array.</p>
<p>This is very simple:</p>
<pre>
width=4
def getNforXY(x,y):
  return x + width*y
</pre>
<p>What if you want to do it backwards. What if you need to know what&#8217;s the X and Y for a given index N in the string?</p>
<pre>
def getXYforN(n):
  y = int(n/width)
  x = n - width/y
  return (x,y)
</pre>
<p>Cheers</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Using+a+linear+array+as+a+bidimensional+matrix+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F&amp;title=Using+a+linear+array+as+a+bidimensional+matrix"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F&amp;title=Using+a+linear+array+as+a+bidimensional+matrix"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F&amp;title=Using+a+linear+array+as+a+bidimensional+matrix"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F&amp;headline=Using+a+linear+array+as+a+bidimensional+matrix"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Using+a+linear+array+as+a+bidimensional+matrix&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Using+a+linear+array+as+a+bidimensional+matrix&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Using+a+linear+array+as+a+bidimensional+matrix&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Using+a+linear+array+as+a+bidimensional+matrix&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Using+a+linear+array+as+a+bidimensional+matrix&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F&amp;title=Using+a+linear+array+as+a+bidimensional+matrix&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2009%2F01%2F27%2Fusing-a-linear-array-as-a-bidimensional-matrix%2F&amp;title=Using+a+linear+array+as+a+bidimensional+matrix"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2009/01/27/using-a-linear-array-as-a-bidimensional-matrix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery tag wrapping</title>
		<link>http://www.gubatron.com/blog/2008/12/19/jquery-tag-wrapping/</link>
		<comments>http://www.gubatron.com/blog/2008/12/19/jquery-tag-wrapping/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 14:08:51 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[one liners]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[wrapping]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1051</guid>
		<description><![CDATA[Many times you&#8217;ll be working on something in HTML that could be long and repetitive, and then for some reason you need to edit the entire thing to wrap each of the tags on some other tags, a common example would be to link many elements.
Take this example, there&#8217;s a bunch of photos, they&#8217;re all [...]]]></description>
			<content:encoded><![CDATA[<p>Many times you&#8217;ll be working on something in HTML that could be long and repetitive, and then for some reason you need to edit the entire thing to wrap each of the tags on some other tags, a common example would be to link many elements.</p>
<p>Take this example, there&#8217;s a bunch of photos, they&#8217;re all contained in divs that have a css class called &#8220;photos&#8221;, inside we just throw<br />
a bunch of &lt;img> tags, and all of a sudden our boss tells us he wans to have every image on that page linked to &#8220;http://domain.com/photos&#8221;. jQuery to the rescue, no need to wrap each &lt;img> with &lt;a href=&#8221;"> by hand, you can do it all in one line</p>
<p>So if the code looks like this:</p>
<pre>
       &lt;div class="photos">
            &lt;img src="http://domain.com/0670027481_m.jpg"/>
            &lt;img src="http://domain.com/211161aa99_m.jpg"/>
            &lt;img src="http://domain.com/173bb0cd6_m.jpg"/>
        &lt;/div>
        &lt;div class="photos">
            &lt;img src="http://domain.com/841fd90b5b_m.jpg"/>
            &lt;img src="http://domain.com/52dda2cee5_m.jpg"/>
            &lt;img src="http://domain.com/b569399599_m.jpg"/>
        &lt;/div>
        &lt;div class="photos">
            &lt;img src="http://domain.com/8806e863a4_m.jpg"/>
            &lt;img src="http://domain.com/5e43aa95fe_m.jpg"/>
            &lt;img src="http://domain.com/68a74a088c_m.jpg"/>
        &lt;/div>

        &lt;div class="tshirt-photos">
            &lt;img src="http://farm4.static.flickr.com/3149/3113619519_72ce82c545_m.jpg"/>
            &lt;img src="http://farm4.static.flickr.com/3236/3105792155_99f2388869_m.jpg"/>
            &lt;img src="http://farm3.static.flickr.com/2114/2372582266_765842fae9_m.jpg"/>
        &lt;/div>
</pre>
<p>With jQuery you can match all the &lt;img> elements, and wrap them all with &#8220;&lt;a href=&#8221;http://domain.com/photos&#8221;>&lt;/a>&#8221; in a single line of code:</p>
<pre>
$(document).ready(function() { $(".photos img").wrap('&lt;a href="http://domain.com/photos"></a>') })
</pre>
<p>So to explain how it works, when the document is ready (when it&#8217;s finished loading) the function inside is called back, it will use the jQuery selector <strong>$(&#8220;.photos img&#8221;)</strong> to match all the <strong>&lt;img></strong> tags contained withing elements of css class &#8220;photos&#8221;, then it applies the wrap() function, which will wrap the matched elements with the given html tags.</p>
<h2>About jQuery</h2>
<p><img src="http://marcgrabanski.com/img/jQuery-logo.gif" class="alignleft"/>jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML. It was released January 2006 at BarCamp NYC by John Resig.</p>
<p>Dual licensed under the MIT License and the GNU General Public License, jQuery is free and open source software.</p>
<p>jQuery contains the following features:</p>
<ul>
<li>DOM element selections
</li>
<li>DOM traversal and modification, (including support for CSS 1-3 and basic XPath)</li>
<li>Events</li>
<li>CSS manipulation</li>
<li>Effects and animations</li>
<li>Ajax</li>
<li>Extensibility</li>
<li>Utilities &#8211; such as browser version and the each function.</li>
<li>JavaScript Plugins</li>
</ul>
<p><a href="http://docs.jquery.com/Main_Page" rel="none">jQuery Documentation</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=jQuery+tag+wrapping+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F&amp;title=jQuery+tag+wrapping"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F&amp;title=jQuery+tag+wrapping"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F&amp;title=jQuery+tag+wrapping"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F&amp;headline=jQuery+tag+wrapping"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=jQuery+tag+wrapping&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=jQuery+tag+wrapping&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=jQuery+tag+wrapping&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=jQuery+tag+wrapping&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=jQuery+tag+wrapping&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F&amp;title=jQuery+tag+wrapping&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F12%2F19%2Fjquery-tag-wrapping%2F&amp;title=jQuery+tag+wrapping"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/12/19/jquery-tag-wrapping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Script to Update Wordpress in One Step</title>
		<link>http://www.gubatron.com/blog/2008/11/26/python-script-to-update-wordpress-in-one-step/</link>
		<comments>http://www.gubatron.com/blog/2008/11/26/python-script-to-update-wordpress-in-one-step/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 15:23:49 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[one step]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1015</guid>
		<description><![CDATA[During the past week, I think I had to update all my wordpress instances twice, and it&#8217;s become really annoying doing this manually. I&#8217;ve written a python script which I&#8217;ll share with you.
How I keep my wordpress updated by hand
I tend to keep my wp-content folder outside of my wordpress installation for 2 reasons:
1. I [...]]]></description>
			<content:encoded><![CDATA[<p>During the past week, I think I had to update all my wordpress instances twice, and it&#8217;s become really annoying doing this manually. I&#8217;ve written a python script which I&#8217;ll share with you.</p>
<p><strong>How I keep my wordpress updated by hand</strong><br />
I tend to keep my wp-content folder outside of my wordpress installation for 2 reasons:</p>
<p>1. I don&#8217;t like to loose my themes, plugins and customizations<br />
2. I like to keep all my customization changes under subversion</p>
<p>So, if I had my wordpress installation say at:<br />
<strong>/home/user/public_html/blog</strong></p>
<p>I&#8217;d keep my wp-content folder for that here:</p>
<p><strong>/home/user/public_html/wp-content-for-blog</strong></p>
<p>So when I upgrade my blog, I always remove the original wp-content folder that comes along wordpress, and I symlink my hard worked on wp-content folder that lives outside to the freshly unzipped wordpress folder.</p>
<pre>
user@machine:~/public_html/blog$ ls -l
...
lrwxrwxr-x 1 user www    54 2008-11-26 09:29 wp-content -> /home/user/public_html/wp-content-for-blog
...
</pre>
<p>So what I endup doing all the time, is downloading the <a href="http://www.wordpress.org/latest.zip" rel="nofollow">latest.zip</a> to ~/public_html/, it will unzip under ~/public_html/wordpress, and then I&#8217;ll copy the current ~/public_html/blog/wp-config.php to ~/public_html/wordpress, then I&#8217;ll remove the default ~/public_html/wordpress/wp-content and symlink the outer wp-content with all my customizations, themes and plugins to it. Once done, I&#8217;ll make a backup of the old wordpress folder, and then I&#8217;ll rename wordpress folder to the name of the blog folder, and it&#8217;s all done.</p>
<p>It&#8217;s simple, but when you have to do it for 5 blogs, every week, it&#8217;s not fun anymore.</p>
<p><strong>The Update Script</strong></p>
<p>So here&#8217;s a script to do it in one step. If you&#8217;re not using my symlinked technique, this will do it for you, you only need to specify the full path to the folder where you want to keep your current wp-content folder outside the new installation before you apply the update, and the name of the folder where your current blog lives. The script below will have its configuration variables towards the beginning set so that they are in line with the example I&#8217;ve been talking about.</p>
<pre>
#!/usr/bin/python
#########################################################################################
#
# upgrade_wordpress.py - Script to automatically upgrade your wordpress installation.
#
# Requirements:
#   - Python 2.4 or older
#   - Wordpress should already be installed
#   - CURL (sudo apt-get install curl)
#
# Author: Angel (Gubatron) Leon
# LICENSE: See the GPL2 license.
# 2008
#########################################################################################
import os

#########################################################################################
#Config (relative to the folder where this script will be run from)
#########################################################################################

#The current folder where the blog lives
BLOG_FOLDER='blog'

#
# The first time you run the script, it will try to make a copy of your
# current wp-content folder outside. Copy here the location of where
# the wp-content folder with your themes and plugins should exist.
#
# After it unzips, it will remove the default wp-content folder from
# the new installation, and it will symlink the external wp-content
# That way you don't ever have to worry about loosing your customizations
# and plugins.
#
WP_CONTENT_OUTSIDE_COPY_FOLDER="/home/user/public_html/wp-content-for-blog"

#This is where a backup of your current blog will be
BLOG_FOLDER_BACKUP_FOLDER=BLOG_FOLDER+'.old'

#Where to download the wordpress latest.zip from
WORDPRESS_LATEST_ZIP_URL='http://wordpress.org/latest.zip'

#### DO NOT MODIFY AFTER THESE LINES ####

def downloadWordpress(url=WORDPRESS_LATEST_ZIP_URL):
    if os.path.exists('latest.zip'):
        print "Removing old latest.zip"
        os.remove('latest.zip')

    #Try to download with CURL
    print "Attempting to download latest.zip from wordpress.org"
    os.system('curl %s -o latest.zip' % url)

    if not os.path.exists('latest.zip'):
        os.system('wget ' + url)

    return os.path.exists('latest.zip')

def dirExists(dirName):
    return os.path.exists(dirName) and os.path.isdir(dirName)

def backupBlog(currentBlogFolder=BLOG_FOLDER,
               wpContentOriginalFolder=WP_CONTENT_OUTSIDE_COPY_FOLDER,
               backupFolder=BLOG_FOLDER_BACKUP_FOLDER):

    #Remove any previous backups
    if os.path.exists(backupFolder) and os.path.isdir(backupFolder):
        print "Removing previous backup folder"
        os.system('rm -fr ' + backupFolder)

    #Copy the current blog folder into a backup folder just in case.
    #We won't do any database backups for now.
    print "Creating new backup folder"
    os.system('cp -r %s %s' % (currentBlogFolder,backupFolder))

    #Check for the copy of wp-content outside the blog, if it doesn't exist
    #we'll make it for the first time.
    if not dirExists(wpContentOriginalFolder):
        print "Creating outside copy of wp-content"
        os.system('cp -r %s %s' % (os.path.join(currentBlogFolder,'wp-content'),
                                   wpContentOriginalFolder))

    #Copy the latest wp-config.php outside to the current folder
    print "Copying your latest wp-config.php outside"
    os.system('cp %s .' % (os.path.join(currentBlogFolder,'wp-config.php')))

    backupFolderExists = dirExists(backupFolder)
    wpContentFolderExists = dirExists(wpContentOriginalFolder)
    configFileExists = os.path.exists('wp-config.php')

    return backupFolderExists and wpContentOriginalFolder and configFileExists

def upgradeBlog(currentBlogFolder=BLOG_FOLDER,
                backupFolder=BLOG_FOLDER_BACKUP_FOLDER,
                url=WORDPRESS_LATEST_ZIP_URL,
                wpContentOriginalFolder=WP_CONTENT_OUTSIDE_COPY_FOLDER):

    if not downloadWordpress(url):
        print "Could not download latest.zip, aborting."
        return False

    if not backupBlog(currentBlogFolder,wpContentOriginalFolder,backupFolder):
        print "Could not backup blog or wp-config.ph, aborting."
        return False

    if currentBlogFolder == 'wordpress':
        print "The current blog folder cannot be 'wordpress, aborting."
        return False

    #1. If a wordpress/ folder exists, wipe it.
    if dirExists('wordpress'):
        print "Removing old wordpress folder"
        os.system('rm -fr wordpress')

    if dirExists('%s.delete' % currentBlogFolder):
        print "Removing old %s.delete folder" % currentBlogFolder
        os.system('rm -fr %s.delete folder' % currentBlogFolder)

    #2. Unzip new copy
    os.system('unzip latest.zip')

    if not dirExists('wordpress'):
        print "Could not unzip the wordpress installation, aborting."
        return False

    #1. Copy wp-config.php into the new installation
    os.system('cp wp-config.php wordpress/')

    #2. Remove the default wp-content folder
    os.system('rm -fr wordpress/wp-content')

    #3. Symlink the original wp-content that lives outside
    os.system('ln -s %s wordpress/wp-content' % (wpContentOriginalFolder))

    #4. Verify symlink was created
    if not (os.path.exists('wordpress/wp-content') and os.path.islink('wordpress/wp-content')):
        print "Could not create symlink to wp-content, aborting."
        return False

    #5. Move original folder to folder.delete, and make this wordpress folder the current folder.
    os.system('mv %s %s.delete' % (currentBlogFolder,currentBlogFolder))

    if not dirExists(currentBlogFolder + ".delete"):
        print "Could not rename current folder for later deletion, aborting."
        return False

    #6. Rename the new installation as the current blog
    os.system('mv %s %s' % ('wordpress',currentBlogFolder))

    if dirExists('wordpress'):
        print "ALERT: The wordpress folder still exists."
        return False

    if not dirExists(currentBlogFolder):
        print "ALERT: The blog doesn't exist, recover from the backup folder %s please" % (backupFolder)
        return False

    #7 Cleanup
    os.system('rm -fr %s.delete' % (currentBlogFolder))

    return True

if __name__ == '__main__':
    upgradeBlog()
</pre>
<p><strong>Requirements</strong></p>
<li>shell access to the machine where you have your wordpress installed</li>
<li>a python interpreter installed</li>
<li>curl (sudo apt-get install curl) to download the zip. If you don&#8217;t have it it&#8217;ll attempt to use wget</li>
<p><strong>Installation</strong></p>
<li>Right outside your wordpress installation folder, create a new file called <strong>upgrade_wordpress.py</strong></li>
<li>Copy and paste the script inside that file</li>
<li>Edit the configuration variables to point to the name of your wordpress installation folder, and give it a full path to where you want to keep your wp-content folder (including the name of the folder, so if you want to name it the same way, you could do for example /home/user/wp-content and it&#8217;ll be saved right under your home)</li>
<p><strong>Usage:</strong></p>
<pre>python upgrade_wordpress.py</pre>
<p>The script is very fault proof, it will always try to abort in case something is not going the way it&#8217;s expected. At the end of the day it&#8217;ll also leave a backup copy of your current blog in case something goes bad, you can always recover.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Python+Script+to+Update+Wordpress+in+One+Step+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F&amp;title=Python+Script+to+Update+Wordpress+in+One+Step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F&amp;title=Python+Script+to+Update+Wordpress+in+One+Step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F&amp;title=Python+Script+to+Update+Wordpress+in+One+Step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F&amp;headline=Python+Script+to+Update+Wordpress+in+One+Step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Python+Script+to+Update+Wordpress+in+One+Step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Python+Script+to+Update+Wordpress+in+One+Step&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Python+Script+to+Update+Wordpress+in+One+Step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Python+Script+to+Update+Wordpress+in+One+Step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Python+Script+to+Update+Wordpress+in+One+Step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F&amp;title=Python+Script+to+Update+Wordpress+in+One+Step&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F26%2Fpython-script-to-update-wordpress-in-one-step%2F&amp;title=Python+Script+to+Update+Wordpress+in+One+Step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/11/26/python-script-to-update-wordpress-in-one-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cola: Real-Time Remote Pair coding</title>
		<link>http://www.gubatron.com/blog/2008/11/25/cola-real-time-remote-pair-coding/</link>
		<comments>http://www.gubatron.com/blog/2008/11/25/cola-real-time-remote-pair-coding/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 00:03:24 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[extreme programing]]></category>
		<category><![CDATA[live]]></category>
		<category><![CDATA[pair coding]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=1012</guid>
		<description><![CDATA[This is not new, but I hadn&#8217;t seen it, so maybe you didn&#8217;t either, I&#8217;ll let the video speak for itself, I&#8217;m speechless.
Thanks to Daniel Chang for sharing this with me.
Cola: Real-Time Shared Editing from Mustafa K. Isik on Vimeo.
]]></description>
			<content:encoded><![CDATA[<p>This is not new, but I hadn&#8217;t seen it, so maybe you didn&#8217;t either, I&#8217;ll let the video speak for itself, I&#8217;m speechless.</p>
<p>Thanks to Daniel Chang for sharing this with me.</p>
<p><object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1195398&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1195398&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object><br /><a href="http://vimeo.com/1195398">Cola: Real-Time Shared Editing</a> from <a href="http://vimeo.com/mustafa">Mustafa K. Isik</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Cola%3A+Real-Time+Remote+Pair+coding+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F&amp;title=Cola%3A+Real-Time+Remote+Pair+coding"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F&amp;title=Cola%3A+Real-Time+Remote+Pair+coding"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F&amp;title=Cola%3A+Real-Time+Remote+Pair+coding"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F&amp;headline=Cola%3A+Real-Time+Remote+Pair+coding"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Cola%3A+Real-Time+Remote+Pair+coding&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Cola%3A+Real-Time+Remote+Pair+coding&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Cola%3A+Real-Time+Remote+Pair+coding&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Cola%3A+Real-Time+Remote+Pair+coding&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Cola%3A+Real-Time+Remote+Pair+coding&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F&amp;title=Cola%3A+Real-Time+Remote+Pair+coding&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F25%2Fcola-real-time-remote-pair-coding%2F&amp;title=Cola%3A+Real-Time+Remote+Pair+coding"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/11/25/cola-real-time-remote-pair-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java/Reflection notes: Invoking a static main() method from a dinamically loaded class.</title>
		<link>http://www.gubatron.com/blog/2008/11/22/javareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class/</link>
		<comments>http://www.gubatron.com/blog/2008/11/22/javareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 20:02:30 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=980</guid>
		<description><![CDATA[Maybe for some wild reason, your Java application will need to execute a pre launcher that won&#8217;t know about the Main class it&#8217;s supposed to invoke until it&#8217;s being executed. For example, you have distributed your Java application but you used pack200 to compress your jars, and your new application launcher will unpack everything, but [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3009/3050249135_841fd90b5b_m.jpg" class="alignleft"/>Maybe for some wild reason, your Java application will need to execute a pre launcher that won&#8217;t know about the Main class it&#8217;s supposed to invoke until it&#8217;s being executed. For example, you have distributed your Java application but you used pack200 to compress your jars, and your new application launcher will unpack everything, but up to this point, it can&#8217;t do an import of the main class, since the jar that contained it, wasn&#8217;t available to the virtual machine when java was invoked.</p>
<p>So, your launcher class, finishes unpacking your jars, adds the jars to the current classloader, and now you need to invoke your <strong>Main.main(String[] args)</strong>. </p>
<p>This is how I managed to do it, using Java&#8217;s reflection mechanisms</p>
<pre>
    public final void startMain(String[] args) {
        //this will create a new class loader out of all jars available, see below on next
        //code section of this blog post
        addJars2Classpath();

        try {
            //Instantiate the main class, and execute it's static main method
            Class clazz = jarsClassloader.loadClass("com.mycomp.somepackage.Main");
            Class[] argTypes = { args.getClass(), };
            Object[] passedArgs = { args };
            Method main = clazz.getMethod("main",argTypes);
            main.invoke(null, passedArgs);
        } catch (Exception e) {
            //oh oh
            e.printStackTrace();
        }

    } //startMain
</pre>
<p>In case you&#8217;re interested in how to add new Jars to the classpath during runtime, this is how I managed to do it:</p>
<pre>
    /**
     * Adds all the newly available jars to the classpath
     */
    public final void addJars2Classpath() throws Exception {
        //Create a new class loader with all the jars.
        Object[] jars = getFiles(getApplicationResourcesJavaFolder(), ".jar");
        URL[] jarUrls = new URL[jars.length];

        for (int i=0; i < jars.length; i++) {
            URL jarURL = null;

            try {
                jarURL = new URL("jar:file:"+(String) jars[i]+"!/");
            } catch (Exception e) {
                //LOG.error("Bad URL for jar ("+jarFile+"):\n"+e.toString()+" ("+jarURL+")\n");
                return;
            }

            jarUrls[i] = jarURL;
        }

        //and this guy here, is the classloader used to load
        jarsClassloader = URLClassLoader.newInstance(jarUrls);
      } //addJar2Classpath

    /**
     * Get a Object<String> array that contains the names of the files
     * that end with 'type' on the given folderPath
     *
     * e.g
     *
     * String[] jarFiles = getFiles(".",".jar");
     *
     */
    public final Object[] getFiles(String folderPath, String type) {
        File f = new File(folderPath);

        String[] files = f.list();

        Vector results = new Vector();

        for (int i=0; i < files.length; i++) {
            if (files[i].endsWith(type)) {
                results.add((String) files[i]);
            }
        }

        if (results.size() == 0)
            return null;

        return results.toArray();
    } //getFiles
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Java%2FReflecti...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F&amp;title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F&amp;title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F&amp;title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F&amp;headline=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F&amp;title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F11%2F22%2Fjavareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class%2F&amp;title=Java%2FReflection+notes%3A+Invoking+a+static+main%28%29+method+from+a+dinamically+loaded+class."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/11/22/javareflection-notes-invoking-a-static-main-method-from-a-dinamically-loaded-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to filter logs in lighttpd</title>
		<link>http://www.gubatron.com/blog/2008/10/27/how-to-filter-logs-in-lighttpd/</link>
		<comments>http://www.gubatron.com/blog/2008/10/27/how-to-filter-logs-in-lighttpd/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 15:59:04 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[accesslog]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filter out]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[mod_accesslog]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=913</guid>
		<description><![CDATA[ I usually don&#8217;t keep lighttpd access logs turned on to avoid writing for every read, but there are times when you need to monitor what&#8217;s going on, and you&#8217;d like to have a high signal-to-noise ratio so it might be convenient to ignore all requests to .gif, .png, .jpg, .css, .ico and other urls [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lighttpd.net/" rel="nofollow" target="_blank"><img align="left" style="margin:5px 5px" src="http://www.lighttpd.net/light_logo.png" width="150" height="150" border="0"/></a> I usually don&#8217;t keep <a href="http://www.lighttpd.net/" rel="nofollow" target="_blank">lighttpd</a> access logs turned on to avoid writing for every read, but there are times when you need to monitor what&#8217;s going on, and you&#8217;d like to have a high signal-to-noise ratio so it might be convenient to ignore all requests to .gif, .png, .jpg, .css, .ico and other urls on your webserver.</p>
<p>To only log certain files, or to NOT log certain files, you resolve this the same way as you do every other thing in lighttpd&#8230; by matching lighttpd variables to regular expressions and applying the settings where they match.</p>
<pre>
# www -> the main website
$HTTP["host"] =~ "^www.yoursite.com$" {
  server.document-root = "/var/www/www.yoursite.com"
  server.errorlog = "/var/log/lighttpd/www.yoursite.com/error.log"

  #Only log non-css and images
  <strong>$HTTP["url"] !~ "(\.css|\.jpg|\.gif|\.png|\.ico)$" {
    accesslog.filename = "/var/log/lighttpd/www.yoursite.com/access.log"
  }</strong>
}
</pre>
<p>So in this example, we only log, where the URL doesn&#8217;t end with any of the &#8220;.css&#8221;, &#8220;.jpg&#8221;, &#8220;.gif&#8221;, &#8220;.png&#8221; or &#8220;.ico&#8221; extensions. We filter those out.</p>
<p>Hope this works for you.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=How+to+filter+logs+in+lighttpd+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F&amp;title=How+to+filter+logs+in+lighttpd"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F&amp;title=How+to+filter+logs+in+lighttpd"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F&amp;title=How+to+filter+logs+in+lighttpd"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F&amp;headline=How+to+filter+logs+in+lighttpd"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+to+filter+logs+in+lighttpd&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+to+filter+logs+in+lighttpd&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+to+filter+logs+in+lighttpd&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+to+filter+logs+in+lighttpd&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+to+filter+logs+in+lighttpd&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F&amp;title=How+to+filter+logs+in+lighttpd&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F27%2Fhow-to-filter-logs-in-lighttpd%2F&amp;title=How+to+filter+logs+in+lighttpd"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/10/27/how-to-filter-logs-in-lighttpd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apple Wireless Keyboard</title>
		<link>http://www.gubatron.com/blog/2008/10/23/apple-wireless-keyboard/</link>
		<comments>http://www.gubatron.com/blog/2008/10/23/apple-wireless-keyboard/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 16:57:21 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Gubatron]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[internet tv]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[slim]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[worn out]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=903</guid>
		<description><![CDATA[
I just got a new Apple Wireless Keyboad. 
My laptop currently sits atop a Griffin Elevator, this keeps it cool and also helps keep my neck at a healthy angle, something I need given how many hours I spend on the computer.
The problem with the Elevator is that after a while, your arms get tired [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3226/2966536939_dcaf59f79c.jpg?v=0"/></p>
<p>I just got a new <a href="http://store.apple.com/us/product/MB167LL/A" rel="nofollow" target="_blank">Apple Wireless Keyboad</a>. </p>
<p>My laptop currently sits atop a <a href="http://www.griffintechnology.com/products/elevator" rel="nofollow">Griffin Elevator</a>, this keeps it cool and also helps keep my neck at a healthy angle, something I need given how many hours I spend on the computer.</p>
<p>The problem with the Elevator is that after a while, your arms get tired and you end up resting your arms over your elbows, causing you elbow dryness and sometimes pain.</p>
<p><img src="http://farm4.static.flickr.com/3021/2966569457_b53916a60a.jpg?v=0"/></p>
<p>To rest my elbows and have an <a href="http://en.wikipedia.org/wiki/Ergonomics" rel="nofollow" target="_blank">ergonomic</a> posture, I needed a keyboard that was small enough to fit on my tight desk.</p>
<p>The other reason I got it was that the MacBook keyboard is extremely worn out.</p>
<p><img src="http://farm4.static.flickr.com/3224/2967384682_271babe6c3.jpg?v=0"/></p>
<p><strong>Getting used to the new keyboard</strong><br />
The function keyboard layout is a bit different from the one on the MacBook. It took me a couple hours getting used to the spacing between the keys, but now I&#8217;m fully used to it. The feeling of the keys going down is very addictive.</p>
<p><img src="http://farm4.static.flickr.com/3233/2967383350_95fa7af130.jpg?v=0"/></p>
<p>Since the keyboard is wireless, I&#8217;m planning on getting another one to put it in front of the TV. Once <a href="boxee.tv" target="_blank">Boxee</a> integrates Joost and Hulu perfectly into the system, getting an Apple TV or a cheap custom built computer as a media center will make a lot of sense. </p>
<p>I&#8217;ve been hooking up the laptop via HDMI to the TV, and it sucks every time an episode ends in Hulu, or when there are commercial breaks on the ABC.com HD player because you have to get up and click on continue, or select the next episode to watch (unless you have setup playlists previously). </p>
<p>A wireless mouse and keyboard solve that problem.</p>
<p><img src="http://farm4.static.flickr.com/3243/2966537755_accd94be36.jpg?v=0"/></p>
<p><strong>Useful for Internet TV</strong><br />
Another plus, it can work like a remote control, for your HDMI-TV/Laptop setup.</p>
<p>I can proudly say we&#8217;ve been Cable-TV free for over 10 months now (saving probably around $200), I &#8220;survive&#8221; on Netflix DVDs &#038; Streaming (can&#8217;t wait for the Xbox Live upgrade), <a href="http://www.joost.com" rel="nofollow" target="_blank">Joost</a> and <a href="http://www.hulu.com" target="_blank" rel="nofollow">Hulu</a>.</p>
<p>Given my past history of doing things 2-3 years before regular people, I can see a big future for the Internet TV/Video companies that survive this &#8220;crisis&#8221; (bullshit crisis really, go to Venezuela and see what a real crisis is), eventually the whole thing will be packed on little boxes and CableTV companies will be in trouble if they don&#8217;t jump on the I-watch-what-I-want-whenever-I-want-via-internet boat.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Apple+Wireless+Keyboard+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F&amp;title=Apple+Wireless+Keyboard"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F&amp;title=Apple+Wireless+Keyboard"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F&amp;title=Apple+Wireless+Keyboard"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F&amp;headline=Apple+Wireless+Keyboard"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Apple+Wireless+Keyboard&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Apple+Wireless+Keyboard&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Apple+Wireless+Keyboard&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Apple+Wireless+Keyboard&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Apple+Wireless+Keyboard&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F&amp;title=Apple+Wireless+Keyboard&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F10%2F23%2Fapple-wireless-keyboard%2F&amp;title=Apple+Wireless+Keyboard"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/10/23/apple-wireless-keyboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google&#8217;s Chrome, no extensions? then no go</title>
		<link>http://www.gubatron.com/blog/2008/09/03/googles-chrome-no-extensions-then-no-go/</link>
		<comments>http://www.gubatron.com/blog/2008/09/03/googles-chrome-no-extensions-then-no-go/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 14:49:24 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[evil]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=843</guid>
		<description><![CDATA[Please correct me if I&#8217;m wrong,  but I didn&#8217;t read any mention of Browser extensions on the chrome document, I read about plugins (these are more like Flash plugin and what not), but nothing about extensions.
This probably means:
 &#8211; No StumbleUpon toolbar :( (I&#8217;m a stumbleupon.com addict, I feel crippled with chrome because of [...]]]></description>
			<content:encoded><![CDATA[<p>Please correct me if I&#8217;m wrong,  but I didn&#8217;t read any mention of Browser extensions on the chrome document, I read about plugins (these are more like Flash plugin and what not), but nothing about extensions.</p>
<p>This probably means:<br />
 &#8211; No StumbleUpon toolbar :( (I&#8217;m a stumbleupon.com addict, I feel crippled with chrome because of this)<br />
 &#8211; No Cool Iris<br />
 &#8211; No Twitter extensions<br />
 &#8211; No weather extensions<br />
 &#8211; No firebug-like extensions<br />
 &#8211; No toolbars of any kind<br />
 &#8211; No Synced bookmarks</p>
<p>This means a lot of businesses would die if people were to embrace an extension-less browser. I think it&#8217;s a little scary when you allow one of the most important websites of the world to run the browser industry. Let&#8217;s hope people will stay distributed around IE, Mozilla, Safari and chrome, and that they don&#8217;t become the defacto browser, cause then they would really run the show.</p>
<p>Remember Google, don&#8217;t be evil, right?</p>
<p><strong>Update:</strong><br />
Confirmed, no extensions as of this writing are available.</p>
<p>Taken from the <a rel="nofollow" href="http://dev.chromium.org/developers/faq" target="_blank">Chromium developer FAQ</a>:</p>
<blockquote><p>Q. How can I develop extensions for Chromium like in Firefox?<br />
A. Chromium doesn&#8217;t have an extension system yet. This is something we&#8217;re interested in adding in a future version.</p></blockquote>
<p><strong>To Mac Geeks</strong><br />
If you want to build it for mac, you can (supposedly, I&#8217;m in the process off, I&#8217;ll post screenshots or video if I manage to do it sucessfully)</p>
<p><a href="http://dev.chromium.org/developers/how-tos/build-instructions-os-x" rel="nofollow" target="_blank">Here are instructions</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Google%26%238217%3Bs+Chrome%2C+no+extensions%3F+then+no+go+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F&amp;title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F&amp;title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F&amp;title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F&amp;headline=Google%27s+Chrome%2C+no+extensions%3F+then+no+go"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Google%27s+Chrome%2C+no+extensions%3F+then+no+go&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F&amp;title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F09%2F03%2Fgoogles-chrome-no-extensions-then-no-go%2F&amp;title=Google%27s+Chrome%2C+no+extensions%3F+then+no+go"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/09/03/googles-chrome-no-extensions-then-no-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script to automatically detect and ban malicious IPs that try to brute force SSH accounts</title>
		<link>http://www.gubatron.com/blog/2008/05/29/script-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts/</link>
		<comments>http://www.gubatron.com/blog/2008/05/29/script-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts/#comments</comments>
		<pubDate>Thu, 29 May 2008 14:01:51 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[automatic banning]]></category>
		<category><![CDATA[ban]]></category>
		<category><![CDATA[banning]]></category>
		<category><![CDATA[brute force]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=816</guid>
		<description><![CDATA[We&#8217;ve noticed that most of our servers have been under heavy attack from random IP addresses to break via SSH.
With the help of the last post on how to ban an IP, and the following python script, you&#8217;ll be able to have a cronjob that runs once or twice a day and automagically bans all [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve noticed that most of our servers have been under heavy attack from random IP addresses to break via SSH.</p>
<p>With the help of the last post on how to ban an IP, and the following python script, you&#8217;ll be able to have a cronjob that runs once or twice a day and automagically bans all the offending ips from ever trying to brute force their way in ever again.</p>
<p>touch and make executable a file called &#8220;detect_ssh_hostiles&#8221;</p>
<pre>
touch detect_ssh_hostiles
chmod +x detect_ssh_hostiles
</pre>
<p>Then copy the following code inside:</p>
<pre>
# Usage:
# python detect_ssh_hostiles [auth.log file path]
#
# Requirement: There should be "ban_ip" and "unban_ip" command availability on the path
#
# Note: you gotta have read permissions on the auth.log file and sudo
#       permissions for the script to ban the ips.

#If an IP meets this number of failed login attemmpts it will be banned
BAN_THRESHOLD = 7
SUSPECTS = {}

#Put here IP addresses you trust, could be making genuine login errors
SAFE_IPS = ['81.73.111.49','101.73.111.160','72.31.171.235','72.36.23.234','82.36.180.210','202.132.82.16']

import os
import sys
import re

BANNED = {}
def loadBanned():
  '''
  This function will load all the banned IPS into the BANNED Dict.
  It will also count how many times (by mistake) the same IP has
  been banned, and it will unban it, so that it will appear only once.
  '''
  global BANNED
  command = 'sudo iptables --list --numeric'
  try:
    p = os.popen(command,'rb')
  except Exception,e:
    print e
    sys.exit(1)

  line = '-'

  while line != '':
    line = p.readline().strip()

    if line.startswith("DROP"):
      parts = line.split()
      ip = parts[3]

      #add hit or register banned ip
      if BANNED.has_key(ip):
        BANNED[ip]+=1
      else:
        BANNED[ip]=1

  #Make sure banned IPs are banned only once
  for ip in BANNED:
    if BANNED[ip] > 1:
      print "IP %s has been banned %d times" % (ip, BANNED[ip])
      n=BANNED[ip]-1
      while n > 0:
        os.system("unban_ip %s" % ip)
        print ("unban_ip %s" % ip)
        n=n-1

  p.close()

# ---- here we go ----
loadBanned()

#read auth log
logfile = '/var/log/auth.log'

if len(sys.argv)==2:
  logfile = sys.argv[1]

command = 'grep "Failed password for " %s' % logfile
#print command

try:
  p = os.popen(command,'rb')
except Exception,e:
  print e
  sys.exit(1)

line = "123"

while line != '':
  line = p.readline()

  #Sample line:
  # May 25 03:29:49 main sshd[6933]: Failed password for root from 202.118.236.132 port 54863 ssh2
  pattern = "(.*)(from\s)(\d+\.\d+\.\d+\.\d+)(.*)"
  matchObject = re.match(pattern, line)

  suspect = None
  if matchObject is not None:
    suspect = matchObject.groups()[2]

    #skip safe IPs
    if suspect in SAFE_IPS:
      continue

    if SUSPECTS.has_key(suspect):
      #add a hit
      SUSPECTS[suspect] += 1
    else:
      #add first hit
      SUSPECTS[suspect] = 1

p.close() #close the pipe

print "=="*30

import time
t = time.localtime()
#(2008, 6, 6, 9, 35, 21, 4, 158, 1)

timestr = "%d-%d-%d@%d:%d:%d" % (t[0],t[1],t[2],t[3],t[4],t[5])
print timestr
print "--"*30
if len(SUSPECTS) > 0:
  for suspect in SUSPECTS:
    if SUSPECTS[suspect] >= BAN_THRESHOLD and not BANNED.has_key(suspect):
      print "Banning %s with %d attempts" % (suspect,SUSPECTS[suspect])
      BANNED[suspect]=1
      os.system("ban_ip %s" % suspect)
    elif BANNED.has_key(suspect):
      print "Ip %s has already been banned" % (suspect)
    else:
      print "Suspect candidate? %s with %d attempts" % (suspect,SUSPECTS[suspect])
else:
  print "Found no suspects to ban"

print "=="*30</pre>
<p>Then add this as a cronjob of your root user, and it will automatically ban all those IPs that have tried to break in. See the script for configuration. You can always make some IPs immune to banning by adding them on the SAFE_IPS list.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Script...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F&amp;title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F&amp;title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F&amp;title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F&amp;headline=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F&amp;title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fscript-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts%2F&amp;title=Script+to+automatically+detect+and+ban+malicious+IPs+that+try+to+brute+force+SSH+accounts"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/05/29/script-to-automatically-detect-and-ban-malicious-ips-that-try-to-brute-force-ssh-accounts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to ban/unban ips in linux</title>
		<link>http://www.gubatron.com/blog/2008/05/29/how-to-banunban-ips-in-linux/</link>
		<comments>http://www.gubatron.com/blog/2008/05/29/how-to-banunban-ips-in-linux/#comments</comments>
		<pubDate>Thu, 29 May 2008 14:00:59 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ban]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[unban]]></category>
		<category><![CDATA[utils]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=814</guid>
		<description><![CDATA[In case you&#8217;re not an iptables guru, you might want to create a couple scripts and put em somewhere on your $PATH. I&#8217;ve created two scripts called ban_ip and unban_ip. 
Create a file called ban_ip

touch ban_ip
chmod +x ban_ip

Edit it and copy the following code inside:

#!/bin/bash
sudo iptables -A INPUT -s $1 -j DROP
echo IP Address $1 [...]]]></description>
			<content:encoded><![CDATA[<p>In case you&#8217;re not an iptables guru, you might want to create a couple scripts and put em somewhere on your $PATH. I&#8217;ve created two scripts called <strong>ban_ip</strong> and <strong>unban_ip</strong>. </p>
<p>Create a file called ban_ip</p>
<pre>
touch ban_ip
chmod +x ban_ip
</pre>
<p>Edit it and copy the following code inside:</p>
<pre>
#!/bin/bash
sudo iptables -A INPUT -s $1 -j DROP
echo IP Address $1 has been banned
echo
</pre>
<p>To ban an IP, you must invoke</p>
<pre>ban_ip &lt;someIpAddressHere&gt;</pre>
<p>e.g.</p>
<pre>ban_ip 211.32.44.111</pre>
<p>And the IP will be banned.</p>
<p>Do the same now for the unban_ip script</p>
<pre>
touch unban_ip
chmod +x unban_ip
</pre>
<p>Open your fav. text editor and copy the following code inside:</p>
<pre>
#!/bin/bash
iptables -D INPUT -s $1 -j DROP
echo Unbanned ip $1
echo
</pre>
<p>Save it, and use it.</p>
<p>To unban an IP, you must invoke</p>
<pre>unban_ip &lt;someIpAddressHere&gt;</pre>
<p>e.g.</p>
<pre>unban_ip 211.32.44.111</pre>
<p><strong>Requirements</strong><br />
Have sudo access, have iptables installed.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=How+to+ban%2Funban+ips+in+linux+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F&amp;title=How+to+ban%2Funban+ips+in+linux"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F&amp;title=How+to+ban%2Funban+ips+in+linux"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F&amp;title=How+to+ban%2Funban+ips+in+linux"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F&amp;headline=How+to+ban%2Funban+ips+in+linux"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+to+ban%2Funban+ips+in+linux&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+to+ban%2Funban+ips+in+linux&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+to+ban%2Funban+ips+in+linux&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+to+ban%2Funban+ips+in+linux&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+to+ban%2Funban+ips+in+linux&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F&amp;title=How+to+ban%2Funban+ips+in+linux&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F29%2Fhow-to-banunban-ips-in-linux%2F&amp;title=How+to+ban%2Funban+ips+in+linux"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/05/29/how-to-banunban-ips-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Function callbacks in C</title>
		<link>http://www.gubatron.com/blog/2008/05/02/function-callbacks-in-c/</link>
		<comments>http://www.gubatron.com/blog/2008/05/02/function-callbacks-in-c/#comments</comments>
		<pubDate>Fri, 02 May 2008 19:46:27 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[function pointers]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=799</guid>
		<description><![CDATA[Ever since I started programming in Javascript, and doing asynchronous function calls, I&#8217;ve found myself to be addicted to passing functions as parameters.
I do it a lot in python and php, it&#8217;s very easy to do this on all these dynamic typed languages.
I never had this concept of passing functions as parameters, or pointers to [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I started programming in Javascript, and doing asynchronous function calls, I&#8217;ve found myself to be addicted to passing functions as parameters.</p>
<p>I do it a lot in python and php, it&#8217;s very easy to do this on all these dynamic typed languages.</p>
<p>I never had this concept of passing functions as parameters, or pointers to functions as parameters when I was a kid in school and we were doing stuff in C or Pascal, I&#8217;d deal with it with ifs and switches.</p>
<p>So, this afternoon I decided to read a little bit and give it a try in C.</p>
<p>Here&#8217;s some code for future reference If I ever need it, it&#8217;s pretty easy.</p>
<pre>
#include <stdio.h>
void this() { printf("This\n"); }
void that() { printf("That\n"); }

int sum(int x, int y) {	return x+y; }

int mul(int x, int y) { return x*y; }

//Function that takes a callback that uses no parameters
void callanother(void (*callback)()) {
  (*callback)();
}

//Function that takes a callback that
//takes 2 int parameters and returns int
int callComplexCallback(int (*callback)(),int a, int b) {
  return (*callback)(a,b);
}

int main (int argc, char** argv) {
  callanother(this);
  callanother(that);

  printf("\n");

  int w = 20;
  int h = 30;

  printf("%d\n",callComplexCallback(sum,w,h));
  printf("%d\n",callComplexCallback(mul,w,h));

  //this also works
  printf("%d\n",callComplexCallback((*sum),w,h));
  printf("%d\n",callComplexCallback((*mul),w,h));

  return 0;
}
</pre>
<p>The output is this:</p>
<pre>
~$ ./a.out
This
That

50
600
50
600
</pre>
<p>The whole trick is how you define the function that will take the other function as a parameter.</p>
<p>If you have a function:</p>
<pre>
void whatever();
</pre>
<p>The function that&#8217;s supposed to use &#8220;whatever()&#8221; like-functions should look:</p>
<pre>
void useWhateverLikeFunctions(void (*f)()) {
  ...
  (*f)();
}
</pre>
<p>If you have a callback function that needs parameters, then you define the caller as:</p>
<pre>
void callerFunction(void (*f),int paramA, int* paramB, char paramC) {
  ...
  (*f)(paramA,paramB,paramC);
}
</pre>
<p>Then you&#8217;d use the function</p>
<pre>
void someCallback(int a, int* b, char c);

...
callerFunction(someCallback,a,b,c);
...
</pre>
<p>I know this is the oldest thing in the world to C programmers, but it never crossed my mind before, so here it is for my own personal reference, I hope it serves others.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Function+callbacks+in+C+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F&amp;title=Function+callbacks+in+C"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F&amp;title=Function+callbacks+in+C"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F&amp;title=Function+callbacks+in+C"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F&amp;headline=Function+callbacks+in+C"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Function+callbacks+in+C&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Function+callbacks+in+C&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Function+callbacks+in+C&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Function+callbacks+in+C&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Function+callbacks+in+C&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F&amp;title=Function+callbacks+in+C&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Ffunction-callbacks-in-c%2F&amp;title=Function+callbacks+in+C"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/05/02/function-callbacks-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>emacs doesn&#8217;t work after Leopard upgrade?</title>
		<link>http://www.gubatron.com/blog/2008/05/02/emacs-doesnt-work-after-leopard-upgrade/</link>
		<comments>http://www.gubatron.com/blog/2008/05/02/emacs-doesnt-work-after-leopard-upgrade/#comments</comments>
		<pubDate>Fri, 02 May 2008 13:29:54 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mac OSX]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[macosx]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=796</guid>
		<description><![CDATA[After updating from Tiger to Leopard I started getting this error whener I tried to execute emacs:

Fatal malloc_jumpstart() error

The solution was basically to reinstall it with dumpemacs

sudo mv /usr/bin/emacs-i386 /usr/bin/emacs-i386.backup
sudo /usr/libexec/dumpemacs -d
emacs --version
emacs

Via Apple Support Discussions
]]></description>
			<content:encoded><![CDATA[<p>After updating from Tiger to Leopard I started getting this error whener I tried to execute emacs:</p>
<p><code><br />
Fatal malloc_jumpstart() error<br />
</code></p>
<p>The solution was basically to reinstall it with dumpemacs</p>
<p><code><br />
sudo mv /usr/bin/emacs-i386 /usr/bin/emacs-i386.backup<br />
sudo /usr/libexec/dumpemacs -d<br />
emacs --version<br />
emacs<br />
</code></p>
<p><a href="http://discussions.apple.com/thread.jspa?messageID=5747427">Via Apple Support Discussions</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=emacs+doesn%26%238217%3Bt+work+after+Leopard+upgrade%3F+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F&amp;title=emacs+doesn%27t+work+after+Leopard+upgrade%3F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F&amp;title=emacs+doesn%27t+work+after+Leopard+upgrade%3F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F&amp;title=emacs+doesn%27t+work+after+Leopard+upgrade%3F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F&amp;headline=emacs+doesn%27t+work+after+Leopard+upgrade%3F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=emacs+doesn%27t+work+after+Leopard+upgrade%3F&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=emacs+doesn%27t+work+after+Leopard+upgrade%3F&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=emacs+doesn%27t+work+after+Leopard+upgrade%3F&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=emacs+doesn%27t+work+after+Leopard+upgrade%3F&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=emacs+doesn%27t+work+after+Leopard+upgrade%3F&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F&amp;title=emacs+doesn%27t+work+after+Leopard+upgrade%3F&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F05%2F02%2Femacs-doesnt-work-after-leopard-upgrade%2F&amp;title=emacs+doesn%27t+work+after+Leopard+upgrade%3F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/05/02/emacs-doesnt-work-after-leopard-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blooploader 0.6 is Hardy compatible</title>
		<link>http://www.gubatron.com/blog/2008/04/26/blooploader-06-is-hardy-compatible/</link>
		<comments>http://www.gubatron.com/blog/2008/04/26/blooploader-06-is-hardy-compatible/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 21:28:47 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[MyBloop.com]]></category>
		<category><![CDATA[blooploader]]></category>
		<category><![CDATA[file sharing]]></category>
		<category><![CDATA[file storage]]></category>
		<category><![CDATA[hardy]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mybloop]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[uploading]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/?p=788</guid>
		<description><![CDATA[
Blooploader 0.6 running on Hardy. Currently available only via subversion.
For our Linux users, you can safely update to Ubuntu Hardy if the one thing holding your breath was compatibility with the Blooploader.
Currently we run the Blooploader in Linux from source, you just need to have installed, Qt4,  sip4, and PyQt4 on your machine. If [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://farm4.static.flickr.com/3273/2440701311_394f9216d1_o.png"><img src="http://farm4.static.flickr.com/3273/2440701311_9733eb15cd_m.jpg" align="left" style="margin:10px 10px" border="0"/></a><br />
Blooploader 0.6 running on Hardy. Currently available only via subversion.</p>
<p>For our Linux users, you can safely update to Ubuntu Hardy if the one thing holding your breath was compatibility with the Blooploader.</p>
<p>Currently we run the Blooploader in Linux from source, you just need to have installed, Qt4,  sip4, and PyQt4 on your machine. If you are an Ubuntu user this translates to:</p>
<ol>
<li>Checking out the source from our <a href="http://code.google.com/p/blooploader/source/checkout">subversion repository</a></li>
<li>sudo apt-get install python-sip4 python-qt4 python-qt-4-common</li>
<li>./run</li>
</ol>
<p>For those of you that want to try the Blooploader in Ubuntu, and you have no clue on how to use the command line, we promise we&#8217;ll have a new .deb installer for our next release now that Hardy has enabled binary packages on their repository for all our dependencies.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Blooploader+0.6+is+Hardy+compatible+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F&amp;title=Blooploader+0.6+is+Hardy+compatible"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F&amp;title=Blooploader+0.6+is+Hardy+compatible"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F&amp;title=Blooploader+0.6+is+Hardy+compatible"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F&amp;headline=Blooploader+0.6+is+Hardy+compatible"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Blooploader+0.6+is+Hardy+compatible&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Blooploader+0.6+is+Hardy+compatible&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Blooploader+0.6+is+Hardy+compatible&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Blooploader+0.6+is+Hardy+compatible&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Blooploader+0.6+is+Hardy+compatible&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F&amp;title=Blooploader+0.6+is+Hardy+compatible&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fblooploader-06-is-hardy-compatible%2F&amp;title=Blooploader+0.6+is+Hardy+compatible"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/04/26/blooploader-06-is-hardy-compatible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Pirate Bay, err, The Liberty Bay</title>
		<link>http://www.gubatron.com/blog/2008/04/26/the-pirate-bay-err-the-liberty-bay/</link>
		<comments>http://www.gubatron.com/blog/2008/04/26/the-pirate-bay-err-the-liberty-bay/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 19:20:25 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[gta]]></category>
		<category><![CDATA[piratebay]]></category>
		<category><![CDATA[pissing people]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[thepiratebay]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2008/04/26/the-pirate-bay-err-the-liberty-bay/</guid>
		<description><![CDATA[
A Screenshot of today&#8217;s ThePirateBay.org homepage.
&#8220;Hint Hint?&#8221; These guys certainly like to piss people off to get media attention and more traffic for that high priced CPM they must have.read more &#124; digg story
]]></description>
			<content:encoded><![CDATA[<p><a href="http://flickr.com/photos/gubatron/2443825378/sizes/o/"><img src="http://farm4.static.flickr.com/3292/2443825378_e83464e62f_m.jpg" border="0" align="right" style="margin:10px 10px"/></a><br />
A Screenshot of today&#8217;s <a href="http://www.thepiratebay.org">ThePirateBay.org</a> homepage.<br />
&#8220;Hint Hint?&#8221; These guys certainly like to piss people off to get media attention and more traffic for that high priced CPM they must have.<br/><br/><a href="http://flickr.com/photos/gubatron/2443825378/sizes/o/">read more</a> | <a href="http://digg.com/gaming_news/The_Pirate_Bay_err_The_Liberty_Bay">digg story</a></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F&amp;title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F&amp;title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F&amp;title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F&amp;headline=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F&amp;title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F04%2F26%2Fthe-pirate-bay-err-the-liberty-bay%2F&amp;title=The+Pirate+Bay%2C+err%2C+The+Liberty+Bay"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/04/26/the-pirate-bay-err-the-liberty-bay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Python] ip2num / num2ip &#8211; Store an IP string as a 4 byte int.</title>
		<link>http://www.gubatron.com/blog/2008/03/27/python-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int/</link>
		<comments>http://www.gubatron.com/blog/2008/03/27/python-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 16:40:37 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[bytes]]></category>
		<category><![CDATA[ip2num]]></category>
		<category><![CDATA[num2ip]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2008/03/27/python-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int/</guid>
		<description><![CDATA[This is probably everywhere, maybe python also comes with it, but I wanted to have my own implementation, and I&#8217;ll leave it here for future reference.
Basically, sometimes you don&#8217;t want to store IPs in Strings cause they take too much space, instead you want to be a good programmer and store them as 4 bytes [...]]]></description>
			<content:encoded><![CDATA[<p>This is probably everywhere, maybe python also comes with it, but I wanted to have my own implementation, and I&#8217;ll leave it here for future reference.</p>
<p>Basically, sometimes you don&#8217;t want to store IPs in Strings cause they take too much space, instead you want to be a good programmer and store them as 4 bytes (IPv4 that is).</p>
<p>So here&#8217;s a couple of functions in python to illustrate the conversion process between string to 4 byte integer, or viceversa:</p>
<pre>
def ip2num(ipString):
    if ipString is None:
        raise Exception("Invalid IP")

    try:
       octets = [octet.strip() for octet in ipString.split('.')]
    except Exception,e:
        raise e

    num = (int(octets[0])<<24) + (int(octets[1])<<16) + (int(octets[2])<<8) + int(octets[3])
    return num

def num2ip(numericIp):
    if numericIp is None or type(numericIp) != int:
        raise Exception("Invalid numeric IP. Must be an integer")
    return str(numericIp >> 24) + '.' + str((numericIp >> 16) &#038; 255) + '.' + str((numericIp >> 8) &#038; 255) + '.' + str(numericIp &#038; 255)
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=%5BPython%5D+ip2num+%2F+num2ip+%26%238211%3B+Store+a...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F&amp;title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F&amp;title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F&amp;title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F&amp;headline=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F&amp;title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F27%2Fpython-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int%2F&amp;title=%5BPython%5D+ip2num+%2F+num2ip+-+Store+an+IP+string+as+a+4+byte+int."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/03/27/python-ip2num-num2ip-store-an-ip-string-as-a-4-byte-int/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safari 3.1 Benchmark part II &#8211; VS Firefox 3.0b4</title>
		<link>http://www.gubatron.com/blog/2008/03/20/safari-31-benchmark-part-ii-vs-firefox-30b4/</link>
		<comments>http://www.gubatron.com/blog/2008/03/20/safari-31-benchmark-part-ii-vs-firefox-30b4/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 19:53:47 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[3.1]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[ff3]]></category>
		<category><![CDATA[firefox3]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[safari3.1]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2008/03/20/safari-31-benchmark-part-ii-vs-firefox-30b4/</guid>
		<description><![CDATA[This is the Part II of Benchmarks between Safari 3.1&#8217;s JavaScript engine and Firefox. Last Benchmark was done against Firefox 2, and Safari destroyed Firefox&#8217;s Javascript engine, in some aspects being up to 7 times faster.
So I was curious and I downloaded and tried the benchmark on Firefox 3.0b4. to see how much Firefox 3.0 [...]]]></description>
			<content:encoded><![CDATA[<p>This is the Part II of <a href="http://www.gubatron.com/blog/2008/03/19/new-safaris-javascript-engine-kicks-ass/">Benchmarks between Safari 3.1&#8217;s JavaScript engine and Firefox</a>. Last Benchmark was done against Firefox 2, and Safari destroyed Firefox&#8217;s Javascript engine, in some aspects being up to 7 times faster.</p>
<p>So I was curious and I downloaded and tried the benchmark on Firefox 3.0b4. to see how much Firefox 3.0 will improve its Javascript performance, key to today&#8217;s web applications and the future of the web.</p>
<p>After seeing the results, I say Kudos to the Firefox 3 team, they&#8217;ve improved considerably their JavaScript engine and that only makes me glad cause I won&#8217;t have to switch to Safari. :)</p>
<p>I will not make any tests on HTML rendering, if you find any benchmark results on HTML rendering, please leave links on the comments section.</p>
<p>Once again, here are the results side by side:</p>
<style>
pre {
border:none;
font-size:9px;
}
</style>
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<pre style="background-color:#FFCC00; width:205px">FIREFOX 3.0b4
========================
RESULTS
(means and 95% confidence intervals)
-----------------------------------------
Total:                 3876.6ms +/- 0.9%
-----------------------------------------

  3d:                   489.0ms +/- 1.3%
    cube:               193.8ms +/- 1.2%
    morph:              138.2ms +/- 1.5%
    raytrace:           157.0ms +/- 3.8%

  access:               594.2ms +/- 5.6%
    binary-trees:        57.4ms +/- 5.9%
    fannkuch:           246.0ms +/- 0.8%
    nbody:              219.8ms +/- 13.6%
    nsieve:              71.0ms +/- 2.1%

  bitops:               470.4ms +/- 0.7%
    3bit-bits-in-byte:   67.8ms +/- 1.5%
    bits-in-byte:        90.8ms +/- 1.8%
    bitwise-and:        177.4ms +/- 1.1%
    nsieve-bits:        134.4ms +/- 0.5%

  controlflow:           42.4ms +/- 1.6%
    recursive:           42.4ms +/- 1.6%

  crypto:               257.2ms +/- 1.2%
    aes:                 87.4ms +/- 1.3%
    md5:                 83.8ms +/- 4.0%
    sha1:                86.0ms +/- 0.0%

  date:                 412.0ms +/- 0.4%
    format-tofte:       251.6ms +/- 0.6%
    format-xparb:       160.4ms +/- 0.4%

  math:                 502.0ms +/- 2.2%
    cordic:             188.0ms +/- 0.5%
    partial-sums:       231.2ms +/- 5.2%
    spectral-norm:       82.8ms +/- 3.6%

  regexp:               275.6ms +/- 1.0%
    dna:                275.6ms +/- 1.0%

  string:               833.8ms +/- 0.7%
    base64:              98.6ms +/- 1.4%
    fasta:              228.8ms +/- 3.2%
    tagcloud:           166.2ms +/- 0.6%
    unpack-code:        218.6ms +/- 0.5%
    validate-input:     121.6ms +/- 0.6%
</pre>
</td>
<td valign="top">
<pre "background-color:#888; width:205px">SAFARI 3.1
========================
RESULTS
(means and 95% confidence intervals)
-----------------------------------------
Total:                 <strong>3368.8ms</strong> +/- 1.0%
-----------------------------------------

  3d:                   414.8ms +/- 1.9%
    cube:               132.2ms +/- 2.4%
    morph:              144.6ms +/- 4.1%
    raytrace:           138.0ms +/- 0.6%

  access:               520.4ms +/- 4.1%
    binary-trees:        78.6ms +/- 11.3%
    fannkuch:           231.4ms +/- 2.0%
    nbody:              149.2ms +/- 8.1%
    nsieve:              61.2ms +/- 3.9%

  bitops:               449.6ms +/- 2.4%
    3bit-bits-in-byte:   69.8ms +/- 9.6%
    bits-in-byte:        99.2ms +/- 4.6%
    bitwise-and:        167.2ms +/- 2.3%
    nsieve-bits:        113.4ms +/- 6.7%

  controlflow:           91.2ms +/- 4.7%
    recursive:           91.2ms +/- 4.7%

  crypto:               247.2ms +/- 2.3%
    aes:                 81.2ms +/- 2.5%
    md5:                 83.8ms +/- 4.6%
    sha1:                82.2ms +/- 2.0%

  date:                 306.4ms +/- 0.5%
    format-tofte:       146.6ms +/- 1.4%
    format-xparb:       159.8ms +/- 1.0%

  math:                 454.8ms +/- 1.3%
    cordic:             174.4ms +/- 1.6%
    partial-sums:       193.8ms +/- 1.2%
    spectral-norm:       86.6ms +/- 4.4%

  regexp:               209.6ms +/- 0.7%
    dna:                209.6ms +/- 0.7%

  string:               674.8ms +/- 2.2%
    base64:             103.8ms +/- 9.0%
    fasta:              177.0ms +/- 1.0%
    tagcloud:           136.0ms +/- 4.6%
    unpack-code:        136.0ms +/- 1.7%
    validate-input:     122.0ms +/- 2.6%
</pre>
</td>
</tr>
</table>
<p>Almost there. Only in Flow control and recursion it beats Safari, the rest needs to improve, however, it&#8217;s improved a lot comparing to the previous version of Firefox.</p>
<p><center><img src="http://farm3.static.flickr.com/2174/2345121485_4a81e90d19.jpg?v=0"/></center></p>
<p>The machine used for this test is a MacBook Pro running Mac OS X Version 10.4.11 with a 2.33 GHz Intel Core 2 Duo and 2GB 667 MHz DDR2 SDRAM.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Safari+3.1+Benchmark+part+II+%26%238211%3B+VS+Firefox+3.0b4+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F&amp;title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F&amp;title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F&amp;title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F&amp;headline=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F&amp;title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F20%2Fsafari-31-benchmark-part-ii-vs-firefox-30b4%2F&amp;title=Safari+3.1+Benchmark+part+II+-+VS+Firefox+3.0b4"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/03/20/safari-31-benchmark-part-ii-vs-firefox-30b4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Safari&#8217;s JavaScript engine Kicks Ass!</title>
		<link>http://www.gubatron.com/blog/2008/03/19/new-safaris-javascript-engine-kicks-ass/</link>
		<comments>http://www.gubatron.com/blog/2008/03/19/new-safaris-javascript-engine-kicks-ass/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 17:51:00 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2008/03/19/new-safaris-javascript-engine-kicks-ass/</guid>
		<description><![CDATA[So I downloaded yesterday the latest Software Update for Mac OSX and it included an update of the Safari Web Browser, which I had taken for dead ages ago, I&#8217;m a hardcore Firefox user.
Today I read about the new updates, and I read something that caught my eye at Mackinando.com.
it executes JavaScript six times faster [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm3.static.flickr.com/2094/2345178853_2f0af7ce85.jpg?v=0" align="right" style="margin:10px"/>So I downloaded yesterday the latest Software Update for Mac OSX and it included an update of the Safari Web Browser, which I had taken for dead ages ago, I&#8217;m a hardcore Firefox user.</p>
<p>Today I read about the new updates, and I read something that caught my eye at <a href="http://www.mackinando.com">Mackinando.com</a>.</p>
<blockquote><p>it executes JavaScript six times faster than the rest</p></blockquote>
<p>I go to the Safari Site, and they compare themselves with a previous version, Firefox, and Opera (not IE, not even worth mentioning)</p>
<p>I couldn&#8217;t believe my eyes, so I googled for &#8220;<a href="http://www.google.com/search?client=safari&#038;rls=en&#038;q=Javascript+benchmark&#038;ie=UTF-8&#038;oe=UTF-8">JavaScript Benchmark</a>&#8220;, and tried the <a href="http://webkit.org/perf/sunspider-0.9/sunspider.html">SunSpider JavaScript Benchmark</a> onboth Firefox 2.0.0.12 and the shiny new Safari 3.1.</p>
<p><center><img src="http://farm3.static.flickr.com/2174/2345121485_4a81e90d19.jpg?v=0"/></center></p>
<p>The machine used for this test is a MacBook Pro running Mac OS X Version 10.4.11 with a 2.33 GHz Intel Core 2 Duo and 2GB 667 MHz DDR2 SDRAM.</p>
<p>Here are the results side by side:</p>
<style>
pre {
border:none;
font-size:9px;
}
</style>
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<pre style="background-color:#FFCC00; width:205px">FIREFOX 2.0.0.12
========================
RESULTS
(means and 95% confidence intervals)
-----------------------------------------
Total:                 <strong>15365.4ms</strong> +/- 1.7%
-----------------------------------------

  3d:                   2386.6ms +/- 7.9%
    cube:                733.0ms +/- 20.8%
    morph:              1269.8ms +/- 9.4%
    raytrace:            383.8ms +/- 37.1%

  access:               1386.2ms +/- 4.8%
    binary-trees:        201.6ms +/- 0.6%
    fannkuch:            294.8ms +/- 5.4%
    nbody:               691.2ms +/- 8.9%
    nsieve:              198.6ms +/- 1.5%

  bitops:               3461.2ms +/- 0.4%
    3bit-bits-in-byte:   275.8ms +/- 0.6%
    bits-in-byte:        248.2ms +/- 0.7%
    bitwise-and:        2765.2ms +/- 0.5%
    nsieve-bits:         172.0ms +/- 4.7%

  controlflow:           153.4ms +/- 0.7%
    recursive:           153.4ms +/- 0.7%

  crypto:                527.2ms +/- 0.5%
    aes:                 230.8ms +/- 1.2%
    md5:                 147.4ms +/- 0.5%
    sha1:                149.0ms +/- 0.6%

  date:                 2551.8ms +/- 0.3%
    format-tofte:       1449.6ms +/- 0.3%
    format-xparb:       1102.2ms +/- 0.8%

  math:                 1312.6ms +/- 12.8%
    cordic:              497.4ms +/- 12.0%
    partial-sums:        501.6ms +/- 1.6%
    spectral-norm:       313.6ms +/- 36.1%

  regexp:                501.0ms +/- 0.2%
    dna:                 501.0ms +/- 0.2%

  string:               3085.4ms +/- 10.3%
    base64:              914.6ms +/- 3.4%
    fasta:               676.0ms +/- 35.4%
    tagcloud:            441.4ms +/- 0.6%
    unpack-code:         846.8ms +/- 25.4%
    validate-input:      206.6ms +/- 1.1%
</pre>
</td>
<td valign="top">
<pre "background-color:#888; width:205px">SAFARI 3.1
========================
RESULTS
(means and 95% confidence intervals)
-----------------------------------------
Total:                 <strong>3368.8ms</strong> +/- 1.0%
-----------------------------------------

  3d:                   414.8ms +/- 1.9%
    cube:               132.2ms +/- 2.4%
    morph:              144.6ms +/- 4.1%
    raytrace:           138.0ms +/- 0.6%

  access:               520.4ms +/- 4.1%
    binary-trees:        78.6ms +/- 11.3%
    fannkuch:           231.4ms +/- 2.0%
    nbody:              149.2ms +/- 8.1%
    nsieve:              61.2ms +/- 3.9%

  bitops:               449.6ms +/- 2.4%
    3bit-bits-in-byte:   69.8ms +/- 9.6%
    bits-in-byte:        99.2ms +/- 4.6%
    bitwise-and:        167.2ms +/- 2.3%
    nsieve-bits:        113.4ms +/- 6.7%

  controlflow:           91.2ms +/- 4.7%
    recursive:           91.2ms +/- 4.7%

  crypto:               247.2ms +/- 2.3%
    aes:                 81.2ms +/- 2.5%
    md5:                 83.8ms +/- 4.6%
    sha1:                82.2ms +/- 2.0%

  date:                 306.4ms +/- 0.5%
    format-tofte:       146.6ms +/- 1.4%
    format-xparb:       159.8ms +/- 1.0%

  math:                 454.8ms +/- 1.3%
    cordic:             174.4ms +/- 1.6%
    partial-sums:       193.8ms +/- 1.2%
    spectral-norm:       86.6ms +/- 4.4%

  regexp:               209.6ms +/- 0.7%
    dna:                209.6ms +/- 0.7%

  string:               674.8ms +/- 2.2%
    base64:             103.8ms +/- 9.0%
    fasta:              177.0ms +/- 1.0%
    tagcloud:           136.0ms +/- 4.6%
    unpack-code:        136.0ms +/- 1.7%
    validate-input:     122.0ms +/- 2.6%
</pre>
</td>
</tr>
</table>
<p>Comparing with Firefox, the overall result of this test was that it&#8217;s 4.56 times faster.</p>
<p>However, if we look test by test, there are areas where I feel embarrassed for Firefox.</p>
<p><strong>Bitwise Operations</strong><br />
For example, Bit-Operation tests in Safari 3.1 are 7.7 times faster in Safari, being the case of the bitwise-AND (&#038;) operator the worst of them, <strong>Safari performed bitwise-and&#8217;s 16 times faster than Firefox</strong></p>
<p>OUCH!!</p>
<p><strong>String Operations</strong><br />
So you&#8217;d be curious now about String operations, which is probably a lot of what goes on with Javascript, and Ajax, parsing those XML results and what not, maybe the bitwise &#038; won&#8217;t hurt us that much given that not many programmers today are smart enough to use them for web programming.</p>
<p>When it comes to String operations, Safari 3.1 was 4.5 times faster than Firefox 2.</p>
<p>Kudos to the Safari Team, I thought there was no point in having Safari until I did this benchmark. I guess they don&#8217;t want to let go of Web Browser users, maybe they make millions every month with ad-clicks on Google generated with the search field they have at the top of the browser which is set by default to do Google search.</p>
<p>Once again the saying proves it self</p>
<blockquote><p>&#8220;Competition is good&#8221;</p></blockquote>
<p>Let&#8217;s hope this will make the Firefox team think more on Javascript improvements with the upcoming Firefox 3. Once it&#8217;s release ready, it&#8217;ll be worth it running this benchmark again and see where it stands.</p>
<p><strong>Update (March 20th, 2008)</strong></p>
<p>I&#8217;ve made tests on Firefox 3 beta 4, <a href="http://www.gubatron.com/blog/2008/03/20/safari-31-benchmark-part-ii-vs-firefox-30b4/">You can see the results here</a>. Tests have been made again on the same Macbook Pro. The improvements of Firefox 3 are notable, however, on the mac, Safari still wins.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=New+Safari%26%238217%3Bs+JavaScript+engine+Kicks+Ass%21+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F&amp;title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F&amp;title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F&amp;title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F&amp;headline=New+Safari%27s+JavaScript+engine+Kicks+Ass%21"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=New+Safari%27s+JavaScript+engine+Kicks+Ass%21&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F&amp;title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F03%2F19%2Fnew-safaris-javascript-engine-kicks-ass%2F&amp;title=New+Safari%27s+JavaScript+engine+Kicks+Ass%21"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/03/19/new-safaris-javascript-engine-kicks-ass/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>VIDEO: Linus habla sobre GIT, su &#8220;subversion&#8221; distribuido</title>
		<link>http://www.gubatron.com/blog/2008/02/02/video-linus-habla-sobre-git-su-subversion-distribuido/</link>
		<comments>http://www.gubatron.com/blog/2008/02/02/video-linus-habla-sobre-git-su-subversion-distribuido/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 18:31:14 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[linus]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2008/02/02/video-linus-habla-sobre-git-su-subversion-distribuido/</guid>
		<description><![CDATA[Aqui hay un Google talk por el mismisimo Linus, quien habla sobre su nuevo sistema de control de versiones distribuido. El cual promete se mas rapido, distribuido, y ocupar menos espacio. Algunos claman que pudiera utilizarse como un sistema de archivos distribuidos que nos permitira crear sistemas que antes eran inconcebibles.

]]></description>
			<content:encoded><![CDATA[<p>Aqui hay un Google talk por el mismisimo Linus, quien habla sobre su nuevo sistema de control de versiones distribuido. El cual promete se mas rapido, distribuido, y ocupar menos espacio. Algunos claman que pudiera utilizarse como un sistema de archivos distribuidos que nos permitira crear sistemas que antes eran inconcebibles.</p>
<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/4XpnKHJAok8&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/4XpnKHJAok8&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%26%238220%3Bsu...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F&amp;title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F&amp;title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F&amp;title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F&amp;headline=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F&amp;title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F02%2Fvideo-linus-habla-sobre-git-su-subversion-distribuido%2F&amp;title=VIDEO%3A+Linus+habla+sobre+GIT%2C+su+%22subversion%22+distribuido"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/02/02/video-linus-habla-sobre-git-su-subversion-distribuido/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Checking what PyQt4 version you&#8217;re running</title>
		<link>http://www.gubatron.com/blog/2008/02/01/checking-what-pyqt4-version-youre-running/</link>
		<comments>http://www.gubatron.com/blog/2008/02/01/checking-what-pyqt4-version-youre-running/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 05:33:52 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Qt4]]></category>
		<category><![CDATA[checking]]></category>
		<category><![CDATA[pyqt]]></category>
		<category><![CDATA[pyqt4]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2008/02/01/checking-what-pyqt4-version-youre-running/</guid>
		<description><![CDATA[This is one of those things I tend to forget

>>> PyQt4.Qt.qVersion()
'4.3.3'

]]></description>
			<content:encoded><![CDATA[<p>This is one of those things I tend to forget</p>
<p><code><br />
>>> PyQt4.Qt.qVersion()<br />
'4.3.3'<br />
</code></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Checking+what+PyQt4+version+you%26%238217%3Bre+running+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F&amp;title=Checking+what+PyQt4+version+you%27re+running"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F&amp;title=Checking+what+PyQt4+version+you%27re+running"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F&amp;title=Checking+what+PyQt4+version+you%27re+running"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F&amp;headline=Checking+what+PyQt4+version+you%27re+running"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Checking+what+PyQt4+version+you%27re+running&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Checking+what+PyQt4+version+you%27re+running&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Checking+what+PyQt4+version+you%27re+running&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Checking+what+PyQt4+version+you%27re+running&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Checking+what+PyQt4+version+you%27re+running&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F&amp;title=Checking+what+PyQt4+version+you%27re+running&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2008%2F02%2F01%2Fchecking-what-pyqt4-version-youre-running%2F&amp;title=Checking+what+PyQt4+version+you%27re+running"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2008/02/01/checking-what-pyqt4-version-youre-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyQt4: Using QMutex vs QMutexLocker.</title>
		<link>http://www.gubatron.com/blog/2007/11/25/pyqt4-using-qmutex-vs-qmutexlocker/</link>
		<comments>http://www.gubatron.com/blog/2007/11/25/pyqt4-using-qmutex-vs-qmutexlocker/#comments</comments>
		<pubDate>Sun, 25 Nov 2007 23:23:01 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Qt4]]></category>
		<category><![CDATA[python qt4 pyqt3 mutex qmutex qmutexlocker]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/11/25/pyqt4-using-qmutex-vs-qmutexlocker/</guid>
		<description><![CDATA[Here&#8217;s some code for my future reference on how to use QMutex or QMutexLocker.
Lessons Learned:
 * Use QMutex to protect data, not code. Try not to lock hughe amounts of code within a function with mutex.lock(), mutex.unlock(), if for any reason you forget to release the lock you&#8217;ll be in trouble. Use the mutex directly [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s some code for my future reference on how to use QMutex or QMutexLocker.</p>
<p>Lessons Learned:<br />
 * Use QMutex to protect data, not code. Try not to lock hughe amounts of code within a function with mutex.lock(), mutex.unlock(), if for any reason you forget to release the lock you&#8217;ll be in trouble. Use the mutex directly only when you know what it is that you want to protect concurrent access from.<br />
 * When you have a complex function and you don&#8217;t want to worry about what to protect and when to release the lock (on exceptions thrown, before returns,etc), you can create an instance of QMutexLocker and it should release the mutex lock upon destruction&#8230; this takes us to the next lesson<br />
 * When using a QMutexLocker, DO NOT make the QMutexLocker an attribute of your class, otherwise, the reference will live after the method finishes and the lock won&#8217;t be released.</p>
<p>Here&#8217;s some code.</p>
<pre>
from PyQt4.Qt import QObject, QMutex, QApplication, QThread, QMutexLocker
import sys

class MutexTestSubject(QObject):
	'''
	Class that uses a QMutex to synchronize
        access to its add(),substract() methods.

        This works perfectly fine.
	'''
	def __init__(self):
		QObject.__init__(self)
		self.MAX_LIMIT = 100
		self.MIN_LIMIT = 0
		self.counter = 50
		self.mutex = QMutex()

	def add(self):
		self.mutex.lock()
		if self.counter < self.MAX_LIMIT:
			self.counter = self.counter + 1
		self.mutex.unlock()

	def substract(self):
		self.mutex.lock()
		if self.counter > self.MIN_LIMIT:
			self.counter = self.counter - 1
		self.mutex.unlock()

	def printStatus(self,thread):
		print "Counter:",self.counter," - Thread:",id(thread)

		if self.counter > self.MAX_LIMIT+1 or self.counter < self.MIN_LIMIT:
			print "Stopping Threads, Max Surpassed, Not Thread Safe. Last Thread:",id(thread)
			sys.exit()

class MutexLockerTestSubject(QObject):
	'''
	Class that attemps to synchronize thread
 	access to its add(),substract() methods with
	the QMutexLocker object.
	'''
	def __init__(self):
		QObject.__init__(self)
		self.MAX_LIMIT = 100
		self.MIN_LIMIT = 0
		self.counter = 50
		self.mutex = QMutex()

	def add(self):
		#VIP: DO NOT MAKE mutexLocker an attribute of your class.
		#other wise it won't be destroyed and the lock will never be released.
		mutexLocker = QMutexLocker(self.mutex)
		if self.counter < self.MAX_LIMIT:
			self.counter = self.counter + 1

	def substract(self):
		mutexLocker = QMutexLocker(self.mutex)
		if self.counter > self.MIN_LIMIT:
			self.counter = self.counter - 1

	def printStatus(self,thread):
		print "Counter:",self.counter," - Thread:",id(thread)

		if self.counter > self.MAX_LIMIT+1 or self.counter < self.MIN_LIMIT:
			print "Stopping Threads, Max Surpassed, Not Thread Safe. Last Thread:",id(thread)
			sys.exit()

class AdderWorker(QThread):
	def __init__(self, mutexTestObject):
		self.mutexTestObject = mutexTestObject
		QThread.__init__(self)

	def run(self):
		while(True):
			self.mutexTestObject.add()
			self.mutexTestObject.printStatus(self)

class SubstractorWorker(QThread):
	def __init__(self, mutexTestObject):
		self.mutexTestObject = mutexTestObject
		QThread.__init__(self,mutexTestObject)

	def run(self):
		while(True):
			self.mutexTestObject.substract()
			self.mutexTestObject.printStatus(self)

if __name__ == "__main__":
	USE_MUTEX_LOCKER = True #switch this to use regular mutexes vd QMutexLocker
	app = QApplication(sys.argv)
	mutexTestObject = MutexTestSubject() if not USE_MUTEX_LOCKER else MutexLockerTestSubject()

	adderThread  = AdderWorker(mutexTestObject)
	substracterThread = SubstractorWorker(mutexTestObject)

	adderThread.start()
	substracterThread.start()

	sys.exit(app.exec_())
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=PyQt4%3A+Using+QMutex+vs+QMutexLocker.+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F&amp;title=PyQt4%3A+Using+QMutex+vs+QMutexLocker."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F&amp;title=PyQt4%3A+Using+QMutex+vs+QMutexLocker."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F&amp;title=PyQt4%3A+Using+QMutex+vs+QMutexLocker."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F&amp;headline=PyQt4%3A+Using+QMutex+vs+QMutexLocker."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=PyQt4%3A+Using+QMutex+vs+QMutexLocker.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=PyQt4%3A+Using+QMutex+vs+QMutexLocker.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=PyQt4%3A+Using+QMutex+vs+QMutexLocker.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=PyQt4%3A+Using+QMutex+vs+QMutexLocker.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=PyQt4%3A+Using+QMutex+vs+QMutexLocker.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F&amp;title=PyQt4%3A+Using+QMutex+vs+QMutexLocker.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F11%2F25%2Fpyqt4-using-qmutex-vs-qmutexlocker%2F&amp;title=PyQt4%3A+Using+QMutex+vs+QMutexLocker."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/11/25/pyqt4-using-qmutex-vs-qmutexlocker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ssh-add -l -&gt; Cannot connect to your agent.</title>
		<link>http://www.gubatron.com/blog/2007/09/21/ssh-add-l-cannot-connect-to-your-agent/</link>
		<comments>http://www.gubatron.com/blog/2007/09/21/ssh-add-l-cannot-connect-to-your-agent/#comments</comments>
		<pubDate>Fri, 21 Sep 2007 20:54:45 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/09/21/ssh-add-l-cannot-connect-to-your-agent/</guid>
		<description><![CDATA[keychain not working for ya&#8230;
you run ssh-agent but ssh-add won&#8217;t add the keys.
This is probably because your SSH_AGENT_PID and SSH_AUTH_SOCK variables are incorrect&#8230;
so I recommend you put something like this on your .bashrc to initialize your ssh-agent correctly:

export SSH_AGENT_PID=
export SSH_AUTH_SOCK=

#make sure no old agents are running
killall ssh-agent

#grab the text output of ssh-agent and evaluate it
#so [...]]]></description>
			<content:encoded><![CDATA[<p>keychain not working for ya&#8230;<br />
you run ssh-agent but ssh-add won&#8217;t add the keys.</p>
<p>This is probably because your SSH_AGENT_PID and SSH_AUTH_SOCK variables are incorrect&#8230;</p>
<p>so I recommend you put something like this on your .bashrc to initialize your ssh-agent correctly:</p>
<pre>
export SSH_AGENT_PID=
export SSH_AUTH_SOCK=

#make sure no old agents are running
killall ssh-agent

#grab the text output of ssh-agent and evaluate it
#so the correct variables are exported
eval `ssh-agent`

#add your private key(s) to the agent
ssh-add ~/.ssh/id_dsa
#ssh-add ~/.ssh/my_other_dsa_key

#at this point the script will ask you for the passwords of your keys
#if you protected them with passwords (recommended)

#list the available keys to make sure they were added
ssh-add -l
</pre>
<p>After this, you should be able to login without a password, on whatever other hosts you put the public keys (at .ssh/authorized_keys or .ssh/authorized_keys2)</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=ssh-add+-l+-%3E+Cannot+connect+to+your+agent.+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F&amp;title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F&amp;title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F&amp;title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F&amp;headline=ssh-add+-l+-%3E+Cannot+connect+to+your+agent."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=ssh-add+-l+-%3E+Cannot+connect+to+your+agent.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F&amp;title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F21%2Fssh-add-l-cannot-connect-to-your-agent%2F&amp;title=ssh-add+-l+-%3E+Cannot+connect+to+your+agent."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/09/21/ssh-add-l-cannot-connect-to-your-agent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Emacs Pocket Guide</title>
		<link>http://www.gubatron.com/blog/2007/09/12/emacs-pocket-guide/</link>
		<comments>http://www.gubatron.com/blog/2007/09/12/emacs-pocket-guide/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 17:31:33 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/09/12/emacs-pocket-guide/</guid>
		<description><![CDATA[I wrote this a long long time ago when I was learning emacs, then pasted it on linuxmachos.org, but that site is down atm.
So here&#8217;s for future reference

EMACS POCKET GUIDE

Ctrl+g          Cancels anything (useful for n00bs)

== Saving ==
Ctrl+x s        Save [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this a long long time ago when I was learning emacs, then pasted it on linuxmachos.org, but that site is down atm.<br />
So here&#8217;s for future reference</p>
<pre>
EMACS POCKET GUIDE

Ctrl+g          Cancels anything (useful for n00bs)

== Saving ==
Ctrl+x s        Save buffer (buffer a.k.a filez)
Ctrl+x Ctrl+w   Save As

== Opening and switching buffers ==
Ctrl+x Ctrl+f   Para abrir buffers (archivos)
Ctrl+x k        Close buffer
Ctrl+x b Enter  Switch to previous opened buffer

Ctrl+x b Tab
Ctrl+x Ctrl+b   Show list of open buffers

== Looking at several buffers at the same time ==
Ctrl+x 2 Split buffer with horizontal bar
Ctrl+x 3 Split buffer with vertical bar
(You can subdivide the screen up to like 64 viewports)

Ctrl+x 1 unsplits everything, only 1 buffer at the time

Ctrl+x o Switch focus to next split buffer

== Select, Copy, Cut, Paste ==
Ctrl+spacebar   Mark the beggining of a text region
Ctrl+w          Wipe (a.k.a Cut)
Alt +w          Copy
Ctrl+y          Paste
Ctrl+k          Cut from the cursor to the end of the line
Ctrl+u          Cut from the cursor to the beggining of the line

Also everything that you select with the mouse will be on the clipboard
and you can paste with middle click (or two button click if you have a 2 button mouse)

Alt+x transient-mark-mode  Makes you see what the selection looks like (highlighting)

Ctrl+d Delete in front of cursor (DELETE)

== Moving around (Search, Replace, Moving cursor fast) ==
Ctrl+s texto   Forward Search
Ctrl+r texto   Reverse search

Once you start the search, press Ctrl+S again, or Ctrl+r to 'keep-on-trucking'
You can stop with the arrow keys, or pressing enter.

Alt+x query-replace Search and replace interactively
                    Press 'y' to replace, 'n' to skip and keep searching

Alt+x replace-string Search and replace everything

Alt+x query-replace-regexp  Interactive Regexp Search and Replace
Alt+x replace-regexp        Non-Interactive Regexp Search and Replace

Alt+f      Move one word forward
Ctrl+right Move one word forward (won't work on console emacs, X-Emacs only)
Alt+b      Move one word back
Ctrl+left  Move one word back (won't work on console emacs, X-Emacs only)

Ctrl+up   Move one paragraph up (X-Emacs only)
Ctrl+down Move one paragraph down (X-Emacs only)

Alt +v Page up
Ctrl+v Page down

Esc &lt;  Go to the very beggining of the buffer
Esc &gt;  Go to the very end

Alt+x goto-line  Go to a line number

Since doing goto-line like that is too long, add a shortcut on your .emacs
==================================================
(define-key esc-map &quot;g&quot; 'goto-line)
==================================================
Now it'll work with Esc-g

Ctrl+shift -
Ctrl /          UNDO

== Sorting ==
Alt+x sort-lines Sort lines alphabetically

== Indentation y Code Completion ==
Alt + \  Word completion, repeat as necessary (must have typed the word on any of the opened buffers)
Ctrl+Alt + \  Audo Indents based on the mode (java, python, php...)

== OTHER COMMANDS ==
Alt+x font-lock-mode Puts syntax coloring
Alt+x c-mode  C style coding
Alt+x java-mode Java style coding
Alt+x html-mode ...you get it.
Alt+x python-mode
Alt+x php-mode

Alt+u Make rest of a word upper case and go to end of word
Alt+l Make rest of a word lower case and go to end of word
Alt+c Make current char upper case and go to end of word

Esc =  If you have a text region selected, see statistics about it.

Ctrl+x = Shows current position of cursor

Complete reference here

http://www.utexas.edu/cc/docs/ccrl34.html

by Gubatron
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Emacs+Pocket+Guide+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F&amp;title=Emacs+Pocket+Guide"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F&amp;title=Emacs+Pocket+Guide"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F&amp;title=Emacs+Pocket+Guide"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F&amp;headline=Emacs+Pocket+Guide"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Emacs+Pocket+Guide&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Emacs+Pocket+Guide&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Emacs+Pocket+Guide&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Emacs+Pocket+Guide&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Emacs+Pocket+Guide&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F&amp;title=Emacs+Pocket+Guide&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F12%2Femacs-pocket-guide%2F&amp;title=Emacs+Pocket+Guide"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/09/12/emacs-pocket-guide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>svn gotchas: Importing a Folder in one step</title>
		<link>http://www.gubatron.com/blog/2007/09/06/svn-gotchas-importing-a-folder-in-one-step/</link>
		<comments>http://www.gubatron.com/blog/2007/09/06/svn-gotchas-importing-a-folder-in-one-step/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 17:17:40 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/09/06/svn-gotchas-importing-a-folder-in-one-step/</guid>
		<description><![CDATA[Up until this day when my friend Gabe told me how, I didn&#8217;t know how to import a folder, without doing this first:

svn mkdir svn+ssh://server.com/path/to/repo/myfolder
svn import myFolder svn+ssh://server.com/path/to/repo/myfolder

If I didn&#8217;t do that, If I just imported the local &#8220;myFolder&#8221;, it would end up adding all the files inside the folder and it would not create [...]]]></description>
			<content:encoded><![CDATA[<p>Up until this day when my friend Gabe told me how, I didn&#8217;t know how to import a folder, without doing this first:</p>
<pre>
svn mkdir svn+ssh://server.com/path/to/repo/myfolder
svn import myFolder svn+ssh://server.com/path/to/repo/myfolder
</pre>
<p>If I didn&#8217;t do that, If I just imported the local &#8220;myFolder&#8221;, it would end up adding all the files inside the folder and it would not create the &#8220;myFolder&#8221; inside the repository, creating a total mess.</p>
<p><strong>Here&#8217;s what you do</strong><br />
Forget everything you know about copying folders on the command line, and do this:</p>
<ul>
<li>cd INTO de Local Folder you want to import as a new folder in your repository</li>
<li>svn import REMOTE_SVN_PATH/nameOfYouLocalFolder</li>
</ul>
<p>This will create that folder as needed on the SVN repository and import all the files and folders of the folder where you&#8217;re standing.</p>
<p>Here&#8217;s an example:</p>
<pre>
gubatrons-macbook-pro:~/workspace/ cd <strong>arcturus-jython-console</strong>
gubatrons-macbook-pro:~/workspace/<strong>arcturus-jython-console</strong> gubatron$ svn import svn+ssh://gubatron@myserver/usr/local/svn/repos/labs/arcturus-jython-console -m "A Jython console to test arcturus core object on the fly"
Adding         Main.java
Adding         lib
Adding  (bin)  lib/jython.jar

Committed revision 7409
</pre>
<p>If you svn ls the repo, you&#8217;ll see the new folder &#8220;arcturus-jython-console&#8221; is there (for this example)</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=svn+gotchas%3A+Importing+a+Folder+in+one+step+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F&amp;title=svn+gotchas%3A+Importing+a+Folder+in+one+step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F&amp;title=svn+gotchas%3A+Importing+a+Folder+in+one+step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F&amp;title=svn+gotchas%3A+Importing+a+Folder+in+one+step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F&amp;headline=svn+gotchas%3A+Importing+a+Folder+in+one+step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=svn+gotchas%3A+Importing+a+Folder+in+one+step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=svn+gotchas%3A+Importing+a+Folder+in+one+step&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=svn+gotchas%3A+Importing+a+Folder+in+one+step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=svn+gotchas%3A+Importing+a+Folder+in+one+step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=svn+gotchas%3A+Importing+a+Folder+in+one+step&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F&amp;title=svn+gotchas%3A+Importing+a+Folder+in+one+step&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F09%2F06%2Fsvn-gotchas-importing-a-folder-in-one-step%2F&amp;title=svn+gotchas%3A+Importing+a+Folder+in+one+step"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/09/06/svn-gotchas-importing-a-folder-in-one-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook PHP Source Code</title>
		<link>http://www.gubatron.com/blog/2007/08/14/facebook-php-source-code/</link>
		<comments>http://www.gubatron.com/blog/2007/08/14/facebook-php-source-code/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 18:34:27 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/08/14/facebook-php-source-code/</guid>
		<description><![CDATA[Ok, so one guy got to see Facebook&#8217;s source code on his screen, probably due to some bad upgrade, lord knows why, the code appeared on his screen, he then copied and pasted it to some forums, and then Facebook lawyers were threatening him.
Too late!, it&#8217;s all over the place. Look for it no more, [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so one guy got to see Facebook&#8217;s source code on his screen, probably due to some bad upgrade, lord knows why, the code appeared on his screen, he then copied and pasted it to some forums, and then Facebook lawyers were threatening him.</p>
<p>Too late!, it&#8217;s all over the place. Look for it no more, see how these noobs code, its horrible&#8230; Home Page code included.</p>
<p>How embarrasing man, let&#8217;s look at this line by line and make jokes or try to learn from them. Wonder what all the people that are doing Facebook apps are going to think about the style of where their code is running on top of.</p>
<p><strong>HOME PAGE CODE</strong></p>
<pre>
include_once $_SERVER['PHP_ROOT'].'/html/init.php';
include_once $_SERVER['PHP_ROOT'].'/lib/home.php';
include_once $_SERVER['PHP_ROOT'].'/lib/requests.php';
include_once $_SERVER['PHP_ROOT'].'/lib/feed/newsfeed.php';
include_once $_SERVER['PHP_ROOT'].'/lib/poke.php';
include_once $_SERVER['PHP_ROOT'].'/lib/share.php';
include_once $_SERVER['PHP_ROOT'].'/lib/orientation.php';
include_once $_SERVER['PHP_ROOT'].'/lib/feed/newsfeed.php';
include_once $_SERVER['PHP_ROOT'].'/lib/mobile/register.php';
include_once $_SERVER['PHP_ROOT'].'/lib/forms_lib.php';
include_once $_SERVER['PHP_ROOT'].'/lib/contact_importer/contact_importer.php';
include_once $_SERVER['PHP_ROOT'].'/lib/feed/util.php';
include_once $_SERVER['PHP_ROOT'].'/lib/hiding_prefs.php';
include_once $_SERVER['PHP_ROOT'].'/lib/abtesting.php';
include_once $_SERVER['PHP_ROOT'].'/lib/friends.php';
include_once $_SERVER['PHP_ROOT'].'/lib/statusupdates.php';

// lib/display/feed.php has to be declared here for scope issues.
// This keeps display/feed.php cleaner and easier to understand.
include_once $_SERVER['PHP_ROOT'].'/lib/display/feed.php';
include_once $_SERVER['PHP_ROOT'].'/lib/monetization_box.php';

// require login
$user = require_login();
print_time('require_login');
param_request(array( 'react' => $PARAM_EXISTS));

// Check and fix broken emails
// LN - disabling due to excessive can_see dirties and sets when enabled.
//check_and_fix_broken_emails($user);

// migrate AIM screenname from profile to screenname table if needed
migrate_screenname ($user);

// homepage announcement variables
$HIDE_ANNOUNCEMENT_BIT = get_site_variable('HIDE_ANNOUNCEMENT_BIT');
$HIDE_INTRO_BITMASK = get_site_variable('HIDE_INTRO_BITMASK');

// redirects
if (is_sponsor_user()) {
redirect('bizhome.php', 'www');
}

include_once $_SERVER['PHP_ROOT'].'/lib/mesg.php';
include_once $_SERVER['PHP_ROOT'].'/lib/invitetool.php';
include_once $_SERVER['PHP_ROOT'].'/lib/grammar.php';
include_once $_SERVER['PHP_ROOT'].'/lib/securityq.php';
include_once $_SERVER['PHP_ROOT'].'/lib/events.php';
include_once $_SERVER['PHP_ROOT'].'/lib/rooster/stories.php';

// todo: password confirmation redirects here (from html/reset.php),
// do we want a confirmation message?

param_get_slashed(array(
'feeduser' => $PARAM_INT, //debug: gets feed for user here
'err' => $PARAM_STRING, // returning from a failed entry on an orientation form
'error' => $PARAM_STRING, // an error can also be here because the profile photo upload code is crazy
'ret' => $PARAM_INT,
'success' => $PARAM_INT, // successful profile picture upload
'jn' => $PARAM_INT, // joined a network for orientation
'np' => $PARAM_INT, // network pending (for work/address network)
'me' => $PARAM_STRING, // mobile error
'mr' => $PARAM_EXISTS, // force mobile reg view
'mobile' => $PARAM_EXISTS, // mobile confirmation code sent
'jif' => $PARAM_EXISTS, // just imported friends
'ied' => $PARAM_STRING, // import email domain
'o' => $PARAM_EXISTS, // first time orientation, passed on confirm
'verified' => $PARAM_EXISTS)); // verified mobile phone

param_post(array(
'leave_orientation' => $PARAM_EXISTS,
'show_orientation' => $PARAM_INT, // show an orientation step
'hide_orientation' => $PARAM_INT)); // skip an orientation step

// homepage actions
if ($req_react &#038;&#038; validate_expiring_hash($req_react, $GLOBALS['url_md5key'])) {
$show_reactivated_message = true;
} else {
$show_reactivated_message = false;
}
tpl_set('show_reactivated_message', $show_reactivated_message);

// upcoming events
events_check_future_events($user); // make sure big tunas haven't moved around
$upcoming_events = events_get_imminent_for_user($user);

// this is all stuff that can be fetched together!
$upcoming_events_short = array();
obj_multiget_short(array_keys($upcoming_events), true, $upcoming_events_short);
$new_pokes = 0;
//only get the next N pokes for display
//where N is set in the dbget to avoid caching issues
$poke_stats = get_num_pokes($user);
get_next_pokes($user, true, $new_pokes);
$poke_count = $poke_stats['unseen'];

$targeted_data = array();
home_get_cache_targeted_data($user, true, $targeted_data);
$announcement_data = array();
home_get_cache_announcement_data($user, true, $announcement_data);
$orientation = 0;
orientation_get_status($user, true, $orientation);
$short_profile = array();
profile_get_short($user, true, $short_profile);
// pure priming stuff
privacy_get_network_settings($user, true);
$presence = array();
mobile_get_presence_data($user, true, $presence);
feedback_get_event_weights($user, true);
// Determine if we want to display the feed intro message
$intro_settings = 0;
user_get_hide_intro_bitmask($user, true, $intro_settings);
$user_friend_finder = true;
contact_importer_get_used_friend_finder($user, true, $used_friend_finder);
$all_requests = requests_get_cache_data($user);
// FIXME?: is it sub-optimal to call this both in requests_get_cache_data and here?
$friends_status = statusupdates_get_recent($user, null, 3);
memcache_dispatch(); // populate cache data

// Merman's Admin profile always links to the Merman's home
if (user_has_obj_attached($user)) {
redirect('mhome.php', 'www');
}

if (is_array($upcoming_events)) {
foreach ($upcoming_events as $event_id => $data) {
$upcoming_events[$event_id]['name'] = txt_set($upcoming_events_short[$event_id]['name']);
}
}

tpl_set('upcoming_events' , $upcoming_events);

// disabled account actions
$disabled_warning = ((IS_DEV_SITE || IS_QA_SITE) &#038;&#038; is_disabled_user($user));
tpl_set('disabled_warning', $disabled_warning);

// new pokes (no more messages here, they are in the top nav!)
if (!user_is_guest($user)) {
tpl_set('poke_count' , $poke_count);
tpl_set('pokes' , $new_pokes);
}

// get announcement computations
tpl_set('targeted_data' , $targeted_data);
tpl_set('announcement_data' , $announcement_data);

// birthday notifications
tpl_set('birthdays' , $birthdays = user_get_birthday_notifications($user, $short_profile));
tpl_set('show_birthdays' , $show_birthdays = (count($birthdays) || !$orientation));

// user info
tpl_set('first_name' , user_get_first_name(txt_set($short_profile['id'])));
tpl_set('user' , $user);

// decide if there are now any requests to show
$show_requests = false;
foreach ($all_requests as $request_category) {
if ($request_category) {
$show_requests = true;
break;
}
}
tpl_set('all_requests', $show_requests ? $all_requests : null);

$permissions = privacy_get_reduced_network_permissions($user, $user);

// status
$user_info = array('user' => $user,
'firstname' => user_get_first_name($user),
'see_all' => '/statusupdates/?ref=hp',
'profile_pic' => make_profile_image_src_direct($user, 'thumb'),
'square_pic' => make_profile_image_src_direct($user, 'square'));

if (!empty($presence) &#038;&#038; $presence['status_time'] > (time() - 60*60*24*7)) {
$status = array('message' => txt_set($presence['status']),
'time' => $presence['status_time'],
'source' => $presence['status_source']);
} else {
$status = array('message' => null, 'time' => null, 'source' => null);
}
tpl_set('user_info', $user_info);

tpl_set('show_status', $show_status = !$orientation);
tpl_set('status', $status);
tpl_set('status_custom', $status_custom = mobile_get_status_custom($user));
tpl_set('friends_status', $friends_status);

// orientation
if ($orientation) {
if ($post_leave_orientation) {
orientation_update_status($user, $orientation, 2);
notification_notify_exit_orientation($user);
dirty_user($user);
redirect('home.php');
} else if (orientation_eligible_exit(array('uid'=>$user)) == 2) {
orientation_update_status($user, $orientation, 1);
notification_notify_exit_orientation($user);
dirty_user($user);
redirect('home.php');
}
}

// timezone - outside of stealth, update user's timezone if necessary
$set_time = !user_is_alpha($user, 'stealth');
tpl_set('timezone_autoset', $set_time );
if ($set_time) {
$daylight_savings = get_site_variable('DAYLIGHT_SAVINGS_ON');
tpl_set('timezone', $short_profile['timezone'] - ($daylight_savings ? 4 : 5) );
}

// set next step if we can
if (!$orientation) {
user_set_next_step($user, $short_profile);
}

// note: don't make this an else with the above statement, because then no news feed stories will be fetched if they're exiting orientation
if ($orientation) {
extract(orientation_get_const());

require_js('js/dynamic_dialog.js');
require_js('js/suggest.js');
require_js('js/typeahead_ns.js');
require_js('js/suggest.js');
require_js('js/editregion.js');
require_js('js/orientation.js');
require_css('css/typeahead.css');
require_css('css/editor.css');

if ($post_hide_orientation &#038;&#038; $post_hide_orientation <= $ORIENTATION_MAX) {
$orientation['orientation_bitmask'] |= ($post_hide_orientation * $ORIENTATION_SKIPPED_MODIFIER);
orientation_update_status($user, $orientation);
} else if ($post_show_orientation &#038;&#038; $post_show_orientation <= $ORIENTATION_MAX) {
$orientation['orientation_bitmask'] &#038;= ~($post_show_orientation * $ORIENTATION_SKIPPED_MODIFIER);
orientation_update_status($user, $orientation);
}

$stories = orientation_get_stories($user, $orientation);
switch ($get_err) {
case $ORIENTATION_ERR_COLLEGE:
$temp = array(); // the affil_retval_msg needs some parameters won't be used
$stories[$ORIENTATION_NETWORK]['failed_college']=affil_retval_msg($get_ret, $temp, $temp);
break;
case $ORIENTATION_ERR_CORP:
$temp = array();
// We special case the network not recognized error here, because affil_retval_msg is retarded.
$stories[$ORIENTATION_NETWORK]['failed_corp'] = ($get_ret == 70) ? 'The email you entered did not match any of our supported networks. ' .
'Click here to see our supported list. ' .
'Go here to suggest your network for the future.'
: affil_retval_msg($get_ret, $temp, $temp);
break;
}

// photo upload error
if ($get_error) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_PROFILE]]['upload_error'] = pic_get_error_text($get_error);
}
// photo upload success
else if ($get_success == 1) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_PROFILE]]['uploaded_pic'] = true;
// join network success
} else if ($get_jn) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['joined'] = array(
'id' => $get_jn,
'name' => network_get_name($get_jn));
// network join pending
} else if ($get_np) {

$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['join_pending'] = array(
'id' => $get_np,
'email' => get_affil_email_conf($user, $get_np),
'network' => network_get_name($get_np));
// just imported friend confirmation
} else if ($get_jif) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['just_imported_friends'] = true;
$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['domain'] = $get_ied;
}

// Mobile web API params
if ($get_mobile) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['sent_code'] = true;
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['view'] = 'confirm';
}
if ($get_verified) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['verified'] = true;
}
if ($get_me) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['error'] = $get_me;
}
if ($get_mr) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['view'] = 'register';
}

if (orientation_eligible_exit($orientation)) {
tpl_set('orientation_show_exit', true);
}
tpl_set('orientation_stories', $stories);

//if in orientation, we hide all feed intros (all 1's in bitmask)
$intro_settings = -1;

}
tpl_set('orientation', $orientation);

// Rooster Stories
if (!$orientation &#038;&#038;
((get_site_variable('ROOSTER_ENABLED') == 2) ||
(get_site_variable('ROOSTER_DEV_ENABLED') == 2))) {
$rooster_story_count = get_site_variable('ROOSTER_STORY_COUNT');
if (!isset($rooster_story_count)) {
// Set default if something is wrong with the sitevar
$rooster_story_count = 2;
}
$rooster_stories = rooster_get_stories($user, $rooster_story_count, $log_omissions = true);
if (!empty($rooster_stories) &#038;&#038; !empty($rooster_stories['stories'])) {
// Do page-view level logging here
foreach($rooster_stories['stories'] as $story) {
rooster_log_action($user, $story, ROOSTER_LOG_ACTION_VIEW);
}
tpl_set('rooster_stories', $rooster_stories);
}
}

// set the variables for the home announcement code
$hide_announcement_tpl = ($intro_settings | $HIDE_INTRO_BITMASK) &#038; $HIDE_ANNOUNCEMENT_BIT;
// if on qa/dev site, special rules
$HIDE_INTRO_ON_DEV = get_site_variable('HIDE_INTRO_ON_DEV');
if ((IS_QA_SITE || IS_DEV_SITE) &#038;&#038; !$HIDE_INTRO_ON_DEV) {
$hide_announcement_tpl = 0;
}

tpl_set('hide_announcement', $hide_announcement_tpl);
if($is_candidate = is_candidate_user($user)) {
tpl_set('hide_announcement', false);
}
$home_announcement_tpl = !$hide_announcement_tpl || $is_candidate ? home_get_announcement_info($user) : 0;
tpl_set('home_announcement', $home_announcement_tpl);
tpl_set('hide_announcement_bit', $HIDE_ANNOUNCEMENT_BIT);

$show_friend_finder = !$orientation &#038;&#038; contact_importer_enabled($user) &#038;&#038; !user_get_hiding_pref($user, 'home_friend_finder');
tpl_set('show_friend_finder', $show_friend_finder);
if ($show_friend_finder &#038;&#038; (user_get_friend_count($user) > 20)) {
tpl_set('friend_finder_hide_options', array('text'=>'close',
'onclick'=>"return clearFriendFinder()"));
} else {
tpl_set('friend_finder_hide_options', null);
}

$account_info = user_get_account_info($user);
$account_create_time = $account_info['time'];

tpl_set('show_friend_finder_top',
!$used_friend_finder);

tpl_set('user', $user);

// MONETIZATION BOX
$minimize_monetization_box = user_get_hiding_pref($user, 'home_monetization');
$show_monetization_box = (!$orientation &#038;&#038;
get_site_variable('HOMEPAGE_MONETIZATION_BOX'));
tpl_set('show_monetization_box', $show_monetization_box);
tpl_set('minimize_monetization_box', $minimize_monetization_box);

if ($show_monetization_box) {
$monetization_box_data = monetization_box_user_get_data($user);
txt_set('monetization_box_data', $monetization_box_data);
}

// ORIENTATION
if ($orientation) {
$network_ids = id_get_networks($user);
$network_names = multiget_network_name($network_ids);
$in_corp_network = in_array($GLOBALS['TYPE_CORP'], array_map('extract_network_type', $network_ids));
$show_corp_search = $in_corp_network ||
get_age(user_get_basic_info_attr($user, 'birthday')) >= 21;
$pending_hs = is_hs_pending_user($user);
$hs_id = null;
$hs_name = null;
if ($pending_hs) {
foreach (id_get_pending_networks($user) as $network) {
if (extract_network_type($network['network_key']) == $GLOBALS['TYPE_HS']) {
$hs_id = $network['network_key'];
$hs_name = network_get_name($hs_id);
break;
}
}
}
//$orientation_people = orientation_get_friend_and_inviter_ids($user);
$orientation_people = array('friends' => user_get_all_friends($user),
'pending' => array_keys(user_get_friend_requests($user)),
'inviters'=> array(), // wc: don't show inviters for now
);
$orientation_info = array_merge($orientation_people,
array('network_names' => $network_names,
'show_corp_search' => $show_corp_search,
'pending_hs' => array('hs_id'=>$hs_id,
'hs_name'=>$hs_name),
'user' => $user,
));
tpl_set('orientation_info', $orientation_info);

tpl_set('simple_orientation_first_login', $get_o); // unused right now
}

// Roughly determine page length for ads
// first, try page length using right-hand panel
$ads_page_length_data = 3 + // 3 for profile pic + next step
($show_friend_finder ? 1 : 0) +
($show_status ? ($status_custom ? count($friends_status) : 0) : 0) +
($show_monetization_box ? 1 : 0) +
($show_birthdays ? count($birthdays) : 0) +
count($new_pokes);

// page length using feed stories
if ($orientation) {
$ads_page_length_data = max($ads_page_length_data, count($stories) * 5);
}
tpl_set('ads_page_length_data', $ads_page_length_data);

$feed_stories = null;
if (!$orientation) { // if they're not in orientation they get other cool stuff
// ad_insert: the ad type to try to insert for the user
// (0 if we don't want to try an insert)
$ad_insert = get_site_variable('FEED_ADS_ENABLE_INSERTS');

$feed_off = false;

if (check_super($user) &#038;&#038; $get_feeduser){
$feed_stories = user_get_displayable_stories($get_feeduser, 0, null, $ad_insert);
} else if (can_see($user, $user, 'feed')) {
$feed_stories = user_get_displayable_stories($user, 0, null, $ad_insert);
} else {
$feed_off = true;
}

// Friend's Feed Selector - Requires dev.php constant
if (is_friendfeed_user($user)) {
$friendfeed = array();
$friendfeed['feeduser'] = $get_feeduser;
$friendfeed['feeduser_name'] = user_get_name($get_feeduser);
$friendfeed['friends'] = user_get_all_friends($user);
tpl_set('friendfeed', $friendfeed);
}

$feed_stories = feed_adjust_timezone($user, $feed_stories);

tpl_set('feed_off', $feed_off ? redirect('privacy.php?view=feeds', null, false) : false);
}
tpl_set('feed_stories', $feed_stories);

render_template($_SERVER['PHP_ROOT'].'/html/home.phpt');
</pre>
<p><strong>SEARCH CODE</strong></p>
<pre>
/* @author Mark Slee
*
* @package ubersearch
*/

ini_set('memory_limit', '100M'); // to be
safe we are increasing the memory limit for search

include_once $_SERVER['PHP_ROOT'].'/html
/init.php'; // final
lib include
include_once $_SERVER['PHP_ROOT'].'/lib/s.php';
include_once $_SERVER['PHP_ROOT'].'/lib/browse.php';
include_once $_SERVER['PHP_ROOT'].'/lib/events.php';
include_once $_SERVER['PHP_ROOT'].'/lib/websearch_classifier/websearch_classifier.php';

flag_allow_guest();
$user = search_require_login();

if($_POST) {
$arr = us_flatten_checkboxes($_POST, array('ii'));
$qs = '?';
foreach($arr as $key=>$val) {
$qs .= $key.'='.urlencode($val).'&#038;';
}
$qs = substr($qs, 0, (strlen($qs)-1));
redirect($_SERVER['PHP_SELF'].$qs);
}

// If they performed a classmates search, these values are
// needed to pre-populate dropdowns
param_get_slashed(array('hy'=>$PARAM_STRING,
'hs'=>$PARAM_INT,
'adv'=>$PARAM_EXISTS,
'events'=>$PARAM_EXISTS,
'groups'=>$PARAM_EXISTS,
'classmate'=>$PARAM_EXISTS,
'coworker'=>$PARAM_EXISTS));
$pos = strpos($get_hy, ':');
if($pos !== false) {
$hsid = intval(substr($get_hy, 0, $pos));
$hsyear = intval(substr($get_hy, $pos+1));
} else {
$hsid = intval($get_hs);
$hsyear = null;
}

tpl_set('hs_id', $hsid);
tpl_set('hs_name', get_high_school($hsid));
tpl_set('hs_year', $hsyear);
tpl_set('is_advanced_search', $get_adv);
tpl_set('user', $user);
tpl_set('count_total', 0); // pre-set count_total for the sake of ads
page length

// Events search calendar data
param_get(array('k' => $PARAM_HEX,
'n' => $PARAM_SINT));
if (($get_k == search_module::get_key(SEARCH_MOD_EVENT, SEARCH_TYPE_AS))) {

$EVENTS_CAL_DAYS_AHEAD = 60;
$events_begin = strftime("%Y%m01"); // first of the month
$events_end = strftime("%Y%m%d", strtotime(strftime("%m/01/%Y")) +
(86400 * $EVENTS_CAL_DAYS_AHEAD));
$events_params = array('dy1' => $events_begin,
'dy2' => $events_end);

param_get(array('c1' => $PARAM_INT, 'c2' => $PARAM_INT), 'evt_');
if (isset($evt_c1)) { $events_params['c1'] = $evt_c1; }
if (isset($evt_c2)) { $events_params['c2'] = $evt_c2; }
$results = events_get_calendar($user, $get_n, $events_params);
tpl_set('events_date', $results['events_date']);
}

// Holy shit, is this the cleanest fucking frontend file you've ever seen?!
ubersearch($_GET, $embedded=false, $template=true);

// Render it
render_template($_SERVER['PHP_ROOT'].'/html/s.phpt');

/**
* login function for s.php
*
* @author Philip Fung
*/
function search_require_login() {

//check if user is logged in
$user = require_login(true);

if($user 0 &#038;&#038; !is_unregistered($user)) { return $user; }

// this is an unregistered user
param_get(array('k' => $GLOBALS['PARAM_HEX'], // search key
(used by rest of ubersearch code)
));

global $get_k;
$search_key = $get_k;

//Let user see event or group search if criteria are obeyed
if ($search_key
&#038;&#038; (search_module::get_key_type($search_key) ==
SEARCH_MOD_EVENT || search_module::get_key_type($search_key) ==
SEARCH_MOD_GROUP) //event or group search
) {

return $user;

} else {
go_home();
}
}
</pre>
<p>It&#8217;s all procedural and looks very nasty to mantain. Procedural for speed maybe? I don&#8217;t think so.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Facebook+PHP+Source+Code+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F&amp;title=Facebook+PHP+Source+Code"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F&amp;title=Facebook+PHP+Source+Code"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F&amp;title=Facebook+PHP+Source+Code"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F&amp;headline=Facebook+PHP+Source+Code"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Facebook+PHP+Source+Code&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Facebook+PHP+Source+Code&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Facebook+PHP+Source+Code&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Facebook+PHP+Source+Code&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Facebook+PHP+Source+Code&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F&amp;title=Facebook+PHP+Source+Code&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F14%2Ffacebook-php-source-code%2F&amp;title=Facebook+PHP+Source+Code"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/08/14/facebook-php-source-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>List Dir by Gubatron &#8211; List your directories on a text file with a right click</title>
		<link>http://www.gubatron.com/blog/2007/08/12/list-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click/</link>
		<comments>http://www.gubatron.com/blog/2007/08/12/list-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click/#comments</comments>
		<pubDate>Sun, 12 Aug 2007 11:52:45 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Geeklife]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/08/12/list-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click/</guid>
		<description><![CDATA[Last week my wife told me if I knew an easy way (without using the cmd.exe) on Windows to list the contents of a directory, she basically wanted to give her users a one click solution to list the contents of a folder and have them on notepad.
So, I created a solution in python, compiled [...]]]></description>
			<content:encoded><![CDATA[<p>Last week my wife told me if I knew an easy way (without using the cmd.exe) on Windows to list the contents of a directory, she basically wanted to give her users a one click solution to list the contents of a folder and have them on notepad.</p>
<p>So, I created a solution in python, compiled it with p2exe and by executing a .reg file, it gets bound to your right click context menu on Windows.</p>
<p><a href="http://www.mybloop.com/gubatron/programs/list_dir_to_txt.zip">You can download the zip file here</a><br />
Instructions are included (where to unzip, etc) , and source code is included as well.</p>
<p>We found way more advanced solutions for this, but they were non-free versions, or shareware versions that would expire.<br />
This only took about an hour to create, so you can use this all you want, note that it will only list the names of the files, each on one line, and folders will look like [this].</p>
<p><strong>Customizing, Building</strong></p>
<p>If you want to add more information about the file, you&#8217;ll have to hack it, you have the source code inside the .zip file, it&#8217;s python so its pretty easy, all you&#8217;ll need to build it is, python2.5, py2exe, and then you just execute that setup.py script, I believe like this</p>
<pre>
python setup.py py2eye
</pre>
<p>and it will create a new binary version for you on a dist/ folder.</p>
<p>DO NOT BUY THIS SOFTWARE ITS FREE SOFTWARE</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=List+Dir+by+Gubatro...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F&amp;title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F&amp;title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F&amp;title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F&amp;headline=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F&amp;title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F12%2Flist-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click%2F&amp;title=List+Dir+by+Gubatron+-+List+your+directories+on+a+text+file+with+a+right+click"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/08/12/list-dir-by-gubatron-list-your-directories-on-a-text-file-with-a-right-click/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if your PHP&#8217;s diff syntax isn&#8217;t breaking</title>
		<link>http://www.gubatron.com/blog/2007/08/11/check-if-your-phps-diff-syntax-isnt-breaking/</link>
		<comments>http://www.gubatron.com/blog/2007/08/11/check-if-your-phps-diff-syntax-isnt-breaking/#comments</comments>
		<pubDate>Sat, 11 Aug 2007 19:34:54 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/08/11/check-if-your-phps-diff-syntax-isnt-breaking/</guid>
		<description><![CDATA[Say you&#8217;re working on emacs, without any kind of syntax checking, and you don&#8217;t want to commit your code cause you might have syntax errors.
If you&#8217;re smart, the best way to know what files you actually changed, is using 

svn diff &#124; grep +++

(that is, if you&#8217;re using subversion, which I hope you are)
then you&#8217;d [...]]]></description>
			<content:encoded><![CDATA[<p>Say you&#8217;re working on emacs, without any kind of syntax checking, and you don&#8217;t want to commit your code cause you might have syntax errors.</p>
<p>If you&#8217;re smart, the best way to know what files you actually changed, is using </p>
<pre>
svn diff | grep +++
</pre>
<p>(that is, if you&#8217;re using subversion, which I hope you are)</p>
<p>then you&#8217;d have to do, </p>
<pre>
php -l <file>
</pre>
<p>on each one of the files&#8230;</p>
<p>well, that looks like a script to me.</p>
<p>Add the following script to your path, name it&#8230; checkdiffsyntax</p>
<pre>
#!/bin/bash

#Put all the files that changed on a temp file and then dump them into a MYBLOOP_DIFF_FILES variable
TMP_FILE=/tmp/changed_${USER}
svn diff | grep +++ | awk {'print $2'} > ${TMP_FILE}; export MYBLOOP_DIFF_FILES=`cat ${TMP_FILE}`

for file in $MYBLOOP_DIFF_FILES
do
  php -l $file
done

rm ${TMP_FILE}
</pre>
<p><strong>UPDATE</strong><br />
I learn how to use <strong>for</strong> as a one liner on bash, and also how to do this without dumping the filepaths to a file which gets fed into a string&#8230; now it just goes straight from awk into the for loop, sick. I will leave the example above for future reference in case you need how to put the contents of a file on a variable and then reading from them</p>
<p>New script looks like this now, one liner.</p>
<pre>
svn diff | grep +++ | for file in `awk {'print $2'}`; do echo ${file}; php -l ${file}; done
</pre>
<p>chmod 777 it, and you&#8217;re ready to go.</p>
<p>Should look like this when you run it</p>
<pre>
angel@foobar:~/public_html$ checkdiffsyntax
No syntax errors detected in members/ajax/mashup.php
No syntax errors detected in foo/mashups/twitter/twitter.php
No syntax errors detected in foo/classes/utils.php
No syntax errors detected in foo/classes/user.php
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Check+if+your+PHP%26%238217%3Bs+diff+syntax+isn%26%238217%3Bt+b...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F&amp;title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F&amp;title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F&amp;title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F&amp;headline=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F&amp;title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F08%2F11%2Fcheck-if-your-phps-diff-syntax-isnt-breaking%2F&amp;title=Check+if+your+PHP%27s+diff+syntax+isn%27t+breaking"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/08/11/check-if-your-phps-diff-syntax-isnt-breaking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Reference: Binary Operators</title>
		<link>http://www.gubatron.com/blog/2007/07/28/python-reference-binary-operators/</link>
		<comments>http://www.gubatron.com/blog/2007/07/28/python-reference-binary-operators/#comments</comments>
		<pubDate>Sat, 28 Jul 2007 15:43:48 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/07/28/python-reference-binary-operators/</guid>
		<description><![CDATA[Python binary operators are pretty much the same as in any other language, however I notice most programmers tend to waste a lot of memory by creating lots and lots of properties say in DB tables, or Objects and using the wrong datatypes. I think its elegant to use the concept of binary flags, for [...]]]></description>
			<content:encoded><![CDATA[<p>Python binary operators are pretty much the same as in any other language, however I notice most programmers tend to waste a lot of memory by creating lots and lots of properties say in DB tables, or Objects and using the wrong datatypes. I think its elegant to use the concept of binary flags, for example, if you have an object that has around 8 or 16 boolean properties, you can store their state in 1 byte or 2 bytes (1 char or 2 char fields), and turn on/off the bits on those fields.</p>
<p>Usually, if you have a binary field, and you want to, turn on bits, toggle bits, and check bits, you do the following.</p>
<p>Suppose &#8220;config&#8221; is an 8 bit number, and you want to modify this bits individually, say config=4 (0b100) and you want to turn on the rightmost bit to have 0b101 (which is a 5) you could do the following</p>
<pre>
>>> #Uses the | operator
... def turnBitOn(config, binaryFlag):
...   return config | binaryFlag
...
>>> config = 4
>>> config = turnBitOn(config,1)
>>> print config
5
</pre>
<p>If you want to check if a Bit is turned on, just use the &#8220;&#038;&#8221; operator, if the result is the same as the bit you&#8217;re comparing, then its turned on.</p>
<pre>
>>> def checkBit(config,binaryFlag):
...   return binaryFlag == config &#038; binaryFlag
...
>>> print checkBit(config,1)
True
>>> print checkBit(config,2) #checks 0b010 in 0b101
False
</pre>
<p>What if you just want to toggle a bit, no matter what&#8217;s in there?<br />
Just use binary XOR, the &#8220;^&#8221; operator.</p>
<pre>
>>> def toggleBit(config,binaryFlag):
...   return config ^ binaryFlag
...
>>> print config
5
>>> config = toggleBit(config,1)
>>> print config
4
>>> config = toggleBit(config,1)
>>> print config
5
</pre>
<p>And now, the last basic operation would be to turn off a bit. For this, you should do a NAND operation. The Binary Not in python as in most programming languages is the &#8220;~&#8221; operator. This is how you can use it to turn off bits.</p>
<p>You have to do it in conjunction with the &#038; operator, sort of doing a NAND</p>
<pre>
>>> 5 &#038; (~1)
4
>>> 5 &#038;~ 1
4
</pre>
<p>So we could define our turnOffBit function as follows:</p>
<pre>
>>> def turnOffBit(config,binaryFlag):
...   return config &#038; (~binaryFlag)
...
>>> print config
5
>>> config = turnOffBit(config,1)
>>> print config
4
>>> config = turnOffBit(config,1)
>>> print config
4
</pre>
<p>Hope this makes a good reference for those trying to make the most out of their bytes.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Python+Reference%3A+Binary+Operators+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F&amp;title=Python+Reference%3A+Binary+Operators"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F&amp;title=Python+Reference%3A+Binary+Operators"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F&amp;title=Python+Reference%3A+Binary+Operators"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F&amp;headline=Python+Reference%3A+Binary+Operators"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Python+Reference%3A+Binary+Operators&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Python+Reference%3A+Binary+Operators&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Python+Reference%3A+Binary+Operators&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Python+Reference%3A+Binary+Operators&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Python+Reference%3A+Binary+Operators&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F&amp;title=Python+Reference%3A+Binary+Operators&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F28%2Fpython-reference-binary-operators%2F&amp;title=Python+Reference%3A+Binary+Operators"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/07/28/python-reference-binary-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: How to debug HTTP while using urllib2</title>
		<link>http://www.gubatron.com/blog/2007/07/27/python-how-to-debug-http-while-using-urllib2/</link>
		<comments>http://www.gubatron.com/blog/2007/07/27/python-how-to-debug-http-while-using-urllib2/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 15:36:58 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/07/27/python-how-to-debug-http-while-using-urllib2/</guid>
		<description><![CDATA[
...
import urllib
import urllib2

#this is just to prepare a dynamic uri (this is actual code from a system I'm building, sorry)
fileDownloadServiceURL = '%s://%s:%s/%s' % (transport,server,port,pathToController)
postData = {'URI':fileUri} #add more post stuff here
postData = urllib.urlencode(postData) #make sure you encode your post data

#add some custom headers if you need them
headers={"Host": server+':'+port,"Cookie":"JSESSIONID="+sessionId,"User-Agent":"Name of your User-Agent Here"}

#prepare your request, with [...]]]></description>
			<content:encoded><![CDATA[<pre>
...
import urllib
import urllib2

#this is just to prepare a dynamic uri (this is actual code from a system I'm building, sorry)
fileDownloadServiceURL = '%s://%s:%s/%s' % (transport,server,port,pathToController)
postData = {'URI':fileUri} #add more post stuff here
postData = urllib.urlencode(postData) #make sure you encode your post data

#add some custom headers if you need them
headers={"Host": server+':'+port,"Cookie":"JSESSIONID="+sessionId,"User-Agent":"Name of your User-Agent Here"}

#prepare your request, with headers and post data
req = urllib2.Request(fileDownloadServiceURL,postData,headers)

#and this is the magic. Create a HTTPHandler object and put its debug level to 1
httpHandler = urllib2.HTTPHandler()
httpHandler.set_http_debuglevel(1)

#Instead of using urllib2.urlopen, create an opener, and pass the HTTPHandler
#and any other handlers... to it.
opener = urllib2.build_opener(httpHandler)

#User your opener to open the Request.
urlHandle = opener.open(req)

#you'll end up with a file-like object... which I called urlHandle
...
</pre>
<p>The ouput will have useful debugging info about the HTTP connection.</p>
<pre>
connect: (localhost, 8080)
send: u'POST /arcturus-web/fileVariableDownload.service HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 57\r\nConnection: close\r\nUser-Agent: Temboo Twyla/Arcturus HTTP Downloader\r\nHost: localhost:8080\r\nCookie: JSESSIONID=1b8xl8nozb2i\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n'
send: 'URI=temboo%3A%2F%2Fwww.one.com%2Ffiles.f%2Fmapping1.m.var'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Language: en-US
header: Content-Type: text/html; charset=ISO-8859-1
header: Connection: close
header: Server: Jetty(6.0.2)
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Python%3A+How+to+debug+HTTP+while+using+urllib2+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F&amp;title=Python%3A+How+to+debug+HTTP+while+using+urllib2"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F&amp;title=Python%3A+How+to+debug+HTTP+while+using+urllib2"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F&amp;title=Python%3A+How+to+debug+HTTP+while+using+urllib2"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F&amp;headline=Python%3A+How+to+debug+HTTP+while+using+urllib2"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Python%3A+How+to+debug+HTTP+while+using+urllib2&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Python%3A+How+to+debug+HTTP+while+using+urllib2&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Python%3A+How+to+debug+HTTP+while+using+urllib2&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Python%3A+How+to+debug+HTTP+while+using+urllib2&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Python%3A+How+to+debug+HTTP+while+using+urllib2&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F&amp;title=Python%3A+How+to+debug+HTTP+while+using+urllib2&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F27%2Fpython-how-to-debug-http-while-using-urllib2%2F&amp;title=Python%3A+How+to+debug+HTTP+while+using+urllib2"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/07/27/python-how-to-debug-http-while-using-urllib2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to update the location of your subversion Repo without checking out again everything</title>
		<link>http://www.gubatron.com/blog/2007/07/10/how-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything/</link>
		<comments>http://www.gubatron.com/blog/2007/07/10/how-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 02:47:56 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/07/10/how-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything/</guid>
		<description><![CDATA[So you checked out code from a place, and whoever runs your subversion server decided to change the URL, or decided to switch from http:// to https:// or to svn+ssh:// &#8230; If you&#8217;re a noob, you&#8217;ll probably just checkout everything again.
Next time this happens just use svn switch
Here&#8217;s an example of real life when sourceforge [...]]]></description>
			<content:encoded><![CDATA[<p>So you checked out code from a place, and whoever runs your subversion server decided to change the URL, or decided to switch from http:// to https:// or to svn+ssh:// &#8230; If you&#8217;re a noob, you&#8217;ll probably just checkout everything again.</p>
<p>Next time this happens just use <strong>svn switch</strong></p>
<p>Here&#8217;s an example of real life when sourceforge updated the urls of their svn repos, this is what I had to do:</p>
<pre>
svn switch --relocate 

https://svn.sourceforge.net/svnroot/frostwire/trunk

http://frostwire.svn.sourceforge.net/svnroot/frostwire/trunk
</pre>
<p>* That command is supposed to be all in one line of course, its written like that for formatting purposes of this blog.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=How+to+...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F&amp;title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F&amp;title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F&amp;title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F&amp;headline=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F&amp;title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F10%2Fhow-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything%2F&amp;title=How+to+update+the+location+of+your+subversion+Repo+without+checking+out+again+everything"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/07/10/how-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Note about Signals and PyQt4.</title>
		<link>http://www.gubatron.com/blog/2007/07/09/note-about-signals-and-pyqt4/</link>
		<comments>http://www.gubatron.com/blog/2007/07/09/note-about-signals-and-pyqt4/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 12:35:34 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Qt4]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/07/09/note-about-signals-and-pyqt4/</guid>
		<description><![CDATA[I keep making the mistake of sending PyQt_PyObjects instead of sending actual Qt4 objects on signals that are defined by Qt like that.
Bottom line:
If a signal has been defined by Qt, to send Qt objects, just copy and paste it, do not try to override it by exchanging the Qt objects for PyQt_PyObject.
This is because [...]]]></description>
			<content:encoded><![CDATA[<p>I keep making the mistake of sending PyQt_PyObjects instead of sending actual Qt4 objects on signals that are defined by Qt like that.</p>
<p>Bottom line:</p>
<p><strong>If a signal has been defined by Qt, to send Qt objects, just copy and paste it, do not try to override it by exchanging the Qt objects for PyQt_PyObject.</strong></p>
<p>This is because PyQt_PyObject is used to represent regular Python objects, therefore, original Qt4 classes will never emit signals under those weird signatures, Qt4 seems to be very strict on how it matches signals.</p>
<p>So when you see something like this on the documentation:</p>
<pre>
Qt Signals
void currentItemChanged (QTreeWidgetItem *,QTreeWidgetItem *)
</pre>
<p>Define your signal for example like this, and it will work:</p>
<pre>SIGNAL_ITEM_CHANGED = SIGNAL('currentItemChanged (QTreeWidgetItem *,QTreeWidgetItem *)')</pre>
<p>Do not do this, cause it won&#8217;t work:</p>
<pre>SIGNAL_ITEM_CHANGED = SIGNAL('currentItemChanged (PyQt_PyObject, PyQt_PyObject)')</pre>
<p>(Keep in mind PyQt_PyObject is used to represent Python objects only, and its useful only when YOU define and <strong>emit your own signals</strong>)</p>
<p>then connect it from a QTreeWidget item (or derived object) to a listener object&#8217;s method like this:</p>
<pre>QObject.connect(myQTree,SIGNAL_ITEM_CHANGED,myListener.onItemChanged)</pre>
<p>Your object&#8217;s listener method should look like this:</p>
<pre>
def onItemChanged(self, current, previous):
  #do what you gotta do, current and previous will be QTreeWidgetItems
</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Note+about+Signals+and+PyQt4.+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F&amp;title=Note+about+Signals+and+PyQt4."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F&amp;title=Note+about+Signals+and+PyQt4."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F&amp;title=Note+about+Signals+and+PyQt4."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F&amp;headline=Note+about+Signals+and+PyQt4."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Note+about+Signals+and+PyQt4.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Note+about+Signals+and+PyQt4.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Note+about+Signals+and+PyQt4.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Note+about+Signals+and+PyQt4.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Note+about+Signals+and+PyQt4.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F&amp;title=Note+about+Signals+and+PyQt4.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F07%2F09%2Fnote-about-signals-and-pyqt4%2F&amp;title=Note+about+Signals+and+PyQt4."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/07/09/note-about-signals-and-pyqt4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trabaja como desarrollador de software en New York</title>
		<link>http://www.gubatron.com/blog/2007/06/06/trabaja-como-desarrollador-de-software-en-new-york/</link>
		<comments>http://www.gubatron.com/blog/2007/06/06/trabaja-como-desarrollador-de-software-en-new-york/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 12:39:38 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[New York City Life]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/06/06/trabaja-como-desarrollador-de-software-en-new-york/</guid>
		<description><![CDATA[Todas las semanas me llegan multiples correos de reclutadores ofertando excelentes posiciones en New York y zonas cercanas.
En muchos de los casos me llaman por telefono, y me preguntan si conozco personas que pueden llenar esas posiciones, mi respuesta es &#8220;No, but I know a lot of talent in South America, if your company can [...]]]></description>
			<content:encoded><![CDATA[<p>Todas las semanas me llegan multiples correos de reclutadores ofertando excelentes posiciones en New York y zonas cercanas.<br />
En muchos de los casos me llaman por telefono, y me preguntan si conozco personas que pueden llenar esas posiciones, mi respuesta es &#8220;No, but I know a lot of talent in South America, if your company can sponsor H1b then I can give you talent&#8221;</p>
<p><img src="http://farm1.static.flickr.com/230/510472682_9b514dd656.jpg?v=0"/></p>
<p>Supongo que en Venezuela y otros paises como Colombia, Chile, Mexico, Peru, etc. hay mucho talento mal pagado, esclavizado por menos de $1000 al mes, creo que si estas leyendo esto y quieres aprovechar tu talento al maximo, deberias empezar por unirte a la lista de correos que he creado, donde todas las semanas envio las descripciones de las oportunidades e informacion de contacto.</p>
<p>La lista de correos te servira ademas para ver que competencias debes pulir o aprender si quieres venir a USA, mas especificamente a New York a trabajar como desarrollador. Con 1 o 2 anos de experiencia puedes aspirar sueldos que empiezan por $50mil al ano, el limite del sueldo depende de lo pilas que seas, pero ya con unos 3 anos de experiencia aqui, estaras rondando facilmente los $100mil anuales o mas, todo depende la dificultad de lo que desees hacer. Se que si te metes en el area de finanzas (que es lo que mas se consigue aqui en NY), programando en lenguajes como C++ (multihilos), o en J2EE las pagas llegan facilmente a los $150k anuales. De todos modos hay muchas oportunidades para otras tecnologias mas suaves y practicas como Python, Ruby, PHP, y por supuesto para otras no tan practicas como .NET ;)</p>
<p>Aqui la direccion del grupo<br />
<a href="http://groups.google.com/group/nycsoftwarejobs">http://groups.google.com/group/nycsoftwarejobs</a></p>
<p>Solo unete y empezaras a recibir los mensajes, supongo que tambien puedes suscribirte al feed RSS.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Trabaja+como+desarrollador+de+software+en+New...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F&amp;title=Trabaja+como+desarrollador+de+software+en+New+York"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F&amp;title=Trabaja+como+desarrollador+de+software+en+New+York"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F&amp;title=Trabaja+como+desarrollador+de+software+en+New+York"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F&amp;headline=Trabaja+como+desarrollador+de+software+en+New+York"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Trabaja+como+desarrollador+de+software+en+New+York&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Trabaja+como+desarrollador+de+software+en+New+York&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Trabaja+como+desarrollador+de+software+en+New+York&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Trabaja+como+desarrollador+de+software+en+New+York&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Trabaja+como+desarrollador+de+software+en+New+York&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F&amp;title=Trabaja+como+desarrollador+de+software+en+New+York&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F06%2F06%2Ftrabaja-como-desarrollador-de-software-en-new-york%2F&amp;title=Trabaja+como+desarrollador+de+software+en+New+York"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/06/06/trabaja-como-desarrollador-de-software-en-new-york/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to update file timestamps in Python</title>
		<link>http://www.gubatron.com/blog/2007/05/29/how-to-update-file-timestamps-in-python/</link>
		<comments>http://www.gubatron.com/blog/2007/05/29/how-to-update-file-timestamps-in-python/#comments</comments>
		<pubDate>Wed, 30 May 2007 01:06:30 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/05/29/how-to-update-file-timestamps-in-python/</guid>
		<description><![CDATA[Sometimes you can be real picky like me about timestamps of files, for example, during my wedding we had a few digital cameras, and one of the cameras had its internal clock 4 hours behind. So what better way for a lazy guy like you to change timestamps than writing a short python script to [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you can be real picky like me about timestamps of files, for example, during my wedding we had a few digital cameras, and one of the cameras had its internal clock 4 hours behind. So what better way for a lazy guy like you to change timestamps than writing a short python script to fix the problem.</p>
<p><img src="http://farm1.static.flickr.com/199/510507306_179804ba0b.jpg?v=0"/></p>
<p>I wrote this script on the same folder where the pictures with the lagged modification times existed:</p>
<pre>
import os
import time
from stat import *

#returns a list of all the files on the current directory
files = os.listdir('.')

for f in files:
  #my folder has some jpegs and raw images
  if f.lower().endswith('jpg') or f.lower().endswith('crw'):
    st = os.stat(f)
    atime = st[ST_ATIME] #access time
    mtime = st[ST_MTIME] #modification time

    new_mtime = mtime + (4*3600) #new modification time

    #modify the file timestamp
    os.utime(f,(atime,new_mtime))
</pre>
<p>Very nice, I like</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=How+to+update+file+timestamps+in+Python+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F&amp;title=How+to+update+file+timestamps+in+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F&amp;title=How+to+update+file+timestamps+in+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F&amp;title=How+to+update+file+timestamps+in+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F&amp;headline=How+to+update+file+timestamps+in+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+to+update+file+timestamps+in+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+to+update+file+timestamps+in+Python&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+to+update+file+timestamps+in+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+to+update+file+timestamps+in+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+to+update+file+timestamps+in+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F&amp;title=How+to+update+file+timestamps+in+Python&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F29%2Fhow-to-update-file-timestamps-in-python%2F&amp;title=How+to+update+file+timestamps+in+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/05/29/how-to-update-file-timestamps-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recordando algoritmos, Quicksort</title>
		<link>http://www.gubatron.com/blog/2007/05/17/recordando-algoritmos-quicksort/</link>
		<comments>http://www.gubatron.com/blog/2007/05/17/recordando-algoritmos-quicksort/#comments</comments>
		<pubDate>Thu, 17 May 2007 17:36:27 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/05/17/recordando-algoritmos-quicksort/</guid>
		<description><![CDATA[Leyendo no se que en internet, lei mencionar algo sobre preguntas de entrevistas de trabajo, y mencionaron que siempre es bueno saber como funciona Quicksort. Por algun motivo, el algoritmo de ordenamiento que siempre recuerdo es Bubble sort, pero todos sabemos que no es el mejor. So decidi repasar y leer como funciona quicksort.
Para los [...]]]></description>
			<content:encoded><![CDATA[<p>Leyendo no se que en internet, lei mencionar algo sobre preguntas de entrevistas de trabajo, y mencionaron que siempre es bueno saber como funciona Quicksort. Por algun motivo, el algoritmo de ordenamiento que siempre recuerdo es Bubble sort, pero todos sabemos que no es el mejor. So decidi repasar y <a href="http://en.wikipedia.org/wiki/Quicksort">leer como funciona quicksort</a>.</p>
<p>Para los que no recuerdan quicksort es simplemente hacer 3 listas con la lista principal [PRINCIPAL]. Estas listas se generan bajo un criterio bien sencillo. Elige un numero cualquiera del arreglo, la primera lista tendra todos los numeros menores a ese numero [MENORES]. La segunda lista tendra todos los numeros que sean de igual valor a ese numero [IGUALES], y la tercera los mayores [MAYORES].</p>
<p>Una vez que tienes estas 3 listas, el resultado de Quicksort es el siquiente (Donde ++ es concatenar una lista):</p>
<blockquote><p>Quicksort([MENORES]) ++ [IGUALES] ++ Quicksort([MAYORES])</p></blockquote>
<p>Como veras, el algoritmo es recursivo, y llegara el momento que no encuentres numeros menores, iguales o mayores, asi que cuando Quicksort recibe una lista de un solo elemento, devuelve ese elemento.</p>
<p>En python esto sale en 4 lineas con list comprehension, literalmente:</p>
<pre>
def qs(lista):
   if len(lista) <= 1: return lista
   p = lista[0] #el pivote
   return qs([x for x in lista if x < p]) + [x for x in lista if x == p] + qs([x for x in lista if x > p])
</pre>
<p>Pudieras aplicar este algoritmo a cualquier tipo de objeto en Python si para ese objeto defines las funciones de comparacion.<br />
Demasiado arrecho, viva python.</p>
<p>PS: Despues de escribir esto, encontre una implementacion aun mas corta, en la que no utilizan list comprehension, utilizan<br />
funciones lambda, en vez de hacer [x for x in lista if x < pivote] hacen  filter(lambda x,y=pivote: x < y,lista), eso devuelve los elementos que cumplen con la funcion lambda en la lista, es decir   filter(funcion, lista)</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Recordando+algoritmos%2C+Quicksort+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F&amp;title=Recordando+algoritmos%2C+Quicksort"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F&amp;title=Recordando+algoritmos%2C+Quicksort"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F&amp;title=Recordando+algoritmos%2C+Quicksort"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F&amp;headline=Recordando+algoritmos%2C+Quicksort"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Recordando+algoritmos%2C+Quicksort&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Recordando+algoritmos%2C+Quicksort&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Recordando+algoritmos%2C+Quicksort&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Recordando+algoritmos%2C+Quicksort&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Recordando+algoritmos%2C+Quicksort&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F&amp;title=Recordando+algoritmos%2C+Quicksort&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F17%2Frecordando-algoritmos-quicksort%2F&amp;title=Recordando+algoritmos%2C+Quicksort"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/05/17/recordando-algoritmos-quicksort/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Do you dream about coding with Python and Qt4 (PyQt4)? Temboo needs you.</title>
		<link>http://www.gubatron.com/blog/2007/05/12/creative-qtpyqt-gui-developers-needed/</link>
		<comments>http://www.gubatron.com/blog/2007/05/12/creative-qtpyqt-gui-developers-needed/#comments</comments>
		<pubDate>Sat, 12 May 2007 13:44:09 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Jobs]]></category>
		<category><![CDATA[New York City Life]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/05/12/creative-qtpyqt-gui-developers-needed/</guid>
		<description><![CDATA[Creative Qt/PyQt GUI Developers needed
About us:
Temboo is a New York-based software company. We have developed a new software model which uses a powerful graphical interface to allow non-programmers to quickly build complex workflows enabling disparate databases, web services, and applications to communicate and interact. Think of our technology as an &#8220;inter-operating system,&#8221; a visual tool [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Creative Qt/PyQt GUI Developers needed</strong></p>
<p><strong>About us:</strong></p>
<p><img src="http://farm1.static.flickr.com/203/493835510_d3a64d79b2_m.jpg" style="margin:4px 4px" align="left" /><strong>Temboo</strong> is a <strong>New York-based</strong> software company. We have developed a new software model which uses a powerful graphical interface to allow non-programmers to quickly build complex workflows enabling disparate databases, web services, and applications to communicate and interact. Think of our technology as an &#8220;inter-operating system,&#8221; a visual tool for developing advanced information services applications that actually works.</p>
<p>We are a small but well-funded company with versions of our product currently live; some of our first customers are leading financial institutions. Our company culture promotes individual contribution, innovation, excellence, and the belief that work should also be fun.</p>
<p><center><img src="http://farm1.static.flickr.com/204/495372819_4fe506ad4e.jpg?v=0"/></center></p>
<p><strong>About you:</strong><br />
We are looking for developers with experience building complex but user-friendly interfaces. In this position, you&#8217;ll help us think creatively about how users interact with technology and find ways of creating systems that simplify compex processes.</p>
<p>Ideally, you possess most or all of the following traits/skills:</p>
<p>    * Experience with <strong>Qt4, Python, and PyQt4</strong><br />
    * Experience with AJAX development<br />
    * <strong>Broad familiarity with OO design patterns</strong><br />
    * Understanding of <strong>good user interface design principles</strong><br />
    * Experience working with information architects</p>
<p>Additional bonus points for:</p>
<p>    * <strong>Familiarity with agile </strong>methods like XP and <strong>test-driven development</strong><br />
    * Experience developing games<br />
    * Experience developing tools that use visual metaphors<br />
    * Interests outside of work (in your email, please tell us what they are!)<br />
    * Sense of humor</p>
<p>We are most interested in candidates who are in the <strong>New York area, or willing to relocate</strong>. However, <strong>telecommuting may be an option</strong> for the right individual.</p>
<p>If this sounds like you, please email your resume and a cover letter introducing yourself to <strong>jobs@temboo.com</strong></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Tem...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F&amp;title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F&amp;title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F&amp;title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F&amp;headline=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F&amp;title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F12%2Fcreative-qtpyqt-gui-developers-needed%2F&amp;title=Do+you+dream+about+coding+with+Python+and+Qt4+%28PyQt4%29%3F+Temboo+needs+you."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/05/12/creative-qtpyqt-gui-developers-needed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ejemplo de automatizacion entre 2 maquinas remotas con bash scripting y Python</title>
		<link>http://www.gubatron.com/blog/2007/05/10/ejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python/</link>
		<comments>http://www.gubatron.com/blog/2007/05/10/ejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python/#comments</comments>
		<pubDate>Thu, 10 May 2007 14:24:55 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OSX]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/05/10/ejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python/</guid>
		<description><![CDATA[Para los amigos que se inician en el mundo *nix, ya sea con su nueva Mac, o con una PC corriendo Linux,
les recomiendo que aprendan a manejar bien los siguientes lenguajes, y el mundo sera suyo:
- bash scripting (aliases, variables, exports, iteraciones, condicionales)
- python (para programar logica mas compleja y portatil en cualquier sistema operativo)
- [...]]]></description>
			<content:encoded><![CDATA[<p>Para los amigos que se inician en el mundo *nix, ya sea con su nueva Mac, o con una PC corriendo Linux,<br />
les recomiendo que aprendan a manejar bien los siguientes lenguajes, y el mundo sera suyo:</p>
<p>- <strong>bash scripting</strong> (aliases, variables, exports, iteraciones, condicionales)<br />
- <strong>python</strong> (para programar logica mas compleja y portatil en cualquier sistema operativo)<br />
- Uso de comandos como grep, egrep, awk (editor de streams) entre otros<br />
- Expresiones regulares</p>
<p>En wedoit4you.com hicimos un simple script que va logeando visitas desde los blogs registrados.<br />
Los blogeros ponen un pedacito de javascript, que al ser invocado, escribe una entrada en un log en el servidor.</p>
<p>Luego tenemos un script que analiza ese log, elimina cualquier intento de hacer muchos clicks, etc. etc.<br />
Ese script se encarga luego de hacer matching de las URLs entrantes, con las URLs de los posts que wedoit4you.com<br />
ya leyo. Este script lamentablemente tarda mucho en analizar mas de 150mb de data, mas lo que haya en el log,<br />
y Dreamhost lo mata si dura mas de un minuto, o si hay mas de N procesos corriendo.</p>
<p>Que hacemos entonces?</p>
<p>Ponemos ese script en una maquina local, donde tenemos todo el cpu, y hacemos que el servidor a ciertas horas<br />
del dia, haga un mysqldump de las tablas que me interesan (BLOGS, BLOG_POSTS, POST_HITS) y meta eso en un archivo<br />
disponible via HTTP.</p>
<p><code><br />
#!/bin/bash<br />
DUMP_DIR=/home/cuenta_en_server/sitio.com/temp/<br />
SQL_FILE_NAME=clicktrackr_dump.sql<br />
SQL_FILE=${DUMP_DIR}/${SQL_FILE_NAME}<br />
TGZ_FILE=${SQL_FILE_FNAME}.tar.gz<br />
mysqldump bd_en_servidor BLOGS BLOG_POSTS POST_HITS > ${SQL_FILE}<br />
cd ${DUMP_DIR}<br />
pwd<br />
echo Making tar<br />
tar cfz ${TGZ_FILE} ${SQL_FILE}<br />
echo Tar with SQL dump ready to be downloaded.<br />
echo Finished.<br />
</code></p>
<p>Este script corre digamos a las 4am en el servidor.</p>
<p><strong>Luego desde la casa</strong><br />
Luego en la maquina local corre un cronjob a las 4:30am, En mi caso una apple iMac Intel, y he aqui el poder de tener una Mac basada en Unix, y no la cagada de windows de mierda.</p>
<p>Hice sencillo bash script que se baja ese dump de la base de datos, y se baja el log del clickTracker para hacer los calculos en mi cpu,<br />
(con el cual hago lo que me da la gana), los calculos son realizados con un script en python (click_tracker.py, incluido al final)<br />
y una vez que termina de calcular, hace ftp de vuelta hacia el servidor y sube un archivo SQL<br />
con instrucciones SQL para que se actualizen los hits de los posts. Este archivo de lolas que no lo subo a un directorio disponible en apache<br />
pq alguien podria meterse con el y alterarnos los hits&#8230; Este Script local luce asi:</p>
<p><code><br />
#!/bin/bash<br />
rm /Users/gubatron/clicktrackr/*.tar.gz<br />
rm /Users/gubatron/clicktrackr/*.sql<br />
rm /Users/gubatron/clicktrackr/*.dat<br />
rm /Users/gubatron/clicktrackr/*.log<br />
echo "Downloading dump from server..."<br />
wget http://www.wedoit4you.com/dir_del_dump/clicktrackr_dump.sql.tar.gz -O /Users/gubatron/clicktrackr/clicktrackr_dump.sql.tar.gz<br />
cd /Users/gubatron/clicktrackr/<br />
echo "Uncompressing Dump..."<br />
tar xfz clicktrackr_dump.sql.tar.gz<br />
echo "Loading data in MySQL"<br />
mysql --user=usuario --password=password --database=bd_local < clicktrackr_dump.sql<br />
echo "Downloading latest tracker.log"<br />
wget http://www.wedoit4you.com/xxxxxxxxx/logs/tracker.log -O /Users/gubatron/clicktrackr/tracker.log<br />
echo "Crunching Data with python script"<br />
python click_tracker.py<br />
echo "Compressing data crunched"<br />
tar cvfz clicktrackr_update_tables.sql.tar.gz clicktrackr_update_tables.sql<br />
echo "Uploading data"<br />
#then upload tar.gz clicktrackr_update_tables.sql<br />
ftp -u ftp://usuario:password@wedoit4you.com/directorioNoAccesiblePorApache/ clicktrackr_update_tables.sql.tar.gz<br />
echo "Finished"<br />
</code></p>
<p>La salida de este script cuando se ejecuta es similar ea esto<br />
<code><br />
imac:~ gubatron$ clicktrackr_processing<br />
Downloading dump from server...<br />
--09:45:14--  http://www.wedoit4you.com/xxxxxxx/clicktrackr_dump.sql.tar.gz<br />
           => `/Users/gubatron/clicktrackr/clicktrackr_dump.sql.tar.gz'<br />
Resolving www.wedoit4you.com... 208.113.146.143<br />
Connecting to www.wedoit4you.com|208.113.146.143|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
Length: 41,227,814 [application/x-tar]</p>
<p>100%[====================================&gt;] 41,227,814    86.84K/s    ETA 00:00</p>
<p>09:53:18 (83.35 KB/s) - `/Users/gubatron/clicktrackr/clicktrackr_dump.sql.tar.gz' saved [41227814/41227814]</p>
<p>Uncompressing Dump...<br />
Loading data in MySQL<br />
/Users/gubatron/bin/clicktrackr_processing: line 12: clicktrackr_dump.sql: No such file or directory<br />
Downloading latest tracker.log<br />
--09:53:20--  http://www.wedoit4you.com/xxxxxxxxxxxxxx/tracker.log<br />
           =&gt; `/Users/gubatron/clicktrackr/tracker.log'<br />
Resolving www.wedoit4you.com... 208.113.146.143<br />
Connecting to www.wedoit4you.com|208.113.146.143|:80... connected.<br />
HTTP request sent, awaiting response... 200 OK<br />
Length: 3,220 [text/plain]</p>
<p>100%[====================================&gt;] 3,220         --.--K/s             </p>
<p>09:53:23 (33.72 KB/s) - `/Users/gubatron/clicktrackr/tracker.log' saved [3220/3220]</p>
<p>Crunching Data with python script<br />
/Users/gubatron/clicktrackr<br />
No timestamp from last time found.<br />
Loading data from ClickTrackr log...<br />
Saving ClickTrackr data to File...<br />
Saving completed.<br />
Loading Blogs and Last Posts from DB<br />
Saving Blogs to File...<br />
Saving completed.<br />
Loading Posts from DB...<br />
Saving Posts from DB on file<br />
Saving completed.<br />
Crunching data...<br />
0 converted from blog to last post<br />
Didnt find total 11 urls.<br />
Didn't find distinct 11 urls.<br />
Saving crunched data...<br />
Data saved.<br />
Writing SQL...<br />
Finished Writing SQL<br />
Wrote last timestamp.<br />
Compressing data crunched<br />
clicktrackr_update_tables.sql -&gt; clicktrackr_update_tables.sql.tar.gz<br />
Uploading data<br />
Connected to wedoit4you.com.<br />
220 ProFTPD 1.3.0rc2 Server (DreamHost FTP) [208.113.146.143]<br />
331 Password required for wedoit4y.<br />
230 User wedoit4y logged in.<br />
Remote system type is UNIX.<br />
Using binary mode to transfer files.<br />
200 Type set to I<br />
250 CWD command successful<br />
local: clicktrackr_update_tables.sql.tar.gz remote: clicktrackr_update_tables.sql.tar.gz<br />
229 Entering Extended Passive Mode (|||57539|)<br />
150 Opening BINARY mode data connection for clicktrackr_update_tables.sql.tar.gz<br />
100% |*************************************|   550 KB  155.72 KB/s    00:03<br />
226 Transfer complete.<br />
563661 bytes sent in 00:03 (143.48 KB/s)<br />
Finished<br />
</code></p>
<p>Una vez que la data fue procesada y FTPeada al servidor, hay otro cronjob que corre una hora mas<br />
tarde, y este asume que el nuevo archivo con la data procesada estara ahi, podriamos agregarle mas<br />
checks, utilizando "stat" y anotando el ultimo timestamp del sql utlizado la vez anterior cosa que no<br />
volvamos a anotar los hits del dia anterior...</p>
<p>Asi luce el script para actualizar finalmente en el servidor:</p>
<p><code><br />
#!/bin/bash<br />
DIR_PRIVADO=/home/usuario/dirPrivado<br />
PATH_DEL_TRACKER_LOG=/home/usuario/algunaCarpeta/tracker.log<br />
cd ${DIR_PRIVADO}<br />
rm *.sql<br />
tar xvfz clicktrackr_update_tables.sql.tar.gz<br />
mysql bd_en_servidor < ${DIR_PRIVADO}/clicktrackr_update_tables.sql<br />
rm *.tar.gz<br />
rm *.sql<br />
rm<br />
touch ${PATH_DEL_TRACKER_LOG}<br />
chmod 777 ${PATH_DEL_TRACKER_LOG}<br />
</code></p>
<p>Si tienes curiosidad de ver como cruncheo la data localmente, aqui esta el codigo en python.<br />
(Es aun un trabajo en progreso)<br />
<code>
<pre>
#!/home/wedoit4y/bin/python/bin/python2.5
# This is the script that processes the ClickTrackr Log
import os
import sys
import pickle
import time

#NAMES OF FILES WHERE WE'LL STORE THE DIFFERENT STAGES OF RETRIEVED
#AND PROCESSED DATA.

#File that holds a dictionary with URLs and HITs we got from the original log file
FILE_MAX_AGE=3600*1
FILE_TIMESTAMP="clicktrackr_last_timestamp.dat"
FILE_001="clicktrackr_001_url_hits.dat"
FILE_002="clicktrackr_002_blogs_lastposts.dat"
FILE_003="clicktrackr_003_posts_hits.dat"
FILE_004="clicktrackr_004_processed_hits.dat" #...and urls not found
FILE_SQL="clicktrackr_update_tables.sql"

try:
    import snowrss_config
    from snowrss_config import getDbCursor
    #from snowrss import *
except Exception,e:
    print "Could not import snowrss_config [%s]" % e
    sys.exit()

def dbExec(sql):
    """Give it some SQL and it will return the returning cursor"""
    try:
        cursor = getDbCursor()
        cursor.execute(sql)
        cursor.connection.close()
    except Exception, e:
        #MySQL has gone away
        print 'dbExec(%s): ' % unicode(sql)
        print e
        return None
    return cursor

def isFileFresh(fileName):
    """
    Returns True if the file is still good to be used.
    Othewise returns false
    """
    try:
        file_stat = os.stat(fileName)
        file_age = time.time() - file_stat.st_mtime
        if file_age > FILE_MAX_AGE:
            return False
        return True
    except:
        return False

def getData(line):
    """Returns a dict with, IP, Timestamp, URL and User Agent if found

    Parameters
        line - A Line with a ClickTracker log entry

    Output
        {'ip':...,'timestamp':...,'url':....,'ua':...}
        ip-> IP Addres
        time -> Time of the event
        url -> Referer Url
        ua -> User Agent of the rerferer user
    """
    l = line.split()
    result = {}
    result['ip']=l[0]
    result['time']=l[1]
    result['url']=l[2]

    result['ua']='N/A'
    if len(l)>3:
        rest = l[3:]
        ua_name = ''
        for b in rest:
            ua_name = ua_name + ' ' + b
        result['ua'] = ua_name

    return result

#Maximum time to count a click from the same IP on the same URL
TIME_BETWEEN_CLICKS = 12*3600

#On the last run (if finished, we write down the time of the last timestamp on file)
#If we did finish a run, we'll get this number from the timestamp file, and we'll ignore
#all previous log entries to that timestamp.
LAST_TIMESTAMP = None
POSSIBLE_LAST_TIMESTAMP = None

try:
    f = fopen(FILE_TIMESTAMP,"rb")
    LAST_TIMESTAMP = pickle.load(f)
    LAST_TIMESTAMP = long(LAST_TIMESTAMP)
    f.close()
except:
    print "No timestamp from last time found."

urls = {}
urls_not_found = {}
LOG_CLICK_TRACKER='tracker.log'

#check if there is a version of the log file backed that's still good enough to be used.
USABLE_LOG_FILE = LOG_CLICK_TRACKER

#use a copy of the log if we got some pickled data
if isFileFresh(LOG_CLICK_TRACKER + '.last') and isFileFresh(FILE_001):
    USABLE_LOG_FILE = LOG_CLICK_TRACKER + ".last"

IGNORED_ENTRIES = 0
if not isFileFresh(FILE_001):

    #open the tracker log (current or old)
    print "Loading data from ClickTrackr log..."
    f = open(USABLE_LOG_FILE,'r')

    f.seek(0,2)
    eof = f.tell()
    f.seek(0)

    while f.tell() < eof:
        entry = getData(f.readline())

        url = entry['url']
        ip = entry['ip']
        timestamp = entry['time']

        if LAST_TIMESTAMP is not None and long(timestamp) < LAST_TIMESTAMP:
            print "i",
            IGNORED_ENTRIES += 1
            continue

        POSSIBLE_LAST_TIMESTAMP = long(timestamp)

        if not url.startswith('http') or \
           url.startswith('http://babelfish.altavista.com') or \
           url.startswith('http://6'):
            #IGNORED_ENTRIES += 1
            continue

        #Ask if this URL is already there
        if urls.has_key(url):
            #Ask if this IP is already there
            if urls[url].has_key(ip):
                #Get the last time stamp inside this IP
                times = urls[url][ip]
                last_time = times[len(times)-1]
                delta_time = long(timestamp) - long(last_time)
                #If its been more than acceptable time
                if delta_time >= TIME_BETWEEN_CLICKS:
                    urls[url][ip].append(timestamp)

                    hits = 0
                    for ipbuffer in urls[url]:
                        if ipbuffer == 'hits': #just count the keys that are not 'hits'
                            continue
                        hits += len(urls[url][ipbuffer])

                    urls[url]['hits'] = hits
            else:
                urls[url][ip] = [timestamp]
                urls[url]['hits'] = 1
        else:
            urls[url]={}
            urls[url][ip] = [timestamp]
            urls[url]['hits']=1
    f.close()

    urls['POSSIBLE_LAST_TIMESTAMP'] = POSSIBLE_LAST_TIMESTAMP

    #we serialize this data for later
    if IGNORED_ENTRIES > 0:
        print "Ignored %d entries." % IGNORED_ENTRIES

    print "Saving ClickTrackr data to File..."
    f = file(FILE_001,"wb")
    pickle.dump(urls,f)
    f.close()
    print "Saving completed."

    #we make a backup of the current ClickTrackr log (.last), in case we need to run again
    #we can diff with this to know from where to relog in the future
    os.system("cp %s %s" % (LOG_CLICK_TRACKER,LOG_CLICK_TRACKER + ".last"))
else:
    #we unserialize the data
    print "Loading ClickTrackr data from existing file..."
    f = file(FILE_001,"rb")
    urls = pickle.load(f)
    f.close()
    POSSIBLE_LAST_TIMESTAMP = urls.pop('POSSIBLE_LAST_TIMESTAMP') #we popup so we have only urls and we dont modify further down
    print "Loading completed."

#LOAD ALL BLOG POST URLS, IDS AND CURRENT NUMBER OF HITS.
blog_urls = {} #blogs hashed by their urls, Buckets have {'post_id':<last_post_id>,'post_link':<last_post_link>}
blog_ids = {} #blogs hashed by their ids, Buckets have {'post_id':<last_post_id>,'post_link':<last_post_link>}
if not isFileFresh(FILE_002):
    print "Loading Blogs and Last Posts from DB"
    sql = "SELECT Blog_pk_id, Blog_url FROM BLOGS WHERE Blog_active=1;"
    cursor = dbExec(sql)
    results = cursor.fetchall()

    for r in results:
        #Get the ID of the last post on each blog"
        sql = u"SELECT BP_pk_id,BP_link FROM BLOG_POSTS WHERE BP_fk_blog_id = %d ORDER BY BP_pk_id DESC LIMIT 1" % (r['Blog_pk_id']);
        cursor = dbExec(sql)
        last_post = cursor.fetchone()

        if last_post:
            blog_urls[r['Blog_url']] = {'post_id':last_post['BP_pk_id'],'post_link':last_post['BP_link']}
            blog_ids[r['Blog_pk_id']] = {'post_id':last_post['BP_pk_id'],'post_link':last_post['BP_link']}

    #serialize blog_urls and blog_ids
    print "Saving Blogs to File..."
    f = file(FILE_002,"wb")
    pickle.dump(blog_urls,f)
    pickle.dump(blog_ids,f)
    f.close()
    print "Saving completed."
else:
    #load blog_urls from serialized data
    print "Loading Blogs and Last Posts from File..."
    f = file(FILE_002,"rb")
    blog_urls = pickle.load(f)
    blog_ids = pickle.load(f)
    f.close()
    print "Loading completed."

#LOAD ALL BLOG_POSTS URL AND ITS HITS
post_hits = {} #posts hashed by url, Buckets have (post_id, post_hits, blog_id)
if not isFileFresh(FILE_003):
    print "Loading Posts from DB..."
    sql = "SELECT SQL_CACHE BP_link, BP_pk_id, BP_fk_blog_id, PH_hits "
    sql += "FROM BLOG_POSTS LEFT JOIN POST_HITS ON BP_pk_id = PH_fk_post_id;"
    cursor = dbExec(sql)
    results = cursor.fetchall()

    for r in results:
        #hits might be null, if the post has never been reached on our page
        hit_count = int(r['PH_hits']) if r['PH_hits'] is not None else 0
        post_hits[r['BP_link']] = {'post_id':int(r['BP_pk_id']),
                                   'post_hits':hit_count,
                                   'blog_id':r['BP_fk_blog_id']}

    #now get the blog_posts
    print "Saving Posts from DB on file"
    f = file(FILE_003,"wb")
    pickle.dump(post_hits,f)
    f.close()
    print "Saving completed."
else:
    print "Loading Posts from File..."
    f = file(FILE_003,"rb")
    post_hits = pickle.load(f)
    f.close()
    print "Loading completed."

# The stars of the game are:
# - urls {<url>:{'ip':<ip>,'hits':<hits>}} //The urls and how many hits we got from the click trackr log
# - blog_urls {<url>:{'post_id':<last_post_id>,'post_link':<last_post_link>}} //urls of blogs, holding each a tuple with last post info
# - post_hits {<url>:{'post_id':
<post_id>,'post_hits':
<post_hits>,'blog_id':<blog_id>]} //urls and hit info of all posts
# - urls_not_found {'<url>':<no_times_found_in_log>}
if not isFileFresh(FILE_004):
    total_not_found = 0
    distinct_not_found = 0
    total_converted = 0

    converting_blog_url_to_post_url = False

    print "Crunching data..."
    for url in urls:
	#if the current url is the home of a blog
        #we try to see if the blog has any hits.
	if blog_urls.has_key(url):
            url = blog_urls[url]['post_link']
            converting_blog_url_to_post_url = True

        #if you find a direct match add the hits right away
        if post_hits.has_key(url):
	    new_hits = 0
	    if urls.has_key(url) and urls[url].has_key('hits'):
                new_hits = urls[url]['hits']
                if converting_blog_url_to_post_url:
                    total_converted+=1
                    print "!",

            old_hits = 0
            if post_hits[url].has_key('post_hits'):
                old_hits = post_hits[url]['post_hits']

            total_hits = new_hits + old_hits

            #finally update post_hits arrays.
            post_hits[url]['post_hits'] = total_hits
            str_a = "(%(post_id)d):%(post_hits)d:" % post_hits[url]
            str_b = "%d+%d)" % (new_hits,old_hits)
            str_c = str_a + str_b
            print str_c,
        else:
            if urls_not_found.has_key(url):
                urls_not_found[url] += 1
            else:
                urls_not_found[url]=1
                distinct_not_found +=1
            total_not_found += 1
            print "-",

    print
    print "%d converted from blog to last post" % total_converted
    print "Didnt find total %d urls." % total_not_found
    print "Didn't find distinct %d urls." % distinct_not_found

    #serialize processed data in file 4
    print "Saving crunched data..."
    f = file(FILE_004,"wb")
    pickle.dump(post_hits,f)
    pickle.dump(urls_not_found,f)
    f.close()
    print "Data saved."
else:
    print "Loading Previously Crunched Data..."
    f = file(FILE_004,"rb")
    post_hits = pickle.load(f)
    urls_not_found = pickle.load(f)
    f.close
    print "Loading completed."

    #If we can't find it on the blog posts, we could try to
    #slim the URL of this url too http://servername.com/folder
    #and look up on the blog url

    #if nothing, we slim down to http://servername.com

    #if in any of these 2 cases we find a match then
    #we add a hit on the last post of this blog

    #the output of this file should be for now a file with SQL insert statements
print len(post_hits)

#Generate SQL output from post_hits array
# - post_hits {<url>:{'post_id':
<post_id>,'post_hits':
<post_hits>,'blog_id':<blog_id>]}
print "Writing SQL..."
f = file(FILE_SQL,"wb")
for url in post_hits:
    post_id = post_hits[url]['post_id']
    hits = post_hits[url]['post_hits']
    f.writelines("UPDATE POST_HITS SET PH_hits = %d WHERE PH_fk_post_id = %d;\n" % (hits,post_id))
f.close()
print "Finished Writing SQL"

#If we make it all the way till here, we write down the new LAST_TIMESTAMP
if POSSIBLE_LAST_TIMESTAMP is not None:
    f = file(FILE_TIMESTAMP,"wb")
    pickle.dump(POSSIBLE_LAST_TIMESTAMP,f)
    f.close()
    print "Wrote last timestamp."
else:
    print "Did not write LAST timestamp."

for u in urls_not_found:
    print u
</pre>
<p></code></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Ejemplo+de+automa...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F&amp;title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F&amp;title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F&amp;title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F&amp;headline=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F&amp;title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F10%2Fejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python%2F&amp;title=Ejemplo+de+automatizacion+entre+2+maquinas+remotas+con+bash+scripting+y+Python"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/05/10/ejemplo-de-automatizacion-entre-2-maquinas-remotas-con-bash-scripting-y-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP, ordenando un arreglo de Objetos, y utilizando funciones dentro de funciones.</title>
		<link>http://www.gubatron.com/blog/2007/05/06/php-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones/</link>
		<comments>http://www.gubatron.com/blog/2007/05/06/php-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones/#comments</comments>
		<pubDate>Sun, 06 May 2007 11:10:51 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/05/06/php-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones/</guid>
		<description><![CDATA[
No fue hasta que programe en Python que me habia pillado que podia definir funciones dentro de funciones en PHP. Hoy tuve que arreglar un defecto en el home de wedoit4you.com del cual algunos bloggers se estaban aprovechando para permanecer en el home. Los articulos aparecen ordenados por fecha de publicacion, y algunos estaban publicando [...]]]></description>
			<content:encoded><![CDATA[<p><center><a href="http://flickr.com/photos/gubatron/486226982/"><img src="http://farm1.static.flickr.com/194/486226982_aa65be1753_o.png" border="0"/></a></center></p>
<p>No fue hasta que programe en Python que me habia pillado que podia definir funciones dentro de funciones en PHP. Hoy tuve que arreglar un defecto en el home de wedoit4you.com del cual algunos bloggers se estaban aprovechando para permanecer en el home. Los articulos aparecen ordenados por fecha de publicacion, y algunos estaban publicando con fechas en el futuro, inclusive abusando y poniendo fechas a fin de mes.</p>
<p>So, en mi clase &#8220;BlogPost&#8221;, puse un metodo &#8220;getTimestamp()&#8221;, si la fecha interna en el objeto esta en el futuro, y no es uno de los blogs a los cuales les paso la gracia&#8230;<br />
Penalizo la fecha del post, y le resto 24 horas a la ultima hora en que se actualizo el Blog.</p>
<p>Pero esto no me resuelve por completo el problema puesto que los posts se leen direct tv de una tabla, y el query ordena por timestamp, el resultado de mi funcion &#8220;getPosts&#8221; es un arreglo de Objetos, y lo ideal era tener esos objetos ordenados dependiendo de la funcion &#8220;getTimestamp()&#8221; en cada objeto &#8220;BlogPost&#8221;</p>
<p>La foto que ven arriba muestra como utilizo la funcion &#8220;usort&#8221; para ordenar (por referencia) el arreglo resultante. La funcion recibe una referencia al arreglo de objetos, y el nombre de una funcion a la cual hacer callback al momento de comparar. La funcion de callback debe recibir 2 objetos como parametro, y luego devolver un numero que represente si el primer parametro es menor o mayor que el segundo parametro. ( < que cero si es menor, cero si son iguales, > que cero si es mayor).</p>
<p>En mi caso llame esta funcion &#8220;cmp&#8221;, pero no la defini afuera de la clase nisiquiera, la defini ahi mismo dentro de la funcion. Si ven la logica de mi funcion el resultado es alrevez puesto que quiero ordenar de manera decrescente.</p>
<p>Espero que alguien haya leido esto si necesita ordenar arreglos.</p>
<p>En cuanto al scoping de las funciones internas, no se que sucederia si hubiese otra funcion llamada igual en el path, supongo que el interprete busca primero en el stack, y encontraria la funcion definida dentro de la funcion actual. Imagino que al terminar de ejecutarse esta funcion, podria no estar diponible para mas nadie. Se que en python puedes hacer Clases dentro de clases, funciones dentro de funciones. En el caso de Clases dentro de Clases, puedes hacer.   Objeto.SubObjeto.metodo(), en el caso de funciones dentro de funciones, creo que no tiene sentido hacer algo como  Objeto.function.subFuncion(), ya que las funciones necesitan parametros, pero seria cuestion de probar a ver, quizas funciona, dado que en python todo es un objeto. Alguien que me eche el cuento para PHP.</p>
<p>(el screenshot fue tomado de emacs en el terminal de OSX Tiger)</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=PHP%2C+ordenando+...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F&amp;title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F&amp;title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F&amp;title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F&amp;headline=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F&amp;title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F05%2F06%2Fphp-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones%2F&amp;title=PHP%2C+ordenando+un+arreglo+de+Objetos%2C+y+utilizando+funciones+dentro+de+funciones."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/05/06/php-ordenando-un-arreglos-de-objectos-y-utilizando-funciones-dentro-de-funciones/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bash Alias &#8211; &#8220;svn_diff_counter&#8221;: Count lines added and removed</title>
		<link>http://www.gubatron.com/blog/2007/04/30/bash-alias-svn_diff_counter-count-lines-added-and-removed/</link>
		<comments>http://www.gubatron.com/blog/2007/04/30/bash-alias-svn_diff_counter-count-lines-added-and-removed/#comments</comments>
		<pubDate>Mon, 30 Apr 2007 16:25:43 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/04/30/bash-alias-svn_diff_counter-count-lines-added-and-removed/</guid>
		<description><![CDATA[I love to know how many lines I&#8217;ve added and deleted before making a commit.
This is why I created this alias:

alias svn_diff_counter='svn diff &#124; egrep "^[\+&#124;\-].*" &#124; egrep -v "(\+\+\+)&#124;(\-\-\-)" > .tmp_diff_counter ; added=`egrep "(^\+)" .tmp_diff_counter &#124; wc -l`; removed=`egrep "(^\-)" .tmp_diff_counter &#124; wc -l`; rm .tmp_diff_counter; echo "Lines Added vs. Line Removed since your [...]]]></description>
			<content:encoded><![CDATA[<p>I love to know how many lines I&#8217;ve added and deleted before making a commit.</p>
<p>This is why I created this alias:</p>
<p><code style="color:#0A0; font-weight:bolder; font-family:Courier"><br />
alias svn_diff_counter='svn diff | egrep "^[\+|\-].*" | egrep -v "(\+\+\+)|(\-\-\-)" > .tmp_diff_counter ; added=`egrep "(^\+)" .tmp_diff_counter | wc -l`; removed=`egrep "(^\-)" .tmp_diff_counter | wc -l`; rm .tmp_diff_counter; echo "Lines Added vs. Line Removed since your last commit"; echo "+ ${added}"; echo "- ${removed}"; echo;'</code><br />
(actualizado el 3 de mayo de 2003 a las 4:03pm, NT Time)</p>
<p><em>En Espa&ntilde;ol</em><br />
Coloca este alias en tu .bash_profile o .bashrc (o .bash_aliases, si tienes un script como yo con puros aliases invocado por .bashrc :) ). Si estas trabajando con un repositorio SVN a veces es divertido ver cuantas lineas de codigo agregaste y cuantas lineas de codigo borraste desde tu ultimo commit. Solo ejecutas este alias &#8220;svn_diff_counter&#8221; y tendras el numero de lineas cambiadas dentro de todos los subdirectorios desde donde estas parado.</p>
<p>Si ves el alias en detalle es muy sencillo, Hago diff, luego extraigo con un regexp todas las lineas que comienzan por &#8220;+&#8221; y por &#8220;-&#8221;, y pongo eso en un archivo temporal, luego vuelvo a hacer un grep para las que comienzan con &#8220;+&#8221; y cuento cuantas lineas hay despues del grep, y meto eso en una variable, repito lo mismo para &#8220;-&#8221;, elimino el archivo temporal y luego imprimo los resultados.</p>
<p>Una vez puesto el alias, solo escribes &#8220;svn_&#8221; [Tab][Enter] y listo<br />
(si no tienes otro alias/comando que comienze por &#8220;svn_&#8221;)</p>
<p>Enjoy.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Bash+Alias+%26%238211%3B+%26%238220%3Bsvn_diff_cou...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F&amp;title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F&amp;title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F&amp;title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F&amp;headline=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F&amp;title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F30%2Fbash-alias-svn_diff_counter-count-lines-added-and-removed%2F&amp;title=Bash+Alias+-+%22svn_diff_counter%22%3A+Count+lines+added+and+removed"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/04/30/bash-alias-svn_diff_counter-count-lines-added-and-removed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fuck the Python Borg, I like Singleton Better</title>
		<link>http://www.gubatron.com/blog/2007/04/25/fuck-the-python-borg-i-like-singleton-better/</link>
		<comments>http://www.gubatron.com/blog/2007/04/25/fuck-the-python-borg-i-like-singleton-better/#comments</comments>
		<pubDate>Wed, 25 Apr 2007 15:02:50 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/04/25/fuck-the-python-borg-i-like-singleton-better/</guid>
		<description><![CDATA[
I&#8217;ve read in parts of the web (and on the Martinelli&#8217;s Python Cookbok) that it&#8217;s better to do the Borg pattern over singletons, they say something alongs the lines of:
&#8220;who cares about identity, care about shared state&#8221;
Coming from the Java world, I just can&#8217;t understand that, why waste memory and cpu to address objects that [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm1.static.flickr.com/216/467754686_701bee8596.jpg?v=0" style="margin:3px 3px" alt="I'm looking for a sponsor, HÃ¤agen-Dazs wants a geek??"></p>
<p>I&#8217;ve read in parts of the web (and on the Martinelli&#8217;s Python Cookbok) that it&#8217;s better to do the Borg pattern over singletons, they say something alongs the lines of:</p>
<p><strong>&#8220;who cares about identity, care about shared state&#8221;</strong></p>
<p>Coming from the Java world, I just can&#8217;t understand that, why waste memory and cpu to address objects that share a state when you can have a single object in memory.</p>
<p>If you&#8217;re looking on how to implement singleton in a simple manner with Python, do the following my friend:</p>
<pre style="width:400px; border:none; font-weight:bolder">
class MyClass:
  __INSTANCE__ = None

  def __init__(self):
    #do whatever you need on your constructor
    pass

  @staticmethod
  def getInstance():
    if MyClass.__INSTANCE__ is None:
      MyClass.__INSTANCE__ = MyClass()
    return MyClass.__INSTANCE__

#Then use it.
theOne = MyClass.getInstance()
</pre>
<p>Done deal, now start trolling on why this code sucks so we can fix it.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Fuck+the+Python+Borg%2C+I+like+Singleton+Better+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F&amp;title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F&amp;title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F&amp;title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F&amp;headline=Fuck+the+Python+Borg%2C+I+like+Singleton+Better"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Fuck+the+Python+Borg%2C+I+like+Singleton+Better&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F&amp;title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F25%2Ffuck-the-python-borg-i-like-singleton-better%2F&amp;title=Fuck+the+Python+Borg%2C+I+like+Singleton+Better"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/04/25/fuck-the-python-borg-i-like-singleton-better/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Como saber que programa esta ocupando tus recursos de sonido. Como matar varios procesos relacionados sin hacer kill -9 a mano</title>
		<link>http://www.gubatron.com/blog/2007/04/23/como-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano/</link>
		<comments>http://www.gubatron.com/blog/2007/04/23/como-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano/#comments</comments>
		<pubDate>Mon, 23 Apr 2007 15:27:29 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/04/23/como-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano/</guid>
		<description><![CDATA[Aprovecho y doy 2 consejos.
Cuando Amarok, o XMMS no te quieren funcionar, y no ves ningun proceso que este relacionado en top, matas todo&#8230; firefox, xmms, amarok, y aun nada&#8230;. la solucion es lsof. Intenta hacer esto:

lsof &#124; grep alsa

Aparecera una lista de procesos y te muestra que librerias estan ocupando. Mata el proceso sospechoso [...]]]></description>
			<content:encoded><![CDATA[<p>Aprovecho y doy 2 consejos.</p>
<p>Cuando Amarok, o XMMS no te quieren funcionar, y no ves ningun proceso que este relacionado en top, matas todo&#8230; firefox, xmms, amarok, y aun nada&#8230;. la solucion es lsof. Intenta hacer esto:</p>
<p><code><br />
lsof | grep alsa<br />
</code></p>
<p>Aparecera una lista de procesos y te muestra que librerias estan ocupando. Mata el proceso sospechoso y deberia solventarse el problema.</p>
<p><strong>Otro consejo</strong></p>
<p>A veces quieres matar un programa que tiene relacionados varios procesos, y <strong>killall</strong> no es una opcion ya que los otros procesos tienen nombres diferentes, y ademas hacer kill -9 p1 p2 p3 &#8230; pn puede ser muy tedioso. Mi solucion es esta (la cual puse en un script llamado &#8220;matalo&#8221;)</p>
<p><code><br />
#!/bin/bash<br />
#matalo <nombre proceso><br />
#Pon este script en algun lugar de tu PATH, y hazle chmod +x<br />
ps aux | grep $1 | grep -v grep | awk {'print $2'} | xargs kill -9<br />
</code></p>
<p>Perro a cagar.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacion...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F&amp;title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F&amp;title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F&amp;title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F&amp;headline=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F&amp;title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F04%2F23%2Fcomo-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano%2F&amp;title=Como+saber+que+programa+esta+ocupando+tus+recursos+de+sonido.+Como+matar+varios+procesos+relacionados+sin+hacer+kill+-9+a+mano"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/04/23/como-saber-que-programa-esta-ocupando-tus-recursos-de-sonido-como-matar-varios-procesos-relacionados-sin-hacer-kill-9-a-mano/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Video de como fue el Google Code Jam Latin America 2007</title>
		<link>http://www.gubatron.com/blog/2007/03/18/video-de-como-fue-el-google-code-jam-latin-america-2007/</link>
		<comments>http://www.gubatron.com/blog/2007/03/18/video-de-como-fue-el-google-code-jam-latin-america-2007/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 03:09:24 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/03/18/video-de-como-fue-el-google-code-jam-latin-america-2007/</guid>
		<description><![CDATA[ 
]]></description>
			<content:encoded><![CDATA[<p><embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=8645111918937942037&#038;hl=en" flashvars=""> </embed></p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=Video+de+como+fue+el+Google+Code+Jam+Lat...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F&amp;title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F&amp;title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F&amp;title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F&amp;headline=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F&amp;title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F18%2Fvideo-de-como-fue-el-google-code-jam-latin-america-2007%2F&amp;title=Video+de+como+fue+el+Google+Code+Jam+Latin+America+2007"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/03/18/video-de-como-fue-el-google-code-jam-latin-america-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svn: Can&#8217;t create tunnel: The system cannot find the file specified.</title>
		<link>http://www.gubatron.com/blog/2007/03/15/svn-cant-create-tunnel-the-system-cannot-find-the-file-specified/</link>
		<comments>http://www.gubatron.com/blog/2007/03/15/svn-cant-create-tunnel-the-system-cannot-find-the-file-specified/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 16:54:38 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/03/15/svn-cant-create-tunnel-the-system-cannot-find-the-file-specified/</guid>
		<description><![CDATA[I was trying to checkout a project from a subversion repository using Eclipse&#8217;s Subversive, and I was having problems with a subversion url that starts with &#8220;svn+ssh://&#8221;
This means all the transport has to be done using a &#8220;ssh&#8221; agent.
Eclipse&#8217;s Subclipse plugin was giving me the error:
svn: Can&#8217;t create tunnel: The system cannot find the file [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to checkout a project from a subversion repository using Eclipse&#8217;s Subversive, and I was having problems with a subversion url that starts with &#8220;svn+ssh://&#8221;</p>
<p>This means all the transport has to be done using a &#8220;ssh&#8221; agent.</p>
<p>Eclipse&#8217;s Subclipse plugin was giving me the error:<br />
<strong>svn: Can&#8217;t create tunnel: The system cannot find the file specified.</strong></p>
<p>To solve the problem I recommend that you&#8230;</p>
<p><strong>Use a pure Java SSH Agent</strong></p>
<p>In Eclipse > Window > Preferences > Team > SSH > SVN Interface > SVNKit (Pure Java)</p>
<p>However it seems its possible to&#8230;</p>
<p><strong>Use Tortoise as your SSH agent</strong></p>
<p>Go to your Windows Environment Variables settings (Computer -> Advanced Settings -> Environment Variables) and add or set the variable SVN_SSH = c:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe</p>
<p>(the double slashes are very important!)</p>
<p>Then make sure eclipse is using the native (Tortoise Plink&#8217;s) ssh agent:</p>
<p>This is set here:<br />
In Eclipse > Window > Preferences > Team > SSH > SVN Interface > JavaHL (JNI)</p>
<p>Once Set and applied, Restart Eclipse, and checkout your project.</p>
<p>Only problem is (at least I found), that when you try to check out, TortoisePlink will prompt its password window, and there&#8217;s no way (that I know for now) to specify the user name. I tried putting in the username on the svn+ssh://user@server  but when I tried, Eclipse told me that the path already existed. You probably need to delete the repo and create it again in eclipse. But since it already works with a Pure Java SSH agent&#8230; fuck it.</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=svn%3A+Can%26%238217%3Bt+create+tunnel%3A...+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F&amp;title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F&amp;title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F&amp;title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F&amp;headline=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified.&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified.&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F&amp;title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified.&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F03%2F15%2Fsvn-cant-create-tunnel-the-system-cannot-find-the-file-specified%2F&amp;title=svn%3A+Can%27t+create+tunnel%3A+The+system+cannot+find+the+file+specified."><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/03/15/svn-cant-create-tunnel-the-system-cannot-find-the-file-specified/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to build PyQt4 for Windows</title>
		<link>http://www.gubatron.com/blog/2007/02/23/how-to-build-pyqt4-for-windows/</link>
		<comments>http://www.gubatron.com/blog/2007/02/23/how-to-build-pyqt4-for-windows/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 21:52:10 +0000</pubDate>
		<dc:creator>gubatron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geeklife]]></category>
		<category><![CDATA[Qt4]]></category>

		<guid isPermaLink="false">http://www.gubatron.com/blog/2007/02/23/how-to-build-pyqt4-for-windows/</guid>
		<description><![CDATA[- Make sure you don&#8217;t have cygwin or C:\devkitPro\msys\bin in your path,
or else your make files can end up trying to run the Makefile using &#8217;sh&#8217; and all
the makefile we&#8217;re about to use are meant to run from the windows command line. 
If for some odd reason you type &#8217;sh&#8217; on your windows command line [...]]]></description>
			<content:encoded><![CDATA[<p>- Make sure you don&#8217;t have cygwin or C:\devkitPro\msys\bin in your path,<br />
or else your make files can end up trying to run the Makefile using &#8217;sh&#8217; and all<br />
the makefile we&#8217;re about to use are meant to run from the windows command line. </p>
<p>If for some odd reason you type &#8217;sh&#8217; on your windows command line and you see something like:</p>
<p>     sh-2.04$</p>
<p>You&#8217;re likely to find this later on:</p>
<p>     /bin/sh: -c: line 2: syntax error: unexpected end of file</p>
<p>- Install Qt open source, with the exe installer, this will attempt to install<br />
  ming if you don&#8217;t have it installed, say yes, mingw rocks.</p>
<p>- Make sure you have the following Windows environment variables set:</p>
<p>      QTDIR = c:\Qt\4.2.2<br />
      QTMAKESPEC = win32-g++</p>
<p>- Make sure you have Python2.5, Qt bin and Mingw bin folders on your path</p>
<p>  PATH = %PATH%;c:\Mingw\bin;c:\Mingw\libexec\gcc\mingw32\3.4.2\;c:\python25\bin;c:\Qt\4.2.2\bin</p>
<p>- Get pexports just in case the Qt doesn&#8217;t have libQtCore4.a on its lib/<br />
  folder.</p>
<p>  You can download pexports at:</p>
<p>http://www.emmestech.com/software/cygwin/pexports-043/download_pexports.html</p>
<p>  If you don&#8217;t have that libQtCore4.a you won&#8217;t be able to build PyQt.</p>
<p>  So you&#8217;ll need to do this, go to your Qt bin folder, say:<br />
  c:\Qt\4.2.2\bin</p>
<p>  And run this:</p>
<p>  pexports QtCore4.dll > Qt4Core4.def<br />
  dlltool -dllname QtCore4.dll &#8211;def QtCore4.def &#8211;output-lib libQtCore4.a</p>
<p>  Move the resulting file, libQtCore4.a, to c:\Qt\4.2.2\lib</p>
<p>COMPILING SIP:<br />
- PyQt needs &#8220;sip&#8221; to be able to bind the Qt libraries, sip will generate the necessary C++ code.<br />
To install sip, get its source code, extract it to a folder say:</p>
<p>  c:\sip-4.5.2</p>
<p>  Once inside run it&#8217;s configure.py like this:</p>
<p>  python configure.py -p win32-g++</p>
<p>  That will create the Makefiles, then you will make it using</p>
<p>  mingw32-make</p>
<p>  and</p>
<p>  mingw32-make install</p>
<p>  Now, I&#8217;m not sure what&#8217;s the environment variable of Mingw library path,<br />
and I was having errors from the compilation of PyQt, telling me it couldn&#8217;t<br />
find the sip libraries, so this is what I did:</p>
<p>   &#8211; Copy all the .o files from c:\sip-4.5.2\siplib to c:\mingw\lib<br />
   &#8211; Copy all the .h files from c:\sip-4.5.2\siplib to c:\mingw\includes</p>
<p>- Now it&#8217;s finally time to compile PyQt.<br />
Uncompress the PyQt zip with the source (not the binary, if not we wouldn&#8217;t be doing this),<br />
do it at the root of your hardrive (C:\), you&#8217;ll end up with a folder named similar to this:</p>
<p>c:\PyQt-win-gpl-4.1.1</p>
<p>Go in there and do this:<br />
  python configure.py<br />
  mingw32-make   (this will take a long time, it will wrap every Qt C++ library on a new .cpp file which will be then compiled to exist as a python binding)<br />
  mingw32-make install</p>
<p>If you have any errors write me a comment on this post</p>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://twitter.com/home?status=How+to+build+PyQt4+for+Windows+http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F&amp;title=How+to+build+PyQt4+for+Windows"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F&amp;title=How+to+build+PyQt4+for+Windows"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F&amp;title=How+to+build+PyQt4+for+Windows"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F&amp;headline=How+to+build+PyQt4+for+Windows"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=How+to+build+PyQt4+for+Windows&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=How+to+build+PyQt4+for+Windows&amp;u=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=How+to+build+PyQt4+for+Windows&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=How+to+build+PyQt4+for+Windows&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=How+to+build+PyQt4+for+Windows&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F&amp;title=How+to+build+PyQt4+for+Windows&amp;summary=&amp;source="><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/reader/link?url=http%3A%2F%2Fwww.gubatron.com%2Fblog%2F2007%2F02%2F23%2Fhow-to-build-pyqt4-for-windows%2F&amp;title=How+to+build+PyQt4+for+Windows"><img class="lightsocial_img" src="http://www.gubatron.com/blog/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.gubatron.com/blog/2007/02/23/how-to-build-pyqt4-for-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->