Tuesday, December 10, 2013

Convert SSH keypairs generated using PuttyGen into key-pairs used by ssh-agent


  1.     Open PuttyGen
  2.     Click Load
  3.     Load your private key
  4.     Go to Conversions->Export OpenSSH and export your private key
  5.     Copy your private key to ~/.ssh/id_rsa
  6.     Create the RFC 4716 version of the public key using ssh-keygen

        ssh-keygen -e -f ~/.ssh/id_rsa > ~/.ssh/id_rsa_pub.tmp
  7.     Convert the RFC 4716 version of the public key to the OpenSSH format:

        ssh-keygen -i -f ~/.ssh/id_rsa_pub.tmp > ~/.ssh/id_rsa.pub

Above steps also work to use your ppk file with Cygwin password-less login.

Monday, February 22, 2010

Is it safer to use SimpleDateFormat?

SimpleDateFormat is not thread-safe.

So you can do one of the following:
* Wrap the SimpleDateFormat class to synchronize format and parse methods. (looks like a heavy handed solution!)
* Use apache-commons-lang FastDateFormat - but doesn't do parsing !

Sunday, March 15, 2009

Basic softwares for a computer

Recently I reinstalled windows xp on my laptop.( I do this atleast four times a year! BREAK AND LEARN )

After that I got the real pain of installing all the necessary softwares to start with. But I keep forgetting all those s/w and links to them. (I know...Just google for them) So thought of scribbling some links here which I used.

1. Install all windows updates.
2. Antivirus (Get your own copy. I use F-Secure).
3. Firefox
4. Firefox plugins and addons
5. VLC Player
6. Flash Get Download manager
7. Real Player
8. 7Zip

Sunday, December 28, 2008

Remove wicket:id attribute

If you want to remove the wicket:id attributes from the generated html source,
you can call the method setRenderBodyOnly(true) on the particular component.

In case you want to remove it from all the pages, then use Settings.setStripWicketTags on the WebApplication.

Sunday, November 23, 2008

AJAXified Confirmation box - Wicket

I have a ajax version of the confirmation box which can be used for Ajax button or Ajax Links.

import org.apache.wicket.ajax.calldecorator.AjaxCallDecorator;

/**
* Javascript Confirmation box for ajax components.
* Can be used for confirmation before deletion of a record.
*
* @author Srikanth NT
*/
public class ConfirmationBoxAjaxRenderer extends AjaxCallDecorator {

/** Serial Version UID. */
private static final long serialVersionUID = 284826838568155159L;

/** Message to be desplayed in the confirm box. */
private String message;

/**
* Constructor.
* @param message Message to be shown in the confirm box.
*/
public ConfirmationBoxAjaxRenderer(final String message) {
super();
this.message = message;
}

/**
* @param script existing script around the component.
* @return modified string.
* @see org.apache.wicket.ajax.calldecorator.AjaxCallDecorator#decorateScript(java.lang.CharSequence)
*/
@Override
public CharSequence decorateScript(final CharSequence script) {
return "if(!confirm('" + message + "')) return false;" + script;
}

}


Enjoy !!!