Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!

udaya krishna

Ranch Hand
+ Follow
since Mar 19, 2009
udaya likes ...
Netbeans IDE Firefox Browser Java
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 udaya krishna

Ouch.Should have been clearer upfront.I can use Java7.So many updated methods may not be available!And yeah,the format of the code may not be good enough right now because I am working on getting result first.And I am creating a arrayList to store all the filenames between the range.
1 year ago
Hi,

Thanks for the quick response.
I am sure that extract part would work fine because the format of the string will always the same(starts with a string,followwed by _,followed by numeric values,followed by .gz),so i think substring part might just work fine.And as you said difference part is easier too.Other steps are the tricky ones.Let me show the code that I have done so far,so that we can figure out where i am going wrong :
1 year ago
Hi,
This may seem a simple one yet a little tricky.I am trying to convert two seperate String objects into two seperate Integer objects.Then I am trying to find the difference between two numbers .The tricky part is the String starts letters and then an _ and then the number and ends with a file extension.gz.Let me give an example :

Result should be the difference between 00000127 and 00000123 and append the ABCDE_at the beginning and .gz at the end.
.So the expected result in the above case is :

Here are the steps I am thinking of doing
1.extract numeric part by using substring, so the result would be 00000123 and 00000127.
2.Convert the extracted part to a Integer Object.This is the tricky part,because the String will start with 00000 ,so is it ok if i do the Integer.parseInt("00000123 "),because i think 0000 will be converted into octal.
3.Once both the strings are converted into integers,i need to find their difference and for the difference you create a new string object append ABCDE_ into the beginneing and .gz at the end and add it to a list.

I am comfortable doing step 1 ,step 2 and step 3 is where i need help.

Thanks Udaya
1 year ago
Hi ,

I am trying to convert data from a csv file to json format.Search on the internet told me that we need to use external libraries.But all the samples that i found had headers included in the CSV file.But I do not have the headers in my CSV file.So I do not know how to parse.
Below is the sample data in CSV :

"JHMZC7840LX200001","356938035643809","8991101200003200001","ATZD6A700","89049032000001000000031233016882","20190322235824123000","Fail","20190323000101123000","Pass"
"JHMZC7840LX200002","356938035643810","8991101200003200002","ATZD6A700","89049032000001000000031233016883","20190322235824123001","Fail","20190323000101123001","Pass"

I need the data in below format :
Data [{
"ColumnA":"JHMZC7840LX200001",
"ColumnB":"356938035643809",
.
.
},
{
"ColumnA":"JHMZC7840LX200002",
"ColumnB":"356938035643810","
.
.
}
]

Here "ColumnA","ColumnB", and so on are some constants(we can say as hardcoded values).
Not sure if any external lib is required for this or we can do this with no String operations.
Here is the code i have so far :

Any help is welcome.
Thanks Udaya
1 year ago
Hi All,

I think this is the perfect forum to ask my questions/issues that I am facing and looks like its going to be a long post.So please have patience.I am a java developer with 4+ years of experience.Basically I was in JSF+EJB development.Now I am into a project wherein I have to develop web services from the scratch and all alone .It looked interesting,so I agreed to take up the project.Now I know the basics of web services (SOAP,Rest), when to use which web services etc.I have even consumed a web service before , but this would be the first time that I would be writing the webservice and that too from the scratch.

The requirement is as below :
1.We will have a CSV file with around 5 columns and around 350 rows of data in it.It is located in a unix machine in a directory(say opt/application).
2.The data in the CSV file gets updated every night (through a script).
3.The file is used by another system (say System A).Currently we are manually sharing the updated CSV file everyday via FTP.

Now my requirement is that I need to write a web service which will be used by other system ( System A) , so that we dont have to transfer the file manually.What would be my approach?

I can tell how I am approaching the problem.Please correct me if I am wrong anywhere:
1.I know how to read the CSV file using a external library (POI).
2.I will be able to iterate through the data and convert them into XML or JSON data depending on what other system(System A) is expecting.
3.Expose my web service.

But I do have a couple of questions though :
Our current system is basically a Swing+EJB application deployed in a remote unix machine(Same machine where the CSV file is located)on weblogic 9.2 server.
1.How do I integrate my newly written web service into existing EAR.The EAR is build using ANT , can I use the same build tool? If yes how?
2.I thought it might be a good idea to use another plain web server(Tomcat) , just to deploy the web service ,so that I dont have to worry about changing the current build process.Is it a good idea?
3.And since the data is not too much I thought of using REST rather than SOAP.Correct?

Any insight from the you experienced people would be very helpful.

Thanks
Udaya Krishna A
6 years ago
Hi,

I am using the calender component of the primefaces and I am using the attribute .But when I print the values in my MBean along with the selected date event the timeZone (i think) is printed as I do not understand why its printed even though I have set the pattern.Part of my code :
XHTML

ManagedBean


Ok.I found out that we need to use <f:convertDateTimePattern> instead of how I am using currently.But I am not able to figure out where to use
in my case.
Thanks
Udaya Krishna A
6 years ago
JSF
Problem resolved after restarting eclipse.

Thanks
6 years ago
I have put a debug point in my main() method.For some reason the control is not coming to main method at all.The application starts from main() method.So I dont know whether putting any print statements is going to help.

Thanks
Uday
6 years ago
Hi Maneesh,

The Swing application (UI) is not coming up,The application runs if I start in normal mode or without remote debugging.

Thanks
Udaya Krishna A
6 years ago
Hi,

I have a swing application set up in my eclipse which calls the EJBs deployed in a remote machine's weblogic 9.2 server.I have configured my startDomain.sh to enable debug mode.Even in my debug configuration window of eclipse I have given host and port number .The problem is when I debug my swing application (there is a main() method that starts the application) from eclipse , a bunch of threads show up in debug console , but the application does not come up at all.Screenshot attached.Any ideas whats happening?

Thanks
Udaya Krishna A
6 years ago
Ok another thing I noticed here.If I try @ManagedBean annotation in TeamController class instead of @Named the data is populated!!Looks like I need to dig deep a little on concepts of EJB and ManagedBean.Meanwhile any help is appreciated.

Thanks
Udaya Krishna A
Hi Tim,

Thanks for the reply.As you can see I initially tried

That did not work (and I think we call the methods in JSF using "action" attribute), so I tried that way and what I am trying to achieve is rather than making an EJB directly as a backing bean/managed bean I wanted another layer inbetween hence I wrote the Controller class.I did not know what other approach I needed to think of.So I am still stuck here .Any help in the code is welcome.

Thanks
Udaya Krishna
Hi K.TSang,

I changed the scope to view and in TeamContoller constructor i did this :


and in my xhtml :

still no luck !!

Thanks
Udaya Krishna
Rob spoor ,
You mean like this ?


I tried that already..it did not work!!so i tried this way..

Thanks
Udaya Krishna
Hi,

I am unable to figure out if this is a EJB issue or JSF manangedBean issue.I am posting it in EJB forum , if required please move it to JSF forum.I am trying to populate a datatable in jsf from DB .I am using glassfish 4.1,netbeans,mysql and primefaces.This is the code so far (I have not pasted the entity class ):
welcome.xhtml

My EJB

My Controller


My issue is that the control is going to TeamController when i put a debug point (I confirmed it by using the sysout)


the above statement is not printed.Another thing is if I do not use the controller class , if I directly use TeamFacade class directly and call it from JSF page , it is working.But from what i read from the internet its not a good idea to call an EJB directly from JSF.Any idea what is going on?

Thanks
Udaya Krishna