Romeo Ranjan

Ranch Hand
+ Follow
since Feb 23, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Romeo Ranjan

But then how to omit the first entry of the duplicate value and increment the following.

9 years ago
Thanks for the reply. Tracking of the last series value is already taken care of. The intialmap values are from the database and thats how we store some of our values. I am ok with it not being ordered. All I want is the second value to have the incremented series and so on and a best approach to do this.

Thanks!
9 years ago
Hi All-

I have a hashmap that has duplicate values.


Expected Output



If the value has no duplicates then no change. If yes, I want to replace the second value by incrementing the series (from 2000 to 2001) and if there is another duplicate then the next series 2002. Looking for some clean and simple idea of implementing this, no third party tools. So far I have thought of this logic in terms of

9 years ago
Martin thank you so much. Using the hierarchial query and by tweaking my original sql was able to generate the required sequence. Also thank you for the note.
10 years ago
Hi All,

I have a requirement to increment zero padded value. One of the column in my table is of datatype varchar2. Since the database is a vendor supported product I dont have the ability to create sequence or do auto increment. So the idea here is to get the max varchar2 value and then increment by 1. The output may be either one value or a list of values based on the number of value required. So the data stored in the column is of format "LST000001". So say for example I want to increment and get the next number it would be "LST000002". If I want a list of four number then it would be
LST000002
LST000003
LST000004
LST000005

The sql to get the max value of the column textvalue and increment by 1. I have not included my actual table name or my actual name rather used dual just get to give some idea. This works perfectly



But the question is how do I get the list? I tried the below statement but this does not work



I am not pl/sql developer. Is my approach to the requirement right? Or is there a easy/different way to do this using oracle sql? I want to do this using oracle sql rather than using java.

Can anyone please suggest me on how to approach this requirement.

Thanks!
10 years ago
Hi All,

I am trying to send email from my code using java mail. Here is the code snippet



The exception that I get is


I understand that the SendFailedException for invalid address might occur if the address may not exists which is not true-its my company mail address that I use. There might be a invalid syntax-no problem withthe syntax of the address..

I am not able to figure out the reason for the issue..Can someone please help me?

Thanks



12 years ago
Hi All,

When I want to write contents to two different files this is the way I do it.



Intialize two FileWriter and two PrintWriter instances, is this a better practise ?

Thanks
13 years ago
Dear Christophe,

Thanks for your reply. Can you please elaborate more on the logic, if possible with one line code snippet from my code. Somehow, I am unable to grasp the logic.

Thanks
13 years ago
Dear Ranchers,

I understand the fact that HashMap accepts duplicate values but not duplicate keys. I am stuck with a situation where I need to have duplicate keys is there a workaround for this.Here is my code



Output


Expected Output : The output above plus the below key and value
TOM---->SC14L2


Since the entry TOM is a duplicate key it give only the last entered value for it. Any workaround please???
13 years ago
Sorry about the compilation error. Thank you very much, the code works.

13 years ago
Dear Ranchers,

I have a tab delimited text file that has three columns.
8169 scott 297
9169 tiger 017
9151 bob 916

The output that I want to get is
8169
bob

But what happens it reads line by line and while inserting the records it overwrites the data and the result i get is
9151
bob

I have a string key 1,2,3 (the line counts) and the map as the value in the covermap, then why it is overwriting??
Is my approach to the problem wrong? My aim is to create HashMap<String, HashMap1> where HashMap1 is generic it contains string and integer. Can someone please point me towards the right direction???

Here is the code that I am working on

13 years ago
Dear Ranchers,

I get java.lang.NullPointerException at of my code snippet. I really dont understand because name is not null and I tried printing out. Doing some google I found this "Have you closed the result set, statement, or db connection? Don't close and then call next(), premature closing will get you that exception" The answer is "no" I am not closing any statement before the next statement. The weird thing is I used the same code for uploading another table it just worked fine. I am not sure what could be wrong..can someone please help me.

13 years ago
Yes it I am sure its a GZIP file.
13 years ago
I unzipped the folder to see the file and its contents, it works just fine. Its not corrupt. The problem is I am expected to unzip the folder programmatically and not manually. So I need help to solve the issue.
13 years ago
Dear Ranchers,

My code tries to unzip a folder read the file in it and display the contents of the file. But while doing it I get this error. I did google for this error and saw a post in this forums but nothing is directing me towards a solution.
Here is the code snippet and the error





The file size is 2.52GB. I use jdk1.5.0_04.

Hope someone could help me with a solution.
13 years ago