Monday, October 26, 2009
Bye Bye GeoCities …
Any Finally thanks GeoCities for all your help. Hope Yahoo may come up with something new
Where your compiled JSP files stored in WEBLOGIC?
Work Folder of WEBLOGIC:
\bea\user_projects\domains\<YOUR_DOMAIN_NAME>\servers\<APP_SERVER_NAME>\tmp\_WL_user\<APPLICATION_WAR>
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Thursday, October 22, 2009
5 Things you should know about String Constant Pool.
- When a Class was compiled the String literals are noted in a special way by the compiler.
- Once the Class get loaded, all the String literals which are inside the class are placed inside the String Constant Pool. So once the Class got initialized all the String literals are ready for use.
- String Constant Pool is Constant Table which will hold all the String Literal Objects which lives on the heap.
- Most of people think String Constant Pool is where the String Literal Object are Stored, but that's not true."All the Objects are Stored one and only in HEAP"
- During Garbage Collections, the values which are String Literals are not Garbage Collected. The reason is GC only collects the objects which are not referred. But String Literals objects (in Heap) are referred by the String Constant Pool (Constant Table).
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Wednesday, October 21, 2009
Eclipse Scrapbook Pages: A quick way to test you java code snippets.
Scrapbook Pages was the functionality which most of the eclipse users don't know. This is a simple and quick way to test any small code snippets before implementing it.
For example if you want to test how you can get year, month and date from calendar class. Then we have to write a test class with proper class name and main method in it… But it is an annoying process to just to test this small code. So in Scrap page you can just paste the code in the files as below and you can execute (Ctrl + U).
Sample Code:
int year = 2009;
int month = 0; // January
int date = 1;
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.clear();
cal.set(java.util.Calendar.YEAR, year);
cal.set(java.util.Calendar.MONTH, month);
cal.set(java.util.Calendar.DATE, date);
java.sql.Date sqlDate = new java.sql.Date(cal.getTimeInMillis());
System.out.println(sqlDate);
System.out.println("Bye");
You also select only the lines which you want to test, for example if I want to test only the last line "System.out.println("Bye"); Just select the line and execute …. You only see "Bye" in you console…
This is a Quick way to test your code Snipped and another important thing is you don't have any import statements and class name. So If you want to refer Calendar class you have to refer it with full package structure like this java.util.Calendar. By default it only finds the classes which are in java.util (as normally java does).
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Monday, October 19, 2009
ANT “Hello World” Example
AntHelloWorld Java Class:
Create a java class with which will print hello world in the console.
package com.passion4java.helloworld.ant;
class AntHelloWorld {
public static void main(String[] args) {
System.out.println("This Project was build using Ant");
}
}
Create a build.xml file which will first clean and compile the java classes and then build the jar file.
Hello world build script:
Execution:
Download the zip file which is attached and extract it. You will see the directory structure as below.
- We have created a project called AntHelloWorld and we have created 3 targets and 4 properties.
- The name of the Project can also referred by ${ant.project.name}
- main-target is the default target which be executed when you are running build.xml file without specifying any targets.
- Once the main-target get triggered, it will first finish all the depended targets which are defined in depends attribute of the target tags.
- In our main target they are 2 depended targets clean,build. So both clean and build should be execution first before main-target starts.
- The order as in depended targets should matters, because as you have the target listed based on that only the ant which will pick which one to execute first. In our case it should be clean target.
- Clean- target deletes the folder and jar if they are present. If no folder is there this will not throw any exceptions.
-
Build targets just compiles all the java classes in the source directory and it will place all the compiled classes in the destination directory
<javac srcdir="${source.dir}" destdir="${classes.dir}"/>
- Then our main-target starts it calls the jar tags which pointing to the classes folder which was created by javac tag.
- There is also a manifest tag which adds the manifest file to the jar file.
- Main-Class attribute was added to the manifest file using the below tag <manifest> <attribute name="Main-Class" value="${main-class-name}"/> </manifest>
- Main-Class is nothing but the entry point class for this jar.
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Wednesday, October 14, 2009
Grouping: A Cool function from Regular Expression
How about if you want to add some text say “Yousuff” at the end of all the word which started with the string passion.
Sample TEXT:
passionsoft.blogspot.com was moved to passion4java.blogspot.com. passion4java.blogspot.com has lot of post related java language. This is all related to passion. Passion is what matters than success and failure.
Here we can’t use direct find/replace, so how do that? I was solving this previously by going manually to all the word which has passion and start appending at the end.. Which I really HATE to do i.e if we have a text called “passion4java,passionsoft,passion!@#”, all has different value but starts with the string “passion”… I should not loose the text which are after the word passion and it is different for every word… So go about this??
I believing there should be some way where you can overcome this using regular expression, later I found the Grouping command using regular expression which will group the pattern and word which are inside the pattern can be reused
Example:
Find text: passion([0-9A-Za-z]*)
Replace text passion$1#--Yousuff--#
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Thursday, October 8, 2009
Easy way to keep your Blog and Twitter up-to-date.
This is a redundant work which I have to do. Today when I was searching in the net found a cool web application which will update your twitter accounts if any update is made in your blogs.
The way it works is it takes your RSS feeds of your blog and understands the updates based on that it updates your twitter account.
twitterfeed
Then I added follow me on twitter in blog ;)
Try if you like it :)
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Wednesday, October 7, 2009
How can we track from where user started to access your Web Application?
Referer Header Field:
This field in the header object will give you the web page URL from which you application was triggered.
Below code in java will give you the reference URL.
String refUrl = request.getHeader("referer");
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Tuesday, October 6, 2009
Is there any difference between java.lang.NoClassDefFoundError and java.lang.ClassNotFoundException ?
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine
Monday, October 5, 2009
Great Add-ons for Mobile Testing
When you want to change your User-Agent name of your Browser (its nothing but your browser name which sent to the server on every request) you can use the "User Agent Switcher" Add-ons of Fire fox to change your user-agent....
What is the Special about Changing User-Agent?
The "User-Agent" is the only way (as of I know) the server come to know from which browser the user was triggered this request, based on that server may change its display logic...
If you try google.com from your mobile, you will see a different version as compared to your google.com from your web browser (IE or Mozilla), that difference. If you are a mobile developer want to know how the data are displayed for a Specific model you can give the user agent string of that Mobile then trigger the request.
For Example when you change your user-agent as "BlackBerry8800/4.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100" and hit from you Fire-fox browser, the content will be displayed as it was seen in Blackberry 8800 Mobile…
These Very good Add-ons if you need to test with different mobile devices (as I do right now)…J.. Please feel free to add your comments ….
- Share this on del.icio.us
- Digg this!
- Stumble upon something good? Share it on StumbleUpon
- Share this on Reddit
- Add this to Google Bookmarks
- Tweet This!
- Share this on Facebook
- Share this on Mixx
- Subscribe
- Buzz up!
- Share this on Linkedin
- Submit this to DesignFloat
- Share this on Technorati
- Submit this to Script & Style
- Post this to MySpace
- Share this on Blinklist
- Share this on FriendFeed
- Seed this on Newsvine