Wednesday, July 21, 2010

Java in 16 days

Learn Java, Basics of J2EE, Open Source Frameworks etc in under 16 days. A free tutorial with links to good content from Sun Java and with to do exercise.

We (Nagarajan and me) prepared a curriculum for interns fresh from college, freshers and people taking up JAVA as a new programming language.

It is a 16 day learning exercise broken down into smaller chunks of contents to read and understand and a small to do exercise at the end of each learning content.








The link to access the document is here - Java learning Curriculum.

It is similar to a Java tutorial for freshers.

m.m

Saturday, July 17, 2010

Coorg / Madikeri Trip

Have published the pictures and journal of my 3 day trip.

Here is the complete run down and album -
http://www.wow-wonderworks.blogspot.com/2010/07/coorg-madikeri.html

Would love comment and critique.

A small sample of the entire album (3 out of 30+)

Stamp of authority

Wonders of the insect kingdom

Life is beautiful


m.m

Tuesday, July 13, 2010

Java File Loading in Web Application

Different applications, different technologies, different designs, different packaging, different servers, different developers... Everything is different in web applications the loading of files becomes really difficult.

So how does one load files (with relative path / with absolute path) in the project structure in their java code within web applications.



1) Get the real path of the file from ServletContext or HttpServletRequest
ServletContext sc = (ServletContext)context;
sc.getRealPath("temp.txt");

or

HttpServletRequest hsrTemp = (HttpServletRequest)context;
hsrTemp.getRealPath("temp.txt");

2) Try with context path
HttpServletRequest hsrTemp = (HttpServletRequest)context;
File fileTemp = new File(hsrTemp.getContextPath()+"/resources/temp.txt");

3) Input stream - file in classes folder
InputStream inpStrTemp = this.getClass().getResourceAsStream("temp.txt");

4) resource url - file in classes folder
URL urlTemp = this.getClass().getResource("temp.txt");

5) Try this one.....................the magic one :) (all four above failed for me, this worked and yes I wrote it on my own ...)

URL currentClassFolder = TestClass.class.getResource(""); //this gives you the package reference of the test class
String pathFromUrl = currentClassFolder.getPath(); //this gives the actual path
String finalPath = pathFromUrl.substring(0,pathFromUrl.indexOf("WEB-INF/classes/com/test/web/")); //navigate to where ever you want to
finalPath = finalPath.replaceAll("% 20", " "); //command prompt doesn't like % 20'

Hope it helps, if it does - do leave a comment!

m.m

Monday, July 12, 2010

Netgear Wifi + Nortel VPN Issues?

I was troubled by the long list of issues that I was facing when I used to connect via VPN through wifi, the connection used to be refused and the office help desk would ask me to seek help from the ISP and vice versa.

Finally one day (a week back), I sat down tried to break my head over it and solved it under 2 hours. Quite pleased with the effort.


Issue: Nortel VPN not connecting via wifi router (netgear in my case) but connects via LAN (directly to the modem)

What I did:

You can access your Modem's application as follows
Link - http://192.168.1.1/
Username / password - admin / password (usually but if it doesn't work search in the net for the right one)

Wifi Router
Netgear router
Link -
http://www.routerlogin.net
or
http://10.0.0.1/
Username / password - admin / password (usually but if it doesn't work search in the net for the right one) [for the virgin media provided wifi router it is virgin/password]

For the VPN to work

Add port triggering for the following ports 50, 80, 500, 4500, 1701, 1723 under both the Wifi and modem's application.
And then Navigate to the wan setup under the wifi router's application and
check the Disable SPI Firewall.

Restart the modem and your system and connect to VPN and voila you connect and if it works drop a comment :)

m.m