Hi
my friend suggested me this cool tool ...
i wanted to colorize my code .. using the color scheme as in IDE
this is cool copy cust paste tool ...
sth we all programmers (??) are used too
http://www.chami.com/colorizer
he he he
Saturday, July 28, 2007
Good Servlet Bad Servlet
lest try to code the same servlet in good way and bad way
now the same code in Good servlet
public class Bad_Servlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
// BAD : this line created one more java object to be GC
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
System.out.println("LOG : Init called");
// BAD : using sop is bad it will require Servlet
// to synchronize disk actions and http response.
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String output="<html>";
output+="<head><title>Bad Servlet</title></head>";
output+="<body>";
output+="<p>The servlet has received a GET. This is the reply.</p>";
output+="</body></html>";
// BAD : pat ur backs once if u judged using variable will create one
// more object for Garbage Colection PAT ur back many times if u judged
// that using + operator with "temp" will cr8 many temp string objects 4 GC
out.println(output);
out.close();
}
//BAD : overriding destroy() will help u freeing ur resources ..
// that will reduce burden on webServer GC cant go ahead until
// it is sure resources re free
}
now the same code in Good servlet
public class Good_Servlet extends HttpServlet {
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>Good Servlet</title></head>");
out.println("<body>");
out.println("<p>received a GET. This is reply.</p>");
for ( int i = 10; i > 0; i-- )
{
out.print( "<h1>" );
out.print( i );
out.println( "</h1>" );
out.flush();
// make sure the browser see the count
// another use of using println()
try
{
Thread.sleep( 1000 );
// this loop takes time
// BUT user wont experience difference
}
catch ( InterruptedException e ) { }
/*
If a page contains a number of graphics
(in a header, for example), each of those graphics
needs a separate HTTP request to be loaded.
If the servlet calls flush() after writing the
IMG tags for the graphics into the PrintWriter,
the browser can start loading the graphics
while the servlet is still processing the original request.
This reduces the amount of time required to display the
complete page in the browser because the separate requests
can be handled concurrently.
*/
}
out.println("</body></html>");
// The difference here is that all output is written directly
// to the PrintWriter, which does not require creating any
// intermediate objects
out.close();
}
public void destroy(){
}
}
Monday, July 2, 2007
Guruji .... a guru ??
came accross http://www.guruji.com/ the first thing i did not like is the punch line ...
"the indian search engine"
guys why do you want to regionalise technology ... and why are people trying to cash on region wise ... its a big world out there ... go compete.... may the best technology win ... !!
and the funnier part ...
try searching ... "flex coders india" ( mind you tried searching something specific to india )
and the FIRST result i got was ....
http://www.punebusinessdirectory.com/BuyingSelling/ShowProductEnq.asp?ProductID=962
based on following highlighted text
(Baddi, distt-solan , INDIA) BUY CODERS PRINTERS Details REQUIRED RENUKA ENTERPRISES (KHAMGAON , INDIA) FLEX BOARD INKJET JET PRINTER
man that was pathetic ...
try the same on THE Search Engine .. i mean google ... and u get
http://www.flexcoders.net/ ( international registry for flex coders )
and second result ...
google group ... groups.google.com/group/bombayflexcoders
second is more relevant than 1st ...
and DEFYING the "dont be eveil motto"
guruji started a contest ... for everyine to use there search engine .. and win prizes
ok ... quite a few people will start using this service if promoted like this
but what after the offer is gone ..
WHY WOULD SOMEONE USE SEARCH ENGINE THAT GIVE INAPPROPRIATE RESULT ...
as the saying goes ... 1st impression is the last impression ...
all i can say is that
(i) guruji u need improve a lot ...
(ii) guruji pls dont bias in terms of regionalism ...
(iii) dont bribe guruji ... that is not good in long term ...
hope to see gurji in better shape soon
cheerz !!
"the indian search engine"
guys why do you want to regionalise technology ... and why are people trying to cash on region wise ... its a big world out there ... go compete.... may the best technology win ... !!
and the funnier part ...
try searching ... "flex coders india" ( mind you tried searching something specific to india )
and the FIRST result i got was ....
http://www.punebusinessdirectory.com/BuyingSelling/ShowProductEnq.asp?ProductID=962
based on following highlighted text
(Baddi, distt-solan , INDIA) BUY CODERS PRINTERS Details REQUIRED RENUKA ENTERPRISES (KHAMGAON , INDIA) FLEX BOARD INKJET JET PRINTER
man that was pathetic ...
try the same on THE Search Engine .. i mean google ... and u get
http://www.flexcoders.net/ ( international registry for flex coders )
and second result ...
google group ... groups.google.com/group/bombayflexcoders
second is more relevant than 1st ...
and DEFYING the "dont be eveil motto"
guruji started a contest ... for everyine to use there search engine .. and win prizes
ok ... quite a few people will start using this service if promoted like this
but what after the offer is gone ..
WHY WOULD SOMEONE USE SEARCH ENGINE THAT GIVE INAPPROPRIATE RESULT ...
as the saying goes ... 1st impression is the last impression ...
all i can say is that
(i) guruji u need improve a lot ...
(ii) guruji pls dont bias in terms of regionalism ...
(iii) dont bribe guruji ... that is not good in long term ...
hope to see gurji in better shape soon
cheerz !!
Thursday, June 14, 2007
Safari for windows ... BUGGY ??
continuing the browser war ... apple recently (June 12, 2007 ) introduced "safari" for windows ... as always being bitten by tech bug to try out new software .. i installed it and started using it ... but using popular web2.0 sites on safari is not a possible as of now...
try out using yahoo mail beta .. you get a screen saying your browser is currently not supported ... and even if one continues using it .. surely safari will crash ...
on the other hand ... try using gmail .. google suggests work fine on it ... infact i read it somewhere google pages that they are currently working to make there sites compatible with safari ... guess they are already on way .. moreover the way safari displays text box etc .... is really nice .. i mean all that blueish light around login text box .. cooollllll
talking of bright side ... the 'search feature ' on safari is something really out of box ... excellent i must say ... as soon as you search a text all the occurences get highlighted (obvious ... ) but the best part is rest of page turns greyish ... making the searched text easily viewable ...
movable tabs ... i dont think its a great feature ... ok kinda thing ...
moreover ... security is a big big drawback ... find posts here and here ... about secuirty issues of theis browser ...
moreover ... i found a bug in the 3.0 release ... and logged it against apple .. Bug ID#5271889 ... lets see how they track it ...
introducing safari for windows is a nice move ... but the first impression is ... its buggy ... and moreover they shouldnt have released it as Beta version .. looks more like an alpha to me ...
try out using yahoo mail beta .. you get a screen saying your browser is currently not supported ... and even if one continues using it .. surely safari will crash ...
on the other hand ... try using gmail .. google suggests work fine on it ... infact i read it somewhere google pages that they are currently working to make there sites compatible with safari ... guess they are already on way .. moreover the way safari displays text box etc .... is really nice .. i mean all that blueish light around login text box .. cooollllll
talking of bright side ... the 'search feature ' on safari is something really out of box ... excellent i must say ... as soon as you search a text all the occurences get highlighted (obvious ... ) but the best part is rest of page turns greyish ... making the searched text easily viewable ...
movable tabs ... i dont think its a great feature ... ok kinda thing ...
moreover ... security is a big big drawback ... find posts here and here ... about secuirty issues of theis browser ...
moreover ... i found a bug in the 3.0 release ... and logged it against apple .. Bug ID#5271889 ... lets see how they track it ...
introducing safari for windows is a nice move ... but the first impression is ... its buggy ... and moreover they shouldnt have released it as Beta version .. looks more like an alpha to me ...
Sunday, May 6, 2007
www.indianrail.gov.in : usability & accesibilty issues
Software has been a growth sector in India. But has software really changed our lives ... the way it should have .. or to its maximum potential ... ??
I am talking of government sites in particular ... I don't think that the Indian government web sites live up to the reputation that the Indian software industry has !!
I was not so much in favor of using the Indian railways web site for bookings until recently started using internet reservation... and not surprisingly found the following MAJOR BUGS in the same
I am talking of government sites in particular ... I don't think that the Indian government web sites live up to the reputation that the Indian software industry has !!
I was not so much in favor of using the Indian railways web site for bookings until recently started using internet reservation... and not surprisingly found the following MAJOR BUGS in the same
- The page picks up date of reservation from the client ... and does calculation accordingly .. if i change my computer date by a month then the it will be shown on the journey date ... but the worst part is the three months reservation period will be calculated based on the wrong date .... yikesss !! Only a novice web programmer can do such a thing ... taking clients date instead of server date ... i wonder which software company has developed the site
- I wonder what will the output be on linux systems ... or mac systems .. as using javascript to get clients date ... that part needs to be checked on all platforms ... what will happen for symbian OS ?? ;o)
- Site being slow .... and ... bank being debited for ticket charges while not getting the tickets is a common error !!
- The look and feel is not at all professional .... Off track ... not talking of bugs .. but general ... while going for e-ticket one is asked to carry the identity proof ... as if the normal tickets have a photo or some other identity mechanism ... so why this rule for e-tickets ?? i find no logic ... for same !! possibly a way to get
- Using outdated DOS based reservation system at the ticketing counter ,,,, phew !! ontop of that the dot matrix printers may give you un readable print outs ...
Wednesday, April 18, 2007
Interesting observation about JSF
i came across an interesting fact
due to my usual habit of copy_cut_paste
;o)
but will find about the reason for it later ... when i have more time in hand
If I have the following code on a page ... ( neglect the wrong syntax .. lib name excluded )
** NOTE ** that the id of both the <:selectOneMenu>
so how does JSF handles it ...
<:outputText value="SOME_OPTION" />
<:selectOneMenu id="id_one" >
<:selectItem itemValue="option_1" itemLabel="option_1"/>
<:selectItem itemValue="option_2" itemLabel="option_2"/>
<:selectItem itemValue="option_3" itemLabel="option_3"/>
<:outputText value="ANOTHER_OPTION" />
<:selectOneMenu id="id_one" >
<:selectItem itemValue="another_option_1" itemLabel="another_option_1"/>
<:selectItem itemValue="another_option_2" itemLabel="another_option_2"/>
<:selectItem itemValue="another_option_3" itemLabel="another_option_3"/>
well ..
It doesnt give a Compile time error
NOR does it give a Runtime error
... instead ...
when the page is displayed then the second option is silently removed
wonder why ??
due to my usual habit of copy_cut_paste
;o)
but will find about the reason for it later ... when i have more time in hand
If I have the following code on a page ... ( neglect the wrong syntax .. lib name excluded )
** NOTE ** that the id of both the <:selectOneMenu>
so how does JSF handles it ...
<:outputText value="SOME_OPTION" />
<:selectOneMenu id="id_one" >
<:selectItem itemValue="option_1" itemLabel="option_1"/>
<:selectItem itemValue="option_2" itemLabel="option_2"/>
<:selectItem itemValue="option_3" itemLabel="option_3"/>
<:outputText value="ANOTHER_OPTION" />
<:selectOneMenu id="id_one" >
<:selectItem itemValue="another_option_1" itemLabel="another_option_1"/>
<:selectItem itemValue="another_option_2" itemLabel="another_option_2"/>
<:selectItem itemValue="another_option_3" itemLabel="another_option_3"/>
well ..
It doesnt give a Compile time error
NOR does it give a Runtime error
... instead ...
when the page is displayed then the second option is silently removed
wonder why ??
Tuesday, April 17, 2007
securityException : package is sealed
Recently came across a securityException .. package is sealed
on doinga lil bit of search came to know that the reason is
classes14.jar was being some how imported twice in the project
so i removed one of the jar files which in turn had classes14.jar
and the code executed normally
but there are still some things which i will like to study and post later
more info here and here
on doinga lil bit of search came to know that the reason is
classes14.jar was being some how imported twice in the project
so i removed one of the jar files which in turn had classes14.jar
and the code executed normally
but there are still some things which i will like to study and post later
more info here and here
Subscribe to:
Posts (Atom)