Blog





2009-03-25 10:35:12
Moving out of here
It seems like I'm growing fond of the Windows Live blogging functionality. The blog has sort of moved there: New Blog
When I find the time I will try to update this page to show that blog instead :)

2008-12-17 11:34:00
Heidisql
Need a tool to manage your MySQL database? Check this one out: heidisql. It pretty much rocks ;)

2008-12-11 21:57:05
CodePlex
CodePlex is Microsoft's open source project hosting web site. A lot of cool free software is available for download here like e.g. the Vista/XP Virtual Desktop manager. This little bugger lets you take control over multiple virtual desktops and this is a great thing when the one and only one you got by defatul just isn't enough. Check it out!

2008-12-11 13:11:34
Update: Eksplosjonsvarsel
This über cool word has now been picked up by the google crawler and indexed. Still no visible sign of it in the Y! or MS index though.

2008-12-02 16:31:30
Adding a swap file on Solaris
This is pretty easy if you have the power of "root".
Find out where you would like to place your swap file and just make it:
/usr/sbin/mkfile <num mb>m <full path to swap file>

Then mount it:
/usr/sbin/swap -a <full path to swap file>

Verify that it has been added by executing:
/usr/sbin/swap -l
Enjoy :D

2008-11-28 09:21:22
Eksplosjonsvarsel update
Still not indexed by Yahoo, Google nor Microsoft.

2008-11-28 09:18:18
NFS mount command Never remembers this so it might help to post it here.

mount -t nfs <ip-address>:<directory-to-mount> <empty-local-dir>

2008-11-14 15:27:03
Eksplosjonsvarsel
Apparently this norwegian word is not indexed by any of the major search engines around the globe. It means something like "explosion warning". This will be a test to see how long different search engines use to include this beautiful word in their indexes..

2008-10-21 09:47:56
Some updates could not be installed
Having trouble installing updates from Windows Update? Try the following in a command prompt:

net stop wuauserv
regsvr32 %windir%\system32\wups2.dll
net start wuauserv

It might just do the trick...

2008-09-29 15:40:02
Linux Commands - A practical reference
Found this cool site while browsing the big net: Linux Commands - A practical reference
Especially I loved the easy trick for serving out all the files in your cwd. If you have python installed just execute "python -m SimpleHTTPServer" and instantly all your files are available at http://:8000. You gotta love python!

2008-07-02 23:41:12
Monitoring CPU usage on Windows using WMI
I have been fiddeling some with the win32pdh api trying to get some CPU readings before I stumbled upon WMI. Five minutes later I had this little snippet that will log time, name of process and cpu usage which later can be graphed by e.g. matplotlib/pylab.. Enjoy ;)
import time
import wmi

print "Intializing WMI. Stay put..."
c = wmi.WMI()
print "Starting cpu monitoring."

proces_info = {}
fp = open("cpu-usage.log", "wb")
while True:
    for process in c.Win32_Process ():
        id = process.ProcessID
        for p in c.Win32_PerfFormattedData_PerfProc_Process(IdProcess=id):
            fp.write("%0.f;%s;%s\n" % (long(time.time()), process.Name,
                     p.PercentProcessorTime))

    time.sleep(1)

fp.close()


2008-01-22 09:08:21
Logging on to the console session
Having trouble connecting to a windows server using remote desktop cause all sessions are in use? You can then try to log on to the console session using this command:
mstsc -v:servername /F -console

2007-11-27 22:47:02
Xbox 360
Recently I have had little time for my pet programming projects and you may blame my xbox for that. So while you wait for updates of e.g. AL you may look at this good looking gamercard:


2007-11-27 22:27:55
Due to a malfunction in the backup rutine this blog post was lost...

2007-07-23 18:55:49
Due to a malfunction in the backup rutine this blog post was lost...

2007-06-13 22:38:22
Due to a malfunction in the backup rutine this blog post was lost...

2007-05-09 15:37:36
NOTE TO SELF:
Next time I want to run a cvs diff towards the head of a branch this can be done by executing the command:
cvs -q diff -r 1

2007-04-12 22:37:03
System Idle Time
Ever wondered how you can figure out how many seconds that has passed since last user input? This is good to know when you e.g. want to perform a task only when the system has been idle for a while so that we do not steal resources when the user is currently working. We can probably assume that if no input has been received in X minutes the user is not actively using the computer (or so we hope). Anyways here is the python code that will enable you to figure it out.

2007-03-13 11:01:28
Task Switch XP Pro
Trying to find that window you know you opened a few minutes back? Alt-Tab isn't really usefull? Try this one out! Really good stuff

2007-03-02 00:48:24
Vista Home Premium
Call me crazy but I actually just bought Windows Vista. The reason is that I'm thinking about building myself a new HTPC and that I'm currently in Boston so the price of the operating system is good compared to the price you'll have to pay in Norway. 240 dollars compared to 500 dollars in Norway for the Norwegian version that no computer geek ever will buy. However, I'm looking forward to geeking around with this new toy and trying out the Windows Media Center. Stay tuned for more information regarding this...

2007-02-09 01:36:25
Living in America, hum ti dum
I'm currently working in Needham, Boston until March 3rd. I arrived January 30th and I will be staying at this hotel the whole month If I feel a sudden urge I might post some pictures. Don't stress me, mkey!

2007-02-09 01:30:46
Python ref
Found this site when I started to wonder when the __nonzero__ method in an object was called. This site has a great index over all these "strange" things.

2007-01-23 21:14:23
Kippo 1992 - 2007. RIP

My dog Kippo died Sunday 01.21.2007. He had a long life, almost 15 years, and he was never sick so I guess he had a good time on this planet. However it still hurts to loose such a good friend and I will remember him forever.



If there's anybody out there reading this and thinking about buying a dog I can highly recommend the breed Bichon Havanese . I'm sure that if I ever decide to buy myself a dog again it'll be one of these.

2006-12-30 17:45:30
Synergy
This piece of greate software enables you to share your mouse and keyboard between machines and operating systems. A must for any geek with more than two computers at his desk!

2006-11-23 22:58:37
AL 0.1.6
Finally it's here. The new and improved AL . The transparency icon bug has been fixed and support for editing aliases has been included into the config panel. Read the complete changelog here or better yet just download it here and figure out the changes yourself. (The last version 0.1.5 was actually downloaded 529 times )

2006-11-08 15:39:19
Thanks dude!
Yesterday I finally read my mails from an old email account where my PayPal is registered and guess what. Somebody named S. Alexander had donated 10 dollars to my project AL (launcher) at SourceForge! This is the first money I have ever earned on an open source project at SF so I’m freaking out of joy right now. Thanks again dude

2006-10-31 23:12:10
Controlling ITunes with python
Just found this link and I can't wait to try it out
Maybe I can integrate ITunes into pyMP Hmm.. maybe I should brew some more coffee and spend the night integrating.. nah. off to bed. talk to ya later

2006-10-04 15:34:55
Google gadgets
Free cool gadgets for your homepage like quotes of the day and things like that. Some really good stuff . Not sure why you should need any of this but.. Hey, let's not get hung up in the details!

2006-10-03 16:34:41
Random Numbers
"The generation of random numbers is too important to be left to chance."
As first stated by: Robert R. Coveyou

2006-09-20 17:44:23
timedelta
Ever wondered on the powers of date manipulation in python? This will explain it all to you.

2006-09-19 14:29:14
FAVICONS
Have you ever experienced that a web page has a icon associated with it? I mean either next to the address field or when you create a favorite? This is easily done by creating a icon with the name "favicon.ico" and placing it on you webserver. For instance googles favicon looks like this: and is situated under e.g. the following address: http://www.google.no/favicon.ico. GO WILD!

2006-09-14 16:55:38
Encoding
I've spent the last days working on different encoding problems when handling CJK support in our application at work and found this usefull. When you need to get the unicode value of a sign you don't recognize to see if it's actually the correct one deep down in your app you can drop it to a file, fire up your nearest hex editor (maybe this one) and get the hex values for each byte(maybe this is what you get: e5 8f af). Decode it with this python snippet:

>s = "\xe5\x8f\xaf"
>s.decode("utf-8") // If it's really utf8
u'\u53ef'

Then you can lookup the 53ef code on this page to fetch the correct code chart and see the sign itself and figure out if it's really what you expect m'key? Easy as eating soup.

2006-09-12 22:38:41
Translation
I have now translated my first appliction ever The app belongs to a friend of mine and it's called Osk Genealogy app. The translation from English to Norwegian was really simple using the Lingua tool and only took me about two hours! The application is written in REALBasic (xplatform). A language that looks great for throwing up a working app in hours rather than days.

2006-09-05 22:42:51
New download record of AL
The latest release of AL (0.1.5) has actually now been downloaded 271 times! That is a new record and it actually means that people I don't know is useing it. Amazing Join the fun now!

2006-08-11 13:14:00
Moved to Tromsø
Yup, that is correct. After two and a half year in Oslo (the capital of Norway) I finally got to my senses and moved back to Tromsø. It’s situated in the far north of Norway with polar bears in the streets! Ok, they are dead and stuffed but who cares. It’s cold enough up here for them to settle down if they wanted to I guess. Look at this link if you wonder where the begeezes Tromsø really is.

2006-08-11 13:01:21
AL 0.1.5
A new version of AL has just hit the streets . It now also supports showing the icon for the application you are about to execute. After fiddeling with the win32 api and memory leaks for a while we finally decided to do it in pure wxPython which works good enough. Check it out! <download>

2006-06-20 14:31:23
Filemon
Trying to figure out which files/directories a process is using? Maybe fine tuning the newly bought real time virus scanning software to try to gain performance by excluding directories that are heavily used by e.g. Visual Studio so that the compilation does not take all day? This little program tells you all you need to know

2006-05-23 22:56:04
Single Instance App
A single instance application is an application that ensures that only one instance is running at any time even though the user e.g. explicitly starts two or three. But how can you check if an instance of your new über cool program already is running? There are several ways, from implementing your own cross platform scheme with sockets (I love sockets but..) too file locking (doesn't really work). Anyways there are two very simple solutions out there, one using wxpyton and one using pywin32. (Remember that pywin32 does not contain the substring "win32" just for fun, it really only works on windows). Warning, source code ahead: Enjoy

2006-05-17 21:37:38
AL - The Application Launcher
Tired of spending several minutes browsing through your Windows Start menu hunting for a program? Install AL today and you can forget about your Start menu. AL enables you to effectivly search for and execute programs with only a few keystrokes.
Example:
You want to start Firefox:
 1) The hotkeys (alt)(space) launches AL
 2) The user just starts typing firefo..
  - AL searches for the correct application while you type!
  - The list of possible choices will be reduced for each character you type
  - AL learns! It keeps history over what you search on, what you execute and uses this to produce better search results for you next time.
 3) Press enter to launch application.

This project is my second project hosted on SourceForge.
Hope you enjoy it!

2006-05-13 12:58:18
yellowicon.com
In need of icons for your non-commercial application? This place just rock!

2006-04-30 22:47:14
BrainyQuote has some really good quotes. My two favourites are from Albert Einstein:
- Try not to become a man of success, but rather try to become a man of value.
- Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

2006-04-29 16:20:21
Wikipedia
This site still amazes me. It contains so much information and about any topic you could think about. Ever wondered how much RAM there is in an ipod? How to build a suffix tree in O(N) time? The frequency of occurrence of solar flares? It's all there! The site currently holds 1 102 000+ articles in english and it's growing fast.

2006-03-27 20:54:50
sysinternals.com
This is a site with a hugh collection of very useful freeware tools for windows. Especially like the Process Explorer. Rock on!

2006-03-17 14:36:37
Southpark character
Are you a southpark digging maniac? Then why not make your own southpark character and use it as your personal icon on MSN or AIM? This is how my attempt looks like:

Some might say that it's actually quite close to the real me

2006-03-07 10:31:18
pyInstaller
I came over PyInstaller today. This is a pice of free software that enables you to freeze python programs into executeables. The site says: "Believing that it is still far superior to py2exe.." This has to be tested.

2006-02-24 19:16:10
Catch global key event
I've been wondering for some time now on how you can catch a global key event in windows regardless if your program has focus or not. A search on zhe google came up with pyhook. This little python extension really does the trick . You may also use wxpython's RegisterHotKey functionality. Now I only need the time to implement something like Quicksilver or AppRocket for windows. This has of course been done before but that shall not stop me!

2006-02-05 19:05:24

The first C64 personal computer saw the light in January 1982 and the world was forever changed. It featured:
- 64 KB RAM
- 20 KB ROM
- Custom SID sound chip
.. and a few copies was actually sold too.. well a few 22 million units that is, making it the best selling computer of all time. I actually grew up with a Commodore 128 which was made available to the general public in 1985. Luckily you could boot this fine pice of machinery in C64 modus. Talk about backwards compatibility.

Now to my little link collection:

- The perfect site (c64s.com) for any retro c64 gamer. The games avilable on this site can be played directly from the web sites itself as java applets. However if you have any hair on .. well you get the picture. All real hackers uses a good emulator (or preferably make one themselves) and fiddles with it until it works. This last approach has several .. ehh. One huge advantage. There are many sites where you can download raw C64 games: - For those of you unwilling to code your own emulator there are several choices: - If you can't remember the title on your favourite game from 20 years back do not dispair. No doctor is needed, just visit The C64 Internet Games Database and search amongst 30 000+ titles. For your convinience it also holds a link to where you can "borrow" an electronic copy.

- "The September 1995 issue of BYTE magazine cited the SID chip as one of the "Most Important Chips" in computing history.." This is also what I remember the best. The music itself. If you would like to refresh your memory check out the ultimate collection of c64 music. This will keep you occupied for a year or two. Unfortunatly pyMP doesn't have support for playing these little wonders yet so you will have to download SIDPLAY to get going. Some other c64 music links:
  • SlayRadio with live DJs playing Remixes of C64 game and demo music.
  • remix.kwed.org features c64 remixes in the well known mp3 format
- Cool blog with news mostly regarding the sid chip and its afterlife.

- If you ever have touched a c64 you're probably getting old like me so the site GameBox64 is also kinda great. It reminds you how the packaging itself looked like :)

The game is on!

2006-01-16 19:13:41
pyMP 1.0.0
pyMP is now frozen, packaged and available on sourceforge. Just install and tell me what you think . (The installer itself is created by the great tool Inno Setup)

2005-12-11 20:44:30
python + C == easy
I've been thinking about learning how to wrap C/C++ into a python extension for a while now when I stumbled upon SWIG. Basically it "connects programs written in C and C++ with a variety of high-level programming languages." An easy tutorial explains how to create your own python extensions using MingW32. No expensive Microsoft compiler needed . Now I will brush the dust of my C programming skills and get to work! (A more comprehensive tutorial on python/Swig can be found here)

2005-12-09 17:04:16
E-mail address
If somebody for a strange reason want to send me an email my address is "encoded" with this nifty python code snippet. Paste it into your python interpreter and behold! Nifty snippet follows:

"".join([chr(ord(c)-2) for c in 'twpgfgxkmB{cjqq0pq'])

2005-11-22 22:50:44
Konfabulator
"Konfabulator is a JavaScript runtime engine for Windows and Mac OS X that lets you run little files called Widgets that can do pretty much whatever you want them to." After Yahoo bought the firm the product was released as freeware . Check it out! I especially love the “Lazy Launcher” widget that mimics the greatest invention for Mac, namely QuickSilver. This widget makes all entries on you start menu accessable with only a few keystrokes. Hide the start menu, you want need it anymore! A widget gallery containing 1526 different widgets can be found here.

2005-11-14 20:30:25
Hepp
Came over this great site last week. If you like cool gadgets (small or big) you should really check this one out
RSS Feed
engadget.com
(They also have podcast but I have not checked that out yet)

2005-11-06 13:22:45
pyMP now available
My project and all source code is now available at sourceforge. Check it out and have fun :)

2005-11-03 20:02:22
pyMP update
Today may project got accepted on sourceforge. The project name is (as you may already know) pyMP (python music player) and can be found here. Just waiting on my ssh-key to be activated so that I can check in zhe code :) Will also make binary distributions available for windows when I get going.
This is my first project in the open source community but I'm already thinking about starting a project for the CruiseControl monitor aswell. Feel zhe source Luke, feel zhe source.

2005-11-02 21:27:20
SHOUTCast Streaming example
After a request from Alex Reich I put together a working example on how to play a shoutcast stream with pyMedia. I added some stuff to the previously posted monitor code and came up with a simple working example.
Be aware though that:
1) The code is just to show you how to do it. No exception handling or no real buffering is included.
2) Pymedia sometimes fails when starting to play music in the middle of a stream resulting in a very slow paced song :)
3) If your computer dies from the stress or your lady friend wonders what the heck you are listening on: Do not blame me, you where warned :)

Fire up shoutcastStreamer.py then relax and listen to Club 977 - The hitz channel for 30 seconds.

2005-11-01 21:55:58
Hei
Recently we have started to use CruiseControl at work for automatically triggering builds on several platforms when new code is checked into CVS. I soon discovered that manually monitoring 10+ servers hosting a lot of projects (where only a small percentage is important for me) is a real pain. Then I thought: "Would it not be nice to have a tiny monitor that told me when builds broke, servers crashed or when a build actually compiled?" Well it took me one Sunday to code it and two evenings to work around some utf8 issues :)

It has the following features:
1) Listens to a projects RSS feed
2) Can connect to as many projects and servers you like
3) Will display a tiny toasterbox with an alert when a build compiles, breaks or the RSS feed becomes unavailable (server or service down)

So Stay tuned for release and actionshots

2005-10-23 15:24:04
ShoutCast monitor
A while back I promised to release the python source showing how you can extract the data and meta data from a shoutcast stream. I have created a little example that connects to a few shoutcast streams, extract the metadata and displays this. The source! If you do use the code, please credit my work by linking back to this page. That is all I ask. Have fun

2005-10-06 19:54:11
First custom pyMP skin:
A friend of mine, Raymond, has created the first custom pyMP skin ever! The skin displays his favourite football team TIL. The skin itself is not yet finished but his first try looks like this:

Will keep you posted on his progress

2005-09-12 23:19:18
Hepp Finally it seems like pymedia is getting stable again after a major overhaul. Hope it stays that way For a while there I was thinking about creating a python wrapper for libmad and use that instead though.. But now all bugs I have reported seems to be fixed
If you think the progress on my player has been slow lately blame Blizzard for creating such a good game as WoW really is

2005-05-24 22:43:52
Having problems with pickle when freezing a python application? Do you get this error: "unknown encoding: string-escape"? The solution is to explicitly import encodings.string_escape. pickle has an dependency to this encoding that isn't resolved by py2exe or cx_freeze and may therefore cause pickle to fail.

2005-05-17 15:13:28
Finally I'm up and running with a semi stable version of pyPlayer using the wxPython library. I have also removed pyGame from my application so at the moment I no longer support playing cd's. This will however change when I have the time to investigate pyMedias cd playing capabilities. Well this is how my player looks at the moment:

Ohh, I probably forgot that I now have renamed the project to pyMP. (short for python music player) Stay tuned for stable release, it is doomed to happen soon

2005-04-28 20:12:27
After much fiddeling I have now managed to create the needed buttons and the transparent background. I have also discovered how to trick callback function to support additional arguments. Python Cookbook

Example:
When you want to bind an event to a button in wxpython you can write the following:
Bind(wx.EVT_BUTTON, self.ExecuteEvent, button)
When the button is pressed the ExecuteEvent method is called with the event object as the only argument. However if you also want to supply some additional arguments you may use the curry class.

Example:
Bind(wx.EVT_BUTTON, curry(self.ExecuteEvent, arg1, arg2, ...),
     button)
Really cool and helpfull

2005-04-18 22:28:06
After toying around with wxpyhon in my spare-time it seams like it has what I need. Even a very simple way of creating sys-tray icons The XML format on my skins is now finished and so is also the xml-parser. Also got an feature request from a good friend of mine (Andre). He wanted me to enhance pyPlayer so that he could start with pod-casting. But I do not think that it is to be included in the near future though.

2005-04-14 22:27:55
I have tested the SHOUTcast streaming for several days now, so I truly believe it works. My next pyPlayer sub-project is to create a new skinnable gui and a more plugable player. Today I have worked on making the different streaming modules plugable.

Yesterday I found a new cool gui library for python that I will have to check out some more (wxPython). It has support for none rectangular windows :) A cool application which utlizes this is earth clock.

2005-04-06 22:06:58
pyPlayer finally has working SHOUTcast support that is not buggy! This is truly a great day for all TWO pyPlayer users The bug I have been struggeling with for several months now was quite easy when I finally found it. Just add "+1" at the correct place in the code and everything works just perfect! I have to thank my co-worker Stig Petter for helping me out on the matter though. He explained a bug he had in his implementation and actually I have managed to implement the same bug.

When I started out implementing SHOUTcast support I discovered that the information on the subject was minimal. Therfore I have decided to share my knowledge and I will also share my implemenation in a later post.

This site gives you a great overview over the protocol: http://www.smackfu.com/stuff/programming/shoutcast.html

I also figured out that you can download the entire SHOUTcast radio list in XML format. The "bad" thing though is that you are not allowed to use it in your application without written approval from Nullsoft (AOL). I'm thinking about sending them a mail an ask if I can use it.

Stig Petter also showed me this site today: MusicBrainz. As of now pyPlayer has freedb support, but maybe I in the future will fetch cd audio metadata from this site instead. The metadata is somewhat better. It also has support for recognizing mp3 files. This can be used to update the id3 tag in an mp3 file, or just to display better information than what is currently available in the id3 tag. This can be done by using acoustic fingerprints (TRMs) to semiautomatically identify mp3 files and then get the correct metadata from musicbrainz.org. Cool stuff

2005-02-14 22:02:27
Yet another bug Well nothing seriouse this time though. getPosition() should return the number of seconds from when you started playing but unfortunatly it wraps over too 0 after playing for an hour. Although not that many songs are that long, I also use this when streaming. Well, maybe listening an hour to the same radio channel is too long anyway.. The bug is reported.

2005-02-11 19:26:29
Discoverd another bug in the pyMedia library. When calling stop on the sound object, it will continue playing until the internal buffer is empty. This has some bad side effects. Firstly when you hit stop it will seem like it takes some time before the player responds to the command. Secondly, if you press pause then stop it will then go from pause mode and continue playing the remainder of the buffer before it stops. I have reported the bug and Dmitry Borisov said he would lookinto the matter. Hope he resolves it quickly and that an new release soon hits the streets.

2005-02-06 22:01:15
Discoverd a bug in the pyMedia library today. If you manage to call GetPosition() on the sound object fast enough it will return garbadge information the next 15 seconds or so. Dmitry Borisov says it is fixed in CVS but because I mainly develop in windows I have some small problems compiling my own version and therefor just have to await a new official prerelease

2005-02-01 20:11:47
I found what looks like a cool piece of 3rdparty software today. It's called pyMedia Since pyGame does not support audio streaming, I have been looking for an replacement. Think this is it!! Hurray for alltheweb.com. Didn't find it when I searched on google so there is still value in using different search engines.

2004-05-09 18:30:21
Started a new project called pyPlayer. My ambitions are high. pyPlayer will someday conquer Winamp The player will be written in python. I'm currently looking into pyGame as a third party library for decoding and playing CD's and mp3's.