<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mhk&#039;s blog</title>
	<atom:link href="http://blog.mathiashabluetzel.ch/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mathiashabluetzel.ch</link>
	<description>thoughts about photography, geekdom, tech, computers and other stuff</description>
	<lastBuildDate>Wed, 06 Feb 2013 16:30:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>urxvt clickable links with ctrl-click</title>
		<link>http://blog.mathiashabluetzel.ch/2013/02/06/urxvt-clickable-links-with-ctrl-click/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=urxvt-clickable-links-with-ctrl-click</link>
		<comments>http://blog.mathiashabluetzel.ch/2013/02/06/urxvt-clickable-links-with-ctrl-click/#comments</comments>
		<pubDate>Wed, 06 Feb 2013 16:28:29 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[(u)rxvt]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=398</guid>
		<description><![CDATA[Today some friends and I messed around with urxvt and we wondered how we could make urxvt launch URLs with not only a simple mouse click, but with ctrl-click. Well, I had to dig around in the source code for this: sub on_start { my ($self) = @_; $self-&#62;{launcher} = $self-&#62;my_resource (&#34;launcher&#34;) &#124;&#124; $self-&#62;x_resource(&#34;url-launcher&#34;) &#124;&#124; [...]]]></description>
				<content:encoded><![CDATA[<p>Today some friends and I messed around with <a href="https://wiki.archlinux.org/index.php/Rxvt-unicode">urxvt</a> and we wondered how we could make urxvt launch URLs with not only a simple mouse click, but with ctrl-click. Well, I had to dig around in the source code for this:</p>
<pre class="prettyprint lang-perl">
sub on_start {
   my ($self) = @_;

   $self-&gt;{launcher} = $self-&gt;my_resource (&quot;launcher&quot;) || $self-&gt;x_resource(&quot;url-launcher&quot;) || &quot;sensible-browser&quot;;

   $self-&gt;{urls} = [];
   $self-&gt;{showing} = 0;
   $self-&gt;{button}  = 2;
   $self-&gt;{state}   = 0;
   if($self-&gt;{argv}[0] || $self-&gt;my_resource (&quot;button&quot;)) {
      my @mods = split '', $self-&gt;{argv}[0] || $self-&gt;my_resource (&quot;button&quot;);
      for my $mod (@mods) {
         if($mod =~ /^d+$/) {
            $self-&gt;{button} = $mod;
         } elsif($mod eq &quot;C&quot;) {
            $self-&gt;{state} |= urxvt::ControlMask;
         } elsif($mod eq &quot;S&quot;) {
            $self-&gt;{state} |= urxvt::ShiftMask;
         } elsif($mod eq &quot;M&quot;) {
            $self-&gt;{state} |= $self-&gt;ModMetaMask;
         } elsif($mod ne &quot;-&quot; &amp;&amp; $mod ne &quot; &quot;) {
            warn(&quot;$mod is invalid in $self-&gt;{_name}&lt;$self-&gt;{argv}[0]&gt;n&quot;);
         }
      }
   }
</pre>
<p>(from <a href="http://cvs.schmorp.de/rxvt-unicode/src/perl/matcher?revision=1.13&#038;view=markup#l188">http://cvs.schmorp.de/rxvt-unicode/src/perl/matcher?revision=1.13&#038;view=markup#l188</a>)</p>
<p>Basically it would split the input from <tt>URxvt.matcher.button</tt> and set different settings. So to enable ctrl-click you have to pre- or postpend a capital <tt>C</tt>, <tt>S</tt> for shift and <tt>M</tt> for the meta-key. My config now looks like this:</p>
<pre class="prettyprint ">
! ~.Xresources
URxvt.perl-ext-common:  default,matcher
URxvt.url-launcher:     /opt/google/chrome/google-chrome
URxvt.matcher.button:   C1
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2013/02/06/urxvt-clickable-links-with-ctrl-click/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SJphone: No active network interface</title>
		<link>http://blog.mathiashabluetzel.ch/2012/11/04/sjphone-no-active-network-interface/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sjphone-no-active-network-interface</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/11/04/sjphone-no-active-network-interface/#comments</comments>
		<pubDate>Sun, 04 Nov 2012 20:06:34 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[bugs]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=393</guid>
		<description><![CDATA[Recently while working with SJphone on Windows 7 workstation I didn&#8217;t encounter any issue but when doing the same job on a laptop I got this little puzzling error message: No active network interface And still I had connectivity. Sniffing around with Wireshark showed that the SIP register paket did not contain the registrant IP [...]]]></description>
				<content:encoded><![CDATA[<p>Recently while working with <a href="http://www.sjphone.org/sjp.html">SJphone</a> on Windows 7 workstation I didn&#8217;t encounter any issue but when doing the same job on a laptop I got this little puzzling error message:</p>
<pre>
No active network interface
</pre>
<p>And still I had connectivity. Sniffing around with Wireshark showed that the SIP register paket did not contain the registrant IP which must be passed to the VoIP server.</p>
<h3>Workaround</h3>
<p>A working workaround I came quickly to test was to deactivate every not needed NIC under Windows 7, basically you deactivate every card except for the Ethernet/LAN. Very funny. At least I would like to be able to select which interface I want to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/11/04/sjphone-no-active-network-interface/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WhatsApp, ein Sicherheitsrisiko und niemanden kümmert&#8217;s</title>
		<link>http://blog.mathiashabluetzel.ch/2012/09/17/whatsapp-ein-sicherheitsrisiko-und-niemanden-kummerts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=whatsapp-ein-sicherheitsrisiko-und-niemanden-kummerts</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/09/17/whatsapp-ein-sicherheitsrisiko-und-niemanden-kummerts/#comments</comments>
		<pubDate>Mon, 17 Sep 2012 15:16:14 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=371</guid>
		<description><![CDATA[Ein seltener Blog-Eintrag auf Deutsch damit ich mehr Leute aus meinem direkten Bekanntenkreis erreichen kann. Whats … wer?! WhatsApp ist ein unter Jugendlichen weit verbreiteter SMS-Ersatz: Keine Längenbeschränkung bei den Nachrichten, integrierter Medienversand (Bilder, Videos, Audio etc) und Gruppenchats. Leider scheinen die Entwickler von WhatsApp wenig bis gar kein Verständnis für Sicherheit, Vertraulichkeit und Privatsphäre [...]]]></description>
				<content:encoded><![CDATA[<p>Ein seltener Blog-Eintrag auf Deutsch damit ich mehr Leute aus meinem direkten Bekanntenkreis erreichen kann.</p>
<h3>Whats … wer?!</h3>
<p><a href="http://www.whatsapp.com/">WhatsApp</a> ist ein unter Jugendlichen weit verbreiteter SMS-Ersatz: Keine Längenbeschränkung bei den Nachrichten, integrierter Medienversand (Bilder, Videos, Audio etc) und Gruppenchats. Leider scheinen die Entwickler von WhatsApp wenig bis gar kein Verständnis für Sicherheit, Vertraulichkeit und Privatsphäre haben.</p>
<h3>Kurzer Abriss der Sicherheitsproblematik</h3>
<p>Zunächst schien es nur ein <a href="http://www.heise.de/security/meldung/Schnueffel-Tool-zeigt-fremde-WhatsApp-Nachrichten-an-1574066.html">fehlende Verschlüsselung zu sein</a>, dann wurde eine <a href="http://www.heise.de/security/meldung/WhatsApp-versendet-keinen-Klartext-mehr-1673054.html">&#8220;Verschlüsselung&#8221; eingeführt</a>. Es kam wie es kommen musste: Es wurde massiv geschlampt und die <a href="http://www.heise.de/security/meldung/WhatsApp-Accounts-fast-ungeschuetzt-1708132.html">Schlüssel sind leicht zu erraten, damit ist der Nachrichten-Austausch quasi komplett ungeschützt</a>. Sogar der Abschnitt bei Wikipedia über <a href="http://en.wikipedia.org/wiki/WhatsApp#Security_concerns"> Sicherheitsbedenken</a> ist länger als jeder andere Abschnitt. Und ja, es gibt schon Tools, um die Lücken auszunutzen: <a href="https://github.com/venomous0x/WhatsAPI">https://github.com/venomous0x/WhatsAPI</a></p>
<p class="warning">Fazit: Jeder kann die Nachrichten von jedem mitlesen und auch in seinem Name verfassen. Vertraulichkeit ist keine mehr gegeben!</p>
<p>Vermutlich werden noch einige weitere Sicherheitsprobleme bekannt werden, möglich dass sich darunter andere Sicherheitslücken befinden wie versenden von kostenpflichtigen SMS oder klauen von persönlichen Daten wie Photos.</p>
<h3>Alternative</h3>
<p>Technisch betrachtet verwendet WhatsApp dasselbe Protokoll wie Facebook oder <a href="http://www.google.com/talk/about.html">GTalk</a>, das sogennante Jabber oder XMPP-Protokoll. Da viele schon ein GMail-Konto (heute eher als Google-Konto bezeichnet) haben, können diese Benutzer einfach dieses benutzen. Solche die Google nicht vertrauen, können sich eines bei <a href="http://www.swissjabber.ch/index.php/Register">Swissjabber.ch</a> erstellen, eine Anleitung wird gleich mitgeliefert für diverse Benutzer-Programme.</p>
<h4>Ich hab Android</h4>
<p>Hier empfehle ich die mitgelieferte Google Talk App. Das vorkonfigurierte GMail-Konto wird verwendet. Es kann auch ein neues erstellt werden. Für Swissjabber kann man <a href="https://play.google.com/store/apps/details?id=org.yaxim.androidclient">Yaxim (OpenSource)</a> oder <a href="https://play.google.com/store/apps/details?id=com.xabber.android">Xabber (Freeware, Closed Source)</a>, die ganz paranoiden können sich <a href="https://play.google.com/store/apps/details?id=info.guardianproject.otr.app.im">Gwibberbot (OpenSource, OTR-Funktionalität)</a> anschauen.</p>
<h4>Ich hab iOS / ein iPhone</h4>
<p>Google liefert keine App für iOS aus, vermutlich wegen der Rivalität zwischen den grossen Plattformen Android und iOS. Unter Kollegen wird anscheinend gerne <a href="http://monal.im/">Monal (Freeware, Closed Source)</a> verwendet, die Paranoiden können sich <a href="http://chrisballinger.info/apps/chatsecure/">Chatsecure (OpenSource, OTR-Funktionalität)</a> zu Gemüte führen.</p>
<h4>Ich möchte auch vom PC aus schreiben!</h4>
<p>Kein Problem. Das ist ein grosses Plus von richtigen Jabber-Netzwerken: Man kann vom Smartphone, PC, Tablet und vermutlich auch auf der Waschmaschine verwenden. Für die meisten Benutzer reicht die Weboberfläche von Gmail oder man benutzt den offiziellen <a href="http://www.google.com/talk/">Google Talk Client von Google</a>, der allerdings nur in Verbindung zum GMail-Konto funktioniert. Ansonsten empfehlen sich <a href="http://psi-im.org/">Psi</a> (OpenSource, reiner Jabber-Client), <a href="http://pidgin.im/">Pidgin</a> (OpenSource, kann viele weitere Chat-Protokolle) und <a href="http://adium.im/">Adium</a> (OpenSource, nur für Mac OS X, kann viele weitere Chat-Protokolle).</p>
<h3>Disclaimer</h3>
<p>Ich arbeite (bzw. arbeitete) für keines der oben genannten Projekte oder Firmen zu diesem oder einem früheren Zeitpunkt.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/09/17/whatsapp-ein-sicherheitsrisiko-und-niemanden-kummerts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pf does not filter dhcp</title>
		<link>http://blog.mathiashabluetzel.ch/2012/08/27/pf-does-not-filter-dhcp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pf-does-not-filter-dhcp</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/08/27/pf-does-not-filter-dhcp/#comments</comments>
		<pubDate>Mon, 27 Aug 2012 20:30:03 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[packetfilter]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=357</guid>
		<description><![CDATA[Introduction / Synopsis While reading The Book of PF and experimenting with the different configuration I noticed that pf does not block dhcp traffic. int_if=&#34;vr0&#34; block quick on $int_if inet proto { tcp, udp } to $int_if port { bootps, bootpc } Digging into the code Further investigation showed that dhcpd accesses the socket before [...]]]></description>
				<content:encoded><![CDATA[<h2>Introduction / Synopsis</h2>
<p>While reading <a href="http://nostarch.com/pf.htm">The Book of PF</a> and experimenting with the different configuration I noticed that <tt>pf</tt> does not block <tt>dhcp</tt> traffic.</p>
<pre class="prettyprint lang-plain">
int_if=&quot;vr0&quot;
block quick on $int_if inet proto { tcp, udp } to $int_if port { bootps, bootpc }
</pre>
<h2>Digging into the code</h2>
<p>Further investigation showed that <tt>dhcpd</tt> accesses the socket before <tt>pf</tt> via <tt>bpf</tt> (Berkley Packet Filter) and sees the unfiltered traffic, the traffic before pf.</p>
<pre>
       +-- BPF -- dhcpd
       |
NIC ---+ --------- pf
</pre>
<p>I won&#8217;t dissect the code in every detail, but the people from the <a href="irc://irc.freenode.org#openbsd">#openbsd</a> channel kindly requested that I share more details. I looked at <a href="http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/dhcpd/bpf.c">bpf.c</a>, <a href="http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/pf.c">pf.c</a> and <a href="http://www.openbsd.org/cgi-bin/cvsweb/src/sys/netinet/ip_input.c">ip_input.c</a>. From what I understand — correct me if I&#8217;m wrong — the following snippets are relevant:</p>
<pre class="prettyprint lang-c">
/*
 * From sys/netinet/ip_input.c
 */

#if NPF &gt; 0
	/*
	 * Packet filter
	 */
	pfrdr = ip-&gt;ip_dst.s_addr;
	if (pf_test(AF_INET, PF_IN, m-&gt;m_pkthdr.rcvif, &amp;m, NULL) != PF_PASS)
		goto bad;
	if (m == NULL)
		return;

	ip = mtod(m, struct ip *);
	hlen = ip-&gt;ip_hl &lt;&lt; 2;
	pfrdr = (pfrdr != ip-&gt;ip_dst.s_addr);
#endif
</pre>
<p>This is where <tt>pf</tt> gets the IP packets passed meaning that we are already at layer 3 here. While <tt>dhcpd</tt> works with <tt>bpf</tt> and thus access directly raw ethernet frames:</p>
<pre class="prettyprint lang-c">
/*
 * From usr.sbin/dhcpd/bpf.c
 */

void
if_register_receive(struct interface_info *info)
{
	struct bpf_version v;
	struct bpf_program p;
	int flag = 1, sz, cmplt = 0;

	/* Open a BPF device and hang it on this interface... */
	info-&gt;rfdesc = if_register_bpf(info);

	/* Make sure the BPF version is in range... */
	if (ioctl(info-&gt;rfdesc, BIOCVERSION, &amp;v) == -1)
		error(&quot;Can't get BPF version: %m&quot;);

	if (v.bv_major != BPF_MAJOR_VERSION ||
	    v.bv_minor &lt; BPF_MINOR_VERSION)
		error(&quot;Kernel BPF version out of range - recompile dhcpd!&quot;);

	/*
	 * Set immediate mode so that reads return as soon as a packet
	 * comes in, rather than waiting for the input buffer to fill
	 * with packets.
	 */
	if (ioctl(info-&gt;rfdesc, BIOCIMMEDIATE, &amp;flag) == -1)
		error(&quot;Can't set immediate mode on bpf device: %m&quot;);

	if (ioctl(info-&gt;rfdesc, BIOCSFILDROP, &amp;flag) == -1)
		error(&quot;Can't set filter-drop mode on bpf device: %m&quot;);

	/* make sure kernel fills in the source ethernet address */
	if (ioctl(info-&gt;rfdesc, BIOCSHDRCMPLT, &amp;cmplt) == -1)
		error(&quot;Can't set header complete flag on bpf device: %m&quot;);

	/* Get the required BPF buffer length from the kernel. */
	if (ioctl(info-&gt;rfdesc, BIOCGBLEN, &amp;sz) == -1)
		error(&quot;Can't get bpf buffer length: %m&quot;);
	info-&gt;rbuf_max = sz;
	info-&gt;rbuf = malloc(info-&gt;rbuf_max);
	if (!info-&gt;rbuf)
		error(&quot;Can't allocate %lu bytes for bpf input buffer.&quot;,
		    (unsigned long)info-&gt;rbuf_max);
	info-&gt;rbuf_offset = 0;
	info-&gt;rbuf_len = 0;

	/* Set up the bpf filter program structure. */
	p.bf_len = dhcp_bpf_filter_len;
	p.bf_insns = dhcp_bpf_filter;

	if (ioctl(info-&gt;rfdesc, BIOCSETF, &amp;p) == -1)
		error(&quot;Can't install packet filter program: %m&quot;);

	/* Set up the bpf write filter program structure. */
	p.bf_len = dhcp_bpf_wfilter_len;
	p.bf_insns = dhcp_bpf_wfilter;

	if (ioctl(info-&gt;rfdesc, BIOCSETWF, &amp;p) == -1)
		error(&quot;Can't install write filter program: %m&quot;);

	/* make sure these settings cannot be changed after dropping privs */
	if (ioctl(info-&gt;rfdesc, BIOCLOCK) == -1)
		error(&quot;Failed to lock bpf descriptor: %m&quot;);
}
</pre>
<p>Also the <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=bpf&#038;sektion=4">manpage of bpf</a> says «Each descriptor that accepts the packet receives its own copy.» meaning that despite an active <tt>pf</tt> <tt>dhcpd</tt> receives an unbiased, unfiltered frame</p>
<h2>Conclusion</h2>
<p>So this renders the rule completely useless when the <tt>dhcpd</tt> runs on the same machine as the <tt>pf</tt>.</p>
<p>This syntax and test were made under OpenBSD 4.5 but should apply also to the newest version according to the people in the IRC-channel on <a href="irc://irc.freenode.org#openbsd">#openbsd</a> and I looked at the newest code versions.</p>
<h2>Corrections / Updates </h2>
<p>I was asked by the people from the <a href="irc://irc.freenode.org#openbsd">#openbsd</a> channel to share more information and insights.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/08/27/pf-does-not-filter-dhcp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cluttered menu bar in Mac OS X?</title>
		<link>http://blog.mathiashabluetzel.ch/2012/06/14/cluttered-menu-bar-in-mac-os-x/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cluttered-menu-bar-in-mac-os-x</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/06/14/cluttered-menu-bar-in-mac-os-x/#comments</comments>
		<pubDate>Thu, 14 Jun 2012 13:02:37 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[fieldtest]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Bartender]]></category>
		<category><![CDATA[Icon]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[Menu Bar]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=337</guid>
		<description><![CDATA[Probably everyone uses tools and software which will add a menu bar icon. And soon it&#8217;ll start to be very cluttered over there in the top bar. I was looking for weeks if not months for a simple tool which will make a folder where I can put those icons I seldom use. A week [...]]]></description>
				<content:encoded><![CDATA[<p>Probably everyone uses tools and software which will add a menu bar icon. And soon it&#8217;ll start to be very cluttered over there in the top bar.</p>
<p><a href="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.51.40.png"><img class="aligncenter size-large wp-image-340" title="A cluttered menu bar" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.51.40-1024x640.png" alt="" width="470" height="293" /></a></p>
<p>I was looking for weeks if not months for a simple tool which will make a folder where I can put those icons I seldom use. A week ago I found one: <a href="http://www.macbartender.com/">http://www.macbartender.com/</a> (free while the beta, costs about 7.50CHF when you buy a license while the beta, will be about 15.00CHF after the beta)</p>
<p><a href="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.44.32.png"><img class="aligncenter size-full wp-image-341" title="Bartender beta" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.44.32.png" alt="" width="754" height="540" /></a></p>
<p>You then easily can put the icons into a folder:</p>
<p><a href="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.52.58.png"><img class="aligncenter size-full wp-image-339" title="Bartender configuration panel" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.52.58.png" alt="" width="754" height="583" /></a></p>
<p>Then your menu will look a lot less cluttered and even when you have a lot of text menu entries you&#8217;ll still be able to access all those menu bar icons.</p>
<p><a href="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.53.22.png"><img class="aligncenter size-large wp-image-338" title="Bartender less cluttered menu" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/06/Bildschirmfoto-2012-06-14-um-14.53.22-1024x640.png" alt="" width="470" height="293" /></a></p>
<p>To be honest: 15.00CHF would be a bit too much for this handy tool, but while it&#8217;s beta you can get a license for 50% off, so I grabbed one. All in all I found myself to use it quite often and I&#8217;m happy with it. Try the beta and make your own opinion!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/06/14/cluttered-menu-bar-in-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMS Backup+</title>
		<link>http://blog.mathiashabluetzel.ch/2012/05/09/sms-backup/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sms-backup</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/05/09/sms-backup/#comments</comments>
		<pubDate>Wed, 09 May 2012 10:24:25 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[app review]]></category>
		<category><![CDATA[fieldtest]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[GMail]]></category>
		<category><![CDATA[SMS]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=330</guid>
		<description><![CDATA[If you happen to want a backup of your SMS you can easily do this to your GMail account. So your SMS will be connected to your contact book, emails and even other things. But mainly you can easily search through all your old SMS using GMail.]]></description>
				<content:encoded><![CDATA[<p>If you happen to want a backup of your SMS you can easily do this to your GMail account. So your SMS will be connected to your contact book, emails and even other things. But mainly you can easily search through all your old SMS using GMail.</p>
<p><a href="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/05/Screenshot_2012-05-09-11-28-43.png"><img class="aligncenter size-medium wp-image-331" title="Screenshot_2012-05-09-11-28-43" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/05/Screenshot_2012-05-09-11-28-43-168x300.png" alt="" width="168" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/05/09/sms-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Depth of field</title>
		<link>http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=depth-of-field</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 11:01:35 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[fieldtest]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[theory]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=288</guid>
		<description><![CDATA[Depth of field is a very versatile way to create photos. You can guide the eye of the viewer to certain parts of the image or you can mask unwanted or disrupting parts. Theory First of a little theory. Let&#8217;s consider a pretty standard lens like the Nikkor 50mm f/1.8. We are able to calculate [...]]]></description>
				<content:encoded><![CDATA[<p>Depth of field is a very versatile way to create photos. You can guide the eye of the viewer to certain parts of the image or you can mask unwanted or disrupting parts.</p>
<h2>Theory</h2>
<p>First of a little theory. Let&#8217;s consider a pretty standard lens like the Nikkor 50mm f/1.8. We are able to calculate the depth of field e.g. f/2.8 a distance to the subject of 5m (5000mm) and a <a href="https://en.wikipedia.org/wiki/Circle_of_confusion">circle of confusion</a> of 0.019mm for my Nikon D300. Refer to your manual or the technical specification of your camera to find out what value your camera has.</p>
<h3>The math</h3>
<pre>hyperfocal distance = (50^2)/(0.019*2.8)+50
    (all units in mm, aperture is unitless)

  47042mm ~= (50^2)/(0.019*2.8)+50

following:
  depth of field = 2*(5000*4950*47042)/(47042^2-4950^2) ~= 1064mm</pre>
<p>For further details have a look at the <a href="https://en.wikipedia.org/wiki/Depth_of_field">wikipedia article about depth of field</a>.</p>
<h3>What does this mean?</h3>
<p><a href="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/Schaerfentiefe_11_50-300.png"><img class="aligncenter size-medium wp-image-316" title="Schaerfentiefe_11_50-300" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/Schaerfentiefe_11_50-300-300x171.png" alt="" width="300" height="171" /></a></p>
<p><a href="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/Schaerfentiefe_2.8_50-300.png"><img class="aligncenter size-medium wp-image-315" title="Schaerfentiefe_2.8_50-300" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/Schaerfentiefe_2.8_50-300-300x169.png" alt="" width="300" height="169" /></a></p>
<p>This means that when I&#8217;m using a 50mm lens with an aperture of f/2.8 and shooting an object in 5m distance I&#8217;ll have a depth of field of around 1m. The following graph shows the depth of field (left scale) for focal lengths between 50-300mm (lower scale) and a subject distance between 1-10m (upper scale) for the aperture f/2.8.</p>
<p>&nbsp;</p>
<h3>Conclusion</h3>
<p>The only difference here is the value range of the depth of field: 0-800mm and 0-3400mm. We can conclude that the aperture influences proportionally the depth of field and the focal length influences inverse proportionally the depth of field.</p>
<h2>Field usage</h2>
<p>Generally I use the manual mode, or you can try the aperture priority mode here.</p>
<h3>Portraits</h3>
<p>Let&#8217;s consider an outdoor situation. I want to take a portrait by some slight covering by cirrus clouds and choose to &#8220;crop&#8221; or emphasize the subject by using a wide open aperture in aperture priority mode. The light meter is set up in center-weighted, I meter right the center of the face to get the correct exposure, press the AE-L button (keeps the exposure settings locked to what was measured), frame my sujet and take the shot. I would leave the focussing setting to continuous mode since the subject would unintentionally slightly move forward or backward and with the very shallow depth of field the subject would easily get out of focus.</p>
<p>I suggest you to use the continuous shots mode since people will just put on their best face for a mere split second. The continuous focus is required because people tend to act naturally when they move most. When they freeze and put on their pre studied facial expression they will probably look pretty much silly or don&#8217;t like their photos.</p>
<h3>Landscapes</h3>
<p>When doing some landscape photography you are tempted to use the smallest possible aperture which makes sense but you should also consider that with a small aperture another effect comes into play: <a href="https://en.wikipedia.org/wiki/Depth_of_field#DOF_and_diffraction">Diffraction Blur</a>. This means that from a certain aperture on you will encounter diffraction which will generally spoken refract the light (remember the prisma thingie?). So you will have to find tradeoff between depth of field and diffraction. My experience shows me that for my APS-C sensor in my Nikon D300 and the 18-70mm f/3.5-4.5 lens a more or less ideal aperture can be found at f/11.</p>
<h3>Details and macro shots</h3>
<p>When doing details shot you should remember that the distance to the motif may be very small and thus the depth of field is very shallow. Let&#8217;s consider the 50mm f/1.8 lens with a distance to the subject of 50cm and with an aperture of f/2.8 we will have a depth of field of only 9.5mm. So holding your camera steady by hand will be nearly impossible – just think about that you still have to breath. Use a tripod.</p>
<h3>Bokeh</h3>
<p><a href="https://en.wikipedia.org/wiki/Bokeh">Bokeh</a> is a japanese word meaning &#8220;blur&#8221; or &#8220;haze&#8221; and defines the look of the blur in photography or its beauty. By this word usually we mean the blurry bubbles which originate from a point like light source like a christmas light chain. You can actually influence the bokeh by using some paper cut shapes which you stick in front of your lense and is explained over at <a href="http://www.diyphotography.net/diy_create_your_own_bokeh">DIY photography</a></p>
<h2>Examples</h2>

<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/wedding-of-angela-and-eliton-3/' title='Boy with blue tshirt'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/5904017133_5a282afc11_b-150x150.jpg" class="attachment-thumbnail" alt="Nikon D300, Nikkor 50mm @ f/2.2, 1/640s, ISO 200, subject distance 1.78m" /></a>
<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/wedding-of-angela-and-eliton-2/' title='Girl with camera'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/5904016771_3efa2ac455_b-150x150.jpg" class="attachment-thumbnail" alt="Nikon D300, Nikkor 50mm @ f/2.2, 1/500s, ISO 200, subject distance 1m" /></a>
<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/wedding-of-angela-and-eliton/' title='Man laughing'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/5904016121_f35b5ae175_b-150x150.jpg" class="attachment-thumbnail" alt="Nikon D300, Nikkor 50mm @ f/2.8, 1/640s, ISO 640, subject distance 1.19m" /></a>
<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/4700106265_dc04848559_b/' title='Flauder'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/4700106265_dc04848559_b-150x150.jpg" class="attachment-thumbnail" alt="Nikon D300, Nikkor 50mm @ f/1.8, 1/8000s, ISO 200, subject distance 0.71m" /></a>
<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/4808142009_474f60b563_b/' title='Bee on flower'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/4808142009_474f60b563_b-150x150.jpg" class="attachment-thumbnail" alt="Nikon D300, Nikkor 50mm with reverse mount, 1/400s, ISO 1600" /></a>
<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/4563071786_5baae1d307_z/' title='Dandelion'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/4563071786_5baae1d307_z-150x150.jpg" class="attachment-thumbnail" alt="Nikon D300, Nikkor 50mm with reverse mount, 1/500s, ISO 400" /></a>
<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/schaerfentiefe_2-8_50-300/' title='Schaerfentiefe_2.8_50-300'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/Schaerfentiefe_2.8_50-300-150x150.png" class="attachment-thumbnail" alt="Schaerfentiefe_2.8_50-300" /></a>
<a href='http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/schaerfentiefe_11_50-300/' title='Schaerfentiefe_11_50-300'><img width="150" height="150" src="http://blog.mathiashabluetzel.ch/wp-content/uploads/2012/04/Schaerfentiefe_11_50-300-150x150.png" class="attachment-thumbnail" alt="Schaerfentiefe_11_50-300" /></a>

<h3>Disclaimer</h3>
<p>I already published this post in german a long time ago and was asked to translate it into english.</p>
<h3>Changelog</h3>
<ul>
<li>Fixed an untranslated section</li>
<li>Fixed a unit conversion mistake</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/04/18/depth-of-field/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The importance of data types and units</title>
		<link>http://blog.mathiashabluetzel.ch/2012/04/11/the-importance-of-data-types-and-units/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-importance-of-data-types-and-units</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/04/11/the-importance-of-data-types-and-units/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 20:09:50 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[bugs]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=267</guid>
		<description><![CDATA[While working on the bachelor thesis I came across a hard to detect type of bug. It&#8217;s not one of the typical off-by-one, array-out-of-bound  or one of those I-inverted-the-indices-of-the-array bug. This one is harder to spot and is caused by a bad design which in turn makes it hard to spot the bug. What happened [...]]]></description>
				<content:encoded><![CDATA[<p>While working on the <a href="http://redmine.evo.mathiashabluetzel.ch/projects/lakerouting">bachelor thesis</a> I came across a hard to detect type of bug. It&#8217;s not one of the typical off-by-one, array-out-of-bound  or one of those I-inverted-the-indices-of-the-array bug. This one is harder to spot and is caused by a bad design which in turn makes it hard to spot the bug.</p>
<h2>What happened</h2>
<p>As all bugs the software behaves wrong. In this case I got some garbage numbers which just didn&#8217;t make sense. Basically the code is interpolating over a field of wind vectors and returns the interpolated wind vectors. The problem was, that the vector all seemingly looked more or less in the same direction. That was weird.</p>
<h2>Bug type definition</h2>
<p>I would call this bug type something like &#8220;mixed units bug&#8221; since I mixed degree and radian:</p>
<pre class="prettyprint lang-java" style="font-size: 80%;">double lng = ((c.getLongitudeInRadian() - metadata.getNorthWestCorner().getLongitudeInRadian()) /
    metadata.getDeltaLng()) % 1;
double lat = ((c.getLatitudeInRadian() - metadata.getNorthWestCorner().getLatitudeInRadian()) /
    metadata.getDeltaLat()) % 1;
return new Double[] {lat,lng};</pre>
<p>Next to the fact that this is not very nice code, I stumbled over a self made trap: <span style="color: #808080;"><em>getDeltaLng()</em></span> and <span style="color: #808080;"><em>getDeltaLat() </em></span> do not actually return a radian unit which you would usually use when doing math with spheres but a degree value. So since the radian value of a sphere traditionally would go from [0,2π) a difference 0.2 would make a lot more in radian than 0.2 in degree.</p>
<h2>How to avoid this type of bugs</h2>
<p>As usual: Try to think before you code unless you like to live with a unmanageable pile of junk code with no clear guideline and a lot of magic conversion in between. In the worst case you will end up converting a radian value again into radian which will give you some really unusable numbers.</p>
<p>The next obvious point is to use the same unit throughout the whole project. If you happen to come across that you may need angular values in degree and radian and coordinates on the sphere also in degree (mostly known as GPS), radian and even cartesian you better use an abstract data type which strictly forces you to set the type of unit when setting the values via setter-methods:</p>
<pre class="prettyprint lang-java" style="font-size:80%;">

public class Coordinate {
    private static final double MIN_LONGITUDE = -180.0;
    private static final double MAX_LONGITUDE = 180.0;
    private static final double MIN_LATITUDE = -90.0;
    private static final double MAX_LATITUDE = 90.0;

    private BigDecimal longitude;
    private BigDecimal latitude;

    public final String toString() {
        return &quot;Longitude: &quot; + longitude + &quot;&Acirc;&deg;, Latitude: &quot; + latitude;
    }

    public final double getLongitudeInDegree() {
        return longitude.doubleValue();
    }

    public final void setLongitudeInDegree(double l) {
        if (l &gt; MAX_LONGITUDE || l &lt;= MIN_LONGITUDE)
            throw new IllegalArgumentException(&quot;Longitude is out of range.&quot;);
        this.longitude = BigDecimal.valueOf(l);
    }

    public final double getLatitudeInDegree() {
        return latitude.doubleValue();
    }

    public final void setLatitudeInDegree(double l) {
        if (l &gt; MAX_LATITUDE || l &lt; MIN_LATITUDE)
            throw new IllegalArgumentException(&quot;Latitude is out of range.&quot;);
        this.latitude = BigDecimal.valueOf(l);
    }

    public final double getLongitudeInRadian() {
        return getLongitudeInDegree()/180*Math.PI;
    }

    public final void setLongitudeInRadian(double l) {
        setLongitudeInDegree(l/Math.PI*180);
    }

    public final double getLatitudeInRadian() {
        return getLatitudeInDegree()/180*Math.PI;
    }

    public final void setLatitudeInRadian(double l) {
        setLatitudeInDegree(l/Math.PI*180);
    }
}
</pre>
<p>As a programmer I don&#8217;t have to care anymore in what format these values are stored internally, I just have to indicate in what unit (or format) I want to set or get the value. In this way my code even gets better reusability since I can easily add other getter- and setter-methods later without breaking any old usage of this data type. In this case I could easily add a way to get and set the coordinate in cartesian values without refactoring other usage of this class.</p>
<p>Even better: As you may have noticed I built in some range checking of the values. In that way I can enforce and assert that the values will never under no circumstances provoke undefined behavior because they went out of range.</p>
<h2>Closing words</h2>
<p>Due to this lack of using strict typing and enforcing the developer to think about what he deals with or rather what unit he&#8217;s working with, I spent and lost a few hours tracking down a annoying and hard to get bug.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/04/11/the-importance-of-data-types-and-units/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LaTeX formula editor in Chrome</title>
		<link>http://blog.mathiashabluetzel.ch/2012/03/31/latex-formula-editor-in-chrome/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=latex-formula-editor-in-chrome</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/03/31/latex-formula-editor-in-chrome/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 16:13:53 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[geekdom]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[Formula]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=264</guid>
		<description><![CDATA[Browsing the Chrome Webstore I came across the Daum Equation Editor which is a WYSIWYG editor in Chrome for LaTeX math formula. It does render LaTeX math code into a PNG or save it as a TXT file. I see this app for quickly sketching a formula on a beamer without the need of a [...]]]></description>
				<content:encoded><![CDATA[<p>Browsing the <a href="https://chrome.google.com/webstore/">Chrome Webstore</a> I came across the <a href="https://chrome.google.com/webstore/detail/dinfmiceliiomokeofbocegmacmagjhe/">Daum Equation Editor</a> which is a WYSIWYG editor in Chrome for LaTeX math formula.</p>
<p>It does render LaTeX math code into a PNG or save it as a TXT file. I see this app for quickly sketching a formula on a beamer without the need of a whole LaTeX environment or when you want to export it to a PNG file to be attached in an email or something like that.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/03/31/latex-formula-editor-in-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lock your Mac OS X</title>
		<link>http://blog.mathiashabluetzel.ch/2012/03/30/lock-your-mac-os-x/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=lock-your-mac-os-x</link>
		<comments>http://blog.mathiashabluetzel.ch/2012/03/30/lock-your-mac-os-x/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 16:38:01 +0000</pubDate>
		<dc:creator>mhk</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://blog.mathiashabluetzel.ch/?p=260</guid>
		<description><![CDATA[When you leave your Mac, you shouldn&#8217;t leave it unlocked. As long you have the ⏏ on the keyboard you are fine. ⌃⇧⏏ ctrl+shift+eject is the solution. Or you can try http://www.gkoya.com/2006/11/23/locktight-for-mac-os-x-intel/]]></description>
				<content:encoded><![CDATA[<p>When you leave your Mac, you shouldn&#8217;t leave it unlocked. As long you have the ⏏ on the keyboard you are fine.</p>
<pre>⌃⇧⏏       ctrl+shift+eject</pre>
<p>is the solution. Or you can try <a href="http://www.gkoya.com/2006/11/23/locktight-for-mac-os-x-intel/">http://www.gkoya.com/2006/11/23/locktight-for-mac-os-x-intel/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mathiashabluetzel.ch/2012/03/30/lock-your-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
