<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>techbits.de &#187; development</title>
	<atom:link href="http://www.techbits.de/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techbits.de</link>
	<description>thoughts on hardware, software, development and tech news</description>
	<lastBuildDate>Fri, 02 Dec 2011 22:51:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using the tag editor component in Alfresco 4.0</title>
		<link>http://www.techbits.de/2011/11/05/using-the-tag-editor-component-in-alfresco-4-0/</link>
		<comments>http://www.techbits.de/2011/11/05/using-the-tag-editor-component-in-alfresco-4-0/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 11:42:03 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[alfresco]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[alfresco4]]></category>

		<guid isPermaLink="false">http://www.techbits.de/?p=349</guid>
		<description><![CDATA[This is just a short post to note down what I found out about the Insitu tag editor component from Alfresco 4.0 and how to use it in your own code. I have not actually used it yet, so the &#8230; <a href="http://www.techbits.de/2011/11/05/using-the-tag-editor-component-in-alfresco-4-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is just a short post to note down what I found out about the Insitu tag editor component from Alfresco 4.0 and how to use it in your own code. I have not actually used it yet, so the code below is not complete nor working. It is just meant as a reference (for me).<span id="more-349"></span></p>
<p>You need to include the documentlibary.css the editors CSS:</p>
<pre>&lt;@link rel="stylesheet" type="text/css" href="${page.url.context}/res/components/documentlibrary/documentlist.css " /&gt;</pre>
<p>Then you need a DIV to create the editor:</p>
<pre>&lt;div id="${el}-tageditor"&gt;&lt;/div&gt;</pre>
<p>You can create a Insitu-Editor for tags from Javascript like this:</p>
<pre>var tageditor = Alfresco.util.createInsituEditor(this.id + "-tageditor",
{
	type: "tagEditor",
	nodeRef : "workspace://SpacesStore/79cced9b-947b-4833-bf03-5fb4660449d9",  <strong>// use nodeRef here</strong>
	name: "prop_cm_taggable",
	value: "", <strong>// here go the tags of the current node</strong>
	validations: [{
		type: Alfresco.forms.validation.nodeName,
		when: "keyup",
		message: this.msg("validation-hint.nodeName")
	}],
	title: this.msg("tip.insitu-tag"),
	errorMessage: this.msg("message.insitu-edit.tag.failure")
},
{
	 fn: this._insituCallback, <strong> // your callback</strong>
	 scope: this,
	 obj: record <strong>// your object</strong>
});</pre>
<p>To display the editor you call:</p>
<pre>tageditor.doShow();</pre>
<p>This displays the following tag editor you know from the document library:</p>
<p><a href="http://www.techbits.de/2011/11/05/using-the-tag-editor-component-in-alfresco-4-0/insitu-tag-editor/" rel="attachment wp-att-350"><img class="aligncenter size-full wp-image-350" title="insitu-tag-editor" src="http://www.techbits.de/wp-content/uploads/2011/11/insitu-tag-editor.png" alt="" width="430" height="58" /></a>What it does:</p>
<ul>
<li>Provide a textbox, a save and a cancel button (as text)</li>
<li>Suggest and auto complete tags as you enter them</li>
<li>Create new tags in the repository on save</li>
<li>Save the tags for the node (using the nodeRef you specified)</li>
<li>Call your code after the update in the repo</li>
</ul>
<p>What it does <strong>not</strong> do:</p>
<ul>
<li>It does not read the current tags. You have to pass them in using the value parameter.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2011/11/05/using-the-tag-editor-component-in-alfresco-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a like button to your Alfresco extensions</title>
		<link>http://www.techbits.de/2011/10/14/adding-a-like-button-to-your-alfresco-extensions/</link>
		<comments>http://www.techbits.de/2011/10/14/adding-a-like-button-to-your-alfresco-extensions/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 09:30:05 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[alfresco]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[alfresco4]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[social]]></category>
		<category><![CDATA[webscript]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.techbits.de/?p=267</guid>
		<description><![CDATA[Alfresco 4.0 introduces social features into the Share client &#8211; the most prominent being the Like button. I&#8217;d like to give you a short tutorial on how to add the new Like button to your own Alfresco 4.0 Share extensions. &#8230; <a href="http://www.techbits.de/2011/10/14/adding-a-like-button-to-your-alfresco-extensions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Alfresco 4.0 introduces social features into the Share client &#8211; the most prominent being the Like button. I&#8217;d like to give you a short tutorial on how to add the new Like button to your own Alfresco 4.0 Share extensions.<a href="http://www.techbits.de/2011/10/14/adding-a-like-button-to-your-alfresco-extensions/like1/" rel="attachment wp-att-278"><img class="aligncenter size-full wp-image-278" title="Like Button in Alfresco 4.0 Share" src="http://www.techbits.de/wp-content/uploads/2011/10/like1.png" alt="" width="454" height="62" /></a></p>
<p><span id="more-267"></span></p>
<h1>Webscripts Backend</h1>
<p>Let&#8217;s start with the backend. I am assuming you already have a repository webscript set up that is returning a list of nodes or a single node to the Share client as JSON objects. Now you&#8217;d like to add a like button to your client for each document.</p>
<p>In the repository javascript tier you have the ratingService at your disposal. The wiki documentation doesn&#8217;t include this service yet, so I did some digging. This is how you would determine if the current user has liked the document and the number of total likes the document has:</p>
<pre>isLiked = ratingService.getRating(node, "likesRatingScheme") !== -1;
totalLikes = ratingService.getRatingsCount(node, "likesRatingScheme");</pre>
<p>To make it even easier you can import a utility function from the document library that does this</p>
<pre>&lt;import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js"&gt;</pre>
<p>and then use the <strong>Common.getLikes()</strong> function to retrieve the information:</p>
<pre>nodes.push({
  "name" : n.name,
  "title" : n.properties["cm:title"],
  "description" : n.properties["cm:description"],
  "nodeRef" : "" + n.nodeRef,
  "likes" : Common.getLikes(n)
});</pre>
<p>With this small change (and possibly a change to the webscript&#8217;s freemarker template) you have a JSON result from your webscript that returns the like information and looks similar to this:<span style="direction: ltr;"> </span></p>
<pre>{
  "name" : "document.txt",
  "title" : "A test document",
  "description" : "",
  "nodeRef : "workspace://SpacesStore/...",
  "likes" : {
    "isLiked": true,
    "totalLikes": 5
  }
}</pre>
<h1>Share frontend</h1>
<p>Now that we have our webscript returning the like information we need to add the like button to the Share frontend code. Here I assume you have some kind of YUI code already in place which we can extend. The share.js (webapps/share/js/share.js) utility script contains a Like Button component that we can easily use.</p>
<p>First we need to add an empty DIV to our components freemarker template.</p>
<pre>&lt;div id="${el}-like"&gt;&lt;/div&gt;</pre>
<p>Then we can add the Like component in the client javascript:</p>
<pre>new Alfresco.Like(this.id + '-like').setOptions({
     siteId: this.options.siteId, 
     nodeRef: item.nodeRef,
     displayName: item.name
}).display(item.likes.isLiked, item.likes.totalLikes);</pre>
<p>This is all you need to display the Like button.</p>
<ul>
<li><span style="direction: ltr;">You only have to set the initial values using the display() function. When the user clicks the Like button the totalLikes value is automatically increased by one.</span></li>
<li><span style="direction: ltr;">This works for documents (for folders you need to set the <strong>type</strong>=&#8221;folder&#8221; option).</span></li>
<li><span style="direction: ltr;">You could leave out the <strong>siteId</strong> if your component is not site specific. It is used to post the like event to the site&#8217;s activity stream.</span></li>
</ul>
<p>The only problem I had with this component is that it does not provide a callback or an event when the like status is updated. It posts the like status the the repository, changes it&#8217;s display state but since it doesn&#8217;t provide feedback you can not update the state of your data model (the item variable) accordingly. This means whenever you redraw or create the Alfresco.Like component you have to make sure you read the most current state of the node from the repository webscript.</p>
<p>All in all adding the like button is pretty painless and I hope you find it as easy to add to your Alfresco extensions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2011/10/14/adding-a-like-button-to-your-alfresco-extensions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Recursive file iteration in Java</title>
		<link>http://www.techbits.de/2010/02/11/recursive-file-iteration-in-java/</link>
		<comments>http://www.techbits.de/2010/02/11/recursive-file-iteration-in-java/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 21:15:48 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[apidesign]]></category>
		<category><![CDATA[bestpractice]]></category>

		<guid isPermaLink="false">http://www.techbits.de/?p=198</guid>
		<description><![CDATA[In a java frameworks talk I gave recently I showed the following example for finding files recursively&#8230; public void listFilesInDirectory(File dir) { File[] files = dir.listFiles(); if (files != null) { for (File f : files) { if (f.isDirectory()) { &#8230; <a href="http://www.techbits.de/2010/02/11/recursive-file-iteration-in-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In a java frameworks talk I gave recently I showed the following example for finding files recursively&#8230;</p>
<blockquote>
<pre>public void listFilesInDirectory(File dir) {
  File[] files = dir.listFiles();
    if (files != null) {
      for (File f : files) {
         if (f.isDirectory()) {
	    listFilesInDirectory(f);
	 }
	 else {
	    System.out.println(f.getName());
	}
     }
  }
}</pre>
</blockquote>
<p>&#8230; which in real projects often grows to a larger block of code. The web is full of code blocks like this for walking a directory tree. The best version I came across is<a id="wylk" title="this object oriented one by Torsten  Curdt" href="http://vafer.org/blog/20071112204524"> this object oriented one by Torsten Curdt</a>. Since you usually don&#8217;t want to write this yourself, I suggested in my talk to use FileUtils which makes recursive iteration much easier:</p>
<blockquote>
<pre>Collection jspFiles = FileUtils.listFiles(rootDirName,
                        new String[] { "jsp" }, true);</pre>
</blockquote>
<p>This looks concise and useful but as I tried to use it, I wasn&#8217;t too pleased with the FileUtils&#8217; solution. Here is why:</p>
<ul>
<li>The recursion is processed in one go, i.e. all results are written to a List even when using the iterateFiles method. The recursion is not processed iteratively.</li>
<li>You can not influence the directories that are searched.</li>
<li>Only files are returned, you can not search for directories.</li>
<li>The API is not very expressive (e.g. what does the &#8220;true&#8221; mean).</li>
<li>No generics (raw collection types are returned).</li>
</ul>
<h1>A Better API</h1>
<p>Not being satisfied with the solutions I found, I &#8220;dreamed up&#8221; my own API for listing and finding files. I don&#8217;t consider it complete but for the most part I am pleased with the ease of use that the builder pattern provides. The code for this can currently be found in an <a id="l6db" title="unrelated goole code project" href="http://code.google.com/p/data-integrity-check/source/browse/#svn/trunk/src/main/java/de/fmaul/common/io">unrelated goole code project</a>. The rest of this article shows the functions that are currently supported.</p>
<h2>Find files two ways</h2>
<p>There are generally two ways to use the result &#8211; as interator or as list:</p>
<p><span style="font-family: Arial;">1. Iterate over all files in the windows directory:</span></p>
<blockquote>
<pre><span style="font-family: Courier New;">for (File f : <strong>Files.find</strong>("c:\\windows")) {</span><br style="font-family: Courier New;" /><br style="font-family: Courier New;" /><span style="font-family: Courier New;">}</span></pre>
</blockquote>
<p>2. Get all the files in a directory as a list of files:</p>
<blockquote>
<pre><span style="font-family: Courier New;">List&lt;File&gt; allFiles = <strong>Files.find</strong>(somedir).<strong>list()</strong>;</span></pre>
</blockquote>
<p><span style="font-family: Verdana;">Except from the return type the second version does the same </span><span style="font-family: Courier New;"><span style="font-family: Verdana;">as the JDK command listFiles:</span></span></p>
<blockquote>
<pre>File[]  allFiles = (new File(somedir)).listFiles()</pre>
</blockquote>
<h2>Easy recursive listing</h2>
<p>To iterate all the files in the C:\Windows directory, you would use:</p>
<blockquote>
<pre><span style="font-family: Courier New;">for (File f : Files.find("c:\\windows").<strong>recursive()</strong>) {</span><br style="font-family: Courier New;" /><br style="font-family: Courier New;" /><span style="font-family: Courier New;">}</span></pre>
</blockquote>
<p>Note: This actually works iteratively, i.e. the recursion happens as you fetch files from the iterator. The result is not fetched into a huge list.</p>
<p>With a Predicate you can limit the recursion to specific directories. In this example all .svn directories within a source tree are skipped:</p>
<blockquote>
<pre><span style="font-family: Courier New;">Predicate&lt;File&gt; noSvnDirs = new Predicate&lt;File&gt;() {</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;"> boolean apply(File file) {</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;"> return !file.getName().equals(".svn");</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;"> }</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">}</span></pre>
<pre><span style="font-family: Courier New;">for (File f : Files.find("src/java/").<strong>recursive(noSvnDir)</strong>) {</span><br style="font-family: Courier New;" /><br style="font-family: Courier New;" /><span style="font-family: Courier New;">}</span></pre>
</blockquote>
<h2>Want Files, Directories or both?</h2>
<p>Define if you want only files, only directories or both in your result with yield*()-Methods.</p>
<blockquote>
<pre>Files.find(someBaseDir).recursive().yieldFiles()  // this is the default
Files.find(someBaseDir).recursive().yieldDirectories()
Files.find(someBaseDir).recursive().yieldFilesAndDirectories()</pre>
</blockquote>
<h2>Filtering the results</h2>
<p>To get all textfiles within a dir use:</p>
<blockquote>
<pre>Files.find(dir).withExtension("txt").list();
Files.find(dir).ignoreCase().withExtension("txt").list();</pre>
</blockquote>
<p>You can also filter by Name, e.g. to find README files:</p>
<blockquote>
<pre>Files.find(dir).withName("README").list();
Files.find(dir).ignoreCase().withName("readme").list();</pre>
</blockquote>
<p>Note that the default matching is case sensitive. The commands caseSensitive() and ignoreCase() can be used to toggle the matching behaviour.</p>
<p>For special needs you can also specify a Predicate&lt;File&gt; to filter the resulting files.</p>
<blockquote>
<pre>Files.find(dir).recursive().withFilter(somePredicate).list();</pre>
</blockquote>
<h2>Finding Directories</h2>
<p>When looking for directories there are some special usecases that are supported, e.g. looking for directories that contain a specific file:</p>
<blockquote>
<pre>Files.find(dir).recursive().yieldDirectories()
               .containingFile("Thumbs.db");</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2010/02/11/recursive-file-iteration-in-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Android exploration continued</title>
		<link>http://www.techbits.de/2010/01/04/android-exploration-continued/</link>
		<comments>http://www.techbits.de/2010/01/04/android-exploration-continued/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 12:01:13 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.techbits.de/?p=192</guid>
		<description><![CDATA[I extended my android application with a preferences screen now, which is quite easy to do. A tutorial for creating a Preferences Activity got me started &#8211; unfortunaltely the xml preferences definition it uses is incorrect. The tags are names &#8230; <a href="http://www.techbits.de/2010/01/04/android-exploration-continued/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I extended my android application with a preferences screen now, which is quite easy to do.</p>
<ul>
<li>A <a href="http://www.androidguys.com/2008/09/29/whats-your-preference-part-one/">tutorial for creating a Preferences Activity</a> got me started &#8211; unfortunaltely the xml preferences definition it uses is incorrect. The tags are names of Classes which have to be capitalized.</li>
<li>The open the preferences activity I added a <a href="http://developer.android.com/guide/topics/ui/menus.html">Option Menu</a>.</li>
<li>I wanted to add some kind of progress indicator. I ended up using the <a href="http://developer.android.com/reference/android/app/ProgressDialog.html">ProgressDialog </a>and the <a href="http://developer.android.com/reference/android/os/AsyncTask.html">AsyncTask </a>to run the downloading and xml parsing in the background. To fix issues with device rotation I might have a look at the BetterAsyncTask in the <a href="http://github.com/kaeppler/droid-fu">Droid-FU library</a> later.</li>
<li>I also ran into DateFormat and Date issues with the UTC formated Date in the XML file. I Thought about using <a href="http://joda-time.sourceforge.net/"> joda-time</a> at least twice but then stuck to the JDK implementation for smaller app size. The fact that android brings it&#8217;s own class named DateFormat which just provides a localized JDK-DateFormat object doesn&#8217;t help either.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2010/01/04/android-exploration-continued/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Steps with Android</title>
		<link>http://www.techbits.de/2009/12/30/first-steps-with-android/</link>
		<comments>http://www.techbits.de/2009/12/30/first-steps-with-android/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 10:02:54 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.techbits.de/?p=189</guid>
		<description><![CDATA[In the last few days I started out with some android development. Here are some things learned so far developing my first app: The Android Tutorials are a great starting point, though i only followed through with the HelloWorld Tutorial. &#8230; <a href="http://www.techbits.de/2009/12/30/first-steps-with-android/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In the last few days I started out with some android development. Here are some things learned so far developing my first app:</p>
<ul>
<li>The Android Tutorials are a great starting point, though i only followed through with the <a href="http://developer.android.com/intl/de/resources/tutorials/hello-world.html">HelloWorld</a> Tutorial. In retrospect I should have looked at the <a href="http://developer.android.com/intl/de/resources/tutorials/notepad/index.html">Notepad Tutorial</a> a little closer because it explains important concepts (namely activities/intents).</li>
<li><a href="http://www.anddev.org/">http://www.anddev.org/</a> is a useful source for tutorials and code snippets</li>
<li>It&#8217;s still java but a completely different API, so you often have to look for classes and methods via code completion oder in examples to get things done.</li>
<li><strong>Downloading:</strong> Can be done with the included HTTP Client library. Unfortuantely <a href="http://dlinsin.blogspot.com/2009/08/http-basic-authentication-with-android.html">Android still uses an old version of the HTTP Client</a> though, which made it hard to find documentation (e.g. how to set authentication credentials). Additionally you shoudn&#8217;t forget to declare the INTERNET-permissions in your application manifest.</li>
<li><strong>Storing and retrieving Files</strong> looks fairly easy (getDir(), getCacheDir()-Methods are there) at first sight but you have to unerstand the Android filesystem security model if you don&#8217;t want to spend hours with debugging. The before mentoined methods use internal storage where each application stores it&#8217;s data independently. Public read/write (e.g. file exchange with other applications) is only possible when you store your content with the specific method openFileOutput(). The external SD card on the other hand can be openly accessed with the regular Java File API.</li>
<li><strong>XML Parsing:</strong> I started out with the sax parser but since my XML file was pretty complex I ditched it and downloaded<a href="http://brainflush.wordpress.com/2009/05/19/the-force-unleashed-xmlxpath-on-android-using-dom4j-and-jaxen/"> dom4j</a> which has a really easy to use API. Unfortunately it adds at least 200KB of final app size. I now realized I could have gone with the<a href="http://www.anddev.org/parse_xml_with_dom_-_getnodevalue_always_null-t3082.html"> regular DOM parser</a> which has a decent API. I&#8217;ll have to reevaluate this later &#8211; maybe the end user responsiveness does require the faster streaming parser approach (sax).</li>
<li><strong>UI design:</strong> Declarative XML based looks powerful and well thought out but I mostly stuck to tutorial layout for now. This is an area I still have to get into.</li>
</ul>
<p>Ok, that&#8217;s it for now. Android is turning out to be a great plattform &#8211; exciting times.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2009/12/30/first-steps-with-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Googles GData Java API to your maven repository</title>
		<link>http://www.techbits.de/2009/08/06/adding-googles-gdata-java-api-to-your-maven-repository/</link>
		<comments>http://www.techbits.de/2009/08/06/adding-googles-gdata-java-api-to-your-maven-repository/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 17:09:34 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[gdata]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[mavenize]]></category>
		<category><![CDATA[mvn]]></category>

		<guid isPermaLink="false">http://www.techbits.de/?p=181</guid>
		<description><![CDATA[The google gdata apis do not come with maven POM-files. Someone went through the trouble to &#8220;mavenize&#8221; the source but it is limited to linux as build plattform and currently out of date (compile errors). So I installed the JARs &#8230; <a href="http://www.techbits.de/2009/08/06/adding-googles-gdata-java-api-to-your-maven-repository/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The<a href="http://code.google.com/intl/de-DE/apis/gdata/overview.html"> google gdata apis</a> do not come with maven POM-files. Someone went through the trouble to <a href="http://code.google.com/p/google-apis-mavenized/">&#8220;mavenize&#8221; the source</a> but it is limited to linux as build plattform and currently out of date (compile errors). So I installed the JARs from the binary distribution of the APIs into my local repository &#8211; which are of course missing the dependencies between the individual JAR files. Here are two batch files which I used to install the JARs quite painlessly:</p>
<p>install.bat:</p>
<blockquote>
<pre>@SET mvn=d:\java\maven\bin\mvn
@%mvn% install:install-file -DgroupId=com.google.gdata
       -DartifactId=%1 -Dversion=%2 -Dfile=%3 -Dpackaging=jar
       -DgeneratePom=true</pre>
</blockquote>
<p>installall.bat:</p>
<blockquote>
<pre>call install.bat gdata-analytics 2.0 gdata-analytics-2.0.jar
call install.bat gdata-appsforyourdomain 1.0 gdata-appsforyourdomain-1.0.jar
call install.bat gdata-base 1.0 gdata-base-1.0.jar
call install.bat gdata-blogger 2.0 gdata-blogger-2.0.jar
call install.bat gdata-books 1.0 gdata-books-1.0.jar
call install.bat gdata-calendar 1.0 gdata-calendar-2.0.jar
call install.bat gdata-client 1.0 gdata-client-1.0.jar
call install.bat gdata-codesearch 2.0 gdata-codesearch-2.0.jar
call install.bat gdata-contacts 3.0 gdata-contacts-3.0.jar
call install.bat gdata-core 1.0 gdata-core-1.0.jar
call install.bat gdata-docs 2.0 gdata-docs-2.0.jar
call install.bat gdata-finance 2.0 gdata-finance-2.0.jar
call install.bat gdata-health 2.0 gdata-health-2.0.jar
call install.bat gdata-maps 2.0 gdata-maps-2.0.jar
call install.bat gdata-media 1.0 gdata-media-1.0.jar
call install.bat gdata-photos 2.0 gdata-photos-2.0.jar
call install.bat gdata-spreadsheet 3.0 gdata-spreadsheet-3.0.jar
call install.bat gdata-webmastertools 2.0 gdata-webmastertools-2.0.jar
call install.bat gdata-youtube 2.0 gdata-youtube-2.0.jar</pre>
</blockquote>
<p>You surely could get fancy and automate the splitting between artifact-name and version number, but hey, I needed those JARs installed quickly and that&#8217;s what it does.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2009/08/06/adding-googles-gdata-java-api-to-your-maven-repository/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>IndexedList: A hybrid of a Java List and a Map</title>
		<link>http://www.techbits.de/2009/07/18/indexedlist-a-hybrid-of-a-java-list-and-a-map/</link>
		<comments>http://www.techbits.de/2009/07/18/indexedlist-a-hybrid-of-a-java-list-and-a-map/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 11:00:09 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[collections]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.techbits.de/?p=164</guid>
		<description><![CDATA[If been working on legacy data import code in the last months with a lot of code searching for exisiting objects in lists. I realized I needed a different collection to speed up searching for identifiers and couldn&#8217;t find any &#8230; <a href="http://www.techbits.de/2009/07/18/indexedlist-a-hybrid-of-a-java-list-and-a-map/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If been working on legacy data import code in the last months with a lot of code searching for exisiting objects in lists. I realized I needed a different collection to speed up searching for identifiers and couldn&#8217;t find any standard collection that matches my needs. I basically need an index like <span style="font-family: Courier New;">Maps.uniqueIndex()</span> from the <a href="http://code.google.com/p/google-collections/">Google Collections Library</a> provides but it should be updating dynamically and not only be generated once.</p>
<p><span id="more-164"></span>To summarize my requirements:</p>
<ul>
<li>A List (ArrayList) which can be modified as usual</li>
<li>A way to find objects (contains and get) in constant time by a custom attribute (like a HashMap)</li>
<li>No reliance on equals() and hashcode() because they cover more attributes (an can not be changed)</li>
</ul>
<p>The <span style="font-family: Courier New;">LinkedHashMap </span>seems to almost fit the bill but it is not a true List and therefore not a great drop in replacement.</p>
<p>What I&#8217;m using right now is a wrapper around a List which maintains an additional HashMap to find objects by the index criterium. The index is automatically updated whenever the list is modified. This is an example on how I use it:</p>
<blockquote>
<pre>// function to index Persons by their social security number<br style="font-family: Courier New;" />Function&lt;Person, String&gt; getSsnrForPerson =
  new Function&lt;Person, String&gt;() {<br style="font-family: Courier New;" />    String apply(Person person) {<br style="font-family: Courier New;" />      return person.getSocialSecurityNumber();<br style="font-family: Courier New;" />    }<br style="font-family: Courier New;" />  }</pre>
</blockquote>
<p>To create an indexed list for an empty ArrayList&lt;Person&gt; with an index on a person&#8217;s social security number you can then easily use the Class UniqueIndexedList:</p>
<blockquote>
<pre>UnqiueIndexedList&lt;Person, String&gt; myList =
  UnqiueIndexedList.create(getSsnrForPerson);</pre>
</blockquote>
<p>Of course all the usual methods of the List&lt;Person&gt; interface can be used as usual:</p>
<blockquote>
<pre>myList.add(somePerson);
myList.add(anotherPerson);
myList.get(i);
myList.iterator();</pre>
</blockquote>
<p>Additionaly there are  methods to access objects by index:<br style="font-family: Courier New;" /></p>
<blockquote>
<pre>boolean personIsInList = myList.containsByIndex("34897634853");</pre>
<pre>Person p = myList.getByIndex("34897634853");</pre>
</blockquote>
<p>The code for the list implementation currently resides here:</p>
<ul>
<li><a id="neqh" title="http://code.google.com/p/data-integrity-check/source/browse/trunk/src/main/java/de/fmaul/common/collect/IndexedList.java" href="http://code.google.com/p/data-integrity-check/source/browse/trunk/src/main/java/de/fmaul/common/collect/IndexedList.java">IndexedList.java</a></li>
<li><a id="uk2m" title="http://code.google.com/p/data-integrity-check/source/browse/trunk/src/main/java/de/fmaul/common/collect/UniqueIndexedList.java" href="http://code.google.com/p/data-integrity-check/source/browse/trunk/src/main/java/de/fmaul/common/collect/UniqueIndexedList.java">UniqueIndexedList.java</a></li>
</ul>
<p>It is basically a hybrid of a List and a special index-Map and works well so far. I am sure that finding objects in list for a given attribute is a very common usecase. Why hasn&#8217;t anyone solved this yet? Are there (better) alternatives that I&#8217;ve missed?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2009/07/18/indexedlist-a-hybrid-of-a-java-list-and-a-map/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back with SQL Script Creator&#8230; almost</title>
		<link>http://www.techbits.de/2006/06/18/back-with-sql-script-creator-almost/</link>
		<comments>http://www.techbits.de/2006/06/18/back-with-sql-script-creator-almost/#comments</comments>
		<pubDate>Sun, 18 Jun 2006 12:47:26 +0000</pubDate>
		<dc:creator>Florian</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[net]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sqlserver]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://www.techbits.de/2006/06/18/back-with-sql-script-creator-almost/</guid>
		<description><![CDATA[Being annoyed by creating a cursor script in SQL and having to define tons of variables manually I wondered if there was any tool to aid in this process. I quick google did not yield promising results. So spend the &#8230; <a href="http://www.techbits.de/2006/06/18/back-with-sql-script-creator-almost/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img style="float:right;" id="image36" src="http://www.techbits.de/wp-content/uploads/2006/06/ssc_small.jpg" alt="SQL Script Creator Splash Screen" /></p>
<p>Being annoyed by creating a cursor script in SQL and having to define tons of variables manually I wondered if there was any tool to aid in this process. I quick google did not yield promising results. So spend the weekend conjuring up an application that eases the script creation by providing specialized generators to create scripts automatically from a given SELECT statement. It works pretty well and will be tested further in the next week until I&#8217;ll release it here under some opensource license.<br />
<span style="clear:right;"/><br />
<a class="imagelink" href="http://www.techbits.de/wp-content/uploads/2006/06/ssc_screenshot.png" title="SQL Script Creator Screenshot"><img id="image38" src="http://www.techbits.de/wp-content/uploads/2006/06/ssc_screenshot.thumbnail.png" alt="SQL Script Creator Screenshot" /></a></p>
<p>Putting this app together thought me some new things about the settings and localization concepts of .NET 2.0. Two articles that got me introduced to the concept are the tutorial <a href="http://www.ondotnet.com/pub/a/dotnet/2005/08/08/localizingaspnet20.html?page=1">Localization in ASP .NET 2.0</a> on ondotnet.com and the detailed article<br />
<a href="http://www.theserverside.net/tt/articles/showarticle.tss?id=LocalizationPractices">Localization Practices for .NET 2.0</a> on theserverside.net. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbits.de/2006/06/18/back-with-sql-script-creator-almost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

