Greg Belyea

Greenhorn
+ Follow
since Jan 11, 2005
Merit badge: grant badges
Cows and Likes
Cows
Total received
1
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 Greg Belyea

but is not your Class Name it is your instance name... Use the Class ... like an ArrayList of strings would be ArrayList<String> list = new ArrayList<>();
8 years ago
but is not your Class Name it is your instance name... Use the Class ... like an ArrayList of strings would be ArrayList<String> list = new ArrayList<>();
8 years ago
Hey Guys

Looking at building a simple data cache that just blocks long enough when there is new data to swap out one hashmap for another.. They asked for this rather than timestamps and updating only
changed records type thing. I have not done this before but it sounded simple enough so i am wondering if anyone wanted to make any suggestions, or help by expressing any concerns. This is read only
stuff and there are never updates to the existing map we use to fetch records from... I have kept the code as simple as possible for the purposes of making feedback not so laborous, i know there is some
housekeeping issues and there may be a few unnecessary objects instantiated but that is stuff i'll sort out later

8 years ago
Hey Guys

Wondering what my best approach would be here, i have a fully functioning REST Service built and a client has requested to be able to use it VIA SOAP.. i have 3 facades with only one call each in them and the facades contain very little logic, most of that is in the DAO, Util classes, and Model constructors.. i am wondering what the simplest thing to do here to make this work for them would be? Can i just create a SOAP service that calls my Rest Service and wraps the JSON response in a SOAP envelope? I could not find much information on this on the web, seems to be alot of people looking to go from SOAP to REST but not the other way around? Any suggestions would be much appreciated..

Cheers
8 years ago
So after some reading i tried using a class with a static method and a FutureTask for this... I have another class that implements Callable and has a LinkedList which i pass the objects i want to log into as they come in... I have a configurable property that i can set so that when the LinkedList hits that size it does a batch insert of the objects into the database, clears the list and is ready to go again. It ended up being quite uncomplicated but i am a little wary of what the downfalls of this might be.. one being what if the application was to crash for whatever reason and i have the batch set to 1000 records and i lose 500 records. I am thinking that the benefit of not spawning a new thread for every insert (which ofcourse does not scale but would be sure to never lose much) much outweighs the risk of losing a tiny percentage of records in the case of a disaster however i'd like to know what others think if there are any opinions out there?

Cheers
8 years ago
Well i solved it so i thought i would post here in case anyone sees similar issues... The only way i could solve this was by using Jackson and calling the mapper.writeValueAsString(response) and returning the string instead of the object.. that got rid of the implicit cast to number and puts the quotes where they need to be
8 years ago

i am using Netbeans and have built a rest webservice that returns JSON and i am seeing something that looks odd to me... in my response object the externalid field has no quotes but in the model that is being converted here it is a string...

"apiName":"Test Case","duration":7644,"externalId":1234561019

if the externalId field has a letter in it, it comes up with quotes, but why is it treating the field like a number just because it happens to be a valid one when i have declared it a string?

Should have mentioned my maven imports are the following

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.10</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>

Thanks for any clues
8 years ago
No, but i sure will tonight and see where that leads me
8 years ago
Hey Guys

I have looked around on the net and i am thinking there is another name for what i am trying to do because it must not be that uncommon a requirement.. Here is my scenario

I have a webservice that gathers some information from SQL reads and returns a JSON object to the user. Right now i write that JSON object back to a log table in the DB so i can track what the users requested and got. Currently the user waits while i write that response in but that is unnecessary and not the way i want it to work. The service may get thousands of requests per minute so what i want to accomplish is simply to send that log info model off to another class that queues up these until it hits say 1000 records or 1 minute (and allows the service to carry on returning the response) whichever comes first type thing and then write them into the table in a batch insert and remove them from the queue. I am hoping to design this right the first time so i am wondering if someone can point me in the right direction for some info to get this started, or if you had experience with something similar give me some advice perhaps?

Cheers
L
8 years ago
Hey Guys

I have been using the Netbeans profiler and have had trouble pinpointing an issue we are having with autogenerated reports not running to completion with byte [] and byte [][] hanging on for many generations and the heap growing and growing while the massive amount of info is gathered and Chart Director graphs are assembled. I don't know that much about the profiler as i have used it sparingly in the past to find simple memory leaks. I am thinking i would like to take a course on all the ins and outs and i am wondering is anyone has any suggestions on what the best profiler to use would be as well as a decent course to take, either onsite or online.. It is paid for by the company but i don't want to go with netbeans just cause i am familiar with it rather than get some educated opinions..

Cheers
Greg
11 years ago
i posted a question this morning that was not moved, simply deleted... is there a better place for me to post a question on session serialization issue??

GB
16 years ago
Hey Carol

Yeah my assault was probably a bit unfounded because i just came off a wasted day of development, due to some problems before i hit the log4j!!! So i was a bit heated..

I appreciate you taking the time to shoot back a thought out answer, i am in a meeting now but i am going to take a closer look when i get out and i will try to implement.

Thanks alot

Greg B
Looking at the instructions for Log4j, never having had to set up Logging before and constantly ridling my code with System.out's that need to be commented out all the time, i figure, what the hey. I'll implement log4j...

I am thinking there should be a simple example out there on how to set it up with my struts application, after sifting through the non applicable examples and the language of doublespeak, i am left 2 hours later with no logging set up.

I have dropped log4j jar into my lib directory under webapps, and i intended to have a class that extended action that i would set up a logger in. this way each action i had would inherently have a logger available to it without having to set up it's own. My system would not deal with the PropertyConfigurator at all, even though i could successfully import it, it would'nt compile any of the examples.

With Log4j ready and the following class skeleton, what would be my best way to set up a simple, very simple logger that my action classes could inherit? Once i get it working i guess i could conquer the more detailed aspects...



package com.cgi.excelsior.actions;

import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;

import org.apache.struts.action.Action;
import org.apache.log4j.*;


public class ExcelsiorAction extends Action{


public DataSource getDatasource(HttpServletRequest request, String key)
{
return this.getDataSource(request, key);
}

}
Shailesh

Yes that does work, it does complicate what the knowledge the user must have on the client side but it may not be too much of an issue. Thanks for the help, i still find it a bit odd the in the SQL window, the results come back no prob with 'wage', but it won't for the application, but i am not gonna spend much time on it...

Thanks
Yeah here it is

select * from minwage where effective like ? and province like ? order by ? ASC

so after the prepare statement loads the parameters it will look exactly like i would want it to

select * from minwage where effevtive like '%77%' and province like '%N%' order by 'wage' ASC

problem is it will not execute the order by, so even if i submit a bad value for the order by, something that does not even exist, i will still get a resultset rather than the error that i should, it appears the order by is being ignored???

Greg B

Here is a system out just before parameter loading, and then before execution, i plyed with the method a bit so it's different than above.


com.mysql.jdbc.ServerPreparedStatement[1] - select * from minwage where province like null order by null desc

com.mysql.jdbc.ServerPreparedStatement[1] - select * from minwage where province like '%Fed%' order by 'wage' desc

the above line pasted into SQL window retrieves the desired results, however executing the pstmt, does not bring back the desired results? Very frustrating and not much info on similar issues???
[ March 15, 2005: Message edited by: Greg Belyea ]