Setting up a local DBpedia mirror with Virtuoso

So you’re the guy who is allowed to setup a local DBpedia mirror for your work group? OK, today is your lucky day and you’re in the right place. I hope you’ll be able to benefit from my hours of trials and errors ;) Continue reading

Posted in Coding | Tagged , , , , , , , | 38 Comments

Daylight saving time

Well, you’ll have noticed, in Germany the daylight saving time striked once again… as per Romain I was reminded that many people have a problem remembering when the time is changed in which direction, so here comes my mnemonic (“donkey bridge;) ):

It’s just the same as with garden furniture. In summer you put them in front of your house, in winter you put them back in your cellar.

So this means the time was shifted back one hour from 3 am to 2 am this morning. The only thing when it gets weird if you have a computer which already did the change and something else stubbornly claiming nothing happened.

Posted in Uncategorized | Tagged , | 3 Comments

Beautiful data visualizations and why we need open data

Today when I attended a talk at LWA 2010 I remembered a nice talk about beautiful data visualization by Hans Rosling, that I want to share with you (it’s worth the time):

When I searched for this talk I also came across the follwing two, the one above is a must, if you liked it, you might want to invest more time with these:

And last but not least another nice talk in this area, this time by David McCandless:

Posted in Uncategorized | Tagged , | 1 Comment

How to convert hex strings to binary ascii strings in python (incl. 8bit space)

As this comes across may way again and again:

How do you turn a hex string like "c3a4c3b6c3bc" into a nice binary string like this: "11000011 10100100 11000011 10110110 11000011 10111100"?

The solution is based on the Python 2.6 new string formatting:

>>> "{0:8b}".format(int("c3",16))
'11000011'

Which can be decomposed into 4 bit for each hex char like this: (notice the 04b, which means 0-padded 4chars long binary string):

>>> "{0:04b}".format(int("c",16)) + "{0:04b}".format(int("3",16))
'11000011'

OK, now we could easily do this for all hex chars "".join(["{0:04b}".format(int(c,16)) for c in "c3a4c3b6"]) and done, but usually we want a blank every 8 bits from the right to left… And looping from the right pairwise is a bit more complicated… Oh and what if the number of bits is uneven?
So the solution looks like this:

>>> binary = lambda x: " ".join(reversed( [i+j for i,j in zip( *[ ["{0:04b}".format(int(c,16)) for c in reversed("0"+x)][n::2] for n in [1,0] ] ) ] ))
>>> binary("c3a4c3b6c3bc")
'11000011 10100100 11000011 10110110 11000011 10111100'

It takes the hex string x, first of all concatenates a "0" to the left (for the uneven case), then reverses the string, converts every char into a 4-bit binary string, then collects all uneven indices of this list, zips them to all even indices, for each in the pairs-list concatenates them to 8-bit binary strings, reverses again and joins them together with a ” ” in between. In case of an even number the added 0 falls out, because there’s no one to zip with, if uneven it zips with the first hex-char.

Yupp, I like 1liners ;)

Posted in Coding | Tagged , , , , , , | Leave a comment

Incentives for Creativity

Actually I saw this nice TED-Talk by Dan Pink on Motivation quite a while ago already (see below), but today I was pointed to this amazing animation by Ludger:

Here’s the original talk:

Posted in Uncategorized | Tagged , , , | Leave a comment

Tipp-Ex viral marketing

Well, perhaps you’ve seen it already, but this indeed is a masterpiece of viral marketing worth knowing:

Tipp-Ex: NSFW. A hunter shoots a bear:

Here is a list of things you can let them do. Furthermore, Wikipedia tells us about the company which created this masterpiece: buzzman.fr

Actually their showcase is quite impressive and was unknown to me.

Posted in Uncategorized | Tagged , | 1 Comment

EtherPad: live collaborative text editing

Ever thought that it would be cool to just collaborate with others while writing a document? Well ok, there are wikis but I mean real-time. Not that it’s new or anything (google docs, wave), but EtherPad recently became one of my favorites for this (thanks to Andreas Wagner).

It’s a no login website, you just need the URL and can start. You can host EtherPad yourself if you don’t trust the server.

It’s a great tool for brainstorming in a group (no more poor guy having to log everything, simply add it yourself), writing down some thoughts, coordinating things in a very interactive way.

Mozilla put up a public EtherPad, just try it here and don’t miss the cool time-slider.

Posted in Uncategorized | Tagged , , , , , , , , | 1 Comment

Bash prompt indicating return value

Lately I’ve fiddled a lot with installing virtuoso on some virtual machines and found myself repeatedly asking bash for the return value of the last command echo $?. I remembered this blog post by Gecko quite a while ago and tuned it a bit to my needs. My user prompt now looks like this (it’s a slightly modified version of the old gentoo defaults, that I prefer over the ubuntu defaults, which only remind you that you’re root with a # instead of a $):

The code for the user prompt:

 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w $(if [[ $? = 0 ]];then echo "\[\033[01;34m\]";else echo "\[\033[01;31m\]";fi)\$ \[\033[00m\]'

And the root prompt:

 PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W $(if [[ $? = 0 ]];then echo "\[\033[01;34m\]";else echo "\[\033[01;31m\]";fi)\$\[\033[00m\] '

And a small doc snippet you might want to include with your PS1 in your .bashrc, so you can still understand that cryptic stuff in a few days:

# \h hostname
# \u user
# \w working dir (home == ~)
# \$ a $ if UID == 0 else #
# \A current 24-time: HH:MM
# \\ a \
# \[ begin, \] end of non-printing (control chars)
#
# colors: have to be surrounded by: '\[\033[' and 'm\]' (without the ''. These literally are the left and right bracket!)
#  color codes are as follows, preceeded by a '0;' (dark) (default) or a '1;' (light)
#  FG and BG NULL: 00 resets
#  FG: 30 + ... 0: black, 1: red, 2: green, 3: yellow, 4: blue, 5: violet, 6: cyan, 7: white
#  BG: 40 + ... same
Posted in Coding | Tagged , , , | 2 Comments

P != NP solved?

Well, it happens every now and then, that someone finds a proof for a long standing theoretical problem.
This time it’s the famous P = NP or P != NP problem of computer science that Gecko pointed me to:

Let’s wish him luck that his proof is flawless and accepted.
(Who’s the first one to say: “I’ve always known it” ? :D )

Sadly my wishes didn’t help :-/

Posted in Uncategorized | Tagged , , , , | 9 Comments

WTFPL

Thanks to Ralf I came across this really nice license today. If you’ve ever been lost in the licensing jungle of any software, you’ll understand:
The WTFPL (Homepage includes a nice FAQ section as well ;) ):

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004
 
 Copyright (C) 2004 Sam Hocevar <HIDDEN EMAIL>
 
 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.
 
            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
  0. You just DO WHAT THE FUCK YOU WANT TO.
Posted in Coding | Tagged , , | 1 Comment