Speedway On A Cold, Windy And Rainy day

2008-10-07 by monzool

COLD, WINDY AND rainy would describe the weather this past Saturday evening. Not that that kind of weather uncommon in Denmark, but this particular day I was at the outdoor Speedway event “Denmark vs. The World” at Vojens Speedway Arena. Speedway is one of the most exiting motor sport types, and its a fantastic experience to watch it live. This event was a special event where two teams, with Danes on one team and non Danes on the other, would race each other for the price.

Here’s a movie that I recorded with my IXUS 50 Canon camera: Speedway - Denmark vs. The World. Not the best quality, but captures the excitement pretty well.

It was a fantastic evening apart from the fact that the event was canceled after heat 11 out of 18 heats due to bad weather. As this picture will show, we all got a bit surprised on the weather. Here sits my brother, my sisters husband and my father with his Easton cap, all hoping it would stop raining.


I’m somewhat glad that I’m not on the picture - we ain’t looking to stylish I guess. lol.

Posted in Travel, Personal | No Comments »

TheCamp 2008

2008-07-27 by monzool

THE-CAMP 2008 WAS a repeat of the success from last year. Again this year 40 people, in all ages, from all over Denmark (plus an North America from Norway, plus a Dane from Holland) rallied for 7 days of of open source. TheCamp is the perfect opportunity for doing some serious nerding and spending time with others of same interest.

Again this year I had a lot planned for this year, but as expected I didn’t get though it all. Firstly I downloaded the latest Subversion revision of Boost 1.35.1 and did some Asio socket and thread programming. I’ve been using Mercurial for a while but planned a switch to Bazaar, so I got that install and moved my projects to a new (local) repository. I’ve bought a new Lenovo 3000 N200 laptop and planned for getting wireless lan up and running on it. That however, was surprisingly easy as everything was supported right out of the box on a Debian Unstable installation. I finally managed to check off a long time waiting TODO item of learning how to use CScope from Vim. I installed Aros on my spare laptop, an old Asus A1000, but Aros kept crashing on me, so I gave that up. Wednesday was more a chill-out day with drinking a few cold beers, taking to people generally enjoying that the sun had finally appeared ;-). I did get some Python programming done with libnotify though. Otherwise I played around with some programming with the Clutter-project toolkit along with it’s Python bindings Pyclutter. Additionally I also tried a bit of Docbook, but decided that LaTeX was better.

As per tradition at TheCamp there was plenty of guest speakers. There was three presentations a day, but of course attending was voluntary.

Sunday, the highlight was when Vim guru Preben Guldberg reran his Vim/regular-expressions presentation from last year. Preben is an expert user in Vim and is also seriously proficient in regular expressions (I think he’s got the black ninja belt in both categories). This year I grasped somewhat more that I did last year, so a great rerun ;-).

Monday Poul-Henning Kamp of FreeBSD/phkmalloc/Varnish fame gave a presentation on developer habits and tools. In essence his was tired of things like having to write linked lists or decide what hash-trees to use. He wished that the software industry would do for them selves, what they have done for all other industries - make the computer do the work. As always an interesting PHK speech, but I think the audience didn’t fully agree; as one argued: “There are being made progress with tools like Eclipse and frameworks like Ruby On Rails, but if you insist on using Vi and writing low level C, then your not really making it easier on your self”. In the evening, Linux multimedia enthusiast and game graphics designer, Rene Jensen held a Blender workshop where he gave a live introduction to Blender.

Tuesday Jørgen Olsen from Sun Microsystems Denmark presented OpenSolaris 2008.5 (sprinkled with Solaris comparisons as a few of the audience run Solaris at work). Jørgen may be an old guy that looks like a hippie with his headband and log grey hair - but he definitely know his Solaris/OpenSolaris stuff. We got a demonstration of the SMF (Service Management Facility) that is an attempt to replace the old system initialization scripts. Other topics was ZFS, Containers, virtualization and DTrace. Later that day Bjarke Walling gave a demonstration of Lego Mindstorm. It was a great run though of Lego Mindstorms hardware, software and historic. He had built a couple of robots and created a program upon feature request from the audience.

An interesting speech Wednesday was Flemming H. Sørensen’s presentation on the Syllable operating system. Flemming had been in the Syllable core group for a couple of years, having responsibility of the locale system. He, and a group of fellow Syllable friends, just forked Syllable to do development that they’d felt had been neglected far too long.

Thursday Preben Guldborg held another session of Vim tricks where one could ask questions or get help with.

All in all this voluntary driven TheCamp was just perfect again this year, and I will surely return next year.

Posted in Travel, Personal | No Comments »

Thanks For Your Time Toshiba T2000SX Laptop

2008-06-24 by monzool

MY T2000SX LAPTOP had been a trusty computer for many many years, but all good things come to an end, and now with mixed mind I’ve tossed it out.

My dad brought it home from work where it, after many years of usage, had depreciated to be worth nothing for a busy corporate business. But for me it was perfect for things like writing homework assignments, playing a game of Gorilla or Pacman, do some programming or connecting homemade electronics to its various ports.

It was a fine machine. It had no color screen or big harddrive or lots of RAM, but it was quite small, handy and low-noised. Some specs. can be found on the Toshiba site about the T2000SX.

In the beginning I mainly ran DOS on it, PC-DOS 5.0 I think, but later it was perfect for experiments with FreeBSD or Linux. I’ve mostly run Linux on it, but lastly it ran a multi-boot between the famous combo installation of PC-DOS 7 + Microsoft Windows 3.11 and an installation of Minix 2.0.0. Fun stuff, and both boots in a few seconds.

Posted in Hardware | No Comments »

Word 2007 Learn From Vi

2008-06-24 by monzool

MICROSOFT WORD 2007 was in todays pool of software upgrades at work. Our previous edition of Word was the 2003 edition, and I must say that the UI and MMI has been changed to a whole new concept. It looks fine and all. And its actually pretty easy to navigate the new “Ribbon”, but the direct keyboard shortcuts are not visible in the (non-existing) menu’s anymore - so I forget them.

Complementary to the normal direct shortcuts, Microsoft has introduced a feature known from e.g. both the Opera and Konquerer browsers. When pressing the Alt key, every menu, group and function gets assigned one or more keys which activates the item… wait. That sounds familiar…

Skimming though Microsoft’s Word 2007 navigation tutorial a funny quote emerges: “In other words, you need to get out of text entry mode and into command mode.

That sounds like something taken right out of the Vi/Vim manual - lol.

Posted in Software | 1 Comment »

Blade Runner - Final Cut

2008-05-21 by monzool

BLADE RUNNER HAS been one of my favorite movies since the first time I saw it.


I’ve always hoped that I would get chance to see Blade Runner on the big cinematic screen, but hadn’t really believed that an old 1982 movie would get big screen time. But suddenly the chance came up, as BioCity in Århus arranged a special marathon, dedicating one show room for continuously playing Blade Runner - Final Cut at all time slots for almost an entire week. The sensation was enhanced by the fact that the movie was projected from a digital copy with a high resolution projector. What a fantastic picture quality! This was the first time I’ve seen a digital movie projected at the cinema - and what a debut experience with such a picture-beautiful movie as Blade Runner. This is how movies should be seen.

Definitely worth the almost 150 kilometer drive.

Rating: ★★★★★



Posted in Movies, Entertainment, Personal | 1 Comment »

Numbers To Strings And Back Again - Standard C++ vs. Boost

2008-05-06 by monzool

CONVERTING NUMBERS TO strings or the opposite of converting strings to numbers, is an operation that is far from as trivial as one would expect from such an obvious task - at least when it comes to C++ programming using standard libraries. The converting can be performed by the iostringstream classes in the standard library. When searching Google for the C++ way of converting between numbers and streams, the stringstream library classes appears not to be the that well known, and especially its features of the number and string operations seems generally to be unknown by many.

The stringstream offers a large range of manipulating stream data, although if used for e.g. special formatted textual output, the implementation steps tends to be somewhat more cumbersome than the old printf family.

The example below takes a few more lines that doing e.g. a atoi or snprintf kind of operation, but depending on the situation, simple conversion scenarios do not require many lines of code.

Standard Input / Output Streams Library

The main function is extracted here, just not to obfuscate the picture of the actual converting. Note that stringstream is defined in the <sstream> header.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <sstream>  // stringstream
 
// Prototypes
void Std_StringToInteger();
void Std_IntegerToString();
 
int main(int argc, char *argv[])
{
  std::cout << "Std_StringToInteger:" << std::endl;
  Std_StringToInteger();
  std::cout << "Std_IntegerToString:" << std::endl;
  Std_IntegerToString();
}

The function below handles conversion from strings to integers. First a simple conversion is done, then followed by an example of testing whether the conversion operation was a success. Last is shown how to enable exceptions on conversion errors.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
void Std_StringToInteger()
{
  std::string str = "1976";
  int val;
 
  // Load stringstream with text to convert
  std::istringstream is(str);
  // Convert by streaming to integer
  is >> val;
  std::cout << "  Val: " << val << std::endl;
 
  // Clear stream for another input
  is.clear();
 
  // Load stream with a non numeric convertible data
  is.str("Monzool.net");
  is >> val;
 
  // Test if conversion failed
  if (is.fail())
    std::cout << "  Conversion failed!" << std::endl;
 
  // Enable exceptions on conversion errors
  try
  {
    // Set failures to be thrown as exceptions
    is.exceptions(std::istringstream::eofbit  |
                  std::istringstream::failbit |
                  std::istringstream::badbit);
  }
  catch(std::istringstream::failure& e)
  {
    std::cout << "  Exception: " << e.what() << std::endl;
    std::cout << "  Conversion failed!" << std::endl;
  }
}

As the naming stringstream indicates, input and output is done by streaming measures. If not quite confident on stream directions, think of how functions cout and cin is used. Using stringstream is no different.

Last function is for converting from numbers to strings.

51
52
53
54
55
56
57
58
59
60
void Std_IntegerToString()
{
  int val = 1976;
 
  // Create empty stringstream for number to convert
  std::ostringstream os("");
  // Convert by streaming integer
  os << val;
  std::cout << "  Str: " <<  os.str() << std::endl;
}

Boost lexical_cast

To put it simple: when dealing with libraries for converting between numbers and strings the Boost library smokes the standard C++ library ditto.

The conversion features of Boost is located in the lexical_cast library and is embedded by including the lexical_cast.hpp file (most Boost libraries are implemented in header files and can be embedded by including the appropriate hpp file.).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <boost/lexical_cast.hpp>
 
// Prototypes
void Boost_StringToInteger();
void Boost_IntegerToString();
 
int main(int argc, char *argv[])
{
  std::cout << "Boost_StringToInteger:" << std::endl;
  Boost_StringToInteger();
  std::cout << "Boost_IntegerToString:" << std::endl;
  Boost_IntegerToString();
}

Instead of using streaming functionality, Boost has chosen a much more obvious concept. Boost has added the functionality of simply casting between numbers and strings. Casting functions are already a familiar concept in C++, like casting between data types using static_cast or manipulating const’ness with const_cast.

The lexical_cast template function makes converting from string to integer trivial. The example below also shows how to handle conversion errors by exception handling.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
void Boost_StringToInteger()
{
  std::string str = "1976";
  // Cast string to integer
  int val = boost::lexical_cast<int>(str);
  std::cout << "  Val: " << val << std::endl;
 
  // Load string with non numeric convertible data
  str = "Monzool.net";
  try
  {
    // Non convertible values throws exceptions
    val = boost::lexical_cast<int>(str);
  }
  catch (boost::bad_lexical_cast &e)
  {
    std::cout << "  Exception: " << e.what() << std::endl;
    std::cout << "  Conversion failed!" << std::endl;
  }
}

Converting the other way from integer to string is just as trivial.

35
36
37
38
39
40
41
void Boost_IntegerToString()
{
  int val = 1976;
  // Cast integer to string
  std::string str = boost::lexical_cast<std::string>(val);
  std::cout << "  Str: " << str << std::endl;
}

When it comes to simple conversion between numbers and strings, Boost is far superior in simplicity. However note that the design goals have also been very different for the two libraries. The C++ Standard Input/Output Streams Library has been designed for flexibility. And flexible it is indeed, but sadly this side effects to complicating its usage even for obvious tasks that ought to be trivial to perform.

Posted in C++, Programming | No Comments »

Wolf Tattoo Restoration

2008-04-24 by monzool

MY WOLF TATTOO had been in need of major restoration job for several years now. Today I finally went to “Doc Pain”, the local tattoo shop, and had it redrawn.

This is a photo taken during the recoloring of the tattoo. It is really stunning to see how much it had degraded since it was originally made in 1995.


At first the tattooist wasn’t quite confident that it could be salvaged. In some places the contours had almost vanished and other places the skin had some tissue scarring. I wasn’t that worried though - it couldn’t get much worse I reckoned.

Now its good as new, and I hope it stays good this time around. If it does, I need to find another drawing to be tattooed.

Posted in Personal | No Comments »

Debian On Macbook

2008-04-16 by monzool

LIBERATED AT LAST. No more torment and self-punishment of using Mac OS X. I finally caved and wiped the Apple operating system from my Macbook and installed Debian and KDE 4. Sweet.


For a long time I’ve been reluctant to wipe the Mac OS X. I wouldn’t just give up on Mac OS X that easy. If so many people finds it that great, why did I keep hitting shortcoming after shortcoming and stupidity after stupidity?

If I should list what I like about the Mac OS X, I could list three things: Front-row is a pretty good media center. Mac OS X boots really fast. I like the zebra wallpaper - I kept that.

As for reasons that I don’t like the Mac OS X experience I could list a few. For example: Finder sux bad and is slow as molasses and stupid. The terminal is broken. I hate when CD’s won’t eject. Its frustrating that wireless cannot reconnect after standby. Hate those stupid obscure keyboard shortcuts. Feel back at Window 2000 with software updates that requires rebooting. I loathe those giant updates to iTunes which I rarely used. The multi-workspace concept in Spaces, its borked. The hibernation support is lousy at best. Hate that stupid inefficient application task switcher. And not by fault of Apple, I’m unhappy with the endless row of bad Total Commander/Krusader clones. I’m also irritated on an almost endless row of broken macports and broken fink ports.

It actually required two attempts to get the Macbook up and running. On the first attempt I followed the directions from the Debian Macbook Wiki, which preach that Lilo must be install for a later replacement by Grub. After installing Grub it was no longer possible to boot. On the second attempt I installed Debian like normal, and chose Grub as boot manager. Then it worked. Actually in a few other occasions I got into troubles when following the guides. It seems that the Debian Macbook Wiki is somewhat outdated on certain areas, as some special “jumping though loops” measures are no longer required, but would rather get you into trouble. Installing the 915resolutions package for example, crashed my X, but was in fact not necessary to get the prober resolution anyways. However it provides many valuable informations and links, and generally ease the installation considerable.

Posted in Mac OS X, Linux, Software | 1 Comment »

Noise Torture From Logitech And Lenovo

2008-04-08 by monzool

SO WHAT IS more annoying than having to listen to a constant high pitch noise at work all day? Having to listen to two high pitch noises at work all day!.

My Lenovo T61p laptop at work emits a terrible high pitch noise. The level of the noise varies depending on the running configuration of the computer. When not in the port replicator the noise level is just ridiculous high. Installing the laptop into the port replicator reduces the level a bit, but the noise is still unbearable irritating. Eventually I’ve ended up running with the lid down and using only an external monitor. The noise is less audible this way, but still irritating. I’m still waiting on the IT department to take action on this.

The second source of a high pitch noise was from my Logitech Mx518 mouse. With the noise from the laptop, it went a while before I realized that the mouse was also emitting a high pitch noise. Today I finally received a replacement mouse, a Logitech G5 Laser mouse. But guess what… that also emits a high pitch noise. Bummer. Two broken mouses in a row. Well, apparently this is a familiar issue with Logitech mouses.

Posted in Hardware | No Comments »

Five Good C++ Books

2008-04-02 by monzool

C++ BOOKS IS something I’ve read quite a few of during the years. Having learned my lesson on buying Python books, I would like to share the five C++ books I value the most, and which I would not hesitate to recommend to others. The books target audience range from absolute beginner to advanced programmer.


I learned C++ programming from the book Teach Yourself C++ in 21 Days. Everything that the book Core Python Programming does wrong, this book does right. It starts with very easy first steps and by top quality examples and well written texts, it gradually adds layer upon layer of increasingly more advanced C++ knowledge. This may in fact very well be the best, and most well written, programming book I’ve ever read (note that I got the 1994 edition, and haven’t read later updated reprints).
Target audience: beginner.
Rating: ★★★★★


No serious C++ work can be done without the C++ Standard Library. The book The C++ Standard Library: A Tutorial and Reference is a perfect combination of a tutorial and reference book (as the title also states). Don’t leave home without it.
Target audience: intermediate, advanced.
Rating: ★★★★★


The C++ book The C++ Programming Language is written by its inventor himself, Bjarne Stroustrup. I actually got this book before Teach Yourself C++ in 21 Days but this book is not suited for beginners. This is for advanced C++ understanding, and an indispensable reference book when doing serious C++ programming.
Target audience: intermediate, advanced.
Rating: ★★★★★


Having read - and understood - the books above, one might get the urge to learn some advanced techniques on templates. For that the cult book Modern C++ Design: Applied Generic and Design Patterns is highly recommendable. This relatively thin book is written precise and to the point. Even though the topics covered are advanced, the author takes great care of explaining the details. (Sadly I seldom get the opportunity of doing such C++ hacking covered in this book).
Target audience: advanced.
Rating: ★★★★★


A bit of a joker is the book The Informit C++ Reference Guide: Techniques, Insight, and Practical Advice on C++. This book is a gold mine of tips, tricks and examples spanning the entire spectrum of C++ programming - the title covers the contents pretty well. Its a very informative book that covers a lot of topics but concentrates intelligently on areas that often causes doubts. I find it a real joy to read every time.
Target audience: intermediate.
Rating: ★★★★★

Posted in Books (technical), Reviews | No Comments »

« Previous Entries