OCTOBER 11TH, 2011
By ADMIN
So, as explained in my previous post I did install Dart on my Machine. And of course I was curios to run one of the examples of the dartlang.org website. To do so, is actually quite simple:
cd ~/workspace/dart/dart/client
python ./tools/htmlconverter.py \
> samples/slider/slider_sample.html -o out/
This compiles the slider example to the out folder. To run, you call your Google Chrome Browser with the newly created html file. Make sure Chrome is not currently running as this will create a conflict accessing the profile
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
> out/client/samples/slider/slider_sample-js.html
This opens Chrome with the sample application running. For those who just want to try out some basic, I do recommend the Tutorials and the Try-Dart Interactive Shell on Google Apps
OCTOBER 10TH, 2011
By ADMIN
So, today it finally became available for the public. And since it sounds really promising, I thought it might be good to get it going right away. Oh, btw, in my opinion the possibility to switch from a quick-and-dirty approach with dynamically typed variables at the beginning for prototyping to statically typed variables as the project evolves sounds just right. No need to decide upfront whether to go for the big-overhead-framework or the simplest possible approach as this simply develops as needed by adding libraries or adding domain specific features. Sounds great, let’s see if they can get some grip soon. For those interested in finding out more, read the introduction to Dart.
On their pages they do also explain how to get Dart up and running, I will follow those instructions and will summarize the steps necessary:
- Install XCode >= 3.2 (I assume you have this already, if not, install it from your MacOS X installation DVD)
- Install the depot_tools and add them to your path:
cd ~/workspace/dart
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
export PATH="$PATH":`~/workspace/dart/depot_tools
- checkout the Dart sources (this may take a while depending on your connection):
gclient config http://dart.googlecode.com/svn/trunk/deps/all.deps
gclient sync
- at the end of the sync I get a message that DumpRenderTree could not be downloaded and I need to execute another command. So I do:
third_party/gsutil/20110627/gsutil config
- This tool prompts for a lot of setup and configuration, such as setting up your Google Account for use with Dart. I won’t repeat all the steps here as they may not be applicable to you. But you will need a Google Account and the Cloud Storage activated.
- Ok, building Dart now:
./tools/build.py --arch=ia32
- That is just what I want to see:
=== BUILD AGGREGATE TARGET All OF PROJECT dart WITH CONFIGURATION Debug_ia32 ===
Check dependencies
** BUILD SUCCEEDED **
- Now I’m running the tests to check whether all is fine:
./tools/test.py --arch=ia32,dartc,chromium
- This did not go through completely and it seems DumpRenderTree has not been installed properly. I got to check this out, but hope you’ve been more successful so far. I will be back. Nevertheless I can run the other tests separately:
./tools/test.py --arch=ia32,dartc

FEBRUARY 28TH, 2011
By ADMIN
Deploying applications is not my favorite task. I don’t do it often and every time I’m not really sure what the bloody command was. So, here I go, taking down notes on what I need to do to get my application up and running from scratch.
First off, I decided to use a Turnkey Linux Tomcat on Apache appliance as it contains all I need and provides some nifty and easy to use tools. Not to forget, it’s the minimal configuration and configured to check for updates automatically to keep security risks to a minimum. But the main point for Turnkey Linux is the ability to deploy their appliances onto Amazons Web Services. Sweet, that will allow me to familiarize with just one installation and simply follow these steps on an EC2 instance. It even gives me the ability to backup and restore from local to cloud instances.
The specific steps involved to get it working locally:
- Download from http://www.turnkeylinux.org/tomcat-apache. In my case it came as version 11.1
- Unzip and run using VMWare Player or Workstation (or use one of the other formats)
- Follow the initial steps to set passwords for the different accounts used
- Call up the manager at https://[SERVERIP]/manager
- Deploy a WAR file (created for example by using “mvn package”) using the “WAR file to deploy” Form. A new application will be created from that WAR and deployed automatically
- The one and only tricky part was the mapping configuration. Since Apache is running in front of Tomcat, it will answer all incoming requests. To have it forward these requests to your application, the Apache-Tomcat-Connector has to know about that. Edit the configuration as follows:On your console (of the VM): nano /etc/tomcat6/mod_jk.confAdd the following to lines to the configuration:
JkMount /yourapplication ajp13_worker
JkMount /yourapplication/* ajp13_worker
Note: Yourapplication is the path your application is listed under in the Tomcat Manager.
Save and close the file with CTL-X and answering YES to the question whether to save the changes
- Restart apache with /etc/init.d/apache2 restart
- Voila, that’s it, you can find your application running now under https://[SERVERIP]/yourapplication

FEBRUARY 24TH, 2011
By ADMIN
I really like that sight when calling up the Apple Store to buy a MacBook Pro as it says
We are busy updating the store for you and will be back shortly.
Why is that so great, another Fanboy waiting to get his toy? Nope, not in my case, but still were looking at getting at least one Mac to be able to build iOS software. Unlike other products you have to have MacOS to be able to to do so. Second point my beloved Dell XPS M1330 is now getting a little to slow for all my work, so instead of investing money into upgrading it I decided to get a new one. Boys and their toys. Was about time…
So, soon I’ll be able to compare current Mac and OS X to my previous experiences with Windows (from NT till 7), Ubuntu, Debian and earlier versions of OS X. Maybe it’s interesting enough to post here about experiences from a relative neutral point of view.
Anyway, I’m looking forward to having a new toy at hands soon. By the looks of it, just a couple of minutes away.
FEBRUARY 7TH, 2011
By ADMIN
Partly learning from past experiences, but mainly because of future requirements regarding mobile development, I am looking to create a Tapestry5 project setup that uses jQuery instead of Prototype and can output HTML5.
Make Tapestry5 accept HTML5 Doctype
Tapestry5 uses a Parser to validate the correctness of documents. They have to be proper XML and contain a DTD. This is great, as it makes us to write proper web documents. The issue with HTML5 is that it does not contain a DTD. HTML5 is kind of a step back and two steps forward. It’s less strict than XHTML (like HTML4) but adds loads of useful stuff from the “real world” by maintaining backwards compatibility. For a short but very good introduction I recommend Jeremy Keith “HTML5 for Web Designers”.
To be able to use HTML5 with Tapestry5 there is a workaround documented in Tapestrys issue database as “Allow HTML5 doctype to be printed“. It includes a little patch that is applied to the org.apache.tapestry5.dom.DTD class. I did create a copy of that class in my project, applied the patch and am running happily HTML5 since then. All I need to do is to keep an eye on updates on that class to not miss any, possibly crucial, changes.
Replacing Prototype with jQuery
By default Tapestry 5 ships with the Prototype/Scriptaculous JS Stack. Though there is no issue with that, jQuery simply seems to be the thing right now, with a much more lively development and broad acceptance among users. All that aside, specifically the
jQuery Mobile Framework has caught my attention. It is optimized for touchbased Smartphones such as the iPhone, Android, Windows 7 and more. Since it is Browser based, you will be able to ship a product for all those phones without too much of customization involved. Simply use your good old and proven Web development knowledge.
So, back to Tapestry5. There has been a clever enhancement that replaces prototype completely with jQuery. Most of the components do work out of the box, for more details read the got5 tapestry5-jquery project page. Follow the instructions on that page for including their dependency into your pom.xml (I did replace version 1.0.0-SNAPSHOT with version 1.1.0-SNAPSHOT) And that’s it!
FEBRUARY 6TH, 2011
By ADMIN
After 6 month I finally am in the process of finishing off the last edges around my first Tapestry5 project: “match-patch.de – Singles mit Familiensinn” is a german dating portal for singles with a sense for family values. Something other portals are not taking utterly serious. It’s a great and lovely concept, visualizing itself in a “spot on” design. But that’s enough for introduction, I’d rather talk about some of my thoughts about the Tapestry Framework.
Ease of development
First of all, working with Tapestry is a treat. If you don’t know Tapestry at all, have a look at their Apache project homepage. Tapestry makes large use of annotations, brings its own Inversion of Control Framework and is developed to be as developer friendly as possible. Mission accomplished! I do love working with Tapestry, with a good introduction from the plenty of sources it is all pretty straight forward and your first prototype out in a blink of the eye. If you are lucky enough to have good grasp of the German language you already can read Igor Dobriazkos book “Tapestry 5″. Good news, it will be translated into English and published as “Tapestry 5 in Action” hopefully soon. It is a great starting point and if you keep on reading Igors Tapestry5 Blog you will be up2date with all the latest and niftiest developments.
To make things easier there is a whole lot of plugins available to deliver solutions for many of the most common needs in web development. That for example are the ones I used in that project:
- tapstry-hibernate & tapestry-hibernate-core: Provides integration of Tapestry with Hibernate
- chenillekit-hibernate: Abstract DAO that makes DAO Development an ease
- chenillekit-quartz: Integrates the Quartz scheduling Framework
- chenillekit-tapestry: Some nice components based on Prototype (Tapestrys native JS Stack)
- tapestry-spring-security: brings the mature Spring Security Framework to your application
- tapestry-upload: Extension to ease upload of files
- t5-easy-fckeditor: The great FCKEditor to mimic Word-like content generation.
As you can see, those are many areas already covered with enhancements that made it easy to add functionally to the site. Some of the projects used are nonetheless not maintained that regularly nowadays, so for upcoming Projects based on Tapestry 5.2 I recommend to check the compatibility.
Exception from the rule: Problems
The most struggle with the project I had when I switched the MySQL database from MyISAM Tables to InnoDB as I had to reconfigure the relationships between the entities. This is a homemade issue since I should have used InnoDB right from the start. But on the bright side, this has lead to a steep learning curve as I had to dig deeper into the whole issue around relationship modelling with JPA and Hibernate. Familiarizing myself with Hibernate annotations I do consider worth the effort already as it is vital to any project.
Other little issues arose around the use of Javascript and specifically related to the use of nested Zones and the client ids automatically provided by Tapestry. These ids often have a suffix that is added to make them unique. But then I could not reference them out of my own functions anymore. So what did help was not just using the “t:id” parameter but also adding the “id” with the same value to the Zone and it’s referencing components, e.g. forms and links.
Conclusion
Having worked with the PHP Symfony Framework and Java Wicket before, I still prefer Tapestry5 to both of them. The whole package of annotation based development with Dependency Injection from Tapestry IOC just feels good. Whenever architectural constraints won’t keep me from using it, my choice will be T5. That next project is actually started already, so keep watching for new posts around the improvements going into that from past experiences.
JANUARY 5TH, 2011
By ADMIN
Jeesh, is it ever going to be easy? Of course not. But easier once you have chosen a path to walk since both, Googles AppEngine and Amazons Web Services, are great improvement in terms of scalability. And while I thought, GAE/J is just right for my new project, lately I have my doubts. While I love the idea of not having to cater for server setup and maintenance tasks, my last project provided me with some very real advantages:
- I can use whatever Framework or enhancement I like, e.g. Tapestry, Lucene or my favorite Database (SQL or NoSQL – choose what suits you best)
- Hibernate actually is really nifty, I learned a lot about that Criteria API lately and it’s close to perfect for many scenarios
- Server downtime is basically in our hands, or at least we can schedule controlled downtimes and create backup procedures to recover easily from desaster
- There is just tons of information out in the web and in booskshelfs on how to best do things, be it unit testing, integration testing, continouus build or questions regarding previously mentioned frameworks and tools.
For GAE there are a lot of question marks. How do I solve all the problems my beloved Frameworks did solve for me lately? Why have there been so many unscheduled downtimes? If you follow the GAE Blog, this can become quite scary. And then there came this very enlighting blog post from an entrepreneur who had chosen GAE and his retrospective on why it failed him.
So, here I am, with a feeling that there are more questions than before and no definitive answer in sight. But with regards to my initial question, no there is no “perfect” way for any given situation, I will just have to dig into the possibilities, determine the best way to proceed and then cope with it. And maybe it’s going to be the Amazon Suite of Web Services. I attended a talk with Amazons CTO Dr. Werner Vogels and that has been quite interesting. They seem to really care about their product line up and building it to continue to be a great product. It’s an important part of Amazons business strategy and therefore has a high priority. I do like that. Cloud sounds great and even if I have to still setup servers, or in this case, appliances, it still allows great flexibility and scalibility.
Sorry if I could not give a definite answer, but this is my current two cents. Stay tuned, there may be more to come.
JANUARY 3RD, 2011
By ADMIN
In my current project – based on Tapestry 5, Hibernate, MySQL – I am integrating the Paypal NVP API to allow the user to upgrade his account. Some of the pages are secured by Tapestry-Spring-Security (TSS) to be usable for premium users only (“ROLE_PREMIUM”). Whereas normal users have the user role (“ROLE_USER”) only. After the user paid, he gets the new authority granted and persisted. So far so good, but for the current session he won’t be able to see all the nice new features, as his credentials are cached in the Session. So I was looking for a solution to update the associated authorities without having the user to logout and login.
Basically found the solution in this post for a Grails based project updating the logged in user in Spring Security. This lead to the following piece of Java code to update the user:
// create new array with the current authorities of the user plus the "ROLE_PREMIUM"UsernamePasswordAuthenticationToken
GrantedAuthority[] grantedAuthorities = (GrantedAuthority[]) ArrayUtils.add(user.getAuthorities(), roleService.findByAuthority("ROLE_PREMIUM"));
// create a new authentication token
authToken = new UsernamePasswordAuthenticationToken(user, "", grantedAuthorities);
// and set the authentication of the current Session context
SecurityContextHolder.getContext().setAuthentication(authToken);
Implementing security is a pretty serious topic and different approaches do exist for Tapestry. So I started reading different articles about it and finally came to the conclusion to go along with Spring-Security implementation for Tapestry.
For those interested, here is a list of articles and plugins regarding that topic:
Securing Tapestry pages with Annotations, Part 1
Chenillekit Access
Securing Tapestry 5 pages with Spring Security 2.x (Part I)
and a couple of articles in the Tapestry5 HowTos
And even though, that all has been a great help, I did ran – probably as usual for a Framework newbie – into some problems. Most of them could be solved with the help of Google, but one got me big time and took a split second longer to get solved: Even though I had annotated a page with @Secured(role=”ROLE_USER”) the page showed up for everyone. Nothing helped and so I kept fuddling around with my code and configuration, up to that moment as I figured out it was because I had integrade tapestry-spring-security 2.0 and not the current 2.1. As soon as I had updated my Maven dependencies everything worked as expected.
This one is pretty obvious if you start from the start page of the tapestry-spring-security plugin as it is clearly stated there, but unfortunately I was following along the “Configuration” documentation and that hasn’t been updated to the latest version of its own plugin. So just be aware of that and you should be fine.
APRIL 19TH, 2010
By ADMIN
This is rather simple task and well documented is the part on doing the call. Though in my case the response is a XML and I want it as a DOMDocument to do my thing. And here is the short snippet for a method that does the call and populates the DOMDocument:
private Document domDocument;
private void doCall(String serviceUrl){
try {
URL url = new URL(serviceUrl);
try {
DocumentBuilder parser = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder();
domDocument = parser.parse(new InputSource(new InputStreamReader(url.openStream(),"UTF-8")));
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e) {
System.out.println(e);
//TODO do something about exceptions
} catch (IOException e) {
System.out.println(e);
}
}
I use this private method in some other methods of my service to do the different calls to a service (search, look for a specific item etc.). After the call I do work on the populated domDocument and create the objects. What’s missing yet is some generic error checking built into the doCall method. But that’s something I do later on.