Archive for the ‘java’ Category

Google App Engine for Java — First Impressions

Thursday, April 9th, 2009

Today’s big news is Google’s announcement for Java support on the App Engine. At Ringful, our hardware strategy is two words: cloud computing. We have multiple apps on both Amazon EC3/S3 and GAE.

EC2 is obviously more flexible since it provides a virtualized Linux environment, where you can do anything you want. GAE, on the other hand, feels much more restrictive since it is basically an app server in a scalable infrastructure. For instance, up until today, Python on Django is the only application model supported on GAE. However, as we use both services, I have grown to like GAE a lot more than EC2:

  • GAE provides automatic scaling that would just add in more resources based on the real time load of your app; EC2 requires you to actually monitor the load and bring up additional servers yourself.
  • GAE’s restrictive programming model also forces you to write apps that are horizontally scalable; With EC2, you could well write apps that cannot scale at all no matter how many server instances you start. In another word, with EC2, there could be well a false sense of scalability — until you really hit a traffic spike …
  • GAE is truly usage based — it only charges for CPU cycles that are actually used, as opposed to EC2 which charges CPU time as long as your virtual machine is up, even if it is idle. That makes GAE potentially a lot more cost effective for small apps.

So, in short, I am very excited that Java finally comes to GAE. I immediately applied for Java support in GAE accounts and wrote a couple of small apps to try it out. Overall, it feels great. I am definitely porting my Python apps to GAE Java as soon as I get around to do it. :) Here is a short summary of my first impression.

The good

* It is based on the standard JDK — not the mutilated Android Java stuff as once rumored.

* Standard servlet + JSP + JSTL stack for web apps. The same kind of setup Tomcat ships out of the box, and should be sufficient for a lot of apps.

* GWT integration if you want an advenced web framework to use with your app.

* JPA support for data persistence in Google’s BigTable.

* Standard WAR deployment. That allows developers to use any tool of their choice — ANT, Maven, Eclipse, NetBeans — as long as it can build standard WAR files.

* Most JVM languages, such as JRuby, Jython, Groovy, and Scala, are already working since the runtime is standard JDK-based.

* A lot of frameworks are already working — or can be made to work with some tweak.

* Cron and scheduler support out of the box. It is a lot better than EJB Timer.

* Direct integration with Google’s data APIs for user authentication, email sending, image manipulation and much more!

The bad

* Most of the Java EE stuff is not supported. Noticeably missing are RMI, JDNI, and JDBC. That means commonly used frameworks such as session beans and Hibernate are not supported. I have heard that JSF 1.2 does not work out of box. I do not expect Seam to work out of the box either. Bummer.

* The persistence store is not a SQL database. I understand that a non-relational data store is needed to support the kind of scalability Google needs. But, BigTable does not even provide full text search! This is Google we are talking about! The lack of SQL supports means that you probably need to re-write significant amount of code if you are porting an app to/from GAE.

* The lack of access to file system would break a lot frameworks that uses XML configuration files — think Struts! But I expect this can be fixed with tweaks in the frameworks.

* The lack of the ability to create and manage threads is probably not a big deal, since technically you should not create threads yourself in a Java EE container anyway. But still, it would be nice to create threads that processes data in the background.

* The HTTP session support in the Java runtime uses BigTable to store session data as opposed to in-memory cache. There got to be a performance for this … But I guess they have to do it this way. In a truly load balanced environment, replicating in-memory sessions is a very complicated task.

* What is the deal with JDO? They really should focus the effort on getting better JPA support. ;)

* No JMS support is a bummer.

The ugly

There is really none I can think of! Despite my numerous mis-givings, Google did a great job bringing Java into a scalable infrastructure and provide very low hosting options for the masses. I look forward to developing more apps on this platform!

Win a free book at JavaRanch

Tuesday, March 31st, 2009

Jacob and I are promoting our “Seam Framework” book at JavaRanch this week. Stop by and ask a question in the JBoss Forum to win a free copy of the book. :) See you there!

12,000 new users per day

Wednesday, February 18th, 2009

As iPhone developers, we all heard of success stories of people selling 10,000+ copies of their apps per day in the app store, making hundreds of thousands of dollars in mere weeks. I always wondered what it is like to have a truly popular application in the app store. Well, now I know. :)

Just a week after we released Hook Mobile’s Multimedia Messaging app, it’s download number has skyrocketed to 12,000+ / day, and it is still accelerating! At this rate, we will have one million users in a quarter. Those are not your average “web users” — they are people who downloaded the application to their phone, and confirmed their phone numbers with us!

Okay, the Multimedia Messaging app is free and we are not exactly making a load of money yet. And, as the reviews indicate, there are a fair amount of problems (partly because we never anticipated this amount of traffic to hit our servers and support staff in such short time!) But to me, this is an eye opener on what a successful iPhone application can do. A lot of lessons learned that can hopefully help us market other for-pay applications. :)

Onward!

“Seam Framework” Finally came out in Paperback (and spotted in China)

Saturday, February 7th, 2009

I just received a hard copy of my book “Seam Framework” from my publisher today. That means you should be able to get it from Amazon and Barnes and Noble very soon. :)

The book is the “second edition” of the original JBoss Seam book I wrote back in 2006, which was a JavaOne and Amazon best seller. But, it is much more than a “sequel” of the original book, my co-author Jacob Orshalick has made many major contributions to the book to address the latest and greatest features in Seam and WebBeans. Check it out!

The picture shows both the original “JBoss Seam” book and the “Seam Framework” book side by side — the photo on the cover of the original book was taken by Ju during our trip to the Death Valley in 2005.

Two books

In a related story, my friend Norman Richards (also a core developer on the Seam team) spotted the Chinese translation of the original Seam book while he was in vacation in China last month. Now, anyone in China wants to buy one and send to me? :)

Busy conference schedule next week

Sunday, October 12th, 2008

Next week is a busy week for me. I will be attending both the Texas Wireless Summit and InnoTech conferences. I am invited to participate in the Seed Stage Form at TWS and an iPhone panel at InnoTech. Ping me if you are in town for either events and would like to meet up!

To see more details on exactly what I will be talking about, please visit my new blog focusing on mobility and mobile / social mashup technonologies.

http://www.mobilitymashups.com/

I also plan to update this blog more often to discuss Java / Seam / server-side related topics. Stay tuned for both blogs! :)

Speaking in JSF One conference

Saturday, August 9th, 2008

I will be speaking in the JSF One conference in the Washington DC area next month. I will speak on the topics of Seam and iPhone web development with JSF. See y’all there!

TheServerSide (TSS) Java Symposium on your phone

Wednesday, March 19th, 2008

TheServerSide Java Symposium is one of the premium conferences in enterprise Java. No matter whether you are attending the conference or not (I certainly hope you do attend and come to my talk on Friday :)), you can now keep track of the latest happenings in the conference on your mobile phone.

For conference attendees, you will get instant access to

* the session schedule
* speaker’s blogs
* TSS front page stories / comments / tech articles
* community reactions
* Las Vegas local information (news and show schedules)
* and more …

All these on your iPhone / Blackberry / Windows Mobile / Nokia, without taking out your laptop and struggling with the often flaky hotel wiki. For those of you who do not attend but still want to keep track of the latest happenings, this is a great tool to keep yourself updated (and entertained) when you are at lunch or in public transit.

All access is free and no registration is required. Here is what you do. You can load the following URL directly on your mobile phone. It displays differently on different phones and automatically adapt to a format that is most suitable for your phone.

http://WebClip2Go.com/tssjs (Try web-based iPhone emulator, Safari and Firefox only)

Or, if you do not want type the long URL. Send a SMS text message tssjs to phone number 41411 and open the link in the returned text message. iPhone users: do not forget to bookmark the site on your home screen!

Picture 51.pngScreenshot0119.jpg

Finally, the entire application is written in the enterprise Java stack (JSF + Seam, no less). The underlying technology is WebClip2Go — a community effort sponsored by eZeeLabs to bring the regular web to all mobile phones. I will discuss it in detail in my presentation in TSSJS.

Please send me any comments you have about this conference guide. If you are a speaker and do not see your blog on my list, please contact me and I will get you added in time for the conference!

The iPhone SDK (and the $100m iFund) is out. Want application ideas / inspirations?

Thursday, March 6th, 2008

Apple announced the iPhone SDK today. I have to say that the demos are very impressive and the “app store” concept is very well thought of — it gets around the carrier and lets Apple become the “deck” for iPhone applications. I am sure that mobile developers would much rather work with Apple than with wireless carriers!

Now, with the $100m iFund bounty, I am sure every mobile developer is learning Object C as we speak and race to develop the coolest iPhone application now. But what kind of applications should you write? What kind of applications can best take advantage of the native SDK capabilities?

Picture 43.png

Some applications, for example our SXSW Mobile Companion: http://webclip2go.com/sxsw08, is quite sufficient as an iPhone rich web application — the additional hurdle of having to download the native app may not pay off.

Well, an obvious place to search for cool application ideas is the native application landscape for other smartphone devices! You can then adopt / optimize those applications for the iPhone! To see what people have done on the Nokia Symbian platform, and give yourself some inspiration on your big iPhone application, come to my SXSW book reading on this Sat for the Nokia Smartphone Hacks book!

For those who cannot attend, I will post the slides later this week …

Michael Yuan
=================
SXSW 08 Mobile Companion
http://webclip2go.com/sxsw08 (iphone simulator)

What is WebClip2Go?

Saturday, March 1st, 2008

WebClip2Go is a free service that let users “clip” content from live web sites and make that content available on mobile phones. In essence, it lets you browse content from the regular Internet on your phone. Checkout the web-based iphone simulator (Safari or Firefox) for a quick sneak peek. WebClip2Go is a community-based open source project sponsored by the eZeeLabs (more on this later).

Okay, I hear you say: “Many of today’s smartphones can already render HTML sites (see the iphone!), and there are online services (google, mowser, or even opera mini, skyfire) that transcode the regular web sites for mobile. How is WebClip2Go different?” Well there are actually several compelling differences:

First, most web pages are designed for wide PC screens. They have loads of headers, menus, sidebars, javascript / flash elements, and are partitioned into horizontal columns — just look at New York Times. They display poorly even on advanced devices like the iphone (require a lot of scrolling and zooming). Furthermore, when the page is “adapted for mobile” through mobile browsers or online services, the least relevant information on the page (e.g, the header and left sidebar) tends to occupy the first several screens of the mobile browser. WebClip2Go lets YOU, the user, choose the most relevant content on the page, and show it directly on the mobile.

Second, since the web clip is only a small part of the original page, it loads much faster on the mobile phone. That is especially true for pages with a lot graphics — parallel loading of images is very slow on mobile networks. A very nice side effect is that you also save a lot of mobile data bandwidth if you are paying per KB for access.

Third, WebClip2Go provides a very easy way to read RSS-based web sites (e.g., blogs and news sites). You can quickly drill down from headlines to the full description, the full article, and full comments. That is much better than any mobile RSS reader I have seen. ;)

Fourth, WebClip2Go works on a variety of mobile phones including the iphone, blackberry, Palm, windows mobile, Nokia Symbian, Linux-based phones. We are trying hard to make the site appear “native” on each of those platforms. Again, checkout our web-based iphone simulator on Safari or Firefox to see what we mean here.

Last but not least, WebClip2Go lets you manage your favorite web clips through a “fave list” and a tagging system. An example is how we bundled together resources for the SXSW 2008 conference. Just bookmark http://webclip2go.com/ and all your favorite sites / blogs will be right at your finger tip!

Still interested? Here are some quick FAQs.

Q: Can I sign up and create my own web clips now?

Yes, of course! However, keep in mind that a big objective of this project is provide easy visual tools to help users clip web sites. Those tools are not in place yet. So, you will have to brave the rather technical web interface. It typically takes an hour for a technical person to master web clip transformation. I know this is a lot of time and effort. But I think you will find it both fun and challenging once you get it going! You can start by reading those two tutorials.

Q: What about the outgoing links in web clips?

So, you created a web clip, but what about the links in the clipped text? In WebClip2Go, you can create further clips to handle those outgoing links so that the linked pages are “clipped” as well. Please see the RSS tutorial for more. Or, you can simple use a standard mobile transcoder, such as Google and Mowser, to transcode outgoing links. Mowser is the default transcoder we use.

Q: Is WebClip2Go an open source project?

Yes, it is. The project is sponsored by eZeeLabs, and the code will most likely be licensed as GPL to the public. I think a project like this can only be successful as an open source project. Why? Well, first of all, mobile content adaption is an unsolved problem. A lot of the stuff we do at WebClip2Go are highly experimental. We can only hope to find the “right way” with a lot of open discussions / trial and errors from the community. Second, there are just too many smartphones out there for us to write view templates for them. Our iphone template works well but it also required a lot of work / time to develop. An open source contributor can really help out here by developing a kick-ass view template for his/her favorite phones! So, if you have any ideas you’d like to contribute, please contact me and we will work out how to work together!

Q: Does WebClip2Go require registration to use?

Not really. Many features in WebClip2Go are available to any un-registered user. You need registration to add your own web clips or to build a “fave list” for yourself. Even if you do not wish to register, I would still appreciate it if you can email me your comments / suggestions / requests on how to improve the service. :)

Q: Where did you get this “web clip” idea?

Well, “web clip” is a well known concept used by Google and Apple. My idea is to make “web clips” available on the mobile phone — hence the WebClip2Go name. The technology is rooted in the Mozilla Joey project, which I have been a key contributors to for quite sometime. Joey pioneers the idea of creating “microsummary” from web sites and sent it to your own mobile phone. WebClip2Go takes one step further and allows any user to create web clips for any site and shares it with the world.

A Mobile Companion for SXSW 2008

Tuesday, February 26th, 2008

If you are among the 6000+ technologists / entrepreneurs / designers attending this year’s SXSW conference (or are just interested in following what’s going on in the conference), check this out: The SXSW 2008 Mobile Companion (http://webclip2go.com/sxsw08) is a free mobile web application that lets you access everything about the South by Southwest conference right there on your mobile phone. Try it in a web-based iphone simulator (Safari and Firefox only). It works on iphone, Blackberry, Palm, Windows Mobile, Nokia, and just about any smartphone out there. The way it works is that it takes live content about the conferences from all over the web, and make the content suitable for display on small mobile phone browsers. Through the companion, you can check:

* Panel / presentation schedules by day
* Session abstracts
* Film / music performance schedules by day
* Official and unofficial conference news, blogs and wikis
* Blogs of conference speakers (full posts w/ comments)
* SXSW parties!
* Austin local news
* Music and film listings by venue in the Austin area
* and much more …

All you need is to load the following URL in your mobile phone browser. Or, if you do not want to type the URL, simply text the word sxsw08 to phone number 41411 to get a link returned in an SMS message (the SMS works in the US only!).

http://webclip2go.com/sxsw08 (Try web-based iphone simulator in your Safari or Firefox browser)

Picture 41.pngScreenshot0114.jpg

Why did I create it? Well, as a veteran technology conference speaker / attendee, I can tell you that conference WIFI is flaky at best in most big conferences. In fact, WIFI was the #1 problem in SXSW 2007. It is quite frustrating to take out your 8 lbs laptop just to find out that the WIFI is down or has no coverage in the Hall. Well, with the mobile companion, you can check out just about anything about the conference / speakers in real time on your phone. I personally would use it a lot. And I encourage you to try it out if you have an iphone / blackberry or other connected device. I plan to do the same for most other conferences I attend this year as well. :)

The technology behind the SXSW Mobile Companion is WebClip2Go. The goal was to let people clip live content from any existing web site / blog, so that those content can be viewed from mobile phones. It has become a hit among my friends — especially those with iphones, since the web content loads much faster and requires simpler navigation in WebClip2Go, compared with directly loading the original web site in iphone. Much still needs to be done to make WebClip2Go ready for the general Internet audience (e.g., we need a Firefox plugin that lets people “clip” web content via drag and drop). In any case, I will blog about WebClip2Go in a separate blog entry later this week. Stay tuned!

BTW, for my Seam readers, it might be comforting to know that the application is built on top of JBoss Seam technology.

Seam conversations made easy

Friday, February 15th, 2008

One of the most interesting concepts in Seam is “conversation” — it allows your web application to have separate internal states for each browser tab, or for each logical multi-page web operation. Conversations can even be nested to manage multi-level wizards. Conversations let you break away from the monolithic session-based web application state management. However, while the concept is easy to grasp, conversations are not as widely understood as sessions. Many web developers are intimidated by the powerful conversation management APIs in Seam.

Well, no more! Jacob Orshalick just released three draft chapters from our 2nd edition of the JBoss Seam book. Those chapters provide very good explanations on conversations should be used in Seam applications. Thanks Jacob! Go check them out!

2.5 Sessions Accepted in JavaOne 2008

Monday, February 4th, 2008

Cool! Out of 4 sessions I submitted to JavaOne 2008, 2.5 are accepted! Given that JavaOne accepts less than 5% of all session proposals, this sounds like pretty good success rate. :) So, what exactly will I talk about in JavaOne?

First off, I will be giving a technical session on Building Interactive Mobile Messaging Applications. I will discuss how to build a SMS service like the Google SMS on a Java EE server. I think the information presented in the session will be useful for a large number of developers — for instance, for web application developers, it is often nice to have a “send to phone” button on your pages to send small pieces of information (e.g., alerts / reminders / links) to the user’s mobile phone. In the session, you will also learn how to make your application respond to requests from SMS (e.g., the user sends in a SMS to reschedule an appointment etc.). The session covers technologies used in such a solution, common design patterns / pitfalls, and third party players involved.

I will also run a BoF session on JBoss Seam: The Deep Integration Framework for Web Applications. I will try to dispel the notion that Seam is somehow a mere “web framework”. Yes, Seam is used in many web applications, but you can just use PHP or Ruby for a simple web site. The real value of Seam is to bring real Java enterprise infrastructure (e.g., business process engine, rules engine, asynchronous messaging infrastructure, advanced transaction services, scheduling service etc.) to the web application. That saves you from hard coding business workflow or rolling your own middleware frameworks in the web application. Come to the session and join the discussion!

Finally, they accepted my proposal on Developing Compelling Mobile Web Applications as a backup session — that is the 0.5 session here. :) This session covers mobile browser detection, multi-template based web site design, and special UI tricks for the iphone. From what I was told, there is a pretty good chance for backup sessions to be presented in the conference since some session presenters drop out at last minute for various reasons. We will see.

Hope to see y’all in JavaOne again this year!

Austin TX is the #3 best city for jobs in America

Sunday, January 13th, 2008

Forbes.com ranked Austin TX the #3 best city for jobs in America for 2008. Of course, we all know that. It is kinda a tough for tech employers though — we have been trying to fill several Java / web positions for months. Almost every developer I know in town is gainfully employed.

Picture 27.png

In fact, according to the article, Texas in general is the best place to look for a job in 2008:

The Lone Star State shines brilliantly in a list of the best places to work in the U.S. when some economists peer into their crystal balls for 2008.

Austin, Fort Worth, Houston and San Antonio all rank high on the latest forecast data from Moody’s Economy.com. McAllen, Texas, is expected to have the highest job growth rate, as its leisure and hospitality, educational and health services and commercial construction jobs flourish.

Here is the detailed statistics for Austin. I noticed that Austin’s ranking is probably dragged down by its lower median income — that is very misleading since we have one of the nation’s largest public universities in town, and the students make very little income while they are still counted in the median. For people in the software field, Austin probably pays 10% less than San Francisco in raw salary but the cost of living is much much lower.

Picture 26.png

Let your readers subscribe to your RSS via SMS

Wednesday, January 9th, 2008

As a blog reader, one thing I’d love to do is to subscribe to my favorite blogs via SMS. And by “subscribing”, I do not mean simply getting an SMS alert telling me to “check it out on your PC”. I want the full post to be delivered to my phone — so that I can read it while I am driving (kidding!).

Well, thanks to the good folks at textmarks and mowser, I just did exactly that for my own wordpress blog (See how it works). As promised, I am releasing my little wordpress plugin here. Here is what you need to do to mobilize your blog:

1. Sign up for a free keyword at textmarks. This is the keyword people will text in to subscribe to your blog.

2. Request for a free API key from textmarks. This key is needed to broadcast SMS messages.

3. Get my plugin here, unzip it and drop the textmarks_alerts.php file in your wp-content/plugins directory, and then activate the plugin from your wordpress admin console.

4. Go to the Options –> Textmarks Options tab, and fill in your account and keyword information from textmarks. You will also need to fill in the root URL of your wordpress blog. You can choose to use Google or Moswer to adapt your blog pages for mobile screen viewing. Choose “none” if you already have Andy Moore’s wordpress mobile plugin installed. See more explanation on the plugin options page.

Picture 24.png

That’s it folks! Your readers can simply subscribe your blog by texting in your keyword to short number 41411. The subscribers will get a mobile web link for every new post from now on!

Okay, if all those sound too complicated but you still want to use the plugin. Send me $100 and I will take care of everything for ya. ;)

cheers
Michael

PS. The scripts uses Binny V A’s free PHP load() function (from bin-co.com) to make make network connections. It is gets around the sometimes blocked file_get_content() call. Thanks Binny!

Develop compelling iphone applications with JSF + Facelets + Seam

Tuesday, January 8th, 2008

I recently had the pleasure to write an iphone application using JSF + Facelets + Seam. It is mostly a smooth experience but there are also some gotchas I'd like to share with the Seam community.

Okay, first things first, what is an "iphone application", you ask? The iphone SDK has not been released yet! Well, I am referring to a web application that simulates iphone's native look-and-feel via JavaScript and special Safari markups. In particular, I am using the iui library. It works great on an iphone (or even in a desktop browser -- try the official iui demo here)!

So, what are the issues using the iui library with JSF + Facelets + Seam?

The first and biggest issue is that iui and Safari expects the page to be in text/html while Facelets + Seam renders text/xhtml. For some obscure reason (a bug in Safari as Firefox does not display the same issue), this really messes up the navigation. To fix that, you can put the page content inside a pair of <f:view> tags to set the content type properly. Your page will look something like this:

XML:
  1. <html xmlns="http://www.w3.org/1999/xhtml"
  2.       xmlns:s="http://jboss.com/products/seam/taglib"
  3.       xmlns:h="http://java.sun.com/jsf/html"
  4.       xmlns:f="http://java.sun.com/jsf/core"
  5.       xmlns:ui="http://java.sun.com/jsf/facelets">
  6. <f:view contentType="text/html">
  7.    
  8.     <head>
  9.         <title>Your Title</title>
  10.         <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
  11.         <link href="iui/iui.css" rel="stylesheet" type="text/css"/>
  12.         <script type="application/x-javascript" src="iui/iui.js"></script>
  13.     </head>
  14.  
  15.     <body>
  16.         <!-- ul and div elements as required by iui -->
  17.     </body>
  18.  
  19. </f:view>
  20. </html>

Notice that the viewport meta data is very useful in iphone development. By default, iphone displays the "thumbnail view" of most web pages when the page is loaded. The words on the page are unreadable in the thumbnail mode. The user is expected to zoom in to read via finger gestures. That works for most large web pages designed for deskto browsers. But you do not want this if your site is optimized for the iphone -- you want the site to display as it is from start up. The viewport element allows you to specify the zooming behavior for this page.

The second issue is that when iui loads pages, it tries to load page fragments via Ajax to provide nice page transition visual effects, as well as nice navigation buttons. To do that some of your dynamic web pages must be provided without the <html> or <body> tags. The facelets <ui:composition> is ideal for this. Here is how one of my pages look like

XML:
  1. <ui:composition xmlns="http://www.w3.org/1999/xhtml"
  2.                 xmlns:ui="http://java.sun.com/jsf/facelets"
  3.                 xmlns:h="http://java.sun.com/jsf/html"
  4.                 xmlns:f="http://java.sun.com/jsf/core"
  5.                 xmlns:s="http://jboss.com/products/seam/taglib">
  6.    
  7.     <ul id="#{siteSearchAction.tag}" title="#{siteSearchAction.tag}">
  8.         <ui:repeat value="#{siteSearchAction.sitesByTag}" var="site">
  9.             <li><a href="view.html?siteId=#{site.id}" target="_self">#{site.name}</a></li>
  10.         </ui:repeat>
  11.     </ul>
  12.  
  13. </ui:composition>

When the user clicks a link to this page, the dynamically generated <ul> list will be rendered according to iui stylesheet, with all the bells and whistles of the "wait" animation and "sliding door" page transition in effect.

Anyway, aside from those two issues, developing for the iphone is really a breeze. What is the application I am writing? Well, you will know in a few days! Subscribe to this blog via SMS! :)