damodar kumar

Ranch Hand
+ Follow
since May 19, 2008
damodar likes ...
Android Chrome MyEclipse IDE
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by damodar kumar

Can we change private value while debuging
7 years ago
Thanks lot Rajasekar Krishnan
7 years ago
Hi,

A colleague of mine needs to develop an Eclipse plugin that has to parse multiple XML files to check for programming rules imposed by a client (for example, no xsl:for-each, or no namespaces declared but not used). There are about a 1000 files to be parsed regularly, each file containing about 300-400 lines.

We were wondering which solution was faster to do it. I'm thinking JDOM, and he's thinking RegEx.

Anyone can help us decide which is best ?

Thanks
7 years ago


Why last two line doesn't compile? Especially the last line. I've been doing quite a bit test on this topic but still couldn't catch the logic.

Thanks.
7 years ago
Java has gotten rid of the entire notion of a textual preprocessor (if you take Java as a "descendent" of C/C++). We can, however, get the best benefits of at least some of the C preprocessor's features in Java: constants and conditional compilation.

One of the inarguably good features of the C preprocessor is the ability to define compile-time constants using a textual name to represent some value. This makes it easier to read and maintain. It is also faster at runtime than using a normal variable.

An arguably abused feature of the C preprocessor is the use of #define along with #ifdef and friends to conditionally compile entire blocks of code. I say it's arguable since people often use this facility to deal with platform-specific issues (and that's both the good point and the bad point).

In C, one could define some constants in a header file via:


#define MY_BDATE 10
#define SILLY_PLATFORM]





and then getting access to those constants by using #include to include them in a code file, and then using them:

fprintf (stderr, "My birthday is on the %d" "th!\n", MY_BDATE);



The equivalent in Java can be done by creating public static final variables in a Java interface:





Then we can access them by using import to make the interface visible to us and then using the constants:

System.out.println ("My birthday is on the " + ConstantStuff.MY_BDATE + "th!");



The C preprocessor can conditionally strip out large areas of text if a given preprocessor constant was or was not defined.


#if defined(SILLY_PLATFORM)
/* Lot's of nasty code to deal with the stupidities of the
* SILLY platform.
*/
#else
/* Code to deal with other, normal platforms. */
#endif



Many folks lament that this capability is absent from Java. Remember, one of the reasons that Java is so wonderful is that the language is so much better defined, so system-specific code like that should not even be necessary.

Be that as it may, you can still get that sort of conditionally compiled code from the compiler directly! You just use public static final boolean constants as the condition for a regular if statement. The Java compiler is smart enough to recognize that as a special case and it can completely eliminate the test and the code of the appropriate conditional branch.

So just write the conditional statement as usual.



I don't know about you, but I hate having to write that long-winded interface name before using any of those constants. So, I just have my class that is going to use those constants implement the interface. Then I can just use the name directly, assuming there are no name clashes (in which case you'll have to distinguish them using the full names).
7 years ago
thanks for your suggestions

Damodar.
7 years ago


out put : Constructor2

My question is , defalut constructor will not have any return type, its universal truth.

But is there any differece in return type as void and not having return type.
both gives same meaning right?

Thanks,
Damodar.
7 years ago
go for below modified code


7 years ago
First of all , i should say thanks for talking about the issue by you,

I need logic for writing the files for every 60 sec in to new file with name as timestamp.

i know how to create the files, how to name the file with timstamp etc.

Thanks,
Damodar.
7 years ago
Hi friends,

here the issue not cross posting, if you are able to resolve the issue its thankful.

Thanks,
Damodar
7 years ago
Hi Darryl ,

I donot have knowledge of "cross postings"

but my intension is to get hlep from others by posting it in multiple forums

please can you help me atleast

Thanks,
Damodar.

7 years ago
Hi friends,

i have a quick question

i have .txt files a, b ,c,.....
i have to write the these files in to single file for particular time period lest take it as some 60 sec and have to save in pdf format
till for 60 sec we have to write to single file and save it by naming it with time stamp
after 60 sec, we have rite to new file from the cursor were it got stopped

please anyone can hlep on this.

Thanks,
damu



7 years ago
context param is for entire session of client so if you keep unnecessary things there it will become overhead for application
inti param is for that particular request or response

you need to differentiate where and when we can use those.
7 years ago
Hi Deepak,

First i will go for Singleton

there is a funtionallity where you are getting Meta Data on to the form, so if you hit database for every time it is overhead to server. Instead get the data for first time and keep it in cache and use it for everytime untill the Meta data is not changed, if data is changed clear it and again get it from database.

Now DAO pattern

you have a application connecting to different databases like oracle,DB2and MSSQL etc
for the above you have get connections and do some stuff for persisting the data. So for all 4 database you will have to get the 4 connection object , it means there will be 4 classes for getting connection mechanism.
Instead doing such redendunt code, have a factory class , which will give you connection object depending upon database you using .

Damodar
7 years ago