Stephen McConnell

Greenhorn
+ Follow
since Mar 23, 2010
Merit badge: grant badges
For More
Villa Rica, Georgia
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 Stephen McConnell

I've started learning Functional Programming and found many books on FP Data Structures use a Lisp or an ML derivative such as Caml or OCaml. So, I started working with OCaml. About half way through my first book on it, I looked up what Jobs were available using OCaml and didn't find many. Then, I found this article:

Flying Frog Blog: The rise and Fall of OCaml

Albeit, this article was published in 2010, but it discusses why OCaml's popularity sort of waned.

From the article:

We blame the inability of OCaml's garbage collector to allow threads to run in parallel as the primary reason for this mass exodus. OCaml was an awesome tool in the late 1990s and, by 2004, many people were finding the OCaml language from benchmark results that showed it to be one of the fastest languages available. Ironically, that was largely due to the superior performance of OCaml's garbage collector but that same garbage collector is now a serious impediment to parallel programming on today's multicore machine



This was written prior to version 3.12 (I don't know what version existed then). And now they are up to 4.0 or greater. I don't know if they have removed the problems with threads, but it is still a nice language and is pretty darn fast.

If anyone has any updates on the garbage collection threading problem, please update me.

I will continue using OCaml to explore Functional Programming for now, but may move over to F# because of it's uses in Numerical and Mathematical programing.

As I always say:
"Boredom is a personal defect."
- Lamar Stephens
10 years ago
Well, I looked at Gson, and it may handle a "NaN" or "Infinity", but it isn't the easiest API to use.

I tested Jackson version 1.7+ and it is very nice, but STILL doesn't handle "NaN" even though they are thinking about it....


So, I went to JSON.org and tested the groupId: org.json artifactId: json version: 20090211 jar out there in Maven.


It does an interesting thing. It just ignores non-numerics without quotes surrounding them and translates them as Strings... assuming that the person generating the JSON may forgotten to put quotes around a String....

Which makes it possible to handle a NaN or Infinity.

All I have to do is for each Numeric value I have in the JSON I'm parsing, have it come back as an Object. Then, test for instanceof (String).

This is a real pain, but until Jackson (which is both fast and beautiful) takes care of this, I have to use the slower JSON.org standard.

Oh well....

We aren't processing HUGE JSON and we have time to process it before the next package comes in...

I might as well do that.

IF ANYONE HAS A BETTER PACKAGE OR SOLUTION, please tell me.
13 years ago

William Brogden wrote:How about pre-processing the data to look for NaN etc and provide special handling before giving it to the JSON parser?

Bill




Bill. That would defeat the purpose. I'm already running a IOStream filter on the JSON to remove or transform non-standard characters in the JSON Stream (which I get about 1% non-standard un-parsable characters from Microsoft). I suppose I could, but I'd rather not have to write it and would rather have a Parser do it. Since this is a problem with many different JSON feeds (not following standards), someone, somewhere must have found a solution. I think I have found one in GSON. (see above)

Thanks for the idea, though.
13 years ago
In the spirit of posting a possible solution when the poster finds it, I'm posting this one.

GSON, which Google's API support of JSON serialization and deserialization says they support the NaN, Positive_Infinity and Negative_Infinity double values in their API.

Gson Support of NaN

I'm going to test this and see if it works... If it does, I will post this.

Does anyone have any experience in using GSON API and know how fast this works. (Really it has to be faster than JSON4J or the JSON.org API), their benchmarks are terrible.

13 years ago
We are not dealing with browsers or JavaScript and JSON. If I were parsing JSON with JavaScript, it would accept NaN and Infinity (all except IE and this is the rub as I will explain later).

However, I am using a Java Parser to parse the JSON. As I said previously, I can find no documentation of a Third Party Java JSON parser that handles NaN or Infinity. However, some people INSIST on sending it, even though it is not part of the standard. Getting to the rub (as I discussed before), usually the people are using Microsoft Servers and running ASP.net to create their JSON. So, on one hand Microsoft Insists that those values are part of JSON and on the other hand their JavaScript in their browsers don't support it.... (Catch 22)

here is an example of the data they are passing in JSON:
{
"AverageRestartSpeed": NaN,
"AverageRunningPosition": 12.566037735849056,
"AverageSpeed": 61.764678923555394,
"BestLap": 40,
"BestSpeed": 131.30060544168066,
........... more data here .............
}, ...........

The NaN is a result of them dividing 0/0 and not pre-checking their values. This could happen on any numeric value that they send if they have bad real time information that they process.

If the party sending JSON insists on the possibility of sending it, however, I have to program defensively and support it.
So, back to my previous question....

Does anyone know of a Java Based JSON parser that supports "NaN and Infiinity". I heard Jackson does, but have not found it for certain in their documentation.

Thanks
13 years ago
We have been using JSON4J as a simple JSON parser. It has been working great UNTIL we started getting both NaN and Infinity as numeric values from a data provider. THEY say that those are accepted values in JSON, but I cannot find a Java JSON parser that handles that.

Is anyone aware of one that does so?


Stephen McConnell
13 years ago
OK sorry for the post.

I found the problem....

The java.naming.provider.url in my jndi.properties file had a typo and pointed to the wrong folder for the .bindings file.

13 years ago
I am using Eclipse and have created a runtime environment that calls an application which uses JNDI to get resources for JMS connections.

It uses a .bindings file for the JMS information. I changed the names of my connection factories and queues in the .bindings file, but when I re-run the app, it retains the same .binding information. I have shut down Eclipse and then re-run the app and it retains the OLD .bindings information. I have shut down my computer and the same thing.

What is going on here? It would seem if I changed the file, it would grab the new information, but it's not.


Stephen McConnell
13 years ago
The initial exception occurs on Line 34 of your AirPortDD.java file.... that is in the general areas of the attempt to access the result set....

Did you get the output from line 96 here in AirPortDD.java? which is the error from an exception trying to retrieve the result set in the first place....

There is so much wrong with this code from a design point of view... no closing of connections, no closing of statements.... Bad handling of exceptions....

Stephen McConnell
Thank you very much...

Looking into it now.

Stephen McConnell
14 years ago
"Lib" doesn't support the excludes option (Straight from the Ant build).
14 years ago
[quote=David Newton
That aside, I wouldn't have that library in WEB-INF/lib at all, but instead keep it as an external dependency.

I probably will do just that.

It is still troubling that I have found several posts under other forums that discuss "exclude" not doing what it said it is supposed to do and none explain why it does not work like several examples in the documentation.

Stephen McConnell
14 years ago

(Actually, I really recommend using the Maven project structure, but that is a different topic...).



I wish they would.... but they don't use maven here.

Steve
14 years ago
I am building a war and have a library under the "WEB-INF/lib" directory. While compiling, I have the "javax.servlet.jar" in that lib, but when I build the war file, I want to exclude it from the "lib" folder.

Under the "war" task here's what I do...



It builds the war, but does not exclude "javax.servlet.jar" like the "docs" said.

Que Passo, here?

Stephen McConnell
14 years ago
@Bear

Yeah... I looked at some of the Firefox bugs and found an ongoing bug with it not recognizing the NO-CACHE meta tag. I was also thinking he may be caching his JSP's on the SERVER side... I had a problem like that once loonnnnnggg ago (with iPlanet, if I remember correctly).

Steve
14 years ago
JSP