Posterous
Lars is using Posterous to post everything online. Shouldn't you?
Lf_thumb
 

The Finer Stuff

Git: Create versions using the 'tag' command

You can use the 'tag' command in Git to create human readable revisions of your software.

Examples:

Create a version / named revision

git tag -a 1.0 -m "Version 1.0"

Remove a tag

git tag -d 1.0

If you are using a remote server (like github) to manage your Git repository, you must

Push a tag to a remote repository

git push --tags origin master

or

git push --all origin master

Fix / Restart Networking when using VMware Fusion

Just a quick hint:

Sometimes it happens that networking in virtual machines under VMware Fusion stops working. To fix this, you can use the boot script command located in 

"/Library/Application\ Support/VMware\ Fusion"

The available options are:

{--start|--stop|--restart}


Example: sudo /Library/Application\ Support/VMware\ Fusion/boot.sh --restart


More information can be found here:

http://communities.vmware.com/docs/DOC-2527

Zimbra Complete Demo Fail

I'm glad even geniuses produce beginner's errors!

Git saved my day - restore accidentally deleted files using Git version control

Today I somehow accidentally deleted some source code files in Intellij IDEA. I don't know how this exactly happened - I must have clicked the wrong menu item.

Because I'm using Git for version control I could recover the files immediately (see below).

To show deleted files use the command:

"git ls-files -d"

To restore the deleted files use:

"git ls-files -d | xargs git checkout --"

(without the quotation marks of course).

The source for this information can be found here:

http://lists.freedesktop.org/archives/xorg/2006-October/018572.html

So, thanks Git!

 

 

Using Display Tag Column Links with Multiple Parameters

[FSR => For Self Reference]

Display tag (http://displaytag.sf.net) is a wonderful tag library you can use to show tabular data in Java Server Pages (JSP).

Display tag has a lot of options but the live examples don't show an easy way to create columns containing links with multiple parameters.

An easy way to create such a column is combining Display tag with JSTL like this:

<display:table name="objectlist" class="table" id="object" requestURI="">
  <display:column property="objectattribute1" titleKey="i18nColumnTitleKey"/>
  <display:column titleKey="i18nColumnTitleKey">
    ${object.displayAttribute}
  </display:column>
</display:table>

You can find (and edit) this snippet on gist: http://gist.github.com/1672

 

 

Tricking Struts2 Multiple Submit Buttons

In one of my last projects I needed multiple submit buttons for one form. The Struts2 website contains information about  ways to accomplish this - see

http://struts.apache.org/2.x/docs/multiple-submit-buttons.html

There are two approaches:

One uses Strings which does work but can't be recommended because the Strings are fixed in code and it doesn't work with i18n (at least if your button name contains special characters like the German Umlaut).

The other approach is much more elegant (taken from the website mentioned above):

 

class MyAction extends ActionSupport {
   private boolean submit;
   private boolean clear;

   public void setSubmit(boolean submit) {
      this.submit = submit;
   }
   public void setClear(boolean clear) {
      this.clear = clear;
   }

   public String execute() {
      if (submit) {
         doSubmit();
         return "submitResult";
      }
      if (clear) {
         doClear();
         return "clearResult";
      }
      return super.execute();
   }
}

The problem is: This just doesn't work because Struts2 can't convert the Strings provided by the request to booleans.

To make this solution work, change the code as follows:

 

private boolean submit = false;
private boolean clear = false;

public void setSubmit(boolean submit) {
  this.submit = true;
}

public void setClear(boolean clear) {
  this.clear = true;
}

I admit this is an ugly hack and not elegant (your IDE should tell you), but it works and does not destroy i18n.

Starting fresh!

After several years of maintaining a blog on several platforms like Blogger or Wordpress, I've decided in 2006 that I don't have enough time writing blog posts.

Now I've decided to restart blogging with this new and fresh platform called "posterous".

The technologies which I'll most likely cover are:

  • Ruby and Rails development
  • Java (EE) development
  • Mac and Linux platforms
  • Integration technologies

The name "The Finer Stuff" is a song title from one of my favorite bands called "The Quireboys" (http:/www.quireboys.com).

You can also reach me on twitter (if it's not down): http://twitter.com/penguintux

Stay tuned!

11
To Posterous, Love Metalab