<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Monzool's Personal Publishing</title>
	<link>http://monzool.net/blog</link>
	<description>a/ Jan Skriver Sørensen</description>
	<pubDate>Tue, 07 Oct 2008 17:37:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Speedway On A Cold, Windy And Rainy day</title>
		<link>http://monzool.net/blog/2008/10/07/speedway-on-a-cold-windy-and-rainy-day/</link>
		<comments>http://monzool.net/blog/2008/10/07/speedway-on-a-cold-windy-and-rainy-day/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 17:32:03 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Travel]]></category>

		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/10/07/speedway-on-a-cold-windy-and-rainy-day/</guid>
		<description><![CDATA[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 &#8220;Denmark vs. The World&#8221; at Vojens Speedway Arena. Speedway is one of the most exiting motor sport types, and its a fantastic [...]]]></description>
			<content:encoded><![CDATA[<p><strong>COLD, WINDY AND</strong> 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 <a href="http://en.wikipedia.org/wiki/Motorcycle_speedway">Speedway</a> event &#8220;Denmark vs. The World&#8221; at <a href="http://www.speedway.dk/index.php?page=about-us&#038;hl=en_US">Vojens Speedway Arena</a>. 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.</p>
<p>Here&#8217;s a movie that I recorded with my IXUS 50 Canon camera: <a href="http://monzool.net/blog/wp-content/uploads/2008/10/Speedway.avi" class="locallink">Speedway - Denmark vs. The World</a>. Not the best quality, but captures the excitement pretty well.</p>
<p>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.</p>
<pre></pre>
<p><img src="http://monzool.net/blog/wp-content/uploads/2008/10/Kim_Heine_Jks_At_Speedway.jpg" class="disp_center"/></p>
<p>I&#8217;m somewhat glad that I&#8217;m not on the picture - we ain&#8217;t looking to stylish I guess. <em>lol</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/10/07/speedway-on-a-cold-windy-and-rainy-day/feed/</wfw:commentRss>
<enclosure url="http://monzool.net/blog/wp-content/uploads/2008/10/Speedway.avi" length="137310746" type="video/x-msvideo" />
		</item>
		<item>
		<title>TheCamp 2008</title>
		<link>http://monzool.net/blog/2008/07/27/thecamp-2008/</link>
		<comments>http://monzool.net/blog/2008/07/27/thecamp-2008/#comments</comments>
		<pubDate>Sun, 27 Jul 2008 08:57:30 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Travel]]></category>

		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/07/27/thecamp-2008/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>THE-CAMP 2008 WAS</strong> a repeat of the success from <a href="http://monzool.net/blog/2007/08/08/thecamp/" class="locallink">last year</a>. 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. <a href="http://www.thecamp.dk">TheCamp</a> is the perfect opportunity for doing some serious nerding and spending time with others of same interest.</p>
<p>Again this year I had a lot planned for this year, but as expected I didn&#8217;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&#8217;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&#8217;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 <a href="http://cscope.sourceforge.net/cscope_vim_tutorial.html">CScope from Vim</a>. I installed <a href="http://aros.sourceforge.net/">Aros</a> 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 <code>;-)</code>. I did get some Python programming done with <a href="www.galago-project.org/">libnotify</a> though. Otherwise I played around with some programming with the <a href="http://clutter-project.org/">Clutter-project</a> toolkit along with it&#8217;s Python bindings <a href="http://zeta-puppis.com/2007/09/23/an-introduction-to-pyclutter-part-one/">Pyclutter</a>. Additionally I also tried a bit of Docbook, but decided that LaTeX was better.</p>
<p class="section">
<p>As per tradition at TheCamp there was plenty of guest speakers. There was three presentations a day, but of course attending was voluntary.</p>
<p>Sunday, the highlight was when Vim guru <a href="http://www.xs4all.nl/~peppe/">Preben Guldberg</a> 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&#8217;s got the black ninja belt in both categories). This year I grasped somewhat more that I did last year, so a great rerun <code>;-)</code>. </p>
<p>Monday <a href="http://people.freebsd.org/~phk/">Poul-Henning Kamp</a> 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&#8217;t fully agree; as one argued: <em>&#8220;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&#8221;</em>. In the evening, Linux multimedia enthusiast and game graphics designer, Rene Jensen held a Blender workshop where he gave a live introduction to Blender.</p>
<p>Tuesday Jørgen Olsen from Sun Microsystems Denmark presented <a href="http://opensolaris.org/">OpenSolaris 2008.5</a> (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 <a href="http://opensolaris.org/os/community/smf/">SMF</a> (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.</p>
<p>An interesting speech Wednesday was Flemming H. Sørensen&#8217;s presentation on the <a href="www.syllable.org">Syllable</a> 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&#8217;d felt had been neglected far too long.</p>
<p>Thursday Preben Guldborg held another session of Vim tricks where one could ask questions or get help with.</p>
<p>All in all this voluntary driven TheCamp was just perfect again this year, and I will surely return next year.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/07/27/thecamp-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thanks For Your Time Toshiba T2000SX Laptop</title>
		<link>http://monzool.net/blog/2008/06/24/thanks-for-your-time-toshiba-t2000sx-laptop/</link>
		<comments>http://monzool.net/blog/2008/06/24/thanks-for-your-time-toshiba-t2000sx-laptop/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 17:22:44 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/06/24/thanks-for-your-time-toshiba-t2000sx-laptop/</guid>
		<description><![CDATA[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&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MY T2000SX LAPTOP</strong> had been a trusty computer for many many years, but all good things come to an end, and now with mixed mind I&#8217;ve tossed it out.</p>
<p><img src="http://monzool.net/blog/wp-content/uploads/2008/06/Toshiba_T2000sx.jpg" class="disp_center"/></p>
<p>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 <a href="http://en.wikipedia.org/wiki/Gorillas_(computer_game)">Gorilla</a> or Pacman, do some programming or connecting homemade electronics to its various ports.</p>
<p>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  <a href="http://www.toshiba-europe.com/bv/computers/products/notebooks/t2000sx/product.shtm">Toshiba site</a> about the T2000SX.</p>
<p>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&#8217;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.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/06/24/thanks-for-your-time-toshiba-t2000sx-laptop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Word 2007 Learn From Vi</title>
		<link>http://monzool.net/blog/2008/06/24/word-2007-learn-from-vi/</link>
		<comments>http://monzool.net/blog/2008/06/24/word-2007-learn-from-vi/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 16:39:07 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/06/24/word-2007-learn-from-vi/</guid>
		<description><![CDATA[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 &#8220;Ribbon&#8221;, but the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MICROSOFT WORD 2007</strong> 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 &#8220;Ribbon&#8221;, but the direct keyboard shortcuts are not visible in the (non-existing) menu&#8217;s anymore - so I forget them.</p>
<p>Complementary to the normal direct shortcuts, Microsoft has introduced a feature known from e.g. both the Opera and Konquerer browsers. When pressing the <code>Alt</code> key, every menu, group and function gets assigned one or more keys which activates the item&#8230; wait. That sounds familiar&#8230;</p>
<p>Skimming though Microsoft&#8217;s <a href="http://office.microsoft.com/training/training.aspx?AssetID=RP101563601033&#038;CTT=6&#038;Origin=RP101563841033">Word 2007 navigation tutorial</a> a funny quote emerges: &#8220;<em>In other words, you need to get out of text entry mode and into command mode.</em>&#8221;</p>
<p>That sounds like something taken <a href="http://vimdoc.sourceforge.net/htmldoc/usr_02.html#02.2">right out of the Vi/Vim manual</a> - <strong>lol</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/06/24/word-2007-learn-from-vi/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Blade Runner - Final Cut</title>
		<link>http://monzool.net/blog/2008/05/21/blade-runner-final-cut/</link>
		<comments>http://monzool.net/blog/2008/05/21/blade-runner-final-cut/#comments</comments>
		<pubDate>Wed, 21 May 2008 18:40:02 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Movies]]></category>

		<category><![CDATA[Entertainment]]></category>

		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/05/21/blade-runner-final-cut/</guid>
		<description><![CDATA[BLADE RUNNER HAS been one of my favorite movies since the first time I saw it. 



I&#8217;ve always hoped that I would get chance to see Blade Runner on the big cinematic screen, but hadn&#8217;t really believed that an old 1982 movie would get big screen time. But suddenly the chance came up, as BioCity [...]]]></description>
			<content:encoded><![CDATA[<p><strong>BLADE RUNNER HAS</strong> been one of my <a href="http://monzool.net/blog/category/entertainment/movies/" class="locallink">favorite movies</a> since the first time I saw it. </p>
<pre></pre>
<p class="section">
<img src="http://monzool.net/blog/wp-content/uploads/2008/05/Blade_Runner_final_cut_poster.jpg" class="disp_left"/></p>
<p>I&#8217;ve always hoped that I would get chance to see Blade Runner on the big cinematic screen, but hadn&#8217;t really believed that an old 1982 movie would get big screen time. But suddenly the chance came up, as <a href="http://www.biobooking.dk">BioCity</a> in Århus arranged a special marathon, dedicating one show room for continuously playing <em>Blade Runner - Final Cut</em> 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&#8217;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. </p>
<p>Definitely worth the almost 150 kilometer drive.</p>
<p><strong>Rating:</strong> 5 out of 5 stars
</p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/05/21/blade-runner-final-cut/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Numbers To Strings And Back Again - Standard C++ vs. Boost</title>
		<link>http://monzool.net/blog/2008/05/06/numbers-to-string-and-back-again-standard-c-vs-boost/</link>
		<comments>http://monzool.net/blog/2008/05/06/numbers-to-string-and-back-again-standard-c-vs-boost/#comments</comments>
		<pubDate>Tue, 06 May 2008 21:59:01 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[C++]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/05/06/numbers-to-string-and-back-again-standard-c-vs-boost/</guid>
		<description><![CDATA[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. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>CONVERTING NUMBERS TO</strong> 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 <code>iostringstream</code> classes in the standard library. When searching Google for the C++ way of converting between numbers and streams, the <code>stringstream</code> 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.</p>
<p>The <code>stringstream</code> 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.</p>
<p>The example below takes a few more lines that doing e.g. a <code>atoi</code> or <code>snprintf</code> kind of operation, but depending on the situation, simple conversion scenarios do not require many lines of code.</p>
<h4>Standard Input / Output Streams Library</h4>
<p>The main function is extracted here, just not to obfuscate the picture of the actual converting. Note that <code>stringstream</code> is defined in the <code>&lt;sstream&gt;</code> header.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="cpp"><span class="co2">#include &lt;iostream&gt;</span>
<span class="co2">#include &lt;sstream&gt;  // stringstream</span>
&nbsp;
<span class="co1">// Prototypes</span>
<span class="kw4">void</span> Std_StringToInteger<span class="br0">&#40;</span><span class="br0">&#41;</span>;
<span class="kw4">void</span> Std_IntegerToString<span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp;
<span class="kw4">int</span> main<span class="br0">&#40;</span><span class="kw4">int</span> argc, <span class="kw4">char</span> *argv<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;Std_StringToInteger:&quot;</span> &lt;&lt; std::<span class="me2">endl</span>;
  Std_StringToInteger<span class="br0">&#40;</span><span class="br0">&#41;</span>;
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;Std_IntegerToString:&quot;</span> &lt;&lt; std::<span class="me2">endl</span>;
  Std_IntegerToString<span class="br0">&#40;</span><span class="br0">&#41;</span>;
<span class="br0">&#125;</span></pre></td></tr></table></div>

<p>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.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="cpp"><span class="kw4">void</span> Std_StringToInteger<span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  std::<span class="me2">string</span> str = <span class="st0">&quot;1976&quot;</span>;
  <span class="kw4">int</span> val;
&nbsp;
  <span class="co1">// Load stringstream with text to convert</span>
  std::<span class="me2">istringstream</span> is<span class="br0">&#40;</span>str<span class="br0">&#41;</span>;
  <span class="co1">// Convert by streaming to integer</span>
  is &gt;&gt; val;
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Val: &quot;</span> &lt;&lt; val &lt;&lt; std::<span class="me2">endl</span>;
&nbsp;
  <span class="co1">// Clear stream for another input</span>
  is.<span class="me1">clear</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp;
  <span class="co1">// Load stream with a non numeric convertible data</span>
  is.<span class="me1">str</span><span class="br0">&#40;</span><span class="st0">&quot;Monzool.net&quot;</span><span class="br0">&#41;</span>;
  is &gt;&gt; val;
&nbsp;
  <span class="co1">// Test if conversion failed</span>
  <span class="kw1">if</span> <span class="br0">&#40;</span>is.<span class="me1">fail</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
    std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Conversion failed!&quot;</span> &lt;&lt; std::<span class="me2">endl</span>;
&nbsp;
  <span class="co1">// Enable exceptions on conversion errors</span>
  <span class="kw2">try</span>
  <span class="br0">&#123;</span>
    <span class="co1">// Set failures to be thrown as exceptions</span>
    is.<span class="me1">exceptions</span><span class="br0">&#40;</span>std::<span class="me2">istringstream</span>::<span class="me2">eofbit</span>  |
                  std::<span class="me2">istringstream</span>::<span class="me2">failbit</span> |
                  std::<span class="me2">istringstream</span>::<span class="me2">badbit</span><span class="br0">&#41;</span>;
  <span class="br0">&#125;</span>
  <span class="kw2">catch</span><span class="br0">&#40;</span>std::<span class="me2">istringstream</span>::<span class="me2">failure</span>&amp; e<span class="br0">&#41;</span>
  <span class="br0">&#123;</span>
    std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Exception: &quot;</span> &lt;&lt; e.<span class="me1">what</span><span class="br0">&#40;</span><span class="br0">&#41;</span> &lt;&lt; std::<span class="me2">endl</span>;
    std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Conversion failed!&quot;</span> &lt;&lt; std::<span class="me2">endl</span>;
  <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></td></tr></table></div>

<p>As the naming <code>stringstream</code> indicates, input and output is done by streaming measures. If not quite confident on stream directions, think of how functions <code>cout</code> and <code>cin</code> is used. Using <code>stringstream</code> is no different.</p>
<p>Last function is for converting from numbers to strings.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="cpp"><span class="kw4">void</span> Std_IntegerToString<span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  <span class="kw4">int</span> val = <span class="nu0">1976</span>;
&nbsp;
  <span class="co1">// Create empty stringstream for number to convert</span>
  std::<span class="me2">ostringstream</span> os<span class="br0">&#40;</span><span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;
  <span class="co1">// Convert by streaming integer</span>
  os &lt;&lt; val;
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Str: &quot;</span> &lt;&lt;  os.<span class="me1">str</span><span class="br0">&#40;</span><span class="br0">&#41;</span> &lt;&lt; std::<span class="me2">endl</span>;
<span class="br0">&#125;</span></pre></td></tr></table></div>

<h4>Boost lexical_cast</h4>
<p>To put it simple: when dealing with libraries for converting between numbers and strings the Boost library <strong>smokes</strong> the standard C++ library ditto. </p>
<p>
The conversion features of Boost is located in the <a href="http://www.boost.org/doc/libs/1_35_0/libs/conversion/lexical_cast.htm"><code>lexical_cast</code></a> library and is embedded by including the <code>lexical_cast.hpp</code> file (most Boost libraries are implemented in header files and can be embedded by including the appropriate hpp file.).
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="cpp"><span class="co2">#include &lt;iostream&gt;</span>
<span class="co2">#include &lt;boost/lexical_cast.hpp&gt;</span>
&nbsp;
<span class="co1">// Prototypes</span>
<span class="kw4">void</span> Boost_StringToInteger<span class="br0">&#40;</span><span class="br0">&#41;</span>;
<span class="kw4">void</span> Boost_IntegerToString<span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp;
<span class="kw4">int</span> main<span class="br0">&#40;</span><span class="kw4">int</span> argc, <span class="kw4">char</span> *argv<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;Boost_StringToInteger:&quot;</span> &lt;&lt; std::<span class="me2">endl</span>;
  Boost_StringToInteger<span class="br0">&#40;</span><span class="br0">&#41;</span>;
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;Boost_IntegerToString:&quot;</span> &lt;&lt; std::<span class="me2">endl</span>;
  Boost_IntegerToString<span class="br0">&#40;</span><span class="br0">&#41;</span>;
<span class="br0">&#125;</span></pre></td></tr></table></div>

<p>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 <code>static_cast</code> or manipulating const&#8217;ness with <code>const_cast</code>.</p>
<p>The <code>lexical_cast</code> template function makes converting from string to integer trivial. The example below also shows how to handle conversion errors by exception handling.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="cpp"><span class="kw4">void</span> Boost_StringToInteger<span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  std::<span class="me2">string</span> str = <span class="st0">&quot;1976&quot;</span>;
  <span class="co1">// Cast string to integer</span>
  <span class="kw4">int</span> val = boost::<span class="me2">lexical_cast</span>&lt;int&gt;<span class="br0">&#40;</span>str<span class="br0">&#41;</span>;
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Val: &quot;</span> &lt;&lt; val &lt;&lt; std::<span class="me2">endl</span>;
&nbsp;
  <span class="co1">// Load string with non numeric convertible data</span>
  str = <span class="st0">&quot;Monzool.net&quot;</span>;
  <span class="kw2">try</span>
  <span class="br0">&#123;</span>
    <span class="co1">// Non convertible values throws exceptions</span>
    val = boost::<span class="me2">lexical_cast</span>&lt;int&gt;<span class="br0">&#40;</span>str<span class="br0">&#41;</span>;
  <span class="br0">&#125;</span>
  <span class="kw2">catch</span> <span class="br0">&#40;</span>boost::<span class="me2">bad_lexical_cast</span> &amp;e<span class="br0">&#41;</span>
  <span class="br0">&#123;</span>
    std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Exception: &quot;</span> &lt;&lt; e.<span class="me1">what</span><span class="br0">&#40;</span><span class="br0">&#41;</span> &lt;&lt; std::<span class="me2">endl</span>;
    std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Conversion failed!&quot;</span> &lt;&lt; std::<span class="me2">endl</span>;
  <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></td></tr></table></div>

<p>Converting the other way from integer to string is just as trivial.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="cpp"><span class="kw4">void</span> Boost_IntegerToString<span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  <span class="kw4">int</span> val = <span class="nu0">1976</span>;
  <span class="co1">// Cast integer to string</span>
  std::<span class="me2">string</span> str = boost::<span class="me2">lexical_cast</span>&lt;std::<span class="me2">string</span>&gt;<span class="br0">&#40;</span>val<span class="br0">&#41;</span>;
  std::<span class="kw3">cout</span> &lt;&lt; <span class="st0">&quot;  Str: &quot;</span> &lt;&lt; str &lt;&lt; std::<span class="me2">endl</span>;
<span class="br0">&#125;</span></pre></td></tr></table></div>

<p class="section">
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.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/05/06/numbers-to-string-and-back-again-standard-c-vs-boost/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wolf Tattoo Restoration</title>
		<link>http://monzool.net/blog/2008/04/24/wolf-tattoo-restoration/</link>
		<comments>http://monzool.net/blog/2008/04/24/wolf-tattoo-restoration/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 16:03:36 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/04/24/wolf-tattoo-restoration/</guid>
		<description><![CDATA[MY WOLF TATTOO had been in need of major restoration job for several years now. Today I finally went to &#8220;Doc Pain&#8221;, 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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MY WOLF TATTOO</strong> had been in need of major restoration job for several years now. Today I finally went to &#8220;Doc Pain&#8221;, the local tattoo shop, and had it redrawn.</p>
<p>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.</p>
<pre></pre>
<p><img src="http://monzool.net/blog/wp-content/uploads/2008/04/Wolf_Tattoo_Half_Complete_small.jpg" /></p>
<p>At first the tattooist wasn&#8217;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&#8217;t that worried though - it couldn&#8217;t get much worse I reckoned.</p>
<p>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.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/04/24/wolf-tattoo-restoration/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Debian On Macbook</title>
		<link>http://monzool.net/blog/2008/04/16/debian-on-macbook/</link>
		<comments>http://monzool.net/blog/2008/04/16/debian-on-macbook/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 20:44:58 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Mac OS X]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/04/16/debian-on-macbook/</guid>
		<description><![CDATA[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&#8217;ve been reluctant to wipe the Mac OS X. I wouldn&#8217;t just give up on Mac OS X that easy. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>LIBERATED AT LAST</strong>. No more torment and self-punishment of using <a href="http://en.wikipedia.org/wiki/Apple_Leopard">Mac OS X</a>. I finally caved and wiped the Apple operating system from my Macbook and installed <a href="http://www.debian.org/">Debian</a> and <a href="http://www.kde.org/announcements/4.0/">KDE 4</a>. Sweet.</p>
<pre></pre>
<p><img src="http://monzool.net/blog/wp-content/uploads/2008/04/Macbook_With_Debian_And_Kde4_small.jpg" /></p>
<p class="section">
For a long time I&#8217;ve been reluctant to wipe the Mac OS X. I wouldn&#8217;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?</p>
<p>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. </p>
<p>As for reasons that I don&#8217;t like the Mac OS X experience I could list a few. For example: <a href="http://www.apple.com/macosx/features/finder.html">Finder</a> sux bad and is slow as molasses and stupid. The terminal is broken. I hate when CD&#8217;s won&#8217;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 <a href="http://blogs.sun.com/bblfish/entry/why_apple_spaces_is_broken">Spaces</a>, its borked. The hibernation support is lousy at best. Hate that stupid inefficient application task switcher. And not by fault of Apple, I&#8217;m unhappy with the endless row of bad Total Commander/Krusader clones. I&#8217;m also irritated on an almost endless row of broken macports and broken fink ports.
</p>
<p class="section">
It actually required two attempts to get the Macbook up and running. On the first attempt I followed the directions from the <a href="wiki.debian.org/MacBook">Debian Macbook Wiki</a>, 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 &#8220;jumping though loops&#8221; 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/04/16/debian-on-macbook/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Noise Torture From Logitech And Lenovo</title>
		<link>http://monzool.net/blog/2008/04/08/sound-torture-from-logitech-and-lenovo/</link>
		<comments>http://monzool.net/blog/2008/04/08/sound-torture-from-logitech-and-lenovo/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 16:52:13 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/04/08/sound-torture-from-logitech-and-lenovo/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>SO WHAT IS</strong> more annoying than having to listen to a constant high pitch noise at work all day? Having to listen to <strong>two</strong> high pitch noises at work all day!.</p>
<p>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&#8217;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&#8217;m still waiting on the IT department to take action on this.</p>
<p>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&#8230; that <strong>also</strong> emits a high pitch noise. Bummer. Two broken mouses in a row. Well, apparently this is a familiar issue with <a href="http://jdc.parodius.com/logitech/"> Logitech mouses</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/04/08/sound-torture-from-logitech-and-lenovo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Five Good C++ Books</title>
		<link>http://monzool.net/blog/2008/04/02/five-good-c-books/</link>
		<comments>http://monzool.net/blog/2008/04/02/five-good-c-books/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 10:07:12 +0000</pubDate>
		<dc:creator>monzool</dc:creator>
		
		<category><![CDATA[Books (technical)]]></category>

		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://monzool.net/blog/2008/04/02/five-good-c-books/</guid>
		<description><![CDATA[C++ BOOKS IS something I&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>C++ BOOKS IS</strong> something I&#8217;ve read quite a few of during the years. Having <a href="http://monzool.net/blog/2008/03/21/core-python-programming" class="locallink">learned my lesson on buying Python books</a>, 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.</p>
<p class="section">
<img src="http://monzool.net/blog/wp-content/uploads/2008/04/Teach_Yourself_Cpp_Programming_In_21_Days.jpg" class="disp_left"/><br />
I learned C++ programming from the book <a href="http://www.amazon.co.uk/Sams-Teach-Yourself-C%2B%2B-Days/dp/0672305410/ref=sr_1_6?ie=UTF8&#038;s=books&#038;qid=1206652233&#038;sr=8-6">Teach Yourself C++ in 21 Days</a>. Everything that the book <em>Core Python Programming</em> 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&#8217;ve ever read (note that I got the 1994 edition, and haven&#8217;t read later updated reprints).<br />
<em>Target audience: beginner</em>.<br />
<strong>Rating:</strong> 5 out of 5 stars
</p>
<div style="clear:both;"></div>
<p>  <!-- Break the picture floating, so the picture doesn't float into next section --></p>
<p class="section">
<img src="http://monzool.net/blog/wp-content/uploads/2008/04/The_Cpp_Standard_Library.jpg" class="disp_left"/><br />
No serious C++ work can be done without the C++ Standard Library. The book <a href="http://www.amazon.co.uk/C%2B%2B-Standard-Library-Tutorial-Reference/dp/0201379260/ref=pd_bbs_1?ie=UTF8&#038;s=books&#038;qid=1206652630&#038;sr=8-1">The C++ Standard Library: A Tutorial and Reference</a> is a perfect combination of a tutorial and reference book (as the title also states). Don&#8217;t leave home without it.<br />
<em>Target audience: intermediate, advanced</em>.<br />
<strong>Rating:</strong> 5 out of 5 stars
</p>
<div style="clear:both;"></div>
<p class="section">
<img src="http://monzool.net/blog/wp-content/uploads/2008/04/The_Cpp_Programming_Language.jpg" class="disp_left"/><br />
The C++ book <a href="http://www.amazon.co.uk/C%2B%2B-Programming-Language-Bjarne-Stroustrup/dp/0201539926/ref=sr_1_4?ie=UTF8&#038;s=books&#038;qid=1206653108&#038;sr=1-4">The C++ Programming Language</a> is written by its inventor himself, Bjarne Stroustrup. I actually got this book before <em>Teach Yourself C++ in 21 Days</em> but this book is not suited for beginners. This is for advanced C++ understanding, and an indispensable reference book when doing serious C++ programming.<br />
<em>Target audience: intermediate, advanced</em>.<br />
<strong>Rating:</strong> 5 out of 5 stars
</p>
<div style="clear:both;"></div>
<p class="section">
<img src="http://monzool.net/blog/wp-content/uploads/2008/04/Modern_Cpp_Design_Applied_Generic_and_Design_Patterns.jpg" class="disp_left"/><br />
Having read - and understood - the books above, one might get the urge to learn some advanced techniques on templates. For that the cult book <a href="http://erdani.org/book/main.html">Modern C++ Design: Applied Generic and Design Patterns</a> 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).<br />
<em>Target audience: advanced</em>.<br />
<strong>Rating:</strong> 5 out of 5 stars
</p>
<div style="clear:both;"></div>
<p class="section">
<img src="http://monzool.net/blog/wp-content/uploads/2008/04/The_Informit_Cpp_Reference_Guide.jpg" class="disp_left"/><br />
A bit of a joker is the book <a href="http://www.informit.com/guides/guide.aspx?g=cplusplus">The Informit C++ Reference Guide: Techniques, Insight, and Practical Advice on C++</a>. 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.<br />
<em>Target audience: intermediate</em>.<br />
<strong>Rating:</strong> 5 out of 5 stars</p>
]]></content:encoded>
			<wfw:commentRss>http://monzool.net/blog/2008/04/02/five-good-c-books/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
