Writing a Parser Is Boring?

When inter­act­ing with dif­fer­ent ser­vices or pro­gram there often comes the point where some sort of file has to be parsed into a data struc­ture, which can be processed lat­er. For stan­dard file for­mats like XML or JSON parsers are avail­able for almost any lan­guage out there. (BTW I love the graph­i­cal rep­re­sen­ta­tion of the JSON syn­tax on their website.)

There are how­ev­er sit­u­a­tions in which one has to deal with a pro­pri­etary file for­mat or with ven­dor-spe­cif­ic exten­sions to a stan­dard­ized for­mat. At this point a pars­er has to be writ­ten. It seems a bor­ing task, how­ev­er there are sev­er­al impor­tant aspects of pro­gram­ming which can be learned here.

Read More

Dancing the DHCP Samba

After a hard­ware fail­ure of a Lin­ux com­put­er I took the chance to set up a Debian instal­la­tion from scratch. So I saved the data that was impor­tant to a serv­er, burned the Debian DVD and installed it on the computer.

When it came to net­work­ing it got a lit­tle more com­pli­cat­ed: as the serv­er is using the cor­po­rate net­work, it had to send a spe­cif­ic host name to obtain the IP con­fig­u­ra­tion via DHCP. So that was what I did: I entered the host name and let dhcp­client do its mag­ic. It took some time, but final­ly it was set up. All DNS entries for this host name and its cor­re­spond­ing IP were correct.

Read More

Deploying a Wireless Network in Your House

The rise of mobile elec­tron­ic devices, which need inter­net access has changed the demand we have on our home net­works. The days are over where one had a sin­gle com­put­er con­nect­ed with a wire to the broad-band inter­net modem. WLANs became very pop­u­lar because net­work client became more mobile. It start­ed with the note­books with which you could browse the net on your couch com­plete­ly wire­less­ly and it became even more pop­u­lar with the rise of the iPhones and iPads which should use the home inter­net access when used around the house. The ques­tion to solve is:

How can one achieve a good WLAN cov­er­age so that one can use his inter­net-depend­ing devices any­where at home?

Read More

Neuer Löwe im Käfig

Seit gestern ist es draussen, das neue Mac OS 10.7 Lion. Das erste Release, dass nur noch online zu beziehen ist. Auf der einen Seite ist das sicher­lich pos­i­tiv, allerd­ings wenn man eine nicht sooo bre­it­bandi­ge Inter­netverbindung hat, kann der Down­load zur Geduld­sprobe werden.

Ich werde in ein­er kleinen Serie von Beiträ­gen bericht­en, wie die Instal­la­tion funk­tion­ierte und was meine ersten Ein­drücke sind. Auf meinem Haup­trech­n­er, dessen Betrieb­ssys­tem seit dem Kauf mit 10.4 Tiger immer kon­tinuier­lich aufgerüstet wurde, ohne einen Neuan­fang zu machen, werde ich nun einen Schnitt machen und mit einem frischen Lion anfan­gen. Inwiefern man es hin­bekommt, aus dem Installer ein boot­fähiges Medi­um zu basteln werde ich sehen und entsprechend berichten.

Chrome OS — News von der Google I/O 2011

Am zweit­en Tag der Google I/O 2011 wur­den in der Keynote einige Neuerun­gen in Googles Chrome Brows­er und in Chrome OS vorgestellt. Der Unter­schied zwis­chen diesen bei­den beste­ht darin, daß es sich bei Chrome OS um ein kom­plettes Betrieb­ssys­tem han­delt, in nur eine App­lika­tion läuft: ein Chrome Brows­er. Um noch einen weit­eren ähn­lichen Namen hinzuzufü­gen gibt es auch noch Chromi­um, das ist das Open Source Pro­jekt, in dem Chrome und Chrome OS entwick­elt wer­den. Unter der Haube han­delt es sich bei Chrom(ium) OS um eine Vari­ante von Gen­too Linux.

Read More

Solarized — A Balanced Color Scheme for Text Editors

Col­ors schemes for text edi­tors is just like the favorite edi­tor itself a con­tro­ver­sial­ly dis­cussed and often very per­son­al mat­ter. Speak­ing about col­ors often the per­son­al taste is the main rea­son for a cus­tom col­or scheme or why a spe­cial scheme was cho­sen. How­ev­er the rela­tion between dif­fer­ent col­ors has been stud­ied by artists for a very long time. Col­or the­o­ry with things like the tri­ad, tetrad or com­ple­men­tary col­ors which was all relat­ed to the col­or cir­cle has been the foun­da­tion design­ers worked on a dai­ly basis.

Now these prin­ci­ples have been applied to col­or schemes in text edi­tors. The arrange­ment of col­ors is called Solar­ized and can be found on the pro­jec­t’s home­page. Besides the col­or scheme itself, which is avail­able for a wide range of edi­tors, start­ing from VIM, Emacs to Net­beans, Xcode, SubEthaEd­it or text­mate, the author Ethan Schoonover also explains the prin­ci­ples of why the col­ors were cho­sen that way. The scheme is avail­able in two vari­ants: one for a light back­ground and one for a black background.

What I like about this scheme is how the a good con­trast between fore­ground and back­ground is giv­en with­out over­do­ing it. You can cre­ate the largest con­trast by using a white text col­or on a black back­ground. This how­ev­er would tire your eyes very quick­ly, as the con­trast is too high. Solar­ized in the dark back­ground vari­ant is using a dark grey as a back­ground col­or and a very light grey as the text col­or. What I also like is that if syn­tax high­light­ing is acti­vat­ed com­ment blocks are shad­ed in a dark­er ver­sion of the text col­or to make your code more promi­nent which is great in heav­i­ly com­ment­ed files.

So if you are look­ing for a new col­or scheme for your favorite edi­tor or IDE, check out Solar­ized.

Backing up a Server to Amazon S3


When deploy­ing a serv­er on the inter­net you always have to deal with secu­ri­ty issues. You hard­en your serv­er by set­ting up encrypt­ed con­nec­tions, con­fig­ur­ing a tight fire­wall and putting crit­i­cal ser­vices in a chroot jail. How­ev­er what hap­pens if an intrud­er hacks into your serv­er and deletes your con­tent? Or if you make a mis­take and erase some data? The last line of defense is hav­ing a good back­up strategy.

The ques­tion aris­es what do back­up and where to back it up. For me some­thing like to holy grail would be hav­ing a fast, reli­able, file-sys­tem-based back­up solu­tion like the snap­shot fea­ture in ZFS. It should then be pos­si­ble to sync these snap­shots in a band­width-effi­cient man­ner to a remote location.

Using Duplicity for Backup

There are a lot of dif­fer­ent solu­tions around, how­ev­er they dif­fer in secu­ri­ty, price and reli­a­bil­i­ty. Duplic­i­ty is one of them. It is rel­a­tive­ly easy to set up if you have a sim­ple back­up prob­lem, such as back­ing up the web serv­er and its cor­re­spond­ing data­base. The neat thing about Duplic­i­ty is that it can make encrypt­ed, incre­men­tal back­ups using stan­dard file for­mats. For the incre­men­tal part of this oper­a­tion it relies on rdiff to do the heavy lift­ing and it is using GPG to encrypt the back­up with a public/private key pair. One of the oth­er ben­e­fits is that Duplic­i­ty offers out of the box Ama­zon S3 sup­port. This means that you are able to store your back­ups up in the cloud in a save man­ner. By per­form­ing incre­men­tal back­ups only, the costs for traf­fic and stor­age are min­i­mized. In my case which is per­form­ing a dai­ly back­up of the con­fig­u­ra­tion and the blog of the serv­er I nev­er paid any­thing because there is a min­i­mum billing amount per month.

Using a file serv­er in the cloud as the back­up des­ti­na­tion has its ben­e­fits espe­cial­ly in the restore case. Then you can rely on Ama­zon’s band­width to per­form a fast restore instead of using your home cable or DSL connection.

What is happening during a backup?

In the begin­ning, when there are no pre­vi­ous back­ups to be used for incre­men­tal back­ups, Duplic­i­ty is per­form­ing a full back­up. For its back­up files it uses stan­dard tar file for­mat which then gets encrypt­ed using GPG and your pub­lic key. It is then uploaded to a remote server.

The next back­up is an incre­men­tal back­up. This means that duplic­i­ty now first checks if its local cache of pre­vi­ous diffs is up to date with the remote repos­i­to­ry. If that is not the case it down­loads all the pre­vi­ous diffs because it needs them to gen­er­ate the new diff of the most recent changes. It then cal­cu­lates the diff, encrypts it and uploads it togeth­er with a hash of the diff to the remote server.

Backup a Database

When using a web appli­ca­tion often there are not only files, but also data­bas­es to be backed up to be able to ful­ly restore your web page from the back­up. In my case I am using a MySQL serv­er. The way I am doing it is first per­form­ing a mysql­dump and then back­ing this file up. I have writ­ten a small helper script in perl that is kicked off by a cron job.

I use for quite a while now and it is work­ing very nice­ly. As a start­ing point I pub­lished the back­up wrap­per script on github.

DTerm — A Terminal at Your Fingertips for Mac OS X

Some­times it would be great if one could just enter a com­mand in the ter­mi­nal which is relat­ed to the direc­to­ry of the file you are work­ing on: send it to a serv­er via scp, build a tar.gz archive, com­pile it or open anoth­er file. These are all oper­a­tions which have also a graph­i­cal “nice” way of exe­cut­ing it, but leav­ing your hands on the key­board can be so much faster.

The tool, which pro­vides a sys­tem-wide access to the ter­mi­nal is DTerm. It has been around for some time, as it has been released in 2008, but it was men­tioned recent­ly in the very nice mobileMac pod­cast (ger­man) I like a lot. The appli­ca­tion is free.

So what is it all about? With DTerm you define a hotkey (stan­dard is Com­mand-Shift-Return), which will over­lay a win­dow with a text field which accepts ter­mi­nal com­mands. They will be exe­cut­ed in the same direc­to­ry as your front­most appli­ca­tion. DTerm is use­ful if you for exam­ple would like to open anoth­er doc­u­ment in the same fold­er: just press DTer­m’s hotkey, enter open then the begin­ning of the file and press the tab­u­la­tor key to show a com­ple­tion list of all the files in the direc­to­ry. Choose the file and press enter and it is opened with its asso­ci­at­ed appli­ca­tion. Anoth­er use­ful short­cut is open . which opens the cur­rent direc­to­ry in the Find­er. If you are famil­iar with a ter­mi­nal on a *NIX based sys­tem now is the time to use all of your ter­mi­nal hacks every­where in your work­flow with­out touch­ing the Ter­mi­nal application.



DTerm home­page

New Highlighting Support in PasteBinIt

There is a new beta of Paste­BinIt avail­able with a nice fea­ture: high­light­ing sup­port. This means that you can click in the line num­ber gut­ter of the code view to set a mark­er that will show up in the paste­bin as a yel­low marked line

In addi­tion some UI tweaks have been made such as list­ing the 5 most recent syn­tax high­light­ings at the top of the menu.

Get the update here or use the inte­grat­ed updater if you have already down­loaded ver­sion 0.2–2.