Monday, October 1, 2012

Cloud Foundry VMC-ng Has Helpful Client Logging

I noticed on the twittersphere that Brian McClain and Mark Lucovsky had a small exchange about the latest tips and tricks for developing Cloud Foundry API clients. Brian has written a Cloud Foundry Chaos Monkey. The important thing to note is the latest cfoundry gem maintained by Alex Suraci on the Cloud Foundry frameworks team has excellent client logging support of Cloud Controller calls. The cfoundry gem is simply a nice ruby wrapper around the Cloud Controller REST API. You can see these calls in action by using the latest pre-release version of vmc (which also is a gem), which we call vmc-ng where the ng is for next generation. The latest vmc builds upon the latest cfoundry gem.

A few things to note about using vmc-ng:
1) You should install it with gem install vmc --pre where the --pre gives you the ng bits. Note that this is preview code and not fully baked yet.
2) vmc-ng functionality is not enabled by default, you need to create a file or directory in your ~/.vmc directory called use-ng. If you do not have this, vmc will fall back to use the standard version without the new client logging capabilities
3) In order to switch back to the old vmc, simple remove the ~/.vmc/use-ng file or directory.
4) The syntax of some of the commands has changed, so make liberal use of the help. One of my favorites is the updated line view of applications vmc apps -l and you can see an example of that below. Another great switch is -t that turns on tracing and shows all of the HTTP request/response in standard out.
5) When using vmc-ng, the Cloud Controller HTTP calls are logged in the ~/.vmc/logs/ file, where is the target.

Check out the gist for a full example using vmc-ng and illustrating the new client logging feature.

Saturday, May 12, 2012

Great Mobile Demos - Using AirPlay to Demo iPhone and iPad Apps

I currently work on Cloud Foundry and vFabric products at VMware, and our customers are often building and hosting mobile applications with our products. Demoing these can be a crappy end-user experience for the person seeing the demo as screenshots and emulators don't give the exact mobile experience.

AirServerA friend of mine, Jeremiah Stone at SAP, recently showed me an awesome product called AirServer. AirServer is $15 and lets you turn your Mac/PC into an AirPlay receiver. This means that using new Apple products like an iPhone 4S or an iPad 3, you can exactly mirror the video/audio of the device to your computer, which can of course be projected to another audience. The projection is smooth enough that you can mirror the iPhone 4S camera display too which is like having a mobile video capture device live feed.

The best way of explaining it is that AppleTV let's you do this with an iPhone/iPad:

Using an app like AirServer, you can also point it at your laptop instead of AppleTV.

Imagine how much better the end-user experience of someone attending a web conference, conference room presentation, or even an auditorium can see your demo when it's exactly the user experience that a real iPhone and iPad application have instead of an approximation of it.

Here's a quick recording of what it's like. Fast forward to 1 minute 30 seconds if you just want to see the punchline.

A few notes, make sure you note the "double-click" and swipe left twice to get the AirPlay menu on your iOS device. I did not even know that menu was there previously.

Also note that some wireless networks may block the video projection. I could not get the display mirroring to function on the wireless network at work. I've heard that using an Ad-Hoc network or a Hotspot network should work in situations like that, so I'll need to play with that still. If you have trouble using it at first, make sure you're not on a wireless network that might be locked down.

Now go build an amazing mobile application on Cloud Foundry that I can demo!

Update: The Ad-Hoc network setup is super simple, I recorded that too. Just create a new Ad-Hoc network on you machine, connect to that network with your phone (no IP setup needed) and you're good to go.

Monday, March 26, 2012

Fixing Twitter Bootstrap and Eclipse Javascript Errors

I've been meaning to play with Twitter Bootstrap and some of it's other associated projects like Font Awesome lately and decided to see if I could integrate into a sample application I'm building.  I'm using an SpringSource Tool Suite 2.9.1 which is based on Eclipse 3.7.2.  When using a Dynamic Web project type and bringing in the assets directory from the Bootstrap download into my WebContent directory, I kept getting JavaScript errors, lots of them.

I realized that it was simply complaining about a single prettify minimized js file that went away if I got the unminimized version.  But I'm stubborn so I refused to let Eclipse win with this work-around...

At first I thought it was related to the Validator or a Builder.  But then I noticed that there was a JavaScript reference to a runtime and I checked the Facets.  Sure enough there is a JavaScript facet that you can unlock and then uncheck.

Since I am not using that capability now, removing that Facet seemed to do the trick once I applied and executed a Project -> Clean, but at least on one occasion I actually had to rename/replace the javascript file that was causing problems to be marked as directed to in this Stack Overflow thread.  Once that was out of the way I now had a nice Bootstrap example ready to customize.  I simply copied one of the html files like starter-template.html or hero.html over from the Bootstrap examples directory and fixed the asset references with a replace-all.  If you have a better approach to get Bootstrap and Eclipse to play nicely, I'd love to hear about it.

Sunday, March 25, 2012

Mirco Cloud Foundry - Set the Local Timezone

Would you like your Mirco Cloud Foundry to use a local timezone instead of UTC? Hopefully this propagates to the default timestamp display of whatever programming language you are using.  I wanted this for a Java application I've been playing around with.  Here are the simple steps I used.

1) Log in to Micro Cloud Foundry using the IP Address displayed on the console as root using the password you supplied when setting up MCF.
ssh [email protected]
2) Run the dpkg-reconfigure command to select your timezone
[email protected]:~# dpkg-reconfigure tzdata
You should get an ASCII-GUI that let's you select the timezone.

When finished you should see output like this:
Current default time zone: 'America/Los_Angeles'
Local time is now:      Sun Mar 25 13:01:18 PDT 2012.
Universal Time is now:  Sun Mar 25 20:01:18 UTC 2012. 
[email protected]:~# date
Sun Mar 25 13:01:30 PDT 2012
3) Restart your applications.

Once I restarted the Java application, this time it picked up the local timezone as the default
output for a
instead of the UTC timezone.

Friday, March 23, 2012

Arun Gupta Java EE 6 and Spring Response

Disclaimer - I am a VMware employee and former WebLogic Server Product Manager at Oracle.  I know Arun personally and he is my friend.  The views expressed below are mine own and do not necessarily represent the views of my employer.  I tried to post this comment on Arun's blog but it was marked as spam.


I'm really surprised to see you trolling Spring like this.  I realize that in your job as a Java EE evangelist that you want to advocate for products and frameworks that you are paid to advocate for, but I don't see the point in misrepresenting many of the attributes that people like about the Spring Framework.  I find it hard to believe that you actually believe your blog is a balanced and objective analysis.  I must say that I never hear the question why should I use Java EE 6 versus Spring and I think it's mostly a contrived question.  Evans Data surveys indicate that about 2/3 of Java developers are using or will use Spring  I guess if you're paid to travel around the world telling people not to use the most popular Java framework that you need to come up with reasons.  From what I can tell the people screaming the hardest not to use Spring are mostly authors employed by vendors that have a strong interest to lock-in their customers to full Java EE server instead of a framework that lets them (but not requires them!) to run on a Servlet or Java SE container.  In your publications list I see authors employed by vendors selling JBoss, Resin, WebSphere, Glassfish and WebLogic Server.  There have been lots of people that have a different point of view on this topic.  What I really don't understand as why someone promoting the Java ecosystem as their primary job wants to so obviously dissuade users from making up their own minds with an objective analysis of trade-offs, especially when it does not have to be a mutually exclusive choice and Spring is part of the Java community.  You know that many other people (in fact the vast majority of Java developers) do not share your view, yet you do not provide a single link to present an alternative perspective.  Are Spring advocates not part of the Java community in your view?

I find it very strange that you try and attach a "l"-word attribute to Spring when the major app server vendors have not even been shipping full Java EE 6 releases until so recently that almost no customers have the latest versions of WebLogic, WebSphere or JBoss installed.  Java EE 6 came out in December of 2009 which is 2+ years old, WebLogic Server 12c only started supporting a Java EE 6 compliant server 3 months ago!  WebSphere 8.0 was summer 2011 and JBoss EAP 6 is not even yet generally available.  You are advocating to use a framework with implementations that are so new that almost no customers of the major application servers have a compliant server in production.  Java EE 6 is not even available in the Oracle Public Cloud yet, so if Oracle can't even upgrade their containers that fast how can you expect all the customers to be up-to-date?  Spring 3.1, which had a lot of features for a minor release, started shipping in the Fall of 2011, almost 2 years after Java EE 6.  Plus as you probably are aware, it supports Java SE 5 and above, so customers are not required to be on the bleeding edge to use it.

You had some trouble finding a tutorial, and I am happy to help you with that since that should be very easy.  First go to and you should click the big button that says "Get Started".  The next page has the links for both tutorials and sample code.  The tutorials page has both video and written tutorials.  If you want to create an MVC style application, there is one called "Green Beans: Getting Started With Spring MVC" by Colin Sampaleanu.  Someone helpfully published a maven archetype in the comments and with only two maven commands you can run the sample with Apache Tomcat, no separate application server installation is required!  If you also wanted to use persistence, you could consider a video like Spring Data JPA by Oliver Gierke

The listing of jar files in the application is not complete if you don't list all the jar files inside Glassfish or WebLogic Server that implement Java EE 6.  The comparable Apache Tomcat list of jars is obviously much smaller.  You know that an application is a container + framework code + application code and you should represent the entire accurate picture.

As for jpetstore, that's not really an updated Spring example as you can see by the Spring version being only a SNAPSHOT before 3.0.0 was released.  It should probably be removed from the list of samples.  The error you saw in maven is from an issue with a JBoss repository.  When I removed the JBoss repository at the bottom of the pom.xml file and updated the Spring version from a SNAPSHOT to RELEASE then my maven build worked fine.  If you want to use a sample that is often highlighted by Spring advocates, then you could look at Spring Travel, but it is only based on Spring 3.0 and not yet taking advantage of all of the Spring 3.1 capabilities.

Your comparison tables are also Apples and Oranges.  You can simply put Tomcat or Jetty in that comparison table and tc Server Standard edition is under 15MB  If you include tc Server, then you should use the Standard Edition recommended for production at 15MB as the Developer Edition includes Spring Insight, which would require including JRockit and JRockit Mission Control in the Java EE 6 column.  I suppose it doesn't help your case to point out that the production version of WebLogic Server 12c has a 1 Gigabyte generic zip installer and that the smaller developer versions are not suitable or supported in production.  I think you are also well aware of the fact that you could run Spring apps on embedded Tomcat 7 which is just a few megs.  I am simply amazed that you think tc Server is proprietary when it is based on Apache Tomcat, the reference implementation of the Servlet Specification, which is part of Java EE!  Why would you want to mislead people like that?  You know as well as I do that there are lots of WebLogic Server customers that are stuck using weblogic.ejb... packages in their code from previous versions of the specification.  The only thing even close to that might be Tomcat valves, but over 1/2 of all Java applications use Tomcat these days, which is free and open source, so it's not locking anyone in.

VMware provides commercial support for both Tomcat and Spring as open source products and customers are not left on their own to manage jars.  VMware also provides commercial products like tc Server, which is Apache Tomcat with some additional management and configuration capabilities and other open source derived products in the vFabric family that represent the way most modern applications are built.  VMware customers are free to use open source with or without commercial support or they can choose a commercial product derived from open source, the choice is theirs.

While Java EE 6 was finalized over 2 years ago, Spring has moved on to simplify and provide solutions to lots of other problem domains with Spring Data applied to NoSQL (MongoDB, GemFire, Riak, Redis, Neo4j) and Big Data (Hadoop)  Spring Social has already been available providing solutions to integrate with Twitter, Facebook, LinkedIn, TripIt and Github while JSR 357 is just getting started   Developers want solutions to these problems now, not when RedHat, Oracle and IBM get around to it.

People may not realize that you and I are friends and I'm happy to see you are passionate about your job, but I can't let you misrepresent the facts without setting the record straight.  I don't understand the Java EE vendor mentality that encourages deriding Spring when so many developers use it effectively and like it.  Go ahead and cheer for your team, but to misrepresent what you see as the other team's case is disingenuous.  I personally find it very deflating to the Java community as a whole when you, Bill Burke and others write trolling articles.  Hopefully only the vendors are paying attention in these artificial and made-up scuffles while productive developers are actually getting work done.


James Bayer

Monday, January 16, 2012

Will Cloud Era Beer Be Mostly Generic?

Disclaimer: I am employed by VMware and work with the Cloud Foundry team.

The Cloudbees guys like stirring the pot a bit, which is fine, but I’m taking the bait this time.  In several of their blog posts they try and paint OS or virtualization vendors with a broad brush that can't possibly be relevant in the cloud era, which they believe is a very convenient argument for them.  Today Sacha Labourey offered some commentary on the recent EC2 Windows free tier announcement and I think he's got it wrong enough (at least about the non-obvious points) that it inspired me to write some thoughts down of my own.

Sacha's outline is something like:

  • Microsoft Windows is more expensive than Linux (sorry Microsoft)
  • VMware is more expensive than Xen (sorry VMware)
  • Paid Linux is more expensive than free Linux (sorry Redhat)
  • Hosting margins are smaller than license or subscription margins (sorry licensed and subscription software vendors)
  • Windows has weak cloud DNA
  • Amazon will be the new Microsoft
  • Therefore, try Cloudbees, the closed-source Java PaaS!

To really dumb it down, my take away is that Sacha feels like cloud providers like Amazon will commoditize the operating system and virtualization companies to an extreme almost exclusively because they will have the lowest raw compute cost per hour.  He implies that totally free open source software without commercial support will dominate the entire stack and dramatically erode business from commercial and subscription based software providers.  Virtualization and operating systems won’t matter as Amazon Linux will become defacto.  He thinks we're all going to love the taste of the blandest and cheapest generic cloud beer.

I disagree that server-side operating system and virtualization software will become undifferentiated and therefore irrelevant in the cloud era.  If the only prism you view things in is cost per hour of raw compute instances available on-demand, then sure, running Amazon Linux on EC2 is tough to beat.  Some fraternity parties make beer selection decisions with a framework like that.  However, an overwhelming majority of the workloads don't and won't fit that model.  Even if PaaS really takes off, it will run better on great virtualization and operating systems.  Public coulds are not the only way to operate cloud era infrastructure.  Cloud can be a malleable term, when I think cloud I think multi-data center, physical layer abstraction, high availability, great density, elasticity, self-service, and organization-relevant billing and metering.  Vendors that offer a holistic solution that spans public and private clouds and integrates with pre-cloud systems will have loyal customers that are willing to pay a premium over cheaper solutions with gaps.  A winning solution will leverage innovations and differentiation in the operating systems and virtualization.

It's not too hard to think of a few examples of why enterprises run Windows which include Exchange, Active Directory, Office, .NET and SQL Server.  These customers choose to pay more when there are free Linux alternatives!  It would be cheaper for everyone to sustain themselves on ramen noodles every night, yet the restaurant business seems to be doing just fine.  Macs cost more than non-Mac laptops, yet I see lots of cloud people using Macs.  I believe that generic beer will not be the only option and probably not even the most popular choice on the menu in the cloud era.  Customers will pay a premium for stuff that lets them accomplish their goals, which may not be directly aligned with the cheapest compute cost per hour on the blandest stack.  Time-to-market, ease-of-use, locality, quality and reliability could all conceivably prioritized over raw compute cost per hour depending on the need.  EC2 already illustrates this breadth of menu approach by the variety of OS's supported and different tiers of pricing.

A few other random points.  I recently learned that many of the worlds ATM's run an embedded version of Windows blue-screen-of-death jokes aside.  Windows has demonstrated it can be optimized for very small footprints.

Amazon Linux might be great for some situations, but Red Hat has indicated that they may not continue letting their operating system innovations to trickle downstream easily as shown by their decision to ship the kernel with patches pre-applied in RHEL 6.  Operating system R&D is funded by customers and there will be differentiated features for paid offerings.  Why else would Joyent invest so much in SmartOS?  Amazon Linux is basically equivalent to RHEL today, but this is a fluid situation.

Cheap beer has it’s time and place, but the majority of customers want choice and are willing to pay for quality on most occasions.  Keep yourself honest and try the cheap beer every once in awhile, just to be sure.  It reinforces my appreciation that you get what you pay for.

Generic beer image is attributed to pdxdiver from flickr.