Go to the navigation

elblogg

Posts Tagged ‘english’

The kindle guide to the galaxy

This XKCD comic are just asking to be cited.
[An XKCD comic joking about the fact that the kindle is like the hichhikers guide to the galaxy]
Click the image to read the whole comic.

Music recommendation: Nero – Something else / Night Thunder

This holiday I attended the Cushion Dubstep and Jungle event at Inside here in Bergen. Lots of awesome tunes where played, some so awesome that I had to go up to the DJ and ask what he was playing. Then, when I arrived at home, I searched for the artists at Beatport, only to get the message “You’ve already bought this track”. It turned out I had been looking for some nice dubstep a few weeks earlier, and discovered just the same tracks. The artist in question is Nero, an UK based Drum and Bass and Dubstep artist (ok.. pretty much everything that is electronic, deep and hard :D )

And here’s the tracks in question. I specially recommend the second track, Night Thunder.

Go to Beatport.com Get These Tracks Add This Player

And… the music is ofcourse available at Beatport in non-drm’ed MP3, AAC and PCM-WAV.

Also available as a 12″ Vinyl single through Juno Records.

Release code:
ZAUDIO 009
Release date:
September 25th 2008
Label:
Z Audio

Blogging code

As a programmer and linux geek I often need, or at least want to write about code, scripts and commands on my blog, but as many of you know, displaying raw code in HTML is setting yourself up for failure. The simplest part of the problem is the fact that line breaks and whitespace might be significant, this is simply solved by putting the code inside a <pre> block. The more tricky part is that code often is full of characters like &, > and <. Characters that have a specific meaning in HTML and can’t be echoed directly. & needs to be typed as an HTML entity (&amp;), just as > (&gt;) and < (&lt;). Talking about HTML and XML code on your blog can be a really tedious task (as the above).

I have usually solved this by writing the code in a file first, and then running the file through this sed command

cat file.html|sed -e 's/&/&amp;/' -e 's/</&lt;/' -e 's/>/&gt;/'

But as I work on a Macintosh these days, I’ve been using TextMate a bit.. Not as much as i use OpenKomodo though. TextMate has some nice blogging capabilities. You can use it to post directly onto your blog, and it has shortcuts for converting sections of your post into HTML entities. Just select the text, and hit ⌘+&, 1

Edit: it seems like there is some compatibility problems with WordPress 2.7 and TextMate. The post was published two hours off, and as a private post.

Music recommendation: Sub Focus – Time Warp

This one got published somewhat by accident. I was supposed to press the preview button in WordPress, but ended up pressing publish instead. So, this won’t be a brilliant post (would it ever be?).
I listen to the Beatport Drum & Bass podcast. They played these tracks a couple of months ago, then today I stumbled upon it again at juno records, and it’s quite cool :)

Update

No pictures this time though. I’m sitting on the bus from Knarvik to Bergen writing this because this is the only slot of time where I’ve had time to do anything like this for almost a week.
I’ve had multiple deliveries of documentation at work, and that can really stretch your creative muscles for a while. On the moving part; we have now finally moved, we have slept in the new apartment for two nights even though the bed hasn’t been assembled yet.

We did most of the moving last Saturday. Big thanks to all the people that helped with the move. Some stuff where left over for sunday though. Sunday was the day for assembling the kitchen before the plumber got here monday morning. We just got barely enough of the kitchen furniture assembled before midnight sunday.
The plumber(s) oddly enough (being contractors and all) was ready at 07:29 Monday morning, one minute before they was supposed to :) And for those who want to know who these eager plumbers where, they where from Gården Rørleggerservice. The same plumber-company that mounted the dishwasher in the old apartment. That also right on time :)

The electrician we hired was also right on time, and though he did a mistake while assembling the sockets in the kitchen, he also fixed the problem right away.

To sum things up. The kitchen almost looks like a kitchen, and we’re able to prepare food there. Theres still a lot to do. We got hot water in the shower (the heater had broke when we stopped the water a few weeks ago). The livingroom is still full of boxes, though somewhat fewer than on saturday. We sleep on a matress on the livingroom floor. And its 8 days to christmas eve. To top things up, the company I’m working for are moving thursday evening.

Pendulum – Showdown video

Very busy these days. I promise to get back to daily postings once this blows over. (the moving process)

Well… here’s some candy in the mean time:

Pendulum – Showdown

Edit: dubplate digest also posted this video, but from YouTUBE instead of MySpace

Unreadable code

If you’re really trying, you will always be able to write completely unreadable code in any programming language. All the language designers attemts to force you to write readable code, and even making it so the easiest way ahead, even for quick hacks is to write it as readable and reusable code will fail if you’re really trying to write unreadable code.

This guy is obviously concerned about “job security”. (not the blog author, but the code author)

?View Code PYTHON
#!/usr/bin/env python
import os,sys
C=os.chdir
S=os.system
M=os.mkdir
J=os.path.join
A=os.path.abspath
D=os.path.dirname
E=os.path.exists
W=sys.stdout.write
V=sys.argv
X=sys.exit
ERR=lambda m:W(m+"\n")
PRNT=lambda m:W(m+"\n")
assert len(V)==2,"you must provide a sandbox name"
SB=V[1]
H=A(D(__file__))
SBD=J(D(H),SB)
C(SBD)
PST=J(SBD,'bin/paster')
VAR=J(SBD,'var')
ETC=J(SBD,'etc')
S("mkdir -p "+VAR)
PRNT("restarting "+SB)
CMD=";".join(['source %s'%J(SBD,'bin/activate'),PST+" serve --daemon --pid-file=%s/sandbox.pid --log-file=%s/sandbox.log %s/sandbox.ini start"%(VAR,VAR,ETC)])
PRNT(CMD)
S(CMD)
PRNT("All done!")
X(0)

Aaannd… Heres my understanding of the code:

?View Code PYTHON
#!/usr/bin/env python
import os,sys
 
#bail out if there's no sandbox specified
assert len(sys.argv)==2,"you must provide a sandbox name"
sandbox=sys.argv[1]
 
#get the dir of this script
home=os.path.abspath(os.path.dirname(__file__))
 
#sandboxdir is this dir/sandboxname
sandboxdir=os.path.join(os.path.dirname(home),sandox)
 
#go into the root of the sandbox
os.chdir(sandboxdir)
PST=os.path.join(sandboxdir,'bin','paster')
VAR=os.path.join(sandboxdir,'var')
ETC=os.path.join(sandboxdir,'etc')
 
#make var directory if it doesnt exists
if not os.path.exists(VAR):
    os.mkdir(VAR)
 
print "restarting "+sandbox
 
# Build the system commands required to restart the sandbox
cmds=[]
cmds.append('source %s' % os.path.join(sandboxdir,'bin','activate'))
cmds.append(PST+" serve --daemon --pid-file=%s/sandbox.pid"
            "--log-file=%s/sandbox.log %s/sandbox.ini start" % (VAR,VAR,ETC))
CMD=";".join(cmds)
PRNT(CMD)
 
#run the cmds
if os.system(CMD) == 0:
    print "All done!"
    sys.exit(0)
else:
    print "Ooops. failed."
    sys.exit(1)

The value of tool…

… is greater than zero.

Python is a dynamically, strong typed programming language. In my opinion that makes it more important to have good tools than for statically typed languages. Sadly, it also makes it more difficult to create great code analysis tools and IDEs. Meanwhile, I find more people in the Python community that is happy coding with Vi(m) even for quite large projects, than in the Java community. My guess is that that is because the tool support for Python has been poor.

When your IDE shouts at you with red lines under your function calls because it’s not able to look up in your custom libraries, of course you’ll refuse to accept it, and go back to your simpler editor.

Torbjørn Nordbye implemented the awesome Ruby support for Netbeans, and has now started on the work to give us Python awesomeness in Netbeans as well.

As mentioned in the comments of a previous blog post I have a good example of simple, obvious bugs that could stay in your application for years, without anyone noticing them, because that piece of code run almost never. Bugs that good tools, and/or compilation of staticly typed languages would find for you, but that unittesting and manual testing of your application probably wouldn’t find.

This is a bug that Tor found while testing his Python support for Netbeans, when he pulled in the datetime module that ships with Jython. There, in some exception handling the code references the non-existent class ValuError, which probably should be ValueError. A simple typo that has been undiscovered for a long time.

We all make errors. Good tools make us do less of them, and find them faster.

popup

Okay, just had to…

funny pictures of cats with captions
more animals

Moving… internet

So, we bought a new apartment. Before we bought it I checked that CanalDigital could offer both TV and Internet to the new apartment. And, according to them, then, they could.

Today however, after making three attempts to get through to them I was told that they now could only offer TV. That means I have to go back to the stoneage-performing ADSL technology. Sigh!

To top this, CanalDigital requires a two month notice on terminating a broadband subscription, and three months to terminate a TV subscription. And, even further, if you move your tv subscription they are counting that as a new subscription, which mean you’ll have to pay for two tv subscriptions for three months.

And, moving to another ISP has some costs in itself. Since there are no operational telephone in the apartment, Nextgentel charges NOK 499,- to enable the telephone line, and additionaly NOK 60,- each month to keep it open. Nextgentel is cheaper on the monthly subscription charge, so the monthly NOK 60,- doesn’t matter that much. But the reduction of 2Mbits of outbound speed matters. And, ADSL has generally a lower quality of service than cable…

Did I mention that CanalDigital probably charges for enabling TV in the new apartment as well? Sigh!

Bloggurat Twingly BlogRank Blogglisten