<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/templates/default/atom.css" type="text/css" ?>

<feed 
   xmlns="http://www.w3.org/2005/Atom"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    
    <link href="http://daniel-lange.com/feeds/atom10.xml" rel="self" title="Daniel Lange's blog" type="application/atom+xml" />
    <link href="http://daniel-lange.com/"                        rel="alternate"    title="Daniel Lange's blog" type="text/html" />
    <link href="http://daniel-lange.com/rss.php?version=2.0"     rel="alternate"    title="Daniel Lange's blog" type="application/rss+xml" />
    <title type="html">Daniel Lange's blog</title>
    <subtitle type="html">agrep -pB IT /dev/life</subtitle>
    <icon>http://daniel-lange.com/templates/bulletproof/img/s9y_banner_small.png</icon>
    <id>http://daniel-lange.com/</id>
    <updated>2012-02-04T08:28:39Z</updated>
    <generator uri="http://www.s9y.org/" version="1.6">Serendipity 1.6 - http://www.s9y.org/</generator>
    <dc:language>en</dc:language>

    <entry>
        <link href="http://daniel-lange.com/archives/64-Creating-iPhoneiPodiPad-notes-from-the-shell.html" rel="alternate" title="Creating iPhone/iPod/iPad notes from the shell" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2012-02-04T08:00:00Z</published>
        <updated>2012-02-04T08:28:39Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=64</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=64</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/7-Open-Source" label="Open Source" term="Open Source" />
    
        <id>http://daniel-lange.com/archives/64-guid.html</id>
        <title type="html">Creating iPhone/iPod/iPad notes from the shell</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I found a very nice script to create Notes on the iPhone from the command line by <a href="http://www.perlmonks.org/?node_id=123291" title="hossman's profile at Perlmonks">hossman</a> over at <a href="http://www.perlmonks.org/?node_id=851322" title="Manipulate iPhone 'Notes' folders by hossman">Perlmonks</a>.</p>

<p>For some weird reason Perlmonks does not allow me to reply with amendments even after I created an <a href="http://www.perlmonks.org/?node_id=951767" title="proof ... my Perlmonks account">account</a>. I can "preview" a reply at Perlmonks but after "create" I get "Permission Denied". Duh. <a href="http://www.perlmonks.org/?node=vroom" title="Perlmonk abbot">vroom</a>, if you want screenshots, contact me on IRC <img src="http://daniel-lange.com/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" />.</p>

<p>As I wrote everything up for the Perlmonks reply anyways, I'll post it here instead.</p>

<p>Against hossman's version 32 from 2011-02-22 I changed the following:</p>

<ul>
<li>removed .pl from filename and documentation</li>
<li>added --list to list existing notes</li>
<li>added --hosteurope for Hosteurope mail account preferences and with it a sample how to add username and password into the script for unattended use</li>
<li>made the "Notes" folder the default (so -f Notes becomes obsolete)</li>
<li>added some UTF-8 conversions to make Umlauts working better (this is a mess in perl, see <a href="http://jeremy.zawodny.com/blog/archives/010546.html" title="Blog entry: The Perl UTF-8 and utf8 Encoding Mess">Jeremy Zawodny's writeup</a> and <a href="http://ahinea.com/en/tech/perl-unicode-struggle.html" title="Blog entry: Unicode-processing issues in Perl and how to cope with it">Ivan Kurmanov's blog entry</a> for some further solutions)</li>
</ul>

<p>I /msg'd hossman the URL of this blog entry.</p>
 <br /><a href="http://daniel-lange.com/archives/64-Creating-iPhoneiPodiPad-notes-from-the-shell.html#extended">Continue reading "Creating iPhone/iPod/iPad notes from the shell"</a>
            </div>
        </content>
        <dc:subject>imap</dc:subject>
<dc:subject>iphone</dc:subject>
<dc:subject>notes</dc:subject>
<dc:subject>perl</dc:subject>
<dc:subject>script</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/59-Apple-iPhone-ring-tones-Linux-style.html" rel="alternate" title="Apple iPhone ring tones Linux style" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2011-03-27T09:55:00Z</published>
        <updated>2011-03-27T11:57:13Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=59</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=59</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/7-Open-Source" label="Open Source" term="Open Source" />
    
        <id>http://daniel-lange.com/archives/59-guid.html</id>
        <title type="html">Apple iPhone ring tones Linux style</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Apple has crippled the iPhone to not allow normal music files as ringtones. Business decision. Technically any sub 40 second MP4 audio file will do once you rename it to <code>*.m4r</code> and drag-and-drop it to the ringtones folder of your phone in iTunes. Longer ones will work, too. But you'd need a jailbroken iPhone for that as iTunes will refuse to transfer the ringtone file if it's too long. Not much of an issue imho, who keeps ringing your phone for 40 seconds or more?</p>

<p>There's a gazillion websites available telling you how to convert a single .mp3-file to a ringtone with or without iTunes help and there are hundreds of tools doing that for you if you can't find out how to do it with just iTunes itself. Still the ones I tried failed for me as I wanted to convert my 20 or so standard ringtones from the good old Motorola K3 to iPhone ringtones all in one go. Without having to edit each one by hand. They are already nice ringtones and have served me well for years, just too long for the iPhone and in .mp3 format.</p>

<p>The basic processing sequence needed is</p>

<ol>
<li>Cut the .mp3 down to 39s</li>
<li>Convert the .mp3 -> .wav (with mplayer, normalize output gain while we're at it)</li>
<li>Convert the .wav -> .mp4 (with facc)</li>
<li>Clean up, GOTO 1 for next file</li>
</ol>

<p>So below is the free shell script to create multiple ringtones in one go on any Linux system. You need to install cutmp3, mplayer and faac for it, so <code>apt-get install cutmp3 mplayer faac</code> on Debian or Ubuntu. cutmp3 is currently not in the portage tree for Gentoo, but you can download an ebuild from <a href="http://www.fn-clan.de/downloads/gentoo/poly-c_overlay/media-sound/cutmp3/" title="Ebuild for cutmp3">Polynomial-C's overlay</a> (<a href="http://gentoo-overlays.zugaina.org/poly-c/portage/media-sound/cutmp3/" title="Poly-C mirror at gentoo-overlays.zugaina.org">mirror</a>). Or you just download the cutmp3 binary from <a href="http://www.puchalla-online.de/cutmp3.html" title="download Cutmp3 from the author's homepage">Jochen Puchalla's homepage</a>. There's no error checking in the script, so know your way around the shell before running it.</p>

<p>Without further ado:</p>

<div class="bash geshi" style="text-align: left"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br /><span style="color: #666666; font-style: italic;">#</span><br /><span style="color: #666666; font-style: italic;"># convert_to_ringtone file1.mp3 [file2.mp3, ...]</span><br /><span style="color: #666666; font-style: italic;"># Placed into the public domain by Daniel Lange, 2011.</span><br /><span style="color: #666666; font-style: italic;">#</span><br /><br /><span style="color: #000000; font-weight: bold;">for</span> arg<br /><span style="color: #000000; font-weight: bold;">do</span><br />&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Processing <span style="color: #007800;">$arg</span>...&quot;</span><br />&#160; &#160; &#160; &#160; cutmp3 <span style="color: #660033;">-c</span> <span style="color: #660033;">-a</span> <span style="color: #000000;">0</span>:<span style="color: #000000;">0.0</span> <span style="color: #660033;">-b</span> <span style="color: #000000;">0</span>:<span style="color: #000000;">39.0</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$arg</span>&quot;</span> <span style="color: #660033;">-O</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$arg</span>.tmp&quot;</span><br />&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">mplayer</span> <span style="color: #660033;">-vo</span> null <span style="color: #660033;">-vc</span> null <span style="color: #660033;">-af</span> volnorm <span style="color: #660033;">-ao</span> pcm:fast:<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">file</span></span>=tmpfile.wav <span style="color: #ff0000;">&quot;<span style="color: #007800;">$arg</span>.tmp&quot;</span><br />&#160; &#160; &#160; &#160; faac <span style="color: #660033;">-b</span> <span style="color: #000000;">128</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">44100</span> <span style="color: #660033;">-w</span> tmpfile.wav<br />&#160; &#160; &#160; &#160; <span style="color: #007800;">name</span>=<span style="color: #000000;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$arg</span><span style="color: #000000;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/.mp3//g'</span><span style="color: #000000;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/ /_/g'</span><span style="color: #000000;">`</span><br />&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">mv</span> tmpfile.m4a <span style="color: #007800;">$name</span>.m4r<br />&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">rm</span> tmpfile.wav<br />&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$arg</span>.tmp&quot;</span><br />&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$arg</span> done.&quot;</span><br /><span style="color: #000000; font-weight: bold;">done</span><br />&#160;</div>

<p><a class="serendipity_image_link" title="Apple 1984 ad. When they we're thinking different." href='http://en.wikipedia.org/wiki/1984_(advertisement)' target="_blank"><!-- s9ymdb:535 --><img class="serendipity_image_center" width="305" height="228"  src="http://daniel-lange.com/uploads/Apple1984.jpg" title="Apple 1984 ad. When they were thinking differently." alt="Wikipedia article on Apple's 1984 ad." /></a></p>
 
            </div>
        </content>
        <dc:subject>apple</dc:subject>
<dc:subject>convert</dc:subject>
<dc:subject>iphone</dc:subject>
<dc:subject>mp3</dc:subject>
<dc:subject>mp4</dc:subject>
<dc:subject>ringtone</dc:subject>
<dc:subject>script</dc:subject>
<dc:subject>shell</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/57-Internations-Greasemonkey-script-to-enlarge-user-images-on-mouse-over.html" rel="alternate" title="Internations Greasemonkey script to enlarge user images on mouse over" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2010-11-19T14:00:00Z</published>
        <updated>2011-11-20T12:11:49Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=57</wfw:comment>
    
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=57</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/1-Private" label="Private" term="Private" />
    
        <id>http://daniel-lange.com/archives/57-guid.html</id>
        <title type="html">Internations Greasemonkey script to enlarge user images on mouse over</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>We've recently relocated to Beijing, China. A fellow expatriate invited me to <a href="http://www.internations.org" title="Internations web page">Internations</a> which is basically Xing with a focus on people living (or having lived) abroad. As I've used the <a href="http://daniel-lange.com/archives/24-Greasemonkey-to-enlarge-Xing-pictures.html" title="Blog entry on the Xing Greasemonkey script">Xing Greasemonkey script</a> to enlarge user images on mouse over for years now, I missed that function  on Internations immediately.</p>

<p>So I created a derivative of the Xing script which you can download <a href="http://daniel-lange.com/software/internations_userimages.user.js" title="Greasemonkey script to enlarge user images on the Internations web pages. Click to install.">here (2kB), v1.1</a>.</p>

<p><!-- s9ymdb:532 --><img class="serendipity_image_center" width="429" height="260"  src="http://daniel-lange.com/uploads/entries/101119_internations_mouseover.jpg" title="Internations web page with Greasemonkey user image script installed" alt="Screenshot of the Internations web page" /></p>

<p>You need to install the <a href="http://www.greasespot.net/" title="Greasespot - Greasemonkey homepage">Greasemonkey</a> <a href="https://addons.mozilla.org/firefox/addon/748/" title="Firefox Addon page for Greasemonkey">Firefox Addon</a> and then click on the above download link to get the script which will automatically be active on Internations.</p>

<p>If you care, my shiny new Internations profile can be found <a href="http://www.internations.org/users/profile_general/240255" title="Daniel's page on Internations">here</a>.</p>

<h3>Updates:</h3>

<p>07.10.11 Updated to v1.1 to support Internations new NetDNA Content Distribution Network (in-cdn.net) URLs. Thanks to Marc for the prod via the comment below.</p>

<p>20.11.11 I've seen a new URL scheme in <a href="http://img.in-cdn.net/2011/11/16/9fa12e28400085e06a24ddaaf195ae65_p9260002_e__5.jpg">this image</a>. URL ending in _e__x.jpg. If that's not an error but a new scheme, I'll update the script to support it.</p>
 
            </div>
        </content>
        <dc:subject>greasemonkey</dc:subject>
<dc:subject>internations</dc:subject>
<dc:subject>javascript</dc:subject>
<dc:subject>xing</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/55-MINI-key-chrome-ring.html" rel="alternate" title="MINI key chrome ring" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2010-07-25T11:25:39Z</published>
        <updated>2010-07-28T18:41:47Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=55</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=55</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/3-Vehicles" label="Vehicles" term="Vehicles" />
    
        <id>http://daniel-lange.com/archives/55-guid.html</id>
        <title type="html">MINI key chrome ring</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>The key on my girlfriend's MINI had to be replaced as the remote control parts of it decided to cease functioning.</p>

<p>The key is an interesting piece of engineering as it communicates with the car wireless, charges via electromagnetic induction and has a standard key quite elegantly <a href="http://www.topspeed.com/cars/car-news/2007-mini-cooper-key-features-ar27958.html" title="Topgear: Mini Cooper Key Features">hidden inside</a>.</p>

<p>When the replacement key arrived it was already bruised on the chrome ring. So I went "duh, another two weeks wait on the next key" but the dealer just smiled, removed the chrome ring and replaced it with a new one.</p>

<p>Playing around with the key it had not occurred to me that the (quite easily scratched and bruised) chrome ring can simply be replaced.</p>

<p>So I figured, I'd document it:
Using (strong enough) fingernails or a plastic or wooden spatula you can carefully remove the chrome ring from you MINI key and replace / refurbish / re-paint it.  Work from one side. Push up as the chrome ring is open only on one side. There are four 8mm wide notches at 55° measured from the longitudinal axes of the key below the chrome ring. If you get your spatula locked in there you can easily leverage the chrome ring off the black plastic body of the key. Before you break things ask somebody with more manual skill to help you or pay a visit to your car dealer's spare parts desk.</p>

<p>The chrome ring as a spare part should be somewhat affordable as well. But I think being able to grind the ring and paint it matching the color of your MINI is a much cooler option. Please leave a comment / send a picture if you do this.</p>

<p><a class="serendipity_image_link" title="MINI key taken apart" href='http://daniel-lange.com/uploads/entries/100725_MINI_Key_disassembled.jpg' onclick="F1 = window.open('/uploads/entries/100725_MINI_Key_disassembled.jpg','Zoom','height=3015,width=4015,top=-900,left=-1040,toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes'); return false;"><!-- s9ymdb:531 --><img class="serendipity_image_left" width="110" height="83"  src="http://daniel-lange.com/uploads/entries/100725_MINI_Key_disassembled.serendipityThumb.jpg" title="MINI key taken apart" alt="" /></a>The engineer in me demanded to take the broken key apart. The inner shell is quite sturdy and the halves are tightly molded into each other, so removing the electronics will quite likely break the thing. Don't do it. But my girlfriend's was broken already, so this is what it looks inside.</p>
 
            </div>
        </content>
        <dc:subject>chrome</dc:subject>
<dc:subject>disassemble</dc:subject>
<dc:subject>key</dc:subject>
<dc:subject>mini</dc:subject>
<dc:subject>remove</dc:subject>
<dc:subject>replace</dc:subject>
<dc:subject>ring</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html" rel="alternate" title="Keeping IRC nicks active" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2010-05-18T21:50:00Z</published>
        <updated>2010-05-18T22:38:43Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=54</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=54</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/15-IRC" label="IRC" term="IRC" />
    
        <id>http://daniel-lange.com/archives/54-guid.html</id>
        <title type="html">Keeping IRC nicks active</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Typical IRC services usually allow you to register with nickserv and link a number of nicks to a personal account. It's quite common to have nick, nick_ and nick__ as many IRC clients auto-append underscores if the primary nickname is already in use when connecting. Obviously you can set these alternate nicknames to almost anything you like in a decent client.</p>

<p>Some folks also group a "vanity" nickname or two for whatever reason. To keep these active, people do the "nick shuffle" (/nick newnick, /nick oldnick) all the time:</p>

<p><!-- s9ymdb:530 --><img class="serendipity_image_center" width="967" height="79" src="http://daniel-lange.com/uploads/entries/100309_freenode_nick_shuffle.png"  alt="nick shuffle on freenode" /></p>

<p>People who forget the occasional nick shuffle may end up losing a grouped nick because it became inactive. While freenode staff try to contact people before dropping linked nicks, there are occasional prunes of "old data" from the services database. And then nobody can really ask upfront.</p>

<p>So before the next big purge comes up, I wrote a small bash script that logs into a nickserv account and cycles through the linked nicks.
A few friends and me have used it successfully for many months now.</p>

<p>Grab a copy of <a href="http://daniel-lange.com/software/keepnick" title="keepnick bash script">keepnick (2.4kB)</a> and drop it into /usr/local/bin.</p>

<p>Keepnick expects to have an accountname, the corresponding password and then a sequence of linked nicks given on its command line.</p>

<p>Something like</p>

<div class="bash geshi" style="text-align: left"><span style="color: #000000;">/</span>usr<span style="color: #000000;">/</span>local<span style="color: #000000;">/</span>bin keepnick accountname passw0rd linked_nick linked_nick_ vanity_nick MyOtherNick</div>

<p>should work.</p>

<p>For regular use, you need to set up a cron job to call keepnick e.g. every week. So put something like the following script into <code>/etc/cron.weekly/keepnicks_irc</code> or create a corresponding crontab entry for <code>keepnicks_irc</code> if you do not have the convenient cron.* directories set up:</p>

<div class="bash geshi" style="text-align: left"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br /><span style="color: #666666; font-style: italic;">#</span><br /><span style="color: #666666; font-style: italic;"># run keepnick for user(s) irc account(s)</span><br /><span style="color: #666666; font-style: italic;"># intended to be run from cron, e.g. through /etc/cron.weekly</span><br /><span style="color: #666666; font-style: italic;">#</span><br /><br /><span style="color: #007800;">KEEPNICK</span>=<span style="color: #ff0000;">&quot;/usr/local/bin/keepnick&quot;</span><br /><span style="color: #666666; font-style: italic;"># better safe than sorry</span><br /><span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin&quot;</span><br /><span style="color: #7a0874; font-weight: bold;">export</span> PATH<br /><br /><span style="color: #007800;">$KEEPNICK</span> accountname1 passw0rd1 linked_nick1 linked_nick1_ linked_nick1__<br /><span style="color: #007800;">$KEEPNICK</span> accountname2 passw0rd2 linked_nick1 linked_nick2_ linked_nick2__<br />&#160;</div>

<p>You should see keepnick in action now every week like this:</p>

<p><!-- s9ymdb:529 --><img class="serendipity_image_center" width="758" height="68"  src="http://daniel-lange.com/uploads/entries/100306_keepnick_in_action.png"  alt="keepnick in action" /></p>

<p>What happens here is that the IRC services package tells you, keepnick has just authenticated to your account and will now shuffle through all nicks you asked it to.
The big advantage is that is does this outside of channels, so not annoying any users. The cron job should make sure you don't forget the nick shuffle anymore.</p>

<h2>Making sure your bash supports network connections</h2>

<p>Stock bash will support network connections but on Debian and old (=pre-karmic) Ubuntu that capability was disabled at compile time.</p>

<p>If you need to check whether your bash is compiled with network support, type <code>cat &lt; /dev/tcp/time.nist.gov/13</code> into a bash terminal.</p>

<p>In case that gives you a <a href="http://www.nist.gov/physlab/div847/grp40/its.cfm" title="NIST Internet time service">RFC-867 time string</a>, you're all fine.
If not, re-compile your bash with <code>--enable-net-redirections</code>.</p>

<p>Now for something more advanced (but entirely optional):</p>
 <br /><a href="http://daniel-lange.com/archives/54-Keeping-IRC-nicks-active.html#extended">Continue reading "Keeping IRC nicks active"</a>
            </div>
        </content>
        <dc:subject>account</dc:subject>
<dc:subject>active</dc:subject>
<dc:subject>bash</dc:subject>
<dc:subject>cron</dc:subject>
<dc:subject>freenode</dc:subject>
<dc:subject>irc</dc:subject>
<dc:subject>network</dc:subject>
<dc:subject>nick</dc:subject>
<dc:subject>script</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/53-Binding-applications-to-a-specific-IP.html" rel="alternate" title="Binding applications to a specific IP" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2010-01-09T19:00:00Z</published>
        <updated>2010-10-29T08:25:14Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=53</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=53</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/8-Linux" label="Linux" term="Linux" />
    
        <id>http://daniel-lange.com/archives/53-guid.html</id>
        <title type="html">Binding applications to a specific IP</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>These days many systems are multi-homed in the sense that they have more than one IP address bound at the same time.<br />
I.e. for different network cards, virtual IPs for shared servers or just using WiFi and a wired network connection at the same time on a laptop.</p>

<p>Murphy of course makes sure that your system will choose to worst IP (i.e. that on slow WiFi or the one reserved for admin access) when an application does not specifically supports binding to a selected IP address.
And Mozilla Firefox for example doesn't.</p>

<p>The kernel chooses an outgoing IP from those in the routing table with the same metric:</p>

<pre><code>daniel@server:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.0.2.1         0.0.0.0         U     0      0        0 eth0
0.0.0.0         192.0.2.2         0.0.0.0         U     0      0        0 eth1
0.0.0.0         192.0.2.3         0.0.0.0         U     0      0        0 eth2
0.0.0.0         192.0.2.4         0.0.0.0         U     0      0        0 eth3
</code></pre>

<p>You can obviously play around with the metric and make the kernel router prefer the desired interface above others. This will affect all applications though.
Some people use the firewall to nat all packages to port 80 onto the network interface desired for web browsing. Gee, beware the http://somewebsite.tld:8080 links...</p>

<p>Thankfully <a href="http://www.ryde.net" title="Daniel Ryde's homepage">Daniel Ryde</a> has solved the problem via a LD_PRELOAD shim. With his code you can run</p>

<div class="bash geshi" style="text-align: left">daniel<span style="color: #000000;">@</span>laptop:~$ <span style="color: #007800;">BIND_ADDR</span>=<span style="color: #ff0000;">&quot;192.0.2.100&quot;</span> <span style="color: #007800;">LD_PRELOAD</span>=<span style="color: #000000;">/</span>usr<span style="color: #000000;">/</span>lib<span style="color: #000000;">/</span>bind.so firefox <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div>

<p>and happily surf away.</p>

<p>To compile <a href="http://www.ryde.net/code/bind.c.txt" title="Bind.c LD_PRELOAD wrapper">his code</a> (3.3kB, <a href="http://daniel-lange.com/software/bind.c" title="Local copy of Daniel Ryde's Bind.c LD_PRELOAD wrapper">local copy</a>, see note 1)
you need to run</p>

<div class="bash geshi" style="text-align: left"><span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-nostartfiles</span> <span style="color: #660033;">-fpic</span> <span style="color: #660033;">-shared</span> bind.c <span style="color: #660033;">-o</span> bind.so <span style="color: #660033;">-ldl</span> -D_GNU_SOURCE<br /><span style="color: #c20cb9; font-weight: bold;">strip</span> bind.so<br /><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-i</span> bind.so <span style="color: #000000;">/</span>usr<span style="color: #000000;">/</span>lib<span style="color: #000000;">/</span></div>

<p>and you're set to go.</p>

<p>If you don't have gcc available (and trust me) you can download pre-compiled 32bit and 64bit (glibc-2) bind.so libraries <a href="http://daniel-lange.com/software/bind_so_compiled.tar.gz" title="Pre-compiled 32bit and 64bit bind.so libs">here</a> (4.5kB).</p>

<p>I guess because Daniel Ryde hid his code so well on his webpage, Robert J. McKay wrote another LD_PRELOAD shim, called <a href="http://wari.mckay.com/~rm/bindhack.c.txt" title="Bindhack.c LD_PRELOAD wrapper">Bindhack</a> (4.5kB, <a href="http://daniel-lange.com/software/bindhack.c" title="Local mirror of Robert J. McKay's Bindhack.c LD_PRELOAD wrapper">local mirror</a>). This will - as is - only compile on 32bit machines. But YMMV.</p>

<p>Run the above command <strong>(*)</strong> with your desired (and locally bound) IP address in bash and visit <a href="http://myip.dk" title="MyIP.dk show-your-ip service">MyIP.dk</a> or <a href="http://showip.be/" title="ShowIP.be show-your-ip service">ShowIP.be</a> or any of the other services that show your external IP to see whether you've succeeded.</p>

<p>Notes:</p>

<ol>
<li>Daniel Ryde did not specify the -D_GNU_SOURCE in the comments section of bind.c. Modern glibc/gcc need that as he used RTLD_NEXT which is Unix98 and not POSIX. I amended the local copy of bind.c and sent him an email so he can update his.</li>
<li>Both are IPv4 only, no IPv6 support.</li>
</ol>

<h3>Updates:</h3>

<p>29.11.10 Catalin M. Boie wrote another LD_PRELOAD shim, <a href="http://kernel.embedromix.ro/us/" title="Catalin(ux) Homepage">force_bind</a>. I have not tested this one. It's capable of handling IPv6 binds.</p>

<p>11.01.09 Daniel Ryde has replied to my email and updated his local copy now as well.</p>
 
            </div>
        </content>
        <dc:subject>address</dc:subject>
<dc:subject>bind</dc:subject>
<dc:subject>ip</dc:subject>
<dc:subject>ld_preload</dc:subject>
<dc:subject>multi-homed</dc:subject>
<dc:subject>network</dc:subject>
<dc:subject>updated</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/52-Ubuntu-Karmic-9.10-Bluetooth-UMTS-Dial-up-DUN.html" rel="alternate" title="Ubuntu Karmic 9.10 Bluetooth UMTS Dial-up (DUN)" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-12-21T17:10:00Z</published>
        <updated>2009-12-21T16:38:43Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=52</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=52</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/8-Linux" label="Linux" term="Linux" />
    
        <id>http://daniel-lange.com/archives/52-guid.html</id>
        <title type="html">Ubuntu Karmic 9.10 Bluetooth UMTS Dial-up (DUN)</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Using a mobile phone's Bluetooth Dial-up network (DUN) to connect to the Internet (UMTS/GPRS) while on the road is quite convenient for me. Sadly so this is not supported out-of-the-box in Ubuntu Karmic 9.10 (Netbook Remix) as it uses Network-Manager to handle - well - network connections. And that is <a href="https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/269329" title="Ubuntu bug #269329 - NM 0.7 lacks bluetooth 3g support" target="_blank">not quite there on Bluetooth managed devices yet</a>.</p>

<p>While the default solution (rfcomm and Gnome-PPP) still works, it's ugly to set up. Sadly so, zillions of Ubuntu-Forum threads and blog entries still detail this solution - or the issues encountered with it along the way.</p>

<p>The much better solutions is using <a href="http://blueman-project.org" title="Blueman GTK+ Bluetooth solution" target="_blank">Blueman</a>, an improved Gnome-Bluetooth primarily developed by Valmantas Palikša. It brings the right UDEV magic along to teach Network-Manager about the Bluetooth devices it handles.</p>

<div class="serendipity_imageComment_right" style="width: 724px"><div class="serendipity_imageComment_img"><!-- s9ymdb:528 --><img class="serendipity_image_right" width="724" height="462"  src="http://daniel-lange.com/uploads/entries/091221_Blueman_Ubuntu.png" alt="" /></div><div class="serendipity_imageComment_txt">Blueman Screenshot on Ubuntu Karmic 9.10 Netbook Edition</div></div>

<p>Just follow the steps on their <a href="http://blueman-project.org/downloads.html" title="Blueman downloads (and - more important - instructions for various distributions)" target="_blank">downloads page</a> to set up the Blueman PPA (Personal Package Archive) to get things working.</p>
 
            </div>
        </content>
        <dc:subject>bluetooth</dc:subject>
<dc:subject>dial-up</dc:subject>
<dc:subject>dun</dc:subject>
<dc:subject>gprs</dc:subject>
<dc:subject>network</dc:subject>
<dc:subject>network-manager</dc:subject>
<dc:subject>ubuntu</dc:subject>
<dc:subject>umts</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/51-Kubuntu-9.10-karmic-64bit-firefox-java-plugin.html" rel="alternate" title="Kubuntu 9.10 (karmic) 64bit firefox java plugin" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-12-06T17:00:00Z</published>
        <updated>2009-12-06T16:21:07Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=51</wfw:comment>
    
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=51</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/8-Linux" label="Linux" term="Linux" />
    
        <id>http://daniel-lange.com/archives/51-guid.html</id>
        <title type="html">Kubuntu 9.10 (karmic) 64bit firefox java plugin</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>For some unknown reason the (K)Ubuntu developers did not update the Java plugin for firefox after jaunty (yet?).</p>

<p>The version that Karmic (9.10) pulls out of the multiverse repository is still jaunty's (9.04).</p>

<p>So when you try:</p>

<div class="bash geshi" style="text-align: left"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sun-java6-plugin</div>

<p>you'll get something like
<blockquote>
<pre><code>   Reading package lists... Done
   Building dependency tree
   Reading state information... Done
   Some packages could not be installed. This may mean that you have
   requested an impossible situation or if you are using the unstable
   distribution that some required packages have not yet been created
   or been moved out of Incoming.
   The following information may help to resolve the situation:

   The following packages have unmet dependencies:
     sun-java6-plugin: Depends: sun-java6-bin (= 6-15-1) but 6-16-0ubuntu1.9.04 is to be installed
   E: Broken packages
</code></pre>
</blockquote></p>

<p>Duh.</p>

<p>Actually if you have the Java Runtime Environment (JRE, package name <code>sun-java6-jre</code>) installed all files needed are already present.<br />
Just not put in the right place on the filesystem.</p>

<p>So, run:</p>

<div class="bash geshi" style="text-align: left"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sun-java6-jre &#160; <span style="color: #666666; font-style: italic;"># install JRE if needed</span><br /><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000;">/</span>usr<span style="color: #000000;">/</span>lib<span style="color: #000000;">/</span>jvm<span style="color: #000000;">/</span>java-<span style="color: #000000;">6</span>-sun<span style="color: #000000;">/</span>jre<span style="color: #000000;">/</span>lib<span style="color: #000000;">/</span>amd64<span style="color: #000000;">/</span>libnpjp2.so <span style="color: #000000;">/</span>usr<span style="color: #000000;">/</span>lib<span style="color: #000000;">/</span>mozilla<span style="color: #000000;">/</span>plugins<span style="color: #000000;">/</span></div>

<p>This will install the JRE (if it's not already installed) and will symlink the firefox plugin for java in place so that it'll be found after a browser restart.</p>
 
            </div>
        </content>
        <dc:subject>64bit</dc:subject>
<dc:subject>firefox</dc:subject>
<dc:subject>java</dc:subject>
<dc:subject>karmic</dc:subject>
<dc:subject>kubuntu</dc:subject>
<dc:subject>mozilla</dc:subject>
<dc:subject>plugin</dc:subject>
<dc:subject>ubuntu</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/50-Summer-Fun.html" rel="alternate" title="Summer Fun" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-12-06T16:10:00Z</published>
        <updated>2009-12-06T16:18:24Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=50</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=50</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/5-BMW" label="BMW" term="BMW" />
    
        <id>http://daniel-lange.com/archives/50-guid.html</id>
        <title type="html">Summer Fun</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>In case you wondered about the lack of activity here over the summer...</p>

<p>I've been working with the motorbikes unit of the company quite a bit as of late. They are great people and thus got me a bit enticed to try out their products.
So I ordered myself a BMW K1300S.</p>

<p>And wow. This is simply the best bike I've ever ridden.
It's extremely powerful while still agile and easy to maneuver. It's comfortable enough for a day ride and fun enough to take to the track.</p>

<p>The German newspaper FAZ found it <a href="http://www.faz.net/s/Rub9AE899D74FA64E1C97C29D196E8EB0BB/Doc~EA467DB18CA0D4FB98E78649733BA3702~ATpl~Ecommon~Scontent.html" title="FAZ article "Jetzt ist sie aber wirklich gut" (GERMAN)" target="_blank">flawless except for the price</a>. I'd second that. It's nearly perfect. The small improvement I'd like on the 2010 model: make the windshield a little higher. The air flow basically ends up right on the helmet if you're above 6 ft. (1.82 m) tall.
But that's really a minor issue, I'm sure accessory developers will take care of it if BMW doesn't.</p>

<p>I got the bike with all the electronic gadgetry available so it has ESA II (Electronic Suspension Adjustment), Quickshift (so one can switch gears up without using the clutch), on-board computer, tire pressure monitor and (...yes I know...) handle bar heating (to save me: the bike was pre-configured when I ordered), ASC, ABS, whatever. Being a geek that's fine: lotsa knobs to play with. After 7 months I have to say none of these are really needed but none are completely useless either.</p>

<div class="serendipity_imageComment_center" style="width: 1024px"><div class="serendipity_imageComment_img"><!-- s9ymdb:527 --><img class="serendipity_image_center" width="1024" height="682"  src="http://daniel-lange.com/uploads/entries/BMW_K1300S.jpg" alt="Daniel's BMW K1300S" /></div><div class="serendipity_imageComment_txt">My K1300S: 1,293cc, water-cooled four-stroke straight-four engine, DOHC, four valves per cylinder; 175bhp at 9,250rpm; 140Nm at 8,250rpm; 228kg dry.</div></div>
 
            </div>
        </content>
        <dc:subject>bmw</dc:subject>
<dc:subject>motorbike</dc:subject>
<dc:subject>summer</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/47-zip2dir-expand-a-zip-to-a-directory-of-the-same-name.html" rel="alternate" title="zip2dir (expand a zip to a directory of the same name)" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-07-30T21:51:40Z</published>
        <updated>2009-07-30T23:28:01Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=47</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=47</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/2-IT" label="IT" term="IT" />
    
        <id>http://daniel-lange.com/archives/47-guid.html</id>
        <title type="html">zip2dir (expand a zip to a directory of the same name)</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>I needed to expand a lot of jars (Java zips) and other zips of various names into directories of the same name for each file.
With 6,239 files of which some are jars, some other zips and many xml and other filetypes all not properly identified by a file extension, this gets a bit too much to do manually.</p>

<p>So:<br />
Finding candidates for these is easy with <code>find . -type f</code>.<br />
The file is most probably a zip archive if the first two characters are "PK", good old <a href="http://en.wikipedia.org/wiki/Phil_Katz" title="Wikipedia: Phil Katz - the inventor of .zip" target="_blank">Phil Katz'</a> signature. A friendly <code>head -c 2</code> checks that.<br />
All combined with some rudimentary error checking:</p>

<div class="bash geshi" style="text-align: left"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"># There is little data security here, so know what you're doing.</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"># All risks in using this code are yours. It moves and deletes files quite stupidly.</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666; font-style: italic;"># (c) Daniel Lange, 2009, v0.01, released into the public domain</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error: $0 expects exactly one argument, a (fully qualified) path/to/a/zipfile&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">!</span> <span style="color: #660033;">-r</span> $<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error: file does not exist or no read permission on $1&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">!</span> <span style="color: #660033;">-w</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(dirname $1)</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error: cannot write to directory of $1&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">3</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(head -c 2 $1)</span>&quot;</span> == <span style="color: #ff0000;">&quot;PK&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">mv</span> $<span style="color: #000000;">1</span> $1.tmp</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> $<span style="color: #000000;">1</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #660033;">-d</span> $<span style="color: #000000;">1</span> $1.tmp</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&#160; &#160; &#160; &#160; <span style="color: #c20cb9; font-weight: bold;">rm</span> $1.tmp</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$1 is not a zipfile&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">fi</span></div></li></ol></div>

<p>Download available <a href="http://daniel-lange.com/software/zip2dir" title="zip2dir download">here (1KB)</a>.</p>

<p>Typical usage:</p>

<div class="bash geshi" style="text-align: left">&#160;<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-print0</span> <span style="color: #000000;">|</span><span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">--null</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">1</span> zip2dir</div>

<p>This will expand all zips under the current directory.<br />
Leave the <code>zip2dir</code> out for a dry run (xargs will just print to the tty then). Look at the <code>-exec</code> switch when digging around a bit more into what <code>find</code> can do for you.</p>
 
            </div>
        </content>
        <dc:subject>bash</dc:subject>
<dc:subject>decompress</dc:subject>
<dc:subject>directory</dc:subject>
<dc:subject>expand</dc:subject>
<dc:subject>script</dc:subject>
<dc:subject>unzip</dc:subject>
<dc:subject>zip</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/46-Google-GMail-dominating-the-email-market.html" rel="alternate" title="Google GMail dominating the email market" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-05-28T21:55:00Z</published>
        <updated>2009-06-12T23:59:35Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=46</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=46</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/13-Other" label="Other" term="Other" />
    
        <id>http://daniel-lange.com/archives/46-guid.html</id>
        <title type="html">Google GMail dominating the email market</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Google's GMail was launched in April 2004 and only in February 2007 Google dropped its invite system to open up to the general public acc. to <a href="http://en.wikipedia.org/wiki/History_of_Gmail" title="Wikipedia article on the history of GMail">Wikipedia's history of GMail</a>. That's some five years of operations up to now.</p>

<p>It kind of amazed me how many people I know have GMail as their primary mail provider. So I took the chance today to get a bit of statistics to check my gut feelings:</p>

<p>A friend of mine selected some (mostly American) bloggers that have indicated specific interests in a topic related to his Doctoral thesis. This sample ended up to be 1,375 people. These folks have 295 different email domains. Only.</p>

<p>A whooping 46% of the (rather random) sample use GMail, 12% Yahoo, 8% Hotmail and about 3% AOL.
While Yahoo has some foreign domains in the sample (yahoo.co.uk, yahoo.ca, see <em>mostly</em> American bloggers above), these add up to around 0.1% of the sample so it's not really significant.</p>

<p><img src="http://daniel-lange.com/uploads/entries/090528_Blogger_Email_Domains.png" alt="Distribution of American blogger's email domains" title="" /></p>

<p>This data is in no way representative, but still wow. Google basically has a monopoly on search and now seems to have a close-to-majority footprint in personal email.</p>

<p>I guess the dominance is currently larger in the States than in Europe or Asia as GMail has only gradually learned languages beyond English.<br />
Large local providers should also have some foothold in these markets. Similar to the Comcast and SBC customers still significant in sample depicted above. Just the local providers in Europe and Asia will be somewhat stronger (for now). Google is also aggressively targeting corporations with hosted email and apps now so one can expect further and accelerated growth in that area. Quite a number of companies are considering using hosted email instead of the conventional mail system they have operated on site for many years now.</p>

<p>So while <a href="http://ginatrapani.org/" title="Gina Trapani's homepage">Gina Trapani</a> recommends <a href="http://lifehacker.com/5261934/break-googles-monopoly-on-your-data-switch-to-yahoo-search" title="Lifehacker blog entry: Break Google's Monopoly on Your Data: Switch to Yahoo Search">"Break Google's Monopoly on Your Data: Switch to Yahoo Search"</a>, may I humbly point out: It's becoming quite impossible to just keep your emails between the recipient and the addressee these days.</p>

<p>Even if you personally do not use GMail, Google can (technically) still profile you because a huge chunk of  people you communicate with send from GMail and receive and store your emails there.</p>

<p>Nearly all email that is sent also passes spam filters before delivery. Google bought the <a href="http://www.google.com/intl/en/press/pressrel/postini_20070709.html" title="Google Press Release about the Postini acquisition">Postini</a> spam filter in 2007. That anti-spam service is used by many enterprises and even city governments, see <a href="http://www.google.com/postini/customers.html" title="Google Postini customer testimonials">here</a>.</p>

<p>So time to consider (unencrypted) email as what it has always been: The digital equivalent of a postcard.<br />
Just now Google has become the postmen. All of them, every second shift. You should hope they're not nosey. Or send letters.</p>
 
            </div>
        </content>
        <dc:subject>email</dc:subject>
<dc:subject>gmail</dc:subject>
<dc:subject>google</dc:subject>
<dc:subject>monopoly</dc:subject>
<dc:subject>privacy</dc:subject>
<dc:subject>security</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/45-Fixing-FreeNX-NoMachine-NX-keyboard-glitches-e.g.-ALTGr.html" rel="alternate" title="Fixing FreeNX / NoMachine NX keyboard glitches (e.g. ALTGr)" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-05-10T11:44:18Z</published>
        <updated>2010-05-27T08:13:15Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=45</wfw:comment>
    
        <slash:comments>11</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=45</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/8-Linux" label="Linux" term="Linux" />
    
        <id>http://daniel-lange.com/archives/45-guid.html</id>
        <title type="html">Fixing FreeNX / NoMachine NX keyboard glitches (e.g. ALTGr)</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>There is a add-on technology to X or VNC called <a href="http://www.nomachine.com/sources.php" title="NX Sources download">NX</a> by an Italian company called <a href="http://www.nomachine.com" title="NoMachine homepage">NoMachine</a>.
It's quite useful as it speeds up working on remote desktops via slow network connections (i.e. DSL pipes) substantially.</p>

<p>The libraries that implement NX are released under GPLv2 by that company.
A server wrapping up the libraries' functionality is available as closed source from NoMachine or as a free product (GPLv2 again) by Fabian Franz, called <a href="http://freenx.berlios.de/" title="FreeNX homepage">FreeNX</a>.</p>

<p>FreeNX itself is amazing as it is written in BASH (with a few helper functions in C). It's also able to mend some of the shortcomings of the NX architecture. E.g. stock NX requires a technical user called "nx" to able to ssh into the NX server with a public/private keypair.
FreeNX can work around that for more secure set-ups.</p>

<p>One issue I bumped into quite regularly with Linux clients and Linux hosts from different distributions/localisations is that the keymaps are not compatible. This usually results in the ALTGr key not usable, so German keyboard users can't enter a pipe ("|"), tilde ("~") or a backslash ("\") character.  Also the up and down keys are usually resulting in weird characters being pasted to the shell. Now all of that makes using a shell/terminal prompt quite <em>interesting</em>.</p>
 <br /><a href="http://daniel-lange.com/archives/45-Fixing-FreeNX-NoMachine-NX-keyboard-glitches-e.g.-ALTGr.html#extended">Continue reading "Fixing FreeNX / NoMachine NX keyboard glitches (e.g. ALTGr)"</a>
            </div>
        </content>
        <dc:subject>freenx</dc:subject>
<dc:subject>gentoo</dc:subject>
<dc:subject>keyboard</dc:subject>
<dc:subject>keymap</dc:subject>
<dc:subject>nx</dc:subject>
<dc:subject>ubuntu</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/44-Fix-Umlauts-in-the-XFCE-Terminal.html" rel="alternate" title="Fix Umlauts in the XFCE Terminal" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-05-01T21:20:00Z</published>
        <updated>2009-05-01T20:40:16Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=44</wfw:comment>
    
        <slash:comments>5</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=44</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/2-IT" label="IT" term="IT" />
    
        <id>http://daniel-lange.com/archives/44-guid.html</id>
        <title type="html">Fix Umlauts in the XFCE Terminal</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>The XFCE Terminal has the weird issue of sometimes showing question marks (?) instead of German Umlauts (äöüÄÖÜ) although they work fine in any other stock XFCE application (e.g. the default editor "mousepad").</p>

<p>The solution to this can be found on the <a href="http://forum.xfce.org/index.php?topic=3302.0" title="XFCE Forum thread on Umlauts in Terminal">XFCE Forums</a> but it took me quite some time to find it. It was difficult to find a suitable search query to dig out that page. Google turns up a lot of irrelevant stuff on "XFCE Terminal question marks"...</p>

<div class="serendipity_imageComment_center" style="width: 526px"><div class="serendipity_imageComment_img"><!-- s9ymdb:525 --><img class="serendipity_image_center" width="526" height="283"  src="http://daniel-lange.com/uploads/entries/090430_XFCE_terminal.png" alt="" /></div><div class="serendipity_imageComment_txt">XFCE Editor Umlauts with and without LANG variable set</div></div>

<p>The problem with Umlauts (and other 8bit ASCII characters) showing as question marks arises if the user has no LANG variable set.</p>

<p>A simple</p>

<div class="bash geshi" style="text-align: left"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LANG</span>=en_US</div>

<p>resolves the issue. Put that into <em>~/.bashrc</em> or any other place suitable in your distribution.</p>

<p>Gentoo users may want to</p>

<div class="bash geshi" style="text-align: left"><span style="color: #c20cb9; font-weight: bold;">su</span> &#160;<span style="color: #666666; font-style: italic;"># become root</span><br /><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;LANG=en_US&quot;</span> <span style="color: #000000;">&gt;&gt;</span> <span style="color: #000000;">/</span>etc<span style="color: #000000;">/</span>env.d<span style="color: #000000;">/</span>02locale<br />env-update<br /><span style="color: #7a0874; font-weight: bold;">exit</span><br /><span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #000000;">/</span>etc<span style="color: #000000;">/</span>profile</div>

<p>to set the LANG variable system-wide.</p>

<p>So keywords, dear Google: <em>Umlaute, deutsch, Fragezeichen, kaputt, falsch, broken, display, zeigt, charset, Zeichensatz</em> <img src="http://daniel-lange.com/templates/default/img/emoticons/smile.png" alt=":-)" style="display: inline; vertical-align: bottom;" class="emoticon" /></p>
 
            </div>
        </content>
        <dc:subject>bug</dc:subject>
<dc:subject>charset</dc:subject>
<dc:subject>gentoo</dc:subject>
<dc:subject>terminal</dc:subject>
<dc:subject>umlauts</dc:subject>
<dc:subject>xfce</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/43-Getting-dual-screen-xinerama-to-work-with-Matrox-G450550-graphics-cards-and-Xorg-1.5.html" rel="alternate" title="Getting dual-screen (xinerama) to work with Matrox G450/550 graphics cards and Xorg 1.5" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-04-25T12:30:00Z</published>
        <updated>2009-04-25T11:46:56Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=43</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=43</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/9-Gentoo" label="Gentoo" term="Gentoo" />
    
        <id>http://daniel-lange.com/archives/43-guid.html</id>
        <title type="html">Getting dual-screen (xinerama) to work with Matrox G450/550 graphics cards and Xorg 1.5</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>Gentoo finally decided to update Xorg to 1.5. Because this has very substantial changes
against the previous version, some things break and there is a <a href="http://www.gentoo.org/proj/en/desktop/x/x11/xorg-server-1.5-upgrade-guide.xml" title="Gentoo Xorg 1.5 Upgrade Guide">migration guide</a> that you
are nagged to read. After the upgrade I found that the Matrox card in one of my servers would not
display xinerama anymore, i.e. I would get the same image on both screens only.
This is the default behaviour for the stock Xorg mga driver. It needs a proprietary HALlib
to get real dual-screen capabilities. Whilst there are a few unstable ebuilds for
<code>x11-drivers/xf86-video-mga</code> none worked for me any better with Xinerama.
The <a href="http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-drivers/xf86-video-mga/ChangeLog?view=markup" title="Gentoo Changelog for xf86-video-mga">Gentoo Changelog</a> is useless as usual. (Gentoo ebuild ChangeLogs tend to never really tell what is fixed, if you're lucky they reference a bug with a good description. But that's only if you're really lucky.)</p>

<p>Worse, that driver hasn't been updated by Matrox anymore since mammals took over the earth (<em>figuratively</em> ... 2005). This is the typical unmaintained-closed-source-drivers-make-hardware-obsolete-sooner-than-later story. Luckily the cards are quite widely used and clever people from the Open Source community have written guides (<a href="http://www.tuxx-home.at/projects/mga/HOWTO_mga_Xorg7" title="The Original MGA HALLib Guide by Alexander Griesser">Tuxx-Home</a>, <a href="http://fkung.wordpress.com/2007/02/08/fkung-1-matrox-0/" title="Recent blog post by Alexander Griesser">Fkung</a>) on how to dissect the proprietary driver and combine parts of it with the Open Source version so that it can be linked into recent X servers.
Unfortunately because of the architectural changes in Xorg 1.5, following these guides will fail at the compile stage.</p>

<p>In the <a href="http://forum.tuxx-home.at/" title="Matrox mga driver discussion forum">Matrox Forum</a> of <a href="http://www.tuxx-home.at/archives/2009/03/17/T21_40_38/" title="Blog entry by Alexander Griesser on his try to port the mga driver to Xorg 1.5">Alexander Griesser</a>, the author of the first comprehensive Matrox driver install guide linked above, people currently mostly downgrade to previous Xorg versions to work around the issue.</p>

<p>But there is a better^Hworking solution already emerging <img src="http://daniel-lange.com/templates/default/img/emoticons/tongue.png" alt=":-P" style="display: inline; vertical-align: bottom;" class="emoticon" /> ...</p>
 <br /><a href="http://daniel-lange.com/archives/43-Getting-dual-screen-xinerama-to-work-with-Matrox-G450550-graphics-cards-and-Xorg-1.5.html#extended">Continue reading "Getting dual-screen (xinerama) to work with Matrox G450/550 graphics cards and Xorg 1.5"</a>
            </div>
        </content>
        <dc:subject>driver</dc:subject>
<dc:subject>gentoo</dc:subject>
<dc:subject>hallib</dc:subject>
<dc:subject>matrox</dc:subject>
<dc:subject>mga</dc:subject>
<dc:subject>ubuntu</dc:subject>
<dc:subject>xinerama</dc:subject>

    </entry>
    <entry>
        <link href="http://daniel-lange.com/archives/42-Windows-Vista-dial-up-networking-slow-to-establish-connection.html" rel="alternate" title="Windows Vista dial-up networking slow to establish connection" />
        <author>
            <name>Daniel Lange</name>
                    </author>
    
        <published>2009-04-12T21:02:54Z</published>
        <updated>2009-04-12T21:02:54Z</updated>
        <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=42</wfw:comment>
    
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://daniel-lange.com/rss.php?version=atom1.0&amp;type=comments&amp;cid=42</wfw:commentRss>
    
            <category scheme="http://daniel-lange.com/categories/2-IT" label="IT" term="IT" />
    
        <id>http://daniel-lange.com/archives/42-guid.html</id>
        <title type="html">Windows Vista dial-up networking slow to establish connection</title>
        <content type="xhtml" xml:base="http://daniel-lange.com/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>If you find that Microsoft Windows Vista is slow to establish a dial-up network connection (DUN) ("register with the network"), that may be caused by it trying to also get an IPv6 on a IPv4 only ISP.
Remove the IPv6 protocol from the Properties -> Network tab of the DUN then.
Worked for me on dialing into an ISP via Bluetooth / mobile phone. Ymmv.</p>
 
            </div>
        </content>
        <dc:subject>dial-in</dc:subject>
<dc:subject>dial-up</dc:subject>
<dc:subject>dun</dc:subject>
<dc:subject>network</dc:subject>
<dc:subject>slow</dc:subject>
<dc:subject>vista</dc:subject>
<dc:subject>windows</dc:subject>

    </entry>

</feed>
