<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>CodeShop - Blog</title>
  <id>tag:www.code-shop.com,2012:mephisto/blog</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://www.code-shop.com/feed/blog" rel="self" type="application/atom+xml"/>
  <link href="http://www.code-shop.com/blog" rel="alternate" type="text/html"/>
  <updated>2011-07-05T09:14:53Z</updated>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2011-07-05:6</id>
    <published>2011-07-05T07:25:00Z</published>
    <updated>2011-07-05T09:14:53Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2011/7/5/libraries" rel="alternate" type="text/html"/>
    <title>C++ libraries</title>
<content type="html">
            &lt;h1&gt;C++ libraries&lt;/h1&gt;


	&lt;p&gt;We provide free and portable C++ source &lt;a href=&quot;http://open.code-shop.com/trac/open/wiki&quot;&gt;libraries&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;The&lt;a href=&quot;http://open.code-shop.com/trac/open/wiki/TheLicense&quot;&gt;license&lt;/a&gt;  encourages both commercial and non-commercial use: most of the libraries have a Boost like license &#8211; this license is &lt;span class=&quot;caps&quot;&gt;OSR&lt;/span&gt; compatible, &#8211; others are &lt;span class=&quot;caps&quot;&gt;GPL&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://www.opensource.org/docs/definition.php&quot;&gt; &lt;img src=&quot;http://www.opensource.org/trademarks/opensource/web/opensource-110x95.png&quot; height=&quot;95&quot; alt=&quot;Open Source (OSI) Logo&quot; width=&quot;110&quot;&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;The libaries section below documents the libraries, for instance specialized libraries like &lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/AudioLib&quot;&gt;audio&lt;/a&gt;, &lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/DrmLib&quot;&gt;drm&lt;/a&gt;, &lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/XmlLib&quot;&gt;xml&lt;/a&gt;, &lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/RssLib&quot;&gt;rss&lt;/a&gt;, &lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/GeoIPLib&quot;&gt;geoip&lt;/a&gt; &#8211; or more general libraries like &lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/QueueLib&quot;&gt;queue&lt;/a&gt; or &lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/ThreadpoolLib&quot;&gt;threadpool&lt;/a&gt; &#8211; feel free to browse through the documentation section to see what&#8217;s available &#8230;&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://open.code-shop.com/trac/open/wiki&quot;&gt;Documentation&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/TheDownload&quot;&gt;Download&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/TheGettingStarted&quot;&gt;Getting started&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;https://open.code-shop.com/trac/open/browser&quot;&gt;Browse svn&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;https://open.code-shop.com/trac/open/wiki/TheLicense&quot;&gt;License&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Note: the &#8220;getting started&#8221; section describes what you will need to do (basically: download and run)&lt;/p&gt;


	&lt;h2&gt;Supported compilers&lt;/h2&gt;


	&lt;p&gt;Libraries have been tested on different of compilers and platforms. Since theyrely on modern C++ features not available in all compilers, not all libraries will work with every compiler. The following compilers and platforms have been extensively tested:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://developer.apple.com&quot;&gt;Apple &lt;span class=&quot;caps&quot;&gt;GCC&lt;/span&gt;&lt;/a&gt; 4.0 on Mac &lt;span class=&quot;caps&quot;&gt;OS X&lt;/span&gt;.&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://gcc.gnu.org&quot;&gt;&lt;span class=&quot;caps&quot;&gt;GNU C&lt;/span&gt;++&lt;/a&gt; 4.0.x, 4.1.x Linux (Debian and Ubuntu)&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/visualc/&quot;&gt;Microsoft Visual C++&lt;/a&gt; 7.1, 8.0&lt;/li&gt;
	&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Arjen</name>
    </author>
    <id>tag:www.code-shop.com,2009-05-18:226</id>
    <published>2009-05-18T11:01:00Z</published>
    <updated>2011-07-05T07:19:36Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2009/5/18/sparkx-embedded-maps" rel="alternate" type="text/html"/>
    <title>Sparkx Embedded Maps</title>
<content type="html">
            Showcase for Sparkx - Maps:

&amp;lt;iframe src=&quot;http://www.sparkx.com/widgets/widget.php?userid=4676&amp;auth=95fcd23031a5663ec49e1c14d2115492&amp;width=400&amp;height=300&amp;szoom=true&quot; frameborder=&quot;0&quot; height=&quot;300&quot; scrolling=&quot;no&quot; width=&quot;400&quot;&gt;&amp;lt;/iframe&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2009-05-17:225</id>
    <published>2009-05-17T12:34:00Z</published>
    <updated>2009-05-17T12:34:30Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2009/5/17/object_factory" rel="alternate" type="text/html"/>
    <title>object_factory</title>
<content type="html">
            &lt;p&gt;For some reason, I needed a object factory. Well, that&#8217;s easy you might think: this subject is well understood and textbook material.&lt;/p&gt;


	&lt;p&gt;It turns out differently.&lt;/p&gt;


	&lt;p&gt;There are in fact several places where you can look:
- Loki 
- Codeproject
- Boost Sandbox&lt;/p&gt;


	&lt;p&gt;But these are all either too specialized or too generalized: nothing fitted quite what I needed: an object factory that creates objecst based on the types of the constructor parameters &#8230;&lt;/p&gt;


	&lt;p&gt;For example:&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;r&quot;&gt;typedef&lt;/span&gt; ObjectFactory&amp;lt;base* (&lt;span class=&quot;pt&quot;&gt;int&lt;/span&gt;, &lt;span class=&quot;pt&quot;&gt;float&lt;/span&gt;), &lt;span class=&quot;pt&quot;&gt;short&lt;/span&gt;&amp;gt; factory_t;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;where base* (int, float) is the constructor signature, and short is the key (but you could use std::string just as easily).&lt;/p&gt;


	&lt;p&gt;The best solution was to be found on &lt;a href=&quot;http://www.gamedev.net/reference/articles/article2097.asp&quot;&gt;Gamedev&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;But this too needed a bit of attention: I wanted N constructor parameters, without having to specialize them by hand &#8211; as that would be silly.&lt;/p&gt;


	&lt;p&gt;So, with the help of Boost.Preprocessor I came up with the following.&lt;/p&gt;


	&lt;p&gt;The template is &lt;a href=&quot;http://www.code-shop.com/object_factory.hpp&quot;&gt;here&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;The template is specialized once for a constructor without arguments, and with the use of Boost.Preprocessor N times; well, between &lt;span class=&quot;caps&quot;&gt;LIMIT&lt;/span&gt;_LOWER_BOUND and &lt;span class=&quot;caps&quot;&gt;LIMIT&lt;/span&gt;_UPPER_BOUND &#8211; which you can adjust if you need more &#8230;&lt;/p&gt;


	&lt;p&gt;The above will allow for code like this &lt;a href=&quot;http://www.code-shop.com/object_factory_unit_test.hpp&quot;&gt;unit-test&lt;/a&gt;&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;r&quot;&gt;struct&lt;/span&gt; base {};&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;struct&lt;/span&gt; node1 : public base&lt;tt&gt;
&lt;/tt&gt;{&lt;tt&gt;
&lt;/tt&gt;  node1(&lt;span class=&quot;pt&quot;&gt;int&lt;/span&gt;) &lt;tt&gt;
&lt;/tt&gt;  { std::cout &amp;lt;&amp;lt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;node1(int)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &amp;lt;&amp;lt; std::endl; }&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  node1(&lt;span class=&quot;pt&quot;&gt;int&lt;/span&gt;, &lt;span class=&quot;pt&quot;&gt;float&lt;/span&gt;) &lt;tt&gt;
&lt;/tt&gt;  { std::cout &amp;lt;&amp;lt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;node1(int, float)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &amp;lt;&amp;lt; std::endl; }&lt;tt&gt;
&lt;/tt&gt;};&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;pt&quot;&gt;void&lt;/span&gt; test_object_factory()&lt;tt&gt;
&lt;/tt&gt;{&lt;tt&gt;
&lt;/tt&gt;  std::wcout &amp;lt;&amp;lt; L&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;object_factory_test: &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &amp;lt;&amp;lt; std::endl;&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;typedef&lt;/span&gt; ObjectFactory&amp;lt;base* (&lt;span class=&quot;pt&quot;&gt;int&lt;/span&gt;, &lt;span class=&quot;pt&quot;&gt;float&lt;/span&gt;),&lt;tt&gt;
&lt;/tt&gt;     &lt;span class=&quot;pt&quot;&gt;char&lt;/span&gt;*&amp;gt; node1_factory_t;&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  node1_factory_t nf;&lt;tt&gt;
&lt;/tt&gt;  nf.Register&amp;lt;node1&amp;gt;(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;node1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;);&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  base* n1 = nf.Create(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;node1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;, &lt;span class=&quot;fl&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;fl&quot;&gt;.0&lt;/span&gt;);&lt;tt&gt;
&lt;/tt&gt;  delete n1;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;This would create an object with the (int, float) signature.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2009-03-29:142</id>
    <published>2009-03-29T10:22:00Z</published>
    <updated>2009-05-17T12:35:22Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2009/3/29/rails-s-daemonize" rel="alternate" type="text/html"/>
    <title>rails's daemonize</title>
<content type="html">
            &lt;p&gt;Isn&#8217;t this a nice and clean way of forking?&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;def daemonize&lt;tt&gt;
&lt;/tt&gt;  exit &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; fork                   &lt;span class=&quot;pp&quot;&gt;# Parent&lt;/span&gt; exits, child continues.&lt;tt&gt;
&lt;/tt&gt;  Process.setsid                 &lt;span class=&quot;pp&quot;&gt;# Become&lt;/span&gt; session leader.&lt;tt&gt;
&lt;/tt&gt;  exit &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; fork                   &lt;span class=&quot;pp&quot;&gt;# Zap&lt;/span&gt; session leader. See [&lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;].&lt;tt&gt;
&lt;/tt&gt;  Dir.chdir &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                  &lt;span class=&quot;pp&quot;&gt;# Release&lt;/span&gt; old working directory.&lt;tt&gt;
&lt;/tt&gt;  File.umask &lt;span class=&quot;oc&quot;&gt;0000&lt;/span&gt;                &lt;span class=&quot;pp&quot;&gt;# Ensure&lt;/span&gt; sensible umask. Adjust as needed.&lt;tt&gt;
&lt;/tt&gt;  STDIN.reopen &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;       &lt;span class=&quot;pp&quot;&gt;# Free&lt;/span&gt; file descriptors and&lt;tt&gt;
&lt;/tt&gt;  STDOUT.reopen &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pp&quot;&gt;# point&lt;/span&gt; them somewhere sensible.&lt;tt&gt;
&lt;/tt&gt;  STDERR.reopen STDOUT           &lt;span class=&quot;pp&quot;&gt;# STDOUT&lt;/span&gt;/ERR should better go to a logfile.&lt;tt&gt;
&lt;/tt&gt;end&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;That is, it&#8217;s the same as in Steven&#8217;s &lt;i&gt;Advanced Programming for the Unix Environment&lt;/i&gt;, but a lot less verbose. Then again, above is Ruby &#8211; Stevens is C.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Arjen</name>
    </author>
    <id>tag:www.code-shop.com,2009-01-23:221</id>
    <published>2009-01-23T21:58:00Z</published>
    <updated>2009-01-23T21:59:30Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2009/1/23/youtube-s-inline-ads" rel="alternate" type="text/html"/>
    <title>YouTube's Inline Ads</title>
<content type="html">
            &lt;p&gt;Q: What happens when Google tries to match Disney videos to their pool of advertisers?&lt;/p&gt;


	&lt;p&gt;A: &lt;img src=&quot;http://www.code-shop.com/assets/2009/1/23/youtube-funny-ads.jpeg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;Ah, 31 animals . Let&#8217;s see, there&#8217;s Alex, Marty, Melman, Gloria, Julien, Maurice, Moto Moto, ...&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Arjen</name>
    </author>
    <id>tag:www.code-shop.com,2008-10-28:143</id>
    <published>2008-10-28T10:43:00Z</published>
    <updated>2008-12-09T13:58:28Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/10/28/iphone-capistrano-deployment" rel="alternate" type="text/html"/>
    <title>iPhone Capistrano deployment</title>
<content type="html">
            &lt;p&gt;You can automatically deploy your own application to the iPhonedevice by using Capistrano.&lt;/p&gt;


	&lt;p&gt;Requirements: Capistrano (gem install capistrano) and ldid (install via Cydia).&lt;/p&gt;


	&lt;p&gt;Build your application for the &lt;span class=&quot;caps&quot;&gt;ARM&lt;/span&gt; architecture:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
  bjam --toolset=darwin macosx-version=iphone-2.0 architecture=arm release
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Deploy the application to the iPhone:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
  cap deploy
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Your app is packaged (tar), copied (scp) to your iphone and SpringBoards is restarted. I use the following Capfile:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;

set :application_name, &quot;LocateMe&quot; 
set :iphone_ip, &quot;192.168.1.4&quot; 
set :user, &quot;root&quot; 
# password = alpine

desc &quot;Package your iPhone application&quot; 
task :package do
 %x[cd &quot;~/Library/Application Support/iPhone Simulator/User/Applications/00000000-0000-0000-0000-000000000000&quot; &#38;&#38; \
    tar -czpvf #{application_name}.tar.gz #{application_name}.app &#38;&#38; \
    scp #{application_name}.tar.gz #{user}@#{iphone_ip}:/Applications]
end

desc &quot;Install the application on your iPhone&quot; 
task :install, :hosts =&amp;gt; &quot;#{iphone_ip}&quot; do
  run &amp;lt;&amp;lt;-CMD
    cd /Applications/;
    tar -xzpvf #{application_name}.tar.gz;
    rm #{application_name}.tar.gz;
    ldid -S /Applications/#{application_name}.app/#{application_name};
    killall SpringBoard;                  # OS 2.0
#   /Applications/BossPrefs.app/Respring; # OS 2.1
  CMD
end

desc &quot;Package and install the application on your iPhone&quot; 
task :deploy, :hosts =&amp;gt; &quot;#{iphone_ip}&quot; do
  package
  install
end

&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Arjen</name>
    </author>
    <id>tag:www.code-shop.com,2008-10-28:144</id>
    <published>2008-10-28T10:40:00Z</published>
    <updated>2008-12-09T13:58:35Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/10/28/building-iphone-locateme-with-bjam" rel="alternate" type="text/html"/>
    <title>Building iPhone LocateMe with BJAM</title>
<content type="html">
            &lt;p&gt;Here&#8217;s an example Jamfile that you can use to build the LocateMe example with &lt;span class=&quot;caps&quot;&gt;BJAM&lt;/span&gt;. The jamfile basically just sums up the sources and resources that need to be compiled. &lt;span class=&quot;caps&quot;&gt;BJAM&lt;/span&gt; already supports the Darwin toolset.&lt;/p&gt;


	&lt;p&gt;The application is compiled and installed in your iPhone Simulator user directory. If you want to compile for the iPhone Simulator you invoke bjam with the following command:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
bjam --toolset=darwin macosx-version=iphonesim-2.0
&lt;/code&gt;&lt;/pre&gt;

If you want to compile for the iPhone device you have to change the architecture to &lt;span class=&quot;caps&quot;&gt;ARM&lt;/span&gt;.
&lt;pre&gt;&lt;code&gt;
bjam --toolset=darwin macosx-version=iphone-2.0 architecture=arm release
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Also see the article about automatically deploying your application to the iPhone using Capistrano.&lt;/p&gt;


	&lt;p&gt;The complete jamfile.v2 for reference:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
# jamfile.v2
#
#
# bjam --toolset=darwin macosx-version=iphonesim-2.0
# bjam --toolset=darwin macosx-version=iphone-2.0 architecture=arm release

import ibtool ;

project locate_me
  : source-location .
  : requirements
  : usage-requirements
  ;

# RESOURCES = Background.png Default.png HelloWorld.xib MainWindow.xib Icon.png Info.plist ;
RESOURCES = Default.png Icon.png Info.plist Localizable.strings ;

nib resources/FlipsideView : en.lproj/FlipsideView.xib ;
nib resources/MainView : en.lproj/MainView.xib ;
nib resources/MainWindow : en.lproj/MainWindow.xib ;

alias compiled_resources : resources/FlipsideView resources/MainView resources/MainWindow ;

exe LocateMe
  : main.m
    Classes/AccuracyPickerItem.m
    Classes/FlipsideViewController.m
    Classes/LocateMeAppDelegate.m
    Classes/MainViewController.m
    Classes/MyCLController.m
    Classes/RootViewController.m
  : &amp;lt;framework&amp;gt;/System/Library/Frameworks/UIKit
    &amp;lt;framework&amp;gt;/System/Library/Frameworks/Foundation
    &amp;lt;framework&amp;gt;/System/Library/Frameworks/CoreLocation
  ;

install simulator
  : LocateMe
  :
    &amp;lt;location&amp;gt;&quot;~/Library/Application Support/iPhone Simulator/User/Applications/00000000-0000-0000-0000-000000000000/LocateMe.app&quot; 
    &amp;lt;install-dependencies&amp;gt;on
    &amp;lt;install-type&amp;gt;EXE
  ;

install resources
  : $(RESOURCES) compiled_resources
  : &amp;lt;location&amp;gt;&quot;~/Library/Application Support/iPhone Simulator/User/Applications/00000000-0000-0000-0000-000000000000/LocateMe.app&quot; 
  ;

&lt;/code&gt;&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Arjen</name>
    </author>
    <id>tag:www.code-shop.com,2008-09-28:141</id>
    <published>2008-09-28T20:34:00Z</published>
    <updated>2008-12-09T13:58:50Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/9/28/c-iphone-development-with-bjam" rel="alternate" type="text/html"/>
    <title>C++ iPhone development with Bjam</title>
<content type="html">
            &lt;p&gt;Just got myself an outdated iPhone and a 2nd hand MacBook!&lt;/p&gt;


	&lt;p&gt;I&#8217;ve been toying with these two goodies for the last day and they are some funky goodies to get your hands on. Of course the most fun is to write your own stuff for it.&lt;/p&gt;


	&lt;p&gt;Part of the challenge is to &lt;strong&gt;not&lt;/strong&gt; use the XCode &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; provided by Apple, but instead use automated command-line tools. Basically I want to stay away from the &lt;span class=&quot;caps&quot;&gt;IDE&lt;/span&gt; and the objective-c. We&#8217;re going to use the boost-build system (bjam) and use as much plain C++ as possible.&lt;/p&gt;


	&lt;p&gt;Compiling and linking of an iPhone application is working fine. The next part is to get the application to run on the iPhone Simulator and/or the actual iPhone. The difficult part here is to get all the code signing, provisioning, packaging and copying in place.&lt;/p&gt;


	&lt;p&gt;I&#8217;ll keep you posted. If you&#8217;re doing something similar, then drop me a comment.&lt;/p&gt;


	&lt;p&gt;Arjen&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2008-09-08:136</id>
    <published>2008-09-08T15:26:00Z</published>
    <updated>2008-09-08T15:27:46Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/9/8/hungary" rel="alternate" type="text/html"/>
    <title>Hungary</title>
<content type="html">
            &lt;p&gt;Action Man says &#8216;Long live Apps Hungarian!&#8217; &#8211; no arguing with him:&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/9/8/Picture_3.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;But saying &#8216;I need the &#8216;p&#8217; prefix because&lt;/p&gt;


&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt; &lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;“&lt;/span&gt;&lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (size == &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;)&lt;span class=&quot;er&quot;&gt;”&lt;/span&gt; and &lt;span class=&quot;er&quot;&gt;“&lt;/span&gt;&lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (pSize == &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;)&lt;span class=&quot;er&quot;&gt;”&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


	&lt;p&gt;are different is wrong: best look @ your variable names &#8230;&lt;/p&gt;


	&lt;p&gt;(The picture came from Sutters &lt;a href=&quot;http://herbsutter.wordpress.com/2008/07/15/hungarian-notation-is-clearly-goodbad&quot;&gt;blog&lt;/a&gt;).&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2008-06-14:53</id>
    <published>2008-06-14T14:11:00Z</published>
    <updated>2008-09-14T14:27:24Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/6/14/standards" rel="alternate" type="text/html"/>
    <title>Standards</title>
<content type="html">
            &lt;p&gt;A note on standards &#8230;&lt;/p&gt;


	&lt;p&gt;These can be discussed for ever, or not at all – &lt;a href=&quot;http://blog.wordaligned.org/articles/2007/01/11/retro-fitting-coding-standards&quot;&gt;this&lt;/a&gt; tells you why.&lt;/p&gt;


	&lt;p&gt;More &lt;a href=&quot;http://www.parashift.com/c++-faq-lite/coding-standards.html&quot;&gt;notes&lt;/a&gt; and there&#8217;s off course Sutter&#38;Alexandrescu&#8217;s &lt;a href=&quot;http://www.amazon.com/Coding-Standards-Guidelines-Practices-Depth/dp/0321113586&quot;&gt;book&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;And if you really must, &lt;a href=&quot;http://www.boost.org/more/lib_guide.htm#Guidelines&quot;&gt;boost&lt;/a&gt; has a nice summary.&lt;/p&gt;


It boils down to:
	&lt;ul&gt;
	&lt;li&gt;Use the naming conventions of the C++ Standard Library!&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Sounds obvious &#8211; but what does that mean?&lt;/p&gt;


Here&#8217;s a few guidelines from that standard
	&lt;ul&gt;
	&lt;li&gt;Names (except as noted below) should be all lowercase, with words separated by underscores. &lt;/li&gt;
		&lt;li&gt;Acronyms should be treated as ordinary names (e.g. xml_parser instead of &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;_parser). &lt;/li&gt;
		&lt;li&gt;Template parameter names begin with an uppercase letter. &lt;/li&gt;
		&lt;li&gt;Macro (gasp!) names all uppercase (and can have a prefix like &#8220;MYLIB_&#8221;)&lt;/li&gt;
		&lt;li&gt;Choose meaningful names – explicit is better than implicit, and readability counts. There is a strong preference for clear and descriptive names, even if lengthy.&lt;/li&gt;
		&lt;li&gt;Use fixed-width fonts.&lt;/li&gt;
		&lt;li&gt;Use spaces rather than tabs.&lt;/li&gt;
		&lt;li&gt;Limit line lengths to 80 characters.&lt;/li&gt;
	&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2008-05-12:128</id>
    <published>2008-05-12T06:28:00Z</published>
    <updated>2008-05-12T08:22:05Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/5/12/japan" rel="alternate" type="text/html"/>
    <title>Japan</title>
<content type="html">
            &lt;p&gt;Is an amazing place &#8211; especially if you have a good friend who speaks japanese to show you around &#8211; a small impression &#8230;&lt;/p&gt;


	&lt;p&gt;There&#8217;s modern Japan&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/5/12/tokyo_tower-s.jpg&quot; alt=&quot;&quot; /&gt; &lt;br /&gt;
&lt;i&gt;Backlight Tokyo Tower&lt;/i&gt;&lt;/p&gt;


&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src=&quot;/assets/2008/5/12/roppongi-s.jpg&quot; alt=&quot;&quot; /&gt; 
&lt;a href=&quot;http://en.wikipedia.org/wiki/Roppongi&quot;&gt;&lt;i&gt;Roppongi&lt;/i&gt;&lt;/a&gt;

&lt;td&gt;
&lt;img src=&quot;/assets/2008/5/12/chris-s.jpg&quot; alt=&quot;&quot; /&gt;
&lt;i&gt;View on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Tokyo&quot;&gt;Rainbow bridge&lt;/a&gt; from Chris&#8217; home&lt;/i&gt;

&lt;/table&gt;

	&lt;p&gt;But there&#8217;s also the more traditional Japan, the gardens and temples:&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/5/12/flowers-s.png&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;i&gt;Sankeien garden&lt;/i&gt;&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/5/12/budda-s.jpg&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;i&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Kamakura%2C_Kanagawa&quot;&gt;Great Buddha at Kōtoku-in&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;


	&lt;p&gt;- and if you&#8217;re in for sushi for breakfast, go to Tsukiji fishmarket&lt;/p&gt;


&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src=&quot;/assets/2008/5/12/my-sushi-s.jpg&quot; alt=&quot;&quot; /&gt; &lt;br /&gt;
&lt;i&gt;My Sushi at Daiwa&lt;/i&gt;

&lt;/table&gt;

	&lt;p&gt;And off course, there&#8217;s a lot more: Kabukicho, &lt;a href=&quot;http://en.wikipedia.org/wiki/Akihabara&quot;&gt;Akihabara&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Shibuya%2C_Tokyo&quot;&gt;Shibuya&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Ueno_Park&quot;&gt;Ueno park&lt;/a&gt;, 代々木公園 (Yoyogi kōen) ...&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/5/12/zoo-s.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;and the zoo &#8211; although the panda&#8217;s moved on to a better place &#8230;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2008-05-10:61</id>
    <published>2008-05-10T09:40:00Z</published>
    <updated>2008-07-07T07:52:19Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/5/10/clickable" rel="alternate" type="text/html"/>
    <title>Clickable</title>
<content type="html">
            &amp;lt;object height=&quot;150&quot; width=&quot;350&quot;&gt;&amp;lt;param name=&quot;movie&quot; value=&quot;http://content.abonja.nl/database/whitelabelvideo.swf&quot;&gt;&amp;lt;/param&gt;&amp;lt;param name=&quot;allowfullscreen&quot; value=&quot;true&quot;&gt;&amp;lt;/param&gt;&amp;lt;param name=&quot;scale&quot; value=&quot;exactfit&quot;&gt;&amp;lt;/param&gt;&amp;lt;param name=&quot;flashvars&quot; value=&quot;playlist=http://www.abonja.nl/feed/item/18174?format=flash&quot;&gt;&amp;lt;/param&gt;&amp;lt;embed scale=&quot;exactfit&quot; allowfullscreen=&quot;true&quot; type=&quot;application/x-shockwave-flash&quot; src=&quot;http://content.abonja.nl/database/whitelabelvideo.swf&quot; flashvars=&quot;playlist=http://www.abonja.nl/feed/item/18174?format=flash&amp;amp;show_header=false&amp;amp;show_controls=false&amp;amp;noemail=true&quot; height=&quot;150&quot; width=&quot;350&quot;&gt;&amp;lt;/embed&gt;&amp;lt;/object&gt;

	&lt;p&gt;Cool piece of film no?&lt;/p&gt;


	&lt;p&gt;So what if you could click or touch highlighted items and order them: you&#8217;re watching a free movie, but you &lt;i&gt;have&lt;/i&gt; to order a pizza &#8230;&lt;/p&gt;


	&lt;p&gt;What if there was a website where you could pick ads to be layered over your movie / or vice versa &#8230;&lt;/p&gt;


	&lt;p&gt;There are some companies doing add-layover, but it&#8217;s ugly &#8211; why don&#8217;t play with the format ??&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2008-04-16:124</id>
    <published>2008-04-16T05:54:00Z</published>
    <updated>2008-05-12T06:47:47Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/4/16/good-accu" rel="alternate" type="text/html"/>
    <title>Good ACCU</title>
<content type="html">
            &lt;p&gt;On april 1 I took off to attend the &lt;a href=&quot;http://www.accu.org/index.php/conferences/accu_conference_2008/accu2008_schedule&quot;&gt;&lt;span class=&quot;caps&quot;&gt;ACCU&lt;/span&gt;&lt;/a&gt; in Oxford, it lasts 5 days and it was amazing! Being there, listening, learning, meeting people, asking questions &#8230; (And of course drink a beer or 2 :)&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/5/12/6am-s.jpg&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;
&lt;i&gt;Oxford saturday morning 6 am&lt;/i&gt;&lt;/p&gt;


	&lt;p&gt;Highlights were: on wednesday I attended &lt;a href=&quot;http://armstrongonsoftware.blogspot.com&quot;&gt;Joe Armstrongs&lt;/a&gt; talk on Erlang &#8211; I already read parts of the book, so I had a notion of what was coming; it was very interesting, especially the figures on Moore&#8217;s law and multicores and how Erlang has concurrency baked into. Then I got the privilige to get a 3 hour introduction to Haskell by &lt;a href=&quot;http://en.wikipedia.org/wiki/Simon_Peyton_Jones&quot;&gt;Simon Peyton Jones&lt;/a&gt; &#8211; great! (Interestingly enough, in 2003 he gave a talk as well, in which I was quite clueless &#8211; this time I understood more).&lt;/p&gt;


&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src=&quot;/assets/2008/5/12/christ_church-s.jpg&quot; alt=&quot;&quot; /&gt;
&lt;td&gt;
&lt;i&gt;Christ Church&lt;/i&gt;
&lt;/table&gt;

	&lt;p&gt;On saturday there was a full day on organizations/patterns by &lt;a href=&quot;http://en.wikipedia.org/wiki/Jim_Coplien&quot;&gt;James Coplien&lt;/a&gt; &#8211; to me this was one of the best sessions, as I agree with one of Copliens statements (my words) &#8216;it&#8217;s the people stupid&#8217; &#8211; it is no so much technology that is difficult but us &#8230; He authored this book &#8211; and it&#8217;s certainly worth a read!&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/4/16/coplien.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>admin</name>
    </author>
    <id>tag:www.code-shop.com,2008-04-13:122</id>
    <published>2008-04-13T18:07:00Z</published>
    <updated>2008-04-13T18:18:20Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/4/13/not-far-from" rel="alternate" type="text/html"/>
    <title>Not far from</title>
<content type="html">
            &lt;p&gt;the truth, I believe &#8230;&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/4/13/twit.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;Saw this &lt;a href=&quot;http://www.gapingvoid.com/Moveable_Type/archives/004480.html&quot;&gt;cartoon&lt;/a&gt; &#8211; and sort of liked it :)&lt;/p&gt;


	&lt;p&gt;The bigger question being, what could be the next big/fundamental/paradigm thing &#8211; or is there none, basically?&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.code-shop.com/">
    <author>
      <name>Dirk</name>
    </author>
    <id>tag:www.code-shop.com,2008-02-07:55</id>
    <published>2008-02-07T07:23:00Z</published>
    <updated>2008-03-22T17:38:05Z</updated>
    <category term="Blog"/>
    <link href="http://www.code-shop.com/2008/2/7/icu-on-x64" rel="alternate" type="text/html"/>
    <title>ICU on x64</title>
<content type="html">
            &lt;p&gt;&lt;span class=&quot;caps&quot;&gt;ICU&lt;/span&gt; &#8211; the &lt;a href=&quot;http://www.icu-project.org&quot;&gt;international components for unicode&lt;/a&gt; is a very usefull library if you&#8217;re working with unicode and/or internationalization issues.&lt;/p&gt;


	&lt;p&gt;It offers all kinds of hard to work out yourself stuff &#8211; but one thing thats is a bit difficult is to the the download to build on windows x64 (vc8); as the .sln file only has 32 bits targets &#8230;&lt;/p&gt;


	&lt;p&gt;Sure, there&#8217;s a rather difficult approach with cygwin/bash/nmake/cl (have auteconf create makefiles and call m$ nmake + cl as the compiler), but even when you got sofar as the having compiled and linked the libs &#8211; you then are faced with incompatibilities: the .def and importlibs for the dlls are wrong.&lt;/p&gt;


	&lt;p&gt;The solution is really simple.&lt;/p&gt;


	&lt;p&gt;Just open the .sln file and change the targets from 32 bit to 64 bit.&lt;/p&gt;


	&lt;p&gt;This will work: libs are correct and you will get good working exe&#8217;s.&lt;/p&gt;


	&lt;p&gt;Settings:&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;/assets/2008/2/7/x64-s.PNG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
          </content>  </entry>
</feed>
