<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4997825642897855521</id><updated>2024-10-25T01:11:27.397+02:00</updated><category term="Java"/><category term="webOS"/><category term="Enyo"/><category term="Windows"/><category term="C"/><category term="C++"/><category term="Eclipse"/><category term="Javascript"/><category term="LWJGL"/><category term="string"/><category term="Slick"/><category term="ANT"/><category term="ActionScript"/><category term="Android"/><category term="Command line"/><category term="FlashDevelop"/><category term="Mojo"/><category term="Service"/><category term="Total Commander"/><category term="tokenize"/><category term="APK"/><category term="CCCH"/><category term="CamelCase"/><category term="Code Formatter"/><category term="CyanogenMod"/><category term="Decompile"/><category term="Find"/><category term="Geometry"/><category term="Google"/><category term="HP Touchpad"/><category term="HTML"/><category term="Icon"/><category term="Javascript service"/><category term="Lines of code"/><category term="Math"/><category term="OpenGL"/><category term="Placeholder"/><category term="Promise"/><category term="Properties"/><category term="RCP"/><category term="STL"/><category term="Shutdown"/><category term="TortoiseSVN"/><category term="WC"/><category term="WebDAV"/><category term="Webservice"/><category term="cujo.js"/><category term="e4"/><category term="node.js"/><category term="templates"/><category term="trim"/><category term="when.js"/><title type='text'>Codebrocken</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-2629579016714425732</id><published>2022-08-24T14:54:00.004+02:00</published><updated>2022-08-24T14:54:40.877+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Getting the google-java-format plugin to run in Eclipse with JDK &gt;= 16</title><content type='html'>&lt;p&gt;The google-java-style plugin can be found &lt;a href=&quot;https://github.com/google/google-java-format&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. You can download the newest version in their release folder. Installation is pretty straight forward - just copy it into the dropins folder of your Eclipse installation folder.&lt;/p&gt;&lt;p&gt;but if you are running on a JDK with a version &amp;gt;= 16 it simply will not work. Going through the release history of the plugin you&#39;ll find a comment for version&amp;nbsp;&lt;a href=&quot;https://github.com/google/google-java-format/releases/tag/v1.10.0&quot; target=&quot;_blank&quot;&gt;1.10.0&lt;/a&gt;. If you are running the Java formatter, you&#39;ll hhave to add some VM args, when you start your Java application.&lt;/p&gt;&lt;p&gt;In order to get this working with your whole Eclipse IDE you&#39;ll have to edit the eclipse.ini in the following way. Took me a little bit, because I forgot the equals after the add-exports:&lt;/p&gt;&lt;p&gt;-vmargs&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre class=&quot;pretty-print&quot;&gt;-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED&lt;/pre&gt;&lt;p&gt;The first part might differ. The important lines are the --add-exports.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/2629579016714425732/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2022/08/getting-google-java-format-plugin-to.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/2629579016714425732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/2629579016714425732'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2022/08/getting-google-java-format-plugin-to.html' title='Getting the google-java-format plugin to run in Eclipse with JDK &gt;= 16'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-6836988031505504199</id><published>2018-08-28T11:01:00.002+02:00</published><updated>2018-09-07T11:44:54.572+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="APK"/><category scheme="http://www.blogger.com/atom/ns#" term="Decompile"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Decompiling an Android APK file</title><content type='html'>I recently needed to look into another Android app to see how they implemented some strange UI behaviour. There are a few steps neccessary to get the source code of an app.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Download the APK from the device.&lt;/li&gt;
&lt;li&gt;Convert the APK file to a JAR&lt;/li&gt;
&lt;li&gt;Decompile the JAR&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;h3&gt;
Download the APK from the device&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This can be done using the Android SDK platform tools. Go to your SDK directory and find platform-tools/adb.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you don&#39;t know where your application is installed on your device follow these instructions:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Type&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;adb shell&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This gives you a Linux shell on your device. Now type:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;pm list packages -f&lt;/pre&gt;
&lt;br /&gt;
This will give you a list of all your installed applications and the paths where they are located in the filesystem.&lt;br /&gt;
&lt;br /&gt;
Exit the shell and download the APK via:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;adb pull &amp;lt;Path to the APK file on the device&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
Now you can find the APK file in your current directory.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Convert the APK file to a JAR&lt;/h3&gt;
&lt;br /&gt;
Now we use the &lt;a href=&quot;https://github.com/pxb1988/dex2jar&quot; target=&quot;_blank&quot;&gt;dex2jar tool&lt;/a&gt; to convert the Dalvik executable files into class files inside a JAR. Download the tool from the github repository and run&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;sh d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This creates the JAR archive in the current directory.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Decompile the JAR&lt;/h3&gt;
&lt;br /&gt;
Now we can use the &lt;a href=&quot;http://jd.benow.ca/&quot; target=&quot;_blank&quot;&gt;Java Decompiler&lt;/a&gt; to view the contents of the JAR archive. Just open the JAR archive in the Decompiler and browse the classes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/6836988031505504199/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2018/08/decompiling-android-apk-file.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/6836988031505504199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/6836988031505504199'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2018/08/decompiling-android-apk-file.html' title='Decompiling an Android APK file'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-1681577296639057145</id><published>2018-06-04T12:04:00.002+02:00</published><updated>2018-06-04T12:04:37.585+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="e4"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Icon"/><category scheme="http://www.blogger.com/atom/ns#" term="RCP"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Create an icon for an Eclipse e4 RCP application (Windows).</title><content type='html'>Trying to give your new Eclipse e4 application a new Windows icon is more complex than one might think.&lt;br /&gt;
&lt;br /&gt;
The solution I am presenting here works for my application that is build with Tycho 1.0.0. I don&#39;t know if you run into the same problems when doing an export from Eclipse as I have never tried that.&lt;br /&gt;
&lt;br /&gt;
When I tried to change the icon I ran into two different problems:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Creating an Windows ICO file that contains all images in the correct formats.&lt;/li&gt;
&lt;li&gt;Adding the icon to the product definition.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
Creating the Window ICO file&lt;/h3&gt;
&lt;div&gt;
The Windows ICO file has to contain 7 images in different resolutions and depths:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;48x48, 8 bits&lt;/li&gt;
&lt;li&gt;32x32, 8 bits&lt;/li&gt;
&lt;li&gt;16x16, 8 bits&lt;/li&gt;
&lt;li&gt;48x48, 32 bits&lt;/li&gt;
&lt;li&gt;32x32, 32 bits&lt;/li&gt;
&lt;li&gt;16x16, 32 bits&lt;/li&gt;
&lt;li&gt;256x256, 32 bits&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
You can find many tools to create an ICO file for you. But you always have to export all your files in the right format and add them to the ICO file. I tried that with several tools and never got it working right.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So I went to Linux and just used &lt;a href=&quot;http://www.imagemagick.org/script/index.php&quot; target=&quot;_blank&quot;&gt;ImageMagick&lt;/a&gt;&amp;nbsp;convert to convert all my images into the format Eclipse needs and than use &lt;a href=&quot;https://www.nongnu.org/icoutils/&quot; target=&quot;_blank&quot;&gt;icoutils&lt;/a&gt; to create the ICO file.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Using &lt;a href=&quot;https://www.gimp.org/&quot; target=&quot;_blank&quot;&gt;GIMP&lt;/a&gt; I created four versions of the image I wanted to use as my icon: 256x256, 48x48, 32x32 and 16x16.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Then I just ran these commands and got my ICO file.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;convert -colors 256 myicon_16x16.png tmp.gif
convert -colors 256 tmp.gif icon_16x16_8.png
convert -colors 256 myicon_32x32.png tmp.gif
convert -colors 256 tmp.gif icon_32x32_8.png
convert -colors 256 myicon_48x48.png tmp.gif
convert -colors 256 tmp.gif icon_48x48_8.png
icotool -c icon_16x16_8.png myicon_16x16.png icon_32x32_8.png myicon_32x32.png icon_48x48_8.png myicon_48x48.png myicon_256x256.png &amp;gt; icon.ico
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h3&gt;
Adding the icon to the product information&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
In the product definition of your Eclipse e4 application you can select an ICO file that should be used for the generated executable. When I clicked browse and selected the icon file I had previously generated I got this:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiabhHf3ojVT2SlPHFwpqdVxB0_s17POJHxxQXKZyanCPLqXUm5nokKcBWMYbVz4ZQYHqMnKW2wR2fE8nuRRGpd2txNLGbhIVHtxHrhbVLiiQP35P8m5f_U6CiZrmOVh_ekzf58x5s6kuo/s1600/icon.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;426&quot; data-original-width=&quot;519&quot; height=&quot;262&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiabhHf3ojVT2SlPHFwpqdVxB0_s17POJHxxQXKZyanCPLqXUm5nokKcBWMYbVz4ZQYHqMnKW2wR2fE8nuRRGpd2txNLGbhIVHtxHrhbVLiiQP35P8m5f_U6CiZrmOVh_ekzf58x5s6kuo/s320/icon.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The IconExe tool that is used for replacing the icons during the Tycho buiold was not able to find the ICO file. I had to change that to a local path for it to work.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggXxjZ8q7uv207eTqGprtgYR7nIYc8-Vixbexz8uYGWp_0kiXh4-wa5N35HBDMd_aCjdOWz9Lt-3IQoa_jJqUCFGK-YZGfrd0K6JJKXSfEeb6Uh72UHd7tH3vCpmf9e43KJ-iEIdJZRD0/s1600/icon2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;426&quot; data-original-width=&quot;519&quot; height=&quot;262&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggXxjZ8q7uv207eTqGprtgYR7nIYc8-Vixbexz8uYGWp_0kiXh4-wa5N35HBDMd_aCjdOWz9Lt-3IQoa_jJqUCFGK-YZGfrd0K6JJKXSfEeb6Uh72UHd7tH3vCpmf9e43KJ-iEIdJZRD0/s320/icon2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/1681577296639057145/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2018/06/create-icon-for-eclipse-e4-rcp.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1681577296639057145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1681577296639057145'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2018/06/create-icon-for-eclipse-e4-rcp.html' title='Create an icon for an Eclipse e4 RCP application (Windows).'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiabhHf3ojVT2SlPHFwpqdVxB0_s17POJHxxQXKZyanCPLqXUm5nokKcBWMYbVz4ZQYHqMnKW2wR2fE8nuRRGpd2txNLGbhIVHtxHrhbVLiiQP35P8m5f_U6CiZrmOVh_ekzf58x5s6kuo/s72-c/icon.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-260106231717635525</id><published>2013-05-08T20:00:00.000+02:00</published><updated>2013-05-08T20:00:03.180+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><category scheme="http://www.blogger.com/atom/ns#" term="templates"/><category scheme="http://www.blogger.com/atom/ns#" term="tokenize"/><title type='text'>C++: improved string tokenizer</title><content type='html'>Using templates the &lt;a href=&quot;http://codebrocken.blogspot.de/2012/02/c-string-tokenzier.html&quot;&gt;old string tokenzier&lt;/a&gt; can be further improved:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;template &lt;class t=&quot;&quot;&gt; void tokenize(const std::string &amp;amp;str,
              T &amp;amp;tokens,
              const std::string &amp;amp;delimiters = &quot; &quot;) {
  string::size_type lastPos = str.find_first_not_of(delimiters, 0);
  string::size_type pos = str.find_first_of(delimiters, lastPos);

  while (std::string::npos != pos || std::string::npos != lastPos) {
    tokens.push_back(str.substr(lastPos, pos - lastPos));
    lastPos = str.find_first_not_of(delimiters, pos);
    pos = str.find_first_of(delimiters, lastPos);
  }
}
&lt;/class&gt;&lt;/pre&gt;
&lt;br /&gt;
This allows any container with a push_back() method to receive the extracted tokens.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;std::list&lt;std::string&gt; tokens;
tokenize(&quot;I want to tokenize this!&quot;, tokens);

tokenize(&quot;2012-02-20&quot;, tokens, &quot;-&quot;);
&lt;/std::string&gt;&lt;/pre&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;std::vector&lt;std::string&gt; tokens;
tokenize(&quot;I want to tokenize this!&quot;, tokens);

tokenize(&quot;2012-02-20&quot;, tokens, &quot;-&quot;);
&lt;/std::string&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/260106231717635525/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2013/05/c-improved-string-tokenizer.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/260106231717635525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/260106231717635525'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2013/05/c-improved-string-tokenizer.html' title='C++: improved string tokenizer'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-3671845118025759452</id><published>2012-09-21T15:58:00.000+02:00</published><updated>2012-09-21T15:58:14.100+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="Placeholder"/><title type='text'>Web: Placeholder.it</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.placehold.it/350x150&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;137&quot; src=&quot;http://www.placehold.it/350x150&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
I found this very useful site on the internet a few days ago. &lt;a href=&quot;http://placeholder.it/&quot;&gt;Placeholder.it&lt;/a&gt; provides a very simple service. You can request an image from them specifying a width and height and they will provide a grey image at your requested size.&lt;br /&gt;
&lt;br /&gt;
If you are lazy like me, you can use these images to quickly build spacers or blind images to layout your site.&lt;br /&gt;
&lt;br /&gt;
This will generate an image with 350x150 pixels.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;http://www.placehold.it/350x150&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/3671845118025759452/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/09/web-placeholderit.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/3671845118025759452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/3671845118025759452'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/09/web-placeholderit.html' title='Web: Placeholder.it'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-202221816704298312</id><published>2012-08-22T20:00:00.000+02:00</published><updated>2012-08-22T20:00:02.497+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="STL"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><title type='text'>C++: String startsWith function</title><content type='html'>This function checks if the supplied string starts with the specified prefix.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;bool string_startsWith(const std::string &amp;str, const std::string &amp;prefix) {
  return std::equal(prefix.begin(), prefix.end(), str.begin());
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/202221816704298312/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/08/c-string-startswith-function.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/202221816704298312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/202221816704298312'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/08/c-string-startswith-function.html' title='C++: String startsWith function'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-6572010011856332002</id><published>2012-08-17T08:00:00.000+02:00</published><updated>2012-08-17T08:00:10.523+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ActionScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Geometry"/><category scheme="http://www.blogger.com/atom/ns#" term="Math"/><title type='text'>ActionScript: Distance between line and a point</title><content type='html'>&lt;pre class=&quot;prettyprint code&quot;&gt;/**
 * Computes the difference vector between two vectors.
 * @param p1 First vector (from (0,0).
 * @param p2 Second vector (from (0,0).
 * @return  The difference vector between p1 and p2.
 */
public static function differenceVector(p1 : Point, p2 : Point) : Point {
 return new Point(p2.x - p1.x, p2.y - p1.y);
}
  
/**
 * Projects a point onto a line. Returns the projected point or null if
 * the projection does not fall within the segment. 
 * 
 * @param lineStart First point of the line.
 * @param lineEnd Second point of the line.
 * @param p Point that should be projected onto the line given by 
 *              lineStart and lineEnd.
 * @return      The projected point on the line or null if the projection line
 *              falls not between lineStart and lineEnd.
 */
public static function projectPointOntoLine(lineStart : Point, 
                                            lineEnd : Point, 
                                            p : Point) : Point {
 // Difference vector is the line.
 var l : Point = differenceVector(lineEnd, lineStart);
   
 // Determine determinant and divide it by the length of the line.
 var u : Number = (((p.x - lineStart.x) * (lineEnd.x - lineStart.x)) + 
                          ((p.y - lineStart.y) * (lineEnd.y - lineStart.y))) / 
                         (l.length * l.length);
   
 // Check whether the projection lies between lineStart and lineEnd.
 if ((u &amp;lt; 0) || (u &amp;gt; 1)) {
  return null;
 }
   
 // Compute projection point.
 var pp : Point = new Point(lineStart.x + u * (lineEnd.x - lineStart.x),
                                   lineStart.y + u * (lineEnd.y - lineStart.y));
   
 return pp;
}
  
/**
 * Computes the shortest distance between a line and a point. If the 
 * point cannot be projected onto the line segment specified by
 * lineStart and lineEnd, the function will return -1.
 * 
 * @param lineStart First point of the line.
 * @param lineEnd Second point of the line.
 * @param p Point that should be projected onto the line given by
 *              lineStart and lineEnd.
 * @return      The distance between p and the line or -1 if p cannot be
 *              projected onto the line.
 */
public static function distanceLinePoint(lineStart : Point, 
                                         lineEnd : Point, 
                                         p : Point) : Number {
 var projection : Point = projectPointOntoLine(lineStart, lineEnd, p);
 if (projection != null) {
  return differenceVector(p, projection).length;
 } else {
  return -1;
 }
}
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/6572010011856332002/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/08/actionscript-distance-between-line-and.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/6572010011856332002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/6572010011856332002'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/08/actionscript-distance-between-line-and.html' title='ActionScript: Distance between line and a point'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-3283538416772985857</id><published>2012-08-16T08:00:00.000+02:00</published><updated>2012-08-16T11:26:15.866+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CamelCase"/><category scheme="http://www.blogger.com/atom/ns#" term="CCCH"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="FlashDevelop"/><title type='text'>FlashDevelop: CamelCase cursor hopping</title><content type='html'>As a keyboard person I really like to navigate text fast. I use &lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;CRTL-Left&lt;/span&gt; and &lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;CRTL-Right&lt;/span&gt; in any text editor to jump between words. &lt;a href=&quot;http://www.eclipse.org/&quot; target=&quot;_blank&quot;&gt;Eclipse&lt;/a&gt; added another feature onto the word hopping. It recognizes the CamelCase nature of code. So if I have&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;myLayoutManager&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
it will position the cursor at the beginning of my on the first press, on the L of Layout on the second press and on the M of Manager on the thrid press, before jumping to the next word or character. For editing code this is simply great. Saves so much time and single curor movement.&lt;br /&gt;
&lt;br /&gt;
Because I have not found an official name for this behavior I will call it CamelCase cursor hopping (CCCH).&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.flashdevelop.org/&quot; target=&quot;_blank&quot;&gt;FlashDevelop&lt;/a&gt;&amp;nbsp;does not support CCCH, but you can install plugins.&amp;nbsp;&lt;a href=&quot;http://m0rkeulv.net/&quot; target=&quot;_blank&quot;&gt;Mørkeulv&lt;/a&gt; wrote the&amp;nbsp;&lt;a href=&quot;http://m0rkeulv.net/blog/641&quot; target=&quot;_blank&quot;&gt;Wordshifter plugin&lt;/a&gt;&amp;nbsp;that enables it in FlashDevelop. Just download the &lt;a href=&quot;http://m0rkeulv.net/wp-content/uploads/WordShifter_bin.fdz&quot; target=&quot;_blank&quot;&gt;binary&lt;/a&gt; from his blog and install it. He even provides the &lt;a href=&quot;http://m0rkeulv.net/wp-content/uploads/WordShifter_src.zip?9d7bd4&quot; target=&quot;_blank&quot;&gt;source code&lt;/a&gt; for the plugin.&lt;br /&gt;
&lt;br /&gt;
You can customize the jumping behavior by providing your own regular expression and which keys should be used to hop around the code. This way you can reenable the old word jumping and have CCCH along each other.&lt;br /&gt;
&lt;br /&gt;
Thanks for the addon!&lt;br /&gt;
&lt;br /&gt;
Links:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Mørkeulv&amp;nbsp;Blog:&amp;nbsp;&lt;a href=&quot;http://m0rkeulv.net/&quot; target=&quot;_blank&quot;&gt;http://m0rkeulv.net/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;WordShifter binary:&amp;nbsp;&lt;a href=&quot;http://m0rkeulv.net/wp-content/uploads/WordShifter_bin.fdz&quot; target=&quot;_blank&quot;&gt;http://m0rkeulv.net/wp-content/uploads/WordShifter_bin.fdz&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;WordShifter source:&amp;nbsp;&lt;a href=&quot;http://m0rkeulv.net/wp-content/uploads/WordShifter_src.zip?9d7bd4&quot; target=&quot;_blank&quot;&gt;http://m0rkeulv.net/wp-content/uploads/WordShifter_src.zip?9d7bd4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;FlashDevelop forum with more information:&amp;nbsp;&lt;a href=&quot;http://www.flashdevelop.org/community/viewtopic.php?f=4&amp;amp;t=9566&quot; target=&quot;_blank&quot;&gt;http://www.flashdevelop.org/community/viewtopic.php?f=4&amp;amp;t=9566&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/3283538416772985857/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/08/flashdevelop-camelcase-cursor-hopping.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/3283538416772985857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/3283538416772985857'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/08/flashdevelop-camelcase-cursor-hopping.html' title='FlashDevelop: CamelCase cursor hopping'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-7001050098662924294</id><published>2012-08-15T20:00:00.000+02:00</published><updated>2012-08-16T12:35:21.198+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="CyanogenMod"/><category scheme="http://www.blogger.com/atom/ns#" term="HP Touchpad"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Android: Install USB drivers for HP Touchpad</title><content type='html'>If you have a HP Touchpad running &lt;a href=&quot;http://www.cyanogenmod.com/&quot; target=&quot;_blank&quot;&gt;CyanogenMod Android&lt;/a&gt;, you can use it to develop and test applications on the native device. But before you can use the tools from the &lt;a href=&quot;http://developer.android.com/sdk/index.html&quot; target=&quot;_blank&quot;&gt;Android SDK&lt;/a&gt; on a Windows PC, you have to install the USB drivers.&lt;br /&gt;
&lt;br /&gt;
The Android SDK provides USB drivers for Windows in &lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;sdk-directory&amp;gt;/extras/google/usb-drivers&lt;/span&gt;. But those drivers don&#39;t include the needed information to identifiy a CyanogenMod Android. CyanogenMod has a patched&amp;nbsp;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;an&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;droid_winusb.inf&lt;/span&gt;&lt;/span&gt; file and the instructions on how to install it available in their &lt;a href=&quot;http://wiki.cyanogenmod.com/wiki/Howto:_Install_the_Android_SDK/Windows&quot; target=&quot;_blank&quot;&gt;wiki&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The patched driver information file does not contain information for the HP Touchpad. You have to patch the patched INF file again for the Touchpad.&lt;br /&gt;
&lt;br /&gt;
So here are the steps needed to connect the Touchpad to a Windows PC to start developing/debugging:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Turn on MTP, which is disabled by default,&amp;nbsp;on the Touchpad.&lt;br /&gt;
&lt;div&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Go to Settings -&amp;gt; Storage -&amp;gt; click on the three small squares in the upper right corner -&amp;gt; USB computer connection -&amp;gt; enable Media Device (MTP)&lt;/blockquote&gt;2. Add HP Touchpad Vendor and Product IDs to the INF file&lt;/div&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Edit the &lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;android_winusb.inf&lt;/span&gt; either from the CyanodgenMod wiki or the original file from the Android SDK. Add these lines at the end of the sections for &lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;[Google.NTx86]&lt;/span&gt; and &lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;[Google.NTamd64]&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint code&quot;&gt;; HP TouchPad
%SingleAdbInterface%    = USB_Install, USB\VID_0BB4&amp;amp;PID_6860&amp;amp;REV_0227&amp;amp;MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&amp;amp;PID_6860&amp;amp;MI_01
&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;3. Update driver in Windows Device Manager&lt;/div&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Open the Device Manager in Windows, selection the unknown USB device and update drivers. Select the &lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;android_winusb.inf&lt;/span&gt; file you just modified.&lt;/blockquote&gt;&lt;div&gt;4) Reboot Touchpad&lt;br /&gt;
&lt;ol&gt;&lt;/ol&gt;Sources:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://stackoverflow.com/questions/9426430/hp-touchpad-usb-driving-on-android&quot; target=&quot;_blank&quot;&gt;http://stackoverflow.com/questions/9426430/hp-touchpad-usb-driving-on-android&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/cmtouchpad/issues/detail?id=663&quot; target=&quot;_blank&quot;&gt;http://code.google.com/p/cmtouchpad/issues/detail?id=663&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/7001050098662924294/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/08/android-install-usb-drivers-for-hp.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/7001050098662924294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/7001050098662924294'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/08/android-install-usb-drivers-for-hp.html' title='Android: Install USB drivers for HP Touchpad'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-1610287543491143970</id><published>2012-08-14T20:00:00.000+02:00</published><updated>2012-08-14T20:00:02.339+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ActionScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Code Formatter"/><category scheme="http://www.blogger.com/atom/ns#" term="FlashDevelop"/><title type='text'>FlashDevelop: Curly braces and CodeFormatter</title><content type='html'>I have been using &lt;a href=&quot;http://www.flashdevelop.org/&quot; target=&quot;_blank&quot;&gt;FlashDevelop&lt;/a&gt; lately. It is a great IDE for ActionScript development. But coming from an &lt;a href=&quot;http://www.eclipse.org/&quot; target=&quot;_blank&quot;&gt;Eclipse&lt;/a&gt; background I had to relearn a lot of keyboard shortcuts. One feature I really like in an IDE is using a code formatter. FlashDevelop contains such a feature and it can be accessed by right clicking in the editor and selecting &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Refactor-&amp;gt;Code Formatter&lt;/span&gt; or by using the keyboard shortcut &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;CRTL-Shift-2&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
But as always every programmer hates it when the automatic code formatter destroys lovingly crafted indentation. The default behavior of the FlashDevelop formatter is to put the curly braces on a new line. I have struggled a long time with myself over whether to put them on a new line or keep them on the same line. The later option won. And now it just feels awkward to see them on a line of their own.&lt;br /&gt;
&lt;br /&gt;
Of course FlashDevelop provides a solution - a little bit hidden. Go to&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Tools -&amp;gt; Program Settings -&amp;gt; CodeFormatter -&amp;gt; BraceStyle&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and change it to &quot;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;OnLine&lt;/span&gt;&quot;.</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/1610287543491143970/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/08/flashdevelop-curly-braces-and.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1610287543491143970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1610287543491143970'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/08/flashdevelop-curly-braces-and.html' title='FlashDevelop: Curly braces and CodeFormatter'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-5676821094282838894</id><published>2012-07-04T20:00:00.000+02:00</published><updated>2012-07-05T10:07:39.198+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command line"/><category scheme="http://www.blogger.com/atom/ns#" term="Service"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Windows: Create/Delete a service</title><content type='html'>Create a new service:&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;sc create SERVICENAME binpath= &quot;&amp;lt;path to executable&amp;gt; -arg1 -arg2&quot;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The excutable is installed as a service. See my &lt;a href=&quot;http://codebrocken.blogspot.de/2012/07/c-create-windows-service.html&quot;&gt;other post&lt;/a&gt; about building your own service. Please note that there is a space after &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;binpath=.&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;DIf the service needs arguments (which will be passed to the &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ServiceMain&lt;/span&gt; function), you can add them (&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;arg1&lt;/span&gt;, &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;arg2 &lt;/span&gt;above). Just be sure to surround the executable and the arguments with quotes.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Delete an existing service:&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;sc delete SERVICENAME&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The service will be deleted after the next restart.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/5676821094282838894/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/07/windows-createdelete-service.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5676821094282838894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5676821094282838894'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/07/windows-createdelete-service.html' title='Windows: Create/Delete a service'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-2829130938324242498</id><published>2012-07-03T20:00:00.000+02:00</published><updated>2012-07-03T20:00:02.472+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Service"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>C++: Create a Windows service</title><content type='html'>Creating a Windows service is fairly simple. You start by writing you &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;main()&lt;/span&gt; function as you would normally. In the&amp;nbsp;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;main()&lt;/span&gt; function you have to call &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686324(v=vs.85).aspx&quot; target=&quot;_blank&quot;&gt;StartServiceCrtlDispatcher()&lt;/a&gt;&lt;/span&gt;. The programm has to make this call at least 30 seconds after it has launched. Otherwise Windows will assume the service failed to start up. So the simplest main() function for a service will look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;int main(int argc, char **argv) {
  SERVICE_TABLE_ENTRY serviceTable[2];
  serviceTable[0].lpServiceName = &quot;ServiceTest&quot;;
  serviceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION) ServiceMain;

  serviceTable[1].lpServiceName = NULL;
  serviceTable[1].lpServiceProc = NULL;
  StartServiceCtrlDispatcher(serviceTable);  
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686324(v=vs.85).aspx&quot; target=&quot;_blank&quot;&gt;StartServiceCrtlDispatcher()&lt;/a&gt;&lt;/span&gt; takes an array of &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686001(v=vs.85).aspx&quot; target=&quot;_blank&quot;&gt;SERVICE_TABLE_ENTRY&lt;/a&gt;s. Each defines the name and callback function of one service it should start. The callback function is run in its own thread and &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686324(v=vs.85).aspx&quot; target=&quot;_blank&quot;&gt;StartServiceCrtlDispatcher()&lt;/a&gt;&lt;/span&gt; will only return after all services it has started have been stopped.&lt;br /&gt;
&lt;br /&gt;
As the name indicates, the callback function of the service is the real main function of the service. Here the service should do whatever it is supposed to do. In order to by managed by the Services interface of Windows the service has to implement a callback to a control handler with the &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms685054(v=vs.85).aspx&quot; target=&quot;_blank&quot;&gt;RegisterServiceCrtlHandler()&lt;/a&gt;&lt;/span&gt; function. The callback is invoked every time the service should change its state (Stop for example).&lt;br /&gt;
&lt;br /&gt;
The service should use the &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686241(v=vs.85).aspx&quot; target=&quot;_blank&quot;&gt;SetServiceStatus()&lt;/a&gt;&lt;/span&gt; function to report its current status to the system. The following code can be used as a skeleton for your own service.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;SERVICE_STATUS ServiceStatus; 
SERVICE_STATUS_HANDLE hServiceStatus; 

// Control handler function callback
void ControlHandler(DWORD request) 
{ 
  switch(request) { 
    case SERVICE_CONTROL_STOP: 
      // Service has been stopped
      ServiceStatus.dwWin32ExitCode = 0; 
      ServiceStatus.dwCurrentState  = SERVICE_STOPPED; 
      SetServiceStatus (hServiceStatus, &amp;amp;ServiceStatus);
      return; 
 
    case SERVICE_CONTROL_SHUTDOWN: 
      ServiceStatus.dwWin32ExitCode = 0; 
      ServiceStatus.dwCurrentState  = SERVICE_STOPPED; 
      SetServiceStatus (hServiceStatus, &amp;amp;ServiceStatus);
      return; 
        
    default:
      break;
  } 
 
  // Report current status
  SetServiceStatus (ServiceStatusHandle,  &amp;amp;ServiceStatus);
} 

// Service main function callback
void ServiceMain(int argc, char **argv) {
  int count = 0;
  int result;
 
  ServiceStatus.dwServiceType = SERVICE_WIN32; 
  ServiceStatus.dwCurrentState = SERVICE_START_PENDING; 
  ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | 
                                       SERVICE_ACCEPT_SHUTDOWN;
  ServiceStatus.dwWin32ExitCode = 0; 
  ServiceStatus.dwServiceSpecificExitCode = 0; 
  ServiceStatus.dwCheckPoint = 0; 
  ServiceStatus.dwWaitHint = 0; 

  hServiceStatus= RegisterServiceCtrlHandler(
                    &quot;ServiceTest&quot;, 
                    (LPHANDLER_FUNCTION) ControlHandler); 
  if (hServiceStatus == (SERVICE_STATUS_HANDLE) 0) { 
    // Registering Control Handler failed
    return; 
  }  

  ServiceStatus.dwCurrentState = SERVICE_RUNNING; 
  SetServiceStatus (hServiceStatus, &amp;amp;ServiceStatus);

  while (ServiceStatus.dwCurrentState == SERVICE_RUNNING) {
    // Do you important service stuff here
    Sleep(5000);
  }
}
&lt;/pre&gt;
&lt;br /&gt;
This service will run as long as its state is &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms685996(v=vs.85).aspx&quot; target=&quot;_blank&quot;&gt;SERVICE_RUNNING&lt;/a&gt;&lt;/span&gt;. Once the state changes the &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ServiceMain &lt;/span&gt;function will return and the service will terminate.&lt;br /&gt;
&lt;br /&gt;
Visit these links for more examples and explanations:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/desktop/ms687416(v=vs.85).aspx&quot; style=&quot;background-color: white;&quot; target=&quot;_blank&quot;&gt;Writing a Service Program&#39;s main Function&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.devx.com/cplus/Article/9857/0/&quot; style=&quot;background-color: white;&quot; target=&quot;_blank&quot;&gt;Five Steps to Writing Windows Services in C&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/2829130938324242498/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/07/c-create-windows-service.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/2829130938324242498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/2829130938324242498'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/07/c-create-windows-service.html' title='C++: Create a Windows service'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-7503042117137298052</id><published>2012-04-26T18:00:00.000+02:00</published><updated>2012-04-26T18:00:03.285+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Find"/><category scheme="http://www.blogger.com/atom/ns#" term="Lines of code"/><category scheme="http://www.blogger.com/atom/ns#" term="WC"/><title type='text'>Shell: Determine lines of code</title><content type='html'>Use this command to determine the number of lines of code you have written for your C++ project.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;find ../src -name &quot;*.cpp&quot; -or -name &quot;*.h&quot; | xargs wc -l
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/7503042117137298052/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/04/shell-determine-lines-of-code.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/7503042117137298052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/7503042117137298052'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/04/shell-determine-lines-of-code.html' title='Shell: Determine lines of code'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-1371228715897771843</id><published>2012-03-14T15:42:00.000+01:00</published><updated>2012-04-26T11:39:50.207+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command line"/><category scheme="http://www.blogger.com/atom/ns#" term="Shutdown"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Windows: Shutdown via command line</title><content type='html'>You can shutdown a computer running Windows using the command line. Use the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;shutdown&lt;/span&gt; command to force a shutdown, reboot or hibernate.&lt;br /&gt;
&lt;br /&gt;
Shutdown computer&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;shutdown /s&lt;/pre&gt;&lt;br /&gt;
Restart computer&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;shutdown /r&lt;/pre&gt;&lt;br /&gt;
Hibernate computer&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;shutdown /h&lt;/pre&gt;&lt;br /&gt;
The shutdown command is available since Windows XP. On older versions of Windows use this command:&lt;br /&gt;
&lt;br /&gt;
Restarting the computer&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;RUNDLL.EXE user.exe,exitwindowsexec&lt;/pre&gt;&lt;br /&gt;
Shut down the computer&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;RUNDLL32.EXE user,exitwindows&lt;/pre&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/1371228715897771843/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/03/windows-shutdown-via-command-line.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1371228715897771843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1371228715897771843'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/03/windows-shutdown-via-command-line.html' title='Windows: Shutdown via command line'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-3994535063582209343</id><published>2012-03-02T11:14:00.000+01:00</published><updated>2012-03-14T15:56:41.817+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="LWJGL"/><category scheme="http://www.blogger.com/atom/ns#" term="Properties"/><title type='text'>Java: Creating an undecorated window with LWJGL</title><content type='html'>This system property removes the window decorations (title bar, icons, border) from &lt;a href=&quot;http://lwjgl.org/&quot; target=&quot;_blank&quot;&gt;LWJGL&lt;/a&gt; applications in window mode.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;org.lwjgl.opengl.Window.undecorated=&amp;lt;true|false&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;
You can specify the property on the command line, when you start the application&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-bsh&quot;&gt;java -Dorg.lwjgl.opengl.Window.undecorated=true -jar application.jar
&lt;/pre&gt;&lt;br /&gt;
or in your code by setting it manually.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;System.setProperty(&quot; org.lwjgl.opengl.Window.undecorated&quot;, &quot;true&quot;);
&lt;/pre&gt;&lt;br /&gt;
See the &lt;a href=&quot;http://lwjgl.org/wiki/index.php?title=LWJGL_Hidden_Switches&quot; target=&quot;_blank&quot;&gt;LWJGL wiki&lt;/a&gt; for more hidden property switches.</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/3994535063582209343/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/03/java-creating-undecorated-window-with.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/3994535063582209343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/3994535063582209343'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/03/java-creating-undecorated-window-with.html' title='Java: Creating an undecorated window with LWJGL'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-4804835285062673579</id><published>2012-02-23T19:00:00.000+01:00</published><updated>2012-03-14T15:56:08.299+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><category scheme="http://www.blogger.com/atom/ns#" term="tokenize"/><title type='text'>C++: string tokenzier</title><content type='html'>This function splits a string into substrings. It uses a list of delimiter characters to find the boundaries of the substrings.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;void tokenize(const std::string &amp;amp;str, 
              std::vector&amp;lt;std::string&amp;gt; &amp;amp;tokens, 
              const std::string &amp;amp;delimiters = &quot; &quot;) {
  string::size_type lastPos = str.find_first_not_of(delimiters, 0);
  string::size_type pos = str.find_first_of(delimiters, lastPos);

  while (std::string::npos != pos || std::string::npos != lastPos) {
    tokens.push_back(str.substr(lastPos, pos - lastPos));
    lastPos = str.find_first_not_of(delimiters, pos);
    pos = str.find_first_of(delimiters, lastPos);
  }
}
&lt;/pre&gt;&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;vector&amp;lt;std::string&amp;gt; tokens;
tokenize(&quot;I want to tokenize this!&quot;, tokens);

tokenize(&quot;2012-02-20&quot;, tokens, &quot;-&quot;);
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/4804835285062673579/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/c-string-tokenzier.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/4804835285062673579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/4804835285062673579'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/c-string-tokenzier.html' title='C++: string tokenzier'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-5130737592694563511</id><published>2012-02-22T10:18:00.000+01:00</published><updated>2012-02-22T10:18:03.301+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Total Commander"/><category scheme="http://www.blogger.com/atom/ns#" term="WebDAV"/><title type='text'>Tools: Installing WebDAV support in TotalCommander 64 bit</title><content type='html'>After I &lt;a href=&quot;http://codebrocken.blogspot.com/2012/02/total-commander-and-tortoisesvn.html&quot;&gt;switched to the 64 bit beta version of Total Commander&lt;/a&gt;, I noticed that I could no longer connect to my WebDAV server. The problem was the WebDAV plugin for &lt;a href=&quot;http://www.ghisler.com/index.htm&quot; target=&quot;_blank&quot;&gt;Total Commander&lt;/a&gt;. It was a 32 bit version and could not be loaded into the 64 bit Commander.&lt;br /&gt;
The &lt;a href=&quot;http://www.ghisler.com/plugins.htm&quot; target=&quot;_blank&quot;&gt;plugins page&lt;/a&gt; still has the 32 bit plugin for download. I think this is ok, because the 64 bit version of Total Commander is still in beta. A 64 bit plugin has already been written. You have to go to the &lt;a href=&quot;http://www.ghisler.ch/board/index.php&quot; target=&quot;_blank&quot;&gt;forums&lt;/a&gt; and &lt;a href=&quot;http://www.ghisler.ch/board/viewtopic.php?t=3857&amp;amp;postdays=0&amp;amp;postorder=asc&amp;amp;highlight=webdav&amp;amp;start=105&quot; target=&quot;_blank&quot;&gt;dig around&lt;/a&gt; a little bit to find the link.&lt;br /&gt;
After installling the beta plugin everything worked fine again.&lt;br /&gt;
&lt;br /&gt;
Download &lt;a href=&quot;http://ghisler.fileburst.com/beta/webdav_23b2.zip&quot; target=&quot;_blank&quot;&gt;WebDAV 64 bit plugin for Total Commander&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/5130737592694563511/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/tools-installing-webdav-support-in.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5130737592694563511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5130737592694563511'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/tools-installing-webdav-support-in.html' title='Tools: Installing WebDAV support in TotalCommander 64 bit'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-4701990159068981910</id><published>2012-02-12T01:00:00.000+01:00</published><updated>2012-02-12T01:00:00.853+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="LWJGL"/><category scheme="http://www.blogger.com/atom/ns#" term="Slick"/><title type='text'>Java Slick game development - 64 bit problems</title><content type='html'>When setting up my project and writing the simple basic application &lt;a href=&quot;http://slick.cokeandcode.com/index.php&quot;&gt;Slick&lt;/a&gt; crashed on me with an error:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;java.lang.UnsatisfiedLinkError: Drones\lib\lwjgl.dll: Can&#39;t load IA 32-bit .dll on a AMD 64-bit platform&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I&#39;m running Windows 7 on a 64 bit system and I have the 64 bit Java VM installed. You will not see this error if you are running the 32 bit version of Java on your 64 bit system.&lt;br /&gt;
&lt;br /&gt;
To solve this problem I had to download the current version of &lt;a href=&quot;http://lwjgl.org/&quot; target=&quot;_blank&quot;&gt;LWJGL&lt;/a&gt; from their site and copy the windows DLLs and the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;lwjgl.jar&lt;/span&gt; that is included in the download into my project lib directory. This will replace the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;lwjgl.jar&lt;/span&gt; that came with the Slick distribution.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC-uGKkmJCOax8bL-5VmwO04UlTWZWnb7CIRGNyisF9AoJwRFwTj_tx6zXFpLPaY-pAqOjkJor41R9zJpQb0NK7ynq5NPTP1OPHFYo7pE74h9Pi1XmBKXa-9YYZTNiTibgof3yN7kxzXk/s1600/Drones-Structure2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC-uGKkmJCOax8bL-5VmwO04UlTWZWnb7CIRGNyisF9AoJwRFwTj_tx6zXFpLPaY-pAqOjkJor41R9zJpQb0NK7ynq5NPTP1OPHFYo7pE74h9Pi1XmBKXa-9YYZTNiTibgof3yN7kxzXk/s1600/Drones-Structure2.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
So now my project looks like this in the project explorer:</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/4701990159068981910/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/java-slick-game-development-64-bit.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/4701990159068981910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/4701990159068981910'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/java-slick-game-development-64-bit.html' title='Java Slick game development - 64 bit problems'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC-uGKkmJCOax8bL-5VmwO04UlTWZWnb7CIRGNyisF9AoJwRFwTj_tx6zXFpLPaY-pAqOjkJor41R9zJpQb0NK7ynq5NPTP1OPHFYo7pE74h9Pi1XmBKXa-9YYZTNiTibgof3yN7kxzXk/s72-c/Drones-Structure2.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-5043002824468225727</id><published>2012-02-11T12:00:00.000+01:00</published><updated>2012-03-14T15:55:38.120+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="LWJGL"/><category scheme="http://www.blogger.com/atom/ns#" term="Slick"/><title type='text'>Java: Slick game development - Part #2 The first program</title><content type='html'>After &lt;a href=&quot;http://codebrocken.blogspot.com/2012/02/java-developing-with-slick-and-eclipse.html&quot;&gt;setting up the project&lt;/a&gt; in my last post, we now create a very simple sample application that we will extent in the future.&lt;br /&gt;
&lt;br /&gt;
The following code creates a new Slick game. It is not much yet - just a black window. But this window is already an OpenGL frame.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;package codebrocken.drones;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;

public class Drones extends BasicGame {

 public Drones(String title) {
  super(title);
 }

 @Override
 public void render(GameContainer arg0, Graphics arg1) throws SlickException {
  // TODO Auto-generated method stub

 }

 @Override
 public void init(GameContainer arg0) throws SlickException {
  // TODO Auto-generated method stub

 }

 @Override
 public void update(GameContainer arg0, int arg1) throws SlickException {
  // TODO Auto-generated method stub

 }

 public static void main(String[] args) {
  try {
   AppGameContainer appContainer = new AppGameContainer(new Drones(&quot;Drones&quot;));
   appContainer.start();
  } catch (SlickException e) {
   e.printStackTrace();
  }
 }
}
&lt;/pre&gt;&lt;br /&gt;
The class itself is derived from BasicGame, which does a lot of work for us. We just have to implement a few methods that will do our actual work later. The main method creates a new AppGameContainer and initializes it with our game.</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/5043002824468225727/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/java-slick-game-development-part-2.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5043002824468225727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5043002824468225727'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/java-slick-game-development-part-2.html' title='Java: Slick game development - Part #2 The first program'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-1391458182709028212</id><published>2012-02-10T23:00:00.000+01:00</published><updated>2012-02-11T01:33:52.483+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="LWJGL"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenGL"/><category scheme="http://www.blogger.com/atom/ns#" term="Slick"/><title type='text'>Java: Slick game development - Part #1 Setting up Eclipse</title><content type='html'>&lt;a href=&quot;http://slick.cokeandcode.com/index.php&quot; target=&quot;_blank&quot;&gt;Slick&lt;/a&gt; is a 2D game library for Java. It uses OpenGL for rendering. It also contains a lot of utility functions. I want to do a little bit of game programming so instead of writing my own engine (as I would do normally), this time I&#39;m testing Slick.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Step #1: Download Slick libraries&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;You can get the Slick libraries &lt;a href=&quot;http://slick.cokeandcode.com/downloads/slick.zip&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. Just download the complete package. It includes the &lt;a href=&quot;http://lwjgl.org/&quot; target=&quot;_blank&quot;&gt;LWJGL&lt;/a&gt; libraries that provide the OpenGL layer.&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Step #2: Create a new Eclipse project&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Create a new Java project in Eclipse and amed it Drones.Nothing fancy at this point.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Step #3: Import the libraries&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;I created a new &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;lib&lt;/span&gt; folder, that will contain all my libraries. I copied the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;slick.jar&lt;/span&gt; and &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;lwjgl.jar&lt;/span&gt; from the Slick archive into that folder. To add them to the build you have to open the properties of the project and select &quot;Build Path&quot;. Then click &quot;Add JARs...&quot; and select the two JAR archives from the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;lib&lt;/span&gt; folder.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Step #4: Import the native libraries&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;The LWJGL library needs a native runtime library. On windows systems this is the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;lwjgl.dll&lt;/span&gt; you can find in the root folder of the Slick archive. I copied the DLL into the lib folder too. You can choose a &quot;native&quot; subfolder as you like.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;You now have to open the &quot;Referenced Libraries&quot; branch in the package explorer and right click the lwjgl.jar to open its properties. In the properties dialog select &quot;Native Library&quot;. Here you can select the &quot;Location path&quot; where Eclipse will look for native libraries, when it starts the application. Just select our &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;lib&lt;/span&gt; directory here.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Under the hood this step sets the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;java.library.path&lt;/span&gt; property to point to the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;lib&lt;/span&gt; directory. This property defines where Java searches for native libraries.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT6S0Vj7xxYvDAFKChCkLFgpR6n1QTD1JMiM6OhvL74pbuNDFkg01SlOhndXRPo7LPehP9SYhpMJ05tuHNpO4RNvff52FPBPTOx6g7MQ_DXYjmDQccIw_2pTZCDfijG5K09l2cJOeNl18/s1600/Drones-Structure.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT6S0Vj7xxYvDAFKChCkLFgpR6n1QTD1JMiM6OhvL74pbuNDFkg01SlOhndXRPo7LPehP9SYhpMJ05tuHNpO4RNvff52FPBPTOx6g7MQ_DXYjmDQccIw_2pTZCDfijG5K09l2cJOeNl18/s1600/Drones-Structure.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Now you are done with setting up Eclipse. You should have a structure that looks something like this:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/1391458182709028212/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/java-developing-with-slick-and-eclipse.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1391458182709028212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/1391458182709028212'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/java-developing-with-slick-and-eclipse.html' title='Java: Slick game development - Part #1 Setting up Eclipse'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT6S0Vj7xxYvDAFKChCkLFgpR6n1QTD1JMiM6OhvL74pbuNDFkg01SlOhndXRPo7LPehP9SYhpMJ05tuHNpO4RNvff52FPBPTOx6g7MQ_DXYjmDQccIw_2pTZCDfijG5K09l2cJOeNl18/s72-c/Drones-Structure.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-495437995357905475</id><published>2012-02-03T17:53:00.000+01:00</published><updated>2012-02-04T23:17:39.802+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="TortoiseSVN"/><category scheme="http://www.blogger.com/atom/ns#" term="Total Commander"/><title type='text'>Tools: Total Commander and TortoiseSVN</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://www.ghisler.com/images/top.logo.gif&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;83&quot; src=&quot;http://www.ghisler.com/images/top.logo.gif&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
I&#39;m a &lt;a href=&quot;http://www.ghisler.com/index.htm&quot; target=&quot;_blank&quot;&gt;Total Commander&lt;/a&gt; fanatic. It is the program, that always run when I&#39;m working on my computer. Even when I&#39;m not working. But recently I had a problem with &lt;a href=&quot;http://tortoisesvn.net/&quot; target=&quot;_blank&quot;&gt;TortoiseSVN&lt;/a&gt; and Total Commander. When you open a SVN folder in Windows Explorer Tortoise will overlay the icon according to the modification state of the contents. This way you can see if there are some modification in your folder and you need to commit them. But Total Commander would not show those icons and the context menu would not contain the SVN commands.&lt;br /&gt;
&lt;br /&gt;
This problem is caused by my new machine being a 64 bit system. As this article details the 32 bit version of Total Commander cannot access the functions of the 64 bit TortoiseSVN. There are two possible solutions:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Install both 32 and 64 bit versions of Tortoise. That should work, but I find that very ugly.&lt;/li&gt;
&lt;li&gt;Install the &lt;a href=&quot;http://www.ghisler.com/800_b17a.php&quot; target=&quot;_blank&quot;&gt;new 64 bit beta version&lt;/a&gt; of Total Commander. Yes it is beta, but it works.&lt;/li&gt;
&lt;/ul&gt;
I did the second options and am now very happy with a state of the art Total Commander and SVN support. Windows Explorer can again Rest In Peace on my computer!</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/495437995357905475/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/total-commander-and-tortoisesvn.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/495437995357905475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/495437995357905475'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/total-commander-and-tortoisesvn.html' title='Tools: Total Commander and TortoiseSVN'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-9199859226939225254</id><published>2012-02-02T15:42:00.000+01:00</published><updated>2012-08-22T16:44:12.149+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><category scheme="http://www.blogger.com/atom/ns#" term="trim"/><title type='text'>C++: String trim function</title><content type='html'>This function removes leading and trailing characters from a string. The default character is a space, but you can use any combination of characters, that should be trimmed.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;std::string trim(std::string &amp;amp;str, const std::string &amp;amp;trimChars = &quot; &quot;)
{
  std::string result = str.erase(str.find_last_not_of(trimChars) + 1);
  return result.erase(0, result.find_first_not_of(trimChars));
}
&lt;/pre&gt;&lt;br /&gt;
Usage:&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-cpp&quot;&gt;string s = trim(&quot;Hello World! &amp;nbsp; &amp;nbsp;&quot;);
std::cout &amp;lt;&amp;lt; s;
// prints: Hello World!

s = trim(&quot;xxx Hello World! xxx&quot;, &quot;x&quot;);
std::cout &amp;lt;&amp;lt; s;
// prints: Hello World!
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/9199859226939225254/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/c-string-trim-function.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/9199859226939225254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/9199859226939225254'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/c-string-trim-function.html' title='C++: String trim function'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-91426209003683107</id><published>2012-02-01T16:59:00.000+01:00</published><updated>2012-03-14T15:53:27.364+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Enyo"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Mojo"/><category scheme="http://www.blogger.com/atom/ns#" term="webOS"/><title type='text'>webOS: Detecting Enyo on phones</title><content type='html'>With the &lt;a href=&quot;http://www.webosnation.com/bing-maps-update-brings-enyo-support-webos-masses&quot; target=&quot;_blank&quot;&gt;trojan horse maps update&lt;/a&gt; for all webOS devices, every device has the option of running Enyo applications. Which is great, but how can you determine whether the user has updated his phone or not?&lt;br /&gt;
&lt;br /&gt;
Arthur Thornton posted a &lt;a href=&quot;https://developer.palm.com/distribution/viewtopic.php?f=109&amp;amp;t=18757&quot; target=&quot;_blank&quot;&gt;very nice solution&lt;/a&gt; in the webOS developer forums. &lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;In the likely situation that no update to older devices is pushed out including enyo, here is a solution...it isn&#39;t pretty, but it will get the job done.&lt;/blockquote&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;The very first thing you need to do is mention in your app description that your app requires &quot;updated system software&quot; included in the Maps app. This way, the users should know to expect this as a requirement, and even though many users don&#39;t read the description (grr...) you&#39;re still covered by mentioning this.&lt;/blockquote&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;Then use the following code in your app:&lt;/blockquote&gt;&lt;br /&gt;
index.html&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;Code:
&amp;lt;!doctype html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
    &amp;lt;meta name=&quot;viewport&quot; content=&quot;height=device-height&quot; /&amp;gt;
    &amp;lt;script src=&quot;C:\Program Files (x86)\HP webOS\SDK\share\framework\enyo\1.0\framework\enyo.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
      if (typeof enyo == &quot;undefined&quot;)
        window.location = &quot;./requiresEnyo.html&quot;;
      else
        new MyApp().renderInto(document.body);
    &amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
requiresEnyo.html&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;Code:
&amp;lt;!doctype html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Install Maps and Enyo&amp;lt;/title&amp;gt;
    &amp;lt;meta name=&quot;viewport&quot; content=&quot;height=device-height&quot; /&amp;gt;
    &amp;lt;script src=&quot;/usr/palm/frameworks/mojo/mojo.js&quot; type=&quot;text/javascript&quot; x-mojo-version=&quot;1&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div style=&quot;padding: 5px&quot;&amp;gt;
      Attention: This application requires an updated version of the system software which is not available on your phone. To install this updated software, you must install the updated Maps app by tapping the below button (will open the App Catalog):
    &amp;lt;/div&amp;gt;
    &amp;lt;div class=&quot;palm-button&quot; onclick=&quot;installEnyo()&quot;&amp;gt;Install&amp;lt;/div&amp;gt;
    &amp;lt;script&amp;gt;
      window.onload = function() {
        PalmSystem.stageReady(); // required for page to load
      };
      function installEnyo() {
        window.location = &quot;http://developer.palm.com/appredirect/?packageid=com.palm.app.maps&quot;;
      }
    &amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;Note that this loads Mojo (which will obviously be on the device) in a separate HTML file *if* enyo isn&#39;t already on the device (i.e. a Pre2). This was tested to work on my Pre2.&lt;/blockquote&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;Also note that to put enyo in your app, your users must be using webOS 1.4.5 or newer because the maps app has a minimum webOS version of 1.4.5 (and thus, users prior to 1.4.5 won&#39;t see it in the Catalog and won&#39;t be able to update) due to (I&#39;m assuming) using the version 2.0 packaging format.&lt;/blockquote&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;If you have your app currently deployed to users running webOS versions prior to 1.4.5, you will have to retain a Mojo version in it (because the app can still be updated even if you change minimum OS version to 1.4.5 unless changes have recently gone into effect to fix that; this doesn&#39;t cause issues for the Maps app because technically, that app is not update-capable on devices prior to the Pre3 without the workaround they came up with).&lt;/blockquote&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;Arthur Thornton&lt;br /&gt;
webOS Application Engineer&lt;br /&gt;
Appstuh&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/91426209003683107/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/02/detecting-enyo-of-phones.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/91426209003683107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/91426209003683107'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/02/detecting-enyo-of-phones.html' title='webOS: Detecting Enyo on phones'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-5858698859868066635</id><published>2012-01-31T10:40:00.000+01:00</published><updated>2012-02-03T18:24:55.968+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Enyo"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="webOS"/><title type='text'>webOS: Kind inheritance tree for Enyo 1.0</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://zawakei.web.fc2.com/testcode/enyo/kind_inherit_tree/enyo-kind-inherit-tree-3.0.0.643.pdf&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG_mVv_t0YRhMSj6ycAaFKO2qp3ItVIXGtjyliBNK_nbAbV0p5BOvQ6LjcgCp4UAzbgV8j5vwkHTsqBKXnpuNI8PlsmU6-KccyvqRjRW9j8V7cF9Mboe4G-7KUtocORjaEK2LrWxElU1Y/s320/enyo-kind-inheritance.png&quot; width=&quot;226&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
With &lt;a href=&quot;http://enyojs.com/&quot; target=&quot;_blank&quot;&gt;Enyo 2.0&lt;/a&gt; available this information might not be as useful as it was before. &lt;a href=&quot;http://zawakei.web.fc2.com/testcode/enyo/kind_inherit_tree/enyo-kind-inherit-tree-3.0.0.643.pdf&quot; target=&quot;_blank&quot;&gt;Here&lt;/a&gt; you can find a PDF document with a tree inheritance model of all Enyo kinds. I always like a visual representation and you can find a new kind you haven&#39;t used before.</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/5858698859868066635/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/01/kind-inheritance-tree-for-enyo-10.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5858698859868066635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/5858698859868066635'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/01/kind-inheritance-tree-for-enyo-10.html' title='webOS: Kind inheritance tree for Enyo 1.0'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG_mVv_t0YRhMSj6ycAaFKO2qp3ItVIXGtjyliBNK_nbAbV0p5BOvQ6LjcgCp4UAzbgV8j5vwkHTsqBKXnpuNI8PlsmU6-KccyvqRjRW9j8V7cF9Mboe4G-7KUtocORjaEK2LrWxElU1Y/s72-c/enyo-kind-inheritance.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4997825642897855521.post-6736858236999979222</id><published>2012-01-30T13:09:00.000+01:00</published><updated>2012-03-14T15:52:51.137+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cujo.js"/><category scheme="http://www.blogger.com/atom/ns#" term="Enyo"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Promise"/><category scheme="http://www.blogger.com/atom/ns#" term="webOS"/><category scheme="http://www.blogger.com/atom/ns#" term="Webservice"/><category scheme="http://www.blogger.com/atom/ns#" term="when.js"/><title type='text'>webOS: Implementing promises with Enyo components</title><content type='html'>I recently needed to make a few web service calls from within my &lt;a href=&quot;http://enyojs.com/&quot; target=&quot;_blank&quot;&gt;Enyo&lt;/a&gt; application. I wanted to use the &lt;a href=&quot;http://cujojs.com/&quot; target=&quot;_blank&quot;&gt;cujojs.com&lt;/a&gt; &lt;a href=&quot;http://when.js/&quot; target=&quot;_blank&quot;&gt;when.js&lt;/a&gt; library for synchronization with promises. Promises in itself are a very intriguing concept and I will write another blog post about them in the future.&lt;br /&gt;
&lt;br /&gt;
In essence a promise works this way:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-javascript&quot;&gt;webservice.login(username, password).then(
  function loginSuccess(response) {
    enyo.log(&quot;Login successful&quot;);
  }, function loginFailed(response) {
    enyo.log(&quot;Login failed.&quot;);
  }); 
&lt;/pre&gt;&lt;br /&gt;
The login function of the web service sends out an request asynchronously and returns immediately. The usual way to handle this kind of behavior is to pass a set of callback functions to the login method, that are called when the service is successful or had failed. Promises allow for more compact code. See this &lt;a href=&quot;http://blogs.msdn.com/b/rbuckton/archive/2010/01/29/promises-and-futures-in-javascript.aspx&quot; target=&quot;_blank&quot;&gt;article&lt;/a&gt; for a good explanation.&lt;br /&gt;
&lt;br /&gt;
To make a web service call in Enyo you normally use an &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;enyo.WebService&lt;/span&gt; component like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-javascript&quot;&gt;enyo.kind({
  name : &quot;LoginComponent&quot;,
  kind : enyo.Component,
  components : [ {
    kind : &quot;WebService&quot;,
    name : &quot;loginWebService&quot;,
    url : &quot;https://&amp;lt;your service URL here&amp;gt;&quot;,
    method : &quot;post&quot;,
    onSuccess : &quot;loginSuccess&quot;,
    onFailure : &quot;loginFailure&quot;
  } ],

  loginSuccess : function(inSender, inResponse, inRequest) {
    enyo.log(&quot;Login successful.&quot;);
  },

  loginFailure : function(inSender, inResponse, inRequest) {
    enyo.log(&quot;Login failed.&quot;);
  }
});
&lt;/pre&gt;&lt;br /&gt;
The WebService kind has to event methods &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;onSuccess&lt;/span&gt; and &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;onFailure&lt;/span&gt;. But in the definition of the kind, those two events take only strings. When the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;doSuccess&lt;/span&gt; or &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;doFailure&lt;/span&gt; methods are called the intelligence of the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;enyo.Object&lt;/span&gt; handle the translation from the string to the actual method call.&lt;br /&gt;
&lt;br /&gt;
To implement the promise concept with the WebService kind, we have to create our own kind.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-javascript&quot;&gt;enyo.kind({
  name : &quot;LoginWebservice&quot;,
  kind : enyo.Component,
  
  deferred : undefined,
  
  components : [ {
    kind : &quot;WebService&quot;,
    name : &quot;loginWebService&quot;,
    url : &quot;https://&amp;lt;your service URL here&amp;gt;&quot;,
    method : &quot;post&quot;,
    onSuccess : &quot;loginSuccess&quot;,
    onFailure : &quot;loginFailure&quot;
  } ],

  login : function(inUsername, inPassword) {
    this.deferred = when.defer();
    var params = {
      Username : inUsername,
      Password : inPassword
    };
    this.$.loginWebService.call(params);
    return this.deferred.promise;
  },

  loginSuccess : function(inSender, inResponse, inRequest) {
    this.deferred.resolve(inResponse);
  },

  loginFailure : function(inSender, inResponse, inRequest) {
    this.deferred.reject(inResponse);
  }
});
&lt;/pre&gt;&lt;br /&gt;
The component creates a &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;deferred&lt;/span&gt; object and resolves/rejects it based upon the result of the web service call. Use the following code to integrate the kind in your own software:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-javascript&quot;&gt;enyo.kind({
  name : &quot;LoginWebServiceTest&quot;,
  kind : &quot;Component&quot;,
  components : [ {
    kind : &quot;LoginWebservice&quot;,
    name: &quot;wsLogin&quot;
  }, {
    kind : &quot;Button&quot;, 
    onclick: &quot;loginTest&quot;
  } ],

  loginTest : function(inSender) {
    this.$.wsLogin.login(&quot;Username&quot;, &quot;MySecretPassword&quot;).then(
      function loginSuccess(response) {
        enyo.log(&quot;Login successful&quot;);
      }, function loginFailed(response) {
        enyo.log(&quot;Login failed.&quot;);
      }
    ); 
  }
});
&lt;/pre&gt;&lt;br /&gt;
x</content><link rel='replies' type='application/atom+xml' href='http://codebrocken.blogspot.com/feeds/6736858236999979222/comments/default' title='Kommentare zum Post'/><link rel='replies' type='text/html' href='http://codebrocken.blogspot.com/2012/01/implementing-promises-with-enyo.html#comment-form' title='0 Kommentare'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/6736858236999979222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4997825642897855521/posts/default/6736858236999979222'/><link rel='alternate' type='text/html' href='http://codebrocken.blogspot.com/2012/01/implementing-promises-with-enyo.html' title='webOS: Implementing promises with Enyo components'/><author><name>FlxFnk</name><uri>http://www.blogger.com/profile/00457583773722344849</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ2_UgGuWr1BZ88JVsCj1ao92eb_K4JPV_fgH5OS_4dBXVXSUmg35FCCuO8P10R99a_NBBKRh9YGvYWAAR5LRo7ljPdfo8Taz-73003FijeMqZIMjbJERrOrAT2GMB8g/s220/Comic.png'/></author><thr:total>0</thr:total></entry></feed>