Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!

k mayank

Greenhorn
+ Follow
since Feb 09, 2009
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by k mayank

Hi Campbell,

As soon as I thought I have got this done someone pointed out the mistake.
When I give 256.0f, The answer I expect is 100 and not 4380000.

When I try String s = String.format("%x",256L); I get the required result,
But this can only work for long data type. This fails as soon as I give more than 19 digits and I need to work with 20 digita.
Can you let me know how to work through this.
A quick hint by all is very much appretiated as this is bocomming a priprity now.

Regards,
9 years ago
Hi Ulf,

Thanks a lot for your reply and time. This was really helpful.

Thanks and Regards,
Mayank
9 years ago
Hi Peer,

Thanks for your reply.
This has made my doubts a lot clear.
Thanks again.

Regards,
Mayank
9 years ago
Hi All,
Thanks for your wonderful replies.
Carey, the classes suggested by your were really helpful and for now I have build the application and delivered.

Will surely come back in case something bad happens over there.

Thanks again to all for your help.

Regards,
Mayank
9 years ago
Hi All,

Thanks for your replies
This has been really helpful.

Regards,
9 years ago
Hi Rob, Adam,

Thanks for your wonderful replies
Now I can see where I went wrong in my assumptions.
Thanks again for all the help.

Regards,
Mayank
9 years ago
Hi Rob,

Thanks for your reply.
I can read the file using JAVA IO. What I wanted to know was is it possible to check and load a file just by filename(in case i dont provide full path to the file) from a java program.

Regards
9 years ago
Hi Rob,

Thanks for your reply. But ClassName.class.getResource() only work in case resourse is in same folder as the ClassName. I wanted to search outside the jar in the class path folders. My file(fow which I need the path) is in /root/config/file.txt, while the classes are in /root/lib/proj.jar and I have to run this application from /root/scrdir/script.sh

Now is this possible at all to dynamically get path of file.txt

Regards,
Mayank
9 years ago
Hi Friends,
I have a properties and a txt file which I need to load at run time. The problem is that I don't want to hard code the relative path ex ../sub/file

I tried the below command from static method of a class named CLassName

CLassName.class.getClassLoader().getResource(APP_CONFIG_FILE)

where APP_CONFIG_FILE is the file I want, however I am getting null back

Kindly suggest.

Regards,
Mayak
9 years ago
Thanks for your reply.
Both Sound good but as I mentioned in my first post, they dont give back exact Hex string. Float gives 0x1.5af1d8p66 and I was unable to convert it into clean Hexadecimal string.

Regards,



9 years ago
Sorry,

Some how the code I posted was wrong.
float x= 99999999999999999999f; //20 9's
String s = Float.toHexString(x);
System.out.println(s);


Thanks for your reply. I have checked on the BigDecimal class before posting but dont want to write seperate code just to calculate Hexadecimal of a number.
looking for some java API which can do this for me.

Regards,
9 years ago
Hi Friends,
I have a strange stiuation here.
I need to use a float number(because it is 20 or more, digits long), then calculate hexadecimal of this number, and then save the result in an integer and use that as a key.

However, the below program prints 0x1.5af1d8p66

float x= 99999999999999999999f; //20 9's
System.out.println(Float.toHexString(x));


Now I'm not able to convert this String result "s" to integer. Please help.

Regards,
9 years ago
I have checked the site. I'm currently using Orielly liabraries for multipart/form-data upload. Also I have checked the code in there.
The problem is by the time it comes to such liabraries, it already has HttpServletRequest object type and can just take out the body from them.
Currently I'm trying to figure out how tomcat might have implemented this.

Regards,
9 years ago
Actually I wanted to read headers using BufferedReader and body using InputStream. This was because i can use readLine from BufferedReader and make sence out of headers(and decide weather to forward the request to Servlet) while I dont want to do anything with body.

Looks like this is becoming very difficult to achieve.

Regards,
Mayank
9 years ago
Hello Friends,
Any suggestions on this......

How can I achive byte pass through and character passthrough on the same InputStream.

Regards,
Mayank
9 years ago