Apr 4 10

Rails, factory_girl and has_many

by jan

This is just a quick note that some people might find useful. I do not write factory_girl Factories that often and when I do I always keep its RDoc opened up because I never seem to remember the API (after not using it for a while).

The problem I had few times before and the problem I set out to fix today was: “What to do when you want to create multiple objects for your has_many association?” Now, this seems like a simple task for factory_girl callbacks. I tried many approaches, this is my final one and I am happy it works.

Lets say we have a model Bundle and it has_many BundleItems. Then a factory that creates a Bundle with exactly four BundleItems will look like this:

Factory.define :bundle do |f|
  f.bundle_items do |bundle|
    res = []
    4.times do
      res << Factory.build(:bundle_item, :bundle => bundle.result)

The only thing I am quite unhappy about is that this calls Proxy.result sooner than it would originally happen, but I simply do not see a better way around this. Suggestions are welcome!

Feb 9 10

bigblobae – store big data blobs on AppEngine

by jan

Few days ago an idea finally came to mind that made sense for the new (maybe not so new anymore) Cloud-Computing thingi. The idea was called image-resizer and feel free to check it out. I am still not quite sure if I will take it past the cloud-computing experiment phase, but it was still quite fun to develop. I have hit several issues with AppEngine along the way, most of which were related to sandbox/production environment differences. Not pretty, but easy to solve.

One particular AppEngine limitation is that you can only store one megabyte of data in any datastore entry. Basically any row in the database cannot be bigger and since the only storage you have is the database, you are kinda screwed (like this guy, who jumps first for most of related Google searches). This is particularly painful in case you want to store big files in the database.

You are screwed until you start thinking that is. The limitation is really not a limitation of the storage, more of the transfer layer, the storage can hold virtually any amount of data, so all you have to do is fragment it a little. And here comes Mr. Smartypants. I have created something called bigblobae (read big blobs for app engine). I am certain there are other maybe smarter implementation of this out there, but this is the way I like it, simple.

So if you want to store your large photos, pdfs or whatever in your AppEngine application, checkout the 0.1 release of bigblobae or you can just download the binary.

Oct 29 09

Develop JavaFX Mobile Apps on MacOS

by jan

Since I have also switched to Mac as my primary OS I have been really happy that the JavaME SDK team was already in process of making their emulators work on Mac. Now they are also available for everyone. If you are a Mac user and you are want to see your JavaFX apps running in the emulator go go and download (and there is bunch of other neat features too).

Aug 26 09

Developer Stack Update

by jan

I just wanted to say: “Thank you!” I was delighted when I got the numbers. What numbers? I just found out how many people downloaded the JavaFX Mobile for Windows Mobile Early Access I mentioned here. We are now counting thousands, people! Now, the Early Access version is far from perfect, we know that and we are working towards something much much better I think everyone is going to love. In the meantime please play with the EA version and let me know what you think about it (or talk to us on SDN). If you are new to all this thanks to Terrence you can watch this great screencast showing how to start working with the stack.

Jul 25 09

JavaFX Mobile 1.2 Developer Stack

by jan

Finally the number of developers able to run JavaFX apps on real devices can grow significantly. On this year’s JavaOne only few lucky developers got their hands on the JavaFX Mobile Developer Phone (HTC Diamond) with JavaFX pre-installed. This week we are releasing a binary that works on any Windows Mobile powered phone. The binary is available for download at javafx.com and although we tested it on HTC Diamond and LG Incite it will work to some extent on any Windows Mobile 6.x device. I think I do not need emphasize that this is a very important step for us. This Early Access of the Stack is tightly integrated with the rest of the SDK and enables direct deployment and testing of apps from out NetBeans with JavaFX tool suite. It also enables you to see how your apps will look like and behave on a real phone. The stack is far from perfect in some cases we already have code ready that will bring us massive performance improvements. Please go ahead and download this Early Access, try it on a phone or even the Windows Mobile emulator which is freely available from Microsoft.


Jun 12 09

JavaOne 2009 Wrap Up

by jan

So this year’s JavaOne is over. Too bad, and also very good. It was a run I can tell you. We have done so much amazing stuff for this year’s that it almost seems impossible.

Mobile was all over the Keynotes! Just wow, really. So much exposure. The JavaME SDK (official blog) guys are very humble believe me and now very famous, I think they are buying new servers to make all those downloads possible and fast. And for JavaFX Mobile? I am almost loosing words when trying to express everything we have done in the past year.

We sold the Early Access version of JavaFX Mobile Developer Phone. It’s an HTC Diamond and even though the runtime on that device is not so awesome performance-wise I think it is still awesome that many JavaFX developers now have a chance to see their apps running on a real phone.

In our session me and Juraj were showing slides written in JavaFX and running on a hacked version of the Emulator (thanks Lubo!). It was amazing. The Emulator is great. Maybe to good, when compared to the device, but we are working on that too, trust me.

We have been also showing our Hardware acceleration bit. We have OpenVG back-end for JavaFX Mobile runtime since MWC, but it was more of a prototype then, now it is a first class citizen of our graphics framework. The most amazing was the Hardware Acceelerated JavaFX Mobile on HTC Diamond. That’s kick-ass stuff. It was made possible by the AmanithVG library from Mazatech (thanks, guys, looking to work with you more). And there are other ways being explored in the OpenGL area too.

I was just about ready to drop dead before this J1, quite a lot of stuff on my shoulders. But now a week after I feel recharged and filled with positive energy. There is some very interesting shifting here in the JavaFX team and beleive we are moving to something awesome (as always). And after some of those J1 meetings with HW vendors especially there are some many new toys to play with and made amazing stuff on that, well, I am very much looking forward to our next run.

Now back to prioritizing those JIRA Issues. And yes, if you find a bug, report it!

May 2 09

A storm in the Rails cup

by jan

If you (like me) have not attended the GoGaRuCo you still probably have heard about the big controversy and discussion started there. I first did not plan to but now I decided to formalize my take on this. For anyone interested.

read more…

Apr 16 09

Java ME SDK 3.0 finally available

by jan

So finally after releasing the Early Access version last year the team finally reached a final release of the “JavaME SDK 3.0”:http://java.sun.com/javame/downloads/sdk30.jsp. JavaME SDK is the successor for both the Wireless Toolkit and the CDC Toolkit previously releassed by our team here at Sun and it brings much more to the table. Check out the “web page”::http://java.sun.com/javame/downloads/sdk30.jsp, the info is all there. More features are comming to you via the auto-update feature, so cool.

Also if you’re going to JavaOne this year do not miss the “JavaME 3.0 session”:http://www28.cplan.com/cc230/session_details.jsp?isid=304529&ilocation_id=230-1&ilanguage=english that Tomas is doing with our Sonny-Ericsson. I am sure those guys will be showing some neat features and also realy on-device debugging.

Mar 29 09

Come to see us at JavaOne this year!

by jan

This year’s JavaOne is going to be big again and I am proud to announce that my session was accepted (well I was part of the commitee, but still). Now it’s probably the best time to start browsing the content catalog so see what this year’s JavaOne is going to be about.

Make sure you do not miss Does Your Mobile Speak the JavaFX™ ? also known as  TS-4801 (had to hack the catalaog a little to get a direct link). Me and Juraj have some pretty amazing stuff planned for this session and I think it is going to be a hell of a show. We will be of course showing our latest experiments and progress with JavaFX on Mobile and beleive me there is stuff to look forward to.

My team from Prague will have even some very good BoF’s on JavaOne and I will bring those up as the conference is comming closer.

Mar 29 09


by jan

Now, this blog is new, but no so much. My personal blog in czech used to live on this very same address. Now that is moved to honzasterba.cz (see? dot cz!).

Now what can be expected here? Who knows. Release annoucements. Conference reports and maybe some background info around JavaFX and Sun in general. One thing is for sure, this blog is in English and I hope to make time for bragging about things here. Cheers!