Paul Kelcey

Ranch Hand
+ Follow
since Jan 26, 2003
Merit badge: grant badges
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Paul Kelcey

Hi,

I'm mucking around with some simple REST based development using RESTeasy. Under Windows there's no problem but when I build and run the same app in Ubuntu I get the following error in Glassfish and a similar one for Tomcat.



I'm using Maven. I don't understand what the problem could be.

Any ideas?
12 years ago
Hi,

I played around with earlier versions of JavaFX and I found it useful for rapid development (compared to Swing/Java 2D programming anyway). But, it was standard mechanism of write 'code', compile and then deploy.

Is it possible to have the script interpreted at runtime? For example, what if I wanted to use JavaFX script to render user-interfaces dynamically. In other words, what if I wanted to generate the JavaFX script server side and then have it rendered dynamically at runtime.

I'll provide a tangible example for clarity.

Say I had an applet that had no U.I. on it's own but it used some of the JavaFX libraries typically used during compile time to create the byte code. The applet could dynamically download the JavaFX script from a JSP say and then compile it on the fly and then add it to the content pane of the applet. If so, this is truly a replacement for AJAX since I can not only dynamically generate the server-side content (i.e. data source) that is used to populate a user-interface but I can also dynamically generate the UI template to begin with.

Anyone care to comment?

Regards,

PK
15 years ago
I appreciate your response.

I have always preferred having an agnostic build tool like Ant or Maven as the basis for our build environment and then developers can choose whichever IDE best suits their particular needs. Personally, I was very fond of IntelliJ (having switched over from JBuilder).

After having used Maven and adopted the Maven project structure, life-cycle and separations of concerns philosophy, I would have trouble going back however.

Maven integration for IntelliJ gives me a reason.
This was a question for Dmitry by the way.
I recently switched from IntelliJ to Eclipse. I'm still an IntelliJ fan however. One of the things I like about Eclipse is it's support for Maven (which I'm also a big fan of). Does IntelliJ provide Maven support and if so, how well does it stack up against the support provided by Eclipse.
I still love you even if no-one else does.
18 years ago
Hi,

I have some Groovy questions for Dierk Koenig || Andrew Glover || Paul King, Guillaume Laforge || Jon Skeet. I'm a Java programmer but I'm not familar with Groovy.

Groovy appears to be a scripting language (well, it says application development mode and scripting mode) yet it works with Java libraries.

Q. Is it built on top of Java (or extends Java somehow)?

Q. Does it run within a JVM? I guess if it compiles to byte code that's the whole point?

Q. What do you need in your environment to run Groovy? I guess a JVM or is there a Groovy install that silently installs a JVM for you?

Q. How does it run in scripting mode? I guess it abstracts or removes the need for a Java file, calls Javac on your behalf and then executes in a JVM for you?

Q. Is there an IDE for Groovy that assists with development? (e.g. pressing dot gives you list of available methods etc.).

Regards,

PK
18 years ago
Hi,

I'm new to Maven and I'm trying to work out how to get it to perform a pre-compilation step of turning IDL files into generated java files before compiling them. I can find virtually no documentation on it online so I'd appreciate some pointers.

I'm thinking I need a structure like...
/project
pom.xml
/src
/main
/java (my source code)
/idl (resource that I don't want copied to target)
/resources (files I do want copied to target)
/target
/classes
/generated
/src (where my generated source files will go)

I also want to use the JacORB compiler rather than the standard Sun compiler for the CORBA files. Other than it being "something" that I need to put in the build section of my pom.xml, I am clueless as to how I specify the order (i.e. generate java files first) and then configure where the target directory is and that I want to use TIE.

I think I need to use the "Maven CORBA IDL Compiler Plugin", idlj-maven-plugin-1.0. But I don't know how.

I have it working in Ant. Any help getting it working with Maven would be greatly appreciated.

PK
18 years ago
That's not what I encountered.
When you use an anonymous inner class like that you get a PrimaryClass$1.class file as well. Did you include that second class in your calculations? I think it adds a few hundred bytes to JAR because of the class header and crap like that in the byte code.
I agree with Michael that eventually things will be better on the clients. However, if you want to get a head-start in the market you sometimes have to make compromises.
PK
20 years ago
One of the largest realities of programming J2ME applications in my experience is the MIDlet size restrictions that are imposed. There is an overhead to every Java class you have in your MIDlet. This applies to inner classes and normal classes. It doesn't make any difference to go normal class compared to inner-class. We noticed about a 600 byte overhead for a class (uncompressed). They add up very quickly.
We wrote a flash player in BREW and J2ME. Without function pointers in J2ME we used separate classes for our action and condition handling. It was great except that the MIDlet size was 300Kb. We eventually got it down to 50Kb (and were able to deploy) but this involved things that would make Mark freak out. With a tear in my eye, I washed my hands every night when I'd finished.
We gained a large benefit by reducing the number of classes we had. We also noticed that the classes seemed to hit a sweet spot with the JAR compression when they got above 32Kb (uncompressed). After working with a lot of PNGs I realised this was due to the 32Kb sliding window that the ZIP algorithm uses for compression. When you hit 32Kb for a class file (after obfuscation - we used DashO) you maximise the benefit from the sliding window. The benefit is linear thereafter.
Our technique we used for this is was to assimilate classes into a parent class for where there was a 1:1 ratio. They we just prefixed the method names with the old class names. You get very big java files but it's still vaguely manageable if you originated from an OO design. Also, we did some extremely nasty things by assimilating children classes (where there was a 1:m relationship) by moving the methods up to the parent, passing in the object to the method call and turning the fields for the children objects into Object arrays.
For example our linked list class was assimilated by the MIDlet class. A list was an Object[]. A List node was an Object[]. The lists enqueue method was implemented by the MIDlet by passing in the list "object" as a parameter. Very nasty - lots of casting - you've got to write down how each object breaks down.
I love writing J2SE and J2EE code. Writing J2ME code is a different kettle of fish in my opinion.
PK
20 years ago
Hi,
I've worked with PNG images with MIDP 1. You need to have a look at some RFCs regarding PNG images as well as Deflate compression. I can't remember the RFC numbers but you'll find them on google. Look for PNG specification 1.0 and Deflate compression. There are later specifications for PNG but the MIDP 1.0 spec explicitly says PNG specification 1.0.
Basically I was working on a streaming video player. I was doing the opposite you need to do (i.e. pixel data -> PNG). I wrote an encoder and you need a decoder. You have a much harder task because PNGs can come in a variety of flavours (eg. direct colour model or indexed colour model). I only had to write from one. Unless you can tightly control the PNGs you're getting, you're going to need to be able to read from many different types.
In all cases the pixel data is in the IDAT chunk. The IDAT chunk is compressed however (though Deflate also supports a NO compression mode). This means you have to screw around with canonical huffman trees and it gets complicated quickly (at least for my simple brain).
If you can find some free source code for ZIP or GZIP compression, I think they will de-compress deflate. Alternately, you can look for some open source PNG decoders they *might* help. All the Java code for PNG decoders I looked at used the natively implemented zipstream class. This doesn't exist in MIDP (only J2SE) so you're back to looking for open-source ZIP/GZIP/Deflate compression code. Personally, I'd look for some C code that did it and convert into a fat and dirty Java class. Otherwise there's no way you are going to get it to fit on any devices.
I think it's a reasonably tricky undertaking but it's not impossible. You might have some performance concerns too (though decoding means you don't have to check addler-32 or CRC checksums which is good).
PK
20 years ago
On another topic....
Anyone know how to freaking paste in a build.xml file and have it display
20 years ago
Arrrgggghhhhh.... Last time - this time without code....
<?xml version="1.0"?>
<project name="Template Buildfile" default="compile" basedir=".">
<property name="dir.src" value="src"/>
<property name="dir.build" value="build"/>
<property name="dir.dist" value="classes"/>

<target name="prepare">
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.dist}"/>
</target>

<target name="clean" description="Clean all files">
<delete dir="${dir.build}"/>
<delete dir="${dir.dist}"/>
</target>

<target name="compile" depends="prepare" description="Compile all source code">
<javac srcdir="${dir.src}" destdir="${dir.build}" source="1.5"/>
</target>
</project>
20 years ago
I'm not sure why my build file is not being included properly. I'll try again...
20 years ago
Hi,
In order to compile any JDK 150 language features, I need to include the command line parameter -source=1.5. There's no option to do with this with the GUI under the project properties tab so I've written a simple ANT script. However, when JBuilder runs the ANT script it does not work.

Ultimately I want to get JBuilder 9 running with JDK 150 as soon as I can. I don't care whether I have to use ANT or modify something else. Anyone know how to do it?
Regards,
20 years ago