<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7298146498063387324</id><updated>2011-08-03T04:30:55.618+02:00</updated><category term='ruby'/><category term='data recovery'/><category term='cms tools'/><category term='javascript'/><category term='expression engine'/><category term='scripteka'/><category term='rsync'/><category term='attr_hidden'/><category term='dvd43'/><category term='video lectures'/><category term='ftp clients'/><category term='scite'/><category term='algorithms'/><category term='rails on oracle'/><category term='personal settings'/><category term='rails plugins'/><category term='linux basics'/><category term='timms'/><category term='applications'/><category term='windows software'/><category term='tcsh'/><category term='GUI programming'/><category term='symbolic links'/><category term='git'/><category term='online lectures'/><category term='shell'/><category term='linux software'/><category term='active record'/><category term='linux compact guides'/><category term='image conversion'/><category term='connection to remote servers'/><category term='rails'/><category term='C basics'/><category term='grep'/><category term='windows alpha blender'/><category term='image editing'/><category term='synctoy'/><category term='script'/><category term='gimp'/><category term='mutimedia software'/><category term='unlocker'/><category term='inkscape'/><category term='polymorphic associations'/><category term='rake'/><category term='backup'/><category term='ruby blocks'/><category term='virtualbox'/><category term='handbrake'/><category term='vi'/><category term='php'/><category term='xslt xml'/><category term='color the shell'/><category term='sort_by :sql'/><category term='photo manipulation'/><category term='apt'/><category term='putty'/><category term='ssh'/><category term='endline chars'/><category term='color picker'/><category term='bash'/><category term='oracle lob'/><category term='common errors'/><category term='MIT'/><category term='oracle'/><category term='vlc media player'/><category term='suffix array'/><category term='rake tasks'/><category term='winscp'/><category term='java software'/><category term='data structures'/><category term='sql'/><category term='cooltips'/><category term='scanf'/><category term='software installed on my laptop'/><category term='top open source projects'/><category term='jdiskreport'/><category term='rails migrations'/><category term='vector graphics'/><category term='hard disk failure'/><category term='active scaffold'/><category term='capistrano'/><category term='less'/><category term='ls'/><category term='disk analysis'/><category term='sftp clients'/><category term='prototype'/><category term='shell rc file'/><title type='text'>...looks interesting... !</title><subtitle type='html'>This are my notes in the fields of computer science and technology.

Everything is written with ABSOLUTE NO WARRANTY of fitness for any purpose. Of course, feel free to comment anything.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>52</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-404091825512332951</id><published>2010-08-12T12:52:00.003+02:00</published><updated>2010-08-12T12:54:39.093+02:00</updated><title type='text'>Install Flash Player without admin rights on Windows</title><content type='html'>Follow this &lt;a href="http://www.varesano.net/blog/fabio/installing%20flash%20player%20plugin%20firefox%20without%20having%20administrator%20access%20or%20premissions"&gt;blog entry&lt;/a&gt;. It worked on Windows XP in a VMware machine under Linux.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-404091825512332951?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/404091825512332951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=404091825512332951' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/404091825512332951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/404091825512332951'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2010/08/install-flash-player-without-admin.html' title='Install Flash Player without admin rights on Windows'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-4152352178000579347</id><published>2010-07-06T23:59:00.003+02:00</published><updated>2010-07-06T23:59:00.255+02:00</updated><title type='text'>Space usage profiling: massif</title><content type='html'>massif is a valgrind tool, that can be used to profile the space usage of a program:&lt;br /&gt;&lt;br /&gt;valgrind --tool=massif ./myprogram&lt;br /&gt;&lt;br /&gt;The result is a massiv.out.&lt;nnnn&gt; file. The most important information in it can be visualized using e.g. ms_print:&lt;br /&gt;&lt;br /&gt;ms_print massif.out.0000 | less&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-4152352178000579347?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/4152352178000579347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=4152352178000579347' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/4152352178000579347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/4152352178000579347'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2010/07/space-usage-profiling-massif.html' title='Space usage profiling: massif'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6081743338047980806</id><published>2010-01-01T11:08:00.000+01:00</published><updated>2010-01-01T11:09:16.340+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apt'/><category scheme='http://www.blogger.com/atom/ns#' term='linux basics'/><title type='text'>Install kernel headers in linux using aptitude</title><content type='html'>&lt;pre&gt;sudo aptitude install linux-kernel-headers linux-headers-`uname -r`&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6081743338047980806?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6081743338047980806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6081743338047980806' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6081743338047980806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6081743338047980806'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2010/01/install-kernel-headers-in-linux-using.html' title='Install kernel headers in linux using aptitude'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-7568971412793713827</id><published>2009-12-31T09:40:00.001+01:00</published><updated>2009-12-31T09:43:27.640+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='shell rc file'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='tcsh'/><title type='text'>ssh autocompletion in tcsh</title><content type='html'>I wrote the following for my .tcshrc to get some autocompletion for ssh. &lt;br /&gt;&lt;pre&gt;set hostlist=(`cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | cut -f 1 -d ',' | uniq`)&lt;br /&gt;complete ssh 'p/1/$hostlist/' 'p/2/c/'&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-7568971412793713827?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/7568971412793713827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=7568971412793713827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7568971412793713827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7568971412793713827'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/12/ssh-autocompletion-in-tcsh.html' title='ssh autocompletion in tcsh'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6472864808379472574</id><published>2009-12-12T14:57:00.002+01:00</published><updated>2009-12-12T15:02:34.898+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='disk analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='hard disk failure'/><category scheme='http://www.blogger.com/atom/ns#' term='data recovery'/><title type='text'>TestDisk</title><content type='html'>Hard disk failure recovery tool; tries to repair partition tables, boot sectors, MBR; allows to read and copy files from lost partitions; an undelete feature is also included.&lt;br /&gt;&lt;br /&gt;Homepage: http://www.cgsecurity.org/wiki/TestDisk&lt;br /&gt;Developer: Christophe Grenier&lt;br /&gt;Version: 6.11 (April 19, 2009)&lt;br /&gt;License: open source free software&lt;br /&gt;Platform: Linux/Windows/Mac&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6472864808379472574?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6472864808379472574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6472864808379472574' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6472864808379472574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6472864808379472574'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/12/testdisk.html' title='TestDisk'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-2731276757113020960</id><published>2009-12-11T01:28:00.002+01:00</published><updated>2009-12-11T01:34:25.392+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='inkscape'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='vector graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><title type='text'>Inkscape</title><content type='html'>Vector graphics program, similar to commercial packages like Adobe Illustrator, with advanced editing features and importing/exporting in a lot of different formats (e.g. PDF). The native format is the open format SGV.&lt;br /&gt;&lt;br /&gt;Homepage: http://www.inkscape.org/&lt;br /&gt;Developer: The Inkscape Team&lt;br /&gt;Version: 0.47 (November 21, 2009)&lt;br /&gt;License: open source free software&lt;br /&gt;Platform: Linux/Windows/Mac&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-2731276757113020960?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/2731276757113020960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=2731276757113020960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2731276757113020960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2731276757113020960'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/12/inkscape.html' title='Inkscape'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-1739814034275301187</id><published>2009-10-11T17:03:00.010+02:00</published><updated>2009-10-11T18:00:46.353+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='connection to remote servers'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='shell rc file'/><title type='text'>Starting ssh-agent from .tcshrc</title><content type='html'>While connecting to a server using SSH, you need either to provide a password or to use a public-private key pair to identify yourself. The latter is interesting, as you don't have to write your password each time. A copy of the public key must be saved in the computer acting as ssh server under ".ssh/authorized_keys", the private key stays only on the client computer.&lt;br /&gt;&lt;br /&gt;However for security reasons it is strongly reccomended to set a password on the key file. Otherwise anyone who can steal your key somehow (like accessing your computer physically), can steal your identity. But if your key file has a password, then you would have to write the password each time, so it wouldn't be much better than using passwords instead of keys in the first time. Luckily there is a solution: ssh-agent and ssh-add. ssh-agent runs as a deamon and remembers the password to your key. ssh-add allows you to tell ssh-agent the password.&lt;br /&gt;&lt;br /&gt;As ssh-agent keep running when you log off your session, you may add some lines to  your shell startup script, to test if ssh-agent is running, otherwise to start it and ask you the password (via ssh-add). In the github guides there is a script for bash (&lt;a href="http://help.github.com/working-with-key-passphrases/"&gt;&lt;/a&gt;). I adapted it to use it in tcsh, which I use as a shell. Here is it (I added these lines at the bottom of my .tcshrc file, only *before* setting the prompt explicitely, as I used it to distinguish interactive sessions from non-interactive ones):&lt;br /&gt;&lt;br /&gt;&lt;pre  style="background: black; color:white;"&gt;&lt;span style="color:#8080ff;"&gt;# start ssh agent if not started yet&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;set&lt;/span&gt; SSH_ENV = &lt;span style="color:#ff6060;"&gt;"&lt;/span&gt;&lt;span style="color:#00ff00;"&gt;$&lt;/span&gt;&lt;span style="color:#ff40ff;"&gt;HOME&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;/.ssh/environment"&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;unset&lt;/span&gt; SSH_AGENT_RUNNING&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;if&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;(&lt;/span&gt;&lt;span style="color:#ffff00;"&gt;-&lt;/span&gt;f &lt;span style="color:#00ff00;"&gt;$SSH_ENV&lt;/span&gt;&lt;span style="color:#ffff00;"&gt;) then&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;  source&lt;/span&gt; &lt;span style="color:#00ff00;"&gt;$SSH_ENV&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;  ps&lt;/span&gt; &lt;span style="color:#00ff00;"&gt;$SSH_AGENT_PID&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;&amp;gt;&lt;/span&gt; /dev/null &lt;span style="color:#ffff00;"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;set&lt;/span&gt; SSH_AGENT_RUNNING&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;endif&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;if&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;(&lt;/span&gt;&lt;span style="color:#00ff00;"&gt;$?&lt;span style="color:#ff40ff;"&gt;prompt&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;&amp;amp;&amp;amp; ! &lt;/span&gt;$?SSH_AGENT_RUNNING&lt;/span&gt;&lt;span style="color:#ffff00;"&gt;) then&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;  echo&lt;/span&gt; &lt;span style="color:#ff6060;"&gt;"Initializing SSH agent..."&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;  /usr/bin/ssh-agent&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;|&lt;/span&gt; &lt;span style="color:#00ffff;"&gt;sed&lt;/span&gt; &lt;span style="color:#ff6060;"&gt;'s/^echo/#echo/'&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;&amp;gt;!&lt;/span&gt; &lt;span style="color:#00ff00;"&gt;$SSH_ENV&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;  chmod&lt;/span&gt; 600 &lt;span style="color:#00ff00;"&gt;$SSH_ENV&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;  source&lt;/span&gt; &lt;span style="color:#00ff00;"&gt;$SSH_ENV&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;  echo&lt;/span&gt; &lt;span style="color:#ff6060;"&gt;"done: ssh-agent is now running, PID &lt;/span&gt;&lt;span style="color:#00ff00;"&gt;$SSH_AGENT_PID&lt;/span&gt;&lt;span style="color:#ff6060;"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;  /usr/bin/ssh-add&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;endif&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-1739814034275301187?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/1739814034275301187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=1739814034275301187' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1739814034275301187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1739814034275301187'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/10/automatizing-ssh-agent-in-tcshrc.html' title='Starting ssh-agent from .tcshrc'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-9075279511646380156</id><published>2009-09-13T20:22:00.013+02:00</published><updated>2009-09-16T14:10:25.181+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='virtualbox'/><title type='text'>My virtual linux server</title><content type='html'>&lt;div&gt;In the windows installation on my laptop, I also run a linux server in background. Here is how I setup my virtual linux server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As a virtualization software I installed Sun VirtualBox. I created a virtual machine. I gave it a little less than the half of my memory and turned on support for AMD-V extensions (as I did also in my host machine BIOS). As HD controller I selected SATA (the default is IDE). For networking I use the NAT configuration. I forwarded the SSH port as described in the virtual box manual (backlinux is the name of my virtual machine):&lt;/div&gt;&lt;pre class="screen"&gt;VBoxManage setextradata "backlinux" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP&lt;br /&gt;VBoxManage setextradata "backlinux" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22&lt;br /&gt;VBoxManage setextradata "backlinux" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222&lt;/pre&gt;Then I followed the suggestion of &lt;a href="http://sebastian-bauer.ws/en/2008/11/06/windows-run-virtualbox-in-the-background.html"&gt;Sebastian Bauer's blog&lt;/a&gt;: I installed the ntwind software's hidden start tool (&lt;a href="http://www.ntwind.com/software/utilities/hstart.html"&gt;homepage&lt;/a&gt;) and created two one-liner batch files that I use to start and stop the virtual machine. There are also more sofisticated approaches to run the machine as a windows service, however I found this very simple and I chose it for this reason.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the start.bat file: (paths are specific to my machine)&lt;/div&gt;&lt;div&gt;&lt;pre&gt;"c:\Program Files\standalone\hstart\hstart" /NOCONSOLE ""c:\Program Files\Sun\VirtualBox\vboxheadless" -s backlinux -vrdp off"&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;while the stop.bat file contains:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;"c:\Program Files\Sun\VirtualBox\VBoxManage.exe" controlvm backlinux savestate&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;I created two hard disk images for the machine, called backlinux.vdi and backlinux.home.vdi. I set both to dynamical 8 Gb. I later attached backlinux.home to /home. I keep /home on a separate disk, so that I can make use of the snapshots feature of Virtualbox, without loosing the data in /home. To do this I changed the type of backlinux.home.vdi to write-through using: &lt;/div&gt;&lt;pre&gt;"c:\Program Files\Sun\VirtualBox\VBoxManage.exe" modifyhd backlinux.home.vdi --type writethrough&lt;/pre&gt;&lt;div&gt;Then I installed ubuntu-server (jaunty, i.e. 9.04) with the option "minimal virtual machine" (press F4 by the installation) and I added some software packages I need/like using aptitude (for example: libncurses-dev, libcairo2-dev, ruby1.9, git-core, gitk ... and relative dependences). The machine has no x-server installed, but I have an X server installed under Windows (Xming), so I can start also graphical software using X-forwarding.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To allow the virtual machine to access the host disk (C:), I installed the VBoxLinuxGuestAdditions from the shell script in the virtual CD image (.iso) provided with virtual box (you need to install linux-headers package for your kernel for that). Then I created a shared folder "c" using the virtual box gui. In Linux then I mounted the folder, creating a /C folder, adding this line to /etc/fstab:&lt;/div&gt;&lt;pre&gt;c    /C    vboxsf&lt;/pre&gt;As last step, I created two icons starting from &lt;a href="http://commons.wikimedia.org/wiki/File:NewTux.svg"&gt;NewTux.svg&lt;/a&gt; of Wikimedia Commons (author: Larry Ewing). I resized it to a 48px square and overlayed a green triangle (start icon) and a red square (stop icon). I created then links to my batch files to my desktop and assigned the icons to the links.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Here is the result: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://3.bp.blogspot.com/_n5V047VKsgs/SrCkiQ7L-CI/AAAAAAAAABo/JzAYPPVlk38/s200/backlinux_start.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5381982463273465890" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 48px; height: 48px; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#0000EE;"&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#0000EE;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_n5V047VKsgs/SrCkuJQ6AGI/AAAAAAAAABw/DUE8hhdYEoM/s1600-h/backlinux_stop.png"&gt;&lt;img src="http://1.bp.blogspot.com/_n5V047VKsgs/SrCkuJQ6AGI/AAAAAAAAABw/DUE8hhdYEoM/s200/backlinux_stop.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5381982667375509602" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 48px; height: 48px; " /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-9075279511646380156?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/9075279511646380156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=9075279511646380156' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/9075279511646380156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/9075279511646380156'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/my-virtual-linux-server.html' title='My virtual linux server'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_n5V047VKsgs/SrCkiQ7L-CI/AAAAAAAAABo/JzAYPPVlk38/s72-c/backlinux_start.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-7713503622776274175</id><published>2009-09-13T18:54:00.005+02:00</published><updated>2009-09-16T11:13:53.624+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='virtualbox'/><title type='text'>VirtualBox</title><content type='html'>There are several available platform virtual machines available. I generally use the Sun VirtualBox. I usually run a Linux server in my Windows-running laptop, using a virtual hard disk for it and accessing it with PuTTY and WinSCP.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;VirtualBox is able to run a virtual machine also without an output terminal/window (headless). I use this for my Linux server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Another possibility it offers is to run a machine booting from a real partition instead of a virtual hard disk. However this makes things quite difficult and is an experimental feature. The hardware found by the operating system will be different in a virtual box and booting as host, so this will lead to several problems. For example I was unable to run a deployed Vista from Linux and I could only run a deployed Ubuntu in Windows with command line interface.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://www.virtualbox.org/"&gt;http://www.virtualbox.org/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Developer: Sun&lt;/div&gt;&lt;div&gt;Version: 3.0.6 (September 9, 2009)&lt;/div&gt;&lt;div&gt;Platform: Cross-platform&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-7713503622776274175?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/7713503622776274175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=7713503622776274175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7713503622776274175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7713503622776274175'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/virtualbox.html' title='VirtualBox'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-3248639548039912955</id><published>2009-09-13T17:39:00.007+02:00</published><updated>2009-09-16T11:13:30.153+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='connection to remote servers'/><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='putty'/><title type='text'>PuTTY</title><content type='html'>A terminal emulator using ssh or telnet connections to remote servers. I always use this for ssh connections from a Windows machine to a Linux machine (usually using WinSCP for file exchanges) - including my virtual linux server I run in background.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In Windows the program settings (including the saved sessions) are stored in the registry at the position: Computer\HKEY_CURRENT_USER\Software\SimonTatham\PuTTY .&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;http://www.chiark.greenend.org.uk/~sgtatham/putty/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Developer: Simon Thatam&lt;/div&gt;&lt;div&gt;Version: 0.60 (April 29, 2007)&lt;/div&gt;&lt;div&gt;&lt;div&gt;Platform: cross-platform&lt;/div&gt;&lt;div&gt;License: open source&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-3248639548039912955?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/3248639548039912955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=3248639548039912955' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3248639548039912955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3248639548039912955'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/putty.html' title='PuTTY'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6762732719005279470</id><published>2009-09-12T19:35:00.004+02:00</published><updated>2009-09-16T11:12:49.722+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='dvd43'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='mutimedia software'/><title type='text'>DVD43</title><content type='html'>In order to rip/transcode DVD you own, for example to see the videos on your mobile device, this tool may be useful. It circumvents copy protection and zone settings. It may be illegal under certain circumstances and jurisdictions, however the tool itself is probably legal, if you don't engage in llegal activities with it. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://www.dvd43.com/"&gt;http://www.dvd43.com/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Developer: unknown, maybe for legal reasons (?) [&lt;a href="http://whois.domaintools.com/dvd43.com"&gt;whois information&lt;/a&gt;]&lt;/div&gt;&lt;div&gt;Version: 4.4.1 (June 29, 2009)&lt;/div&gt;&lt;div&gt;License: closed source freeware&lt;/div&gt;&lt;div&gt;Platform: Windows&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6762732719005279470?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6762732719005279470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6762732719005279470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6762732719005279470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6762732719005279470'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/dvd43_12.html' title='DVD43'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-3090664772824660293</id><published>2009-09-12T19:25:00.005+02:00</published><updated>2009-09-12T19:40:48.635+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='handbrake'/><category scheme='http://www.blogger.com/atom/ns#' term='mutimedia software'/><title type='text'>HandBrake</title><content type='html'>This software comes in hand, when you want to upload videos to a mobile phone or media player. It allows to transcode easily to mp4 format with a good control of options, encoder to use, resizing...&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is my settings file (user_presets.xml), which I use to convert files to display them in my phone:&lt;/div&gt;&lt;pre&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br /&gt;&amp;lt;ArrayOfPreset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;&lt;br /&gt;&amp;lt;Preset&amp;gt;&lt;br /&gt;  &amp;lt;Level&amp;gt;0&amp;lt;/Level&amp;gt;&lt;br /&gt;  &amp;lt;Name&amp;gt;Mobile phone&amp;lt;/Name&amp;gt;&lt;br /&gt;  &amp;lt;Query&amp;gt; -f mp4 -w 400 -e ffmpeg -q 0.5 -a 1 -E faac -B 160 -R 0 -6 stereo -D 1 -m -v &amp;lt;/Query&amp;gt;&lt;br /&gt;&amp;lt;/Preset&amp;gt;&lt;br /&gt;&amp;lt;/ArrayOfPreset&amp;gt;&lt;/pre&gt;My settings are: ffmpeg encoding, mp4 container format, aac stereo sound, 50% constant quality, resize to 400px width. Note that to be able to create a preset under Vista you need to start the application with administrative rights.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://handbrake.fr/"&gt;http://handbrake.fr/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Platform: cross-platform&lt;/div&gt;&lt;div&gt;Version: 0.9.3 (Nov 23, 2008)&lt;/div&gt;&lt;div&gt;License: open source freeware&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-3090664772824660293?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/3090664772824660293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=3090664772824660293' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3090664772824660293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3090664772824660293'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/handbrake_12.html' title='HandBrake'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-7425725610691533060</id><published>2009-09-12T19:08:00.007+02:00</published><updated>2009-09-12T19:49:34.944+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vlc media player'/><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='top open source projects'/><category scheme='http://www.blogger.com/atom/ns#' term='mutimedia software'/><title type='text'>VLC media player</title><content type='html'>This media player allows to reproduce a wide spectrum of media files. It is extremely flexible and has a lot of advanced features, probably more than any other media player. The graphical interface (which is one of the different interfaces it has) is nevertheless very simple and lightweight.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can select the GUI language using Ctrl+P and changing the first option in the dialog.&lt;br /&gt;&lt;br /&gt;Homepage: &lt;a href="http://www.videolan.org/vlc/"&gt;http://www.videolan.org/vlc/&lt;/a&gt;&lt;br /&gt;Developer: VideoLAN project&lt;br /&gt;Version: 1.0.1 (July 27, 2009)&lt;br /&gt;Platform: cross-platform&lt;br /&gt;License: freeware, open source&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-7425725610691533060?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/7425725610691533060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=7425725610691533060' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7425725610691533060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7425725610691533060'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/vlc-media-player.html' title='VLC media player'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-3787067949519447304</id><published>2009-09-12T18:59:00.005+02:00</published><updated>2009-09-12T19:03:22.415+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='synctoy'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><title type='text'>SyncToy</title><content type='html'>As a simple backup strategy under Windows, I synchronize my important folders with a copy on an external drive. To do that I am using SyncToy, a free-to-download tool from Microsoft.&lt;br /&gt;&lt;br /&gt;Download link: &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=C26EFA36-98E0-4EE9-A7C5-98D0592D8C52&amp;displaylang=en"&gt;http://www.microsoft.com/downloads/[...]&lt;/a&gt;&lt;br /&gt;Developer: Microsoft&lt;br /&gt;Version: 2.0 (August 15, 2008)&lt;br /&gt;Platform: Windows&lt;br /&gt;License: freeware, closed source&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-3787067949519447304?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/3787067949519447304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=3787067949519447304' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3787067949519447304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3787067949519447304'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/synctoy.html' title='SyncToy'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6603794539367189827</id><published>2009-09-12T18:44:00.006+02:00</published><updated>2009-09-13T19:16:41.400+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='windows alpha blender'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><title type='text'>Windows Alpha Blender</title><content type='html'>This tool allows to set the tranparency of a windows using a shortcut to increase (default: Ctrl+F11; my setting: Ctrl+&lt;) or decrease (default: Ctrl+F12; my setting: Ctrl+Shift+&lt;) the alpha transparency value of the currently active window. It is not very sofisticated, but it can be useful sometimes.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Personal settings (ie the keyboard shortcuts) are kept in the registry.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://www.vaultmate.com/freewaregifts.php"&gt;http://www.vaultmate.com/freewaregifts.php&lt;/a&gt;&lt;br /&gt;Developer: VaultMate Software&lt;br /&gt;Version: 1.2 (June 7, 2008)&lt;br /&gt;License: freeware, closed source&lt;br /&gt;Platform: Windows&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6603794539367189827?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6603794539367189827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6603794539367189827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6603794539367189827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6603794539367189827'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/windows-alpha-blender.html' title='Windows Alpha Blender'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-7531993242378516224</id><published>2009-09-12T17:16:00.003+02:00</published><updated>2009-09-12T17:19:09.226+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='grep'/><category scheme='http://www.blogger.com/atom/ns#' term='shell rc file'/><category scheme='http://www.blogger.com/atom/ns#' term='color the shell'/><title type='text'>Colors in grep</title><content type='html'>To turn on colors in grep, you may add --color=auto to the GREP_OPTIONS environment variable. The way to do it is of course shell-dependant. E.g. add the following to your shell rc file:&lt;br /&gt;&lt;pre&gt;export GREP_OPTIONS='--color=auto'&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-7531993242378516224?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/7531993242378516224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=7531993242378516224' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7531993242378516224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7531993242378516224'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/colors-in-grep.html' title='Colors in grep'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-2245058762050656819</id><published>2009-09-12T16:30:00.003+02:00</published><updated>2009-09-12T16:42:19.821+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='unlocker'/><title type='text'>Unlocker</title><content type='html'>This tool allows to identify the process, which is currently locking a given file or directory and if desidered to force unlocking of the file from one or all processes. It works as a shell extension in explorer. Note that under Vista the program requires a confirmation to be allowed to access a file (if the UAC system is on).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://ccollomb.free.fr/unlocker/"&gt;http://ccollomb.free.fr/unlocker/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://ccollomb.free.fr/unlocker/"&gt;&lt;/a&gt;Developer: Cedrick Collomb&lt;/div&gt;&lt;div&gt;Version: 1.8.7 (May 1st, 2008)&lt;/div&gt;&lt;div&gt;Platform: Windows&lt;/div&gt;&lt;div&gt;License: freeware, closed source&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-2245058762050656819?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/2245058762050656819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=2245058762050656819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2245058762050656819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2245058762050656819'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/unlocker.html' title='Unlocker'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-8114453835234523738</id><published>2009-09-12T12:20:00.010+02:00</published><updated>2009-09-12T16:29:09.728+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ftp clients'/><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='connection to remote servers'/><category scheme='http://www.blogger.com/atom/ns#' term='sftp clients'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='winscp'/><title type='text'>WinSCP</title><content type='html'>WinSCP is the perfect windows tool to connect to remote servers and exchange (download/upload) files or edit them. It is a SFTP and FTP client. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is a standalone version and an installer based setup; if using the latter, beware that it will ask you install additional software using the &lt;a href="http://en.wikipedia.org/wiki/OpenCandy"&gt;OpenCandy&lt;/a&gt; system. However at least the default is not to install any additional software.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I like to store the preferences in ini file instead of the registry, so that I can export them easily to other computers. To turn on the ini preferences storage: in WinSCP login dialog select "preferences", then "Other general options: Preferences", "Storage" and change the "configuration storage" value to "INI file". The default location of the ini file under Windows Vista will be: "C:\Users\&lt;username&gt;\AppData\Local\VirtualStore\Program Files\WinSCP". Under older Windows version it will be directly in the application directory (C:\program files\WinSCP).&lt;/username&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://winscp.net/"&gt;http://winscp.net/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Documentation: &lt;a href="http://winscp.net/eng/docs/guides"&gt;http://winscp.net/eng/docs/guides&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Version: 4.2.3 beta (August 18, 2009)&lt;/div&gt;&lt;div&gt;Platform: Windows&lt;/div&gt;&lt;div&gt;License: freeware&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-8114453835234523738?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/8114453835234523738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=8114453835234523738' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/8114453835234523738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/8114453835234523738'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/winscp.html' title='WinSCP'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6277575394906081799</id><published>2009-09-12T10:55:00.008+02:00</published><updated>2009-09-12T16:25:53.510+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='shell rc file'/><category scheme='http://www.blogger.com/atom/ns#' term='color the shell'/><category scheme='http://www.blogger.com/atom/ns#' term='ls'/><title type='text'>ls colors</title><content type='html'>&lt;div&gt;add an alias to your shell rc file:&lt;/div&gt;&lt;pre&gt;alias ls "ls --color=auto"&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6277575394906081799?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6277575394906081799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6277575394906081799' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6277575394906081799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6277575394906081799'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/ls-colors.html' title='ls colors'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-3353622597721744200</id><published>2009-09-11T18:34:00.013+02:00</published><updated>2009-09-12T19:23:02.880+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gimp'/><category scheme='http://www.blogger.com/atom/ns#' term='image editing'/><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='image conversion'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='top open source projects'/><category scheme='http://www.blogger.com/atom/ns#' term='photo manipulation'/><title type='text'>Gimp</title><content type='html'>&lt;div&gt;Gimp is great if you cannot afford on do not want to pay a lot of money for professional software (i.e. Photoshop). According to some it *is* a professional level software, according to other not yet; however it has more than enough features for amateur photo manipulation and other image related tasks (e.g. icon editing, image conversion, resizing etc). The first version was realeased in 1996 by two computer science students (Kimball and Mattis, currently Google engineers).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is quite complicated to use and probably extreme complicated to master, however it is intuitive enough for simple tasks. Since version 2.6 they invested in an effort to make the interface easier to use (see &lt;a href="http://en.wikipedia.org/wiki/GIMP"&gt;Wikipedia article&lt;/a&gt;). An &lt;a href="http://docs.gimp.org/"&gt;user manual and documentation page&lt;/a&gt; is also available.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;If you want a different language than your operating system, here is the &lt;a href="http://docs.gimp.org/en/gimp-fire-up.html#gimp-concepts-running-language"&gt;howto&lt;/a&gt;. In my Vista laptop I wanted the english version, so I did the following: I created a .bat file in C:/users/program files/GIMP2.0/bin (you need admin privileges to write it there) with the following content:&lt;pre&gt;set lang=en&lt;br /&gt;start gimp-2.6.exe&lt;br /&gt;&lt;/pre&gt;Then I changed the startmenu entry to point to the bat file instead of the exe file (other settings: execute minimized, use icon of the .exe file).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Name: Gimp&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://www.gimp.org/"&gt;http://www.gimp.org/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Version: 2.6.7 (August 14, 2009)&lt;/div&gt;&lt;div&gt;License: free, open-source software&lt;/div&gt;&lt;div&gt;&lt;div&gt;Platform: cross-platform&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-3353622597721744200?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/3353622597721744200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=3353622597721744200' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3353622597721744200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3353622597721744200'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/gimp-in-another-language.html' title='Gimp'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-161423141711529584</id><published>2009-09-11T17:51:00.014+02:00</published><updated>2009-09-12T16:43:34.518+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java software'/><category scheme='http://www.blogger.com/atom/ns#' term='jdiskreport'/><category scheme='http://www.blogger.com/atom/ns#' term='windows software'/><category scheme='http://www.blogger.com/atom/ns#' term='disk analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='software installed on my laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='applications'/><title type='text'>JDiskReport</title><content type='html'>There are for sure a lot of disk space analysis tools, but I liked this German Java application a lot: &lt;a href="http://www.jgoodies.com/freeware/jdiskreport/"&gt;JDiskReport&lt;/a&gt;. It is relatively fast and displays a lot of additional information. The space usage or number of files information can be grouped by location on the file system, but also by file size, modification time or file extension. All information can be displayed as pie chart, histogram or detailed list.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Name: JDiskReport&lt;/div&gt;&lt;div&gt;Developer: Karsten Lentzsch (JGoodies, &lt;a href="http://www.jgoodies.com/"&gt;www.jgoodies.com&lt;/a&gt;)&lt;/div&gt;&lt;div&gt;Homepage: &lt;a href="http://www.jgoodies.com/freeware/jdiskreport/index.html"&gt;http://www.jgoodies.com/freeware/jdiskreport/index.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Current version: 1.3.1 (July 30, 2008)&lt;/div&gt;&lt;div&gt;License: freeware, partially closed source; open source release planned [&lt;a href="http://www.jgoodies.com/freeware/jdiskreport/faq.html"&gt;see here&lt;/a&gt;]&lt;/div&gt;&lt;div&gt;Platform: cross-platform&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-161423141711529584?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/161423141711529584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=161423141711529584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/161423141711529584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/161423141711529584'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/09/jdiskreport.html' title='JDiskReport'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-273425972097835926</id><published>2009-08-11T12:27:00.011+02:00</published><updated>2009-08-11T12:45:29.351+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><title type='text'>git: write a single commit to file</title><content type='html'>Write the commit to file:&lt;pre style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;git diff-tree &amp;lt;commit&amp;gt; -p --pretty &amp;gt; &amp;lt;filename&amp;gt;&lt;/pre&gt;You can also use &lt;em&gt;git format-patch&lt;/em&gt;, but that is more specialized for patches to be submitted by email.&lt;br /&gt;&lt;br /&gt;Apply the commit from the file:&lt;pre style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;git apply &amp;lt;filename&amp;gt;&lt;br /&gt;&lt;/pre&gt;Here is an excerpt from the &lt;em&gt;git diff-tree&lt;/em&gt; manual page:&lt;br /&gt;&lt;pre&gt;When "git-diff-index", "git-diff-tree", or "git-diff-files"&lt;br /&gt;are run with a -p option, "git diff" without the --raw option,&lt;br /&gt;or "git log" with the "-p" option, they do not produce the output&lt;br /&gt;described above; instead they produce a patch file. You can&lt;br /&gt;customize the creation of such patches via the GIT_EXTERNAL_DIFF&lt;br /&gt;and the GIT_DIFF_OPTS environment variables&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-273425972097835926?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/273425972097835926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=273425972097835926' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/273425972097835926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/273425972097835926'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/08/git-write-single-commit-to-file.html' title='git: write a single commit to file'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-2042806605303561733</id><published>2009-08-10T10:28:00.009+02:00</published><updated>2009-09-12T11:10:54.979+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='scite'/><title type='text'>Scite: add a vertical line at column 80</title><content type='html'>A tip for the &lt;a href="http://www.scintilla.org/SciTE.html"&gt;SciTE editor&lt;/a&gt;: this is interesting if you want your code to be easy to print and display without horizontal scrolling.&lt;br /&gt;&lt;br /&gt;Add the following to the global or user properties file:&lt;br /&gt;&lt;pre style="background: black none repeat scroll 0% 50%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;edge.column=80&lt;br /&gt;edge.mode=1&lt;br /&gt;edge.colour=#C0DCC0&lt;br /&gt;&lt;/pre&gt;This is an excerpt of the SciTE documentation for the edge property:&lt;br /&gt;&lt;pre&gt;Indicates long lines. The default edge.mode, 0, does not&lt;br /&gt;indicate long lines. An edge.mode of 1 uses a vertical&lt;br /&gt;line to indicate the specified column and an edge.mode&lt;br /&gt;of 2 changes the background colour of characters beyond&lt;br /&gt;that column. For proportional fonts, an edge.mode of 2&lt;br /&gt;is more useful than 1.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-2042806605303561733?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/2042806605303561733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=2042806605303561733' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2042806605303561733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2042806605303561733'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/08/scite-add-vertical-line-at-column-80.html' title='Scite: add a vertical line at column 80'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-3719575082057921473</id><published>2009-08-09T15:46:00.011+02:00</published><updated>2009-09-12T10:41:59.017+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux compact guides'/><category scheme='http://www.blogger.com/atom/ns#' term='less'/><title type='text'>Compact guide to less commands</title><content type='html'>&lt;h4&gt;Movement&lt;/h4&gt;Arrows, page up/down, home/end keys all work as expected. In addition the following are sometimes useful:&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;d/u&lt;/td&gt;&lt;td&gt;Move half page forward / backward&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;20g&lt;/td&gt;&lt;td&gt;Move to line 20&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;20%&lt;/td&gt;&lt;td&gt;Move to the 20% point&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;ma/'a&lt;/td&gt;&lt;td&gt;set markpoint "a" / move to markpoint "a"&lt;br /&gt;(also instead of "a" any other lowcase letter)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h4&gt;Search&lt;/h4&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;/pattern&lt;/td&gt;&lt;td&gt;search pattern forward&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;?pattern&lt;/td&gt;&lt;td&gt;search pattern backward&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;n&lt;/td&gt;&lt;td&gt;next match&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;N&lt;/td&gt;&lt;td&gt;previous match&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;/!pattern&lt;/td&gt;&lt;td&gt;search non-matching line&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Esc-u&lt;/td&gt;&lt;td&gt;turn match highlighting on/off&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h4&gt;Misc &lt;/h4&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;=&lt;/td&gt;&lt;td&gt;show info about the file and current position&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;! command&lt;/td&gt;&lt;td&gt;execute command and show its output&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;s filename&lt;/td&gt;&lt;td&gt;save to file (if the input was a pipe)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-3719575082057921473?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/3719575082057921473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=3719575082057921473' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3719575082057921473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3719575082057921473'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/08/most-important-commands-in-less.html' title='Compact guide to &lt;em&gt;less&lt;/em&gt; commands'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-3422188180283935514</id><published>2009-08-09T14:17:00.018+02:00</published><updated>2009-09-12T11:12:06.414+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='shell rc file'/><category scheme='http://www.blogger.com/atom/ns#' term='color the shell'/><category scheme='http://www.blogger.com/atom/ns#' term='less'/><title type='text'>GIT_PAGER and LESS colors</title><content type='html'>I was wondering why, working on two different machines, I was able to display git-log and git-diff colors on one machine and not on the other, despite the same git configuration file &lt;i&gt;~/.gitconfig&lt;/i&gt;:&lt;br /&gt;&lt;pre style=" background:black;"&gt;&lt;br /&gt;&lt;span style="color:#ffff00;"&gt;[color]&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;diff&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;    = auto&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;status&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;  = auto&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;branch&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;  = auto&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#00ffff;"&gt;log&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;     = auto&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;and no particular settings regarding colors in &lt;i&gt;&amp;lt;repository&amp;gt;/.git/config&lt;/i&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Although I was not using a Mac, the solution was in this &lt;a href="http://www.xcombinator.com/2008/07/23/mac-os-x-color-showing-escwhatever-for-git-diff-colors-and-more/"&gt;blog post&lt;/a&gt;: that is, setting the GIT_PAGER variable to &lt;i&gt;cat &lt;/i&gt;was already solving the problem; GIT_PAGER sets which program should be used by git to display for example the diff and log output &lt;i&gt;(&lt;/i&gt;default &lt;i&gt;less&lt;/i&gt;).&lt;br /&gt;&lt;br /&gt;The actual problem was in &lt;i&gt;less &lt;/i&gt;and how it outputs ANSI color ESC codes.  A solution, similarly to what suggested in that post, was to set the LESS variable to -R and leave GIT_PAGER unset, as it originally was. Regarding the other options suggested in the blog post for LESS, -X and -e have no influence on color display, and -R is probably better than -r; in particular, this in an extract of the less manual, at the -r/-R  section, explaining why:&lt;/div&gt;&lt;pre&gt;-r or --raw-control-chars&lt;br /&gt;&lt;br /&gt;Causes  "raw"  control  characters  to be displayed.&lt;br /&gt;[...] Warning: when the -r option is used, less cannot&lt;br /&gt;keep track of the actual appearance of the screen&lt;br /&gt;(since this depends on how the screen responds to&lt;br /&gt;each type of control character). Thus, various display&lt;br /&gt;problems may result, such as long lines being split&lt;br /&gt;in the wrong place.&lt;br /&gt;&lt;br /&gt;-R or --RAW-CONTROL-CHARS&lt;br /&gt;&lt;br /&gt;Like -r, but only ANSI "color" escape sequences are&lt;br /&gt;output in "raw" form. Unlike -r, the screen appearance&lt;br /&gt;is maintained correctly in most cases.  [...]&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-3422188180283935514?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/3422188180283935514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=3422188180283935514' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3422188180283935514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3422188180283935514'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/08/gitpager-and-less-colors.html' title='GIT_PAGER and LESS colors'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-7529581765505437112</id><published>2009-07-23T14:29:00.010+02:00</published><updated>2009-09-12T12:41:01.329+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux basics'/><category scheme='http://www.blogger.com/atom/ns#' term='endline chars'/><title type='text'>Conversion of CR+LF to LF</title><content type='html'>The following will convert all files also in subdirectories&lt;br /&gt;exept for those starting with a dot (skips also such directories).&lt;br /&gt;This works if dos2unix is available, of course; otherwise use sed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:monospace;"&gt;find ^.* -exec dos2unix '{}' \;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I needed it to convert the content of a git repository (that's&lt;br /&gt;why I skipped the . files: I didn't want .git/* files to be included).&lt;br /&gt;Of course you can write better matching chriteria, but this worked&lt;br /&gt;fine for my case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-7529581765505437112?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/7529581765505437112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=7529581765505437112' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7529581765505437112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7529581765505437112'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/07/example-of-conversion-cr-lf-to-lf.html' title='Conversion of CR+LF to LF'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6476487666809701667</id><published>2009-07-16T14:33:00.008+02:00</published><updated>2009-08-11T12:44:36.035+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='data structures'/><category scheme='http://www.blogger.com/atom/ns#' term='suffix array'/><title type='text'>Tiny implementation of a suffix array in Ruby</title><content type='html'>&lt;div style="background: black none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: white;"&gt;&lt;pre&gt;&lt;span style="color:#ff40ff;"&gt;class &lt;/span&gt;&lt;span style="color:#00ff00;"&gt;SuffixArray&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color:#ffff00;"&gt;attr_reader&lt;/span&gt; &lt;span style="color:#00ffff;"&gt;:suf&lt;/span&gt;, &lt;span style="color:#00ffff;"&gt;:string&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color:#ff40ff;"&gt;def &lt;/span&gt;&lt;span style="color:#00ffff;"&gt;initialize&lt;/span&gt;(string)&lt;br /&gt;   &lt;span style="color:#00ffff;"&gt;@string&lt;/span&gt; = string&lt;br /&gt;   &lt;span style="color:#00ffff;"&gt;@suf&lt;/span&gt; = (&lt;span style="color:#ff6060;"&gt;0&lt;/span&gt;..string.size-&lt;span style="color:#ff6060;"&gt;1&lt;/span&gt;).sort_by{|&lt;span style="color:#00ffff;"&gt;i&lt;/span&gt;|&lt;span style="color:#00ffff;"&gt;@string&lt;/span&gt;[i..-&lt;span style="color:#ff6060;"&gt;1&lt;/span&gt;]}&lt;br /&gt; &lt;span style="color:#ff40ff;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff40ff;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6476487666809701667?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6476487666809701667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6476487666809701667' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6476487666809701667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6476487666809701667'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/07/simple-implementation-of-suffix-array.html' title='Tiny implementation of a suffix array in Ruby'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-5962777914309177006</id><published>2009-04-20T15:06:00.004+02:00</published><updated>2009-09-12T17:08:10.627+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rake tasks'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Count distinct values in all columns of a table</title><content type='html'>The following rake task will show the number of different values of each column of a given table in the database. I wrote it to see statistics on which columns are really used.&lt;br /&gt;&lt;pre&gt;namespace :db do&lt;br /&gt; desc "Count distinct values for each non empty column of a table (TABLE=xxx) "+&lt;br /&gt;      "optionally using a condition (WHERE=\"yyy\")"&lt;br /&gt; task :count_distincts =&amp;gt; :environment do&lt;br /&gt;   raise "Specify option TABLE=&amp;lt;table_name&amp;gt;" unless ENV["TABLE"]&lt;br /&gt;   puts "Distinct values in table #{ENV['TABLE']}:"&lt;br /&gt;   puts "(condition: where #{ENV['WHERE']})" if ENV['WHERE']&lt;br /&gt;   c = ActiveRecord::Base.connection&lt;br /&gt;   columns = c.select_all("describe #{ENV['TABLE']};").map{|a|a["Field"]}&lt;br /&gt;   columns.each do |col|&lt;br /&gt;     sql = "select count(distinct #{col}) as c from #{ENV['TABLE']}"&lt;br /&gt;     sql &amp;lt;&amp;lt; " where #{ENV['WHERE']}" if ENV['WHERE']&lt;br /&gt;     n = c.select_one(sql)['c']&lt;br /&gt;     puts "#{col}: #{n}" unless n == "0"&lt;br /&gt;     STDOUT.flush&lt;br /&gt;   end&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-5962777914309177006?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/5962777914309177006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=5962777914309177006' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/5962777914309177006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/5962777914309177006'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/count-distinct-values-in-all-columns-of.html' title='Count distinct values in all columns of a table'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-4109577705720786582</id><published>2009-04-16T12:43:00.007+02:00</published><updated>2009-07-23T14:39:51.394+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C basics'/><title type='text'>assert.h</title><content type='html'>Assertions: you express your expectations in a certain position of the code, and this way you avoid bugs that would otherwise very difficult to trace.&lt;br /&gt;&lt;br /&gt;In C use the standard library macro assert. You must &lt;span style="font-family:courier new;"&gt;#include &amp;lt;assert.h&amp;gt;&lt;/span&gt;, then you &lt;span style="font-family:courier new;"&gt;assert(expression);&lt;/span&gt; in the code, and if the expression is evaluating to 0 / false, the program aborts with an error msg printed on sterr that tells you which assertion fails and where it is (file/line).&lt;br /&gt;&lt;br /&gt;It is also possible to turn assertions off, adding a &lt;span style="font-family:courier new;"&gt;#define NDEBUG&lt;/span&gt; before the #include &amp;lt;assert.h&amp;gt;.&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-4109577705720786582?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/4109577705720786582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=4109577705720786582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/4109577705720786582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/4109577705720786582'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/asserth.html' title='assert.h'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-7201195737991434432</id><published>2009-04-14T22:38:00.005+02:00</published><updated>2009-07-23T14:39:33.365+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C basics'/><title type='text'>Why main is int and not void.</title><content type='html'>The standard says so. And it actually makes a difference: here is a detailed discussion about this topic: &lt;a href="http://users.aber.ac.uk/auj/voidmain.shtml"&gt;http://users.aber.ac.uk/auj/voidmain.shtml&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-7201195737991434432?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/7201195737991434432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=7201195737991434432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7201195737991434432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7201195737991434432'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/why-int-main.html' title='Why main is int and not void.'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-809623900602033105</id><published>2009-04-14T11:14:00.005+02:00</published><updated>2009-07-23T14:40:34.744+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scanf'/><category scheme='http://www.blogger.com/atom/ns#' term='C basics'/><title type='text'>Why do you have to pass scanf the address of the variable to write in?</title><content type='html'>&lt;div&gt;&lt;div&gt;As I was learning C the first time, I remember I was asking this myself... I would have preferred it to return the scanned values, something like: &lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-style: italic; "&gt;myVar = scanf("%s")   /* don't do this :) */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;but of course, in this case (1) you could assign only 1 variable, (2) you would have not had the return value (number of read items)... &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is some discussion of it: &lt;a href="http://www.velocityreviews.com/forums/t436453-why-to-use-amp-in-scanf-but-not-in-printf-.html"&gt;...&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-809623900602033105?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/809623900602033105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=809623900602033105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/809623900602033105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/809623900602033105'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/why-do-you-have-to-pass-scanf-address.html' title='Why do you have to pass scanf the address of the variable to write in?'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6840202787987013597</id><published>2009-04-14T10:44:00.008+02:00</published><updated>2009-09-12T11:12:51.273+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vi'/><category scheme='http://www.blogger.com/atom/ns#' term='personal settings'/><category scheme='http://www.blogger.com/atom/ns#' term='linux basics'/><category scheme='http://www.blogger.com/atom/ns#' term='color the shell'/><title type='text'>Turn colors on in vi/vim</title><content type='html'>&lt;span&gt;&lt;span&gt;If the color syntax highlighting is off, you can turn it on by editing (or creating) &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;~/.vimrc&lt;/span&gt;, adding the following line:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;:syn on&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6840202787987013597?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6840202787987013597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6840202787987013597' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6840202787987013597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6840202787987013597'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/turn-colors-on-in-vivim.html' title='Turn colors on in vi/vim'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-8650002330035338271</id><published>2009-04-13T20:54:00.004+02:00</published><updated>2009-04-14T10:50:14.684+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><title type='text'>square root</title><content type='html'>When I have some time, I will have a look to this algorithm to calculate the square root of a number:&lt;br /&gt;&lt;div dir="ltr" style="text-align: left;"&gt;&lt;pre class="source-csharp"&gt;    &lt;span class="kw4"&gt;int&lt;/span&gt; sqrt&lt;span class="br0"&gt;(&lt;/span&gt;&lt;span class="kw4"&gt;int&lt;/span&gt; num&lt;span class="br0"&gt;)&lt;/span&gt; &lt;span class="br0"&gt;{&lt;/span&gt;&lt;br /&gt;     &lt;span class="kw4"&gt;int&lt;/span&gt; op = num;&lt;br /&gt;     &lt;span class="kw4"&gt;int&lt;/span&gt; res = &lt;span class="nu0"&gt;0&lt;/span&gt;;&lt;br /&gt;     &lt;span class="kw4"&gt;int&lt;/span&gt; one = &lt;span class="nu0"&gt;1&lt;/span&gt; &amp;lt;&amp;lt; &lt;span class="nu0"&gt;14&lt;/span&gt;; &lt;span class="co1"&gt;// The second-to-top bit is set: 1L&amp;lt;&amp;lt;30 for long&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;     &lt;span class="co1"&gt;// "one" starts at the highest power of four &amp;lt;= the argument.&lt;/span&gt;&lt;br /&gt;     &lt;span class="kw1"&gt;while&lt;/span&gt; &lt;span class="br0"&gt;(&lt;/span&gt;one &amp;gt; op&lt;span class="br0"&gt;)&lt;/span&gt;&lt;br /&gt;         one &amp;gt;&amp;gt;= &lt;span class="nu0"&gt;2&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;     &lt;span class="kw1"&gt;while&lt;/span&gt; &lt;span class="br0"&gt;(&lt;/span&gt;one != &lt;span class="nu0"&gt;0&lt;/span&gt;&lt;span class="br0"&gt;)&lt;/span&gt; &lt;span class="br0"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span class="kw1"&gt;if&lt;/span&gt; &lt;span class="br0"&gt;(&lt;/span&gt;op &amp;gt;= res + one&lt;span class="br0"&gt;)&lt;/span&gt; &lt;span class="br0"&gt;{&lt;/span&gt;&lt;br /&gt;             op -= res + one;&lt;br /&gt;             res += one &amp;lt;&amp;lt; &lt;span class="nu0"&gt;1&lt;/span&gt;;&lt;br /&gt;         &lt;span class="br0"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         res &amp;gt;&amp;gt;= &lt;span class="nu0"&gt;1&lt;/span&gt;;&lt;br /&gt;         one &amp;gt;&amp;gt;= &lt;span class="nu0"&gt;2&lt;/span&gt;;&lt;br /&gt;     &lt;span class="br0"&gt;}&lt;/span&gt;&lt;br /&gt;     &lt;span class="kw1"&gt;return&lt;/span&gt; res;&lt;br /&gt; &lt;span class="br0"&gt;}&lt;/span&gt;&lt;span style="font-family:Georgia,serif;"&gt;&lt;br /&gt;&lt;br /&gt;(&lt;a href="http://en.wikipedia.org/wiki/Methods_of_computing_square_roots"&gt;from Wikipedia&lt;/a&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-8650002330035338271?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/8650002330035338271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=8650002330035338271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/8650002330035338271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/8650002330035338271'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/square-root.html' title='square root'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-2789544199395797935</id><published>2009-04-11T16:43:00.005+02:00</published><updated>2009-04-11T17:07:30.913+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xslt xml'/><title type='text'>XSLT</title><content type='html'>XSLT: take an XML doc and, through a sort of "stylesheet", make something with the data (another XML doc, or perhaps a XHTML doc). I don't know this language but I guess it's rather useful (although I have no use for it at the moment).&lt;br /&gt;&lt;br /&gt;related stuff: libxml, libxml2, libxslt, xsltproc&lt;br /&gt;&lt;br /&gt;Links:&lt;br /&gt;- specifications@w3: &lt;a href="http://www.w3.org/TR/xslt"&gt;http://www.w3.org/TR/xslt&lt;/a&gt;&lt;div&gt;- tutorial@w3: &lt;a href="http://www.w3schools.com/xsl/"&gt;http://www.w3schools.com/xsl/&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://en.wikipedia.org/wiki/XSLT"&gt;http://en.wikipedia.org/wiki/XSLT&lt;/a&gt;&lt;br /&gt;- &lt;a href="http://en.wikipedia.org/wiki/LibXML"&gt;http://en.wikipedia.org/wiki/LibXML&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-2789544199395797935?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/2789544199395797935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=2789544199395797935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2789544199395797935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/2789544199395797935'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/xslt.html' title='XSLT'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-7963333771754174755</id><published>2009-04-11T15:29:00.004+02:00</published><updated>2009-04-11T17:26:58.920+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cms tools'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='expression engine'/><title type='text'>PragProg media: Expression Engine Techniques</title><content type='html'>I often have a look at the list of media of "PragProg" (&lt;a href="http://www.pragprog.com/categories/all?sort=pubdate"&gt;http://www.pragprog.com/categories/all?sort=pubdate&lt;/a&gt;). The newest title is the screencast serie: "&lt;span class="Apple-style-span"  style=" ;font-family:'courier new';"&gt;Expression Engine Techniques"&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Well I definitely don't need it, anyway I'm always curious, so here is the info I collected (mainly from Wiki) about the topic:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;ExpressionEngine &lt;a href="http://expressionengine.com/"&gt;http://expressionengine.com/&lt;/a&gt; is a CMS, developer: EllisLab, there is a free version, and two paid ones. A "2.0" is expected in 2009, will be based on CodeIgniter, which is a PHP framework.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-7963333771754174755?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/7963333771754174755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=7963333771754174755' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7963333771754174755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/7963333771754174755'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/pragprog-media-expression-engine.html' title='PragProg media: Expression Engine Techniques'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-1609452773352882022</id><published>2009-04-11T14:06:00.006+02:00</published><updated>2009-04-11T14:18:05.590+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='capistrano'/><title type='text'>capistrano using git</title><content type='html'>The cap deploy:update task when you are using git runs the following git command: &lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;git checkout -q -b deploy 3fe75somehash.....&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;meaning : &lt;br /&gt;&lt;br /&gt;&lt;div&gt;- creates a new branch named "deploy" (what happens if there is already one called like that?)&lt;/div&gt;&lt;div&gt;- the source of the branch is the commit identified by the given hash&lt;/div&gt;&lt;div&gt;- -q option is "quiet mode"&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-1609452773352882022?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/1609452773352882022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=1609452773352882022' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1609452773352882022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1609452773352882022'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/capistrano-using-git.html' title='capistrano using git'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-1186154165607537801</id><published>2009-04-11T13:46:00.007+02:00</published><updated>2009-09-12T16:26:56.295+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux software'/><category scheme='http://www.blogger.com/atom/ns#' term='backup'/><category scheme='http://www.blogger.com/atom/ns#' term='symbolic links'/><category scheme='http://www.blogger.com/atom/ns#' term='rsync'/><title type='text'>rsync and symbolic links</title><content type='html'>&lt;div&gt;some possible behaviours of rsync (from the man page):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(1) SKIP:&lt;/div&gt;&lt;div&gt;default case =&gt; symlinks are simply not followed&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(2) COPY THE LINK: &lt;/div&gt;&lt;div&gt;"symlinks are recreated with the same target on the destination"&lt;/div&gt;&lt;div&gt;rsync --links &lt;/div&gt;&lt;div&gt;also: rsync --archive implies --links&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(3) FOLLOW THE LINK&lt;/div&gt;&lt;div&gt;rsync --copy-links &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;safe/unsafe:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;relevant for case 3 is the "safe" vs. "unsafe" difference which I did not understand good.&lt;/div&gt;&lt;div&gt;This is what is written: "An example where this might be used is a web site mirror that wishes ensure the  rsync module they copy does not include symbolic links to /etc/passwd in the public section of the site. Using --copy-unsafe-links will cause any links to be copied as the file they point to on the destination. Using --safe-links will cause unsafe links to be ommitted altogether." &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-1186154165607537801?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/1186154165607537801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=1186154165607537801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1186154165607537801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1186154165607537801'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/rsync-and-symbolic-links.html' title='rsync and symbolic links'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6148045895966856944</id><published>2009-04-11T12:17:00.009+02:00</published><updated>2009-09-12T16:28:33.517+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='common errors'/><category scheme='http://www.blogger.com/atom/ns#' term='backup'/><category scheme='http://www.blogger.com/atom/ns#' term='symbolic links'/><title type='text'>Always back up on a dedicated partition or disk!</title><content type='html'>&lt;div&gt;My home dir on a certain server was backed up by another company. I set under my home a soft link to another location (several Gb of data). What I didn't know: their backup script was rync-based *with* the option --copy-unsafe-links. Rsync followed the link and backed up tons of stuff clugging the backup hard disk. They used the same hard disk and the same partition also for another function: email server. So that softlink disrupted the email server! At first I though I was to be blamed, but after a second thought, I understood, that it's not 100% true: they should have *never* run the mail server on the same partition where they backed up that stuff!&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6148045895966856944?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6148045895966856944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6148045895966856944' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6148045895966856944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6148045895966856944'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/i-did-following-mistake-my-home-dir-on.html' title='Always back up on a dedicated partition or disk!'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-1142520907369618862</id><published>2009-04-11T11:55:00.005+02:00</published><updated>2009-04-11T14:21:05.182+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI programming'/><title type='text'>Ruby and GUIs</title><content type='html'>Is there a good ruby GUI toolkit?&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I want to write a simple app, with a simple DB backend, just to keep some notes. As I want it to run on my laptop, I don't want any webserver running, so no rails app (and also because I want to do some gui programming, it's years I am only working on console or web apps). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I started earlier this morning my Google quest to answer this question, I am not so far yet. I am no expert in GUIs. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Some disorganized thoughts:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- Java of course is a good choice, isn't it? Yes I want to learn Java again (I learned it 10 years ago, and not using it a long time, so I guess my knowledge is totally out-of-date). But now I want just to write a little small app in that simple little lovely ruby language. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;- I guess most Win apps are based on "native" widgets. For that maybe you need VS or the like and I am in this moment in no mood to be a MS fan. And I want something cross-platform. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- There a libraries, and like always in IT a lot of names and acronymes, just to confuse stupid newbies like me. QT is one, I think, then there are others (I think some GUI library-flame is also the reason why Gnome and KDE are 2 different desktops, isn't it?). So I guess you use one of that with some good ruby bindings and you are on it. Right?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- I read of Shoes: very simple, maybe good idea, but probably just for beginners, I don't know if I want to waste my time with it. Looks like is just something for kids learning programming? &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-1142520907369618862?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/1142520907369618862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=1142520907369618862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1142520907369618862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1142520907369618862'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/ruby-gui.html' title='Ruby and GUIs'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-9165340787901081577</id><published>2008-11-07T14:00:00.001+01:00</published><updated>2009-09-12T10:38:06.466+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux basics'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Determine the current runnning shell (linux)</title><content type='html'>&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;tt&gt;echo $SHELL&lt;/tt&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;span class="Apple-style-span"   style=" ;font-family:-webkit-monospace;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-9165340787901081577?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/9165340787901081577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=9165340787901081577' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/9165340787901081577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/9165340787901081577'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/how-do-i-find-out-current-shell.html' title='Determine the current runnning shell (linux)'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-6760512367564962337</id><published>2008-11-06T14:03:00.000+01:00</published><updated>2009-04-11T14:05:22.776+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>app helper in the rails console</title><content type='html'>The app helper is cool. You can use it to simulate requests to your app: &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;e.g.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;app.get "/" &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-6760512367564962337?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/6760512367564962337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=6760512367564962337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6760512367564962337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/6760512367564962337'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/app-helper-in-rails-console.html' title='app helper in the rails console'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-183090567494435478</id><published>2008-08-22T22:39:00.022+02:00</published><updated>2009-09-12T17:13:24.533+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attr_hidden'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='active record'/><category scheme='http://www.blogger.com/atom/ns#' term='rails plugins'/><title type='text'>Hide attributes in Rails / ActiveRecord</title><content type='html'>Let's assume you have a table "entities" that was created by this Rails migration code:&lt;div  style="background:black; color:white;"&gt;&lt;pre&gt;create_table &lt;span style="color:#00ffff;"&gt;:entities&lt;/span&gt; &lt;span style="color:#ffff00;"&gt;do&lt;/span&gt; |&lt;span style="color:#00ffff;"&gt;t&lt;/span&gt;|&lt;pre&gt;  t.string &lt;span style="color:#00ffff;"&gt;:type&lt;/span&gt;&lt;br /&gt;  t.string &lt;span style="color:#00ffff;"&gt;:title&lt;/span&gt;&lt;br /&gt;  t.string &lt;span style="color:#00ffff;"&gt;:first_name&lt;/span&gt;&lt;br /&gt;  t.string &lt;span style="color:#00ffff;"&gt;:last_name&lt;/span&gt;&lt;br /&gt;  t.binary &lt;span style="color:#00ffff;"&gt;:logo&lt;/span&gt;&lt;/pre&gt;&lt;span style="color:#ffff00;"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;Person and Organisation will be subclasses of Entity (which of course is  a subclass of ActiveRecord::Base), using single table inheritance. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If people have no logo and organisations have no title, first name and last name, maybe we would like to hide this columns from their respective classes. Of course, you may say that in this case you shouldn't use STI. But if you really want to... ActiveRecord does not provide hiding functionality. All Person and Organisation instances will see all attributes of Entity. This behaviour can be changed as follows.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;When a new object is created (e.g. Person.new), this is a real instance of Person. The list of attributes comes in this case from the public class method &lt;tt&gt;columns&lt;/tt&gt; of ActiveRecord::Base. When records are fetched using a finder method, however, (e.g. Person.first), ActiveRecord goes another way, and calls the private class method &lt;tt&gt;instantiate&lt;/tt&gt; of ActiveRecord::Base, which takes an hash of attributes/values as argument, which conversely derive from the results of the sql query. So to hide attributes you have to hide them both in columns and in instantiate and the trick is done.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-183090567494435478?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/183090567494435478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=183090567494435478' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/183090567494435478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/183090567494435478'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/hide-attributes-in-active-record.html' title='Hide attributes in Rails / ActiveRecord'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-1930492238320533126</id><published>2008-08-18T21:01:00.020+02:00</published><updated>2009-09-12T11:14:08.225+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby blocks'/><title type='text'>Default values in Ruby blocks</title><content type='html'>The ruby parser does not allow default values to be set in blocks, unlike in method signatures. This is of course valid ruby: &lt;pre&gt;def method(a, b=0)&lt;br /&gt;#...&lt;br /&gt;end&lt;/pre&gt; but this isn't: &lt;pre&gt;Proc.new {|a, b=0| } ### syntax error!&lt;/pre&gt; See e.g. &lt;a href="http://www.ruby-forum.com/topic/121058"&gt;this discussion&lt;/a&gt; in Ruby forum.&lt;br /&gt;&lt;br /&gt;However it is possible to simulate the behaviour, creating a &lt;em&gt;de facto&lt;/em&gt; signature with default values. For example lets say I want a proc accepting the same parameters as a method  defined as &lt;code&gt;def a(b, c=1)&lt;/code&gt;:&lt;br /&gt;&lt;pre  style="background: black none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;color:white;"&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;lambda&lt;/span&gt; &lt;span style="color: rgb(255, 255, 0);"&gt;do&lt;/span&gt; |&lt;span style="color: rgb(0, 255, 255);"&gt;*args&lt;/span&gt;| &lt;span style="color: rgb(128, 128, 255);"&gt;# simulated signature: |b, c=1|&lt;/span&gt;&lt;br /&gt; b, c = args[&lt;span style="color: rgb(255, 96, 96);"&gt;0&lt;/span&gt;], args[&lt;span style="color: rgb(255, 96, 96);"&gt;1&lt;/span&gt;] || &lt;span style="color: rgb(255, 96, 96);"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;This has the disadvantage that is not validating the number of arguments, so let's add some validation code to the block: &lt;pre  style="background: black none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color:white;"&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;lambda&lt;/span&gt; &lt;span style="color: rgb(255, 255, 0);"&gt;do&lt;/span&gt; |&lt;span style="color: rgb(0, 255, 255);"&gt;*args&lt;/span&gt;| &lt;span style="color: rgb(128, 128, 255);"&gt;# simulated signature: |b, c=1|&lt;/span&gt;&lt;br /&gt; b, c = args[&lt;span style="color: rgb(255, 96, 96);"&gt;0&lt;/span&gt;], args[&lt;span style="color: rgb(255, 96, 96);"&gt;1&lt;/span&gt;] || &lt;span style="color: rgb(255, 96, 96);"&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(128, 128, 255);"&gt;  # validate number of arguments:&lt;/span&gt;&lt;br /&gt; err = &lt;span style="color: rgb(255, 64, 255);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(255, 96, 96);"&gt;wrong number of arguments&lt;/span&gt;&lt;span style="color: rgb(255, 64, 255);"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;  if&lt;/span&gt; args.size &amp;gt; &lt;span style="color: rgb(255, 96, 96);"&gt;2&lt;/span&gt;&lt;br /&gt;   &lt;span style="color: rgb(255, 255, 0);"&gt;raise&lt;/span&gt; &lt;span style="color: rgb(0, 255, 255);"&gt;ArgumentError&lt;/span&gt;, &lt;span style="color: rgb(255, 64, 255);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(255, 64, 255);"&gt;#{err}&lt;/span&gt;&lt;span style="color: rgb(255, 96, 96);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(255, 64, 255);"&gt;#{args.size}&lt;/span&gt;&lt;span style="color: rgb(255, 96, 96);"&gt; for 2)&lt;/span&gt;&lt;span style="color: rgb(255, 64, 255);"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;  elsif&lt;/span&gt; args.size == &lt;span style="color: rgb(255, 96, 96);"&gt;0&lt;/span&gt;&lt;br /&gt;   &lt;span style="color: rgb(255, 255, 0);"&gt;raise&lt;/span&gt; &lt;span style="color: rgb(0, 255, 255);"&gt;ArgumentError&lt;/span&gt;, &lt;span style="color: rgb(255, 64, 255);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(255, 64, 255);"&gt;#{err}&lt;/span&gt;&lt;span style="color: rgb(255, 96, 96);"&gt; (0 for 1)&lt;/span&gt;&lt;span style="color: rgb(255, 64, 255);"&gt;"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;Now the block behaves like if it had the signature |b, c=1|.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-1930492238320533126?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/1930492238320533126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=1930492238320533126' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1930492238320533126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1930492238320533126'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/default-values-in-ruby-blocks.html' title='Default values in Ruby blocks'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-5121115670894922208</id><published>2008-08-17T01:09:00.002+02:00</published><updated>2009-09-12T16:50:01.825+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle lob'/><category scheme='http://www.blogger.com/atom/ns#' term='rails on oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='active scaffold'/><title type='text'>ActiveScaffold and LOB sorting in Oracle</title><content type='html'>If you are using ActiveScaffold and an Oracle DB, you will notice that you can't natively sort on LOB columns. If you click on the table header for a LOB column, you will get an error message. A way to fix this is to sort using the substr function and pass it to &lt;code&gt;config.columns[&lt;lob_attr_name&gt;].sort_by :sql&lt;/lob_attr_name&gt;&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;To make it simpler, I solved the matter including in &lt;code&gt;ActiveScaffold::DataStructures::Column&lt;/code&gt; a&lt;br /&gt;method:&lt;br /&gt;&lt;pre&gt;def sort_as_lob(lenght = 50, offset = 1)&lt;br /&gt;  sort_by :sql =&gt; "dbms_lob.substr(#{name},"+&lt;br /&gt;                                  "#{lenght},"+&lt;br /&gt;                                  "#{offset})"&lt;br /&gt;end&lt;/pre&gt; which I use on LOBs column declaring in the active scaffold config block:&lt;br /&gt;&lt;pre&gt;active_scaffold do |config|&lt;br /&gt;config.columns[:my_lob].sort_as_lob&lt;br /&gt;end&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-5121115670894922208?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/5121115670894922208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=5121115670894922208' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/5121115670894922208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/5121115670894922208'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/activescaffold-and-lob-sorting-in.html' title='ActiveScaffold and LOB sorting in Oracle'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-1705134515591013760</id><published>2008-08-16T14:58:00.001+02:00</published><updated>2008-08-18T21:22:22.123+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='sort_by :sql'/><category scheme='http://www.blogger.com/atom/ns#' term='polymorphic associations'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='active scaffold'/><title type='text'>sort_by =&gt; :sql in and polymorphic associations</title><content type='html'>Assume you have a polymorphic association in Rails.&lt;br /&gt;&lt;pre&gt;class MyObject &lt; ActiveRecord::Base &lt;br /&gt;  belongs_to :another_object, :polymorphic =&gt; true&lt;br /&gt;end&lt;/pre&gt;Well, "another object" can now be in any other table of the DB, and in the &lt;code&gt;my_objects&lt;/code&gt; table there are two columns (assuming you followed the conventions) named &lt;code&gt;another_object_id&lt;/code&gt; and &lt;code&gt;another_object_type&lt;/code&gt;, the first one containing the ID of the object, the second the model name. &lt;br /&gt;&lt;br /&gt;Now let's say I have a table with all "my objects" and I want to sort it according to a specific column in "another object" (for simplicity let us assume any possible "other object" have a column called "label"). &lt;br /&gt;&lt;br /&gt;There is two ways to do this. The first one is loading all "my objects" instances, then for each one make a query, according to the association type, to find the other objects, than let Ruby sort by label. This is of course not optimized. Through the &lt;br /&gt;'eager loading' ActiveRecord feature, which I think is in the meantime also available for polymorphic associations, it is probably possible to find a better way. However I wanted a single query, so I did it using SQL; &lt;code&gt;case&lt;/code&gt; was introduced in the standard, if I am not wrong, in the SQL-92 version. I think that most SQL-DBs comply, SQL-Lite probably excluded (I tested only on Oracle). &lt;br /&gt;&lt;br /&gt;So in my case another_objects can only be of a few types, so I did it this way, in the controller code:&lt;br /&gt;&lt;pre&gt;#&lt;br /&gt;# e.g. types = %w[Cat Dog Mouse]&lt;br /&gt;#&lt;br /&gt;def sort_by_sql(types)&lt;br /&gt;  sql = '(case (another_object_type)'&lt;br /&gt;  sql &lt;&lt; types.map do |type|&lt;br /&gt;           'when #{type} &lt;br /&gt;            then (select label &lt;br /&gt;                 from #{type.tableize} t&lt;br /&gt;                 where t.id = another_object_id) '&lt;br /&gt;         end.join('')&lt;br /&gt;  sql &lt;&lt; 'end)'&lt;br /&gt;end&lt;br /&gt;private :sort_by_sql&lt;/pre&gt;You can use this sort_by_sql() method in the &lt;code&gt;:order_by =&gt; sort_by_sql(...)&lt;/code&gt; key of the find method to sort by the label method of the polymorphic association with only one query. This was sensibly faster in my case. &lt;br /&gt;&lt;br /&gt;Actually the need for this came because I wanted to sort by a polymorphic association in an ActiveScaffold based controller, and in this case I am not sure I could have specified an eager loading without too much effort (probably overriding the finder method of the list). So I just wrote the sort_by_sql() as a class method and used it in the config block of my active scaffold:&lt;br /&gt;&lt;pre&gt;AllowedTypes = %w[Cat Dog Mouse]&lt;br /&gt;def self.sort_by_sql(types)&lt;br /&gt;  #...the code up here...#&lt;br /&gt;end&lt;br /&gt;active_scaffold :my_objects do |config|&lt;br /&gt;  # ...&lt;br /&gt;  config.columns[:another_object].sort_by :sql =&gt; &lt;br /&gt;                           sort_by_sql(*AllowedTypes)&lt;br /&gt;  # ...&lt;br /&gt;end&lt;/pre&gt;That worked fine for me.&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-1705134515591013760?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/1705134515591013760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=1705134515591013760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1705134515591013760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1705134515591013760'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/sortby-sql-in-and-polymorphic.html' title='sort_by =&gt; :sql in and polymorphic associations'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-1608992186034921795</id><published>2008-08-14T20:28:00.001+02:00</published><updated>2009-09-12T10:47:05.368+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='rake'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>Execute a Rake task in another</title><content type='html'>It is easy to make one task dependent on another, for example:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;task :one =&gt; [:two, :three]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;executes task two, three, then one (I have to test that the order is really this). But how to execute task ":two" in the middle of the code of another task?&lt;br /&gt;&lt;br /&gt;Here is the solution:&lt;br /&gt;&lt;code lang="ruby"&gt;&lt;br /&gt;desc "This task executes task two in its code!"&lt;br /&gt;task :one do&lt;br /&gt;&lt;br /&gt;  # ... do domething&lt;br /&gt;&lt;br /&gt;  ENV['PAR1'] = 'xxx'&lt;br /&gt;  ENV['PAR2'] = 'yyy'&lt;br /&gt;  Rake::Task[ "two" ].execute&lt;br /&gt;&lt;br /&gt;  # ... do something&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;the ENV assignments and execute call have a similar effect to executing in your shell:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;rake two PAR1 = xxx, PAR2 = yyy&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Yeah, Rake is a really easy and cool tool for every scripting need...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-1608992186034921795?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/1608992186034921795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=1608992186034921795' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1608992186034921795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/1608992186034921795'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/execute-rake-task-in-another.html' title='Execute a Rake task in another'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-8832792367960507425</id><published>2008-08-14T17:32:00.006+02:00</published><updated>2009-09-12T17:00:30.225+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rake tasks'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='rails migrations'/><title type='text'>Fake migrations for rails &lt; 2.0.2</title><content type='html'>&lt;div&gt;The following rake task can be used to update the migration pointer without actually migrate in rails databases for rails under 2.0.2. This is sometimes useful if you applied something manually or want to skip some migration anyway.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Usage examples: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;rake db:pretend:migrate&lt;/div&gt;&lt;div&gt;rake db:pretend:migrate VERSION=20080730181045 &lt;/div&gt;&lt;div&gt;rake db:pretend:rollback&lt;/div&gt;&lt;pre&gt;namespace(:db) do&lt;br /&gt;  namespace(:pretend) do&lt;br /&gt;    desc "Pretend the database migrated 1 step or to VERSION=&amp;lt;nn&amp;gt;"&lt;br /&gt;    task :migrate =&amp;gt; :environment do&lt;br /&gt;      c = ActiveRecord::Base.connection&lt;br /&gt;      if ENV['VERSION']&lt;br /&gt;        version = ENV['VERSION'].to_i&lt;br /&gt;      else&lt;br /&gt;        version = c.select_one("select version from schema_info")['version'].to_i + 1&lt;br /&gt;      end&lt;br /&gt;      c.execute("update schema_info set version = #{version}")&lt;br /&gt;      puts "Current version: #{version}"&lt;br /&gt;    end&lt;br /&gt;    desc "Pretend that the last migration did not happen"&lt;br /&gt;    task :rollback =&amp;gt; :environment do&lt;br /&gt;      c = ActiveRecord::Base.connection&lt;br /&gt;      version = c.select_one("select version from schema_info")['version'].to_i - 1&lt;br /&gt;      c.execute("update schema_info set version = #{version}")&lt;br /&gt;      puts "Current version: #{version}"&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-8832792367960507425?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/8832792367960507425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=8832792367960507425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/8832792367960507425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/8832792367960507425'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/fake-migrations-for-rails-202.html' title='Fake migrations for rails &lt; 2.0.2'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-3429422564824893709</id><published>2008-08-14T17:31:00.003+02:00</published><updated>2009-09-12T17:01:14.112+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails on oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='rake tasks'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='rails migrations'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>oracle adapter and rails migrations</title><content type='html'>The Oracle adapter for active record has a bug that does not allow to create a dump of the schema using rake. The following code is from &lt;a href="http://dev.rubyonrails.org/ticket/10415"&gt;http://dev.rubyonrails.org/ticket/10415&lt;/a&gt; and corrects this problem.&lt;pre&gt;require 'active_record/connection_adapters/oracle_adapter'&lt;br /&gt;module ActiveRecord&lt;br /&gt;  module ConnectionAdapters&lt;br /&gt;   class OracleAdapter&lt;br /&gt;     # Returns an array of arrays containing the field values.&lt;br /&gt;     # Order is the same as that returned by #columns.&lt;br /&gt;     def select_rows(sql, name = nil)&lt;br /&gt;       result = select(sql, name)&lt;br /&gt;       result.map{ |v| v.values}&lt;br /&gt;     end&lt;br /&gt;   end&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-3429422564824893709?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/3429422564824893709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=3429422564824893709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3429422564824893709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/3429422564824893709'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/oracle-adapter-and-rails-migrations.html' title='oracle adapter and rails migrations'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-452164673916884307</id><published>2008-08-13T12:32:00.014+02:00</published><updated>2008-08-18T02:00:23.279+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='color picker'/><category scheme='http://www.blogger.com/atom/ns#' term='scripteka'/><category scheme='http://www.blogger.com/atom/ns#' term='prototype'/><category scheme='http://www.blogger.com/atom/ns#' term='cooltips'/><title type='text'>A color picker</title><content type='html'>Looking for a color picker for a website I am preparing, I found many commercial tools and other open source (unobfuscated js) but not free-licensed. &lt;br /&gt;&lt;br /&gt;An open source free licensed ('&lt;em&gt;it’s dual licenced under Creative Commons &amp; GPL&lt;/em&gt;') color picker is the &lt;a target='new' href='http://www.colorjack.com/software/'&gt;Colorjack color picker&lt;/a&gt;: I like more the &lt;a target='new' href='http://www.colorjack.com/software/dhtml+color+picker.html'&gt;version 1.0.4&lt;/a&gt; than &lt;a target='new' href='http://www.nofunc.com/DHTML_Color_Picker_2/'&gt;2.0&lt;/a&gt;. . &lt;br /&gt;&lt;br /&gt;I saw that the code in Colorjack incorporates a function $() which I would have to rename to avoid conflicts with the Prototype framework... (although I didn't actually test it) so I just looked further and found &lt;a target='new' href='http://scripteka.com/'&gt;Scripteka&lt;/a&gt;, which is a collection of Prototype extensions. Currently there are links to 119 projects. &lt;br /&gt;&lt;br /&gt;At least two of them are color picking related, John Dyer's &lt;a target='new' href='http://johndyer.name/post/2007/09/PhotoShop-like-JavaScript-Color-Picker.aspx'&gt;Colorpicker&lt;/a&gt;, released in 2007 under a MIT-style license and Jeremy Jongsma's GPL-licensed &lt;a target='new' href='http://home.jongsma.org/software/js/colorpicker'&gt;Control.ColorPicker&lt;/a&gt;, released in April 2008.&lt;br /&gt;&lt;br /&gt;Not all the projects linked by Scripteka are free licensed: for example &lt;a target='new' href='http://www.wildbit.com/labs/cooltips/'&gt;Cooltips&lt;/a&gt; is not.&lt;br /&gt;&lt;br /&gt;Through a comment in John Dyer's blog I came to &lt;a target='new' href='http://www.nogray.com/color_picker.php'&gt;nogray color picker&lt;/a&gt; which is based on another javascript framework (mooTools) and I didn't find the licensing terms. &lt;br /&gt;&lt;br /&gt;It's a pity none of them is available as Rails plugin, maybe with some nice helper methods...&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-452164673916884307?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/452164673916884307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=452164673916884307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/452164673916884307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/452164673916884307'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/color-picker.html' title='A color picker'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-9167702995586471774</id><published>2008-07-13T11:56:00.001+02:00</published><updated>2008-11-17T19:17:25.978+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='video lectures'/><category scheme='http://www.blogger.com/atom/ns#' term='online lectures'/><category scheme='http://www.blogger.com/atom/ns#' term='MIT'/><category scheme='http://www.blogger.com/atom/ns#' term='timms'/><title type='text'>Online lectures</title><content type='html'>An Italian University (&lt;a target="new" href="http://www.consorzionettuno.it/"&gt;Consorzio Nettuno&lt;/a&gt;) is based on recorded lectures in several languages, unfortunately not online (or only for their students) but broadcasted by two channels on an european satellite. I have currently no satellite dish... that's a pity...&lt;br /&gt;&lt;br /&gt;On the web there are anyway some resources with lectures and other videotaped matherial better than music videos and jokes. Here are some examples I found, grouped by language:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;English&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://mitworld.mit.edu/"&gt;MIT World&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://video.google.com/ucberkeley.html"&gt;UC Berkeley&lt;/a&gt;&lt;/li&gt;  &lt;/ul&gt;  &lt;li&gt;German&lt;br /&gt;  &lt;/li&gt;  &lt;ul&gt;&lt;li&gt;&lt;a href="http://timms.uni-tuebingen.de/"&gt;Tübinger Internet Multimedia Server&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;  &lt;/ul&gt;&lt;li&gt;Italian&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.seventlab.com/"&gt;SeventLab (Computer Engeneering)&lt;/a&gt;, heavy DivX files (ca. 400 Mb)&lt;/li&gt;  &lt;/ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-9167702995586471774?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/9167702995586471774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=9167702995586471774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/9167702995586471774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/9167702995586471774'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2008/08/idea-of-recording-video-of-university.html' title='Online lectures'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-195042062411183253</id><published>2007-10-11T17:19:00.002+02:00</published><updated>2009-09-12T17:02:10.401+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash'/><category scheme='http://www.blogger.com/atom/ns#' term='linux basics'/><category scheme='http://www.blogger.com/atom/ns#' term='shell rc file'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>bash startup</title><content type='html'>&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;In interactive mode bash executes some startup scripts. First thing to know is if it is a login shell or not a login shell: &lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;br /&gt;* login shell: (executes more things)&lt;br /&gt;(1) general settings for all users are in: /etc/profile&lt;br /&gt;(2) personal settins may be in: (first one readable)&lt;br /&gt;~/.bash_profile&lt;br /&gt;~/.bash_login&lt;br /&gt;~/.profile&lt;br /&gt;(3) before logout: ~/.bash_logout&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;* non-login: &lt;br /&gt;&gt;bash =&gt; ~/.bashrc&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&gt;bash --norc =&gt; nothing&lt;br /&gt;&gt;bash --rcfile filename =&gt; specify another rc file&lt;br /&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-195042062411183253?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/195042062411183253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=195042062411183253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/195042062411183253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/195042062411183253'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/in-interactive-mode-bash-executes-some.html' title='bash startup'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7298146498063387324.post-4647041790525523719</id><published>2007-04-11T12:08:00.002+02:00</published><updated>2009-09-12T10:36:15.756+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C basics'/><title type='text'>Learning C: params from the command line</title><content type='html'>&lt;span class="Apple-style-span"  style=" ;font-family:'Times New Roman';"&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;I want to read two parameters from the command line: a string and a number. The number should be a positive integer smaller than 100.&lt;br /&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;pre&gt;int main (int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt; char * string;&lt;br /&gt; long int number;&lt;br /&gt; /* are there really 2 parameters? */&lt;br /&gt; if (argc != 3) exit(EXIT_FAILURE);&lt;br /&gt; /* catch them */&lt;br /&gt; string = argv[1];&lt;br /&gt; number = atoi(argv[2]);&lt;br /&gt; /* use them */&lt;br /&gt; printf("String parameter: %s\n",string);&lt;br /&gt; printf("Number parameter+1: %d\n",number+1);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The number of parameters (as int) and the parameters itself (as char*) are passed to "main". &lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;Everybody writes main as &lt;span style="font-family:courier new;"&gt;int main (int argc, char *argv&lt;/span&gt;), I guess it's possible to use more descriptive names to the arguments of main, like &lt;span style="font-family:courier new;"&gt;int main (int argument_counter, char *arguments)&lt;/span&gt; but it's probably out of fashion - if you write C you should look serious after all. &lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;The classical beginner's note: It must be considered that argv[0] is the program name (what is useful for example for syntax error messages), so the counter is always actually one more than you intuitively expected and you find the first real parameter as argv[1].&lt;br /&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;Parameter type: as the parameters are actually always strings, you must convert them using some conversion functions like atoi or strtol (I guess).&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7298146498063387324-4647041790525523719?l=looks-interesting.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://looks-interesting.blogspot.com/feeds/4647041790525523719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7298146498063387324&amp;postID=4647041790525523719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/4647041790525523719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7298146498063387324/posts/default/4647041790525523719'/><link rel='alternate' type='text/html' href='http://looks-interesting.blogspot.com/2009/04/i-am-learning-c-you-know.html' title='Learning C: params from the command line'/><author><name>Giorgio Gonnella</name><uri>http://www.blogger.com/profile/16327435259007371993</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_n5V047VKsgs/SKKnXvzFY3I/AAAAAAAAAAs/ALeqyP8sRXs/s1600-R/RIMG0106.JPG'/></author><thr:total>0</thr:total></entry></feed>
