Jakub Korab
Tech, Opinion, and Doing Stuff

Blog now syntax highlighting code snippets!

July 27th, 2007

I tracked down a Javascript component today that allows you to format code snippets in your blog. Syntaxhighlighter by Alex Gorbatchev. Most popular languages supported.

Had to do a minor patch to run it off blogger, but it now works like a treat. Check out my last post on EJB.


Filed under: blogs, javascript, tools | No Tag
No Tag
July 27th, 2007 15:08:00

Prototype documentation

July 27th, 2007

Anybody working with the prototype Javascript library should check out Sergio Pereira’s Developer Notes for prototype.js. This is the documentation the library should have had.


Filed under: ajax, javascript | No Tag
No Tag
July 27th, 2007 11:32:00

Client-side web development evolved

July 27th, 2007

It’s finally time to say goodbye to my trusty Venkman debugger for Firefox. My old friend has served me well for Javascript development, but I have found a new, better tool: Firebug. Javascript, DOM, XHR debugging, profiling, viewing, command line interface, profiling. Mmm…


Filed under: ajax, javascript, open source, tools | No Tag
No Tag
July 27th, 2007 10:31:00

Getting up to speed on EJB3 and Spring

July 24th, 2007

Another contract, another technology set. Having successfully avoided working in EJB2 after getting certified in it by Sun (only to work out just how badly it smelt ;) ), my initial foray into its successor has been much nicer. The job in question specified Spring and EJB3 as technology requirements, so having Sprung in anger, I approached it from that angle as well as getting myself up to speed on the EJB3 changes.

Firstly, while they may be viewed competing technologies they can be complementary ones. Spring is a framework which aside from dependency injection gives you a bunch of goodies for the various tiers in your application that make your life easy and cut down on boiler-plate code. EJB3 is a model for building server-side components that gives you services such as concurrency, transaction management, persistence, object distribution, naming, and security. And it’s finally getting to be the technology that it should have been.

The changes in EJB since version 2:

  • All EJBs are now POJOs. Woohoo! Nothing to subclass. Easy to test!
  • You don’t have to implement a whole bunch of container callback methods – write up the ones you want (if you want them) and annotate with the event that triggers. I am finally seeing the power of the annotation here. Think optional mini-interface.
  • Remote interfaces don’t have to differ from local interfaces only by a RemoteException that needs to be handled around each invocation.
  • Persistence via entity beans has been reworked into it’s own API (JPA) which means it can be used outside a container. Stuff that implements it? Hibernate, Toplink… all the stuff you already know.

In fact… a stateless session bean does not look that far removed from a stateless class your existing Spring application used in its service layer. A smattering of annotations, a hook for Spring to weave its DI magic and a change of config is all it takes for your Spring app to use all of the goodies that EJB gives you via local session beans. You still have to understand the EJB life cycle but you don’t get something for nothing.

EJB3 supports dependency injection out of the box, but it’s kind of limited. The only things that are injected are other EJBs, and an EntityManager object (used to access the ORM – kind of naff since we have all been happily DAOing for ages and like to separate our data access from our business logic). If you wanted to use DI to inject stuff at a finer level (such as DAOs, JavaMail sessions etc.), you still have to use an actual DI container – hence Spring. The hook feels a bit clumsy, in that your EJBs have to subclass a Spring class and implement a callback, but it makes sense when you understand the bean life cycle. Not quite painless but pretty good nevertheless.

Spring strikes again in the DAO/EAO layer (E for Entity, get it?) with it’s superb template approach via the JpaDaoSupport class, cutting boiler-plate code in that layer to nothing. Mmm… warm fuzzy feeling ahead:

public class UserDao extends JpaDaoSupport {  public List getAdminUsers() {    return getJpaTemplate().find("select u from User u where type=?1", "admin");  }}

EJB 3 in Action is worth the money just for the chapter covering the Spring integration. The rest of the book is also quite good both from the point of view of a new developer and people like me who are getting up to speed on the changes from earlier versions. The latest edition of the definitive guide, Enterprise JavaBeans 3.0 by Burke and Monson-Haefel (who retired from writing before this edition) is also exceptional, but you should check out the relevant Spring documentation to supplement it.

My take on this is that Spring gives you good stuff, and EJB gives you good stuff as well – and now without the pain. Use one, or the other, or feel free to mix and match. It’s nice to know that you don’t have to trade one for the other.


Filed under: books, ejb, java, spring | No Tag
No Tag
July 24th, 2007 18:13:00

Killing the 419 through a high signal-noise ratio

July 20th, 2007

Most of the spam that hits my mailbox these days is the “Contact us urgently for your $1.5 million” type rubbish. Everything else seems to get caught by my email provider. I guess that the 419 looks like something that may be legitimate, so they let it through. Sending the mails on to email providers to shut down mailboxes is a time consuming affair and is like trying to stamp out little fires that keep spreading – it tries to cure the symptoms rather than the problem.

So what’s the underlying problem with the 419 emails? It is profitable for a guy in some third world country to scam the Unsavvy. Send out a hundred thousand emails, and the people who email you back are ripe for the picking. Now, what if the guy started getting a huge number of fake personal details that he follows up only to find that they’re crap. The cost of doing the 419 automatically goes up.

The idea: a 419 killer service. You forward the email to the killer mailbox. It works out whether it’s dealing with a legitimate 419 email, and if so adds the from and reply-to addresses to a list. It then periodically generates rubbish personal details that it forwards in an authentic looking reply message to those addresses. Now instead of having a few legitimate details, they’re hidden in the hundreds that these guys need to go through to find an actual person. The result: an increased cost of doing 419s, and hopefully getting these people to do something else with their time.


Filed under: questionable ideas, spam, technology | No Tag
No Tag
July 20th, 2007 14:29:00

Upcoming Events at the Dublin JUG

July 12th, 2007

At Tuesday’s regular monthly JUG meetup, I put forward some ideas of the sort of stuff that I’m going to be pushing in order to make the JUG more valuable to our members.

Master classes – a 2-3 hour session for 20 people max that explains how to use one technology properly. Eg. how to test a Struts, Spring, Hibernate app at all levels, or using JMX to modify the behaviour of a web application at runtime. These are just some starter ideas. Yes, the info is all out there on the net, but this would be a tutorial overview that collates all the good stuff in a digestible module.

A themed conference – eg. “Build me an SOA”. From the feedback that I’m seeing, a lot of the big conferences focus on what’s coming up in the near future and why you should use the latest and greatest. Cool. No probs. But tell a team of developers that you’re embarking on a project to implement an SOA strategy using an ESB and you’ll be left with a whole bunch of folks scratching their heads or nodding and quickly reading up on the net. So how about an event that explains what the buzzwords are, how they work in theory, the problems they solve and then how to go about implementing it. Add in a few local speakers who have gone through it all to describe hazards, pitfalls and the payoffs and I think you’d be on to a winner.

One off presentations – evening conference presentation type things. “Here’s the coolest new framework/development paradigm”.

The forum welcomed the ideas, and with the support that I have received over the last few weeks from various parties around Dublin, I’m looking forward to getting some of these ideas rolling as soon as I can. Fun times ahead.

Not part of the Dublin JUG? You should be.


Filed under: java, jug | No Tag
No Tag
July 12th, 2007 13:51:00

7 year old girl implements Pet Store in Java

July 11th, 2007

Seems today is my day for posting links up. I blame the guys at the JUG.

http://craigbbaker.com/2007/07/08/7-year-old-girl-implements-pet-store-in-java/


Filed under: humour, java | No Tag
No Tag
July 11th, 2007 13:04:00

22 Confessions of a Former Dell Sales Manager

July 11th, 2007

Great tips on how to get the best deal on a new system from Dell:

http://consumerist.com/consumer/insiders/22-confessions-of-a-former-dell-sales-manager-268831.php


Filed under: technology | No Tag
No Tag
July 11th, 2007 13:02:00

Web Developer rates up 26% in UK

July 11th, 2007

Driven by new interest in Web 2.0 technologies, acquisitions by the New
Conglomerates (Google, Microsoft et al.)

http://www.contractoruk.com/news/003339.html


Filed under: contracting | No Tag
No Tag
July 11th, 2007 13:01:00

Dublin JUG June Meetup Synopsis

July 11th, 2007

So you wanted to know what exactly gets covered at the Dublin JUG
meetups? Here's a quick, edited stream of collective consciousness from
last night:

JBoss guys doing talk in London – Mark Proctor, JBoss Rules.
Sun Microsystems HQ might be an idea for presentations.

Topics that might be covered in a Rules, JBoss, Hibernate, Spring.
.Net guys use Boswell's hotel for conferences. 60-100 ppl
Pascal from DCU about .Net group
Barcamp use old Guinness visitor centre for conference area.

Perl industrial duct tape – is there still a market for it as the
primary job skill?
Python more popular than Ruby according to job boards
OpenApp use Python, demo graphics similar to Google Maps
Might be an idea to get some Python guys to bring people over to the
dark side.
Ruby group getting started.
Groovy scripting
Paul likes PHP because it's easy to read, update and there's lots of
stuff out in the wild

Juan getting tired of Java since you can't use any of the new stuff,
since all of the environments use 1.4
Retroweaver comes with Struts 2.0, modifies 1.5 byte code so it runs in
1.4 JVM
It is being used in production
Irish independent using 1.5
Sun don't put in must-have features, drop support to make people upgrade
If companies did bigger changes at the same time, perhaps there would be
more impetus to upgrade.

Application servers drive change
Consumers using the applets will only need a subset of the API. Is this
the way to go for servers?
OSGI, JSR-277
Ecosystem of Jars
Java 6 is irrelevant to everyday developers, since most are stuck on
older JVMs

Google's biggest problem when they upgraded to Java 5 was rewriting
enum() functions, due to reserved word
A talk with Li Moore is available on the Sun website -

http://java.sun.com/developer/technicalArticles/J2SE/google/limoore.html

You can run Google mail through your website
Personal mail proxy
Will mobiles/3G cards make corporate email policies obsolete?

Java.sun.com worldviewer – realtime written by NASA
Aircoach has maps which show where the next bus is
Dart has same but not in realtime
Tomtom does similar

Shrink wrapped software versus web app quality


Filed under: java, jug | No Tag
No Tag
July 11th, 2007 12:58:00