jug.ORG.ua >  Dashboard > Ленты новостей | RSS > Home > jroller
jroller Log In   View a printable version of the current page.

  • View Info
  •  

Added by Sergey Druzkin, last edited by root on Dec 17, 2007  (view change)
Labels: 
(None)

JRoller
(Javalobby Community Weblog Service)
The strange Hibernate version numbers

I am fascinated with Hibernate version numbers. Have you noticed how uncommon they are ? In the open source community, almost every project follows the same rules :

project-MAJOR.minor.bugfix

For example :

commons-io-1.2.3
or
spring-core-2.0.0

If necessary, you may append release specific modifiers :

  • alpha version : -alpha1, -alpha2, ...
  • beta version : -beta1, -beta2, ...
  • release candidate : -rc1, ...

Hibernate does not follow those conventions. You may find :

  • hibernate-3.2.0.cr1 : why not hibernate-3.2.0-rc1 ?
  • hibernate-3.3.0.ga : why not hibernate-3.3.0 ?
  • hibernate-3.3.0.SP1 : why not hibernate-3.3.1 ?
  • hibernate-search-3.1.0.Beta1 : why not hibernate-search-3.1.0-beta1 ?
  • ...
If you are used to Maven, then you must have been annoyed with it, as the resulting artifacts never follow the same conventions (with or without dash, uppercase or not, ...).

Pretty frustrating. As a widely used library, I would expect Hibernate to follow the most common versioning schemes...

Talked at My University

The whole story is at my new blog;

http://prime.com.tr/cagataycivici/?p=104

SwingBuilder's binding revisited
Looks like the previous SwingBuilder binding entry stroke a chord on Greg Bollinger. Greg writes at dzone links:
That's pretty cool but horribly impractical. What I'd like to see is how binding would work to a true domain object vs some "example only" worthy ObservableMap that no one really uses to store form data in.
What everyone needs is the ability to easily bind forms to POJO's and back. Just like all the wonderful web frameworks can do. Let's see those kinds of examples if you really want to impress.

Horribly impractical... true, nobody in their sound mind should use an observable-map-as-POGO-replacement instead of regular domain objects when it comes to production code, for prototyping and testing and would think otherwise. An example with true domain objects you say? you got it! As I said ObservableMap works like an observable POGO, it simplifies testing as you do not need to declare a new class for your observable POGO, you just use the behavior, after all Groovy has blurred the line between Maps and POGOs. So what does it take to make a POGO and observable one? following the JavaBean conventions it means
  • Each observable property must fire PropertyChangeEvent when its value changes.
  • The bean should expose register/unregister methods for PropertyChangeListener.
  • The observable behavior (firing events) may be implemented with PropertyChangeSupport.
Simple rules really, but they can turn your domain object into a jungle of code. Groovy already provides simplified POGOs, just declare a field and its type without an access modifier and you got yourself a property. Groovy 1.6-beta-1+ goes one step further with @Bindable and ASTTransformations. As @shemnon shows here, it is quite easy to build an observable POGO, so lets follow his code samples

That's it. Import the annotation, annotate the pertinent properties, bind to your hearts content. But wait there is more, it turns out there is a way to streamline the binding form textField.text to textModel.text. SwingBuilder includes a factory for building any node/bean you'd like, aptly named bean. If we use that factory and set textModel as it value then we can also use the short syntax for binding

Much better. You may be wondering, what happened to the trigger code (PropertyChangeListener)? well that remains the same, it doesn't matter if you have an ObservableMap instance of an observable POGO, there is no short syntax for triggers for the time being.

Keep on Groovying!
Random Thoughts in Random Order

It has been a while since I blogged. I am still alive and well. I had a steady blogging streak there for a while and then oblivion. I have been hitting the gym hard again. I mostly update my twitter account about such things http://www.twitter.com/RickHigh. My twitter is constantly updated these days.


Getting kind of bored with the Spring, Hibernate and JSF which are still my bread and butter. I was thinking about doing more with GWT or perhaps Google App Engine (on the side for fun). I really enjoyed working with Python 1998 through 2000 and Google App Engine looks very cool (uses Python). 

I installed MacSpeach about two months ago and have still not set it up. I was going to do it tonight and then realized that I left the headphones/mic combo at work. Not sure how well it will work with the built in mic. I imagine there is a reason it ships with the headphone mic set.

I have been training for the Nike 10K Human Race on Aug 31st. I ran six miles last Thursday, 4.2 miles yesterday. I try to run at least a mile or two every day.

In addition to digging into the Google App Engine, I'd like to dig into learning Spanish. I really want to learn Spanish. I was thinking about getting Rosetta Stone. So many things I'd like to do, so few time and so much ADD. The $500 price tag stops me at the moment. (Looking on Craigs list for a cheaper alternative.)

I finished the SG1 TV series via iTunes. I am now up to season 4 of SG Atlantis (there is a season 5 and then I am a free man). Imagine if I would have spent this time doing something else.

I started going up in weight in the weight room. I maxed 455 lbs on the hammer strength bench press. I keep trying to get 475 lbs. Once I just missed it. As I run more, I can lift less (not a lot less but less).

We wrote a GWT course and a Flex/Java course recently. I really dig both of these technology stacks. I lean towards GWT.

Crank is still going strong. I just got a contract to update Presto using Crank style features. Well the contract is in negotiations. They want to do a fixed bid contract and I am not used to doing those.

In addition, I am thinking about becoming a full time employee. I moved to Los Angeles permanently. My house in Tucson is up for sale. I live in Manhattan Beach. I love my new place.

I was biking 26 miles up and down the strand but have not done that in a while. I am going to focus on running until Aug 31st and then I think I will ease up on that because it is hard on my knees. I prefer doing the elliptical machine and the stair master elliptical machine (and biking)... a bit easier on my old knees.

I love my iPhone. Just love it. It is everything I ever wanted in a device and so much more. I wish the battery lasted longer. Other than that, this is the best thing ever.

A bunch of us went to the laugh factory last night in Hollywood. Here are some pics http://gallery.me.com/richardmhightower#100024

I plan on writing more, running more and then less. And learning a second language. I also want to drop another 20 pounds or so. I am sick of sucking my gut in for pics. I almost turned blue in the face on that above pic waiting for them to figure out how to use my iphone to take a pic. 

Tom and I did the Body for Life program and put on a lot of muscle. I even have some definition and can do 30 bar dips. Whoo hoo! Still not at my peak but getting closer.


AJP (8009) to HTTPS (8443) is supposed end in HTTPS

I'm writing this blog post because I have a problem that is becoming a real pisser. I've used Apache and the AJP connector with Tomcat many times and now I'm getting HTTP ultimately from the 8443 connector. My 8009 connector redirects to port 8443 and if I call the URL using the colon 8443 I get the page HTTPS correctly. When I call the URL without port numbers and the /cas virtual, it uses the AJP/1.3 connector on 8009 because the page comes up beautifully with one problem. That is the content is HTTP (plain text).

My buddy, the CISCO expert here showed me Wireshark (damn fine Windows application) that allowed us to look at all this Apache reverse proxy, AJP, Tomcat, JBoss traffic and sure enough he showed me my password (HTTP).

I'm really stumped. This was working prior to multiple domains and virtual IPs. I usually don't "trust" certificates when I'm doing implementation work but I assumed that I had accepted the certificate some time ago and forgot all about the HTTPS. Also, with all the proxy business going on, I don't pay much attention to the browser address bar anymore.

So now I'll back up and begin to simplify. If anyone has seen this before please let me know. If it didn't work, I could understand this, but when I know that TCP traffic is going thru the 8009 and 8443 ports, I can't understand why I never get asked to accept the certificate? Bear in mind too that there's a lot of overkill here that I can't reduce or simplify for security reasons.

Signed, Stumped in the weeds here in NC

JAVAWUG BOF 40 JQuantLib

JAVAWUG BOF 40 JQuantLib

Birds-of-a-Feather 40
Monday, 15th September 2008
Skills Matter, London, UK 
 

Dear All





I would like to formally announce that JAVAWUG (Java Web User Group) is holding the Fortieth Birds-of-Feather (Meet-up 40) at Skills Matter on Monday, 15th September 2008 from 18:30 until 20:00.



Talk

JQuantLib is a free, open-source, comprehensive framework for quantitative finance, written in Java, aiming to offer several mathematical and statistical tools needed for valuation of financial instruments like options, bonds and alike. In spite of JQuantLib being based on QuantLib, which is written in C++, it is not intended to be a mere translation from C++ code: it's a rewrite intended to offer features that Java developers expect.


The talk will cover subjects as:


Innovation: JQuantLib tries to reduce the gap between C++ and Java worlds on quantitative finance. This talk shows the opportunity Java developers currently have in the competitive niche of quantitative finance.


Architecture: Whilst keeping API resemblance to QuantLib/C++ wherever possible, JQuantLib aims to provide flexibility which is important to modern execution environments. This talk exposes the challenges of accomplishing these factors whilst keeping performance as a critical factor of success.


Performance: How Java applications can be speed up and compete with C++ applications? This talk exposes some techniques and shows that Java is viable for low latency, critical production environments, being able to offer performance similar to C++.


Correctness: Programming errors must be avoided wherever possible in order to reduce development costs. This talk exposes how strong type checking, upcoming features of JDK7 and quality assurance tools are important to eradicate programming errors.


Accuracy: Calculations have to be accurate and it can be accomplished by different ways. This talk exposes how performance and system resources are radically affected by these different approaches.


For more information about JQuantLib, please visit

http://www.jquantlib.org/


These are some introductory information related to Quantitative Finance:
http://en.wikipedia.org/wiki/Financial_markets
http://en.wikipedia.org/wiki/Derivative_(finance)
http://en.wikipedia.org/wiki/Quantitative_analyst

Biography

Richard Gomes is Brazilian and graduated at Unicamp, Brazil.

In the beginning of his career he developed numeric libraries in assembly language and a symbolic debugger whilst working for CPqD/Telebras R&D Center, which was a key player in the emerging brazilian telecommunications scenario at that time.

He has several years of experience in IT and experience with full software life-cycle, working as developer, architect, production support analyst and configuration manager in complex projects with multiple development branches. He has experience with high volume, low latency critical systems specially in banking and telecommunication sectors. He worked for companies such as IBM attending Sprint/USA, EDS and Unibanco, where he designed a critical, high volume cheque clearance system.

Richard is settled in London since September/2006. He works for Coalition, a Market Intelligence company.

Registration

Afterwards members can retire to the nearby The Crown Tavern pub/restaurant for more in depth discussion dinner, food and drink ...


The address is:

Skills Matter Limited
1 Sekforde Street
LONDON EC1R 0BE
Phone: 020 7107 2620
Fax: 020 7107 2621


If you would like to attend:

  1. Please REGISTER so that you can be added to the SECURITY DETAIL with Skills Matter Limited.
  2. If you aren't a JAVAWUG member why not join the JAVAWUG at Google Groups?

For problems, send an email to peter (dot) pilgrim (at) gmail (dot) com and emin (dot) tatosian (at) gmail (dot) com.


Here is some relevant travel information:

  • By Underground: -
    Farringdon : Come out the station turn left and left again. Walk up Turnmill Street, cross the Clerkenwell Road. At the road head to the right on Aylesbury St. Walk past the Crown Tavern pub and you will see the building 1 Sekforde. You can't really miss it.
  • Map: Google Maps Link to 1 Sekforde Street


The venue has graciously been organised by Skills Matter team. We all appreciate this generous gift.

JAVAWUG.com


Media Copyright Notice

JAVAWUG BOF Events are video recorded, edited and published freely. We normally recorded the speaker and administrators. You can find examples on Vimeo and Google Video. On the rare occasion we record some audience members. Please let us know if you personally would rather not been filmed. We reserved the Copyright 2008 © JAVAWUG Video Productions, Creative Commons (Attributions: Attribution (by): Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these.).

This is Peter Pilgrim, Out.











Taking SwingBuilder's binding for a spin
Those of you that follow @shemnnon's blog will surely know that he has revamped how binding is supported in the development versions of Groovy 1.6.x (here, here and here). Impatiently as ever, I created my own distro of groovy 1.6-beta-2-SNAPSHOT and gave it a try, quite fitting with the latest JavaFx Script experiments.

One of the appealing features of JavaFx Script is that it has binding baked right into the language, it also sports the notion of triggers. You can attach any function on a trigger, whenever the trigger receives a biding update event the function will be called. This is akin to PropertyChangeListener and PropertyChangeEvent, only you don't see those classes in the open with JavaFx. So here goes, three simple binding/triggers examples on JavaFx Script and Groovy. The examples are not comprehensive, binding both languages can cover a broader spectrum. It is important to note that binding in Groovy is provided by a set of APIs (SwingBuilder and the bind factory) not by the language itself.

The first snippet exemplifies binding between two components, the label's text will be updated every time text is written on the textField, first comes the JavaFx Script version
And now its Groovy counterpart

Maybe there is another way to setup the binding between the label and the textfield on JavaFx Script, but you can't define variables while building the content unless you do it inside a function, this means that those components are not built close to the place where they are inserted into the UI hierarchy. Clearly that is not a problem with the Groovy version. The next snippet introduces one level of indirection, a textModel. Now the label will bind to a third object that holds a text attribute. A button is also added to 'trigger' the update
The code is pretty much self explanatory, I would say the same holds true for the Groovy versionObservableMap is an utility class that fires up PropertyChangeEvents every time a property is added, updated and/or removed from it, in contrast observable beans usually fire events when a property is updated only (more options for you!). I can hear someone at the back saying 'but you JavaFx Script does have triggers, why don't you use them instead?' certainly I will. So let's remove the button and bind the label, textField and textModel, adding a console printout just to show that the model is being updated as expected, and it in turn updates the labelIt only took two binding calls and one trigger, sweet. What about the Groovy version? well, we don't have triggers (yet) that make the code short but it is certainly doableNotice that a regular PropertyChangeListener has been registered with the ObservableMap, this is how triggers are implemente in Java/Groovy. Binding the textField's text to the textModel's text property is also a bit more verbose than before. As a matter of fact that syntax used to be the previous one, so you can see that binding has been improved, just a bit but good enough :-D I think it is possible to cook up a trigger dsl to reduce the amount of code required to create triggers in Groovy, don't you think? we have metaprogramming on our side after all.

Keep on Groovying!
Java, Groovy & JavaFx: side to side 2
Second part of the Java,Groovy,JavaFx series. The following table details the language features introduced in JSE 5 and how they may or may not be supported by Groovy and JavaFx.

Feature Java Groovy JavaFx
Varargs class Person {
   public void greet(Object... args) {
     // access the "args" array here
   }
}

note: works on JDK5+
class Person {
   public void greet(Object... args) {
     // access the "args" array here
   }
}

note: works on JDK5+

class Person {
   public void greet(Object[] args) {
     // access the "args" array here
   }
}

note: any array type will do only if it is the last parameter defined. Works on JDK4+
Not supported
Annotations @NotNull String field;
@NotNull String field;


note: annotations work in the same way as in Java, with the caveat that they can not be defined in Groovy yet, requires JDJ5+
Not Supported
Generics class MyComparable implements Comparable<MyClass> { }

Map<String,Integer> map = new HashMap<String,Integer>();
class MyComparable implements Comparable<MyClass> { }

Map<String,Integer> map = new HashMap<String,Integer>();


note: generics work in the same way as in Java, requires JDK5+
Not Supported
Static imports import static java.awt.Color.RED;
import static java.awt.Color.RED;


note: static imports work in the same way as in Java, requires JDK5+
Not Supported
Typesafe Enums enum Lang {
  JAVA, GROOVY, JAVAFX;
}
enum Lang {
  JAVA, GROOVY, JAVAFX;
}

note: enums work in the same way as in Java, plus they receive some extra behavior from the GDK
Enum definition is not supported, but you can access them as any regular Java class, requires JDK5+
Enhanced for-loop for( Type variableName : Iterable )
  // statements }
for( Type variableName : Iterable )
  // statements
}

Groovy has its own enhanced for loop syntax too

for( Type variableName in Iterable )
  // statements
}

note: a type must be defined in the first version (requires JDK5+), type is optional in the second version
JavaFx has its own enhanced for loop syntax, can chain sequences

for (album in albums, track in album.tracks) {
   if (album.title == track)
     // do x
   else
     // do y
}

it also accepts filters (with a where clause)
Autoboxing/Unboxing int i = Integer.valueOf(10);
Integer j = 42;
Everything in Groovy is an object. Still it will perform autoboxing/unboxing when calling Java code that requires either a primitive or a wrapper value. JavaFx does not have primitive types per se, rather they are called basic types: String, Boolean, Number, Integer, Duration (Basic Types table)


Clearly Groovy has a better integration with Java the language than JavaFx does, but I must remind you that is by design of both languages. Developers that find themselves comfortable enough with Java5 features should feel right at home should they decide to pick Groovy, those who choose JavaFx will find themselves relearning new ways to do what they are used to, which is not really a bad thing per se, just beware of the context switching when programming in 2 or 3 languages that sport considerable differences feature wise and syntax wise.
Qi4j: fixing dependency injection

Yesterday there was a blog post about how "Dependency Injection is Broken". The issues pointed out in the post are dealt with in Qi4j, and I'd like to briefly outline how it works.

First issue:


The problem I've always had with DI frameworks, be it Spring or Guice, is they create this nasty dependency tree. If you don't want to use GlobalApplicationContext.getBean() or Injector.getInstance() then you'll need to inject all your dependencies at the root. It annoys the crap out of me, but I suppose there's just no way around it...

This is dealt with in Qi4j by allowing objects to be instantiated without having direct access to all the dependencies needed by the object. If you have a class Foo that requires a Bar service, like this:

public class Foo
{
@Service Bar bar;
}

then you can instantiate it wherever you want by simply doing:

Foo foo = objectBuilderFactory.newObject(Foo.class);

which will instantiate Foo and provide all the dependencies it needs, without the caller having to provide them explicitly.

It is also possible to use service locators in Qi4j, like this:

public class Foo
{
@Structure ServiceFinder finder;

public void doStuff()
{
ServiceReference<Bar> barRef = finder.findService(Bar.class);
Bar bar = barRef.get();
 }
}

Another issue pointed out is the ability to say "realize an object of type X, but I don't know what concrete type it should be". This is so that application code only has to be aware of the base class or interface X, which in runtime can be bound to XImpl or XMock or some other implementation. This is supported in Qi4j since all classes that are to be instantiated must be registered upfront. You can therefore register an implementation like this in the Assembler:

public void assemble(ModuleAssembly module)
{
module.addObjects(XImpl.class); // XImpl implements X interface
}

and instantiate it with:

X x = objectBuilderFactory.newObject(X.class);

Based on what you registered the appropriate implementation will be chosen. In the above case XImpl will be instantiated, and if you instead registered XMock which also implements X, then that would be instantiated. If many possibilities exist, an AmbiguousTypeException will be thrown to avoid non-deterministic behaviour.

That should take care of most of the issues pointed out in the post I think. Also note that all of the above mechanism considers visibility rules of the Layers and Modules in the Application, which can be used to further control what types are "seen" by application code in various parts of your app.

How to Monetize Your Blog

 A friend just sent me to this site that pays bloggers like yourself for every approved article posted on your site. If you are into blogging for profit and would like to add this to what you already have, this another one of those opportunities to increase your profile. Take a minute to pay the site a visit and see if there's something there for you. Remember, there's nothing to loose, but everything to gain.

Or if you already use sites like Google for Adsense, the Link Worth programme will nicely complement that. I have compiled a list of the top ten sites that will pay you to write a sponsored post on your blog; but I will find time to post them here later.

I will also provide some tips for newcomers that will help them make the most money from their blogs. Some sites pay a bit better than others, however you could join a few of these to maximize your earning potential

I will make time to place the list here later in the week.

Site running on a free Atlassian Confluence Open Source Project / Non-profit License granted to Java developers community of KPI ("JUG KPI"),. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.0 Build:#913 Sep 27, 2007) - Bug/feature request - Contact Administrators