Sunday, October 25, 2009

Fixed Record file parser

/**
* This functions takes one line of fixed record file as sting and returns
* array of fields
*
* @author Kisor Biswal
* @param string
* @return
*/
private String[] splitter(String string) {
// Lets get the string by space
String[] subStrings = string.split(" ");
// Oh we have to consider the the spaces inside, Okay no problem we will
// joint these back
List finalResult = new ArrayList();
List tempStrings = new ArrayList();
boolean isFirst = false;
for (String s : subStrings) {
// Do the string contain double quote?
if (s.contains("\"")) {
// Yes, Lets check if first time
if (!isFirst) {
// Yes, add the sting to temp list and go ahead
tempStrings.add(s);
isFirst = true;
} else {
// No, Ok now time to concatenate all temp strings and
// append to final result list
tempStrings.add(s);
StringBuffer buffer = new StringBuffer();
for (String ts : tempStrings) {
buffer.append(ts);
// Put space back
if (!ts.endsWith("\"")) {
buffer.append(" ");
}
}
finalResult.add(buffer.toString().replace("\"", ""));
// Now just toggle the

isFirst = false;

}

} else if (isFirst) {
// Yes, add the sting to temp list and go ahead
tempStrings.add(s);
} else {
finalResult.add(s);
}

}
return finalResult.toArray(new String[finalResult.size()]);
}

Friday, August 21, 2009

PWC6033: Unable to compile class for JSP

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:924)


org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:107)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:280)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:347)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:400)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:477)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:371)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:268)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
at org.mortbay.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

SOLUTION worked for me

adding tools.jar(/usr/lib/jvm/java-6-sun-1.6.0.14/lib/tools.jar) to class path.

Saturday, August 15, 2009

I was scared of mask wearing people, Swine Flu

desease swine, influenza A, i'm not infected....Image by Dan Queiroz via Flickr

Today morning I read about swine flu from my most trusted source information wikipedia. What understood is, swine flu is not that much dangerous as I have perceived. The normal good health habits can bit the flu easily. Even if someone is infected it can be cured.
Yesterday I was going to Paradise circle in a cab from Dr. A.S Rao Nagar, near Nadermet a group of people get into the same cab. I was scared of them as they were following everything whatever I have read in newspaper, wearing mask and drinking water frequently. They all belong to same family; children, father and mother. First I thought better to get down and go by hiring an auto, later I thought its better to ask them. So I asked "Are you all scared of swine flu or......?". The answer was "its better to be proactive, right?". This gave me enough confidence to not to get down from the cab, still I was worried and was trying to breath fresh air from the window. Came back by auto to avoid mask wearing people :).

Reblog this post [with Zemanta]

Thursday, July 23, 2009

Programming is not mere use of left brain

The human brainImage via Wikipedia
Few months back I have seen the video "A Whole New Mind: Why Right-brainers Will Rule the Future" of Daniel H. Pink. Where he professes why Right-brainers Will Rule the Future. Everything he told made sense to me, everything was logical. Mostly he is talking about outsourcing from US to ASIA, in these outsourced works programming was also included. But after seeing the programing language Scala and Lift framework I felt like programming is not mere use of left brain. As far as I understand programming needs "A whole brain" neither left nor right brain can help alone. Sometimes after getting frustrated by trying to solve a problem sequentially and logically, we find the solution by thinking in random with no logic.
So we should give a chance to right brain when the problem is taking longer than usual time. And should think beyond the existing technologies to solve the problems we have, at least once a week if more is not feasible.

Reblog this post [with Zemanta]

Sunday, June 14, 2009

Zemanta plugin

Pretty girlImage by Ed Yourdon via Flickr

Today I came across the plugin zemanta. First I thought how can it help me in writing but it did. Suppose here I'll write I bought a domain from dreamhost hosting provider, then I dont need to give the link to dreamhost, zemanta is smart enought to put that link. Also it claims it can help in composing emails, I have not used yet. Not only it suggest links but also suggests images, let me try writing pretty girl :). Got some images to choose from. But it recognize only popular words, here it wont put a link to my website even if I write the full url including http; http://kisor.vimukti.com.

In single sentence I liked it!

Oh it made me edit the post to write that, it writes the CSS also, see how the image is aligned. I promise I did not do anything in CSS.

Reblog this post [with Zemanta]

Monday, April 6, 2009

Practice makes DMA of Skills

What I mean by knowledge is understanding and remembering how things work, practice is process of finding the most efficient(the efficient way is not same for all)way of using the acquired knowledge. Skill is the perfect blend of knowledge and practice. During the process of acquiring a new skill our brain uses all most all of neurons and create new connections between the neurons, consequently we feel so busy and cant do anything simultaneously. But practice make everything simple, which decreases the number of neurons used for doing a particular task. As we master the skill, number of neurons used decreases and released neurons can be used for some other task. Once something is practiced perfectly it works like DMA without active involvement of brain. Without involvement of brain it will be faster.

Thursday, February 5, 2009

Escaping escalates problems

Never neglect a mistake. You may escape from the problem when you noticed it first time, because it is not grown to such a extent that will scare you. But I'm sure, later you will not be happy because you managed to escape from the problem, rather you'll repent because you gave a chance to the problem to grow beyond your ability to manage. Everything is predictable up-to the extent of requirement. Now I'm writing this because, the mistake I did today afternoon gave me an opportunity and enough time to write, now time is 1.59am:).

Learning from mistakes is good, but learning to avoid mistake is better.