Useful developer tools: Smart Draw 7 -- for drawing good quality diagrams. Loads of templates to quickly do the task(free). Jude -- Very easy UML developer tool(free). JProfiler -- To profile java application(10 day licence free). Profiler4j -- Opensource profiler for java wink - A good screen capture/presentation tool . Can convert to compressed swf, etc. http://www.debugmode.com/wink/ freemind - a opensource mind mapping tool. currports - for getting the port information on windows. BareTail - A linux tail for windows Archiva - Surround SCM Test Track ProBug tracker. Better use free JIRA bug tracker instead. Mingle - highly recommended for agile process management. But pricy! Sonar - Code report and monitoring app. PuTTY Connection Manager - My favourite. Manage multiple putty consoles in this tab based connection manager. Also the windows can be arranged and split up..excellent!! DownThemAll - Good when you want to download large sized files on firefoxCapistrano - automating remote tasks. Works only for linux Crucible - Code review tool remotely. Confluence- collaboration software. (news, etc) Perfect Macro Recorder (http://www.perfectiontools.com/) for automation Best firefox plugins for developers:Others:
- LightShot-- Nice screenshot add-on.
- Firebug -- Best of the breed, javascript debugging, DOM explorer
- LiveHttpHeaders -- shows request header
- UrlParams -- shows get and post params
- iMacros -- macro to automate work.
- tamperData - to check post/get request in browsers..my fav!
Secure Login - To auto fill login submission.
- web developer - html, css, xhtml compliance, table border...good tool for html development
- bugmenot- to auto login site with dummy password
- autopager - reduce clicks while searching
Firefox AutoFill address bar As you type a web site address into Firefox's location bar, by default a dropdown with suggestions based on your history expands, and you can use the down arrow key to select one. For more aggressive URL auto-completion, head on into Firefox's
- ImgLikeOpera -- save bandwidth
- ScribeFire -- Quickest way to blog from firefox. Type about:config in browser url Then search and update the property display.history.numbertoshow (default is 10) Restart browser. This should list more blogs
- GSpace --virtual file system
- del.ico.us -- online tagging (book marks)
Autocomplete Manager 2.0
about:config
area and set thebrowser.urlbar.autoFill
For more check http://lifehacker.com/software/firefox-tip/enable-firefox-address-bar-autocompletion-313533.php value to true.Firefox Memory Optimization (Ref http://nicusor.com/internet/firefox-memory-optimization/ )
Ref: http://c4lpt.co.uk/Top100Tools/ Firefox plugin development : http://www.gmacker.com/web/content/tutorial/firefox/firefoxtutorial.htm http://www.captain.at/howto-firefox-toolbar-tutorial.php http://www.slideshare.net/skeevs/mozilla-firefox-extension-development/ Tools for firefox plugin development extension developer extension https://addons.mozilla.org/en-US/firefox/addon/7434/ spket ide XUL booster Windows XP performance tuning:
- Open Firefox browser, go to address bar, type about:config and hit enter
- You’ll see a page full with text under 4 columns: Preference Name, Status, Type, Value
- Right-click anywhere on that page and select New -> Boolean
- You’ll get prompted to enter a Preference Name - enter this: config.trim_on_minimize and hit enter
- You’ll be prompted for a value - select True and hit enter
- That’s it - close Firefox and open it again!
- Now, whenever you minimize your Firefox, the amount of memory used will be reduced to approximately 20%. Minimize Firefox and see what happens
- Enable network.http.proxy.pipelining to true
- Enable network.http.piplelining to true
- Enable network.http.pipelining.max... to 30 from 4
- create integer nglayout.initialpaint.delay and set value to 0
- Right click my computer-- properties -- advanced -- performance -- Select adjust for best performance.Appy.
- click start -- run -- msconfig -- startup -- disable all ( note do selective disable if u want to have some programs in task bar).
- Go to start -- all programs -- accessories -- system tools -- disk clean up. This will clean up all crap.
Powered by ScribeFire.
Monday, June 30, 2008
Useful developer tools , Fire fox plugins and tweaks
Tuesday, April 8, 2008
Software tools
More links
http://weierophinney.net/matthew/archives/101-Using-Windows-XP.html
<br /><br />
Friday, April 4, 2008
Movies To watch
- The art of negative thinking
- the pursuit of happiness
- Once you are born
- We shall overcome
- For more sun
- Blind flyers
- The best of youth
- The edge of heaven
- Little miss sunshine
- An inconvenient truth
- Happy Feet
Monday, March 24, 2008
Code Generator
More to come soon....![]()
Thursday, March 20, 2008
Cobertura- junit coverage tool
First, you need to add a task definition to the build.xml file. This top-level
taskdef
element specifies that the cobertura.jar file is in the current working directory:<taskdef classpath="cobertura.jar" resource="tasks.properties" /> For eclipse IDE, you need to add the cobertura.jar, junit.jar in the global path of Ant through Eclipse--} preferences--} Ant --} Global entry.
Next, you need a
cobertura-instrument
task that adds the logging code to the already compiled class files. Thetodir
attribute instructs where to put the instrumented classes. Thefileset
child element specifies which .class files to instrument:<target name="instrument"> <cobertura-instrument todir="target/instrumented-classes"> <fileset dir="target/classes"> <include name="**/*.class"/> </fileset> </cobertura-instrument> </target>
You run the tests with the same type of Ant task that normally runs the test suite. The only differences are that the instrumented classes need to appear in the classpath before the original classes, and you need to add the Cobertura JAR file to the classpath:
<target name="cover-test" depends="instrument"> <mkdir dir="${testreportdir}" /> <junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true"> <formatter type="plain" usefile="false"/> <!-- Normally you can create this task by copying your existing JUnit target, changing its name, and adding these next two lines. You may need to change the locations to point to wherever you've put the cobertura.jar file and the instrumented classes. --> <classpath location="cobertura.jar"/> <classpath location="target/instrumented-classes"/> <classpath> <fileset dir="${libdir}"> <include name="*.jar" /> </fileset> <pathelement path="${testclassesdir}" /> <pathelement path="${classesdir}" /> </classpath> <batchtest todir="${testreportdir}"> <fileset dir="src/java/test"> <include name="**/*Test.java" /> <include name="org/jaxen/javabean/*Test.java" /> </fileset> </batchtest> </junit> </target>>
The Jaxen project uses JUnit as its test framework, but Cobertura is framework agnostic. It works equally well with TestNG, Artima SuiteRunner, HTTPUnit, or the home-brewed system you cooked up in your basement.
Finally, the
cobertura-report
task generates the HTML files you saw at the beginning of the article:<target name="coverage-report" depends="cover-test"> <cobertura-report srcdir="src/java/main" destdir="cobertura"/> </target>
The
srcdir
attribute specifies where the original .java source code files reside. Thedestdir
attribute names the directory where Cobertura should place the output HTML.Once you've added similar tasks to your own Ant build file, you generate a coverage report by typing:
% ant instrument % ant cover-test % ant coverage-report
Thursday, February 7, 2008
Internationalization utility
This utility is just to extract static text out of a HTML/JSP and put in the property file. The static text is replaced with [spring:message key="xyz /].
Just provide input and output folders and all the i18n message are extracted to srcFolder\messages_en_US.properties file and JSP/HTML are updated.
Code is below:
/**
*
*/
package parser.htmlParser;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import au.id.jericho.lib.html.Element;
import au.id.jericho.lib.html.OutputDocument;
import au.id.jericho.lib.html.Segment;
import au.id.jericho.lib.html.Source;
import au.id.jericho.lib.html.TextExtractor;
/**
* @author Sandeep.Maloth
*
*/
public class JerichoInternationalizer {
final static String SRC_DIR_NAME = "D:\\ProjectRelated\\evaluation\\liferay4.3.2\\webapps\\cmpWeb2\\WEB-INF\\jsp";
final static String DSTN_DIR_NAME = "D:\\ProjectRelated\\evaluation\\liferay4.3.2\\webapps\\cmpWeb2\\WEB-INF\\jsp\\TEMP";
final static String FILE_NAME = "articledisplay_view.jsp";
static Map messageKeyValueHolder = new LinkedHashMap();
static Map messageValueKeyHolder = new LinkedHashMap();
static Map elementsToReplace = new LinkedHashMap();
static int counter = 1;
/**
* @param args
* @throws IOException
* @throws Exception
*/
public static void main(String[] args) throws Exception, IOException {
doProcess(SRC_DIR_NAME, DSTN_DIR_NAME );
storeMessages(SRC_DIR_NAME);
System.out.println(messageKeyValueHolder);
System.out.println(messageValueKeyHolder);
}
private static void doProcess(String srcDirName, String dstnDirName) throws IOException, FileNotFoundException, Exception {
File dir = new File(srcDirName);
String files[] = dir.list();
for (int i = 0; i < files.length; i++) {
String fileName = files[i];
final File fileObject = new File(srcDirName, fileName);
if (fileObject.isDirectory()) {
String tempSrcDir = srcDirName + "\\" + fileName;
final String tempDstnDirName = dstnDirName + "\\"+fileName;
doProcess(tempSrcDir, tempDstnDirName);
} else {
if (!(fileName.toUpperCase().endsWith("JSP") || fileName.toUpperCase().endsWith("HTML"))) {
System.out.println("Skipping " + fileName);
continue;
}
System.out.println("Parsing .... " + fileName);
Source source = new Source(new FileInputStream(fileObject));
source.fullSequentialParse();
final List childElements = source.getChildElements();
extractMessages(childElements, source, fileName);
// The extracted messages will be in elementsToReplace and need
// to be replaced in the source
Set entrySet = elementsToReplace.entrySet();
OutputDocument outputDocument = new OutputDocument(source);
for (Iterator iter = entrySet.iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
Segment content = (Segment) entry.getKey();
String value = (String) entry.getValue();
outputDocument.replace(content, value);
}
final File dstnDir = new File(dstnDirName);
if (!dstnDir.exists()) {
dstnDir.mkdirs();
}
final File tempFile = new File(dstnDirName, fileName);
FileWriter fileWriter = new FileWriter(tempFile);
outputDocument.writeTo(fileWriter);
fileWriter.close();
elementsToReplace.clear();
System.out.println();
}
}
}
private static void storeMessages(String dstnDirName) throws FileNotFoundException, IOException {
Set msgsEntrySet = messageKeyValueHolder.entrySet();
FileWriter fileWriter = null;
StringBuffer sbuf = new StringBuffer();
for (Iterator iter = msgsEntrySet.iterator(); iter.hasNext();) {
final Object object = iter.next();
System.out.println(object);
Map.Entry entry = (Map.Entry) object;
String key = (String) entry.getKey();
String value = (String) entry.getValue();
sbuf.append(key).append("=").append(value).append("\r\n");
}
try {
fileWriter = new FileWriter(new File(dstnDirName + "\\messages_en_US.properties"));
fileWriter.write(sbuf.toString());
} finally {
if (fileWriter != null)
fileWriter.close();
}
}
private static void extractMessages(List childElements, Source source, String fileName) throws Exception {
for (Iterator iter = childElements.iterator(); iter.hasNext();) {
Element element = (Element) iter.next();
final List childElements2 = element.getChildElements();
if (childElements2 != null && childElements2.size() > 0) {
extractMessages(childElements2, source, fileName);
} else {
final TextExtractor textExtractor = element.getTextExtractor();
String txt = textExtractor.toString();
String key = "";
if (txt != null) {
txt = txt.trim();
if (txt.length() > 0 && !StringUtils.isNumeric(txt)) {
System.out.println(txt);
String ctrString = "";
if (counter < 10) {
ctrString = "0000" + counter;
} else if (counter < 100) {
ctrString = "000" + counter;
} else if (counter < 1000) {
ctrString = "00" + counter;
}else if(counter<10000){
ctrString = "0" + counter;
}
if (!messageValueKeyHolder.containsKey(txt)) {
key = "MESG" + ctrString;
messageKeyValueHolder.put(key, txt);
messageValueKeyHolder.put(txt, key);
elementsToReplace.put(element.getContent(), "<spring:message code=\"" + key + "\"></spring:message>");
counter++;
} else {
key = (String) messageValueKeyHolder.get(txt);
elementsToReplace.put(element.getContent(), "<spring:message code=\"" + key + "\"></spring:message>");
}
}
}
}
}
}
}
Wednesday, February 6, 2008
internationalization support in spring -usage
Spring Internationalization web MVC
1. Add two properties files in /WEB-INF/classes:
1) messages_zh_CN.properties Chinese message file.
2) messages_en_US.properties English message file.
2. Add bean in action-servlet.xml:
[bean id="localeResolver" class="org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver"/]
Spring will set UI language locale and message according to the client-side browser locale configuration.
3. JSP files
1. [fmt:message key="key1"/]
2. Error message
[spring:bind path="account.password"]
[input type="password" name="${status.expression}" value="${status.value}"/]
[span class="fieldError"]${status.errorMessage}[/span]
[/spring:bind]
3. button
[input type="submit" class="button" name="prev" value="[fmt:message key="prev"/]" /]
Spring Internationalization for portlet MVC
1. Add two properties files in /WEB-INF/classes:
1) messages_zh_CN.properties -Chinese message file.
The Java properties files are created using a native encoding or in UTF-8. This must be converted to an ascii format for Java. This is done as part of the extraction process on the translation website but if you have a manually created file in UTF-8 that needs to be encoded, then use the native2ascii command that comes with with Java JDK.
Call native2ascii to ascii encoding, specifying the original file has UTF-8 encoding:
Eg: native2ascii.exe -encoding UTF-8 chinese_zh.txt ApplicationResource_zh_CN.properties
2) messages_en_US.properties -English message file.
2. Update applicationContext.xml file as below:
- Replace the static text in JSP files with
[spring:message code=”key1”/] where key1 is the key available in message_xx.properties file
Note :The Java properties files are created using a native encoding or in
UTF-8. This must be converted to an ascii format for Java. This is done
as part of the extraction process on the translation website but if you
have a manually created file in UTF-8 that needs to be encoded, then
use the native2ascii command that comes with with Java JDK.
Call native2ascii to ascii encoding, specifying the original file has UTF-8 encoding:
native2ascii.exe -encoding UTF-8 chinese_zh.txt ApplicationResource_zh_CN.properties
Ref: http://wiki.lamsfoundation.org/display/lams/LAMS+i18n
The below JSP is Useful to troubleshoot locale related issues:
[%
//java.util.Locale locale = (java.util.Locale)request.getSession().getAttribute
("org.apache.struts.action.LOCALE");
Locale locale = renderRequest.getLocale();
String language = locale.getLanguage();
String country = locale.getCountry();
out.println(language +" "+country);
// Remember, messagesis the fully qualified name of a bundle in the classpath
// e.g. WEB-INF/classes/messages_*.properties
ResourceBundle res = ResourceBundle.getBundle("messages", new java.util.Locale(language, country));
java.util.Enumeration en=res.getKeys();
while(en.hasMoreElements())
{
out.println(en.nextElement());
}
out.print(res.getString("key1"));
%]
Thursday, January 31, 2008
Linux ssh autologin with putty
ssh autologin with putty
This article shows how to do it whenconnecting from a windows machine using putty to a linux box.
1. download PuTTYgen and start it.
2. at the bottom of the window, select SSH2 RSA
3. click generate and start moving your mouse over the blank part of
the window until the bar is filled and it shows some more options.
4. change the key comment to something meaningful like the name of your computer or you
5. save the private key (and if you want for later use, save the public
key too, but we don’t need this one for our auto login)
6. copy the public key from the textarea at the top of the window and
paste it into the ~/.ssh/authorized_keys file on your server you want
to logon in the home directory of the user you want to logon as. if
this file doesn’t exist yet, create it. (you may again want to
save the copy/pasted key to a text file on your computer in case you
have some more servers you want to auto-logon, so you can always open
it and copy/paste it from that file)
7. start putty and load your server settings
8. go to Connection–>Data and enter the username you want to
login as in the up most field “Auto-Login username”
9. go to Connection–>SSH–>Auth and choose the newly
reated private key file you saved before in the last field
“Private key file for authentication” by hitting the browse
button.
10. go back to Session and save all these settings.
now your’re done. from now on you will automatically be logged in when you open a session to that server
somem more tutorials for this and other os’s can be found here: http://wellsi.com/sme/ssh/ssh.html
More here for linux as well http://wiki.dreamhost.com/index.php/SSH#Passwordless_Login
Wednesday, January 30, 2008
Spyware trojan and virus removal tools
Wednesday, January 23, 2008
PHP and Related
http://www.dbforums.com/t1044828.html I just installed Apache/PHP5/MySQL on my Windows PC with XP Home OS. I followed the Tut Installing PHP under Windows by Matthew Phillips Referred to in the Post: Easy to understand Apache/PHP/MySQL install on XP box This worked OK aside from a couple obvious differences. I had the most troube getting MySQL configured with PHP and had to do some searching to find the answer. Here is what I had to do to get it working. In the Apache httpd.conf File at 'C:\Program Files\Apache Group\Apache2\conf\httpd.conf' You have to add these lines for PHP5 LoadModule php5_module php5apache2.dll AddType application/x-httpd-php .php In addition to installing MySQL etc. I had to do this to get MySQL to work: 1. Make sure that you have a valid php.ini in your windows directory. OR (Per the tut the 'php.ini' can be installed in the 'C:\Program Files\Apache Group\Apache2' folder. This works fine.) 2. copy libmysql.dll to the system32 directory (php_mysql.dll would not load without doing this) 3. set the extension_dir in php.ini to the ext directory of your PHP installation directory (like e.g. extension_dir=C:\php5\ext) 4. enable the MySQL extension in php.ini by uncommenting the line extension=php_mysql.dll 5. Restart Apache Server Check this link for latest php host http://www.0php.com/free_PHP_hosting.php Useful open source apps: Online exam - TCExam (sourceforge project) perfect for online exam .(http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcexam) Fixes: Remember to add the user right (with groups , date format is yyyy-mm-dd) Install the application through the application. project management http://itprojectguide.org/ Drupal - an excellent content mgmt system. Joomla - similar to Drupal Imageflow - image gallery showcase.
Tuesday, January 8, 2008
Tomcat enabling security using Catalina.policy
For debugging security information have below setting in catalina
CATALINA_OPTS=" -Djava.security.debug=acess,failure"
The catalina.policy file should be present under $tomcat/conf/
Change the catalina.policy as required by checking the debug information
To check acess failures use the below:
grep -v "access allow" /usr/local/sso/logs/catalina.out |more
Note: -v is used to invert the search pattern.
or use
grep -v "access allow" /usr/local/sso/logs/catalina.out |egrep "domain|denied" |more
Saturday, January 5, 2008
Pega PRPC
Pega is a collection of rules linked to a business process Pega = Rules Engine + Business Process It is smart as it is built for changes and has all the capabalities required in a SDLC(s/w development life cycle). Here is a few: - An inbuilt Versioning system.Excellent feature to manage releases. Never seen such good feature in my career in other products. - An inbuilt clipboard and tracing tool for debugging. Rule inspector for debugging HTML on the fly. What else do you want with zero developer configuration. - Inbuilt security system. Imagine building security in J2ee world , it is really a pain. - A interface to view/design/manage the work flow from any corner of the world. Just have a browser and you are done. You setup the server environment once. No need to setup any other environment for individual developer. - Object oriented. - Java Based and inbuilt internationalization support - Can include new java libraries easily (Rule-utility)... - Smart product for smart people. - Excellent external service integration - It solves most of the repeatedly occuring problems in a J2ee webapp development and hence a sure winner. Most problems are captured as rules which can be changed easily. - Rule testing capability like Junit in java. What it lacks in V4.2(correct if i am wrong) - Sucks lot of Memory. Maybe deu to the rules stored in memory. - Customizing the user interface layout takes a hell lot of time and effort. Also depends on the skillset of the developer. - Didn't find a worthy information of handling back button in a work flow. Going back from one flow to another is not possible. - How do we support AJAX? Portlets , etc? Is it there in V5 ? - Hard Core *Coder* will not like it as it is not as flexible and tunable. :) -Bigger learning curve of rules. But with it's feature its worth. - Not open sourced :-). If it get's opensourced no other product can beat it. [update] Useful links Forum for pega Question and answer Developer notes 1 More to come here TODO: -How to develop pega app from scratch quickly -Best Practices -Essential rules what a pega developer should know.
[updates]
Another developer blog on its experiences:
http://claforet.wordpress.com/2010/06/26/getting-started-with-pega-development/
Monday, December 31, 2007
Hibernate second level cache
Second level cache(2LC) of hibernate boosts the performance of websites.
One needs to be careful to handle the cache refresh.
By default hibernate 3 comes with EHcache for session level
cache(primary cache).
EhCache can also be used for secondary level cache.
Setup of 2LC using EHcache:
1. Setup the session factory with the below details:
hibernate.cache.provider_class as org.hibernate.cache.EhCacheProvider
hibernate.cache.use_query_cache as true
Optionally cache statistics can be enabled by using below
hibernate.generate_statistics as true
hibernate.cache.use_structured_entries as true
2. In the hbm files just under the class element put the below:
cache region="com.xmp.web2.model.Article" usage="read-only"
--in the above, the region is used to identify as cache key.
3. For query cache, set the Query as cacheable programatically.
Query queryObj = session.createQuery(query);
queryObj.setCacheable(true);
-- This will cache all the query result, thus reducing DB hits.
4. To refresh a query programatically, do the below:
-- sessionFactory.evict(Article.class, id); //this will remove from the cache the article object instance with the primary key id. Note that the id is serializable and the type should be the same as defined in hbm.
5. To optionally print the statistics, enable statistic monitoring as told in step 1 and use the below:
static void printCacheStatistics(String regionName) {
Statistics statistics = sessionFactory.getStatistics();
SecondLevelCacheStatistics secondLevelCacheStatistics = statistics.getSecondLevelCacheStatistics(regionName);
System.out.println("2nd level CACHE Statistics :"+secondLevelCacheStatistics.toString());
}
To check cache statistics use the JSP as below:
<%@ page language="java" import="org.springframework.web.context.*,org.springframework.web.context.support.*,org.hibernate.*,org.hibernate.stat.*"%>
<%
String cacheRegion="com.xmp.web2.model.Article";
WebApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(
this.getServletContext());
SessionFactory sessionFactory = (SessionFactory) ctx.getBean("sessionFactory");
out.print(sessionFactory);
Statistics statistics = sessionFactory.getStatistics();
SecondLevelCacheStatistics secondLevelCacheStatistics = statistics.getSecondLevelCacheStatistics(cacheRegion);
out.print("<br/>");
out.println("Query cache hit count :"+statistics.getQueryCacheHitCount());
out.print("<br/>");
out.print("<br/>");
out.println("2nd level CACHE Statistics :" + secondLevelCacheStatistics.toString());
%>
Reference:
http://doc.javanb.com/hibernate-reference-3-2-4-ga-en/performance.html
http://www.hibernate.org/hib_docs/v3/reference/en/html/performance.html#performance-cache
An excellent write-up on 2ndLC http://tech.puredanger.com/2009/07/10/hibernate-query-cache/
Monday, December 17, 2007
All about UK Visa.
HSMP is a 2 step process as of now.I applied for HSMP visa through a consultant y-axis in Bangalore, India.
They provided good service for getting step 1done(HSMP acceptance). The second part(Entry clearance)
was hopeless service by y-axis. I feel like chewing that consultant who processed it.
They are very keen about proof's (original documents) which has to be genuine and no scope for any errors.
Eg: Say you have your salary credited through cheques, then in the bank statement
you wont have the mention that your XYZ company paid you the salary. So you need
to get a letter for the same from bank or company stating you got the salary from
XYZ company. As long as you prove yourself with the documents the chances of
rejection is very low. Also all your salary slips should be attested by the
corresponding authority.
H1 vs HSMP:
- The chances of getting visa depends on your documentation which serves as the proof of you skills. Not entirely on luck like in H1.
- It is not like H1 visa (phaltu lottery system and only done once a year ). HSMP's points calculator is best and you can calculate before hand if you are eligible for it or not. Also you can apply any time of the year as long as you have your documents right. UK guys are smart at applying rules i guess.
As I said before, it is a 2 step process-
- Get HSMP acceptance from UK consulate by sending your documents, 400 pounds and details to UK. It took me 3 weeks for getting the HSMP accepted. Actually gathering all the documents for proof of salary, bank stmts, medium of instruction letter etc. took me 1 month. On a whole you should get this first part done in 2-3 months.
mumbai. I applied through local VFS in bangalore(VFS sent it to chennai).Paid Rs.17,000
at VFS office fee for EC. It is already 3 weeks since I applied. Yet to get a response. HSMP
visa Entry clearance application status can be checked from here
I have got the first part done(got HSMP acceptance letter), the second one is also done.
Overall the entire process took me 6 months as of now. I could have saved some 2 months had I got all the documents ready. By and large
4-6 months.
Right now I am in UK. More to blog soon.
UK HSMP visa useful Links:
- hsmphelp.blogspot.com/
- Check the blog ec-hsmp.blogspot.com HSMP blog .On the right you can find various useful section's. This blog is one of the best. No need to go to visa consultant and shell out so much fortune.
- http://www.workpermit.com/uk/hsmp_calculator.htm --> HSMP point calculator. This may change in first quarter of 2008. Watch out.
- Job assistance in Uk 00 44 114 207 6020 -Aman http://www.vertex-solutions.co.uk/technical-recruitment/immigrationservices.asp Tel (UK): 08456 448 441
- Direct Dial: (+44) 144 222 1320
- Buy tickets for UK to/from india at
- http://www.ticketstoindia.co.uk/result_new.aspx
- For currency, time, phone number conversion check
- http://www.timeanddate.com
Suggest some possible ways to get a job by seating here in india?
FAQ
What is the cheap and best place to stay in london. What is the price of apartments?
Eastham is cheap with lot of asians but not so safe. For a bachelor it will cost around 300 pounds for a shared acco of 3 people.
Around 450 for 2 people. Thats a rough estimate...Depends on the owner.
How much cash should one carry for travel and job search?
Around 300 pounds for flight + travel.. You might spend 600 pounds a month overall staying here.
If u r traveling for job search you will need some more like 100 pounds more.
So that might cost you 2- 3 lak rs for 2-3 months to come here and stay ,search a job.... Its ur best try and luck how
soon u get the job.
Sitting in India and trying a job is not a good idea. Chances are i can say only 10%. If u want to get work form India , chances are u end up with an Indian company who has UK requirement.... Also many consultants here dont call indian numbers. You need to prepare yourself with finances so that u survive in UK for atleast 2-3 months without a job(that might cost you 2- 3 lak rs).
Wednesday, December 12, 2007
LinuxPerformance Tuning(apache,tomcat,linux) and related
-- HTTPAnalyzer --
-- YSlow --CSS,Javascript report , time/size measurement for individual component is good.
-- FireBug -- Net performance, for a quick analysis.
--Open STA
Tomcat profiling
-- JProfiler
-- Hot spots ,JDBC queries(J2ee components), object instance count are useful.
--Database connection pooling with optimal values.
Connection leakage in DBCP can be easily detected by settin logAbandoned=true in resource configuration (server.xml). This is a very nice feature and throws up the exact location of the code which is not closing the connection. These connection issues normally come up during load testing.Also the jndi resource configuration for DBCP should have ideal settings. The one used for our project is below:
[GlobalNamingResources]
[Resource
name="jdbc/cmpPubPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:oci:@[TNSNAME]"
removeAbandoned="true"
logAbandoned="true"
maxActive="2"
maxIdle="2"
initialSize="2"
maxWait="-1"
username="[USER_NAME]"
password="[USER_PASSWORD]"
validationQuery=”select 1 from dual” /]
[/GlobalNamingResources]
JVM Tuning
Modify the heap size in JAVA_OPTS.
Apache tuning
prefork or worker module can be used.
prefork is non thread based.
Worker module is multi threaded and may yield a better performance.
Linux
--$top -- to check CPU status
top
Top has probably hundreds of keys to do whatever you want. A few are most useful for me.
The >
key sorts by the next column (%MEM) instead of the default (%CPU). <
sorts by the previous column.
Hit c
to toggle the display of command line arguments. Useful for me when I
have a lot of processes that otherwise just show up as “java”
Typing A
brings up the alternate display, showing processes sorted by different
fields with different columns. One section shows a nice memory-centric
view, for example.
Hitting z
turns on colors. Z
brings you to a color selection screen where you can pick colors you want. B
turns on bold for some fields.
Hit W
to save all your configuration changes to ~/.toprc where it will be loaded next time.
Type k
allows you to kill a process without exiting top.
On windows use CTRL +Break.
Hardware
-Linux memory size can be checked using
cat /proc/meminfo --Gives RAM size
free -m -- Gives RAM size in MB (-k for kb)
df -H -- Human readable format of hard disk size
Useful links
http://jha.rajeev.googlepages.com/web2push
Powered by ScribeFire.
Monday, November 19, 2007
Spring + Hibernate Usefuls
package com.xmp.web2.dao;
public class BaseDAOHibernate extends HibernateDaoSupport implements DAO {
private static final Log LOGGER = LogFactory.getLog(BaseDAOHibernate.class);
protected DataSource dataSource;
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
public void saveObject(final Object object) {
getHibernateTemplate().saveOrUpdate(object);
}
public Object getObject(final Class clazz, final Serializable id) {
Object object = getHibernateTemplate().get(clazz, id);
return object;
}
public List getObjects(final Class clazz) {
return getHibernateTemplate().loadAll(clazz);
}
public void removeObject(final Class clazz, final Serializable id) {
getHibernateTemplate().delete(getObject(clazz, id));
}
public List findObject(final Class clazz, final String columnName, final String articleID) {
return getHibernateTemplate().find("from " + clazz.getName() + " tableAlias where tableAlias." + columnName + " in ( " + articleID + " )");
}
/**
* Accepts a HQL and ordered map of parameters.
*
* @param query
* @param parameters
* @return
*/
public List search(String query, LinkedHashMap parameters) throws xmpWebException {
boolean keepSessionOpen=false;
return search(query, parameters, keepSessionOpen);
}
/**
* Accepts a HQL and ordered map of parameters.
* The caller of this method should explicitly close the session.
* @param query
* @param parameters
* @parm keepSessionOpen -boolean to instruct if the session should be closed or not.
* @return
*/
protected List search(String query, LinkedHashMap parameters, boolean keepSessionOpen) throws xmpWebException {
List objList = null;
Session session = null;
try {
if (LOGGER.isInfoEnabled()) {
LOGGER.info(new StringBuilder().append("Searching ( query = ").append(query).append(" ,parameters =").append(parameters).append(")").toString());
}
session = getHibernateTemplate().getSessionFactory().openSession();
Query queryObj = session.createQuery(query);
queryObj.setCacheable(true);
if (parameters != null) {
for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
String key = (String) iter.next();
Object value = parameters.get(key);
queryObj.setParameter(key, value);
}
}
objList = queryObj.list();
} catch (Exception e) {
String msg = new StringBuilder("Search failed ( query = ").append("Searching ( query = ").append(query).append(" ,parameters =").append(parameters).append(")").toString();
LOGGER.error(msg, e);
throw new xmpWebException(msg, e);
} finally {
if (!keepSessionOpen) {
if (session != null && session.isOpen())
session.close();
}
}
return objList;
}
/**
* Accepts a HQL and ordered map of parameters. Useful with pagination as it
* accepts pageNo and pagesize.
*
* @param query
* @param parameters
* @param pageNo - The starting page number
* @param pageSize - The max record size.
* @return
*/
protected List searchAdvanced(final String query, final LinkedHashMap parameters, final int pageNo, final int pageSize) throws xmpWebException {
boolean keepSessionOpen = false;
return searchAdvanced(query, parameters, pageNo, pageSize, keepSessionOpen);
}
/**
* Accepts a HQL and ordered map of parameters. Useful with pagination as it
* accepts pageNo and pagesize.
*
* @param query
* @param parameters
* @param pageNo - The starting page number
* @param pageSize - The max record size.
* @param keepSessionOpen - boolean to identify if session needs to be kept open or not.
* @return
*/
protected List searchAdvanced(final String query, final LinkedHashMap parameters, final int pageNo, final int pageSize, boolean keepSessionOpen) throws xmpWebException {
if (LOGGER.isInfoEnabled()) {
LOGGER.info(new StringBuilder("Searching with ( query = ").append(query).append(" ,parameters =").append(parameters).append(" ,pageNo =").append(pageNo).append(" ,pageSize= ").append(
pageSize).append(" )").toString());
}
Session session = null;
try {
session = getHibernateTemplate().getSessionFactory().openSession();
Query queryObject = session.createQuery(query);
// queryObj.setCacheable(true);
if (parameters != null) {
for (Iterator iter = parameters.keySet().iterator(); iter.hasNext();) {
String key = (String) iter.next();
Object value = parameters.get(key);
queryObject.setParameter(key, value);
}
}
queryObject.setMaxResults((pageSize < msg =" new" query = ").append(query).append(" parameters =").append(parameters).append(" pageno =").append(pageNo).append(" pagesize= ").append( pageSize).append(">
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The above should solve most of the basic coding effort in DAO layer which we do 90% of the time.
Spring+Hibernate Junit testing:
Spring framework provides a nifty base class (AbstractTransactionalDataSourceSpringContextTests) that provides automatic transaction rollback, exposing a JDBC template to interact with the DB and auto wiring of beans.
Lets take a simple DAO class that save a User object to the database:
public class UserDaoImpl extends HibernateDaoSupport implements UserDao { public void save(User user) { getHibernateTemplate().save(user); } } |
public class UserDaoTest extends AbstractTransactionalDataSourceSpringContextTests { private UserDao userDao; private SessionFactory sessionFactory = null; protected String[] getConfigLocations() { return new String[]{"test-spring-config.xml"}; } public void setUserDao(UserDao userDao) { this.userDao = userDao; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } /** * Test the save method * */ public void testSave(){ String query = "select count(*) from user where first_name = 'Firstname'"; int count = jdbcTemplate.queryForInt(query); assertEquals("A user already exists in the DB", 0, count); User user = new User(); user.setFirstName("Firstname"); userDao.saveUser(user); // flush the session so we can get the record using JDBC template SessionFactoryUtils.getSession(sessionFactory, false).flush(); count = jdbcTemplate.queryForInt(query); assertEquals("User was not found in the DB", 1, count); } } |
/** * Overridden method from base class which gets called automatically */ protected void onSetUpBeforeTransaction() throws Exception { super.onSetUpBeforeTransaction(); userDao = (UserDao) applicationContext.getBean("userDao"); } |
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean name="userDao" class="com.dao.UserDaoImpl"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource"/> </property> <property name="mappingResources"> <list> <value>hibernates/User.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> </props> </property> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@localhost:1521:ORCL" /> <property name="username" value="test" /> <property name="password" value="test" /> </bean> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"><ref local="sessionFactory"/></property> </bean> </beans>Useful stuff: HQL many to many query for retreival from UserTask ut where :journal in elements(ut.journals)
Wednesday, November 14, 2007
Single Sign on - OpenSSO
OpenSSO was earlier called as access manager.
OpenFM is openSSO + federation (Cross domain support?)
It was a herculian effort to get it going with openfm/OpenSSO.
- Access Manager(opensso/openfm) configuration:
- First thing I came across when deploying the openfm.war on linux was as below:
-First time when we go to http://localhost:8080/openfm and try to
configure the openfm, it gives a error with no stack trace nothing . It
misleads you with a path to log file which you can find in their(sso
developers) dreams.GRRRR.- Had to search around
in Red hat linux Enterprise edition 5. Later figured that it creates a
folder with name @BASEDIR@ under tomcat/bin/... Who can imagine a
cryptic folder for logging sso errors that too under tomcat/bin/...
Wasted almost 1.5 days on that ....- In another version of linux, the above didn't work out. It was in tomcat logs catalina.out. Lucky!!
- The
problem usually tends to be due to wrong JDK. The Sun JCE comes as
default with Sun JDK but not with IBM JDK. The Sun JCE is used for
encryption of password by open SSO.
Another important thing. First time you setup access manager you should
be careful. Next time, if you try setting it up(by deploying new
openfm.war) , it complains. Under windows u can simply delete the
access manager folder created during installation (default is C:\Doc and settings\user name\)...
- Under linux it should be somewhere under /home/
by default. Search using locate access manager. The custom path would be the one which you setup openSSO using Configurator.jsp.
- If
you mess up access manager by configuring authentication chain or data
store, the work around is use the default module=DataStore as URL parameter eg: http://localhost:8080/openfm/UI/Login?module=DataStore
- By
default the openfm ships with set of authentication plugin like JDBC,
LDAP based , etc .Our requirement needed to compare the user entered
auth password with MD5 encrypted password. Hence had to build a custom
authentication plugin. Luckily sun provide service provider
interface(SPI).Implementing this was a major effort as there is hardly
any documentation or forum talking about it.Took a short cut by
extending the sun provided com.sun.identity.authentication.modules.jdbc.JDBC.java and over riding transform() method. It works smooth
- Move the custom
authentication jar which you wrote (opensso_xmp_plug_v1.0.1.jar) into
the ~/openfm/WEB-INF/lib folder.All the related property files should
be on class path.
- Copy the custom
Authentication JDBC configuration file. amAuthxmpJDBC.xml into ~/openfm/WEB-INF/classes
folder.Refer amAuthJDBC.xml in the same folder for creating a similar one for your custom auth module.
- Register the module in
serviceNames.properties abailable under openfm/WEB-INF/classes to have
amAuthXMPJDBC.xml. (Add amAuthxmpJDBC.xml at the end)
- Copy XMPJDBC.xml into ~/openfm/config/auth/default
- Restart tomcat.
- Login to Access Manager, Goto
Configuration -- Authentication --Core- Enter com.xmp.security.plugin.XMPJDBC as New Value and click on Add to configure
the new service.- Go to Access Control and
select the realm (opensso). Click on Authentication > Module Instances
and Add the previously configured XMPJDBC module to the authentication
chain as shown below: Save the information.- Now the Login of opensso will use xmpJDBC module as default for
authentication. If you want to login with the amAdmin user,
module=DataStore need to be added to login URL (like
http://localhost/openfm?module=DataStore)- Login with a valid userId and password (sample xello@xello.com/xello)
The user is taken to the successful login page.
NOTE:
- Once a user is logged in successfully, the access manager by default
looks for the user's profile through Id repo. This is the default
behaviour. This can be over ridden by setting the property in
realm(opensso) -- Authentication -- Advanced (look profile) to ignored.public class SSOTaskHandler extends AmFilterTaskHandler implements ISSOTaskHandler
- Using custom com.sun.identity.agents.filter.SSOTaskHandler class, we can
insert a session attribute which is used by the SSO agent/application
for auto login (discussed later , for now agent is like a client to
open sso). The sample code is below:{...
public AmFilterResult process(AmFilterRequestContext amfilterrequestcontext) throws AgentException
{
.........
amfilterrequestcontext.getHttpServletRequest().getSession().setAttribute("SSO_VALIDATION_RESULT",ssovalidationresult);
.............
}
........
}
TODO: J2EE agent
The agent J2ee 007 would be hiding in the web application root web.xml(as AmAgentFilter) to provide secured access. ;)
AMAgent.properties is where the whole good behaviors of the badly behaving J2ee agent is configured. This is generated by amadmin tool and updated later. Check it below for only the important parameters to manually update
----------------------------------------------------------------------------------------------------------
#
# CDSSO PROCESSING PROPERTIES
com.sun.identity.agents.config.cdsso.enable = true
com.sun.identity.agents.config.cdsso.redirect.uri = /agentapp/sunwCDSSORedirectURI
com.sun.identity.agents.config.cdsso.cdcservlet.url[0] = http://172.20.41.39:6060/openfm/cdcservlet
com.sun.identity.agents.config.cdsso.clock.skew = 0
com.sun.identity.agents.config.cdsso.trusted.id.provider[0] = http://172.20.41.39:6060/openfm/cdcservlet
#
# LOGOUT PROCESSING PROPERTIES
com.sun.identity.agents.config.logout.application.handler[] =
com.sun.identity.agents.config.logout.uri[DefaultWebApp] =/web/xmpXMS/logout
com.sun.identity.agents.config.logout.request.param[] =
com.sun.identity.agents.config.logout.introspect.enabled = false
com.sun.identity.agents.config.logout.entry.uri[DefaultWebApp] =/web/xmpXMS/home
#
# NOT-ENFORCED URI PROCESSING PROPERTIES
# - notenforced.uri: A LIST of URIs for which protection is not enforced
# by the Agent.
# - notenforced.uri.invert: A flag that specifies if the list of URIs
# specified by the property notenforced.uri should be inverted. When
# set to true, it indicates that the URIs specified should be enforced
# and all other URIs should be not enforced by the Agent. Entries in
# this list can have wild card character '*'.
# Example of notenforced.uri:
# com.sun.identity.agents.config.notenforced.uri[0]=*.gif
# com.sun.identity.agents.config.notenforced.uri[1]=/public/*
# com.sun.identity.agents.config.notenforced.uri[2]=/images/*
#
com.sun.identity.agents.config.notenforced.uri[0] =
com.sun.identity.agents.config.notenforced.uri.invert = false
com.sun.identity.agents.config.notenforced.uri.cache.enable = true
com.sun.identity.agents.config.notenforced.uri.cache.size = 1000
#
# DEBUG SERVICE PROPERTIES
# - com.iplanet.services.debug.level: Specifies the debug level to be used.
# The value is one of: off, error, warning, message. ******** Funny thing, debug is missing but it actually is very useful for developers********
com.iplanet.services.debug.level=debug
--------------------------------------------------------------------------------------------------------------
TODO: Web Agent
Powered by ScribeFire.
Wednesday, October 31, 2007
The art of debugging
Software debugging is used to troubleshoot a problem in code. So what is the best way of debugging? 1. Run through the log statements 2. Start a debug session in your favourite IDE. The session can be remote(for a web app) or local. 3. Narrow down to the problem by reducing the dependencies. Is it because of the framework or your own code, to know that reduce the code and test piece by piece. Option 2, Debugger is the best arsenal for troubleshooting issues in code. Mixing 1,2 and 3 would be the ultimate way to fix the worst problem. For details of remote debugging in eclipse please refer to my earlier posts. In eclipse I find the below things very useful in debugging session: 1. Breakpoints:1.Put a breakpoint in eclipse. You can also edit the breakpoint properties by right clicking on the breakpoints properties. Here you can put a condition and put S.o.p for quickly identifying the problem 2. Exception breakpoint is a cool feature which will catch the exception which you specify. This will help you find the control flow(especially with nasty Null pointer exceptions). You can specify this by clicking on the "Add Java Exceptions" breakpoint of breakpoints view.2.If you're running in debug code, you can actually just edit the method and re-invoke it. None of this resetting variables on the fly; just save the new method and do 'drop to stack' to get it to re-run the code. You can't do this if you're not running your application in eclipse, but are rather joined to it as a remore debugger. 3. Variables can be reset in debugging session through expressions or variables view. 4. Short cuts: CTRL+SHIFT +I -- to check a variable after selection. F5, F6, F8 Useful links Jacoozi - Remote Debugging with Eclipse
Monday, October 29, 2007
JNDI test JSP page
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" import="javax.naming.*" %> <% InitialContext initialContext = new InitialContext(); Object obj=initialContext.lookup("java:comp/env/jdbc/xmpPubPool"); out.print(obj); %>
Thursday, October 25, 2007
Useful Eclipse Plugins + shortcut keys
- MyEclipse -- Is a heavy wieght champion among plugins.Has lot of good features that makes it good as well as bulky. It sucks lot of memory.
- jigloo -- Very good, clean and free Swing code generator. Makes swing development like VB.
- pmd
- jsEclipse
- Teniga_Javascript_Editor
- Mylyn --- Connects to task repository and eases task managemnt.Also standalone support
- JadClipse --Uses Jad to decompile class
- jautodoc -- Very useful for quick API documentation.
- junitBuilder -- Generate Junit automatically for classes..Saves time
- moreunit - a must have for junit. http://moreunit.sourceforge.net/org.moreunit.updatesite/
- phpeclipse -- Good for PHP developers.
- VelocityWebEdit -- Cool velocity template validation and edit tool
- patternbox -- very useful for building regular expressions quickly.
- xmlbuddy -- neat small and simple xml editing tool.
- subclipse --SVN plugin
- NTail - tail for eclipse http://www.certiv.net/
- Eclipse HttpClient -- is a Rich HttpClient Plugin with stunning user interface and build on top of the famous Apache HttpClient
- Jar class finder - give a class , it will find the jar where it belongs to.
- andromda
- aptana
- Clay modelling tool DB_Modelling_jp.azzurri.clay
I think of Quick Fix as a tool for writing code, not something that just corrects accidental errors. Instead of trying to type perfect code and using Quick Fix only when you make a mistake, try intentionally leaving out code, then using Quick Fix to add it in. For example, call a function that isn’t defined, passing in all the arguments you want to to take. Use Ctrl-1, Enter to create an empty version of the function with all the right parameter types. I also like Quick Fix for creating casts. I assign an expression to a variable without a cast, then use Quick Fix to add it in.
Instead of declaring a variable and then assiging the value of an expression to it, try just writing the expression, then use Quick Assist – Assign to Field
(Ctrl-2 L) to generate the declaration. The variable name will be
highlighted and the drop down gives you several reasonable alternatives
to use for the variable name. Tab again to get to the type to choose an
alternative. For example if you had new ArrayList<String>()
and used Assign to Field you might choose List<String>
from the list of type alternatives.
More here : http://eclipse.dzone.com/news/effective-eclipse-shortcut-key
More here : http://rayfd.wordpress.com/2007/05/20/10-eclipse-navigation-shortcuts-every-java-programmer-should-know/
Powered by ScribeFire.