Posts

Showing posts from December, 2005

Free Icons

famfamfam has kindly provided a set of Free Icons of all different shapes and sizes. They look great.

> Need icons for your new website or web application, at the best price there is (free!)?

CSS-Only, Table-less Forms

Jeff Howden has created a CSS-Only, Table-less Forms CSS solution.

> Most of the CSS-only, table-less forms available suck. So, not wanting to stoop to mediocrity, I decided to take on the task of coming up with something better. This is the result of my efforts. It works in Win/IE6, Firefox v1.0 , Win/Opera v8.0, has minor layout differences in Mac/Safari v1.0.3 and Mac/Safari v1.2, and is usable but fairly buggered in Mac/IE5.2.

File Uploads with Rails

Sebastian Kanthak has created a very handy file upload utility for Rails called FileColumn.

> This library makes handling of uploaded files in Ruby on Rails as easy as it should be. It helps you to not repeat yourself and write the same file handling code all over the place while providing you with nice features like keeping uploads during form redisplays, nice looking URLs for your uploaded files and easy integration with RMagick to resize uploaded images and create thumb-nails. Files are stored in the filesystem and the filename in the database.

Rails Petstore

The Rails Petstore is

> an implementation of Clinton Begin's JPetstore that has been developed with the Rails web framework. The aim of this project is to develop a reference application that demonstrates the capabilities of the framework and the best practices that should be followed when developing an application.

This is for all you Java people out there who have seen the Petstore application in one form or another over the years. The Petstore is a common Java application implementation used to show how a framework is used "in the real world". It's been implemented many times, and comparing a Java Petstore to a Rails Petstore is very useful.

Ruby off the Rails

Ruby off the Rails is a look at Ruby from a Java developer's point of view.

> Ruby on Rails is just one facet of what makes Ruby great, just like EJB is only part of the Java™ enterprise platform. Andrew Glover digs beneath the hype for a look at what Java developers can do with Ruby, all by itself.

Steal These Buttons

Image
Steal These Buttons is a collection of those little button images you find on the sidebars of blogs, such as . There are over 3000 buttons available. Of course, if you can't find what you need, you can always make your own or use the handy web version.

All these links stolen from MeFi.

SwitchTower: Automating Application Deployment

SwitchTower is a set of scripts to automate application deployments for Ruby on Rails applications. For anyone who knows the pain of deploying and upgrading many applications, this is heaven sent. At a previous job we spent close to 25% of our time deploying and redeploying applications.

> SwitchTower is a standalone utility that can also integrate nicely with Rails. You simply provide SwitchTower with a deployment “recipe” that describes your various servers and their roles, and voila! You magically have single-command deployment. It even allows you to roll a bad version out of production and revert back to the previous release.

Question now is, can this even be done in the Java world? Even if it could, would it ever take hold? I almost think that a common deploy script and procedure would not be widely accepted in the Java world, because of the mentality of the common Java developer. A Java developer wants to built it himself (see the insane number of web frameworks out there …

IM, meet AJAX

AJAX, meet Instant Messaging. IM, meet meebo.com

Call me when I'm running an AJAX browser inside my browser.

On the Rails Again

Danny's Blog has some good perspectives from a Java guy who just went to JavaPolis, but who is also On the Rails Again. He did pick up on a general meme of EoD:

> A lot of presentations I saw, about Java EE 5 (GlassFish) but also for instance about Spring, stressed that everyone now focusses on EoD(Ease of Development) and ‘code by exception’, meaning: only having to code the exceptions to the default behaviour.

Having just come back from The Spring Experience myself, and having written Ruby on Rails applications for the two weeks prior, I can attest to what Danny experienced. Programming in Rails certainly opens up your eyes to what else is possible in the web programming world. Not all of it is good, mind you. You immediately miss the power of your Java IDE, for one thing.

I recommend that every Java web developer go code a quick application in Rails, even if they will never use Rails again. It's so easy to get caught up in a language's constraints, both physical an…

Writing Mixins using AspectJ

java.net has a nice long article on Writing Mixins using AspectJ. They use the example of JavaBean property change event listeners, which up to this point has been a total pain to write. Using AspectJ, you can whisk that code away into its own aspect. Your tradition bean looks clean and beautiful again, while retaining the nice functionality of event listener notification.

>Aspect-oriented programming complements object-oriented programming in many ways. One interesting complementary feature is behavior composability. This means that it should be possible to compose a class by adding behavior from different classes. OO uses inheritance and many patterns to add behavior to existing classes. AOP allows us to use mixins without changing the class inheritance hierarchy or otherwise changing the code.

>Mixins enable us to uniformly extend a set of classes with a set of fields and methods. Java does not support mixin-based programming. This article shows what mixins are and explains …

Tutorial on Semantic Web Technologies

The Tutorial on Semantic Web Technologies, by Ivan Herman, is an excellent, complete tutorial on the semantic web. This is interesting for two reasons: (1) it is very complete and covers a lot of ground, and (2) is written in XHTML and CSS, yet it looks and acts like a PowerPoint presentation. There's also a PDF version for printing.

Accessible, stylish form layout

The Man in Blue brings the love to Accessible, stylish form layout. He shows six different ways to layout the same form, all with CSS and minimal tricks.

> Yes, HTML forms are the worst things known to web designers. Yes, HTML forms have to be accessible and usable. No, HTML forms do not have to be an eyesore.

W3’s CSS Activity

The W3C has been busy with lots of activity on the CSS front.

> 2005-12-16: The CSS Working Group has released a First Public Working Draft of the CSS3 Advanced Layout Module defining grid layout. The draft's features could be used to define visual order independent of document order, position and alignment of user interface "widgets," and page and window grids. Also published are Working Drafts of Multi-Column Layout and Cascading and Inheritance. Visit the CSS home page.

Ten Rules for Web Startups

Evan Williams (the original Blogger!), current CEO of Odeo, Inc has enumerated his Ten Rules for Web Startups. These echo how his current company is operating, lean, mean, powered by Ruby on Rails, and following the "less is more" approach.

To avoid the suspense:

1. Be Narrow
1. Be Different
1. Be Casual
1. Be Picky
1. Be User-Centric
1. Be Self-Centered
1. Be Greedy
1. Be Tiny
1. Be Agile
1. Be Balanced
1. Be Wary (bonus!)

Russell Beatie wanted to add a #12, Be Mobile.

More on Splitting Hibernate Jars from Spring

Colin Sampaleanusheds some more light on why the Hibernate classes were split into their own Jars from the Spring library:

> It's not about splitting it out just to split it out. The problem is
that having both the Hibernate 2 and Hibernate 3 code together leads to
a lot of confusion. People end up importing the wrong classes all the
time. The actual class names are identical, and the packages as
identical except for one extra char, so it's easy to import the wrong
one when you do an auto import in Eclipse. I see this over and over
during trainings, among other places. So back in the summer I suggested
we split things out to separate jars and have people just include
whichever one they wanted, but it didn't make sense (for drop in
compatibility reasons) to do this in a 1.2 point release, but rather
only now with 2.0...

Project Aardvark

Project Aardvark is a movie about:

> Four interns are brought into Manhattan and given 12 weeks to design, develop, debug and ship a program that will change the way computer geeks around the world fix their friends' computers. Boondoggle Films presents a journey through the world of software development from the perspective of a unique upstart, four quirky interns, and the world of The Geek.

Spring 2.0 Jar Missing Hibernate Classes

From Craig Walls, explaining what happened to Spring's Hibernate classes in the latest Spring 2.0 M1 release:

> I stopped Rob, Rod, and Juergen in the lobby on the last day of TSE and asked the same question. It seems that Juergen has split out most of the vendor-specific ORM stuff into independent JARs (spring-hibernate.jar or spring-hibernate3.jar for instance). It's my understanding that the decision was made because (1) the main JAR was getting quite large and (2)
Hibernate/iBATIS/OJB/etc-specific stuff is not central to Spring and thus should not be in the main JAR.

> So, yes, from a JAR dependency perspective, backwards compatibility is broken. But fixing it is simply a matter of including an addition JAR file in the classpath. Code-wise, backwards compatibility is still intact.

JavaPolis Spring Web Tier slides

From Alef Arendsen's blog, he has posted his JavaPolis Spring Web Tier slides

>Yesterday, Erwin Vervaet and me did a 3-hour session on Spring in the Web Tier. We mainly focused on Spring MVC and Web Flow. The sample is online; you can get to it from the Spring Framework site.

>The slides are here, in PDF format.

Ruby to JMS Bindings

You can now integrate Java and Ruby with JMS for Ruby. This implementation uses ActiveMQ as the JMS server. This rocks.

Removing Commons-Logging Once and For All

Removing Commons-Logging Once and For All

> I lurk on a bunch of mailing lists via Gmane and recently came across this message in which Henri Yandell asks if it would be possible to write a tool using bytecode manipulation which strips out any dependency on commons-logging.

> After getting in touch with Henri he suggested making it a generic tool that could strip out any dependency. That's pretty much right up my alley, and since I've had a few logging headaches of my own I figured it was worth a try. So I've checked in some experimental code to the Jar Jar Links project, which has similar dependency-reducing goals.

Pragmatic AOP with Spring and AspectJ

The final afternoon talk on the final day of The Spring Experience is Pragmatic AOP with Spring and AspectJ.

Aspects are modular, enhancing the value of the software overall. Aspects lead to DRY SOCs (Don't Repeat Yourself, Separation of Concerns).

Join points are well defined points in the execution of the program.
Pointcuts are expressions that match join points.
Advice is action to take at those join points. Advice is not explicitly called, unlike methods.

Typical applications are Spring managed for data access, services, web controllers, transactions, etc. Up to now, the Domain Model has not been managed by Spring.

Spring AOP is a good fit for Spring managed beans, execution based join points, or coarser-grained service application. Or any time where the aspect is slower than the impact of the proxy itself (ie, transactions).

In Domain Driven Design, another separation of concern (SOC) is the Technical Concerns (transactions, auditing, etc) from the Business Concerns (the Ubiquit…

Practical Quick Start with Acegi Security and Spring

The afternoon sessions begin with Practical Quick Start with Acegi Security and Spring, presented by Ben Alex. Ben is the project lead for Acegi Security, a fully pluggable and flexible enterprise security framework. Specifically for your enterprise software, it's not an Operating System security framework or any sort of browser or sandbox security solution.

The important thing to know about Acegi Security is it is more of a model and lexicon instead of pre-built security implementation. Because security varies across each application so widely, Acegi provides interfaces and extension points to make building a security framework much easier.

Acegi is much more than a replacement for Servlet API security. While it does fully replace the Servlet security features, it also provides fine grained ACLs on a per-object instance which is a huge feature. J2EE security does not support that at all. Other features include CAPTCHA, channel security, switch user, prohibit concurrent logins…

Spring.NET Introduction

Aleksander Seovic, Mark Pollak, and Rob Harrop are presenting an Introduction to Spring.NET.

So the first question is Why Spring.NET? Simply, the IoC container transends platforms. Also, a lack of similar toolsets and libraries on the .NET platform required a Spring.NET.

However, it's not a direct port, as the two environments have quite different practices and conventions.

One benefit to the Spring Community is a bigger core development team, and a good cross-pollination of ideas. For instance, the new XML Namespaces and XSD configurations originally came from Spring.NET.

A similarity between Spring.JAVA and Spring.NET is the transaction handling. AOP exists in Spring.NET, but implemented differently. One difficulty with aspects in .NET is methods are by default marked as final.

You'll find there are naming differences between the two environments. Object vs bean, type vs class, dictionary vs map. In .NET all exceptions are unchecked. Configuration is more formal in .NET, …

Jurgen Holler and JMS and JCA

Day Three (Full Day Two) here at The Spring Experience, and the morning session has Jurgen Holler talking about Spring's support for JMS and JCA. He knows his stuff. We're going over the standard synchronous JmsTemplate, useful when you're not running an asynchronous JMS listener.

Spring 2.0 has full support for asynchronous message receiving with POJOs. This is the elusive Message Driven POJO, important when Message Driven Beans (MDBs) aren't available.

An important note about the JmsTemplate is that it fetches a Connection for every request. In a managed environment, this is OK, because the container will pool Connections. However, in a non-managed environment, be sure that the ConnectionFactory is pooling connections.

For asynchronous message handling, you can either use MessageListener and manually register it with the Session, or use J2EE's Message Driven Beans. In either case, you are using a framework interface (MessageListener) which is not POJO complian…

The Aspects Blog: The New Holy Trinity

The
Aspects Blog: The New Holy Trinity
is Adrian Colyer's excellent post about the relationship between aspects, annotations, and POJOs. This is required reading when investigating Spring 2.0's new POJO Dependency Injection, powered by annotations and AspectJ. Essentially, you may now DI your POJOs, even when you use the new operator. In other words, you can use Spring to Dependency Inject your POJOs without any ApplicationContext in sight, or without the ApplicationContext having even created your POJO.

> Dependency injection, annotations, and aspects are the three foundations on which the next generation of world-class POJO-based applications should be built.

Spring, Mule, and the ESB

The first talk today from The Spring Experience was Justin Gehtland's Spring, Mule, and the ESB. Justin thought it was going to be attended by only a few people, but instead the room was quite full.

His talk covered what an ESB is (generally speaking, doing a good job not to do too much arm waving), what Mule is (short answer: an ESB container), and how Spring can be used for tasks like Mule configuration and Mule components.

Justin's style is quite good, and I can recommend you check him out if you happen to be at a conference with him. Or, just corner him and yell, "Hey, it's Justin Gehtland!" He loves that.

I've used Mule once, evaluating it for a project. We needed to shuffle files around, uploaded to us via FTP every night. At that time, Mule's support for file based messages was limited, so we didn't end up using the product. I think it was mainly because Mule didn't natively support the universal workaround for file dumps (place a zero-l…

Get Rocketboom via Tivo

It looks like Tivo is getting it. You can now download Rocketboom with your Tivo and watch it on your TV. That's right, original Internet video content, streamed directly to your TV. Nice. I like small content, as I find myself unwilling to sit down for 20 minutes just to watch TV. Tivo has already shrunk my tolerance for sitting down too long (thanks, commercial skip!), so a 3-5 minute episode of Rocketboom is just what I need.

Subscribe to Rocketboom with your Tivo now.

Clustering Spring

Attended the Transparently Clustering Spring talk, with more information at The Server Side press release.

The crowd quickly steared the talk to a technical overview of the product, and it was quite interesting once we got them to stop hand waving. The product is not FOSS, but still pretty cheap (mentioned about $2k per node).

The product, named Terracotta Distributed Shared Objects, provides essentially a networked shared heap. This is not a standard object caching thing like Coherence, this product maintains object identity.

The Spring Experience Keynote

We're here at The Spring Experience keynote, given by Rod Johnson. It's Wednesday evening, and dinner has finished up.  The approx. count for attendance is 275, not a bad number.
His talk is titled Spring Today and Tomorrow.  Spring is “the most powerful technology for enabling POJO-based application development.”  The majority of Interface 21’s clients are in the backing sector.
The framework is released in Feb 03 as open source, released as Spring 1.0M1 in Aug 03, and finally 1.0 Mar 04.  Spring 1.1 arrives in Sept 04, 1.2 in May 05, and Spring 2.0 M1 is released at The Spring Experience.
New features of Spring 2.0 includes:

Bean Scoping
CommonJ timer manager
Portlet MVC
Message-driven POJOs
Configuration simplification (XML or Java code)
SimpleJdbcTemplate – Java 5 features
Still committed to Java 1.3.
Coming up, what will get better?

Configuration can become simplified – Use XML namespaces, XML schema to reduce code, use custom domain specific tags, and better IDE integration.
Closer i…

Particletree · Quick Guide to Prototype

Particletree · Quick Guide to Prototype

> JavaScript’s increasing popularity throughout the web makes it more important than ever to make sure our client side code is implemented with a nice mix of stability, speed, and reusability. One of the best ways for accomplishing this is to use a simple library and syntax to use as a foundation for every project. Thankfully, Sam Stephenson created an amazing library of functions that we can rely on called Prototype.js to ease our JavaScript development practices.

Treehouse

Treehouse

>Treehouse is a monthly web development PDF magazine put together by the people behind Particletree.

>Treehouse provides web designers, programmers and entrepreneurs a creative home and outlet for the latest news, trends and techniques from the best in the industry.

First Post from BlogJet

This is a post from BlogJet.

Now Blogging with Ecto

This is the first post with Ecto.Technorati Tags: ,

Now with Tagging

Here we go, added an easy tagging facility for WordPress. Thanks to the Modified Cat2Tag plugin, we have folksonomies.

First Post!

Trying out a new blog, this time WordPress.

Rails and Allowing ID Editing from Forms

Need to allow yours users to directly edit the ID of your model object?



By default, Rails will strip out the ID field from the hash of request parameters. This is a security measure, prohibitings the web interface from altering an object's ID.



Generally, this is a good practice. However, some legacy schemas have IDs that are not simply numbers. In those cases, the ID is created and managed by the user.



To tell Rails to allow the ID to be edited, you can use attr_protected and attr_allowed.



More information is available at http://wiki.rubyonrails.com/rails/pages/HowToEnsureValidAttributesInFormData

Rails, Legacy Schemas, ActiveRecord, and has_and_belongs_to_many

There turns out to be an issue with legacy schemas and ActiveRecord, the ORM layer of Rails when using has_and_belongs_to_many.


Note: This issue might be Oracle specific.

If the join table itself has an id column, and it has the same name as the id column from the association table, then it will override the id from the association table.


This means that instances from the association table will have the wrong id.


The solution looks to be the new :finder_sql parameter of the has_and_belongs_to_many relationship. With :finder_sql, you can override the generated SQL.


How to use :finder_sql? Try:



has_and_belongs_to_many :ksaas, :join_table => "tbl_ksaa_objective",
:foreign_key => "objective_cid", :association_foreign_key => "ksaa_cid",
:finder_sql => "SELECT TBL_KSAA.cid, TBL_KSAA.ksaa_type, TBL_KSAA.ksaa_item, " +
"TBL_KSAA.KSAA_TYPEID, TBL_KSAA.SAMPLE_BEHAVIOR " +
"FROM TBL_KSAA LEFT JOIN TBL_KSAA_OBJECTIVE ON &quo…

OWLIM Inference Storage Engine

OWLIM is a high-performance semantic repository, packaged as a Storage and Inference Layer (SAIL) for the Sesame RDF database. OWLIM uses the IRRE engine to perform OWL DLP reasoning. The reasoning and query evaluation are performed in-memory, while a reliable persistence strategy assures data preservation, consistency and integrity.
– From the OWLIM Page.

More Ruby Meets the Semantic Web

Doing a bit more research on Ruby and the Semantic Web, I found another blog entry from Obie titled Semantic Web, meet Ruby on Rails.

Here's one of his snippets:



class Person < ActiveOntology::Base

definition "http://xmlns.com/foaf/0.1/index.rdf"

def your_method_here
# methods are pretty much the only thing left to write
# because since you defined it as a foaf:Person, it already has
# all the properties described at http://xmlns.com/foaf/0.1/#term_Person
end

def network_msg
"#{firstName} #{surname} has #{knows.size} people in their network"
end

end

Ruby, Meet the Semantic Web

The article Deep Integration of Ruby with Semantic Web Ontologies (PDF) makes the case that Ruby is the perfect language for the Semantic Web.

Because Ruby is so dymanic, I tend to agree. Plus, my Ruby on Rails work is making me a convert to The Way.

Named Routes in Rails

From Ronny Haryanto via the Rails Mailing List:
Interested in URLs that look something like this?
http://www.example.com/project/submarine
You can tell Rails to parse that URL in order to call the appropriate method on the controller.

 You might be interested in Named Routes.
http://wiki.rubyonrails.com/rails/pages/NamedRoutes

In config/routes.rb:

   map.project 'project/:projtitle' :controller => 'project',
                                    :action => 'show'

In app/controllers/project_controller.rb:

   def show
     @project = Project.find(:first,
                             :conditions => ['title = ?',params[:projtitle]])
     ...
   end

Or something like that. Assuming your project titles are unique. Then
you can also use project_url (since you have map.project in routes.rb)
for urls in your views, e.g.

   <% for project in @projects %>
   <%= link_to project.title,
               project_url(:projtitle => project.title) %>
    ...
   <% end…

Using Columns with Reserved Names in Rails

From Rails Mailing List : How to access column with a reserved name?



def new_column
read_attribute 'old_column'
end

def new_column=(value)
write_attribute 'old_column', value
end