<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-5211228043243414701</atom:id><lastBuildDate>Mon, 15 Mar 2010 17:10:07 +0000</lastBuildDate><title>Juri Strumpflohner's TechBlog</title><description>Computer Science, Programming, Microsoft Technologies, Best Practices, Personal opinions...</description><link>http://blog.js-development.com/</link><managingEditor>noreply@blogger.com (Juri Strumpflohner)</managingEditor><generator>Blogger</generator><openSearch:totalResults>285</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/juristrumpflohner" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="juristrumpflohner" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-1928533004959293137</guid><pubDate>Mon, 15 Mar 2010 17:08:00 +0000</pubDate><atom:updated>2010-03-15T18:10:07.868+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">GWT</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><title>GWT Button with image AND text</title><description>GWT just provides the basic widgets like check boxes, hyperlinks, buttons etc...and leave the more complex ones to the developer or to 3rd party providers. For instance they don't have lists. Another thing which quite surprised me, their implementation of a button doesn't allow to have images AND text at the same time although a lot of Google products have it (Wave, GDocs, Gmail...).&lt;br /&gt;
With GWT buttons you have mainly two possibilities, using &lt;code&gt;Button&lt;/code&gt; or &lt;code&gt;PushButton&lt;/code&gt;. The first is just the standard one while the latter allows to assign an image which is passed in its constructor. But also the PushButton doesn't allow to have both, image AND text visualized...which somehow seems to be a use case which is quite requested. A search on the web brought me to the GWT's JavaDoc describing a CustomButton widget which can be used like this:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;g:PushButton ui:field='pushButton' enabled='true'&amp;gt;
 &amp;lt;g:upFace&amp;gt;
  &amp;lt;b&amp;gt;click me&amp;lt;/b&amp;gt;
 &amp;lt;/g:upFace&amp;gt;
 &amp;lt;g:upHoveringFace&amp;gt;
  &amp;lt;b&amp;gt;Click ME!&amp;lt;/b&amp;gt;
 &amp;lt;/g:upHoveringFace&amp;gt;
 &amp;lt;g:downFace image='{res.save}' /&amp;gt;
&amp;lt;/g:PushButton&amp;gt;&lt;/pre&gt;&lt;br /&gt;
But also this kind of implementation doesn't allow you to have an image and text declaration...* uff *.&lt;br /&gt;
&lt;br /&gt;
So after that, &lt;a href="http://blog.js-development.com/2010/02/gwt-hyperlink-widget-with-image.html"&gt;similar as for the Hyperlink&lt;/a&gt;, I decided to implement one by myself. The implementation wasn't that difficult after all. Here's the source code:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Image;

public class CustomButton extends Button {
 private String text;
 
 public CustomButton(){
  super();
 }
 
 public void setResource(ImageResource imageResource){
  Image img = new Image(imageResource);
  String definedStyles = img.getElement().getAttribute("style");
  img.getElement().setAttribute("style", definedStyles + "; vertical-align:middle;");
  DOM.insertBefore(getElement(), img.getElement(), DOM.getFirstChild(getElement()));
 }
 
 @Override
 public void setText(String text) {
  this.text = text;
  Element span = DOM.createElement("span");
  span.setInnerText(text);
  span.setAttribute("style", "padding-left:3px; vertical-align:middle;");
  
  DOM.insertChild(getElement(), span, 0);
 }
 
 @Override
 public String getText() {
  return this.text;
 }
}
&lt;/pre&gt;The according usage with the GWT UiBinder is the following:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;...
&amp;lt;!-- Declaration of your ImageBundle --&amp;gt;
&amp;lt;ui:with field="res" type="com.sample.client.IDevbookImageBundle" /&amp;gt;
...
&amp;lt;d:CustomButton ui:field="buttonSave" text="Save" resource="{res.save}"&amp;gt;&amp;lt;/d:CustomButton&amp;gt;
&lt;/pre&gt;Pretty simple, isn't it? And it doesn't alter the button's behavior rather than adding the image. Some explanations might be needed as for instance you may wonder why I've overridden the &lt;code&gt;setText(String)&lt;/code&gt;, &lt;code&gt;getText()&lt;/code&gt; of the standard Button widget. This was needed in order to wrap the text inside a span element which I can then identify when adding the image in order to position the image before the text. This has the drawback that a definition like&lt;br /&gt;
&lt;pre class="prettyprint"&gt;...
&amp;lt;d:CustomButton ui:field="buttonSave"resource="{res.save}"&amp;gt;Save&amp;lt;/d:CustomButton&amp;gt;
&lt;/pre&gt;...won't work.&lt;br /&gt;
&lt;br /&gt;
Moreover this widget may be enhanced by making it more configurable like adding the image after the text etc. I've also hard-coded some styles as you see in order to make the widget easier to use. The final outcome:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_tF6XjsUy87k/S55p5OxLnhI/AAAAAAAACjI/r0fh3G9eeT0/s1600-h/gwtImagebuttontext.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_tF6XjsUy87k/S55p5OxLnhI/AAAAAAAACjI/r0fh3G9eeT0/s320/gwtImagebuttontext.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-1928533004959293137?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UVV9v1bYi1B4NW0PMwTiX-azVE4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UVV9v1bYi1B4NW0PMwTiX-azVE4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UVV9v1bYi1B4NW0PMwTiX-azVE4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UVV9v1bYi1B4NW0PMwTiX-azVE4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/03/gwt-button-with-image-and-text.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_tF6XjsUy87k/S55p5OxLnhI/AAAAAAAACjI/r0fh3G9eeT0/s72-c/gwtImagebuttontext.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-6653872024753368614</guid><pubDate>Fri, 12 Mar 2010 19:21:00 +0000</pubDate><atom:updated>2010-03-12T20:21:00.764+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">GWT</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><title>Client-server communication peculiarities with GWT and App Engine DataNucleus</title><description>I just had to fight with a strange exception which got raised after a GWT-RPC call to the App Engine back-end server which had the purpose to persistently store an entity into the data store.&lt;br /&gt;
The exception:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="code"&gt;com.google.gwt.user.client.rpc.SerializationException: Type 'org.datanucleus.sco.backed.List' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer.For security purposes, this type will not be serialized.: instance = []
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:610)
 at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:152)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:534)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:700)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:730)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:612)
 at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:152)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:534)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:700)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:730)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:612)
 at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:152)
 at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:534)
 at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:609)
 at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:467)
 at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:564)
 at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:544)
 at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:504)&lt;/pre&gt;&lt;br /&gt;
The exception happened during the (de)serialization of the RPC call. But I didn't use any &lt;code&gt;org.datanucleus.sco.backed.List&lt;/code&gt; type in my entities which I transfer over the network. The reason however is the persist operation on App Engine. The code is like&lt;br /&gt;
&lt;pre class="prettyprint"&gt;@Override
public void saveOrUpdate(SourceCodeItem item) {
 PersistenceManager pm = getPersistenceManager();
 try {
  pm.currentTransaction().begin();
  pm.makePersistent(item);
  pm.currentTransaction().commit();
 } catch (Exception ex) {
  if (pm.currentTransaction().isActive())
   pm.currentTransaction().rollback();
 } finally {
  pm.close();
 }
}&lt;/pre&gt;It takes an object of type &lt;code&gt;SourceCodeItem&lt;/code&gt; and makes it persistent by calling &lt;code&gt;makePersistent(...)&lt;/code&gt;. This call to makePersistent changes the state of the passed object. The SourceCodeItem object has the following structure (cut out details):&lt;br /&gt;
&lt;pre class="code"&gt;@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class SourceCodeItem implements IsSerializable {
 @PrimaryKey
 @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
 private String id;

 @Persistent
 private String title;

 ...
 
 &lt;b&gt;private List&amp;lt;Label&amp;gt; labels;&lt;/b&gt;

 public SourceCodeItem() {
  ...
  &lt;b&gt;labels = new ArrayList&amp;lt;Label&amp;gt;();&lt;/b&gt;
 }
 ...
}&lt;/pre&gt;The highlighted member variable declaration is a list which is not persistent and it gets initialized in the constructor. However after a call to the JDO's &lt;code&gt;makePersistent(..)&lt;/code&gt; this list will be instantiated with the above mentioned &lt;code&gt;org.datanucleus.sco.backed.List&lt;/code&gt; type. If you don't "detach" the object from JDOs manager it will be transferred with that instance type of the list which cannot be serialized and you'll get the exception I described in the beginning.&lt;br /&gt;
&lt;br /&gt;
Now you have two choices. Change your implementation of &lt;code&gt;saveOrUpdate(SourceCodeItem)&lt;/code&gt; and explicitly detach your object. This would result in the following code:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;@Override
public SourceCodeItem saveOrUpdate(SourceCodeItem item) {
        SourceCodeItem result = null;
 PersistenceManager pm = getPersistenceManager();
 try {
  pm.currentTransaction().begin();
  pm.makePersistent(item);
  pm.currentTransaction().commit();
                result = pm.detachCopy(item);
 } catch (Exception ex) {
  if (pm.currentTransaction().isActive())
   pm.currentTransaction().rollback();
 } finally {
  pm.close();
 }

        return result;
}&lt;/pre&gt;Alternatively, which is my favorite option is to add the following to your jdoconfig.xml:&lt;br /&gt;
&lt;pre class="code"&gt;&amp;lt;property name="datanucleus.DetachAllOnCommit" value="true"/&amp;gt;&lt;/pre&gt;In this way the detaching will be done automatically after a commit and you can leave the code as it was initially. In such a way you'd get the following lifecycle:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.datanucleus.org/products/accessplatform_1_1/images/jdo_object_lifecycle.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="142" src="http://www.datanucleus.org/products/accessplatform_1_1/images/jdo_object_lifecycle.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-6653872024753368614?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4mZzN7ngkElH1Jov3fIk1Q6JGpc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4mZzN7ngkElH1Jov3fIk1Q6JGpc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4mZzN7ngkElH1Jov3fIk1Q6JGpc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4mZzN7ngkElH1Jov3fIk1Q6JGpc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/03/client-server-communication.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-5809389679923396642</guid><pubDate>Tue, 09 Mar 2010 16:39:00 +0000</pubDate><atom:updated>2010-03-09T18:11:53.117+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">annotated</category><category domain="http://www.blogger.com/atom/ns#">mobile dev</category><category domain="http://www.blogger.com/atom/ns#">Android</category><title>Tune your emulator with a pretty Nexus One skin!</title><description>I know it doesn't really increase your value during development. It's just for fun but those of you that like it, here are some links that point to Nexus One skins that can be used on your local dev emulator.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.tughi.com/2010/01/19/nexus-one-skin/"&gt;http://www.tughi.com/2010/01/19/nexus-one-skin/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://timhoeck.com/2010/01/16/nexus-one-emulator-skin/"&gt;http://timhoeck.com/2010/01/16/nexus-one-emulator-skin/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
Installation is easy. Just extract it to &lt;code&gt;&amp;lt;android-sdk-install-root&amp;gt;/platforms/&amp;lt;your-platform&amp;gt;/skins&lt;/code&gt; and then use it.&lt;br /&gt;
&lt;br /&gt;
The result is pretty nice :)&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_tF6XjsUy87k/S5Z5GcfF_TI/AAAAAAAACjA/lDoetARX_Y0/s1600-h/nexusOneSkin.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/_tF6XjsUy87k/S5Z5GcfF_TI/AAAAAAAACjA/lDoetARX_Y0/s400/nexusOneSkin.png" width="158" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Update&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
What I forgot to mention. If you have problems with the size of the emulator that is going to be started, you may want to add a &lt;code&gt;-scale&lt;/code&gt; to your emulator run arguments. In Eclipse you add it under your Run Configurations:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_tF6XjsUy87k/S5aBOXKncyI/AAAAAAAACjE/-P7spfvFXWo/s1600-h/scaleEmulatorEclipse.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="545" src="http://1.bp.blogspot.com/_tF6XjsUy87k/S5aBOXKncyI/AAAAAAAACjE/-P7spfvFXWo/s640/scaleEmulatorEclipse.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-5809389679923396642?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2N6luUyc4QAFvV5_TJ4qR2LGMws/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2N6luUyc4QAFvV5_TJ4qR2LGMws/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2N6luUyc4QAFvV5_TJ4qR2LGMws/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2N6luUyc4QAFvV5_TJ4qR2LGMws/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/03/tune-your-emulator-with-pretty-nexus.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_tF6XjsUy87k/S5Z5GcfF_TI/AAAAAAAACjA/lDoetARX_Y0/s72-c/nexusOneSkin.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-8396372704366743535</guid><pubDate>Tue, 02 Mar 2010 21:55:00 +0000</pubDate><atom:updated>2010-03-02T22:55:37.136+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">annotated</category><category domain="http://www.blogger.com/atom/ns#">Eclipse</category><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><title>That's what I'm missing in Visual Studio! Give me better code editor support!!</title><description>Visual Studio is great in doing many things as for instance in integrating with other MS products (obviously) or with debugging. The VS debugger is one of the best I've seen till now (using different IDEs).&lt;br /&gt;
&lt;br /&gt;
One thing however I always again miss is having better code editor support. I'm also using Eclipse heavily and the code support which is given there is just amazing and by far better than in Visual Studio. Examples are not only the refactorings, but also shortcuts for jumping to classes / methods which in VS is only available through 3rd-party plugins. Ok...you can use the dropdown box on top...but it is far from usable (have to switch to mouse, etc...).&lt;br /&gt;
&lt;br /&gt;
Another example I came across today in Eclipse is the following. I was just writing an argument matcher to be provided to &lt;a href="http://mockito.org/"&gt;Mockito&lt;/a&gt; in one of my test cases. I started with the following&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tF6XjsUy87k/S42HYuj-S3I/AAAAAAAACiw/2Wr1yBmTA6o/s1600-h/EclipseCodeSupport1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="167" src="http://3.bp.blogspot.com/_tF6XjsUy87k/S42HYuj-S3I/AAAAAAAACiw/2Wr1yBmTA6o/s400/EclipseCodeSupport1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;Note, argument is of type object, so I did a check using the &lt;code&gt;instanceof&lt;/code&gt; ("is" in C#) keyword wrapped within an if clause. I then continued to write &lt;code&gt;argument.getLabels()&lt;/code&gt;,...&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_tF6XjsUy87k/S42IE9Hik5I/AAAAAAAACi0/mdIURjeItN8/s1600-h/EclipseCodeSupport2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="182" src="http://4.bp.blogspot.com/_tF6XjsUy87k/S42IE9Hik5I/AAAAAAAACi0/mdIURjeItN8/s400/EclipseCodeSupport2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
...not recognizing that &lt;code&gt;getLabels()&lt;/code&gt; is actually a method of SourceCodeItem, wherefore I have to cast &lt;code&gt;argument&lt;/code&gt; to &lt;code&gt;SourceCodeItem&lt;/code&gt; first. But...wait; strangely Eclipse provided &lt;code&gt;getLabels()&lt;/code&gt; in its suggestions as if it would be a valid method of &lt;code&gt;argument&lt;/code&gt;?? Confirming it...&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tF6XjsUy87k/S42IrtmruJI/AAAAAAAACi4/REulHGL0lxs/s1600-h/EclipseCodeSupport3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="183" src="http://3.bp.blogspot.com/_tF6XjsUy87k/S42IrtmruJI/AAAAAAAACi4/REulHGL0lxs/s400/EclipseCodeSupport3.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;...Eclipse does the cast automatically for me!! That's what I call great support....I love it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-8396372704366743535?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MUn_N07RNyTI3wFrKNPLH2hvvf8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MUn_N07RNyTI3wFrKNPLH2hvvf8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MUn_N07RNyTI3wFrKNPLH2hvvf8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MUn_N07RNyTI3wFrKNPLH2hvvf8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/03/thats-what-im-missing-in-visual-studio.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_tF6XjsUy87k/S42HYuj-S3I/AAAAAAAACiw/2Wr1yBmTA6o/s72-c/EclipseCodeSupport1.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-8788784536935673626</guid><pubDate>Sun, 28 Feb 2010 21:53:00 +0000</pubDate><atom:updated>2010-02-28T22:55:13.719+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">GWT</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><title>GWT Hyperlink Widget with Image</title><description>Standard &lt;a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/Hyperlink.html"&gt;GWT Hyperlink&lt;/a&gt; widgets don't seem to give the possibility to associate an image. This is quite awkward since you may want to provide nice icons along with your links. In my opinion, appropriate icons increase the user experience dramatically. But it is also not difficult to create image-enhanced hyperlink widgets.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public class HyperLink extends Hyperlink {

 public HyperLink(){
 }
 
 public void setResource(ImageResource imageResource){
  Image img = new Image(imageResource);
  img.setStyleName("navbarimg");
  DOM.insertBefore(getElement(), img.getElement(), DOM.getFirstChild(getElement()));
 }
}&lt;/pre&gt;Now you can use the widget like&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&amp;gt;
&amp;lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
 xmlns:g="urn:import:com.google.gwt.user.client.ui" 
 &lt;b&gt;xmlns:v="urn:import:com.devbook.client.view" xmlns:d="urn:import:com.devbook.client.widget"&amp;gt;&lt;/b&gt;
 &amp;lt;ui:style&amp;gt;
 &amp;lt;/ui:style&amp;gt;
 &lt;b&gt;&amp;lt;ui:with field="res" type="com.devbook.client.IDevbookImageBundle" /&amp;gt;&lt;/b&gt;
 &amp;lt;g:DecoratorPanel ui:field="outerContainer"&amp;gt;
  &amp;lt;g:HTMLPanel ui:field="mainContainer"&amp;gt;
   &amp;lt;v:DecoratedPanel ui:field="titleContainer" text="Navigation"&amp;gt;&amp;lt;/v:DecoratedPanel&amp;gt;
   &amp;lt;g:VerticalPanel&amp;gt;
    &lt;b&gt;&amp;lt;d:HyperLink resource="{res.add}" targetHistoryToken="addSourceItem"&amp;gt;Add Item&amp;lt;/d:HyperLink&amp;gt;&lt;/b&gt;
   &amp;lt;/g:VerticalPanel&amp;gt;
  &amp;lt;/g:HTMLPanel&amp;gt;
 &amp;lt;/g:DecoratorPanel&amp;gt;
&amp;lt;/ui:UiBinder&amp;gt; &lt;/pre&gt;The above XML file makes use of the &lt;code&gt;UiBinder&lt;/code&gt; which has been introduced with GWT 2.0. You have to take a look at the highlighted parts. First the &lt;code&gt;HyperLink&lt;/code&gt; widget (shown at the beginning of this post) is being referenced. Then a reference to the ImageBundle you have defined for your GWT module is created. This bundle is needed to reference the image you'll show on the &lt;code&gt;HyperLink&lt;/code&gt; widget. The &lt;code&gt;resource="{res.add}"&lt;/code&gt; will be translated to a call of&amp;nbsp;&lt;code&gt;setResource(ImageResource)&lt;/code&gt;. The passed ImageResource is the one defined in your ImageBundle.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public interface IDevbookImageBundle extends ClientBundle {
 ...
 @Source("com/devbook/images/add.png")
 ImageResource add();
 ...
}&lt;/pre&gt;The final result:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tF6XjsUy87k/S4rlTspU9jI/AAAAAAAACis/5ag8YCQJLwA/s1600-h/hyperlinkIcon.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_tF6XjsUy87k/S4rlTspU9jI/AAAAAAAACis/5ag8YCQJLwA/s1600/hyperlinkIcon.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-8788784536935673626?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cdHoMxgaUKAnAkYumgsESfdQscY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cdHoMxgaUKAnAkYumgsESfdQscY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cdHoMxgaUKAnAkYumgsESfdQscY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cdHoMxgaUKAnAkYumgsESfdQscY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/02/gwt-hyperlink-widget-with-image.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_tF6XjsUy87k/S4rlTspU9jI/AAAAAAAACis/5ag8YCQJLwA/s72-c/hyperlinkIcon.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-4468238131586485951</guid><pubDate>Tue, 23 Feb 2010 17:52:00 +0000</pubDate><atom:updated>2010-02-23T18:52:04.068+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">GWT</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Projects</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><title>GWT, App Engine and App Engine Data Classes</title><description>I currently have some time before starting with my Master thesis project which will bring me back to Android programming. So to make use of that, I started to develop a project I already wanted to implement a couple of years ago, but due to my Master studies I didn't have the time to. I'll need some beta testers soon, so keep track of my blog here to catch the moment when everything goes online.&lt;br /&gt;
What I can reveal so far is that it will be a web application, using Google's &lt;a href="http://code.google.com/webtoolkit/"&gt;GWT&lt;/a&gt; and it will be hosted on Google's cloud computing platform &lt;a href="http://appengine.google.com/"&gt;App Engin&lt;/a&gt;e.&lt;br /&gt;
&lt;br /&gt;
Today I was finishing the implementation of the basic CRUD operations, using JDO and App Engine's DataNucleus DataStore. Now the app possibly needs to store large strings surely more than 255 characters. You'd think that shouldn't be a problem, but App Engine's DataStore has&lt;a href="http://code.google.com/appengine/docs/java/datastore/usingjdo.html#Unsupported_Features_of_JDO"&gt; some implications one should be aware of&lt;/a&gt;. Beside these, there are some well defined core value types, under which there is the restriction that you have to use the &lt;code&gt;com.google.appengine.api.datastore.Text&lt;/code&gt; instead of the &lt;code&gt;String&lt;/code&gt; datatype if you plan to store more than 255 character strings. Ok, that shouldn't be a problem for us, should it? Well...not exactly. If you plan to use App Engine together with plain old JSP or whatever view technology that it won't be a problem, but if you use GWT you have to keep in mind that you're implementing a client-server system. The difference: the GWT client lives within the browser. So the data has to be transferred between the two end-points and has to be serializable accordingly. &lt;code&gt;com.google.appengine.api.datastore.Text&lt;/code&gt; isn't serializable though. This means you &lt;b&gt;cannot&lt;/b&gt;&amp;nbsp;share your POJOs between your GWT client app and server-side code. Now you have different possibilities. Some that come to my mind right now are..&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;using DTOs (&lt;a href="http://martinfowler.com/eaaCatalog/dataTransferObject.html"&gt;Data Transfer Objects&lt;/a&gt;) which isn't that comfortable 'cause it causes a lot of boilerplate code&lt;/li&gt;
&lt;li&gt;writing a serializable version of &lt;code&gt;com.google.appengine.api.datastore.Text&lt;/code&gt; data class.&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;Fortunately a guy has already implemented such a serializable version of &lt;code&gt;Text&lt;/code&gt; and provides it for free. I just tried it out and it works&amp;nbsp;seamlessly, without writing a single additional line of code. Here some steps on how to use it (available descriptions on the web are really bad).&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Download the necessary jar files from&amp;nbsp;&lt;a href="http://www.resmarksystems.com/code/"&gt;http://www.resmarksystems.com/code/&lt;/a&gt;:&lt;br /&gt;
&lt;a href="http://www.resmarksystems.com/code/appengine-utils-client-1.0.jar"&gt;appengine-utils-client-1.0.jar&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.resmarksystems.com/code/appengine-utils-server-1.0.jar"&gt;appengine-utils-server-1.0.jar&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Include the appengine-utils-client-1.0.jar in your build path. Copy the appengine-utils-server-1.0.jar to your WEB-INF/lib folder.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;On your GWT module file add the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;inherits name="com.resmarksystems.AppEngineDataTypes"/&amp;gt;

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Restart your GWT app or compile it and everything should work as expected.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;Resmarksystem's version doesn't just provide serializable versions of &lt;code&gt;Text&lt;/code&gt; but also for &lt;code&gt;Key&lt;/code&gt;, &lt;code&gt;ShortBlob&lt;/code&gt;, &lt;code&gt;Blob&lt;/code&gt;, &lt;code&gt;Link&lt;/code&gt;, &lt;code&gt;User&lt;/code&gt;.&lt;br /&gt;
If you get exceptions like&lt;br /&gt;
&lt;pre class="code"&gt;java.lang.ClassCastException: java.lang.String cannot be cast to com.google.appengine.api.datastore.Text&lt;/pre&gt;or &lt;br /&gt;
&lt;pre class="code"&gt;An IncompatibleRemoteServiceException was thrown while processing this call. &lt;/pre&gt;then it's probably because you didn't correctly include the jar files as mentioned in step 2 above.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-4468238131586485951?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FAFOehtdSQslx3gUtHGIuTAy97Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FAFOehtdSQslx3gUtHGIuTAy97Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/FAFOehtdSQslx3gUtHGIuTAy97Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FAFOehtdSQslx3gUtHGIuTAy97Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/02/gwt-app-engine-and-app-engine-data.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-3168982070723566913</guid><pubDate>Fri, 19 Feb 2010 15:33:00 +0000</pubDate><atom:updated>2010-02-19T16:33:56.492+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">GWT</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><title>DockLayoutPanel doesn't work correctly??</title><description>Suppose you'd like to create a layout like the following using GWT:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://code.google.com/webtoolkit/doc/latest/images/DockLayoutPanel.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://code.google.com/webtoolkit/doc/latest/images/DockLayoutPanel.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
With GWT 2.0 the documentation suggests to use the &lt;a href="http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html#LayoutPanels"&gt;DockLayoutPanel&lt;/a&gt;.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;g:DockLayoutPanel unit='EM'&amp;gt;
  &amp;lt;g:north size='4'&amp;gt;
    &amp;lt;g:Label&amp;gt;Header&amp;lt;/g:Label&amp;gt;
  &amp;lt;/g:north&amp;gt;

  &amp;lt;g:west size='16'&amp;gt;
    &amp;lt;g:Label&amp;gt;Navigation&amp;lt;/g:Label&amp;gt;
  &amp;lt;/g:west&amp;gt;

  &amp;lt;g:center&amp;gt;
    &amp;lt;g:ScrollPanel&amp;gt;
      &amp;lt;g:Label&amp;gt;Content Area&amp;lt;/g:Label&amp;gt;
    &amp;lt;/g:ScrollPanel&amp;gt;
  &amp;lt;/g:center&amp;gt;
&amp;lt;/g:DockLayoutPanel&amp;gt;&lt;/pre&gt;&lt;br /&gt;
However pay attention, this won't work if you use the standard mechanism like&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public void onModuleLoad() {
 RootPanel.get("main").add(new MainUI());
}&lt;/pre&gt;where the &lt;code&gt;new MainUI()&lt;/code&gt; contains the &lt;code&gt;DockLayoutPanel&lt;/code&gt; as root element (I assume you're using GWT's new UiBinder mechanism), then the &lt;code&gt;DockLayoutPanel&lt;/code&gt; won't work surprisingly.&lt;br /&gt;
&lt;br /&gt;
Instead you have to use&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public void onModuleLoad() {
   RootLayoutPanel panel = RootLayoutPanel.get();
   panel.add(new MainUI());
}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-3168982070723566913?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JwA9aV1DdW7igGGOV4JbUniDYuc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JwA9aV1DdW7igGGOV4JbUniDYuc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JwA9aV1DdW7igGGOV4JbUniDYuc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JwA9aV1DdW7igGGOV4JbUniDYuc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/02/docklayoutpanel-doesnt-work-correctly.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-5422536379305971178</guid><pubDate>Thu, 18 Feb 2010 14:00:00 +0000</pubDate><atom:updated>2010-02-18T15:00:08.023+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HowTo</category><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><category domain="http://www.blogger.com/atom/ns#">Java Script</category><title>HowTo: Launch JavaScript after async postback of UpdatePanel</title><description>Assume the scenario where you want to launch a JavaScript function after your UpdatePanel finished to do its async postback. This turns out to actually be quite simple. What you do is to use the &lt;code&gt;ScriptManager.RegisterStartupScript(...)&lt;/code&gt; method.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;ScriptManager.RegisterStartupScript(btnSave, this.GetType(), "myScriptKey", "myFunction()", true);
&lt;/pre&gt;The only thing I found that people misdo is to not specify the correct instance&amp;nbsp;(1st parameter)&amp;nbsp;that caused the asynchronous postback to fire and thus the UpdatePanel to do the postback. In such a case it will just fail silently.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-5422536379305971178?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/QwgPSm4aUll6rW5DJ-UUsfIrP7Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QwgPSm4aUll6rW5DJ-UUsfIrP7Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/QwgPSm4aUll6rW5DJ-UUsfIrP7Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QwgPSm4aUll6rW5DJ-UUsfIrP7Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/02/howto-launch-javascript-after-async.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-6081042210640096517</guid><pubDate>Tue, 16 Feb 2010 22:54:00 +0000</pubDate><atom:updated>2010-02-16T23:54:24.225+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">GWT</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><title>GWT DecoratorPanel style problems</title><description>I just experienced a nice side effect that happens if you use a &lt;a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/DecoratorPanel.html"&gt;DecoratorPanel&lt;/a&gt;. In my example it contained a list of items and everything is fine.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tF6XjsUy87k/S3sg7S-3dYI/AAAAAAAACiE/FBaOCW0MVKQ/s1600-h/decoratorPanelSmallFine.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_tF6XjsUy87k/S3sg7S-3dYI/AAAAAAAACiE/FBaOCW0MVKQ/s1600/decoratorPanelSmallFine.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Decorator panel with no width indication&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div&gt;So far, everything is shiny. Bad things start when you want your DecoratorPanel to expand on the whole width of your page. So you add a &lt;code&gt;width="100%"&lt;/code&gt; and get this&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tF6XjsUy87k/S3shYue7m4I/AAAAAAAACiI/Fqo2pW6Fwuc/s1600-h/decoratorPanelLargeOdd.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="100" src="http://3.bp.blogspot.com/_tF6XjsUy87k/S3shYue7m4I/AAAAAAAACiI/Fqo2pW6Fwuc/s640/decoratorPanelLargeOdd.png" width="640" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Decorator panel borders totally not working&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
Of course this is a style problem. Some browsing on the web and by reading through bug reports I came out with the following piece of CSS you have to place in your main GWT application's CSS file:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;.gwt-DecoratorPanel {
    table-layout: fixed;
}
.gwt-DecoratorPanel .topLeft,
.gwt-DecoratorPanel .topRight {
    width: 5px;
}
&lt;/pre&gt;Refresh your browser and everything should work fine.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-6081042210640096517?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SIHiJPkQJFZ-aihDrQ0VyMAw-Vk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SIHiJPkQJFZ-aihDrQ0VyMAw-Vk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SIHiJPkQJFZ-aihDrQ0VyMAw-Vk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SIHiJPkQJFZ-aihDrQ0VyMAw-Vk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/02/gwt-decoratorpanel-style-problems.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_tF6XjsUy87k/S3sg7S-3dYI/AAAAAAAACiE/FBaOCW0MVKQ/s72-c/decoratorPanelSmallFine.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-1405885873975344250</guid><pubDate>Sun, 07 Feb 2010 20:00:00 +0000</pubDate><atom:updated>2010-02-07T21:00:00.581+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">OSX</category><category domain="http://www.blogger.com/atom/ns#">Mac</category><category domain="http://www.blogger.com/atom/ns#">interesting apps</category><title>Reloaded: Clean up your folder. For OSX</title><description>When downloading files from the web I usually have a predefined folder where all the downloads from my different browsers are stored. It doesn't take long till that folder grows to quite a &lt;a href="http://modmyi.com/images/pauldanielash/automator-icon.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://modmyi.com/images/pauldanielash/automator-icon.png" width="200" /&gt;&lt;/a&gt;remarkable size. Sorting out the files which are still needed is then a cumbersome and time-consuming process. Therefore,&lt;a href="http://blog.js-development.com/2007/12/clean-up-your-folder.html"&gt; years ago I created a Java console app&lt;/a&gt; which takes care of removing files of a certain age.&lt;br /&gt;
&lt;br /&gt;
Since I own a &lt;a href="http://blog.js-development.com/2009/05/my-new-macbook-pro.html"&gt;Mac&lt;/a&gt; this has become even more easy. For instance, to delete all files from a folder which haven't been accessed for 90 days and more, all you have to do is to create an automator script that executes the following unix shell command:&lt;br /&gt;
&lt;pre class="code"&gt;find /Users/Juri/Downloads/* -type f -atime +90 -exec rm -f {} \;&lt;/pre&gt;Note the usage of the parameter &lt;code&gt;-atime&lt;/code&gt;. According to the man page&lt;br /&gt;
&lt;pre class="code"&gt;-atime n
     File  was  last  accessed n*24 hours ago.  When find figures out
     how many 24-hour periods ago the file  was  last  accessed,  any
     fractional part is ignored, so to match -atime +1, a file has to
     have been accessed at least two days ago.
&lt;/pre&gt;This parameter assures that files which you often touch (open/modify) will not be deleted from the folder. It would be somehow wrong to use &lt;code&gt;-mtime&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;
In addition after the overall cleaning process of the files you should get rid of empty folders which is done by invoking&lt;br /&gt;
&lt;pre class="code"&gt;find /Users/Juri/Downloads/* -type d -depth -empty -exec rmdir {} \;&lt;/pre&gt;&lt;br /&gt;
Now you can combine everything in an Automator script and launch it at login time and voilà. From now on you don't have to care any more about cleaning your downloads folder :)&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;(P.S.: For future reference you may also like to redirect log entries into a file in order to know which files have been deleted)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-1405885873975344250?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_353AT-A5Y3H5TLMYpW-e-4ZjKQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_353AT-A5Y3H5TLMYpW-e-4ZjKQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_353AT-A5Y3H5TLMYpW-e-4ZjKQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_353AT-A5Y3H5TLMYpW-e-4ZjKQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/02/reloaded-clean-up-your-folder-for-osx.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-1396973709686163781</guid><pubDate>Wed, 03 Feb 2010 14:21:00 +0000</pubDate><atom:updated>2010-02-03T15:21:53.115+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Antipatterns</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">.Net</category><category domain="http://www.blogger.com/atom/ns#">Software Design</category><title>Are anonymous Lambda style event handlers a readability killer?</title><description>A standard event handling method in C# looks something like this&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public void SomeOtherMethod()
{
   MyClass aObj = new MyClass();
   aObj.MyCustomEventName += new EventHandler(OnMyCustomEventName);
   ...
}

private void OnMyCustomEventName(object sender, EventArgs e)
{
    //do what you need to
}
&lt;/pre&gt;Pretty straightforward. Now since C# 3.0 you have the possibility to declare anonymous methods of the type&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public void SomeOtherMethod()
{
   MyClass aObj = new MyClass();
   aObj.MyCustomEventName += delegate(Object sender, EventArgs e)
   {
      //do what you need to
   };
}&lt;/pre&gt;This makes it more concise since you define the event handling code directly at the point where you register the event.&lt;br /&gt;
This is, by the way, also possible in Java by declaring anonymous types such as&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public void someOtherMethod(){
   ...
   MyClass aObj = new MyClass();
   aObj.setOnMyCustomEventListener(new IMyCustomEventListener(){

      public void onMyCustomEvent(...){
         //do what you need to
      }

   });
}&lt;/pre&gt;&lt;b&gt;Note:&lt;/b&gt;&lt;code&gt;IMyCustomEventListener&lt;/code&gt; is an interface and nevertheless we use the new to "instantiate" it. How's that possible? Well, this is a language feature which behind instantiates an anonymous object implementing the according interface.&lt;br /&gt;
&lt;br /&gt;
It is very similar to the C# declaration of the event by using anonymous methods. Now, Lambda expression allow you to write this even more concisely&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public void SomeOtherMethod()
{
   MyClass aObj = new MyClass();
   aObj.MyCustomEventName += (s,e) =&amp;gt;
   {
      //do what you need to
   };
}&lt;/pre&gt;Nice, isn't it? In this way defining an event is really fast. The only doubt I have is in terms of readability. Now clearly the example above is perfectly readable, but it is just a dummy example. But consider a method where you have to define lots of event handlers for different components. Then declaring all the handlers in the way above may soon get very smelly.&lt;br /&gt;
Note, beside others, one reason for applying &lt;a href="http://www.refactoring.com/catalog/extractMethod.html"&gt;Extract Method&lt;/a&gt; is for readability purposes. When reading over a method, your eyes should grasp the essence and you should be immediately able to tell what the method is about, although you may not know in detail what - for instance - the internally called method &lt;code&gt;RetrieveExpiredItems(aProductBag)&lt;/code&gt; will do, but according to its name it will retrieve the expired items from an object called &lt;code&gt;aProductBag &lt;/code&gt;and that may be enough because actually you may be interested in something completely different. On the other side, if you code everything in one method you may have substantial difficulties in finding the interesting piece because you're flooded with all the details you won't even care about.&lt;br /&gt;
&lt;br /&gt;
This same principle may also apply to the "inline" definition of such event handlers using Lambda expressions. As long as they're simple "one-liners" it may not pose any major problem, but as soon as the code within these handlers starts to grow it may become problematic.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-1396973709686163781?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HSDDtnO6z2uI0wdiPRB2qGTDYgU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HSDDtnO6z2uI0wdiPRB2qGTDYgU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HSDDtnO6z2uI0wdiPRB2qGTDYgU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HSDDtnO6z2uI0wdiPRB2qGTDYgU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/02/are-anonymous-lambda-style-event.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-3746631412795109868</guid><pubDate>Sun, 31 Jan 2010 09:00:00 +0000</pubDate><atom:updated>2010-01-31T10:00:02.927+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Windows OS</category><category domain="http://www.blogger.com/atom/ns#">OSX</category><category domain="http://www.blogger.com/atom/ns#">Mac</category><title>Time Machine backups to Windows shared network drive</title><description>As some of you may have already read I &lt;a href="http://blog.js-development.com/2009/05/my-new-macbook-pro.html"&gt;acquired a MacBook Pro&lt;/a&gt; about half a year ago and I love it ;) . Now one of the really cool things OS X provides is Time Machine backups.&lt;br /&gt;
&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/n055CqFnjyo&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/n055CqFnjyo&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;br /&gt;
It's so great because you simple don't have to do anything. If at all, you can specify the folders which should be excluded from the backup, but the rest is a completely automated process. Time Machine takes care of creating backups that contain the best possible coverage, starting from hourly, weekly to monthly backups, depending on the remaining space on your backup drive.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://images.apple.com/timecapsule/images/overview_timecapsule_20091202.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="140" src="http://images.apple.com/timecapsule/images/overview_timecapsule_20091202.png" width="320" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;Now, Apple wouldn't be Apple if they wouldn't have a business model behind this thing.They call it &lt;a href="http://www.apple.com/timecapsule/"&gt;Time Capsule&lt;/a&gt; and it is the device which is intented to be the backup drive on the other side of Time Machine. It is more than just a simple external (network capable) HD: it may also function as print server and router.&lt;br /&gt;
&lt;br /&gt;
Anyway, I already bought an external HD about 1 1/2 years ago (I guess). Unfortunately it cannot be attached to the network, but just over USB. So for a while I used to do my backups by manually attaching my HD to the USB port of my MacBook and let Time Machine do its work. However this is cumbersome and you often forget to attach it regularly and moreover, the HD usually stands at some place in your&amp;nbsp;apartment. You're not going to take it around and again, it's nerving to take your notebook there, attach it just for the purpose of doing backups.&lt;br /&gt;
&lt;br /&gt;
So the idea came to my mind of sharing my HD over the network through another computer. I still have my very first notebook, an Acer which is about 6 years old now, I guess. I usually use it as some kind of server, also for sharing my non-network printer to the home wireless. So why shouldn't I also expose my HD?&lt;br /&gt;
A &lt;a href="http://superuser.com/questions/95005/any-experiences-using-time-machine-backup-to-windows-network-drive"&gt;post on Superuser&lt;/a&gt; pointed me &lt;a href="http://adamcohenrose.blogspot.com/2008/02/time-machine-wireless-backup-without.html"&gt;to&lt;/a&gt; &lt;a href="http://serverfault.com/questions/20768/using-whs-for-a-mac-time-machine-backup"&gt;some&lt;/a&gt; &lt;a href="http://www.stocksy.co.uk/articles/Mac/getting_time_machine_to_work_how_i_want/"&gt;interesting&lt;/a&gt; &lt;a href="http://www.macosxhints.com/article.php?story=20080420211034137"&gt;pages&lt;/a&gt;&amp;nbsp;(&lt;a href="http://www.levelofindirection.com/journal/2009/10/10/using-a-networked-drive-for-time-machine-backups-on-a-mac.html"&gt;this one is another good one&lt;/a&gt;). I'm not going to repeat everything since you can get more informations on the linked pages. The main steps are the following:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Activate 'unsupported' network drives for backup&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="code"&gt;defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Create a sparsebundle which will be used by TimeMachine for doing its job. This sparsebundle has to be created &lt;i&gt;locally&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="code"&gt;sudo hdiutil create -size 320g -type SPARSEBUNDLE -nospotlight -volname "Backup of &amp;lt;computer_name&amp;gt;" -fs "Case-sensitive Journaled HFS+" -verbose ~/Desktop/&amp;lt;computer_name&amp;gt;_&amp;lt;mac address&amp;gt;.sparsebundle

&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Share the external HD on your Windows server (or notebook as in my case) and make sure you have the necessary user rights for writing/reading.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Mount the network drive and copy the created sparsebundle on it&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Configure the network drive for backups by referencing it from within the Time Machine configuration&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;You have to pay attention that the hostname you indicate in the .sparsebundle name matches exactly your Mac's hostname. Spaces and strange characters may create problems.&lt;br /&gt;
Moreover I'd suggest to do the first backup directly over a wired network connection since the 1st backup may take quite a while.&lt;br /&gt;
&lt;br /&gt;
I'm now using this backup mechanism for about three weeks and it works&amp;nbsp;seamlessly. When my Mac is within the home wireless network it automatically connects to the shared backup drive and starts creating his hourly backups. Just great :)&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-3746631412795109868?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/H-PTFaxyiu_vVJTqPxWvYwGkgWM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H-PTFaxyiu_vVJTqPxWvYwGkgWM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/H-PTFaxyiu_vVJTqPxWvYwGkgWM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H-PTFaxyiu_vVJTqPxWvYwGkgWM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/01/time-machine-backups-to-windows-shared.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-2903616542535931937</guid><pubDate>Thu, 28 Jan 2010 14:09:00 +0000</pubDate><atom:updated>2010-01-28T15:09:03.883+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HowTo</category><category domain="http://www.blogger.com/atom/ns#">OSX</category><category domain="http://www.blogger.com/atom/ns#">iPhone</category><title>HowTo: Use your iPhone as a remote control for presentations</title><description>My latest post is already a while back but I'm currently extremely busy. More posts will come in February.&amp;nbsp;Today, I successfully presented my talk for the final exam of the "Technical Scientific Communication" course. It consisted of an approximately 10 minutes talk about a technical topic (preferably the current research topic). Using this occasion I have to say that iWorks's Keynote is just amazing. I've used MS PowerPoint, OpenOffice etc for a while, but when it comes to create professional looking presentations, none of them can cope with it.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.logitech.com/repository/3053/png/25041.1.0.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://www.logitech.com/repository/3053/png/25041.1.0.png" /&gt;&lt;/a&gt;But let's come back to the actual topic of this post. When doing such presentations, it is always quite uncomfortable if you don't have a remote pointer and you have to always use your touchpad or notebook's keyboard. It hinders you somehow in your freedom of movement during the presentation. But if you have an iPhone you actually have you're pointer already with you, without knowing ;) . Yesterday evening, Matthias pointed me to a really nice app for the iPhone provided by Logitech. It's called &lt;a href="http://www.logitech.com/index.cfm/494/6367&amp;amp;hub=1&amp;amp;cl=us,en?bit=&amp;amp;osid=9"&gt;TouchMouse&lt;/a&gt;&amp;nbsp;and consists of an iPhone app, freely available on the App Store and a small server as a back-end for the communication between your iPhone and Mac/PC. Yes, it also works for PCs (Windows).&lt;br /&gt;
However, the app isn't just made for the purpose of controlling presentations. What is does is basically to bring your notebook's touchpad to your iPhone.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.logitech.com/repository/3338/jpg/25960.1.0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="372" src="http://www.logitech.com/repository/3338/jpg/25960.1.0.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
So, as the figure shows, you have the left/center/right button and a couple of further configurations that let you customize the app. The best of all: it's totally free!&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Source:&lt;/u&gt;&lt;br /&gt;
&lt;a href="http://www.logitech.com/index.cfm/494/6367&amp;amp;hub=1&amp;amp;cl=us,en?bit=&amp;amp;osid=9"&gt;http://www.logitech.com/index.cfm/494/6367&amp;amp;hub=1&amp;amp;cl=us,en?bit=&amp;amp;osid=9&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-2903616542535931937?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Sb2RlYdSqzIhN5AFQkQPT8BTNYA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Sb2RlYdSqzIhN5AFQkQPT8BTNYA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Sb2RlYdSqzIhN5AFQkQPT8BTNYA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Sb2RlYdSqzIhN5AFQkQPT8BTNYA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/01/howto-use-your-iphone-as-remote-control.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-5406365253768218531</guid><pubDate>Fri, 08 Jan 2010 07:42:00 +0000</pubDate><atom:updated>2010-01-08T08:43:31.217+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HowTo</category><category domain="http://www.blogger.com/atom/ns#">ASP.net</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><title>HowTo: Use globally defined resources in your ASPX code</title><description>When creating localized web applications using ASP.net you may often come across strings which are the same on many of your interface parts. Usually you probably use the VS functionality "Generate local resources" which creates you an appropriate resx file containing the keys of your ASP.net Page or UserControl. But take for instance the simple example of a "save button" having the text "Save". Using the "generate resources" approach will lead to a situation where the text "save" appears in many different resx files. This may render it particularly difficult to make changes afterwards, i.e. when your customer&amp;nbsp;suddenly&amp;nbsp;wants to have the text "save content" instead of "save" alone. It would therefore make perfectly sense to have this kind of text defined globally.&lt;br /&gt;
&lt;br /&gt;
This can be done quite easily:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;u&gt;Add the special ASP.net folder "App_GlobalResources" to your ASP.net project&lt;/u&gt;&lt;br /&gt;
You can do this by right-clicking on the project and then choosing "Add / Add ASP.NET folder / App_GlobalResources".&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Add a new resource file to the created folder&lt;/u&gt;&lt;br /&gt;
To achieve this, right-click on the App_GlobalResources folder you just created, then click "New Item" and choose "Resources file". Give it a meaningful name, i.e. "GlobalResources.resx".&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Add a new entry for your "save" text&lt;/u&gt;&lt;br /&gt;
Add a new entry to the resource file with the key "Button_Save" and the value "Save".&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Now open the ASPX code containing the definition of your button(s)&lt;/u&gt;&lt;br /&gt;
You can now set the localized text from the resource file as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="prettyprint"&gt;&amp;lt;asp:Button id="btnSubmit" runat="server" Text="&amp;lt;%$ Resources:GlobalResources, Button_Save %&amp;gt;"/&amp;gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-5406365253768218531?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PYsSFeiMGGxAlWwmn-CSIdquQWU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PYsSFeiMGGxAlWwmn-CSIdquQWU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PYsSFeiMGGxAlWwmn-CSIdquQWU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PYsSFeiMGGxAlWwmn-CSIdquQWU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/01/howto-use-globally-defined-resources-in.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-8636210674624856752</guid><pubDate>Wed, 06 Jan 2010 16:53:00 +0000</pubDate><atom:updated>2010-02-03T15:26:29.553+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Antipatterns</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Software Design</category><title>Comments smell! Replace them with more expressive code.</title><description>As already pointed out in &lt;a href="http://blog.js-development.com/2009/09/add-semantic-through-your-code-not.html"&gt;that post&lt;/a&gt;, here's another code example:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;...
&lt;b&gt;//300 = Italy&lt;/b&gt;
if(aCompany.NationId == 300)
{
   ...
}
...
&lt;/pre&gt;The comment above the &lt;code&gt;if&lt;/code&gt; clause is definitely a code smell. If you wouldn't have that and you come back three months after releasing the software in search for a bug, you probably don't remember what's the meaning of 300, right? Therefore, refactor it by writing more expressive code:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;...
if(aCompany.NationId == Nation.TypeOf.Italy)
{
   ...
}
...
&lt;/pre&gt;The comment is completely useless now. Every developer in the team will now understand the meaning of this code without any effort. Note, such code can lower the &lt;a href="http://en.wikipedia.org/wiki/Mean_time_to_repair"&gt;mean-time-to-repair (MTTR)&lt;/a&gt; significantly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-8636210674624856752?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7E74v1z3pGWFiutN2mk1ssEJ4a4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7E74v1z3pGWFiutN2mk1ssEJ4a4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7E74v1z3pGWFiutN2mk1ssEJ4a4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7E74v1z3pGWFiutN2mk1ssEJ4a4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2010/01/comments-smell-replace-them-with-more.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-8210103304931266101</guid><pubDate>Wed, 30 Dec 2009 16:15:00 +0000</pubDate><atom:updated>2010-01-03T20:13:57.306+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HowTo</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><category domain="http://www.blogger.com/atom/ns#">jQuery</category><category domain="http://www.blogger.com/atom/ns#">Java Script</category><title>HowTo: Fade out div after some seconds using jQuery</title><description>Today I made a quick change to my blog. I don't know whether many of my readers noticed the possibility of expanding the reading area by clicking on the gray vertical bar which separates the left column with the post content.&lt;br /&gt;
&lt;br /&gt;
Therefore, what I wanted to change was to automatically hide the left navigation bar after a certain amount of time and so to give maximum focus on the written content, which is, after all, the most important part :) .&lt;br /&gt;
Shouldn't be a problem with jQuery and so the first Google query brought me directly to StackOverflow (who wonders ;) ). The raised&amp;nbsp;&lt;a href="http://stackoverflow.com/questions/536502/how-can-i-fade-out-a-div-using-jquer"&gt;question&lt;/a&gt;&amp;nbsp;there&amp;nbsp;is exactly what I needed, I was however not really satisfied by the accepted answer. Its author suggests to use the jQuery's &lt;code&gt;fadeOut&lt;/code&gt; method&lt;br /&gt;
&lt;pre class="prettyprint"&gt;$("#myDiv").fadeOut(5000);&lt;/pre&gt;&lt;br /&gt;
This however does not cause a delay of 5 seconds but specifies the timespan of the fade-out process itself. Being not satisfied about the answer I went ahead in search of an alternative and came up with this solution, which btw is actually a workaround. What I did is to make use of the "fadeTo" method which allows takes two parameters:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;The speed of the process of "fading to". One can indicate milliseconds as well as semantic names like "slow".&lt;/li&gt;
&lt;li&gt;The percentage of opacity, where 1 = 100% opacity.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;I specified it like&lt;br /&gt;
&lt;/div&gt;&lt;pre class="prettyprint"&gt;$("#sidebar-column").fadeTo(15000,1).fadeOut(1000);&lt;/pre&gt;So the process starts immediately and for 15 seconds it fades (an already 100% opaque container) to 100% opacity, i.e. nothing changes. This to simulate the delay. Then the fadeOut will start for a timespan of 1 second. Voilà. You have your delay. Now, of course you can find the "correct" solution, using other jQuery plugins which have been made just for the purpose of creating a delay (like pause(...) ?) etc.&lt;br /&gt;
&lt;br /&gt;
The mentioned solution has some advantages which I'd not disregard:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;it is a simple one-liner&lt;/li&gt;
&lt;li&gt;you don't need any additional plugins&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;Here's my &lt;a href="http://stackoverflow.com/questions/536502/how-can-i-fade-out-a-div-using-jquery/1980197#1980197"&gt;SO contribution&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-8210103304931266101?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ldw_9Uo_cDZ9cGyR1dcqzLfWBno/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ldw_9Uo_cDZ9cGyR1dcqzLfWBno/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ldw_9Uo_cDZ9cGyR1dcqzLfWBno/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ldw_9Uo_cDZ9cGyR1dcqzLfWBno/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/12/howto-fade-out-div-after-some-seconds.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-6797278917504052612</guid><pubDate>Sat, 26 Dec 2009 14:52:00 +0000</pubDate><atom:updated>2009-12-26T15:58:00.984+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">annotated</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">mobile dev</category><category domain="http://www.blogger.com/atom/ns#">Android</category><title>Android SMS activity doesn't fill phone number</title><description>Today while fixing a bug for our current project we develop for the Android phone I found a strange behavior when trying to launch the phone's SMS sender activity. For those of you non-Android-devs, Android has the concept of &lt;a href="http://developer.android.com/reference/android/content/Intent.html"&gt;Intents&lt;/a&gt;.&lt;br /&gt;
&lt;blockquote&gt;An intent is an abstract description of an operation to be performed. [...]&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;i&gt;&lt;a href="http://developer.android.com/reference/android/content/Intent.html"&gt;(from the Android docs)&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/blockquote&gt;This is a really nice mechanism. Basically you launch an Intent, specifying what you'd like to do and those activities out there which may be able to respond to your needs will answer. (a bit simplified of course ;) )&lt;br /&gt;
&lt;br /&gt;
So in our code we launched the phones SMS sender activity by specifying the intent as&lt;br /&gt;
&lt;pre class="prettyprint"&gt;Intent smsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:3330349"));
smsIntent.setType("vnd.android-dir/mms-sms");

startActivity(smsIntent);&lt;/pre&gt;The problem as you can see:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_tF6XjsUy87k/SzYaUwZxvWI/AAAAAAAACfY/yucSGmg0URY/s1600-h/sms_notworking.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/_tF6XjsUy87k/SzYaUwZxvWI/AAAAAAAACfY/yucSGmg0URY/s320/sms_notworking.png" width="218" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;...the phone number that has been passed in the intent-uri is not displayed on the SMS activity as it should. I searched a bit around and well...there shouldn't be "tel:...." in the Uri but rather "smsto:...". Fair enough, although by specifying the type of the intent I'd expect to get it anyway. So what I did is to change the intent Uri to..&lt;br /&gt;
&lt;pre class="prettyprint"&gt;Intent smsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("smsto:3330349"));
smsIntent.setType("vnd.android-dir/mms-sms");

startActivity(smsIntent);&lt;/pre&gt;..expecting to get it to work now: nothing. Still the same result, the activity opens but there's no phone number displayed. So...?! *confused*&lt;br /&gt;
Well, I found that you basically have the following possibilities.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Just specify the Uri. Ok, it's enough, you have all of the needed information encoded in it, but again, additionally specifying the intent type shouldn't be a problem.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;Intent smsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("smsto:3330349"));
//smsIntent.setType("vnd.android-dir/mms-sms");

startActivity(smsIntent);&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Specify the phone number by adding it to the intent bundle data.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;Intent smsIntent = new Intent(Intent.ACTION_VIEW);
smsIntent.putExtra("address", "3330349");
smsIntent.setType("vnd.android-dir/mms-sms");

startActivity(smsIntent);&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;Both will bring you the expected result&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tF6XjsUy87k/SzYgdgLF5pI/AAAAAAAACfc/cAv2qiOv_ls/s1600-h/sms_working.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_tF6XjsUy87k/SzYgdgLF5pI/AAAAAAAACfc/cAv2qiOv_ls/s320/sms_working.png" width="218" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
I understand, specifying the uri containing the "smsto" &lt;b&gt;and&lt;/b&gt;&amp;nbsp;the type is somehow redundant information, but anyway I wouldn't expect that it doesn't work at all.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-6797278917504052612?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3lUyPbNZ-BZJNd6yN2ltBkc57M8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3lUyPbNZ-BZJNd6yN2ltBkc57M8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3lUyPbNZ-BZJNd6yN2ltBkc57M8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3lUyPbNZ-BZJNd6yN2ltBkc57M8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/12/android-sms-activity-doesnt-fill-phone.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_tF6XjsUy87k/SzYaUwZxvWI/AAAAAAAACfY/yucSGmg0URY/s72-c/sms_notworking.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-7497834739364863092</guid><pubDate>Fri, 25 Dec 2009 09:48:00 +0000</pubDate><atom:updated>2009-12-25T10:48:40.310+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Eclipse</category><category domain="http://www.blogger.com/atom/ns#">Software testing</category><title>Creating Test Suites with jUnit 4</title><description>A while back I've &lt;a href="http://blog.js-development.com/2007/11/tdd-junit-38-and-junit-4.html"&gt;posted about how to enable the automatic&lt;/a&gt; (jUnit 3.8-style) creation of test suites in Eclipse. That was necessary for Eclipse 3.1.2 and previous. With Eclipse 3.2 and newer in combination with jUnit 4 there is no such wizard like with jUnit 3.8 which automatically creates you the test suite class, but you can use annotations for defining the jUnit 4 tests to run. So you basically create your test&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public class MyJUnitTest{

   @Before
   public void setUp(){
      //do your setup stuff
   }

   @After
   public void tearDown(){
      //clean up
      //note setUp and tearDown can be named differently as you want
      //I just find it more clear to stick to this naming convention
   }

   @Test
   public void testSomething(){
      //the test
   }
}
&lt;/pre&gt;...and then you define your test suite.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;import org.somepackagename.someprog;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith( Suite.class )
@SuiteClasses( {MyJUnitTest.class} )
public class UnitTests {
}&lt;/pre&gt;&lt;br /&gt;
Then you launch it like you would with any other normal unit test.&lt;br /&gt;
&lt;br /&gt;
I like this grouping in test suites because in this way you go to your main package in your test project and just launch the tests you're interested (unit tests, integration tests...).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-7497834739364863092?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lFdxbHbdGJqbxlVoHjRXU_ErktE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lFdxbHbdGJqbxlVoHjRXU_ErktE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lFdxbHbdGJqbxlVoHjRXU_ErktE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lFdxbHbdGJqbxlVoHjRXU_ErktE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/12/creating-test-suites-with-junit-4.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-4287809277708371645</guid><pubDate>Thu, 10 Dec 2009 09:15:00 +0000</pubDate><atom:updated>2009-12-10T11:53:08.316+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Software Design</category><title>The power and simplicity of the Command pattern</title><description>Never thought of how to implement an "undo" function? Not that easy, huh? People in our architecture class today came up with quite creative solutions: two separate stacks storing operations, versioning of the object to go back etc... All quite complex. Well, I've thought about that already about a year ago, so it was quite easy for me and there you actually see how simple such a task becomes if you know the right pattern (I'll come to it immediately).&lt;br /&gt;
&lt;br /&gt;
The key is actually to encapsulate the operation and the object the operation acts on. If you encapsulate that within an object you're already pretty much done. Every time you perform an operation you create such an object encapsulating that operation.&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://yuml.me/diagram/scruffy;/class/[ICommand%20|%20execute()]" /&gt;&lt;br /&gt;
&lt;br /&gt;
If you knew about it already...yes, it's the Command pattern :) . Now the interface above is the standard implementation, but adding undo is not a major difficulty. You can either add the method to the ICommand interface or create another abstract class/interface UndoableCommand using ICommand. Take for instance the operation "make bold" of a word within a document. Applying the Command pattern and adapting it for undo and redo functions is quite simple&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://yuml.me/diagram/scruffy;/class/[ICommand%20|%20undo();%20execute();%20redo()]^-[BoldCommand],%20[BoldCommand]&amp;lt;&amp;gt;-&amp;gt;[Word]" /&gt;&lt;br /&gt;
&lt;br /&gt;
For each concrete command you implement the interface. So an example implementation of such a BoldCommand could look like&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public class BoldCommand implements ICommand{
   private Word aWord;

   public BoldCommand(Word aWord){
      this.aWord = aWord;
   }

   public void execute(){
      //call some appropriate object that knows how to perform
      //the action, i.e.
      aWord.setBold(true);   
   }

   public void undo(){
      //undoing is easy since we know here what we did previously and
      //we have the reference to the object we acted upon
      aWord.setBold(false);
   }

   public void redo(){
      execute();
   }
}
&lt;/pre&gt;I guess this should look now pretty obvious to you. Of course this is just a simple code for demonstrating the idea. You need some more sophisticated structures that take care of these command objects. For the undo/redo you'd probably have some list that tracks all of these objects, removes old ones etc...&lt;br /&gt;
If you programmed already for the Eclipse platform, you probably came across the IAction interface and Action classes. Well that's one implementation of such a command pattern. They use it quite heavily there.&lt;br /&gt;
&lt;br /&gt;
Now that you know the pattern, think about the solution you came up with previously (2 stacks, operations, undo operations etc..). Quite complicated :) I like this example because I think this example of the undo/redo functionality explains quite clearly the improvement of your code if you know the right - and obviously suitable - pattern.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-4287809277708371645?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/undqbX6tWgFzOB63WuKVDbteliU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/undqbX6tWgFzOB63WuKVDbteliU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/undqbX6tWgFzOB63WuKVDbteliU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/undqbX6tWgFzOB63WuKVDbteliU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/12/power-and-simplicity-of-command-pattern.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-3328023867357009123</guid><pubDate>Wed, 02 Dec 2009 22:39:00 +0000</pubDate><atom:updated>2009-12-03T11:56:01.067+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">mobile dev</category><category domain="http://www.blogger.com/atom/ns#">Android</category><title>MapView doesn't fire onLongClick event</title><description>Here's another curiosity I came across today while programming on my Android project. I was creating a MapView for displaying some interesting stuff on it.&lt;br /&gt;
&lt;br /&gt;
Update: This post got a bit lengthy due to different problems that popped up while I was writing the post. So if you prefer to jump directly due to the final solution, feel free &lt;a href="#solution"&gt;to do so&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Now there are different events the user may interact when having a map on the screen like just simple clicks or even moves when navigating on the map. So first of all I have my MapActivity class which again loads a MapView on it, defined in some layout xml file. So far so good. For reacting on click or move events I had to override the MapActivities "dispatchOnTouchEvent" method.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public class MyMapActivity extends MapActivity {
   ...
   @Override
   public void onCreate(...){
      super.onCreate(...);
      setContentView(R.layout.mymapviewlayout);

      this.mapView = (MapView)findViewById(R.id.myMapView);
      this.mapView.set....
      ...
      this.mapView.setClickable(true);
      ...
   }

   @Override
   public boolean dispatchTouchEvent(MotionEvent ev) {
      int actionType = ev.getAction();
      switch (actionType) {
         case MotionEvent.ACTION_MOVE:
       //react properly
              break;
      }

      return super.dispatchTouchEvent(ev);
   }
   ...
}&lt;/pre&gt;That worked pretty well. Now comes the strange behavior. I wanted to differentiate the action of a simple click (press down with immediate release) from a longer click (press down, hold a while and then release again). A fast search on the Android docs revealed the "setOnLongClickListener(OnLongClickListener)" method. Pretty nice, so I just needed to implement the listener an that's it? Actually that didn't work I adjusted my view s.t. it sets the necessary flags and implements the correct listeners...&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public class MyMapActivity extends MapActivity {
   ...
   @Override
   public void onCreate(...){
      ...
      this.mapView.setClickable(true);
      this.mapView.setLongClickable(true);
      //direct listener implementation
      mapView.setOnLongClickListener(new OnLongClickListener() {
         public boolean onLongClick(View v) {
            //react
            return false;
         }
      });
      ...
   }

   ...
}&lt;/pre&gt;...however with no success. The event just didn't fire. I also tried to adapt the overridden dispatchTouchEvent method s.t. it forwards the event to the MapView like&lt;br /&gt;
&lt;pre class="prettyprint"&gt;@Override
   public boolean dispatchTouchEvent(MotionEvent ev) {
      int actionType = ev.getAction();
      switch (actionType) {
         case MotionEvent.ACTION_MOVE:
       //react properly
              break;
      }

      return this.mapView.dispatchTouchEvent(ev);
   }
&lt;/pre&gt;..which would sound plausible, however with no success.&lt;br /&gt;
&lt;br /&gt;
So the final solution I came up with was to add a &lt;a href="http://developer.android.com/reference/android/view/GestureDetector.html"&gt;GestureDetector&lt;/a&gt; to my MapActivity and delegate all touch events to that object. The according OnGestureListener implements a couple of event handlers, under which also the "onLongPress(...)" event handler. So I had to change my implementation to the following&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public class MyMapActivity extends MapActivity implements &lt;b&gt;OnGestureListener&lt;/b&gt; {
   ...
   &lt;b&gt;private GestureDetector gestureDetector;&lt;/b&gt;

   @Override
   public void onCreate(...){
      super.onCreate(...);
      setContentView(R.layout.mymapviewlayout);

      &lt;b&gt;this.gestureDetector = new GestureDetector(this);&lt;/b&gt;
      &lt;b&gt;this.gestureDetector.setIsLongpressEnabled(true);&lt;/b&gt;

      this.mapView = (MapView)findViewById(R.id.myMapView);
      this.mapView.set....
      ...
      this.mapView.setClickable(true);
      ...
   }

   @Override
   public boolean dispatchTouchEvent(MotionEvent ev) {
      int actionType = ev.getAction();
      switch (actionType) {
         case MotionEvent.ACTION_MOVE:
       //react properly
              break;
      }

      &lt;b&gt;return gestureDetector.onTouchEvent(ev);&lt;/b&gt;
   }
   ...

   //other methods of the OnGestureListener interface
   public void onLongPress(MotionEvent e) {
      ActivityUtils.showToast(this, "Pushed down", 3000);
   }
   ...
}&lt;/pre&gt;The result after doing a "long click" on the map:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_tF6XjsUy87k/SxbriADZ62I/AAAAAAAACfI/qJdPY_2241w/s1600/MapView.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/_tF6XjsUy87k/SxbriADZ62I/AAAAAAAACfI/qJdPY_2241w/s400/MapView.png" width="271" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;That looks like it works :) . Don't ask me why it didn't work by just attaching the OnLongClickListener on the map and dispatching events to the MapView. It's now 11:40 PM and I think it's time to have a bit of sleep.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a name="solution"&gt;Update:&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
Indeed, it was late last night. Today morning when I launched my MapView the onLongClick worked, but everything else didn't work any more including move events click events etc. The reason is obvious: I forward everything to my GestureDetector wherefore the MapView will never get the events.&lt;br /&gt;
Due to a suggestion of Paul (see comments), I checked the inheritance hierarchy of the MapView and it inherits from ViewGroup. The LongClick event is defined on the level of the View object and for some reason the MapView doesn't react on it nor it lets you override the behavior.&lt;br /&gt;
&lt;br /&gt;
So the final solution to the problem is to handle it on your own. What I did is to create my custom MapView which inherits from MapView. On that class I've overriden the onTouch event and made some kind of hack on it to achieve a long-touch event. The approach was basically to measure the time between the MotionEvent.ACTION_DOWN and the MotionEvent.ACTION_UP event.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;public class MyMap extends MapView{
   ...

   public MyMapView(Context context, AttributeSet attrs) {
      super(context, attrs);
   }

   @Override
   public boolean onTouchEvent(MotionEvent ev) {
      if(ev.getAction() == MotionEvent.ACTION_DOWN){
         //record the start time
         startTime = ev.getEventTime();
      }else if(ev.getAction() == MotionEvent.ACTION_UP){
         //record the end time
         endTime = ev.getEventTime();
      }

      //verify
      if(endTime - startTime &amp;gt; 1000){
         //we have a 1000ms duration touch
         //propagate your own event
         return true; //notify that you handled this event (do not propagate)
      }
   }

}
&lt;/pre&gt;What I left out here (since I don't want you to steal your own creativity ;) ) is to handle moves on the map which may also otherwise result in a long click. It's quite simple to fix that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-3328023867357009123?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/eg6ke-AZjARpzoatLBy7xKCbwFY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eg6ke-AZjARpzoatLBy7xKCbwFY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/eg6ke-AZjARpzoatLBy7xKCbwFY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eg6ke-AZjARpzoatLBy7xKCbwFY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/12/mapview-doesnt-fire-onlongclick-event.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_tF6XjsUy87k/SxbriADZ62I/AAAAAAAACfI/qJdPY_2241w/s72-c/MapView.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-3414809927782840453</guid><pubDate>Thu, 26 Nov 2009 19:00:00 +0000</pubDate><atom:updated>2009-11-26T20:00:00.514+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><category domain="http://www.blogger.com/atom/ns#">Software testing</category><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><category domain="http://www.blogger.com/atom/ns#">.Net</category><title>RT: Testing with VS2010 - A Bugs Life</title><description>I'm surely one who &lt;a href="http://blog.js-development.com/search/label/Software%20testing"&gt;loves automated tests&lt;/a&gt;. Having them in place (with appropriate code coverage of course) and seeing the green bar or green check icons (depending on your IDE) just gives you the necessary peace for making changes to your application and for applying concepts like refactoring which otherwise is just as if you'd drive blindly (it may work, but it very much depends on your luck). And not just that, in my opinion writing unit tests makes you produce better, more loosely coupled code, 'cause otherwise testing would just be a nightmare. And this pushes you towards using best practices approaches like dependency injection, layering and so on. The only problem is that it is sometimes hard to motivate people to jump on board since they do not immediately recognize the value of automated testing. :(&lt;br /&gt;
&lt;br /&gt;
I'm actually coming from the jUnit world but while diving recently into .Net development I got in touch with MS Tests, concepts like data-driven tests and the whole test-integration into MS's Visual Studio IDE. And I have to admit that I really like Microsoft's recent efforts to strive for best practices like &lt;a href="http://www.asp.net/mvc/"&gt;MVC &lt;/a&gt;(or MVVM in WPF) and Unit testing.&lt;br /&gt;
&lt;br /&gt;
Here I post a very nice presentation from a former work mate and colleague, &lt;a href="http://peitor.blogspot.com/"&gt;Peter&lt;/a&gt;, hold on a user group. It's about the awesome integration of testing into the new VS2010 IDE. Enjoy.&lt;br /&gt;
&lt;div id="__ss_2532322" style="text-align: left; width: 425px;"&gt;&lt;a href="http://www.slideshare.net/PeterGfader/testing-with-vs2010-a-bugs-life" style="display: block; font-family: Helvetica,Arial,Sans-serif; font-size-adjust: none; font-size: 14px; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; margin: 12px 0pt 3px; text-decoration: underline;" title="Testing with VS2010 - A Bugs Life"&gt;Testing with VS2010 - A Bugs Life&lt;/a&gt;&lt;object height="355" style="margin: 0px;" width="425"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=vs2010-testing-a-bugs-life-peter-gfader-v1-0-091118180249-phpapp02&amp;rel=0&amp;stripped_title=testing-with-vs2010-a-bugs-life" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=vs2010-testing-a-bugs-life-peter-gfader-v1-0-091118180249-phpapp02&amp;rel=0&amp;stripped_title=testing-with-vs2010-a-bugs-life" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;div style="font-family: tahoma,arial; font-size: 11px; height: 26px; padding-top: 2px;"&gt;View more &lt;a href="http://www.slideshare.net/" style="text-decoration: underline;"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/PeterGfader" style="text-decoration: underline;"&gt;Peter Gfader&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-3414809927782840453?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dmeWB1TQbO9brbDasJrrFCk0RT8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dmeWB1TQbO9brbDasJrrFCk0RT8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dmeWB1TQbO9brbDasJrrFCk0RT8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dmeWB1TQbO9brbDasJrrFCk0RT8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/11/rt-testing-with-vs2010-bugs-life.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-8003461754059517600</guid><pubDate>Thu, 26 Nov 2009 07:45:00 +0000</pubDate><atom:updated>2009-11-26T10:05:31.870+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HowTo</category><category domain="http://www.blogger.com/atom/ns#">Web dev</category><category domain="http://www.blogger.com/atom/ns#">Java Script</category><title>HowTo: Include JavaScript file from JavaScript code</title><description>Recently a colleague asked me on how to add a JavaScript file reference to an HTML document from within JavaScript code. It's actually quite easy. All you need is to create the appropriate element and attach it to the HTML document's dom structure on the appropriate position, i.e. the head element. The following JavaScript does the job.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;function loadScript(src) {
   var script = document.createElement("script");
   script.type = "text/javascript";
   document.getElementsByTagName("head")[0].appendChild(script);
   script.src = src;
}
&lt;/pre&gt;And then call it from within your JavaScript code with&lt;br /&gt;
&lt;pre class="prettyprint"&gt;loadScript('http://someurl.com/test.js');&lt;/pre&gt;&lt;br /&gt;
Similarly you may want to attach a JavaScript function programmatically to the HTML body's onLoad event. This can be achieved with the following function&lt;br /&gt;
&lt;pre class="prettyprint"&gt;function addLoadEvent(func) {
   var old = window.onload;
   if (typeof window.onload != 'function') {
      window.onload = func;
   } else {
      window.onload = function() {
         old();
         func();
      }
   }
}
&lt;/pre&gt;And then by calling it similarly as in the loadScript function&lt;br /&gt;
&lt;pre class="prettyprint"&gt;addLoadEvent(&amp;lt;someJavaScriptFunction&amp;gt;);&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-8003461754059517600?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NtTdCioOvPHJM-bA4WQ7ej-W4Ac/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NtTdCioOvPHJM-bA4WQ7ej-W4Ac/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NtTdCioOvPHJM-bA4WQ7ej-W4Ac/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NtTdCioOvPHJM-bA4WQ7ej-W4Ac/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/11/howto-include-javascript-file-from.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-8533878864571868987</guid><pubDate>Tue, 24 Nov 2009 21:25:00 +0000</pubDate><atom:updated>2009-11-24T22:25:10.638+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">mobile dev</category><category domain="http://www.blogger.com/atom/ns#">Android</category><title>Implementing the onTouchEvent for the MapActivity</title><description>Android View classes expose an onTouchEvent(MotionEvent ev) method. As the name already suggests, by overriding this method you can handle touch events done by the user on the current view.&lt;br /&gt;
&lt;pre class="prettyprint"&gt;@Override public boolean onTouchEvent(MotionEvent event) {
   int action = event.getAction();
   switch (action) { 
      case (MotionEvent.ACTION_DOWN) : // Touch screen pressed
         break; 
      case (MotionEvent.ACTION_UP) : // Touch screen touch ended
         break; 
      case (MotionEvent.ACTION_MOVE) : // Contact has moved across screen
         break; 
      case (MotionEvent.ACTION_CANCEL) : // Touch event cancelled
         break;
   } 
   return super.onTouchEvent(event);
&lt;/pre&gt;Now when you have a MapActivity you're tempted to do the same, however this won't work. The handler isn't being executed. I didn't find the exact reason for this behavior yet. Probably the reason is that the MapActivity doesn't automatically forward the event to the registered MapView or it just doesn't get notified about the event, since the motion event actually occurs on the MapView itself and not its parent, the MapActivity.&lt;br /&gt;
&lt;br /&gt;
What can be done instead is to either register the event directly on the MapView&lt;br /&gt;
&lt;pre class="prettyprint"&gt;mapView.setOnTouchListener(new OnTouchListener() {
  
 public boolean onTouch(View v, MotionEvent event) {
  // TODO Auto-generated method stub
  return false;
 }
});
&lt;/pre&gt;..or to override the MapActivity's dispatchTouchEvent(MotionEvent). What has to be considered however is to appropriately forward the event in this case. For overriding event handlers, the Android &lt;a href="http://developer.android.com/reference/android/view/View.html#onTouchEvent%28android.view.MotionEvent%29"&gt;API suggests&lt;/a&gt; to&lt;br /&gt;
&lt;blockquote&gt;Returns: True if the event was handled, false otherwise. &lt;br /&gt;
&lt;/blockquote&gt;Now if you catch some touch event and you do your according processing, then you have to be aware that if you return true, the onTouch event won't be propagated, with the side-effect that the user won't be able to move on the map (or better "move the map on the screen"). Therefore, while in other cases you would return true after handling the event, in this specific case of the MapActivity you may consider not returning (or returning false) and just propagating the event by invoking super.dispatchTouchEvent(...).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-8533878864571868987?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JCuTvLoAAQP_UFhEfFDZqWorMT4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JCuTvLoAAQP_UFhEfFDZqWorMT4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JCuTvLoAAQP_UFhEfFDZqWorMT4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JCuTvLoAAQP_UFhEfFDZqWorMT4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/11/implementing-ontouchevent-for.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-1858278425559884341</guid><pubDate>Fri, 20 Nov 2009 12:40:00 +0000</pubDate><atom:updated>2009-11-20T13:40:53.075+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><title>Visual Studio intellisense not working properly</title><description>Recently a work mate pointed me out that my Visual Studio &lt;a href="http://en.wikipedia.org/wiki/Intellisense"&gt;Intellisense &lt;/a&gt;seemed to not work correctly. When writing...&lt;br /&gt;
&lt;pre class="prettyprint"&gt;this.Page.GetPostBackClientEvent(
&lt;/pre&gt;...the info with the remaining parameters should appear automatically which was not the case on my machine. I actually hadn't noticed that before since you can just press CTRL+SHIFT+SPACE within the method call and you will get the parameter info.&lt;br /&gt;
&lt;br /&gt;
Nevertheless I tried to figure out the reason and I was already fearing that some 3rd-party VS add-in may have broken my Intellisense and that I'd have to invoke "&lt;a href="http://blog.js-development.com/2009/10/visual-studio-2010-beta2-cannot-start.html"&gt;devenv.exe /resetuserdata&lt;/a&gt;" (which however is a pain). Then I found this setting inside the VS options dialog:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_tF6XjsUy87k/SwaNu1f20lI/AAAAAAAACeo/0McYKu3yvRU/s1600/IntellisenseStoppedWorking.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_tF6XjsUy87k/SwaNu1f20lI/AAAAAAAACeo/0McYKu3yvRU/s640/IntellisenseStoppedWorking.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;From the "grayed-out" checkbox I assume that some configuration was really damaged since otherwise it should either be in the disabled or enabled state. Anyway, ticking the checkbox in again solved my issue :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-1858278425559884341?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lZcammE9cNbVPxJzHbhGoe8qC1w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lZcammE9cNbVPxJzHbhGoe8qC1w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lZcammE9cNbVPxJzHbhGoe8qC1w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lZcammE9cNbVPxJzHbhGoe8qC1w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/11/visual-studio-intellisense-not-working_20.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_tF6XjsUy87k/SwaNu1f20lI/AAAAAAAACeo/0McYKu3yvRU/s72-c/IntellisenseStoppedWorking.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5211228043243414701.post-6042514662609573196</guid><pubDate>Wed, 11 Nov 2009 08:08:00 +0000</pubDate><atom:updated>2009-11-11T09:08:57.190+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HowTo</category><category domain="http://www.blogger.com/atom/ns#">mobile dev</category><category domain="http://www.blogger.com/atom/ns#">Android</category><title>HowTo: Get the selected list index on Android Activity from context menu event</title><description>Consider the situation where you have an Activity displaying a list of items. You have a context menu and a normal option menu. When pressing the option menu button, you can get the selected item and index as follows:&lt;br /&gt;
&lt;pre class="prettyprint"&gt;//the selected index
int index = listView.getSelectedItemPosition();

//selected item
Object selObj = listView.getSelectedItem();
&lt;/pre&gt;It is as simple as that. If you registered a context menu on the list, then the situation changes slightly and the "getSelectedItemPosition()" will fail. Instead, you have to do something like this&lt;br /&gt;
&lt;pre class="prettyprint"&gt;AdapterView.AdapterContextMenuInfo menuInfo;
menuInfo = (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
int index = menuInfo.position;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5211228043243414701-6042514662609573196?l=blog.js-development.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TfKH5Lrj59sm_yZ7xM8r-jZFCes/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TfKH5Lrj59sm_yZ7xM8r-jZFCes/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TfKH5Lrj59sm_yZ7xM8r-jZFCes/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TfKH5Lrj59sm_yZ7xM8r-jZFCes/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.js-development.com/2009/11/howto-get-selected-list-index-on.html</link><author>noreply@blogger.com (Juri Strumpflohner)</author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total></item></channel></rss>
