21 November 2011

Hudson - Continuous Integration

People (developers) pricier
Computers Cheaper
Why not use more computers than people?

Hudson in many companies used (not in Google?)

community release every week

detects changes
record results
send notifications

cron - before hudson (+some customization using perl)
can send emails only not anymore

hudson - aggregate results, from different platform, different JVMs and so on (great feature)

hudson has plugins -[]-> findBug plugin

keep track of changes

capable of hosting more than one project using in one hudson

JNLP Launch for slaves who can not see master

hudson can install JDK for you! Different versions!

hudson kills processes used for making the builds and won't let them live longer than needed.

hudson on EC2 (Cloud) (best on Amazon)

3 / 4 working full-time on hudson core

3 November 2011

VM arguments

Have you ever wondered where that value came from in a Java program? One place to look for is the VM arguments. They are set in the system and not when you are writing your code.

A code like this will give you some good understanding of VM arguments.

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;

RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
List arguments = RuntimemxBean.getInputArguments();
Iterator iterator = arguments.iterator();
System.out.println("VM arguments");
int i=0;
System.out.println("Number of VM arguments :"+i);

1 November 2011

Ultimate guide to online social privacy

With emerge of G+, social life on the web has come to a new era. An era, that you can not ignore it. There are lots of advantages in it. A simple sample is a search result, Google will return results that your circles suggest you, and if you are working on testNG as a newbie, you always would appreciate its creators (C├ędric Beust @ http://beust.com/weblog/ & https://plus.google.com/u/0/108840253750748459271/posts) +1 on testNG links. On the other hand, there is always concerns privacy issues. I am going to suggest some steps in order to protect your online social privacy as much as possible. These steps make your life more private to third parties and not the social network (e.g. Google+, twitter or Facebook) you are using. Let me make it more clear by making an example, let's say you comment on an image in Facebook, after a while you decide that you don't want everyone know that you care about that specific photo and delete that comment. However, as all we know this would be a logical delete in Facebook data center, they are just marking your comment as deleted and won't ever showing that to you or anyone else, but they keep that in their data center to make sure they know as much about you as possible. If you try this on Google+, it would be even more transparent, comment on a photo, then delete it, after deletion you would still get notifications on that photo.

These are my ultimate rule to online privacy:

  • Do not retweet, twitter treat retweet differntly than regular tweets generated by you. Try copying pasting it and give author credit by using @ sing and his/her id
  • After a while, use tweeterwhipe on your account, http://twitwipe.com/login.php this is the best I have found, you will give it access to your tweets, based on your number of tweets, it will delete all tweets, it might take a while if you have lots of tweets
  • I really like twitter for being so open, you can delete all your tweets (you can not do that in your Facebook, even manually)

  • Use like as less as possible specially on webpages outside Facebook. If you have to use Like and nothing else on the world make you happier than hitting Like button, do it. What I suggest is to have a Trace folder/tag in your favorite bookmark and bookmark that page.
  • Do visit your wall often (e.g. once a week), your wall shows all your interactions on Facebook, like any comments you've made recently. Go over old comments of yours and do delete them, do delete tags of yourself in photos as well (or you can set photos of you to be only available to yourself and no one else, your choice. I selected the later one, I do like to have access to all my photos on Facebook)
  • Do visit the Trace folder/tag in your bookmark and unLike the pages, photos, groups that you've liked.

  • Google+ is somehow the same as Facebook, it is more transparent in terms of privacy (at least in my view) but still there is not API announced for it yet. So you can not expect to have whipe all your activities on G+ using some tools like twitwipe. You have to do that manually.
  • There is not wall in G+, you have to visit your notifications page (https://plus.google.com/u/0/notifications/all) and post page (e.g. https://plus.google.com/101413016003587078317/posts this is my G+) to be able to see all your transactions with G+. You can delete your posts, your comments, your +1s.

Remember, it is nice to comment on friend's engagement photo, congradulate him/her on his/her best day of his/her life. But there is no point to leaving it there, if he replied back to you and thanked you on that. It means that he received your message. Keeping your comment there is like saving your voice-mails for eternity. I am sure there wouldn't be any use for you, is it? So it is up to you to delete that.

Access EJB via HTTP in JBoss AS

If you are trying to acccess EJB through HTTP, you need to use org.jboss.naming.HttpNamingContextFactory for your context factory. However, there is only one small twitch in using that. You need to specify credentials accessing that invoker. This is what you need to add:

env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");

This is complete code:

Hashtable env = new Hashtable();
env.put(Context.PROVIDER_URL, "http://localhost:8080/invoker/JNDIFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
Context ctx = new InitialContext(env);
ejbTestRemote obj = (ejbTestRemote) ctx.lookup("ejbTest/remote");

This is how it looks like if you are using NamingContextFactory:

Hashtable env = new Hashtable();
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
Context ctx = new InitialContext(env);
ejbTestRemote obj = (ejbTestRemote) ctx.lookup("ejbTest/remote");