<?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-714307892554290055</id><updated>2011-09-10T16:10:52.483+02:00</updated><category term='linux'/><category term='mobile'/><category term='spotify'/><category term='S60'/><category term='postgresql'/><category term='javascript'/><category term='xmpp'/><category term='java'/><category term='web'/><category term='pidgin'/><category term='fedora'/><category term='dbus'/><category term='ichat'/><category term='adium'/><category term='tip'/><category term='OS X'/><category term='gps'/><category term='firefox'/><category term='cool'/><category term='git'/><category term='python'/><category term='shell'/><category term='script'/><category term='vim'/><category term='eclipse'/><category term='subversion'/><category term='database'/><title type='text'>Fredrik Fornwall's geek blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-8139028802993144006</id><published>2010-10-31T22:05:00.000+01:00</published><updated>2010-10-31T22:05:13.355+01:00</updated><title type='text'>Weekend project: Chat Pusher</title><content type='html'>Needed something like this: &lt;a href="http://chatpusher.appspot.com/"&gt;http://chatpusher.appspot.com/&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-8139028802993144006?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/8139028802993144006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=8139028802993144006' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/8139028802993144006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/8139028802993144006'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2010/10/weekend-project-chat-pusher.html' title='Weekend project: Chat Pusher'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-1698867986223496530</id><published>2010-09-26T23:50:00.002+02:00</published><updated>2010-09-26T23:50:53.370+02:00</updated><title type='text'>Viewing Android Source Code in Eclipse</title><content type='html'>Just wrote a python script to help build the necessary folder for viewing android source code in eclipse. Check out &lt;a href="http://mobilepearls.com/labs/viewing-android-source-code-in-eclipse/"&gt;http://mobilepearls.com/labs/viewing-android-source-code-in-eclipse/&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-1698867986223496530?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/1698867986223496530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=1698867986223496530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/1698867986223496530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/1698867986223496530'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2010/09/viewing-android-source-code-in-eclipse.html' title='Viewing Android Source Code in Eclipse'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-324352840288451174</id><published>2010-08-08T04:19:00.000+02:00</published><updated>2010-08-08T04:19:14.686+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='git'/><category scheme='http://www.blogger.com/atom/ns#' term='subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Handling SSH on non-standard ports for subversion and git</title><content type='html'>Working with subversion and git over SSH on a non-standard port (!=22) is troublesome as the &lt;strong&gt;host:port&lt;/strong&gt; syntax does not work.&lt;br /&gt;&lt;br /&gt;One easy way around this is to to define an entry as the following in $HOME/.ssh/config:&lt;br /&gt;&lt;pre&gt;Host my.githost.com&lt;br /&gt;Port 7822&lt;/pre&gt;&lt;br /&gt;This allows one to use the host normally through most SSH-using tools such as subversion and git!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-324352840288451174?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/324352840288451174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=324352840288451174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/324352840288451174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/324352840288451174'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2010/08/handling-ssh-on-non-standard-ports-for.html' title='Handling SSH on non-standard ports for subversion and git'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-2621184739522295472</id><published>2010-08-08T04:10:00.001+02:00</published><updated>2010-08-08T04:14:17.146+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><title type='text'>Show&amp;hide hidden files and folders in Mac file dialogs</title><content type='html'>Keyboard shortcut of the day: Use "&lt;strong&gt;Cmd+Shift+.&lt;/strong&gt;" to toggle showing hidden files in Mac file dialogs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-2621184739522295472?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/2621184739522295472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=2621184739522295472' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/2621184739522295472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/2621184739522295472'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2010/08/show-hidden-files-and-folders-in-mac.html' title='Show&amp;hide hidden files and folders in Mac file dialogs'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-684071144759074661</id><published>2010-07-08T00:05:00.001+02:00</published><updated>2010-07-08T00:06:49.972+02:00</updated><title type='text'>Simple HTTP benchmarks with ab</title><content type='html'>&lt;p&gt;The &lt;a href="http://httpd.apache.org/docs/2.0/programs/ab.html"&gt;ab tool&lt;/a&gt; from Apache is a simple command line program for benchmarking, included in the &lt;i&gt;httpd-tools&lt;/i&gt; rpm package in Fedora. The below command shows how to benchmark http://example.com/ with 4 total requests using 2 concurrent connections:&lt;/p&gt;&lt;pre&gt;ab -n 4 -c 2 http://example.com/&lt;/pre&gt;&lt;p&gt;There are a lot of options as the &lt;i&gt;-H&lt;/i&gt; for a custom HTTP header or the &lt;i&gt;-p&lt;/i&gt; for POST data from a file!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-684071144759074661?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/684071144759074661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=684071144759074661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/684071144759074661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/684071144759074661'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2010/07/simple-http-benchmarks-with-ab.html' title='Simple HTTP benchmarks with ab'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-4334664737469993447</id><published>2010-05-29T12:04:00.003+02:00</published><updated>2010-06-01T12:06:06.044+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>Eclipse tip: Choose editor from the "Open Resource" dialog</title><content type='html'>Eclipse 3.5 added the option to choose which editor to use when opening a file from the &lt;i&gt;Open Resource&lt;/i&gt; dialog:&lt;br /&gt;&lt;div&gt;&lt;img src="http://fornwall.net/images/blog/eclipse-open-resource-with.png" alt="The Open Resource dialog with option to choose editor" width="637" height="434"/&gt;&lt;/div&gt;&lt;br /&gt;It's useful when a file type is associated with an external editor, but one has a need of finding it in Eclipse to work with e.g. version control.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-4334664737469993447?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/4334664737469993447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=4334664737469993447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/4334664737469993447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/4334664737469993447'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2010/05/eclipse-tip-choose-editor-from-open.html' title='Eclipse tip: Choose editor from the &quot;Open Resource&quot; dialog'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-4252572640326194408</id><published>2010-02-06T23:57:00.002+01:00</published><updated>2010-02-07T00:03:34.610+01:00</updated><title type='text'>Fixing graphical glitches with eclipse on fedora 12</title><content type='html'>As noticed by &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=538733"&gt;https://bugzilla.redhat.com/show_bug.cgi?id=538733&lt;/a&gt; and &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291257"&gt;https://bugs.eclipse.org/bugs/show_bug.cgi?id=291257&lt;/a&gt;, eclipse has problems on fedora 12 in the form of missing icons in views. Setting GDK_NATIVE_WINDOWS as below fixes the problem:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;export GDK_NATIVE_WINDOWS=1; ./eclipse&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-4252572640326194408?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/4252572640326194408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=4252572640326194408' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/4252572640326194408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/4252572640326194408'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2010/02/fixing-graphical-glitches-with-eclipse.html' title='Fixing graphical glitches with eclipse on fedora 12'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-976578887992873776</id><published>2009-09-05T23:41:00.005+02:00</published><updated>2009-09-07T16:26:15.488+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='fedora'/><category scheme='http://www.blogger.com/atom/ns#' term='spotify'/><title type='text'>Fixing graphical glitches using Spotify&amp;Wine in Fedora 11</title><content type='html'>To reduce dual-booting to windows to a minimum, I recently setup &lt;a href="http://spotify.com/"&gt;Spotify&lt;/a&gt; under &lt;a href="http://www.winehq.org/"&gt;Wine&lt;/a&gt; in Fedora 11 (64-bit).&lt;br /&gt;Initially, the audio went silent shortly after starting the application - this was fixed by changing the sound driver in winecfg to ALSA instead of PulseAudio.&lt;br /&gt;A second problem was graphical glitches:&lt;br /&gt;&lt;div&gt;&lt;img src="http://fornwall.net/images/blog/screenshot-spotify-messed-up.png" alt=""/&gt;&lt;/div&gt;&lt;br /&gt;Googling found &lt;a href="http://blog.rubbad.com/archives/295"&gt;a nice blog post&lt;/a&gt; about what was missing:&lt;br /&gt;&lt;pre&gt;yum install cups-libs.i586 fontconfig.i586 gnutls.i586 hal-libs.i586 libXcomposite.i586 libpng.i586 sane-backends-libs.i586 libXcursor.i586 libXinerama.i586 libXrandr.i586 libXrender.i586&lt;/pre&gt;After installing the above packages the graphical glitches disappeared and victory was declared:&lt;br /&gt;&lt;div&gt;&lt;img src="http://fornwall.net/images/blog/screenshot-spotify-fixed.png" alt=""/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-976578887992873776?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/976578887992873776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=976578887992873776' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/976578887992873776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/976578887992873776'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/09/fixing-graphical-glitches-using-spotify.html' title='Fixing graphical glitches using Spotify&amp;Wine in Fedora 11'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-6577902561511178221</id><published>2009-08-05T11:08:00.004+02:00</published><updated>2009-08-05T11:16:37.491+02:00</updated><title type='text'>Worth repeating: How to easily add certificates to your keystore in java</title><content type='html'>Today I (yet again) had the below tiresome problem:&lt;pre&gt;sun.security.validator.ValidatorException:&lt;br /&gt;PKIX path building failed:&lt;br /&gt;sun.security.provider.certpath.SunCertPathBuilderException:&lt;br /&gt;unable to find valid certification path to requested target&lt;/pre&gt;The problem occurred when accessing WSDL files on a test server. I cursed life...&lt;br /&gt;&lt;br /&gt;Then, a helpful post how to easily add certificates at &lt;a href="http://blogs.sun.com/andreas/entry/no_more_unable_to_find"&gt;http://blogs.sun.com/andreas/entry/no_more_unable_to_find&lt;/a&gt; saved the day. Yay!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-6577902561511178221?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/6577902561511178221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=6577902561511178221' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6577902561511178221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6577902561511178221'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/08/worth-repeating-how-to-easily-add.html' title='Worth repeating: How to easily add certificates to your keystore in java'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-3692653327290433058</id><published>2009-05-18T15:09:00.003+02:00</published><updated>2010-04-15T09:04:12.271+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Indentation problem when pasting into vim and the nopaste option</title><content type='html'>&lt;p&gt;When pasting content into vim, such as a code snippet, it may mess up the indentation in a nested kind of way, with indentation increasing the further down you go.&lt;/p&gt;&lt;p&gt;The &lt;a href="http://vimdoc.sourceforge.net/htmldoc/options.html#%27paste%27"&gt;vim paste option&lt;/a&gt; fixes this - just issue &lt;em&gt;:set paste&lt;/em&gt; before pasting, and &lt;em&gt;:set nopaste&lt;/em&gt; when done.&lt;/p&gt;&lt;p&gt;As noted by the vim documentation, the underlying problem is that a terminal program, in contrast to a GUI one, may not recognize the difference between pasted and typed text.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-3692653327290433058?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/3692653327290433058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=3692653327290433058' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/3692653327290433058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/3692653327290433058'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/05/indentation-problem-when-pasting-into.html' title='Indentation problem when pasting into vim and the nopaste option'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-6105809177030699644</id><published>2009-05-03T18:40:00.003+02:00</published><updated>2009-05-03T18:43:16.981+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='gps'/><title type='text'>Java app to send geocaching data to your Nokia phone</title><content type='html'>&lt;p&gt;I have documented a small java app that's useful for me that allows me to send geocaching information from &lt;a href="http://geocaching.com/"&gt;geocaching.com&lt;/a&gt; to Nokia phones. See &lt;a href="http://fornwall.net/landmarksender/"&gt;http://fornwall.net/landmarksender/&lt;/a&gt; for more information.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-6105809177030699644?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/6105809177030699644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=6105809177030699644' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6105809177030699644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6105809177030699644'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/05/java-app-to-send-geocaching-data-to.html' title='Java app to send geocaching data to your Nokia phone'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-7390624476169435667</id><published>2009-04-29T13:45:00.004+02:00</published><updated>2009-05-07T01:03:11.374+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Session variables in postgresql</title><content type='html'>&lt;p&gt;Consider a trigger that would like to prevent certain operations when executed by a web application, while allowing the operations when performed by a nightly batch job.&lt;/p&gt;&lt;p&gt;One way to solve this is to use a kind of session variables. The trigger lets the operation execute normally only if a session variable is set, which the batch job sets at the start of the execution. Below is an example illustrating one implementation for this in PostgreSQL.&lt;/p&gt;&lt;p&gt;First, we define a kind of namespace for our session variable (a &lt;a href="http://www.postgresql.org/docs/8.3/static/runtime-config-custom.html"&gt;customized option or variable class&lt;/a&gt; in postgres lingo) in postgresql.conf:&lt;/p&gt;&lt;pre class="prettyprint"&gt;# comma-separated list of class names:&lt;br /&gt;custom_variable_classes = 'myvariableclass'&lt;/pre&gt;&lt;p&gt;Now, consider the following table:&lt;/p&gt;&lt;pre class="prettyprint"&gt;CREATE TABLE my_table (ID INTEGER);&lt;br /&gt;INSERT INTO my_table VALUES (1);&lt;/pre&gt;&lt;p&gt;A trigger is to prevent DELETE:s from that table unless the session variable &lt;em&gt;myvariableclass.idontcare&lt;/em&gt; is set:&lt;/p&gt;&lt;pre class="prettyprint"&gt;CREATE OR REPLACE FUNCTION prevent_delete_unless_idontcare() RETURNS TRIGGER AS $$&lt;br /&gt;DECLARE&lt;br /&gt;  idontcare TEXT;&lt;br /&gt;BEGIN&lt;br /&gt;  SELECT INTO idontcare CURRENT_SETTING('myvariableclass.idontcare');&lt;br /&gt;  IF (idontcare != 'true') THEN&lt;br /&gt;    RAISE EXCEPTION 'Not allowed to delete unless myvariableclass.idontcare is true';&lt;br /&gt;  END IF;&lt;br /&gt;  RETURN NULL;&lt;br /&gt;END;&lt;br /&gt;$$ LANGUAGE plpgsql;&lt;br /&gt;&lt;br /&gt;CREATE TRIGGER prevent_delete_unless_idontcare_trigger&lt;br /&gt;AFTER DELETE ON my_table&lt;br /&gt;FOR EACH ROW EXECUTE PROCEDURE prevent_delete_unless_idontcare();&lt;/pre&gt;&lt;p&gt;Now let's see it in action:&lt;/p&gt;&lt;pre class="prettyprint"&gt;fornwall=&amp;gt; DELETE FROM my_table;&lt;br /&gt;ERROR:  Not allowed to delete unless myvariableclass.idontcare is true&lt;br /&gt;fornwall=&amp;gt; SELECT SET_CONFIG('myvariableclass.idontcare', 'true', FALSE);&lt;br /&gt; set_config &lt;br /&gt;------------&lt;br /&gt; true&lt;br /&gt;(1 row)&lt;br /&gt;&lt;br /&gt;fornwall=&amp;gt; DELETE FROM my_table;&lt;br /&gt;DELETE 1&lt;/pre&gt;&lt;p&gt;See &lt;a href="http://www.postgresql.org/docs/8.3/static/functions-admin.html#FUNCTIONS-ADMIN-SET-TABLE"&gt;postgres documentation for the current_setting and set_config functions&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-7390624476169435667?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/7390624476169435667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=7390624476169435667' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/7390624476169435667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/7390624476169435667'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/04/session-variables-in-postgresql.html' title='Session variables in postgresql'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-6882986142335722458</id><published>2009-02-23T14:57:00.003+01:00</published><updated>2009-02-23T16:18:31.139+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mobile'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='S60'/><title type='text'>PyS60 script to summarize top persons in SMS inbox and outbox</title><content type='html'>This requires the latest version of PyS60 (1.9.x):&lt;br /&gt;&lt;pre class="prettyprint"&gt;# -*- coding:utf-8 -*-&lt;br /&gt;import appuifw, collections, e32, inbox&lt;br /&gt;&lt;br /&gt;def summarize_box(box, box_name):&lt;br /&gt;    counter = collections.defaultdict(int)&lt;br /&gt;    for message_id in box.sms_messages():&lt;br /&gt;            counter[box.address(message_id)] += 1&lt;br /&gt;&lt;br /&gt;    content = "Persons in " + box_name + ":\n"&lt;br /&gt;    for (name, count) in sorted(counter.iteritems(), key=lambda (x,y):(y,x), reverse=True):&lt;br /&gt;        content += u"%-3d: %s\n" % (count, name)&lt;br /&gt;&lt;br /&gt;    return content&lt;br /&gt;&lt;br /&gt;content = summarize_box(inbox.Inbox(), 'Inbox')&lt;br /&gt;content += "\n"&lt;br /&gt;content += summarize_box(inbox.Inbox(inbox.ESent), 'Sent')&lt;br /&gt;&lt;br /&gt;lock = e32.Ao_lock()&lt;br /&gt;appuifw.app.body = appuifw.Text(content)&lt;br /&gt;appuifw.app.exit_key_handler = lock.signal&lt;br /&gt;lock.wait()&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-6882986142335722458?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/6882986142335722458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=6882986142335722458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6882986142335722458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6882986142335722458'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/02/pys60-script-to-summarize-top-persons.html' title='PyS60 script to summarize top persons in SMS inbox and outbox'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-1532682215187768994</id><published>2009-02-15T02:49:00.004+01:00</published><updated>2009-02-15T02:54:13.461+01:00</updated><title type='text'>Tip: What to try when autocomplete stops working for java in eclipse</title><content type='html'>&lt;p&gt;Suddenly (?) the autocomplete functionality of the java editor in eclipse stopped working. &lt;a href="http://www.google.se/search?q=eclipse+autocomplete+not+working"&gt;Searching for "eclipse autocomplete not working" on google&lt;/a&gt; quickly found a cure:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Go Preferences&gt;Java&gt;Editor&gt;Content Assist&gt;Advanced&lt;/li&gt;&lt;li&gt;Make sure “Other Java Proposals” is ticked&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-1532682215187768994?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/1532682215187768994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=1532682215187768994' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/1532682215187768994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/1532682215187768994'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/02/tip-what-to-try-when-autocomplete-stops.html' title='Tip: What to try when autocomplete stops working for java in eclipse'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-2273956055071352250</id><published>2009-01-21T11:26:00.005+01:00</published><updated>2009-01-27T05:52:17.227+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='postgresql'/><title type='text'>Size of a postgresql database</title><content type='html'>The size of a postgresql database can be obtained using the following query:&lt;br /&gt;&lt;pre class="prettyprint"&gt;$ select pg_size_pretty(pg_database_size('database_name'));&lt;br /&gt; pg_size_pretty &lt;br /&gt;----------------&lt;br /&gt; 70 GB&lt;br /&gt;(1 row)&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-2273956055071352250?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/2273956055071352250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=2273956055071352250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/2273956055071352250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/2273956055071352250'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2009/01/size-of-postgresql-database.html' title='Size of a postgresql database'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-5675376719351246359</id><published>2008-12-08T12:44:00.010+01:00</published><updated>2009-01-26T03:26:16.171+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Adding a search provider for searching Gmail from the browser</title><content type='html'>Adding search engines to the browser (in the top-right search field in most browsers) may be done by creating an xml file containing an &lt;a href="https://developer.mozilla.org/en/Creating_OpenSearch_plugins_for_Firefox"&gt;Opensearch description&lt;/a&gt; and then &lt;a href="https://developer.mozilla.org/en/Adding_search_engines_from_web_pages"&gt;adding them with a javascript method call&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The below button adds a search provider for searching gmail:&lt;br /&gt;&lt;br /&gt;&lt;input value="Add Gmail search provider" onclick="window.external.AddSearchProvider('http://fornwall.net/files/blog/gmail-search-provider.xml');" type="button"&gt;&lt;br /&gt;&lt;br /&gt;The javascript call is &lt;pre class="prettyprint"&gt;window.external.AddSearchProvider('http://fornwall.net/files/blog/gmail-search-provider.xml');&lt;/pre&gt; where the xml file is as follows:&lt;br /&gt;&lt;pre class="prettyprint"&gt;&amp;lt;OpenSearchDescription xmlns=&amp;quot;http://a9.com/-/spec/opensearch/1.1/&amp;quot;&lt;br /&gt;                       xmlns:moz=&amp;quot;http://www.mozilla.org/2006/browser/search/&amp;quot;&amp;gt;&lt;br /&gt;  &amp;lt;ShortName&amp;gt;Gmail&amp;lt;/ShortName&amp;gt;&lt;br /&gt;  &amp;lt;Description&amp;gt;Search Gmail&amp;lt;/Description&amp;gt;&lt;br /&gt;  &amp;lt;InputEncoding&amp;gt;UTF-8&amp;lt;/InputEncoding&amp;gt;&lt;br /&gt;  &amp;lt;Image width=&amp;quot;16&amp;quot; height=&amp;quot;16&amp;quot;&amp;gt;https://mail.google.com/favicon.ico&amp;lt;/Image&amp;gt;&lt;br /&gt;  &amp;lt;Url type=&amp;quot;text/html&amp;quot; method=&amp;quot;GET&amp;quot; template=&amp;quot;https://mail.google.com/mail/#search/{searchTerms}&amp;quot;/&amp;gt;&lt;br /&gt;  &amp;lt;moz:SearchForm&amp;gt;https://mail.google.com/mail/&amp;lt;/moz:SearchForm&amp;gt;&lt;br /&gt;&amp;lt;/OpenSearchDescription&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-5675376719351246359?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/5675376719351246359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=5675376719351246359' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/5675376719351246359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/5675376719351246359'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/12/adding-search-provider-to-firefox-for.html' title='Adding a search provider for searching Gmail from the browser'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-4464001783110299778</id><published>2008-08-09T16:30:00.007+02:00</published><updated>2009-05-07T02:08:19.386+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>"Universal Edit Button" for marking web pages as editable</title><content type='html'>There exists an intresting suggestion for a &lt;a href="http://universaleditbutton.org/Universal_Edit_Button"&gt;Universal Edit Button&lt;/a&gt; on web pages.  Basically, just as the RSS icon &lt;img style="vertical-align: middle;" src="http://universaleditbutton.org/images/a/a7/ExampleRSS.png" /&gt; pops up in the browser address bar when visiting a page with a feed related to it, an edit icon &lt;img style="vertical-align: middle;" src="http://c2.com/wiki.png" /&gt; shows up when visiting an editable page.&lt;br /&gt;&lt;br /&gt;Marking the page as editable is done by adding a &amp;lt;link/&amp;gt; element with content as follows:&lt;blockquote&gt;&lt;pre class="prettyprint"&gt;&amp;lt;link rel="alternate" type="application/wiki" title="Edit this page!" href="wiki?edit=WelcomeVisitors"/&amp;gt;&lt;/pre&gt;&lt;/blockquote&gt;The values of the rel and  type attributes are currently a bit strange and &lt;a href="http://universaleditbutton.org/Suggestions#The_rel_and.2For_type_should_be..."&gt;are being discussed&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Apparently, Wikipedia has already adopted it and there is a &lt;a href="https://addons.wikihow.com/univedit.xpi"&gt;Firefox extension&lt;/a&gt; available to watch it live.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://universaleditbutton.org/images/0/05/UWEBexampleSmall.png" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-4464001783110299778?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/4464001783110299778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=4464001783110299778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/4464001783110299778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/4464001783110299778'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/08/universal-edit-button-for-marking-web.html' title='&quot;Universal Edit Button&quot; for marking web pages as editable'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-6164971937820321300</id><published>2008-08-04T23:18:00.006+02:00</published><updated>2008-11-25T19:55:06.672+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Servlet to create java heap dumps</title><content type='html'>To create a heap dump for analyzing memory usage one needs to use non-portable API:s. This is example code using suns HotSpotDiagnosticMXBean, but using reflection to avoid compile-time dependency on the sun class library:&lt;br /&gt;&lt;pre class="prettyprint"&gt;public class HeapDumpServlet extends HttpServlet {&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {&lt;br /&gt;        File tmpFile = File.createTempFile("heapdump", ".hprof");&lt;br /&gt;        try {&lt;br /&gt;            MBeanServer server = ManagementFactory.getPlatformMBeanServer();&lt;br /&gt;            // use reflection to avoid compile time dependency on sun classes&lt;br /&gt;            String className = "com.sun.management.HotSpotDiagnosticMXBean";&lt;br /&gt;            Class diagClass = Class.forName(className);&lt;br /&gt;            Object diagBean = ManagementFactory.newPlatformMXBeanProxy(server,&lt;br /&gt;                "com.sun.management:type=HotSpotDiagnostic", diagClass);&lt;br /&gt;            Method dumpHeapMethod = diagClass.getMethod("dumpHeap", String.class, boolean.class);&lt;br /&gt;            dumpHeapMethod.invoke(diagBean, tmpFile.getAbsolutePath(), true);&lt;br /&gt;            response.setContentType("application/octet-stream");&lt;br /&gt;            response.addHeader("Content-Disposition", "attachment; filename=heapdump.hprof");&lt;br /&gt;            IOUtils.copy(new FileInputStream(tmpFile), response.getOutputStream());&lt;br /&gt;        } catch (Exception e) {&lt;br /&gt;            response.setContentType("text/plain");&lt;br /&gt;            response.getWriter().println("ERROR: " + e.getMessage() + "\n" + ExceptionUtils.getFullStackTrace(e));&lt;br /&gt;        } finally {&lt;br /&gt;            tmpFile.delete();&lt;br /&gt;        }&lt;br /&gt;    }&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/714307892554290055-6164971937820321300?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/6164971937820321300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=6164971937820321300' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6164971937820321300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6164971937820321300'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/08/creating-java-heap-dumps.html' title='Servlet to create java heap dumps'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-8015526671929026361</id><published>2008-08-04T22:20:00.004+02:00</published><updated>2008-08-04T23:14:32.530+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Monitoring java threads programmatically</title><content type='html'>Using the &lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/package-summary.html"&gt;java.lang.management&lt;/a&gt; package introduced in java 1.5 one may monitor some aspects of the threads of a java process:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Find all active threads and get their stack traces&lt;/li&gt;&lt;li&gt;Find deadlocked threads&lt;/li&gt;&lt;li&gt;Find out what lock a thread is waiting for (and which thread owns it)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;(Optional, depending on JVM): Monitor thread contention - how many times and for how long have each thread waited or blocked&lt;/li&gt;&lt;li&gt;(Optional, depending on JVM): Measure thread CPU time (and how much of that time was spent in user mode)&lt;/li&gt;&lt;/ul&gt;The code to do this looks as follows:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadMXBean.html"&gt;ThreadMXBean&lt;/a&gt; threadBean = &lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ManagementFactory.html"&gt;ManagementFactory&lt;/a&gt;.getThreadMXBean();&lt;br /&gt;if (threadBean.isThreadCpuTimeSupported())&lt;br /&gt;    threadBean.setThreadCpuTimeSupported(true);&lt;br /&gt;if (threadBean.isThreadContentionMonitoringSupported())&lt;br /&gt;    threadBean.setThreadContentionMonitoringEnabled(true);&lt;br /&gt;&lt;br /&gt;out.println("There are " + threadBean.getThreadCount() +&lt;br /&gt;    " threads of which " + threadBean.getDaemonThreadCount() +&lt;br /&gt;    " are daemons.");&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ThreadInfo.html"&gt;ThreadInfo&lt;/a&gt;[] infos&lt;br /&gt;    = threadBean.getThreadInfo(threadBean.getAllThreadIds(), Integer.MAX_VALUE);&lt;br /&gt;&lt;br /&gt;for (ThreadInfo info : infos) {&lt;br /&gt;    out.println("Thread(id=" + info.getThreadId() + "): " +&lt;br /&gt;        info.getThreadName() + ":");&lt;br /&gt;&lt;br /&gt;    out.println("\tState: " + info.getThreadState());&lt;br /&gt;    if (info.getLockOwnerId() != null)&lt;br /&gt;        out.println("\tWaiting on lock " + info.getLockName() + " owned by " + info.getLockOwnerId());&lt;br /&gt;&lt;br /&gt;    if (info.getBlockedTime() != -1) {&lt;br /&gt;        out.println("\tBlocked time: " + (info.getBlockedTime() / 1000.) + " seconds during " +&lt;br /&gt;            info.getBlockedCount() + " blocks");&lt;br /&gt;        out.println("\tWaited time: " + (info.getWaitedTime() / 1000.) + " seconds during " +&lt;br /&gt;            info.getWaitedCount() + " blocks");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    out.println("\tStack trace:");&lt;br /&gt;    for (int j = 0; j &amp;lt; threadInfo.getStackTrace().length; j++) {&lt;br /&gt;        StackTraceElement e = threadInfo.getStackTrace()[j];&lt;br /&gt;        out.println(e.getClassName() + "#" + e.getMethodName() + ":" + e.getLineNumber());&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-8015526671929026361?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/8015526671929026361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=8015526671929026361' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/8015526671929026361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/8015526671929026361'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/08/monitoring-java-threads.html' title='Monitoring java threads programmatically'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-8486100091801068280</id><published>2008-08-04T01:27:00.004+02:00</published><updated>2008-08-04T22:16:50.135+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Better shell scripts: set -u</title><content type='html'>Beginning shell scripts with "set -u" could save you serious time. From bash(1):&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-style: italic;"&gt;Treat unset variables as an error when performing parameter expansion.  If expansion is attempted on an unset variable, the shell prints an error message, and, if not interactive, exits with a non-zero status.&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;Example:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;$&lt;/span&gt; cat hello.sh&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;NAME=$1&lt;br /&gt;echo Hello $NAME&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;$&lt;/span&gt; sh hello.sh&lt;br /&gt;Hello&lt;/pre&gt;&lt;/blockquote&gt;vs&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;$&lt;/span&gt; cat hellou.sh&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;set -u&lt;br /&gt;&lt;br /&gt;NAME=$1&lt;br /&gt;echo Hello $NAME&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;$&lt;/span&gt; sh hellou.sh&lt;br /&gt;hellou.sh: line 5: $1: unbound variable&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-8486100091801068280?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/8486100091801068280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=8486100091801068280' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/8486100091801068280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/8486100091801068280'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/08/better-shell-scripts-set-e-and-set-u.html' title='Better shell scripts: set -u'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-3045659144464166741</id><published>2008-08-02T14:33:00.004+02:00</published><updated>2008-08-11T03:18:12.046+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java thread safety: Memory Consistency Properties</title><content type='html'>From the words-to-live-by department (or, the &lt;a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html#MemoryVisibility"&gt;java.util.concurrent javadoc&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html"&gt;Chapter 17 of the Java Language Specification&lt;/a&gt; defines the &lt;i&gt;happens-before&lt;/i&gt; relation on memory operations such as reads and writes of shared variables.  The results of a write by one thread are guaranteed to be visible to a read by another thread only if the write operation &lt;i&gt;happens-before&lt;/i&gt; the read operation.  The &lt;code&gt;synchronized&lt;/code&gt; and &lt;code&gt;volatile&lt;/code&gt; constructs, as well as the &lt;code&gt;Thread.start()&lt;/code&gt; and &lt;code&gt;Thread.join()&lt;/code&gt; methods, can form &lt;i&gt;happens-before&lt;/i&gt; relationships. In particular:  &lt;ul&gt;&lt;li&gt;Each action in a thread &lt;i&gt;happens-before&lt;/i&gt; every action in that   thread that comes later in the program's order.    &lt;/li&gt;&lt;li&gt;An unlock (&lt;code&gt;synchronized&lt;/code&gt; block or method exit) of a   monitor &lt;i&gt;happens-before&lt;/i&gt; every subsequent lock (&lt;code&gt;synchronized&lt;/code&gt;   block or method entry) of that same monitor. And because   the &lt;i&gt;happens-before&lt;/i&gt; relation is transitive, all actions   of a thread prior to unlocking &lt;i&gt;happen-before&lt;/i&gt; all actions   subsequent to any thread locking that monitor.    &lt;/li&gt;&lt;li&gt;A write to a &lt;code&gt;volatile&lt;/code&gt; field &lt;i&gt;happens-before&lt;/i&gt; every   subsequent read of that same field. Writes and reads of   &lt;code&gt;volatile&lt;/code&gt; fields have similar memory consistency effects   as entering and exiting monitors, but do &lt;em&gt;not&lt;/em&gt; entail   mutual exclusion locking.    &lt;/li&gt;&lt;li&gt;A call to &lt;code&gt;start&lt;/code&gt; on a thread &lt;i&gt;happens-before&lt;/i&gt; any action in the   started thread.    &lt;/li&gt;&lt;li&gt;All actions in a thread &lt;i&gt;happen-before&lt;/i&gt; any other thread   successfully returns from a &lt;code&gt;join&lt;/code&gt; on that thread.  &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;img src="http://www.ibm.com/developerworks/library/j-jtp03304/jsr133.gif" width="336" height="257"/&gt;&lt;br /&gt;The methods of all classes in &lt;code&gt;java.util.concurrent&lt;/code&gt; and its subpackages extend these guarantees to higher-level synchronization. In particular:  &lt;ul&gt;&lt;li&gt;Actions in a thread prior to placing an object into any concurrent   collection &lt;i&gt;happen-before&lt;/i&gt; actions subsequent to the access or   removal of that element from the collection in another thread.    &lt;/li&gt;&lt;li&gt;Actions in a thread prior to the submission of a &lt;code&gt;Runnable&lt;/code&gt;   to an &lt;code&gt;Executor&lt;/code&gt; &lt;i&gt;happen-before&lt;/i&gt; its execution begins.   Similarly for &lt;code&gt;Callables&lt;/code&gt; submitted to an &lt;code&gt;ExecutorService&lt;/code&gt;.    &lt;/li&gt;&lt;li&gt;Actions taken by the asynchronous computation represented by a   &lt;code&gt;Future&lt;/code&gt; &lt;i&gt;happen-before&lt;/i&gt; actions subsequent to the   retrieval of the result via &lt;code&gt;Future.get()&lt;/code&gt; in another thread.    &lt;/li&gt;&lt;li&gt;Actions prior to "releasing" synchronizer methods such as   &lt;code&gt;Lock.unlock&lt;/code&gt;, &lt;code&gt;Semaphore.release&lt;/code&gt;, and   &lt;code&gt;CountDownLatch.countDown&lt;/code&gt; &lt;i&gt;happen-before&lt;/i&gt; actions   subsequent to a successful "acquiring" method such as   &lt;code&gt;Lock.lock&lt;/code&gt;, &lt;code&gt;Semaphore.acquire&lt;/code&gt;,   &lt;code&gt;Condition.await&lt;/code&gt;, and &lt;code&gt;CountDownLatch.await&lt;/code&gt; on the   same synchronizer object in another thread.    &lt;/li&gt;&lt;li&gt;For each pair of threads that successfully exchange objects via   an &lt;code&gt;Exchanger&lt;/code&gt;, actions prior to the &lt;code&gt;exchange()&lt;/code&gt;   in each thread &lt;i&gt;happen-before&lt;/i&gt; those subsequent to the   corresponding &lt;code&gt;exchange()&lt;/code&gt; in another thread.    &lt;/li&gt;&lt;li&gt;Actions prior to calling &lt;code&gt;CyclicBarrier.await&lt;/code&gt;   &lt;i&gt;happen-before&lt;/i&gt; actions performed by the barrier action, and   actions performed by the barrier action &lt;i&gt;happen-before&lt;/i&gt; actions   subsequent to a successful return from the corresponding &lt;code&gt;await&lt;/code&gt;   in other threads.  &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-3045659144464166741?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/3045659144464166741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=3045659144464166741' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/3045659144464166741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/3045659144464166741'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/08/java-thread-safety-memory-consistency.html' title='Java thread safety: Memory Consistency Properties'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-5188130160851164178</id><published>2008-07-23T03:44:00.021+02:00</published><updated>2009-05-20T04:47:26.100+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ichat'/><category scheme='http://www.blogger.com/atom/ns#' term='OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='xmpp'/><category scheme='http://www.blogger.com/atom/ns#' term='pidgin'/><category scheme='http://www.blogger.com/atom/ns#' term='adium'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='dbus'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>Send IM messages from the command line with iChat, Adium or Pidgin</title><content type='html'>&lt;img src="http://fornwall.net/images/blog/terminal-with-iwrite.png" /&gt;&lt;br /&gt;&lt;br /&gt;In my office there was a tradition of using the &lt;a href="http://www.umanitoba.ca/cgi-bin/man.cgi?section=1&amp;amp;topic=zwrite"&gt;zwrite&lt;/a&gt; command line tool for writing IM to eachother. This is useful to send snippets such as&lt;br /&gt;&lt;blockquote&gt;grep FATAL logfile | zwrite coworker&lt;/blockquote&gt;It's quick, avoids tedious copy and paste and allows sending messages from batch run scripts. However, zwrite started to show its age long ago, being difficult to setup on various systems and having poor desktop integration and power.&lt;br /&gt;&lt;br /&gt;Using &lt;a href="http://www.xmpp.org/"&gt;XMPP&lt;/a&gt; (mostly over the &lt;a href="http://www.google.com/talk/"&gt;Google Talk&lt;/a&gt; servers) works nicely, having good native clients, a web client (gmail) and a &lt;a href="http://www.igniterealtime.org/projects/smack/"&gt;great java library&lt;/a&gt; for programmatic access. Missing was a zwrite-like  command line way of sending snippets. I wrote a small shell script working with a running instance of either &lt;a href="http://www.pidgin.im/"&gt;Pidgin&lt;/a&gt; under *nix (using D-Bus python bindings) and &lt;a href="http://www.apple.com/macosx/features/ichat.html"&gt;iChat&lt;/a&gt; or &lt;a href="http://www.adiumx.com/"&gt;Adium&lt;/a&gt; (using applescript) on OS X:&lt;br /&gt;&lt;pre class="prettyprint"&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;test $# -eq 0 &amp;amp;&amp;amp; echo "Usage: echo hi | $0 user [otherusers] " &amp;amp;&amp;amp; exit 1&lt;br /&gt;&lt;br /&gt;export MESSAGE="`cat`"&lt;br /&gt;&lt;br /&gt;while test "$1"; do&lt;br /&gt;&lt;br /&gt;BUDDY=$1&lt;br /&gt;&lt;br /&gt;# aliases&lt;br /&gt;test $BUDDY = friend1 &amp;amp;&amp;amp; BUDDY=friend1.account&lt;br /&gt;test $BUDDY = friend2 &amp;amp;&amp;amp; BUDDY=friend2.account&lt;br /&gt;# ..&lt;br /&gt;&lt;br /&gt;# default to @gmail.com&lt;br /&gt;test `echo $BUDDY | grep @` || BUDDY=$BUDDY@gmail.com&lt;br /&gt;&lt;br /&gt;export BUDDY&lt;br /&gt;&lt;br /&gt;OS=`uname`&lt;br /&gt;if [ "$OS" = "Darwin" ]; then&lt;br /&gt; # use applescript to call either ichat or adium&lt;br /&gt;/usr/bin/osascript &amp;lt;&amp;lt;EOL&lt;br /&gt;set stdinText to do shell script "echo \"\$MESSAGE\"" without altering line endings&lt;br /&gt;&lt;br /&gt;tell application "System Events" to set iChatRunning to (name of processes) contains "iChat"&lt;br /&gt;if iChatRunning then&lt;br /&gt;tell application "iChat"&lt;br /&gt; send stdinText to buddy "$BUDDY"&lt;br /&gt; activate&lt;br /&gt;end tell&lt;br /&gt;else&lt;br /&gt;tell application "System Events" to set adiumRunning to (name of processes) contains "Adium"&lt;br /&gt;if adiumRunning then&lt;br /&gt; tell application "Adium"&lt;br /&gt;  tell the first account of the service "GTalk" to ¬¨&lt;br /&gt;   set newChat to ¬¨&lt;br /&gt;    make new chat with contacts {contact "$BUDDY"} ¬¨&lt;br /&gt;    with new chat window&lt;br /&gt;  send newChat message stdinText&lt;br /&gt;  activate&lt;br /&gt; end tell&lt;br /&gt;else&lt;br /&gt; display dialog "ERROR: You must run either iChat or Adium" buttons "OK" default button "OK"&lt;br /&gt;end if&lt;br /&gt;end if&lt;br /&gt;EOL&lt;br /&gt;else&lt;br /&gt; # calling pidgin over dbus&lt;br /&gt; python -t - &amp;lt;&amp;lt;EOL&lt;br /&gt;import os, sys&lt;br /&gt;try:&lt;br /&gt;import dbus&lt;br /&gt;except ImportError: sys.exit('ERROR: You need dbus with python bindings installed')&lt;br /&gt;&lt;br /&gt;try:&lt;br /&gt;bus = dbus.SessionBus()&lt;br /&gt;service = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")&lt;br /&gt;purple = dbus.Interface(service, "im.pidgin.purple.PurpleInterface")&lt;br /&gt;except: sys.exit('ERROR: Could not connect - is pidgin up and running?')&lt;br /&gt;&lt;br /&gt;xmppAccount = None&lt;br /&gt;for account in purple.PurpleAccountsGetAllActive():&lt;br /&gt;      if 'XMPP' == purple.PurpleAccountGetProtocolName(account): xmppAccount = account&lt;br /&gt;if xmppAccount == None: sys.exit('ERROR: Cannot find any xmpp account')&lt;br /&gt;&lt;br /&gt;recipient = os.environ['BUDDY']&lt;br /&gt;matches = purple.PurpleFindBuddies(xmppAccount, recipient)&lt;br /&gt;if len(matches) == 0: sys.exit('ERROR: Buddy "%s" not found!' % recipient)&lt;br /&gt;&lt;br /&gt;conversationType = 1 # http://developer.pidgin.im/doxygen/dev/html/conversation_8h-source.html#l00051&lt;br /&gt;conversation = purple.PurpleConversationNew(conversationType, xmppAccount, recipient)&lt;br /&gt;im = purple.PurpleConvIm(conversation)&lt;br /&gt;message = os.environ['MESSAGE']&lt;br /&gt;purple.PurpleConvImSend(im, message)&lt;br /&gt;EOL&lt;br /&gt; test $? -ne 0 &amp;amp;&amp;amp; exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;shift&lt;br /&gt;done&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-5188130160851164178?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/5188130160851164178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=5188130160851164178' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/5188130160851164178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/5188130160851164178'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/07/replacement-script-for-zwrite-using.html' title='Send IM messages from the command line with iChat, Adium or Pidgin'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-6908487870355612893</id><published>2008-07-23T03:27:00.005+02:00</published><updated>2008-07-30T20:21:38.897+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><title type='text'>OS X command line tools: open</title><content type='html'>The &lt;a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/open.1.html"&gt;/usr/bin/open&lt;/a&gt; command is a command line utility deriving from NextStep, and &lt;span style="font-style: italic;"&gt;opens a file (or a directory or URL), just as if you had double-clicked the file's icon&lt;/span&gt;. It is the equivalent of the freedesktop &lt;a href="http://portland.freedesktop.org/xdg-utils-1.0/xdg-open.html"&gt;xdg-open&lt;/a&gt; command but has a few options making it a bit more useful:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;-a specifies the application to use, so "&lt;span style="font-style: italic;"&gt;open -a firefox http://osnews.com/&lt;/span&gt;" opens the site in firefox.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;-e  Causes the file to be opened with /Applications/TextEdit&lt;/li&gt;&lt;li&gt;-t  Causes the file to be opened with the default text editor, as determined via LaunchServices&lt;/li&gt;&lt;li&gt;-f  Reads input from standard input and opens the results in the default text editor.  End input by sending EOF character (type Control-D).  Also useful for piping output to open and having it open in the default text editor.&lt;/li&gt;&lt;li&gt;-n  Open a new instance of the application(s) even if one is already running.&lt;/li&gt;&lt;li&gt;-W  Causes open to wait until the applications it opens (or that were already open) have exited.  Use with the -n flag to allow open to function as an appropriate app for the $EDITOR environment variable.&lt;/li&gt;&lt;/ul&gt;Note especially that you can launch applications bundles, so&lt;br /&gt;&lt;blockquote&gt;open $HOME/Downloads/GLTron.app&lt;/blockquote&gt;allows you to try out http://www.gltron.org/ directly after unpacking.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-6908487870355612893?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/6908487870355612893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=6908487870355612893' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6908487870355612893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6908487870355612893'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/07/os-x-command-line-tools-open.html' title='OS X command line tools: open'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-6652047495412659093</id><published>2008-07-17T00:25:00.002+02:00</published><updated>2008-07-30T20:22:11.144+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cool'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><title type='text'>Promising "Cola: Real-Time Shared Editing"</title><content type='html'>With eclipse 3.4 comes ECF (eclipse communications framework) version 2, which allows this:&lt;br /&gt;&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/GfeUCT-tRJQ&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;embed src="http://www.youtube.com/v/GfeUCT-tRJQ&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;The only &lt;a href="http://en.wikipedia.org/wiki/Collaborative_real-time_editor"&gt;"collaborative real-time editor"&lt;/a&gt; I've seen before is &lt;a href="http://www.codingmonkeys.de/subethaedit/"&gt;SubEthaEdit&lt;/a&gt; which is mac-only (and does not have all those IDE features one wants for coding).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-6652047495412659093?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/6652047495412659093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=6652047495412659093' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6652047495412659093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/6652047495412659093'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/07/promising-cola-real-time-shared-editing.html' title='Promising &quot;Cola: Real-Time Shared Editing&quot;'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-2718086869612270313</id><published>2008-07-16T23:59:00.001+02:00</published><updated>2008-07-23T04:29:09.038+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='subversion'/><title type='text'>Eclipse change sets</title><content type='html'>The release of subversion 1.5 brought &lt;a href="http://subversion.tigris.org/svn_1.5_releasenotes.html#changelists"&gt;basic support for "changelists"&lt;/a&gt; in the command-line client. It's a quick and easy way to organize work instead of at commit time having to go through the diffs and trying to remember what belonged to the issue at hand.&lt;br /&gt;&lt;br /&gt;Working in eclipse, I have the need for something similar, and was surprised that up until now I've never noticed the &lt;a href="http://mirror.calvin.edu/eclipse/downloads/drops/R-3.1-200506271435/eclipse-news-part1c.html#TeamCVS"&gt;existing support for change sets in eclipse&lt;/a&gt;. It feels great to "discover" a small but useful feature, even if it is a couple of years old :).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://fornwall.net/images/blog/eclipse-changesets.png" alt="The eclipse synchronize view showing change sets" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-2718086869612270313?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/2718086869612270313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=2718086869612270313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/2718086869612270313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/2718086869612270313'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2008/07/eclipse-change-sets.html' title='Eclipse change sets'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-714307892554290055.post-5677526330385843808</id><published>2006-09-29T23:29:00.000+02:00</published><updated>2008-07-17T00:10:13.147+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>dyndns.com update script</title><content type='html'>&lt;div class="entry"&gt;       &lt;p&gt;For using a dynamic ip address, &lt;a href="http://fornwall.net/blog/dyndns.com"&gt;dyndns.com&lt;/a&gt; provides a great free service. Below is a script which takes care of updating the account host ip periodically, taking care only to update when the local address and host ip differs. It uses &lt;a href="http://fornwall.net/blog/whatismyip.org"&gt;whatismyip.org&lt;/a&gt; for looking up the local ip address - useful if you are sitting behind a router.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;#!/bin/sh&lt;br /&gt;USER=xxx&lt;br /&gt;PASS=xxx&lt;br /&gt;HOST=xxx&lt;br /&gt;HOSTIP=`host $HOST | cut -d ” ” -f4`&lt;br /&gt;MYIP=`wget -q -O - whatismyip.org`&lt;br /&gt;if [ “$HOSTIP” != “$MYIP” ];&lt;br /&gt;then wget –http-user=$USER –http-password=$PASS -O /dev/null \&lt;br /&gt; http://members.dyndns.org:8245/nic/update?system=dyndns&amp;amp;hostname=${HOST}&amp;amp;myip=${MYIP}&amp;amp;wildcard=ON”&lt;br /&gt;fi&lt;/pre&gt;&lt;p&gt; &lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/714307892554290055-5677526330385843808?l=frefo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://frefo.blogspot.com/feeds/5677526330385843808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=714307892554290055&amp;postID=5677526330385843808' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/5677526330385843808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/714307892554290055/posts/default/5677526330385843808'/><link rel='alternate' type='text/html' href='http://frefo.blogspot.com/2006/09/dyndnscom-update-script.html' title='dyndns.com update script'/><author><name>Fredrik</name><uri>http://www.blogger.com/profile/03408738528764957060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
