Sep 23

WebWork 2.2: Coninuations, Spring, Dependencies, and Books

Java, Lightweight Containers, Tech, Web Frameworks 84 Comments »

A lot of great news has come out of the WebWork team. Having used WebWork on a lot of projects recently, I am a big fan, as it is simple and gets out of your damn way! :)

Some of the great news:

  • Continuations: RIFE and WebWork have partnered around continuations (at least). WebWork now contains an early version of RIFE/continuations, and provides experimental support for continuations. This is so we can get closer to SeaSide if we want. Take a look at an example action:
    public class Guess extends ActionSupport {
    int guess;
    
    public String execute() throws Exception {
    int answer = new Random().nextInt(100) + 1;
    int tries = 5;
    
    while (answer != guess && tries > 0) {
    pause(SUCCESS);
    
    if (guess > answer) {
    addFieldError("guess", "Too high!");
    } else if (guess < answer) {
    addFieldError("guess", "Too low!");
    }
    
    tries--;
    }
    
    if (answer == guess) {
    addActionMessage("You got it!");
    } else {
    addActionMessage("You ran out of tries, the answer was " + answer);
    }
    
    return SUCCESS;
    }
    
    public void setGuess(int guess) {
    this.guess = guess;
    }
    }
    
  • Spring IoC by default: WebWork is working with the Spring team too, and Spring is now the default IoC container
  • WebWork in Action: "Where is the WebWork book?". It's finally here
  • WebWork Dependencies: WebWork uses Ivy, and has a nice view of its dependencies

Amazing work guys.

Sep 23

Tweaking on the bleeding edge: Ruby vs. Java

Java, Ruby, Tech 54 Comments »

Something clicked recently, after I compared a couple of scenarios of recently life.

The two cases have to do with extending your framework, especially on the bleeding edge.

Extending Java: Hibernate and XDoclet

Ben Ellingson has been working on an Adigio project that is pushing the edge with Hibernate 3 and XDoclet 2.

To get things working, both Hibernate 3, and the XDoclet 2 plugin had to be patched, resulting in our own builds.

Luckily, there are JIRA issues filed, and in the Hibernate 3 case a fix seems to have already been put in.

Extending Ruby: Rails

In another life, a Rails project needed to alter the way Rails did something. Rather than having to have a special jar file, or dependency, or anything like that, all that needed to be done was to re-open the classes that needed tweaking, and change the methods!

Having a system that allows open classes is a pleasure when it comes to making changes like this. So much cleaner!

Sep 22

Ruby on Ruby on Rails

Ruby 1 Comment »

It is good to see Sam Ruby “Prototyping Intertwingly on Rails”.

He loves porting his blog software to every framework under the sun, and this time he talks about his experience porting to Rails.

I still have much to explore: localization, logging, redcloth or equivalent, caching, spell checking, trackbacks, automated excerpts, Atom publishing protocol, comment throttles, etc., etc., etc.; however at this time I see nothing that will likely get in my way – to the contrary, I see quite a bit of things that I can build upon in Ruby on Rails.

It seems like a positive experience :)

Sep 21

Next Big Thing for Google: Google p0rn

Google, Tech 2 Comments »

You keep hearing Google rumors on a daily basis. It really is quite amazing how much buzz they get. I don’t think I have seen such a constant stream for any company in my time.

However, I think that everyone is missing the Big One ™. It isn’t Google Wifi, and it wasn’t Google Talk.

I think the next big thing revolves around the imaging product. If you do image searches, you notice that you can say “don’t show me anything XXX”. This means that Google has the power to take a photo and say “this is raunchy”.

They could take this as a power for good and simply flip the bit. Imagine how many people would use a search engine that ONLY searches the raunchy. I bet Google can probably do more than just know “yes/no”, but also “blond/brunette” and even more (you can get creative I am sure).

So, the cat is out of the bag Google. We know that this entire company was made to come up with the Big One. Google Porn.

Sep 20

Why I want a group IDE vs. an Ajax code editor

IDE, Tech 3 Comments »

Kunal Anand wants an Ajaxian Code Editor.

When you read on, you quickly find that whether it is Ajax or not isn’t the issue. The issue is that he wants a more “live” experience in his group coding.

This is something that keeps coming back.

Now-a-days, a lot of coders are lucky enough to have multiple monitors (or monitor + laptop screen).

When I am plugged in, my laptop screen becomes a dashboard. That is where I have my email, my calendar, etc. On my main screen I have my code and real work.

I would like to see apps grokking that this is a growing setup.

Imagine if my IDE had a panel that I could move over to my dashboard screen that had IM windows for people in my team, and I can see what they are coding. Live. Then we can chat (text/voice) and iterate together. You can bring in, or ignore various people on the team to not bug eachother, etc etc.

You would truly feel like the entire team is running fast getting stuff done, and multitasking at the same time.

Sep 19

SeatGuru.com: A must have bookmark for travel

Travel 1 Comment »

Ben told me about SeatGuru.com which tells you everything you need to know about the plane that you are travelling on.

This is priceless for me, as I always forget whether the bulkhead is a great seat or a poor seat, as it varies from plane to plane!

It would be really cool if they allowed you comment on the planes too :)

Sep 14

Gadgets vs. Widgets: The war starts

Apple, Microsoft 25 Comments »

Microsoft has gotten into the Widget/Gadget DHTML component game.

We have the players:

You want to write a cool dhtml widget for your desktop, what do you choose? Partly it will depend on your OS of course, but what about cross platform via Yahoo! Widgets?

Imagine if we had ONE standard, so you could write one widget that worked in all docks and platforms?

Sure, this would mean that you couldn’t tie into the OS specific side of things…

Sep 14

Application Monitoring with AspectJ, JMX, and GlassBox

AOP, Tech 4 Comments »

Ron Bodkin has written about Performance monitoring with AspectJ: A look inside the Glassbox Inspector with AspectJ and JMX, which is part of the AOP@Work series.

Say goodbye to scattered and tangled monitoring code, as Ron Bodkin shows you how to combine AspectJ and JMX for a flexible, modular approach to performance monitoring. In this first of two parts, Ron uses source code and ideas from the Glassbox Inspector open source project to help you build a monitoring system that provides correlated information to identify specific problems, but with low enough overhead to be used in production environments.

The article gets into some serious code, and discusses:

  • An aspect for capturing time and counts of servlets
  • Managing overhead
  • Thread safety
  • Exposing performance data
  • Exposing beans for JMX management
  • Database request monitoring
  • Servlet request tracking
  • JDBC monitoring
  • Tracking JDBC information

Not only is this a great example of seeing *real* AOP at work, but it also let’s us see the work being done in Glassbox, which wil hopefully end up with us being able to find problems in our software a LOT faster!

glassbox-jmxconsole.jpg

Sep 13

Implicit Local Variables and Lambda comes to C#

Microsoft, Tech 17 Comments »

Anders is a smart man. He has seen good ideas that are taking hold in the dynamic language space, and has pragmatically chosen those that can make sense in a statically typed world and applied them.

Specifically:

  • C# 3 has lambda. True closures.
  • C# 3 has implicitly typed local variables

Implicit variables

As Ben says, if your IDE knows to put in a (Cast), can’t the compiler?

The C# 3 one can, and does:

var x = 7;
var s = “This is a string.”;
var d = 99.99;
var numbers = new int[] { 0, 1, 2, 3, 4, 5, 6 };

foreach (int n in numbers) Console.WriteLine(n);

var lowNums = from n in numbers where n < 5 select n;

Now, this doesn’t mean that C# is a script language and you can put anything you want into these variables. The compiler works out the type, and statically binds it. If you try to assign an incorrect type later on you will get an exception.

Lambda

C# 2 offered good old delegate() which was a nice step forward. Now they have gone the whole hog though, and allow you to create lambda expressions.

A lambda expression is written as a parameter list, followed by the => token, followed by an expression.

// Explicit
(int x) => x + 1

// Implicit. If there is one, then the parens can be ommited
x => x + 1

// Two, implicit
(x, y) => return x * y;

Some more examples:

var evenNumbers = list.FindAll(i => (i % 2) == 0);

// multiple parameters
var matches = fruit.FilterBy((string name, double price) => name == “banana” && price < 2.00);

Java 7 anyone?

C# 3.0 New features

  • Implicitly typed local variables, which permit the type of local variables to be inferred from the expressions used to initialize them.
  • Extension methods, which make it possible to extend existing types and constructed types with additional methods.
  • Lambda expressions, an evolution of anonymous methods that provides improved type inference and conversions to both delegate types and expression trees.
  • Object initializers, which ease construction and initialization of objects.
  • Anonymous types, which are tuple types automatically inferred and created from object initializers.
  • Implicitly typed arrays, a form of array creation and initialization that infers the element type of the array from an array initializer.
  • Query expressions, which provide a language integrated syntax for queries that is similar to relational and hierarchical query languages such as SQL and XQuery.
  • Expression trees, which permit lambda expressions to be represented as data (expression trees) instead of as code (delegates).

LINQ Project

LINQ Tech Preview

C# 3.0 Language Specification

Sep 13

Tagging Object Model with Rails

Ruby, Tech No Comments »

Dema has created a nice acts_as_taggable mixin that allows you to add metadata tagging to your ActiveRecord object model.

Nice and clean.

class Photo < ActiveRecord::Base
acts_as_taggable
end

photo = Photo.new

# standard tagging with a string
photo.tag 'brazil rio beach'

# tagging with an array
photo.tag ['south america', 'soccer']

# tagging with a different separator
photo.tag 'beautiful women, babes, hot chicks', :separator => ','

# tagging with a Proc separator
photo.tag '2001..2005', :separator => proc { |s| eval(s).to_a }

# suppose your tags_photos join table has attributes
# and you want to set them while you tag
photo.tag 'samba', :attributes => { :tagged_at => Time.now }

# Let