<?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>Björn's Blog</title>
	<atom:link href="http://blog.blinker.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.blinker.net</link>
	<description>Computer Science, Mathematics, Games</description>
	<lastBuildDate>Sun, 20 Jun 2010 09:47:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mac Mini G4 Homeserver With Ubuntu Linux 10.04, WPA2</title>
		<link>http://blog.blinker.net/2010/06/20/mac-mini-g4-homeserver-with-ubuntu-linux-10-04-wpa2/</link>
		<comments>http://blog.blinker.net/2010/06/20/mac-mini-g4-homeserver-with-ubuntu-linux-10-04-wpa2/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 00:39:58 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Computer Stuff]]></category>
		<category><![CDATA[home server]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac Mini]]></category>
		<category><![CDATA[PowerPC]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[WLAN]]></category>
		<category><![CDATA[WPA2]]></category>
		<category><![CDATA[wpa_supplicant]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=39</guid>
		<description><![CDATA[I finally got WPA2 to work on my old Mac Mini G4, which is running Ubuntu Linux 10.04 server edition for PowerPC (Update: WLAN worked for a while, but it seems to be very unstable. Could be the location where it sits, or the software &#8211; Update2: running it at another location, it seems to [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got WPA2 to work on my old Mac Mini G4, which is running Ubuntu Linux 10.04 server edition for PowerPC (Update: WLAN worked for a while, but it seems to be very unstable. Could be the location where it sits, or the software &#8211; Update2: running it at another location, it seems to work fine and stable).</p>
<p>I wanted to use the old Mini as a homeserver for a long time, but my girl-friend had complained about the (faint) noise it makes. Without a wireless connection, I had to place it next to the router, which in turn is placed next to her room.</p>
<p>Now with wireless I put it on the fridge in the kitchen, which is already quite noisy. Unfortunately, my girl-friend still complains. But I hope she&#8217;ll either get used to it, or I can still find a better place. With WLAN, there are more options.</p>
<p>Since I have installed Ubuntu Server and Samba for serving Windows shares months ago, I have forgotten the steps and can not talk about them now. I remember that the Ubuntu installation was really simple. Also I had apparently already configured the driver for the Mini&#8217;s wireless card, so I am not sure how I got that working. For a long time, I was unable to get wireless to actually work, especially not with WPA_SUPPLICANT providing access to my WPA2 encrypted network. </p>
<p>Hopefully information for installing the correct drivers for the Mac Mini wireless card can be found reasonably easy, as I can not retrace the steps anymore. My Mini required the b43 drivers, which requires download of the firmware by installing the b43-fwcutter package (sudo aptitude install b43-fwcutter).</p>
<p>So assuming your driver is working, I eventually found <a href="https://help.ubuntu.com/community/WifiDocs/WPAHowTo">WPAHowTo</a> for an old version of Ubuntu that describes most of the steps for configuring WPA2 (I only read the WPA_SUPPLICANT parts of that HowTo). All the newer how-tos seem to assume a graphical user interface and only describe how to use network-manager. </p>
<p>All instructions say to shut down eth0 before trying to start wlan0 (that&#8217;s how they are called on my system). So I grudgingly connected the Mini to a monitor and a keyboard again to complete the configuration. I also tested wlan without encryption, which worked.</p>
<p>Next install wpa_supplicant if not already done (sudo aptitude install wpasupplicant).</p>
<p>My wlan network uses a preshared key, so I used wpa_passphrase to generate the basis for a config file:<br />
<code><br />
wpa_passphrase NetworkEssid passphrase<br />
</code></p>
<p>(replace NetworkEssid and passphrase according to your network&#8217;s setttings).</p>
<p>which resulted in output like<br />
<code><br />
network={<br />
        ssid="NetworkEssid"<br />
        #psk="TextPassphrase"<br />
       psk=somerandomnumbersandletters<br />
  }<br />
</code></p>
<p>Then create or edit /etc/wpa_supplicant.conf (on my system the file did not exist yet). Since it needs the output of wpa_passphrase, I actually piped the output of wpa_passphrase into a file and copied it to /etc/wpa_supplicant.conf (somehow piping there directly didn&#8217;t work). (all operations in /etc require root privileges, so sudo accordingly). Also change owner and group of the conf file back to root in case by copying it or creating it it became owned by your &#8220;normal&#8221; user (chgrp root thefile and chown root thefile).</p>
<p>After some searching around, I found an example wpa_supplicant.conf for a WPA2 WLAN network using a preshared key and CCMP/AES encryption <a href="http://hardware.linuxnetz.de/bcm4318-wpa2/">here</a> They say they need a weird &#8220;double configuration&#8221; for it to work, but actually it also worked for me when I removed the TKIP stuff. So my final wpa_supplicant.conf file looks like this:<br />
<code><br />
network={<br />
        ssid="dummy"<br />
        proto=WPA2<br />
        key_mgmt=WPA-PSK<br />
        pairwise=CCMP<br />
        group=CCMP<br />
        #psk="dummydummy"<br />
	psk=somerandomnumbersandletters<br />
}<br />
</code></p>
<p>(Except of course other values for dummy and psk). It is probably save to delete the line with the clear text password, too.</p>
<p>Now the instructions from the WPAHowTo  said to test wpa_supplicant like this (already with my parameters, not the ones from the HowTo):<br />
<code><br />
  sudo wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext<br />
</code><br />
(Omitting the -w parameter from the HowTo, doesn&#8217;t seem to exist anymore)</p>
<p>The problem here was the -D parameter, as here you are supposed to state the correct driver (also, apparently, instead of wlan0 your wlan might have a different device name). At the <a href="http://www.linuxwireless.org/en/users/Drivers/b43#firmware">Homepage of the linux driver for the b43</a> I found the information that &#8220;wext&#8221; should be used for wpa_supplicant. </p>
<p>So, again following the old HowTo, I put the following into my /etc/networks/interfaces:<br />
<code><br />
auto lo<br />
iface lo inet loopback<br />
address 127.0.0.1<br />
netmask 255.0.0.0</p>
<p>#auto eth0<br />
iface eth0 inet dhcp</p>
<p>auto wlan0<br />
iface wlan0 inet dhcp<br />
wpa-driver wext<br />
wpa-conf /etc/wpa_supplicant.conf<br />
</code></p>
<p>Now if I power up the server, it automatically connects to my WPA2-encrypted WLAN. I was very happy about this and put the server on the fridge. However, while I started writing up this summary, I experienced several connection losses. Now I feel like giving up on connecting the server via WLAN and try one of those Powerline networking things instead, which enable networking through the electric power lines (like <a href="http://amzn.to/dyBgbZ">this one</a>).. On the other hand, I just moved the Mac Mini server into my room to connect it to the monitor again, and here WLAN seems to work fine. So maybe it was just the location on top of the fridge that doesn&#8217;t work &#8211; it is closer to the router, but at another angle and with different walls in between. I might try some other places for the server yet.</p>
<p>One candidate might be the bathroom, but I am bit worried about the occasional high humidity.</p>
<p>There are yet more issues to be solved before my home server is ready. Backups, what kind of file systems to share, iTunes server (?) or something else?</p>
<p>One small thing I also haven&#8217;t yet found a solution for yet: it would be nice if the Mini would shutdown if I press the power button. At the moment the power button simply seems to be ignored by the Ubuntu Server installtion. I could not yet find a solution for this &#8211; in the net there are some instructions for making the power button initiate the shutdown sequence, but they are all for normal PCs, not for PowerPC Minis. If anybody knows of a solution, please let me know!</p>
<p>That way, my girl-friend could also power the server on and off without having to learn about ssh and linux shells, and it wouldn&#8217;t have to run all the time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2010/06/20/mac-mini-g4-homeserver-with-ubuntu-linux-10-04-wpa2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why sending e-cards is rather rude</title>
		<link>http://blog.blinker.net/2010/02/09/why-sending-e-cards-is-rather-rude/</link>
		<comments>http://blog.blinker.net/2010/02/09/why-sending-e-cards-is-rather-rude/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 18:56:55 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Computer Stuff]]></category>
		<category><![CDATA[e-cards]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[friends]]></category>
		<category><![CDATA[scam]]></category>
		<category><![CDATA[social networks]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[valentines]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=36</guid>
		<description><![CDATA[Valentine&#8217;s day is upon us, and like many other special days throughout the year a pesky aspect of the internet rears it&#8217;s head again: e-cards.
For one thing, spammers jump on the opportunity and send around intriguing e-card announcements of the form &#8220;somebody sent you an e-card&#8221; or &#8220;n people want to meet you on network [...]]]></description>
			<content:encoded><![CDATA[<p>Valentine&#8217;s day is upon us, and like many other special days throughout the year a pesky aspect of the internet rears it&#8217;s head again: e-cards.</p>
<p>For one thing, spammers jump on the opportunity and send around intriguing e-card announcements of the form &#8220;somebody sent you an e-card&#8221; or &#8220;n people want to meet you on network x&#8221;. It&#8217;s a good idea to never click on those links in emails, as most likely they&#8217;ll just link to a scam. </p>
<p>So that is one reason not to send e-cards: it endangers the recipient, because he is getting used to clicking on e-card links, which might be hazardous. The better e-card sites are capable of including the senders name in the email (&#8220;xyz sent you an e-card&#8221;), but even that is no guarantee that the e-card is legitimate. It is easy to harvest the names of a person&#8217;s friends from various social networks (Facebook and others) and simply pretend to send e-cards in their name.</p>
<p>One way to at least send a reasonably safe e-card would be to use a very well known and trustworthy company, like Yahoo, Google or Amazon (and that list is probably the complete list, I can&#8217;t think of any other well known sites). But even then it is still rude: by sending somebody an e-card, you are giving away that person&#8217;s private information, namely their email-address. Chances are high that in addition to your lovingly selected e-card, that person will also receive a never ending amount of spam mails for the rest of their lives.</p>
<p>If you absolutely want to send a greeting card by mail, just attach a regular JPEG image to an email you sent from your normal email program. Otherwise, why not invest in a real postcard? I know there are a lot of funny flash movies available for special occasions, but really JPEG is preferred. The chances for security holes in JPEG viewers are very small (although not impossible), and the same can not be said for most other formats like flash or Power Point.</p>
<p>That said, I admit that the occasional e-card from a friend has given me a warm fuzzy feeling. I don&#8217;t really expect most people to understand the issues with e-cards, or with giving my email address to a 3rd party. But I&#8217;d prefer it if they did, hence this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2010/02/09/why-sending-e-cards-is-rather-rude/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchanging a hard drive with Ubuntu LiveCD and gparted, disk image created with dd</title>
		<link>http://blog.blinker.net/2010/02/04/exchanging-a-hard-drive-with-ubuntu-livecd-and-gparted-disk-image-created-with-dd/</link>
		<comments>http://blog.blinker.net/2010/02/04/exchanging-a-hard-drive-with-ubuntu-livecd-and-gparted-disk-image-created-with-dd/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 18:26:53 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=34</guid>
		<description><![CDATA[The S.M.A.R.T. monitor has been warning about imminent failure of the hard drive in my mother&#8217;s laptop, so it was time to exchange it. Since it is running Ubuntu Linux (version 9.10, Karmic Koala), I was looking for ways to create an image of the old hard disk and transfer it to the new hard [...]]]></description>
			<content:encoded><![CDATA[<p>The S.M.A.R.T. monitor has been warning about imminent failure of the hard drive in my mother&#8217;s laptop, so it was time to exchange it. Since it is running Ubuntu Linux (version 9.10, Karmic Koala), I was looking for ways to create an image of the old hard disk and transfer it to the new hard disk. </p>
<p>My initial googling didn&#8217;t immediately yield definite results, even though I found some comments mentioning &#8220;dd&#8221;. Therefore I wanted to quickly summarize the steps I have taken in case anybody else looks for something similar.</p>
<p>While I found forum threads recommending a variety of tools, they were usually several years old. Therefore I wasn&#8217;t sure if the recommended tools are still state of the art. Also I preferred a disk image over using the recovery mechanisms of the backup software (sbackup or rsync), as I wasn&#8217;t 100% sure if permissions and everything would work out OK on a fresh install of Ubuntu (probably, but a disk image just seemed cleaner). </p>
<p>Then I found this <a href="http://www.joewein.net/blog/2009/11/12/backing-up-migrating-your-hard-disk-data-ubuntu-live-cd/">blog article about copying a disk with dd</a> and decided to stick with it. Other than in that article, since I didn&#8217;t have a way to connect the new hd without installing it in the notebook, I first copied the image to another external hd. Then I exchanged the internal disk and copied the image back onto the new internal disk. </p>
<p>To do the copying, first boot the notebook from the Ubuntu CD (&#8220;Ubuntu LiveCD&#8221;), to run Ubuntu from the CD and not from the internal hd. That way, the conents of the hd don&#8217;t change during the copy process. Booted into Ubuntu LiveCD, I quickly changed the keyboard layout in the settings -> keyboard menu (it defaults to US layout, but I have German). Then I mounted the external USB disk by selecting it in &#8220;Places&#8221; (or clicking on it in Nautilus, the Ubuntu file explorer). </p>
<p>Then open a shell, and create an image of the internal hd by executing </p>
<p><code>sudo dd if=/dev/sda of=/media/name_of_external_disk/image_name</code></p>
<p>The sudo might be optional, in my case I needed it because the external hd was only writable for root. If the external hd doesn&#8217;t have a name yet, you can assign one with GParted or Disk Utility (I forgot which). </p>
<p>This might take a while, depending on the size of the internal hd. The resulting image will be as big as the capacity of the internal hd. dd will copy the whole hd, no matter how much of it is used or not. Also dd does not give any progress reports, so just be patient. </p>
<p>As the article I linked to mentioned, it might be a good idea to check with<br />
<code>sudo fdisk -l /dev/sda</code> that /dev/sda is the right hd (I recognized it because of the size).</p>
<p>Now, power down and exchange the internal hd, then boot up with the Ubuntu LiveCD again. Again, change the keyboard layout (if necessary) and mount the external hd. (I actually rebooted once because at the first time there was a hickup mounting the external hd. After the reboot it worked). </p>
<p>Then write the disk image back using </p>
<p><code>sudo dd if=/media/name_of_external_disk/image_name of=/dev/sda</code></p>
<p>(again, checking that sda is the right target with fdisk might be good). </p>
<p>If the new disk is the same size as the old one, that&#8217;s it. Otherwise, the partitions on the hd can be resized with GParted to make them use the whole disk. GParted can be started from the Ubuntu Administration Menu. </p>
<p>I had only one problem: the hd had a &#8220;normal&#8221; partition containting the main file system, followed by an extended partition that contained the swap partition. Somehow I couldn&#8217;t move the extended partition or the swap partition, and therefore I could not resize the main partition either. Eventually I figured that I should first resize the extended partition to fill all the remaining space. Then I could move the swap partition (which is inside the extended partition) to the end of the available space. That done I resized the external partition again to only be as big as the swap partition. After that I could finally resize the main partition to use all the remaining space (OK, except for 8MB that were left over because of alignment with the hd&#8217;s &#8220;Cylinders&#8221;, not sure if that was necessary or not).  Before resizing/moving the swap partition it might be necessary to select &#8220;swapoff&#8221; for that partition on gparted, if the Ubuntu Live system has decided to use that swap space.</p>
<p>That&#8217;s it &#8211; again a scarily long text to describe a simple procedure.</p>
<p>A downside might be that it copies the whole disk, not just the used parts. Also there has to be enough space left on the external disk. Not sure if copying less could be achieved with some dd magic. I am pretty sure one could just copy individual partitions with dd, but not sure how to copy the disks partition table, master boot record and what not then. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2010/02/04/exchanging-a-hard-drive-with-ubuntu-livecd-and-gparted-disk-image-created-with-dd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>APT, the app store for geeks</title>
		<link>http://blog.blinker.net/2010/02/03/apt-the-app-store-for-geeks/</link>
		<comments>http://blog.blinker.net/2010/02/03/apt-the-app-store-for-geeks/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 21:44:27 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Computer Stuff]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=33</guid>
		<description><![CDATA[Whether they loved it or hated it, all reviewers of the iPad agreed that usability of &#8220;normal&#8221; PCs for average users is atrocious. And I have to agree: whenever I take a look at the PC of a friend or relative who is not a &#8220;computer freak&#8221;, they are always riddled with spyware and malware [...]]]></description>
			<content:encoded><![CDATA[<p>Whether they loved it or hated it, all reviewers of the iPad agreed that usability of &#8220;normal&#8221; PCs for average users is atrocious. And I have to agree: whenever I take a look at the PC of a friend or relative who is not a &#8220;computer freak&#8221;, they are always riddled with spyware and malware or at least ladden with useless software that draws away time and energy of the user (examples are &#8220;Toolbars&#8221; like the Google Toolbar or the Yahoo Toolbar). This is not only because they might have downloaded or installed bad software from questionable sources, but because even vendors or seemingly trustworthy businesses have no qualms to sell their customers. Usually a new PC is already messed up by the software the vendor has preinstalled. If not that, then the new gadget (camera, navigation system, whatever) might come with crappy software.</p>
<p>But I don&#8217;t want to rant about the various ways today&#8217;s PC software and hardware vendors mess up the PC experience. The point is, by many reviewers the iPad has been hailed as the savior from this hell of malware and overly complicated software. What I want to mention is that the &#8220;geeks&#8221; (computer savvy people) have actually been aware of this problem for a long time, and they have invented a solution long before Apple&#8217;s App Store. It is called <a href="http://en.wikipedia.org/wiki/Advanced_Packaging_Tool">APT</a>.</p>
<p>APT is a front end to the package managers of some Linux distributions, most notably Debian and it&#8217;s derivative Ubuntu. By using it you can install software from a trusted repository of open source applications (trusted because it is open to peer review). It is not the only way to install software on these Linux systems, but usually if you opt to install software from another source, you end up feeling slightly icky and dirty, as you should. </p>
<p>To avoid icky spyware, malware and so on, just stick to the official repositories of your Linux distribution. It is as simple as that &#8211; no debilitating iPad required. </p>
<p>Now I have to go ahead and admit that I am not even that well versed with Linux and apt. I know how to find, install and remove programs, and some other internals that are not really important. But isn&#8217;t that kind of the point: you can use Linux and apt even if you are NOT a &#8220;computer freak&#8221;. There are simple front ends that enable you to use it without using the command line. The main difference to Apple&#8217;s App Store is that it is still open &#8211; using apt is entirely optional, but recommended. </p>
<p>Of course, things on Linux don&#8217;t always run as smoothly as with a Mac (although I have whole lot of things to complain about with Macs, too). Not all the software in the repositories is very polished or even bug free. But neither is software in the app store.</p>
<p>As for stability, it helps to look at the hardware Apple has on offer: presumably they only actually sell three or four different kinds of computers (a laptop, which includes the iMac and the Mac Mini which are also based on laptop internals, the Mac Pro, and the iPhone/iPad). Most Linux distributions try to support a far wider range of hardware and therefore are less optimized for any specific piece of hardware. But it would be possible even today to launch computers with a Linux distribution optimized just for these computers. They should have no troubles achieving adequate stability.</p>
<p>Anyway, maybe you get the idea, maybe you don&#8217;t, all I want to say is this: the App store model is NOT our only salvation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2010/02/03/apt-the-app-store-for-geeks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Architecture Analogy For Programming Is Wrong</title>
		<link>http://blog.blinker.net/2009/08/31/the-architecture-analogy-for-programming-is-wrong/</link>
		<comments>http://blog.blinker.net/2009/08/31/the-architecture-analogy-for-programming-is-wrong/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 16:57:47 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Startups]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=29</guid>
		<description><![CDATA[Software Development has taken a lot of inspiration from architecture. Seems to build stable buildings, you have to plan as much as possible beforehand. Once things are put in concrete, it is too late or very expensive to fix mistakes and bugs. In analogy most IT companies try to do a lot of planning before [...]]]></description>
			<content:encoded><![CDATA[<p>Software Development has taken a lot of inspiration from architecture. Seems to build stable buildings, you have to plan as much as possible beforehand. Once things are put in concrete, it is too late or very expensive to fix mistakes and bugs. In analogy most IT companies try to do a lot of planning before sitting down to code.</p>
<p>I believe they might have drawn the wrong analogy, though: the final piece of software is not like the building. The proper analogy for the software is the final plan the architect emits. Building the building is more like then running the completed software on the computer, it happens when the work of the architect is already done. To be sure, while building buildings or running software, you&#8217;ll still notice the one or other flaw that you have to fix &#8220;on the fly&#8221;. But that doesn&#8217;t contradict the general notion.</p>
<p>Why does it matter? Because this misguided paradigm is stifling software development and turning it into an expensive and arduous chore. It is very difficult and therefore expensive to plan everything in software development beforehand. </p>
<p>Unfortunately I don&#8217;t know much about how architects really go about drawing their plans. There might be some interesting lessons there. To be sure there has to be some structure (a building needs windows, doors, stairs, toilets, &#8230;), but I suspect overall it is much more free form and creative than misguided software development. For now I just felt like throwing that thought snippet out there&#8230; Please comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2009/08/31/the-architecture-analogy-for-programming-is-wrong/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting up a git repository that is accessible via HTTP WebDAV</title>
		<link>http://blog.blinker.net/2009/07/21/setting-up-a-git-repository-that-is-accessible-via-http-webdav/</link>
		<comments>http://blog.blinker.net/2009/07/21/setting-up-a-git-repository-that-is-accessible-via-http-webdav/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 13:00:37 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Computer Stuff]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[http-push]]></category>
		<category><![CDATA[MacPorts]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[WebDAV]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=28</guid>
		<description><![CDATA[I finally managed to set up a git repository on my debian server that can be accessed via http WebDAV. Since there were a few stumbling blocks I could not find any information on, I thought I should blog a quick note. This won&#8217;t be interesting to many visitors of my blog, but perhaps it [...]]]></description>
			<content:encoded><![CDATA[<p>I finally managed to set up a git repository on my debian server that can be accessed via http WebDAV. Since there were a few stumbling blocks I could not find any information on, I thought I should blog a quick note. This won&#8217;t be interesting to many visitors of my blog, but perhaps it can save some people a bit of time if they run into the same problems as I did.</p>
<p>First I have to say that I don&#8217;t know very much about the ins and outs of git yet (and the same goes for WebDAV). I merely tried to follow some tutorials for setting up a central git repository. I am not even sure if access via http is a very good idea. But I am sharing the server and before git we used subversion via WebDAV, so it seemed like the most consistent way to go the same route for git.</p>
<p>For the most part I followed the instructions found in this <a href="http://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt">&#8220;git server over http tutorial&#8221; on kernel.org</a></p>
<p>This almost worked, but left out issues with https and a strange command named &#8220;git update-server info&#8221; that needs to be run on the server after each commit. Luckily it will be run automatically eventually, but the first time it has to be run by hand (or so it seems). </p>
<p>Since the tutorial at kernel.org covers most steps, I&#8217;ll describe the problems I had first and then try to give a very brief <a href="#summary">summary</a> of all steps in at the end of the article.</p>
<h4>git update-server-info, file ownerships and update hooks</h4>
<p>One issue I ran into was that after trying to push to the server, git push would end with<br />
<code><br />
Updating remote server info<br />
PUT error: curl result=22, HTTP code=403<br />
</code></p>
<p>And after that I could still not pull the changes from the server into another clone.</p>
<p>I could not find any info on this on the net. It turned out that there were some files in the git repository that were not owned by www-data (the apache2 user). I suspect it happened when I executed </p>
<p><code>git update-server-info</code> </p>
<p>on the server, which I was supposed to do once in the beginning (according to a website I unfortunately can&#8217;t find anymore now). So making www-data the owner of all files by executing</p>
<p><code>chown -R www-data /path/to/git-repo</code> </p>
<p>fixed that. </p>
<p>As for the initial call of git update-server-info, I am not sure. Maybe it would not have been necessary had the &#8220;hook&#8221; worked from the beginning. But in case there are problems, it is probably worth executing.<br />
<code><br />
git update-server-info<br />
</code></p>
<p>in the root directory of the git repository once. After that, check again that all file permissions are correct (www-data should be the owner of all files). </p>
<p>It seems in subsequent git push calls git triggers the update-server-info hook automatically. </p>
<p>Frankly it makes me feel a bit uneasy &#8211; it seems WebDAV allows writing to the git repository and executing files &#8211; could it overwrite the executable and then execute it? A bit more than what I would like to allow guest users. But WebDAV and git where implemented by smart people, so for now I&#8217;ll assume that it is going to be OK (and I don&#8217;t have guests on there yet anyway). </p>
<h4>HTTPS, self-signed root certificates and curl+ssl on OS X with MacPorts</h4>
<p>The other problem I had was that I wanted to allow HTTPS access only. Our apache server uses a self signed root certificate that somehow had to be made known to git. Otherwise git operations would fail because it could not validate the certificate. The tutorial on kernel.org writes that you can disable the validation, but that is a temporary solution at best.</p>
<p>Apparently git uses libcurl, so making the certificate known to curl fixed the problem. However, by default curl on OS X does not even have ssl support built in if it is installed via MacPorts. I found a <a href="http://naleid.com/blog/2009/03/16/enabling-https-support-in-curl-installed-through-macports-on-osx/">blog article on enabling https support</a> which explains that the remedy is to install curl with options as follows:<br />
<code><br />
sudo port install curl +ssl<br />
</code></p>
<p>First the old version has to be uninstalled, though (or MacPorts has to be convinced in some other way to do the upgrade &#8211; Update: via Twitter <a href="http://twitter.com/macports/status/2765516488">@MacPorts told me to use &#8220;sudo port -fn upgrade curl +ssl&#8221;</a>). This turned out to be very complicated for someone who does not know MacPorts very well. Simple port uninstall commands would fail because of dependencies, and even<br />
<code><br />
sudo port uninstall --follow-dependents curl<br />
</code></p>
<p>Would fail because sometimes there would still be multiple versions of packages around and MacPorts would then not know which ones to uninstall (yeah right, because I want to keep the outdated package??).</p>
<p>After a bit of Yahoogling I found that I could purge all the outdated packages with the command<br />
<code><br />
sudo port -f uninstall inactive<br />
</code></p>
<p>The -f is for force, however, so it uninstalls even if there might be some dependencies. I have not yet checked if any other packages have stopped working. Also, for the future I know to run &#8220;port -u upgrade&#8221; instead of &#8220;port upgrade&#8221;, as the -u flag is supposed to tell MacPorts to uninstall the outdated versions right away.</p>
<p>With that cleared up, I could uninstall and reinstall curl and curl +ssl. One more thing to do about the certificates problem: make it known to curl. Our certificate was already in PEM format, so all there was to it was to add the text from the PEM certificate to /usr/share/curl/curl-ca-bundle.crt and git stopped complaining about the certificates. curl will name the location of it&#8217;s ca-bundle, in case it is located elsewhere on your system. I really added the certificate manually by opening curl-ca-bundle.crt in a text editor and copy+pasting the root certificate text (UPDATE: I just realized that MacPorts replaced that file when updating curl+ssl &#8211; looking for workaround). There are tutorials for importing the certificates from Firefox, but I don&#8217;t think they necessarily work for OS X. However, Firefox might provide an easy way to convert certificates to PEM, as it lets you choose the format for exporting certificates (in &#8220;Preferences&#8221;-&gt;&#8221;Advanced&#8221;-&gt;&#8221;View Certificates&#8221;).</p>
<p>Update: on Ubuntu 9.04 I also had problems to let curl know about the certificate. What worked where the instructions found at <a href="https://help.ubuntu.com/community/OpenSSL#Using%20PKCS#12%20Certificates%20in%20Client%20Applications">help.ubuntu.com</a> for &#8220;Importing a Certificate into the System-Wide Certificate Authority Database&#8221;.</p>
<p>However, somehow git on Ubuntu does not ask me for a password and just fails with error code 22 (unauthorized). As a workaround for the time being I tried to hardcode my password into the remote URL (username:password@url), but that led to an error message (<a href="https://bugs.launchpad.net/ubuntu/+source/git-core/+bug/293553">same as this one</a>). Putting my login information into ~/.netrc as follows worked:<br />
<code><br />
machine domain.name<br />
login foo<br />
password bar<br />
</code></p>
<p>I am not very happy with that, though, as it puts my password into a file in clear text. </p>
<h4 id="summary">quick steps summary (on Debian Linux)</h4>
<p>Create directory for repository, either below apache2 DocumentRoot (usually /var/www) or some other lcoation you deem suitable</p>
<p><code>mkdir myproject.git</code></p>
<p>Init git repository with &#8211;bare option (apparently to make sure it never gets into unclean state &#8211; it should not be used the same way a local git repo is being used). Make accessible to www-data (apache user).<br />
<code><br />
cd myproject.git<br />
git --bare init<br />
git update-server-info<br />
chown -R www-data.www-data .<br />
</code></p>
<p>(note: install git with apt-get install git-core, the package &#8220;git&#8221; seems to be something else). Enable WebDAV (it seems I did not need the dav_fs as suggested in the kernel.org tutorial)</p>
<p><code>a2enmod dav</code></p>
<p>Configure apache for allowing WebDAV to the git repository. I also require SSL &#8211; however I won&#8217;t go into this. The infrastructure already existed on my server and I don&#8217;t want to search for tutorials now. There should be plenty of tutorials on setting up SSL for apache2. The same goes for setting up BasicAuth. Also I did not add my changes to /etc/apache2/httpd.conf but to the respective VirtualHost config file for my domain in /etc/apache2/sites-available (as our apache2 serves multiple domains). </p>
<p>My config looked something like this:<br />
<code><br />
   Alias /git/myproject /path/to/git/repo/on/server<br />
</code><code><br />
  &lt;Location /git/myproject&gt;<br />
    SSLRequireSSL<br />
    DAV on<br />
    AuthType Basic<br />
    AuthName "yourDomainForBasicAuth"<br />
    AuthUserFile /etc/apache2/path/to/password-file<br />
    Require user username-in-passwordfile<br />
  &lt;/Location&gt;<br />
</code></p>
<p>Restart apache2 with /etc/init.d/apache2 restart and things should be ready to go. As described at kernel.org, configure the remote location for your local git repo as follows<br />
<code><br />
git config remote.upload.url https://&lt;username&gt;@&lt;servername&gt;/git/myproject/<br />
</code></p>
<p>I suppose &#8220;upload&#8221; is actually an arbitrary name you can choose. The trailing &#8220;/&#8221; is important. From then on you can just </p>
<p><code>git push upload master</code></p>
<p>to the repository. (If the project is not yet in git, execute &#8220;git init&#8221; in the top level directory of the project first). </p>
<p>On the other hand, to check out the project from the server into a new working directory (let&#8217;s call it &#8220;my-project-dir&#8221;), I did<br />
<code><br />
git clone https://&lt;username&gt;@&lt;servername&gt;/git/myproject/ my-project-dir<br />
</code></p>
<p>Not sure actually if that is the best way &#8211; git has so many variations. But when I had done it like that, the way to push changes to the server would be</p>
<p><code>git push origin master</code></p>
<p>I suppose because I pulled the project from the server, the server repo is now known as &#8220;origin&#8221;, no need to configure anything else. There is a certain logic to it apparently.</p>
<p>I have not yet set up passwords via .netrc as described in the kernel.org tutorial, so that step is optional.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2009/07/21/setting-up-a-git-repository-that-is-accessible-via-http-webdav/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating &#8220;Twitter This&#8221; Links</title>
		<link>http://blog.blinker.net/2009/06/05/creating-twitter-this-links/</link>
		<comments>http://blog.blinker.net/2009/06/05/creating-twitter-this-links/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 22:18:53 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Throwaway Ideas]]></category>
		<category><![CDATA[link generator]]></category>
		<category><![CDATA[tweet this]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitter this]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=24</guid>
		<description><![CDATA[To jump to the link generator directly, scroll down or click here. Note that the form only works on my blog, on blog aggregators the JavaScript will probably be missing.
Nicole Simon has brought to my attention that creating &#8220;Twitter This&#8221; links is not as trivial as it might seem. I hope to remedy the situation [...]]]></description>
			<content:encoded><![CDATA[<p><em>To jump to the link generator directly, scroll down or <a href="#twitterThisForm">click here</a>. Note that the form only works on my blog, on blog aggregators the JavaScript will probably be missing.</em></p>
<p><a href="http://nicole-simon.eu/">Nicole Simon</a> has brought to my attention that creating &#8220;Twitter This&#8221; links is not as trivial as it might seem. I hope to remedy the situation by providing a simple tool for creating such links.</p>
<p>What is a &#8220;Twitter This&#8221; link? Simply, a link that brings the user to the Twitter page with a prepared status text field. All the user has to do to tweet your prepared text is to click the &#8220;Update&#8221; button. For example, if you click <a href="http://twitter.com?status=A%20handy%20form%20for%20generating%20%E2%80%9CTwitter%20This%E2%80%9D%20links,%20created%20by%20@Fractality%20:%20http://bit.ly/twitterthislinks">this link</a>, you should be transferred to Twitter with the prepared status message </p>
<blockquote><p>A handy form for generating &#8220;Twitter This&#8221; links, created by @Fractality : http://bit.ly/twitterthislinks</p></blockquote>
<p>(Following this link does NOT tweet the text, you still have to press &#8220;Update&#8221;. Why don&#8217;t you go ahead and just tweet it &#8211; thanks! <img src='http://blog.blinker.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). It even works if you are not currently logged in to Twitter. After you login, you should also see the prepared status update form. Alas, it does not (yet) work if the user has no Twitter account yet and decides to sign up on the spot. After the signup process, the text is lost (but if the user clicks on your link again, it will then work).</p>
<p>In my opinion, this is the preferred way to encourage users to tweet about you. Many Twitter applications ask for the user&#8217;s login credentials instead and then proceed to post in the user&#8217;s name. Admittedly, sometimes that might seem more effective because users might not even realize it is happening at first &#8211; so they will tweet about you even if they never intended to do so. But I consider it a slightly dirty trick, which might alienate users in the long run. Also, personally I have never given my login credentials to a Twitter app (OK, maybe once or twice, but I regret that now), and many users might feel the same.</p>
<p>How does one create such links? It is rather simple: add a parameter named &#8220;status&#8221; to the Twitter URL, like this: <span style="font-weight:bold">http://twitter.com?status=your_message</span>, where <span style="font-weight:bold">your_message</span> is your message. The minor issue is that <span style="font-weight:bold">your_message</span> has to be <a href="http://en.wikipedia.org/wiki/Url_encoding">URL encoded</a>. That means certain characters in the message have to be escaped, for example &#8220;&lt;&#8221; becomes &#8220;%3C&#8221;. Most programming languages have utility methods to do this. For example you could simple paste the following snippet into your browser&#8217;s URL field and press return: </p>
<p><code>javascript: encodeURIComponent('a text that needs encoding');</code> </p>
<p>(except you have to be careful about &#8216; and &#8220;, so that approach is not 100% failsafe).</p>
<p>To make it easier for you, I have created a simple form for creating such URLs. Enter the text you want to be tweeted in the &#8220;Text To Tweet&#8221; field. In &#8220;Link Text&#8221; you can enter a text that should appear as the name of the link. If you then press &#8220;Create Links&#8221;, the &#8220;Twitter This URL&#8221; field should contain the &#8220;Tweet This&#8221; link. For your convenience the &#8220;HTML Link Code&#8221; field contains a full HTML link element you can Copy+Paste into your web site (make sure you copy all of it, I recommend right clicking into the field and choosing &#8220;select all&#8221;). &#8220;Link Preview&#8221; shows you how the link should look on your web site.</p>
<p>Finally, if you liked this post and/or find the link generator useful, please <a href="http://twitter.com?status=A%20handy%20form%20for%20generating%20%E2%80%9CTwitter%20This%E2%80%9D%20links,%20created%20by%20@Fractality%20:%20http://bit.ly/twitterthislinks">twitter this</a>. Also follow me on Twitter <a href="http://twitter.com/Fractality">@Fractality</a>.</p>
<p><script type="text/javascript" src="/wp-content/themes/default_bg/scripts/twitterthis.js">&nbsp;</script><br />
<script type="text/javascript" src="/wp-content/themes/default_bg/scripts/backgroundCharCount.js">&nbsp;</script></p>
<form id="twitterThisForm" action="javascript:return false;">
<fieldset>
<legend>&#8220;Twitter This&#8221; Link Generator</legend>
<table>
<tr>
<td><label for="statusText">Text To Tweet:</label></td>
<td align="left">
<textarea onkeypress="updateCharCount('statusText');" name="statusText" id="statusText" cols="40" rows="2" style="background-repeat: no-repeat;background-position: bottom right"></textarea>
</td>
</tr>
<tr>
<td><label for="linkText">Link Text:</label></td>
<td align="left">
<input name="linkText" type="text" size="30" maxlength="30" id="linkText" value="twitter this"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Create Links" onclick="computeOutput();return false;">
</td>
</tr>
<tr>
<td><label for="twitterURL">Twitter This URL:</label></td>
<td align="left">
<textarea readonly="readonly" name="twitterURL" id="twitterURL" cols="40" rows="6"></textarea>
</td>
</tr>
<tr>
<td><label for="twitterLink">HTML Link Code:</label></td>
<td align="left">
<textarea readonly="readonly" name="twitterLink" id="twitterLink" cols="40" rows="6"></textarea>
</td>
</tr>
<tr>
<td><span style="font-weight:bold">Link Preview: </span></td>
<td align="left"><span id="linkPreview">&nbsp;</span></td>
</tr>
</table>
</fieldset>
</form>
<p><script type="text/javascript">updateCharCount("statusText");</script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2009/06/05/creating-twitter-this-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>@OfficeWorkout &#8211; Twitter bot to keep you fit</title>
		<link>http://blog.blinker.net/2009/06/02/officeworkout-twitter-bot-to-keep-you-fit/</link>
		<comments>http://blog.blinker.net/2009/06/02/officeworkout-twitter-bot-to-keep-you-fit/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 09:10:26 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Entertainment]]></category>
		<category><![CDATA[Throwaway Ideas]]></category>
		<category><![CDATA[exercise]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitter api]]></category>
		<category><![CDATA[workout]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=22</guid>
		<description><![CDATA[I have created a new Twitter bot: @OfficeWorkout tweets a random workout suggestions every 30 minutes. It should remind you to move your body occasionally if you are a screen worker.
I am looking for more suggestions for workouts that mesh well with office life. Best way to tell me would be to tweet them to [...]]]></description>
			<content:encoded><![CDATA[<p>I have created a new Twitter bot: <a href="http://twitter.com/OfficeWorkout">@OfficeWorkout</a> tweets a random workout suggestions every 30 minutes. It should remind you to move your body occasionally if you are a screen worker.</p>
<p>I am looking for more suggestions for workouts that mesh well with office life. Best way to tell me would be to tweet them to @OfficeWorkout (&#8220;suggest @OfficeWorkout yourWorkoutIdeaHere&#8221;).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2009/06/02/officeworkout-twitter-bot-to-keep-you-fit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A big problem with OpenID: phishing</title>
		<link>http://blog.blinker.net/2009/01/09/a-big-problem-with-openid-phishing/</link>
		<comments>http://blog.blinker.net/2009/01/09/a-big-problem-with-openid-phishing/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 12:16:27 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[OpenID]]></category>
		<category><![CDATA[Phishing]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=20</guid>
		<description><![CDATA[Hopefully I won&#8217;t embarrass myself too much with this post, because I haven&#8217;t really researched the ins and outs of OpenID. From using it a couple of times I got the impression that the concept has a big flaw, though. 
Usually what happens when I try to sign up to a site with OpenID is [...]]]></description>
			<content:encoded><![CDATA[<p>Hopefully I won&#8217;t embarrass myself too much with this post, because I haven&#8217;t really researched the ins and outs of OpenID. From using it a couple of times I got the impression that the concept has a big flaw, though. </p>
<p>Usually what happens when I try to sign up to a site with OpenID is that the site forwards me to my OpenID provider. Then I have to login to that OpenID provider&#8217;s site and confirm to the OpenID provider that I want to login to the original site.</p>
<p>And that is the problem right there: some random site of the internet forwards me to my OpenID provider, where I proceed to enter my login credentials. That is a classic phishing scenario.</p>
<p>How can I be sure that the site I am being forwarded to is really the site of my OpenID provider? Phishers are experts at mimicking other sites. They could forward me to another site that looks almost the same as the site of my OpenID provider. Often this is done by slightly misspelling the name of the site, in some cases the name even looks the same because there are different letters in other languages that look the same, so it is impossible to spot the difference. </p>
<p>There are some mechanisms that try to prevent site spooking, such as HTTPS, but I think the reality is that none of them really are good enough. The only way to make sure you are on the site you want to be is to type in it&#8217;s url by hand, without making any spelling mistakes (even then it is probably not 100% sure, because the domain name resolution system could also be tampered with &#8211; but that is another topic altogether, and I don&#8217;t know much about it). For the same reason one shouldn&#8217;t click on links in emails, for example if you get a link by (supposedly) ebay to check your auction, that email could be from a fake ebay linking to a spooked ebay that will phish your ebay login.</p>
<p>But I don&#8217;t want to educate about phishing, there is enough information about it on the internet already. I just wanted to raise my concerns about this problem with OpenID.</p>
<p>Many might feel that the problem is not really severe, or maybe it is just a problem of the particular implementations of OpenID that I have used. My own feeling is that as web developers we have a responsibility to not encourage dangerous behaviour on the side of our users, therefore OpenID in it&#8217;s current form has lost a lot of appeal to me.</p>
<p>One possible way to deal with the problem would be to always stay logged in to one&#8217;s OpenID provider and never log in when being forwarded to it. Hopefully if you are already logged in, you don&#8217;t need to login when being forwarded, you only have to confirm the authentication request of the original site.</p>
<p>Please leave comments and correct me if I am wrong. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2009/01/09/a-big-problem-with-openid-phishing/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Impressions from the iPhone Tech Talk in Berlin (kind of)</title>
		<link>http://blog.blinker.net/2008/11/11/impressions-from-the-iphone-tech-talk-in-berlin-kind-of/</link>
		<comments>http://blog.blinker.net/2008/11/11/impressions-from-the-iphone-tech-talk-in-berlin-kind-of/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 09:51:48 +0000</pubDate>
		<dc:creator>Björn</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.blinker.net/?p=15</guid>
		<description><![CDATA[The bad news is, Apple needlessly slapped a &#8220;confidential&#8221; sign across the tech talk today, so nobody is allowed to write anything about it or post any pictures. 
I think I can nevertheless write some thoughts I took away, without giving away anything about the content of the sessions. So what I write might have [...]]]></description>
			<content:encoded><![CDATA[<p>The bad news is, Apple needlessly slapped a &#8220;confidential&#8221; sign across the tech talk today, so nobody is allowed to write anything about it or post any pictures. </p>
<p>I think I can nevertheless write some thoughts I took away, without giving away anything about the content of the sessions. So what I write might have been inspired by the lectures, or by something completely unrelated, like surfing a web site or talking to people.</p>
<p>Some things to know first: I left early because I got bored, so I missed roughly the last two lectures. Also, I don&#8217;t have an iPhone myself yet, and my friends would perhaps even describe me as an Apple hater. I really don&#8217;t like Apple&#8217;s restrictive policies, and I don&#8217;t even like OS X, but that is a story for another post. The iPhone is nice enough to make me overlook the general flaws of Apple. For one thing, I gave up on mobile games development with Java because it became too tedious to support all the available devices. The iPhone is one device (OK, strictly speaking three: old iPhone, iPhone 3G and iPod touch) that has sold several million times, making it possible to develop useful applications targeted at one device only. And Apple really got a lot of things right, I don&#8217;t think any other phone comes close in usability.</p>
<p>If I don&#8217;t have an iPhone yet, it is because I don&#8217;t like the conditions of the T-Mobile Germany contracts. Specifically the UMTS bandwidth limitation seems silly, since the iPhone makes it possible to surf normal web sites. So I would expect the T-Mobile bandwidth to be consumed rather quickly.</p>
<p>Without a doubt, a lot of fun can be had with the iPhone, and a lot of fun applications already exist. </p>
<p>What follows is mostly me venting my frustration about having to use Objective-C. I had to say it somewhere&#8230; It is not the only thing I took away from the tech talk, but it was a tech talk after all, so you can guess about the main topics. I had a nice idea for a possible iPhone app while dozing in the lecture, and I also met some nice people, so going there was not all in vain. Oh, and I got a T-Shirt, too.</p>
<h3>Objective-C, the strange beast</h3>
<p>My main gripe, however, is the programming language. Most people I talked to say that it is not so bad, but my programmer instincts make me shy away from Objective C for several reasons. Granted, most of them probably sound like nitpicking and my objections might make me seem petty. But I have become a programmer out of laziness, and so I absolutely can&#8217;t stand it if a programming language is making me do stuff that isn&#8217;t necessary.</p>
<h4>Header files (Shudder!!!)</h4>
<p>Objective-C seems to be a strange beast: on the one hand it apparently is &#8220;fully dynamic&#8221; (Apple speech), meaning among other things that methods are not statically linked at compile time. On the other hand it borrows from C and C++, with ugly pointers cluttering the code, but much, much worse, forcing you to write header files for your classes. </p>
<p>I am not a language designer, but for the life of me, I can not get these two aspects combined in my head (dynamic linking and header files) &#8211; either one feature seems to make the other one pointless. Dynamic means you can modify classes at runtime, so what is the point of the header files? </p>
<p>I have programmed in languages without header files for 10 years now, so I can confidently say that there is no excuse for header files. I think they only exists because of the laziness of the developer of the compiler. But then again, those guys had several years to improve their compiler. What is up with that? </p>
<p>For the non-programmers: a header file basically means that I have to program every object and method in my program twice. Once to tell the compiler that it exists, and once to actually implement it. </p>
<p>It is certainly not difficult, but just as certainly it is not fun. For someone with my condition it becomes very difficult to do because I generally have a very hard time doing things that I see no point in doing.</p>
<h4>No garbage collection</h4>
<p>Another gripe is that Objective-C for the iPhone does not have garbage collection, so the developer has to take care of erasing objects by himself. Curiously, many people I talked to seemed to agree that this makes sense for a mobile device, because resources are so limited. Well, it seems the recommended maximum memory consumption for an iPhone app is 25MB. I have developed games for mobile phones in Java that had only 800KB available as runtime memory, with garbage collection. No problem whatsoever. A slightly more plausible explanation: garbage collection usually runs in a background thread, and having that thread constantly running might consume more energy. But honestly, I don&#8217;t believe it, that is just a weak excuse.</p>
<p>Also, you don&#8217;t even manage memory directly in Objective-C, but you have to manually take care of the reference counters. This makes even less sense to me, because I don&#8217;t think that is what makes garbage collection difficult. Rather, I would expect counting the references to be compiled into the executable. There might even be garbage collection going on in Objective-C, something still has to free the memory when the reference count has reached zero, after all. Again, this just reeks of laziness on behalf of the developers of the compiler.</p>
<p>Maybe inserting the reference counting into the executable would inflate the memory footprint marginally, but honestly, these days the size of the code is never the problem. Most memory is consumed by the data, for instance images that are being loaded by the application.</p>
<h4>Hungarian Notation (Shudder!!!)</h4>
<p>One more unbearable thing I have seen in code snippets from Apple: it seems it is customary in Objective-C to use the useless kind of hungarian notation. That means it is customary to call a widget UIWidget instead of Widget, because it belongs to the UI. <a href="http://www.joelonsoftware.com/articles/Wrong.html">Joel On Software has the ultimate essay on hungarian notation and how it should be done</a>, mandatory reading for every programmer in my opinion. </p>
<p>Again, this might sound like a non-issue, but it makes me feel almost like the heroine of William Gibson&#8217;s &#8220;Pattern Recognition&#8221; upon seeing the Michelin Man: it is almost as if I am psychologically allergic to this ugliness and extremely bad taste. It sounds innocent if you see just one line, but imagine thousands of lines of code littered with hungarian notation. It is unreadable, unless you train your brain to just not notice it. But why should I have to do this to my brain?</p>
<h4>More ugliness</h4>
<p>I have mentioned the pointers, something I also haven&#8217;t seen in years. Going back to using pointers makes me feel like coding in the stoneage, and they also look ugly. In the same category as the header files fall the interfaces (forgot their real name, but they work exactly like the interfaces in Java). I see no need for them in a dynamic language, so please don&#8217;t make me use them. At least possibly one really can get away with not using them, I don&#8217;t know for sure. </p>
<h4>Hope in the form of alternative programming languages?</h4>
<p>Which brings me back to my original gripes with Apple. Is there hope of relief in the form of alternative programming languages coming to the iPhone eventually? Apple certainly hasn&#8217;t leaked any plans, and worse, they officially outlaw interpreters of programming languages. The reason is clear: with an interpreter of another programming language (for example a Java virtual machine), people could circumvent the Apple AppStore and get applications from other sources.</p>
<p>This alone does not prevent other languages, though, at least I don&#8217;t think it does. I think it would still be legal to use an interpreter just for one&#8217;s own application, without exposing it to other applications. Or one could use another language that compiles to Objective-C. One such language seems to be <a href="http://en.wikipedia.org/wiki/Objective-J">Objective-J</a>. Still, I think the rule against interpreted languages at least slowed development efforts for alternative programming languages for the iPhone. </p>
<p>There are rumors that there will be an adapted (=restricted) version of Flash eventually, but it is not yet clear if it will be possible to write iPhone applications with it, or if it will just enable web sites.</p>
<p>I have found a <a href="http://luaforge.net/projects/luaobjc/">Lua bridge to Objective-C</a>, but it doesn&#8217;t sound as if the iPhone is supported so far.</p>
<p>Personally I still have some hopes for Javascript. There already is a Javascript interpreter in the iPhone, coming with Safari, that can also be instantiated from within an iPhone application. I don&#8217;t know yet how much one can interface with the usual iPhone features from Javascript, and if it is possible to run Javascript without actually displaying the WebView (Safari/WebKit). Most people I talk to about this are of the opinion that one should write iPhone Apps in Objective-C to get to use all the fancy features, but I am not fully convinced yet. I hope at least for some apps on can get away with Javascript (obviously not if you are writing a 3d game), so it might be sufficient to get one&#8217;s feet wet in iPhone development. Even just to be able to write some parts of the application in JavaScript would be a relief.</p>
<p>Meanwhile, I keep hopes for finding alternative languages for iPhone development. Please let me know if you find any. I probably won&#8217;t use Objective-J, though, because it seems too proprietary for my taste. If I learn a new programming language, I want it to be as universally useful as possible.</p>
<p>Ultimately it is the end product that matters, of course. I have programmed in the Linden Scripting Language for Second Life before, which is the crappiest language I have ever seen. Nevertheless it was fun, because the things you could achieve with it were so much fun. Probably it will be the same with iPhone development. Once I really get started and get to see results on the phone, Objective-C won&#8217;t feel so painful anymore. Still, I wish there were other options. Options makes me remember: I have also heard people say that XCode is not all that great either, and apparently it is not so easy to use alternatives. Too bad.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blinker.net/2008/11/11/impressions-from-the-iphone-tech-talk-in-berlin-kind-of/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
