Thursday, December 29, 2005

Last few weeks films viewed:

(Out of 5 stars)
Batman begins (****)Best popcorn movie of this year.
Usual suspects (****) Good thriller.

I will write my take later. Too busy enjoying my vacation with kids.

Monday, December 12, 2005

Last weekend movies

Saw (2004)

It is quiet perfect thriller. (Sometimes disturbing too.)
Movie start with two men in old, abandoned, large bath room with their legs tied with a dead man in between. A note in their pocket says that you have kill the other person. It was a game played by a serial killer. Movie ends with who survived in that game.
Direction & script is very fast paced and hold you in your seat for whole two hours.
Very gripping screenplay. I watched many thrillers (silence of lambs, seven, bone collector etc) but this movie ending was awesome & stunning & twisting one.
Only negative point in this movie is, director did not explain why serial killer is doing all this. Seven, Bone collector etc shows their characters differently.
Movie ended in such a ways that there another part in is on the way.
It is very low budget movies & a big hit.
A worth watching for thriller fans.

I watched another awesome movie “Leon The professional” movie too.
I will add review later.

Chanakya (Indian politician, strategist and writer, 350 BC-275 BC) quotes

I always admire Chanakya's work.

{Right from 12 years old. Very important person in Indian history. I forgot almost all the history but not his name & his work.}


Few of his quotes


1) The biggest guru-mantra is: Never share your secrets with anybody. It will definitely destroy you.

2) There is some self-interest behind every friendship. There is no friendship without self-interests. This is a bitter truth.

3) A person should not be too honest. Straight trees are cut first and honest people are screwed first.

4) Before you start some work, always ask yourself three questions - Why am I doing it, What the results might be and Will I be successful. Only when you think deeply and find satisfactory answers to these questions, go ahead.

5) As soon as the fear approaches near, attack and destroy it.

6) The world's biggest power is the youth and beauty of a woman.

7) Once you start a working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest.

8) A man is great by deeds, not by birth.

9) Treat your kid like a darling for the first five years. For the next five/ten years, scold them. By the time they turn sixteen, treat them like a friend. Your grown up children are your best friends.

10) Books are as useful to a stupid person as a mirror is useful to a blind person.

11) Education is the best friend. An educated person is respected everywhere. Education beats the beauty and the youth.

12) Even if a snake is not poisonous, it should pretend to be venomous."

I will add more later.

Friday, December 09, 2005

My take on movie "Crash" (2004)

Tag line: You think you know who you are.

Movie start with cars crash on LA suburbs.
Immediately movie goes back to last 24 hours of
people who met this crash and lives.
Movie got very smart & intelligent script showcases not only characters,
but real representation of real people.

Shot in the background of LA
(Where you will see white, black, Asian, spanic and French etc)
live together & their personalities and racist feeling w.r.t others & on the system.

Again movie has everything.
Right & brilliant script, good casting & apt locations & good photography etc.

Very worth watching. Dont miss it.

Thursday, December 08, 2005

My failed DVD recorder hacking story

During black Friday, I purchased Liteon DVD recorder.
It is working well. Easy to setup & records favorite TV shows.
But my main objective to buy this recorder is to make a copy of costly DVDs.
My little Dhanvi sometimes handles DVDs badly. Sometime he is very quiet nice.
For his age, he is doing great in handling DVDs. He select his own title from the collection & plays. We have to see what he is doing. He is quiet perfect on this.

Idea is to backup my own DVDs. So I searched net for any hacks.
I found following discussion forum for this.

http://club.cdfreaks.com/showthread.php?t=124298&page=3&pp=25

I tried it yesterday. But my hack attempt failed.
It is not working on my model Liteon LVW-1001HC1.
What a bad-luck. What a sad ending.

Wow. "Family Guy, Vol. 2: Season 3" Boxed DVD set for $10. Hurry

Ordered "Family Guy, Vol. 2: Season 3" boxed DVD set today from www.fye.com.
Check deal of the day section.
It is very good deal. ($30-$20 rebate.)
But for $10 you really can't go wrong.
Quiet neatly produced series. Sit, relax & enjoy.

Wednesday, December 07, 2005

Careful with blockbuster online rentals.

Couple of days back, on their website, I searched for movie “LEON”
and search resulted in many matches.
(Basically I saw picture of the DVD cover and read Leon: the professional etc.)
I selected one & added to my queue.
Yesterday I received movie from them & played DVD around 10PM.
Guess what happened. This is a bonus disk.
Contains some experts from stars, director, some other movie previews etc.
Not the movie, not even deleted scenes from the movie.
I am very disappointed.
Later checked blockbuster website.
It was mentioned that in title that it was Bonus disk only.
I am really surprised that people do rent “Just Bonus Disk?”
My wife scolded me. Don’t you read the complete title properly?

I said why somebody rents Bonus disk for movie price?
It is a supplementary DVD right?

My theory was, if you go to shop & buy the DVD movie you will get movie + bonus disks as a package. So if I am renting, I must receive the whole package.
But my theory was dead wrong with this.


This is first time I am renting DVD movies online, so be careful with the titles.
Blockbuster ships “Bonus” disk as movie for $.
Clever business or I am not knowledgeable to understand things properly?

So next time, if you rent movie, make sure you are ordering correct one.
Else you will end up with bonus DVD.
A crazy online DVD rental experience. What about you?

Tuesday, December 06, 2005

Hurray. Ordered "Die Hard" Boxed DVD set.

Ordered "Die Hard" boxed DVD set today during lunch time.
It is very good deal. ($30-$20 rebate.)
I am not fan of pure action movies or popcorn movies or Bruce.
But for $10 this is worth set to own.
Waiting and searching for good deal on Night Shyamalan DVD package deal.

Monday, December 05, 2005

Bad Weather & Dull weekend

Weather is too cold (upper 10’s F). This is my 5Th year in MN. But this is one of the worst December months. Single digits are common in Jan but not before new year eve. Want to go to shopping to Bestbuy but decided not to. Looking for good External hard drive & Laptop internal DVD recorder.
Did not do much except playing with kids.
Saketh started sitting on his own & he is trying to standup on his own.
Just playing with kids for the whole day & reading the pioneer press news paper.

Click following link too see MN Weather.
http://www.twincities.com/mld/twincities/13332539.htm
Minnesotans awoke Monday to the state's first hard cold snap of the winter, with below-zero temperatures in many parts of the state.............

Sunday, December 04, 2005

Interesting Upcoming Movies

Went to Barnes and Nobel Friday night story time with family
Dhanvi & mama went to story time,
I am with saketh reading few magazines.

Seems to be the following forth-coming movie is very interesting.

King Kong from Lord of rings director, Naomi Watts (Ring fame Rachel) etc.
Production pictures are looking very good.
Click link http://www.kingkongmovie.com/ see to more details.

Just released

Syrian
Syrian script written by Traffic movie writer.
(Traffic is one of my favorite movie. )

Friday night movie Heavenly Creatures(1994)

I don’t know why this movie in my watch list. (May be Oscar nominated)
It is story about two close girl friends story.
The friendship so close is that, when their parents try to separate them,
they plans and kills one of their mother.
It is based on a true story happened in 1950's.
Again movie has great casting, locations, photography etc.

Don't rent it.
Safely you can borrow from your public library and watch it.
It is 100% for Drama lovers.

Friday, December 02, 2005

Recent photo with saketh

Dhanvi in Halloween Dress.

My younger son "Saketh" photo

Bedtime Story "Bad Lion" for Dhanvi

This is one of the bed time stories for my elder son Dhanvi.
This is my childhood text book story. Converted slightly for young boy’s purpose.
There is one big forest & one big bad lion. It is bad because it kills all animals. Since it is strong animal, no animal can fight with him. So all animals decide & go to him & say, lion don’t kill all of them. We will make turns & per day one animal will come to your home & u can eat. No more hunting for you. Bad lion accept it. Because it don’t have to run & fight with others. So per agreement, animal makes turns.

At first “A” like alligator, “B” like bear etc…. (I will try go with alphabet sequence. For most of the alphabets, he will say the animals.) When finally it is rabbits turn. Rabbitt is small animal but it is clever animal. So rabbit thinks, thinks and finally goes to bad lion home very late.

Bad lion is very hungry and angrily says why you are so late?

Then rabbit says “I saw another lion on the ways. It took lot of time to escape from that one”
Then lion says ‘Another lion in this forest? I am the king” Show me where it is?
Then rabbit takes him to one old well & says “it is in that well”
Bad lion climbs the well wall & sees inside.
I will ask Dhanvi what bad lion will see? He say a loud, its image.
Now story continues as
“Bad lion is strong but not clear” So it think that is another lion inside well.
So it says “I am the king of the forest. So surrender me else I will kill you”
But the same words comes back.
So angrily bad lion jumps in to well & what happens to bad lion?”
Dhanvi says “bad lion chachipoyiii." (Telugu word for "killed")
I will ask him why? He says “bad lion don’t know swimming” &

he continues " But I am learning. Now I am at ell stage."

(He remembers his swimming level.)
Normally I will stress him about “alphabets and animals” You have to be clever like rabbit. Think, think etc. Later swimming stuff. It is fun.
Slowly we move to another story.

Thursday, December 01, 2005

My take on Ring Two (2005) movie

I liked Ring 1 a lot. But in part 1 raises more questions than answers.
In particular girl (samara story) the video tape origination and Why now suddenly she started killing? Part 1 did not answer those questions. I watched second part with some hope on some of these questions.

Now coming to second part review , Rachel & her boy moves from Seattle to Oregon & she get job in local new paper. Hoping that they will have better life. In the next scene, again young couple watching TV, video tape & death. (Very much similar to part 1.) Next scene onwards, director shows samara alive in the new place too. Later some of Rachel’s actions make her anger too. Now samara enters in to her son’s body. (These sequences of shots are good.) Now Rachel thinks that better to end samara before it is too late. She goes to original places and investigates Samara story. i.e. where she came from. (Story revolves around before samara adoption ) & movie ends with killingor stoping of samara.
A last major dialog was I am not your fucking mummy.

Part 2 address some of questions but again raises more questions, if samara is looking for Mummy and her love. I think the step mom have already provided that stuff. (In part1, they show stopmom tries a lot for a baby then finally, she adopts samara.) Again why suddenly Samara starts her evil acts? What prompted those? Part2 shows that a video tape spreads around the country and everyone makes a copy? If so, no investigation by any?
Samara original mom dialog “listen to baby”. She says, she tried to kill samara because she asked her to do. But they show samara as infant. Samara mom dairy content is confusing.
Like this many are unanswered.

Now coming to movie, there is not much plot and not much shock like part1. Nearly five & six shots are worth scaring. Actors did good job. In particular Rachel role is too good. Other casting, locations, photography etc are good & apt. Again do not except too much in part2.

At the end, I felt it is different way of story telling with lot of questions & answers left for viewer’s imagination.

Sunday, November 27, 2005

My Black Friday experience

Basically I need one good desktop for my kids. I pinned down to Best Buy’s Emachines desktop system. (Because it is flat $150. No rebates etc.) Also I planned few more items like sandisk 512MB MP player, Lite-on DVD recorder etc.
Based on the Internet discussions, hype, retailers publicity I know that I have to go to store before three hours. Initially I thought 3 AM is OK but later I thought 2AM is good.
At one point I feel it is better to go there before 1AM too. But I did not. I went to bed around 11AM. Slept for couple of hours. Woke up around 1.20 AM. Finally I started from home around 1.35 AM. Reached BB around 1.50. After parking car reached the line around 1.50 AM. More than 25+ people are already in the line with tents, blankets etc. Initially I got doubt that Will I get desktop? But I stayed in the line. No point in going back & sleeping again.
Decided to try my luck. Temperature is around 9F + it is too windy. Slowly more and more people are joining in line. One old lady (around 55+) joined the line next to me.
After first 30 mins, I started feeling cold. (My two-layer dress is not good enough.) I brought some tea to keep my self-warm. Started drinking the first cup of tea. Old lady next to me started talking. Initially I am very surprised why she is in the line. She told me that her son wants a Game cube package. (It is $100 less than retail price.) Seems to be during thanks giving dinner, he told to her. She decided immediately & seems to be she came very well prepared. With 4 layers of dresses & one think fleece blanket. Her son works in Costco, which is very opposite to BB. He is working at that time. (Around 4AM.) But I am very surprise with her decision. (For $100 saving, 3+ hours of standing in cold 9F) May be this is called true love? Or extreme love or true bargain hunter? Her son came by before going to Costco work (around 4AM), handed hot coffee to her. I was listening to songs & some times talking to other people around me. Around 4.05AM, BB folks started giving tokens to people in the line. First started with Toshiba TV, Kodak digital camera etc. Later Panasonic Camcorder. I took Panasonic token. Waiting for computers stuff. $380 Laptops are gone. Started feeling tension about desktop. Desktop tokens came. Luckily I got token for Emachine's desktop. I asked old lady to get additional token for me. (To give to my friend.) She took the token & give it to me. Time is around 4.30. Tea is over & wind is increasing & started feeling too much pain. Basically water is coming from nose continuously. Old lady offered her fleece Blanket to me. Saying that you much come with much better dressing & don’t give up. Last 30 mins is very horrible to be me. Finally store opened prompt 5AM. I went inside & took all the planned stuff & went in to checkout line. All done by 5.40 AM except desktop pickup. Separate line was created for desktop checkout. That line is too long. So I decided to go back to other stores & come back later. While returning from BB, I checked lines at circuit city & Office depot. Lines are too big. Decided not worth waiting. Started immediately & went Menards around 6.40 A.M. Struggled to get a parking spot. Finally managed a parking. Went inside & grabbed all the planned stuff & immediately went t checkout lines. All done with in 40 Mins. (Brought car seat for saketh, batteries, activity books etc. Back to home around 7.20AM. After little bit of breakfast, again went to BB to pick up desktop & camcorder & some rockeers etc. Returned home by 11 AM. It is snowing heavily. Return drive was too messy & very slow. Finally everything went smooth. Got lot of body pains later. (May be because of cold whether exposure.) Used some painkillers later. We put the desktop in the afternoon session & it was working great. Dhanvi face was glowing like a 1000-Watt bulb after seeing his new desktop. He played for couple of hours. I am very much happy after seeing his face. All pain is gone.
Later part of the day, I started thinking it is worth? May be if I buy all of them via sale prices, may be I will pay additional $400 to $500 for my stuff. So started thinking deeply about it.
it is worth going around 2AM in cold, alone? I felt is it is an good experience. In particular old women story was really touching to me. I placed myself in her position. Will I do that at her age? Still I am not sure at this point. This is my 7 th year in USA. Never went to black Friday shopping at that early. i.e. I went to stores but always after opening of the store i.e. after 5 or 6 AM. Whatever is left, I used to collect. But this year, it was whole new experience.
I saw all kind of people. (People who badly need some thing, people nice to have items, just to give the loved ones the asked stuff, and some idiots too. Who came around 5AM and trying to jump in to lines.)? Overall this black Friday is more than bargain hunting for me.
Share yours opinions too.

Monday, November 21, 2005

Swingers

by Doug Liman

I watched this movie director’s previous movie Bourne Identity.
So I put his movies in my watch list. Last week-end I watched swingers.

Overall, This movie is a one of the best teen’s comedy movie.
Coming to review part, This is story about a guy & his friends moved from NY to LS for
His Hollywood dreams after his girl friend dumps him.
Whole movie revolves around this guy & his friends.
All about real people & real incidents & their dating experiences, feelings etc.
In particular this movie ending was awesome. I liked it.

Dont watch without any expectations.
Again my credits to writer & director. Both did commanding job.

Monday, November 14, 2005

Dead Man (1996) review

Directed by: Jim Jarmusch

Nearly 5 years back. I watched this director’s movie Mystery Train.
I liked it a lot. So I purchased “DEAD MAN” DVD.
This movie theme on US Wild West 1800 time period.
Director tries to show the real facts of the Wild wild west in 2000?
I don’t know. I thought it is an adventure film but I am 100% flop on this guess.

Now review part, movie start with Johnny Depp, traveling from Cleveland to West (machines) on a train for a Job purpose. One more import point is the whole movie was shot in black & white. For first five mins, he shows different people changing but still Depp is on the train. Finally he reaches the destination & goes to the office, where he got job offer. After reaching there, he come to know that he lost the job to somebody else. In the same night, he meets a girl at the bar. He goes with the girl. Before sleeping on the bed, girls ex husband, come to the girl’s room. Boom, few arguments and some shooting. Girl & her ex. friend are dead on the spot. Depp get injured. (To save Depp, girl comes in front of Depp. Bullet goes from girl heart to Depp’s heart.) Depps escapes from the spot on a horse to wild country side. Girlfriend's ex husband father hires, three killers to shoot Depp. Now chase is on. After escaping, Depp meets a native Indian ( his name is nobody, funny). He tries to remove Depps bullet from chest. But it is too deep. Now Indian put some sprit in to Depp’s body. Now chase is on. Killers tries to kill Depp. Now movie keeps on goes on killings & funny native Indians dialogs etc.etc. drags for 70+ mins.

Ending was not interesting or good to me.
Only good thing is too good photography & absolute amazing visuals.
(In black & while, he shows the Wild West scenes too good.)
Some times background score is too exceptional.
(Some times too loud & bad.)
Actor’s performance was good.

Finally I felt, I watched an American classic or Art movie or western psychic movie?
I don’t know. Not satisfied with whole movie.
(May be I am expecting adventure? Or I am not ready for two hours of black & white movie?)

Friday, November 11, 2005

Abc of DVD copy

Good one.

Tuesday, November 08, 2005

Heaven(2002) movie review

It is my first review. So bare with me.
Before going to the movie review, reason to watch this movie is I liked
this director’s previous movie RunLoraRun.
(Though it was inspired movie, this movie was good.)

Now coming to movie part, movie start with lady (Philippa) trying to kill a man by keeping a bomb in his office. But her attempt fails & police catches her. Now interrogation process, young police officer (acts as translator) helps her to escape from the jail. This whole sequence is escaping from police is too good. (Simple ideas & effective execution too.)
Immediately after escape, again with the help of the same young officer, she kills the bad man. (She wants to kill this man, a drug leader, because of him, her husband and other young kids die with drug over dosage.) Next 30 mins, both (Philippa & translator) tries to escape from the chasing police officers & translator expresses his love to her.)
Ending was unsatisfactory to me. (May be I did catch the director thoughts here.)
I don’t want to reveal the ending in this review.

But over all it is good movie with good action from actors, brilliant visuals & locations & quiet & simple effective dialogs.

In particular, I watched so many movies but this movie locations are simply great & awesome.

Friday, November 04, 2005

Recycle old computer

Buying a computer or laptop from dell.
Don't forget adding free recycle kit while ordering.
It is absolutely free.
I recycled my 8 year old computer freely.

Tuesday, November 01, 2005

good one

An interesting website for products & reviews & discussions etc.
See their blog at
http://www.woot.com/Blog/Default.aspx

Tuesday, October 18, 2005

XSLT

XSLT an XML-based, declarative and functional programming language.

declarative programming

A style of programming that concentrates on what to do, rather than how to do it, as opposite to imperative programming.

A common example of declarative programming would be an HTML document (which describes the structure of the page, but not how to actually construct the view.
At least, in principle.)

imperative programming

In imperative programming is traditional way of programming, a sequence of instructions to be executed.
For ex
do this task
do that task
do another task

imperative programming is about telling a computer how to do something

functional programming

In functional programming rather than presenting a program as a series of steps, it's represented with interdependent math-style functions,
where you set one value, a variable, and all the contingent values snap into place, like a spreadsheet.


Programs are viewed as descriptions of problems rather than instructions.

Tuesday, October 11, 2005

What type of files is .rar extension?

rar is another archive mechanism to save the space.
Download the archive binary from the following location.

Thursday, September 08, 2005

jasper reports (Free Java open source reports framework )

Recently I worked with the following open source reports framework.
It was very promising to me.
May be I will give sample prototype code in this site later.
Basically it is free & extensible & simple reports engine.

Java 2 1.4.2 API specification

Just core Java platform API's only.

Thursday, July 28, 2005

new book in my book collection

Book info:
Title: Service oriented architecture
a field guide to integrating XML and web services.

Author:
By Thomas Erl

I started reading the above book. (Just few pages only.)
I liked it.
Read the reviews the above link. See other users reviews too.

LCD monitor Dead Pixels Test

good one.

Thursday, May 19, 2005

Java sorting strings

// Sorts the input arguments

public static void main(String[] args)
{
//just sort the input command line args
Arrays.sort(args); // sorting works for many primitive data types
//sorting objects will be another section.
//Print the sorted array
for (int i=0; i .lt. args.length;i++)
{
System.out.println(args[i]);
}
}

Wednesday, May 18, 2005

Java Swing To Set custom Look and Feel to UI

if ( setcmd txt is "Windows")
{
lfName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
}

try
{
UIManager.setLookAndFeel(lfName);
}
catch (UnsupportedLookAndFeelException ex1)
{
System.err.println("Unsupported LookAndFeel: " + lnfName);
}

Wednesday, May 11, 2005

Eclipse SWT vs. Java Swing

Good article.

copy xml document via xslt.

Few months back, one guy stopped by office & asked me I want .xsl file to copy the incoming xml file. At first I am bit shocked why you want to do that, later he explained the scenario. Immediately I got confused how to ? but did it in 10 minutes. But a crazy scenario. here is code for that part.

.lt. xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" .gt.
-- match the root node and copy it --
.lt. xsl:template match="/" .gt.
.lt. xsl:copy-of select="."/ .gt.
.lt./xsl:template .gt.

.lt./xsl:stylesheet.gt.

.lt. less than symbol .gt. greater than symbol

Eclipse 3.0 onwards. Using ImageRegistry & plugin your own images

The ImageRegistry is intended to be used for Images
that appear frequently in your plugnin UI.
To use ImageRegistry make sure your Plugin class a subclass of org.eclipse.ui.plugin.AbstractUIPlugin.

This class creates an ImageRegistry automatically (one per plug-in instance) and
override/implement the following methods.


public Image getImage(String id)
{
ImageRegistry ir= getImageRegistry();
return (Image)ir.get(id);
}

public ImageDescriptor getImageDescriptor(String id)
{

ImageRegistry ir= getImageRegistry();
return (ImageDescriptor)ir.getDescriptor(id);
}


protected void initializeImageRegistry(ImageRegistry image_registry)
{

ImageDescriptor desc = ImageDescriptor.createFromURL(generateURL("myOwnImage1.gif"));
image_registry.put("myOwnImage1",desc);
}

private URL generateURL(String file_name)
{
Bundle bundle = Platform.getBundle(PLUGIN_ID);
String iconPath = "icons/";
String completePath= iconPath+file_name;
IPath path = new Path(completePath);
URL url = Platform.find(bundle,path);
return url;
}

Tuesday, May 10, 2005

Java Sample code to write exception stack trace in to a file.

My previous code is too big. So I will add small code today.
Normally in the try catch block, if we have exception object, we will print exception object with printStatckTace, getErrorMessage etc. But I faced a situation in which, I need to log all the exception trace back stack in to a text file. Later admin want to view this log file for all tracebacks.
Just think how to write exception trace in to a txt file.
Here is the code block for the above problem.

StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
StringBuffer error = sw.getBuffer();
String exceptionString = error. toString()
Note: StringWriter, PrintWriter classes comes from io package.

Monday, May 09, 2005

Validating XML files under a web application. ( aka a file system path.)

Following code parses xml files under a directory. (It was recursive one.)
We have a web application which is very much similar to struts framework.
So we have tons of xml preference files.
Before launching tomcat, I will invoke the following code to make sure that
all xml files were valid one.

public void parseDirectory(String fullpath)
{
if ( fullpath == null) return;

Path path = new Path(fullpath);
File file = path.toFile();
File[] files = file.listFiles();
if (files==null) return;
int size = files.length;

for (int i=0; i .lt. size; i=i+1)
{
if (files[i].isDirectory())
{
File[] dirFiles = files[i].listFiles();
String dirName =files[i].getName();

System.out.println("\n processing directory"+dirName);
for (int j=0; j .lt. dirFiles.length; j=j+1)
{
File subDirFile = dirFiles[j];
String subDirFileName = subDirFile.getName();
if ( subDirFileName.endsWith(".xml"))
{
parseXmlile(files[i].getName();
}
else
{
if ( subDirFile.isDirectory() ) parseDirectory(subDirFileName);
}
}
}
else
{
String fileName = files[i].getName();
if ( fileName.endsWith(".xml"))
{
parseXmlile(files[i].getName();
}
else
{
// it is not a xml file & directory.. so skip it.
}
}
}
}




public void parseXmlile(String fileName)
{

try
{
System.err.println("Parsing " + fileName + "...");
// Make the document a URL so relative DTD works.
String uri = "file:" + new File(fileName).getAbsolutePath();
XmlDocument doc = XmlDocument.createXmlDocument(uri);
System.out.println("Parsed OK...");
}
catch (SAXParseException ex)
{
System.err.println("================================");
System.err.println("| *Parse Error* |");
System.err.println("================================");
System.err.println("+ Line " + ex.getLineNumber ()
+ ", uri " + ex.getSystemId ());
System.err.println(ex.getClass());
System.err.println(ex.getMessage());
System.err.println("================================");
}
catch(SAXException ex)
{
System.err.println("================================");
System.err.println("| *SAX XML Error* |");
System.err.println("================================");
System.err.println(ex.toString());
}
catch (IOException ex)
{
System.err.println("================================");
System.err.println("| *Input/Output Error* |");
System.err.println("================================");
System.err.println(ex.toString());
}
catch (Exception ex)
{
System.err.println("================================");
System.err.println("| Unknown error |");
System.err.println("================================");
System.err.println(ex.toString());
}
}

Friday, May 06, 2005

Eclipse 3.0 onwards. A Light Weight Decorator sample.

Eclips 3.0 onwards only. for plugin developers.

Sample code to implement powerful Light Weight Decorator to
paint tree and XXX nodes.
I used it to paint tree nodes in my project to show different images on top
of standard tree folder,+,- signs.

1) plugin.xml add the following node.
point="org.eclipse.ui.decorators">
decorator
adaptable="true"
label="%plugin.my_label"
state="false"
lightweight="true"
location="BOTTOM_RIGHT"
class="com.xxx.TreeLabelProvider"
id="com.xxx.views"
enablement
objectClass
name="com.xxx.TreeObject"
objectClass
enablement
decorator
extension
stpid tool is not allowing me enter comple xml syntax.
2) open tree object class & add/ implement the following.

TreeLabelProvider extends LabelProvider
implements ILightweightLabelDecorer

implement
public Image getImage(Object element)
public String getText(Object element)
and
public void decorate(Object element, IDecoration decoration)
{
if (element instanceof TreeObject)
decoration.addOverlay(error,IDecoration.BOTTOM_RIGHT);
}
catch relation between TreeLabelProvider & TreeObject.
U are done. enjoy.

creating read-only views of collections inside a application

// create a list and add some items to it

List stringlist = new ArrayList();
stringlist.add("alpha");
stringlist.add("beta");
stringlist.add("gamma");

// create an unmodifiable view of the list

List rolist = Collections.unmodifiableList(stringlist);

// add to the original list (works OK)

stringlist.add("delta");

// add through the read-only view (gives an exception)

rolist.add("delta");

dumping system properties

Just to dump java System class properties.

try
{

////dumping system properties.

// Note1) If property is duplicated it will use the later value for key value

Properties p = System.getProperties();
Enumeration e= p.propertyNames();
for ( ; e.hasMoreElements();) {
String o =(String) e.nextElement();
System.out.println( "\n Key="+ o);
System.out.println( " Value="+ p.getProperty(o) );

}

}
catch (Exception e)
{
System.err.println("Directory " + e.getMessage() + " is invalid.");
e.printStackTrace();
}

parsing a Date string

U got date input as string. (In some MM/DD/YYYY format)
Now I want the equivalent Java date object.
(For further validity & further processing.)
Use the following segment.


public static void main(String args[])
{
String dt = "10-10-1990"; // some test data

try{

SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
// input date format
format.setLenient(false);
Date date = format.parse( dt );
System.out.println("The parsed date: " + date);
} catch (ParseException e) {
System.out.println(e.getMessage());
}

About myself.

Working as software engineer.
Just want to post some useful Java, Eclipse, C/C++, XML/XSLT programming samples, tips, tools etc. Day2day programming life, I come across these things.
Just for my reference & may be useful for others too.
My sons first two letter are the blog spot name.
I will update their pictures later.