Today I got present: a device which is meant to steam poultry on a BBQ. Next to the device I got a nice French chicken from the poulterer. Here a photo story of what happened after that.
- Get the BBQ started
- The steaming device
- Sjoerd (my son) is inspecting the herb/beer mixture
- Mount the chicken
- Minor adjustments using a miniature shovel
- Ready to cook
- Adjusted the setup to retain more heat
- Very warm…
- Measure the temperature once in a while
- Nice and brown
Today I went to the RubyEnRails 2008 conference. Last year I went there as well and was really enthusiastic about the presentations I visited. This years’ conference was good, but didn’t manage to come close to what I expected. Maybe my expectations where to high this year.
Zed Shaw gave a really nice opening presentation. He addressed some interesting problems of current software development and benchmarks using some great examples.
After this Obie Fernadez showed some crappy Rails code and told us not to write that sort of stuff. To bad he didn’t show how we _should_ code.
Sam Aaron tried to tell us something about the aesthetics of code. Nice presentation. Nothing really conclusive which I didn’t know before (yes, domain specific languages are useful).
Mod_rails… interesting nice to have. Next.
JRuby. Good presentation. The JRuby team is really delivering great stuff. I’ve been spoiled though; Not to different from the one at JavaOne
Then Roderick van Domburg tried to tell something about code metrics. Auch. Apart from really straightforward metrics like the LOC in tests vs the LOC and the average number of lines per method he showed Heckle, Flog and rCov. Which have all been around for years now. Nothing new here.
The Rails Q&A with David Heinemeier Hansson via iChat was horrible. I’m not interested in whether David prefers his Macbook Air over his Macbook Pro.
I did met a lot of people and had some interesting discussions in the corridors; which was really nice!
- The building
- Finalist Stand
- Zed Shaw
- Obie Fernandez telling us what _not_ to do
- Charles on JRuby
- David via IChat
1 day of CommunityOne and 4 days of JavaOne went by in a flash. I’ve been to a lot of great, a couple of not-so-great and some really bad sessions.
To avoid information overload on semi-interesting topics I really tried to only go to sessions about topics I’m really interested in. For this JavaOne these where (in no particular order):
- alternative languages on the virtual machine
- methodologies
- the future of Java / JEE
- cool new stuff
I tried to avoid product pitches as much as possible! Some of my personal highlights:
- the No Fluff Just Stuff session at the g2one party
- Both Neal Ford presentations I’ve attended (JRuby vs. Groovy / Enterprise Debugging techniques)
- the scripting bowl
- Taming the Leopard with Java
I’m still processing everything I’ve seen, but so far I didn’t see to much I didn’t know about before; certainly nothing shocking. Here are some of my observations:
Java 7
Sun is adding more and more annotations, the Java 7 spec-leads feel it’s a safe way of extending the language; even though it decreases readability (well, that is MY opinion). They are even planning to extend the number of targets for annotations; in the future we will probably see annotations inside generic type definitions… auch!
I also sincerely doubt that we will see a useful implementation of closures in Java 7; the spec-leads don’t want to burn their hands on it; Gafter seems the only one who dares to risk his neck…
Alternative languages on the VM
Groovy gained a lot of traction the past years. Most mayor app-servers offer out of the box support and major speakers are promoting it (Neal Ford repeatedly called it JDK 2.0).
JRuby is looking better and better. It is now even possible to just drop your Rails app in Glassfish to make it run. I do however feel that some users should stand-up and really demonstrate the virtues of Ruby on the VM to get peoples’ attention. The Jython presentation(s) where horrible; I think they did more harm to the language than good. I saw some great demonstrations of scala; but popularity seems to be at an alltime low.
As I said I’m still processing al the information and probably blog about various nice details and insights. Now I’m heading towards a restaurant and some beers!
Yesterday I (with two of my collegueas) travelled to San Francisco to attend JavaOne 2008 and the Community one sessions which start on May 5th. The interesting conversations began during the flight; we we’re located just in front of the David Booth (JetBrains Executive Manager) and had a nice little chat about what features we would pay for in IDE software.
After arriving we just walked through San Francisco and had some beers, good Italian Food en Coffee. The weather is just fine!
Today I’ll probably walk arround to see the Fishmens’ Wharf, Golden Gate and various other touristic attractions.
I’m uploading foto’s to my flickr account; you can browse my JavaOne related pictures here.
Javaone: My (preliminary) schedule
0 Comments Published by peter April 11th, 2008 in conference, javaone.
It has been a bit silent on my blog lately. This can be accounted to several reasons including some very busy projects at work and family business. I did write an article (in Dutch) for the Finalist blog about Fluent Interfaces though.
But recently I got some great work-related news which I just have to share: I get to go to JavaOne in San Francisco!
I went over the schedule and created a preliminary schedule (which proved to be quite hard with so much to choose from) of the sessions I’d like to visit. As you can see; I’ll be on a tight schedule!
| Time | Session ID/Title | Speaker(s) | ||
| Tuesday , May 06 | ||||
| 8:30 AM - 10:30 AM | Sun General Session Java + YOU |
|||
| 11:30 AM - 8:00 PM | Tuesday Pavilion Hours: 11:30 a.m. - 8:00 p.m. | |||
| 11:50 AM - 12:10 PM | Break between sessions | |||
| 11:50 AM - 11:50 AM | Lunch Served from 11:50 a.m. to 2:00 p.m. | |||
| 12:10 PM - 1:10 PM | TS-6623 More “Effective Java” |
Joshua Bloch | ||
| 1:30 PM - 3:00 PM | Sun General Session Java-Centricity: Leveraging Java Technology at the hub of your Digital Life |
|||
| 3:20 PM - 4:20 PM | TS-5581 Upcoming Java™ Programming-Language Changes |
Alex Buckley; Michael Ernst; Neal Gafter | ||
| 4:20 PM - 4:40 PM | Break between sessions | |||
| 4:40 PM - 5:40 PM | TS-5030 Building Secure Mashups with OpenAjax |
Jon Ferraiolo | ||
| 5:40 PM - 6:00 PM | Break between sessions | |||
| 6:00 PM - 7:00 PM | TS-5764 Grails in Depth |
Guillaume Laforge; Graeme Rocher | ||
| 7:00 PM - 7:30 PM | Evening Break | |||
| 7:30 PM - 8:20 PM | BOF-5031 Upcoming Java™ Programming Language Features |
Alex Buckley; Maurizio Cimadomore; Jonathan Gibbons | ||
| 8:30 PM - 9:20 PM | BOF-5111 Scripting in GlassFish™ Project |
Arun Gupta; Vivek Pandey | ||
| 9:30 PM - 10:20 PM | BOF-5205 All About the Sun Certified Enterprise Architect (SCEA) Exam |
Mark Cade; Humphrey Sheil | ||
| Wednesday, May 07 | ||||
| 8:30 AM - 9:15 AM | Oracle General Session Enterprise Application Platform |
|||
| 9:30 AM - 10:30 AM | PAN-5435 The Script Bowl: A Rapid-Fire Comparison of Scripting Languages |
Guillaume Laforge; Charles Nutter; Jorge Ortiz; Raghavan Srinivas; Frank Wierzbicki | ||
| 10:30 AM - 10:50 AM | Break between sessions | |||
| 10:50 AM - 11:50 AM | TS-5286 Introduction to Web Beans |
Gavin King | ||
| 11:30 AM - 4:30 PM | Wednesday Pavilion Hours: 11:30 a.m. - 4:30 p.m. | |||
| 11:50 AM - 11:50 AM | Lunch Served from 11:50 a.m. to 2:00 p.m. | |||
| 1:30 PM - 2:30 PM | TS-5535 Tying Java™ Technologies Together the RESTful Way |
Roderico Cruz; Peter Liu | ||
| 2:30 PM - 2:50 PM | Break between sessions | |||
| 2:50 PM - 3:50 PM | TS-7064 Future Challenges for Open Source and Java™ Technology |
Patrick Finch; Simon Phipps | ||
| 3:50 PM - 4:10 PM | Break between sessions | |||
| 5:10 PM - 6:30 PM | Evening Break | |||
| 5:30 PM - 6:15 PM | AMD General Session The Role of the Microprocessor in the Evolution of Java Technology |
|||
| 8:30 PM - 9:20 PM | BOF-5102 Cooking Your Own Groovy Builder: A Step Forward into Domain-Specific Languages |
Andres Almiray; Ixchel Ruiz | ||
| Thursday , May 08 | ||||
| 8:30 AM - 9:15 AM | Intel General Session Innovations through Software |
|||
| 9:30 AM - 10:30 AM | TS-5686 New I/O APIs for the Java™ Platform |
Alan Bateman | ||
| 10:30 AM - 10:50 AM | Break between sessions | |||
| 10:50 AM - 11:50 AM | TS-5415 Java™ Servlet 3.0 API: What’s New and Exciting |
Rajiv Mordani; Sridatta Viswanath | ||
| 11:30 AM - 4:30 PM | Thurdsay Pavilion Hours: 11:30 a.m. - 4:30 p.m. | |||
| 11:50 AM - 11:50 AM | Lunch Served from 11:50 a.m. to 2:00 p.m. | |||
| 1:30 PM - 2:30 PM | TS-5165 Programming with Functional Objects in Scala |
Martin Odersky | ||
| 2:30 PM - 2:50 PM | Break between sessions | |||
| 2:50 PM - 3:50 PM | TS-6457 Choosing Your Java™ Technology-Based Web Framework: A Comparison |
Richard Pack; Stacey Schneider | ||
| 3:50 PM - 4:10 PM | Break between sessions | |||
| 4:10 PM - 5:10 PM | TS-5596 Pimp My Build: 10 Ways to Make Your Build Rock |
Conor MacNeill; Matt Quail | ||
| 5:10 PM - 6:30 PM | Evening Break | |||
| 5:30 PM - 6:15 PM | Motorola General Session Dial in, Drive Deep: Using Motorola’s Platforms to Reach Consumer and Enterprise Markets |
|||
| 6:30 PM - 7:20 PM | BOF-6362 LinkedIn: A Professional Social Network Built with Java™ Technologies and Agile Practices |
Nick Dellamaggiore; Eishay Smith | ||
| 8:30 PM - 9:20 PM | BOF-5998 Meet the Java™ Posse |
Tor Norbye; Dick Wall | ||
| Friday , May 09 | ||||
| 8:30 AM - 10:30 AM | Sun General Session Extreme Innovation |
|||
| 10:50 AM - 11:50 AM | TS-6391 Using Java™ Technology at the World’s Largest Web Site |
Joshua Blatt; Dean Yu | ||
| 11:50 AM - 12:10 PM | Break between sessions | |||
| 11:50 AM - 11:50 AM | Lunch Served from 11:50 a.m. to 2:00 p.m. | |||
| 12:10 PM - 1:10 PM | TS-6658 GlassFish™ Project Web Services Stack “Metro”: Easy to Use, Robust, and High-Performance |
Jitendra Kotamraju; Marek Potociar | ||
| 1:10 PM - 1:30 PM | Break between sessions | |||
| 1:30 PM - 2:30 PM | TS-4883 Advanced Java™ NIO Technology-Based Applications Using the Grizzly Framework |
Jean-François Arcand; Oleksiy Stashok | ||
| 2:30 PM - 2:50 PM | Break between sessions | |||
| 2:50 PM - 3:50 PM | TS-5358 Detecting and Defending Against Security Vulnerabilities for Web 2.0 Applications |
Barry AuYeung; Ray Lai | ||
| 3:50 PM - 4:10 PM | Break between sessions | |||
| 4:10 PM - 5:10 PM | TS-5349 So Many Faces: Web 2.0 XD Experience with JavaServer™ Faces and JavaFX™ Technology, Flex, and Windows Presentation Foundation |
Ray Lai; George Mount | ||
I’ve been a bit silent on my blog lately. This is primarily caused by the birth of my second child Maaike. She is everything we could have hoped for!
I’m mostly running around with diapers, towels and video/photo camera’s if I’m not entertaining visitors or my son Sjoerd or posting to the family blog!
Nesting ActiveRecord transactions
0 Comments Published by peter January 24th, 2008 in active_record, ruby, transactions.I was experimenting with transactions in Rails/ActiveRecord to see what they can and what they can't do. At first it seemed I couldn't get transactions to work at all. I made sure I was using the InnoDB storage engine. I rechecked my code. But the test kept failing.
This, by the way, is the test:
-
require File.dirname(__FILE__) + '/../test_helper'
-
-
class BlogTest <ActiveSupport::TestCase
-
-
def test_transaction_rollback
-
b = Blog.find(2);
-
assert_equal(b.title, "Title 2")
-
-
assert_raise RuntimeError do
-
Blog.transaction do
-
b.title = "changed title"
-
b.save
-
raise "forced error" # force exception
-
end
-
end
-
b.reload # get the current state from the database
-
-
assert_equal(b.title, "Title 2")
-
end
-
end
Luckily a colleague pointed out that it was probably related to Rails' limited support for nested transactions; tests run within a transaction for performance reasons... which makes it impossible to roll back a transaction within a test.
Consider the following code:
-
Account.transaction do
-
User.transaction do
-
# do some stuff
-
end
-
-
# the previous transaction has already been committed, if we
-
# raise an exception now it can not be rolled back
-
raise
-
end
The inner transaction won't be rolled back if the outer transaction fails after it's execution!
Googling around I found a simple fix for my test. Turn off the transactional behavior of the fixtures in the test:
-
class BlogTest <ActiveSupport::TestCase
-
self.use_transactional_fixtures = false
-
...
-
end
Which works, but will slow down the execution of all tests. And it actually doesn't really solve the problem, it is a work-around.
I decided to see why nested transactions where such a big issue, and how it could be solved and found the ActiveRecord NestedTransactions (ARNE) pluging. ARNE is a plugin which makes ActiveRecord use SAVEPOINTS to achieve nested transactions functionality.
Savepoints save the state within a transaction to provide the ability to jump back to this state when something goes wrong later on. In SQL it looks something like this:
-
BEGIN; # start transaction
-
SAVEPOINT my_first_savepoint # capture the current state
-
-
# do some work here
-
-
ROLLBACK TO SAVEPOINT my_first_savepoint # optionally roll back to the specified state.
-
RELEASE SAVEPOINT my_first_savepoint # clean up
-
END; # end the transaction
The ARNE plugin wraps transaction blocks in savepoints to provide nesting functionality and actually works beautifully; my test succeeded. I did however find a small bug for which I've submitted a patch. The name of a safepoint must be unique for nesting to work without problems. If a name is used twice the initial savepoint is overwritten. Since the name was originally generated using a random generator this was in no way guaranteed:
-
# method to generate savepoint name
-
def generate_savepoint_name
-
# name must start with letters
-
"SP#{MD5.md5(rand.to_s)}"
-
end
A better solution would (IMHO) be to use a UUID generator:
-
# method to generate savepoint name
-
def generate_savepoint_name
-
# name must start with letters
-
"SP#{UUID.random_create.to_s.gsub('-','_')}"
-
end
I used the UUID generator from the uuidtools Gem. Note the random_create (a random generator is used to seeded the UUID algoritm) this guarantees that the above will also work when there is no standard MAC address (I heard about VPS solutions with this problem).
I learned a lot by looking at the way transaction handling is implemented in ActiveRecord. The code is clean, compact and readable. It made me like Ruby even more; although some people will probably say (and I tend to agree) that nesting should have been part of ActiveRecord all along.
Some people complained about the fact that they had to register to add comments on this blog. Requiring people to login was the easiest way to get rid of spam after problems I had with SpamKarma.
While waiting for eclipse/subversion to finish its' tasks I decided to install Did You Pass Math? (DYPM). DYPM asks the person making the comment to answer a simple math question; you've seen it on other blogs.
So... let's see if it works for me!
Januari 28 will be the day of the first gathering of the Amsterdam's Ruby User Group. I'd like to be there but due to the fact that at that time my wife will be over 40 weeks pregnant... I just wont...
Still, I think it's a great idea and will certainly be joining future gatherings! For those of you without pregnant wives, come and talk Ruby at De bekeerde suster near the Nieuwmarkt in Amsterdam (Duh!!) arround 20:00.




































