Monthly Archives: February 2014

Cordova: Getting Started with iOS and Android Applications (Tech Tip #14)

cordova-logo

Apache Cordova is a platform for building native mobile applications using HTML, CSS, and JavaScript. This blog will show how to build a simple application using Cordova and run it on iPhone and Android emulators.

Complete detailed instructions are available here. Lets get started!

  1. Install Node Package Manager (optional): The easiest way to get started with Cordova is using the cordova command-line interface. This tool allows you to create new projects, build them on different platforms, and run them within an emulator. You can also use the CLI to initialize project code, after which you use various platforms’ SDKs to develop them further.The command-line is available as Node.js packaged module and can be installed using npm. If you already have Node.js then you already have npm, otherwise download and install Node.js.
  2. Install cordova command-line as:
  3. Create a new project as:
  4. Target platforms: Specify a set of target platforms such as iOS or Android. But before these target platforms can be specified the machine needs to support the SDK and the corresponding SDK must be installed.For example, XCode must be installed to specify iOS as the target platform, and Android SDK for Android target platform. Once installed, the target platform can be added as:
    And verify as:
  5. Build the app as:
  6. Simulator: Install the iOS simulator
  7. Test the app on iOS simulator:
    to see the result as:

    tt15-ios-simulator-default-screen

  8. Add Android target platform as:

    You’ll need to make sure bin directory from Apache Ant and android command from Android SDK are in the path.

  9. Create Android Vitual Device
    1. Generate the list of targets:

    2. Create Android Virtual Device as:

      Note that the target value is chosen from previous command’s output.

  10. Test the app on Android emulator:

    to see the result as:

    tt15-android-simulator-default-screen

Most of the steps above like installing emulators, XCode, Android SDK are one time. But other than that the application development process is pretty straightforward.

How cool ?

There are several ways to get help: mailing lists, file an issue, docs, @apachecordova.

JBoss Tools provide great tooling for Cordova. Check out this two-part video that provide an end-to-end application development using Cordova

and

Future blogs will continue building upon this application and show integration with other technologies, add other features like accelerometer, compass, geolocation, battery events, camer, media, vibration, etc.

IBM WebSphere Liberty Core 8.5.5 vs Red Hat JBoss EAP 6.2

Here is an excellent video comparing IBM WebSphere Liberty Core 8.5.5 with Red Hat JBoss Enterprise Application Platform 6.2:

Even though its a short video but the summary is shown in snapshot captured from the video:

ibm-websphere-liberty-profile-8.5.5-vs-redhat-jboss-eap-6.2

A complete TCO analysis on JBoss EAP vs IBM WebSphere is available here. A quick summary from the paper is:

We compared these products as objectively as possible, utilizing people that were expert in each, and concluded that JBoss EAP is the clear winner over WebSphere AS ND with a 50.91% lower TCO, easier application development characteristics, noteworthy operational ease-of-use advantages, and a smaller footprint.

And another detailed comparison is here.

Enjoy!

Download Red Hat JBoss EAP 6.2 today and take the red pill!

DevNation 2014: Top notch speakers, Sessions, Labs, Hackfests, …

devnation-logo

DevNation is Red Hat’s inaugural open source polyglot conference and has some top notch speakers:

  • Kris Borchers, Executive Director, jQuery Foundation
  • James Pearce, Head of Open source, Facebook
  • Jeremy Edberg, Reliability Architect, Netflix
  • Anton Arhipov, JRebel product lead
  • Gavin King, Ceylon project lead
  • Mike Milinkovich from Eclipse Foudation
  • Chris Aniszczyck from Twitter
  • Markus Eisele prominent Java EE architect and blogger

Oh, this is really exciting, tell me more!

Dates: April 13-17, 2014
Venue: Moscone Center, San Francisco
Website: devnation.org
Twitter: @DevNationConf
Hashtag: #DevNation

Oh Moscone … have not seen a Java conference there for a while 😉

Tell me more …

Agenda: www.devnation.org/#agenda
Speakers: www.devnation.org/#speakers

There will be sessions, labs, hackfests, panels, and much more.

Early bird registration ($495) ends on Mar 14.

I’m soooo ready to register … give me the link to register ?

Register now!

I’m going to register and share it with friends too :)

And BTW, all JUG leaders, JBUG leaders, and Java Champions get a 50% discount on registration. Just leave a comment on the blog and we’ll share the discount code.

REST vs WebSocket Comparison and Benchmarks

One of the common questions asked during my #JavaEE7 presentations around the world is how do WebSockets compare with REST ?

First of all, REST is a style of architecture so what really people mean is RESTful HTTP. As an architecture cannot be compared with a technology. But the term is so loosely used that they are used in place of each other commonly.

Lets start with a one line definition for WebSocket …

Bi-directional and full-duplex communication channel over a single TCP connection.

WebSocket solves a few issues with REST, or HTTP in general:

  • Bi-directional: HTTP is a uni-directional protocol where a request is always initiated by client, server processes and returns a response, and then the client consumes it. WebSocket is a bi-directional protocol where there are no pre-defined message patterns such as request/response. Either client or server can send a message to the other party.
  • Full-duplex: HTTP allows the request message to go from client to server and then server sends a response message to the client. At a given time, either client is talking to server or server is talking to client. WebSocket allows client and server to talk independent of each other.
  • Single TCP Connection: Typically a new TCP connection is initiated for a HTTP request and terminated after the response is received. A new TCP connection need to be established for another HTTP request/response. For WebSocket, the HTTP connection is upgraded using standard HTTP Upgrade mechanism and client and server communicate over that same TCP connection for the lifecycle of WebSocket connection.
  • Lean protocol: HTTP is a chatty protocol. Here is the set of HTTP headers sent in request message by Advanced REST Client Chrome extension.
    And the response headers received from WildFly 8:
    These are 663 characters exchanged for a trivial “Hello World” echo. The source code for this simple application is here.

    For WebSocket, after the initial HTTP handshake, the data is minimally framed with 2 bytes.

Lets take a look at a micro benchmark that shows the overhead caused by REST over a WebSocket echo endpoint. The payload is just a simple text array populated with ‘x’. The source code for the benchmark is available here.

The first graph shows the time (in milliseconds) taken to process N messages for a constant payload size.

websocket-rest-messages

Here is the raw data that feeds this graph:

websocket-rest-constant-payload

This graph and the table shows that the REST overhead increases with the number of messages. This is true because that many TCP connections need to be initiated and terminated and that many HTTP headers need to be sent and received. The last column particularly shows the multiplication factor for the amount of time to fulfill a REST request.

The second graph shows the time taken to process a fixed number of messages by varying the payload size.

websocket-rest-payload

Here is the raw data that feeds this graph:

websocket-rest-constant-messages

This graph shows that the incremental cost of processing the request/response for a REST endpoint is minimal and most of the time is spent in connection initiation/termination and honoring HTTP semantics.

These benchmarks were generated on WildFly 8 and the source code for the benchmark is available here.

Together the graph also shows that WebSocket is a more efficient protocol than RESTful HTTP. But does that mean it will replace RESTful HTTP ?

The answer to that, at least in the short term is, NO!

  • WebSocket is a low-level protocol, think of it as a socket on the web. Every thing, including a simple request/response design pattern, how to create/update/delete resources need, status codes etc to be build on top of it. All of these are well defined for HTTP.
  • WebSocket is a stateful protocol where as HTTP is a stateless protocol. WebSocket connections are know to scale vertically on a single server where as HTTP can scale horizontally. There are some proprietary solutions for WebSocket horizontal scaling, but they are not standards-based.
  • HTTP comes with a lot of other goodies such as caching, routing, multiplexing, gzipping and lot more. All of these need to be defined on top of WebSocket.
  • How will Search Engine Optimization (SEO) work with WebSocket ? Works very well for HTTP URLs.
  • All proxy, DNS, firewalls are not yet fully aware of WebSocket traffic. They allow port 80 but might restrict traffic by snooping on it first.
  • Security with WebSocket is all-or-nothing approach.

This blog does not provide any conclusion because its meant to trigger thoughts!

And if you want a complete introduction to JSR 356 WebSocket API in Java EE 7, then watch a recently concluded webinar at vJUG:

So, what do you think ?

Vert.x-athon at EclipseCon 2014

vertx-logoeclipsecon2014-na-logo

Vert.x is a lightweight, high performance application platform for the JVM that’s designed for modern mobile, web, and enterprise applications.

Do you want to learn more about Vert.x from the committers and leading experts ?

Join us at EclipseCon 2014 for Vert.x Day!

What will you get ?

  • Get an overview of Vert.x by none other than Tim Fox.
  • Learn how Netty an asynchronous event-driven network application framework is powering Vert.x by Norman Maurer.
  • Build Vert.x applications using Clojure or Spring, or host them on OpenShift.
  • Find out how Vertigo and RxJava are leveraging Vert.x.

Tickets are only $200!

When ? Mar 17-20, 2014
Where ? Hyatt San Francisco Airport
More details ? Agenda

Register now!

 

Undertow, Vert.x, and Netty Benchmarks

90 frameworks (including web application platforms, full-stack frameworks, and micro-frameworks) are compared using 230 tests by Tech Empower. The tests execute fundamental tasks such as JSON serialization, database access, and server-side template composition. Read more about the tests introduction, permutation, and environment details.

Complete results from Round 8 are explained here.

Undertow is the new web server in WildFly 8 and did pretty well with consistently staying in top 10 in all categories, especially given that the server is written from scratch. Vert.x and Netty – two more frameworks from Red Hat are doing pretty well too!

Here is a snapshot of some of the results:

undertow-benchmark6-plaintext-feb20

 

Top 3 frameworks here are by Red Hat :)

 

undertow-benchmark1-json-feb20

undertow-benchmark2-single-query-feb20

undertow-benchmark3-multiple-queries-feb20

undertow-benchmark4-fortune-feb20

undertow-benchmark5-updates-feb20

WildFly 8 was recently released and uses Undertow as the web server. Undertow provide a composition/handler-based architecture that provides support for Servlet 3.1, HTTP upgrade, WebSocket, and mod_cluster. It can also be embedded in to your application very easily. Find more details here.

Did you know Twitter’s fault-tolerant protocol-agnostic RPC framework (Finagle) is built on top of Netty ?

How are you using WildFly 8, Undertow, Vert.x, or Netty ?

 

WildFly 8 is now available!

8final

WildFly brings you the latest innovations in application server technology, and

  • is developer-friendly with fast start-up, extensive tooling, and quickstarts
  • supports Java EE  standards and beyond
  • is ideal for running in cloud environments where every cycle matters

WildFly 8 brings:

  • Java EE 7 support: This means all the latest and greatest technologies such as WebSocket/JSR 356, Batch Processing/JSR 352, JSON-P/JSR 353, Concurrency Utilities/JSR 236, JAX-RS 2.0/JSR 339, JMS 2.0/JSR 343, and all others from the platform are now available in WildFly.
  • New high performance web server (Undertow): A flexible performant web server written in java, providing both true blocking and non-blocking API’s based on NIO. It has the ability to scale to a million connections and has impressive numbers on throughput. It also allows us to add support for modern security standards. And since web server is one of the most critical pieces of an application server, writing it a fresh allows us to provide the best possible performance and memory efficiency.
  • Greatly reduced port usage: Nearly all protocols are multiplexed over two ports: 8080 for application and 9990 for management. This is a very useful feature in high-density environments such as OpenShift.
  • Role based access control (RBAC) and Audit logging: RBAC is the ability to restrict access to system or certain portions of it to authorized users. Seven pre-defined roles can be used to map permissions to users and groups to different parts of management infrastructure. Audit logging allows logging for of operations affecting the management model. RBAC and Audit Logging certainly makes the server enterprise grade.
  • Patching infrastructure: Infrastructure to support the application of patches to an existing install has been implemented. This capability allows for a remote client to install and rollback new static modules and binary files using the WildFly management protocol.

Read the official release announcement which provides a comprehensive list of features (lots of cool ones!) and check out the resources page (books, videos, tutorials, docs, etc).

How do you reach us ?

  • wildfly.org
  • WildFly Forums or Mailing List (archive)
  • @WildFlyAS
  • File bugs in issue tracker
  • IRC

Download now (zip) and get started!

Why I love JUDCon India 2014!

JUDCon India 2014 got over a few days ago. One of the highlights of the conference was the “wall” where attendees could share their honest feedback about JUDCon. This venue was generally packed in between the sessions and turned out to be a colorful collage of post-its as seen in the picture below:

And here are some of the comments:

  • Judcon joins minds and heart with open source
  • Nice Oppurtunity to explore various technology and trends in JBOSS world and its community
  • I Love Judcon
  • Working with JBOSS is making me to love my work :-)
  • Loved it
  • Awesome!!! A great deal of information and exposure to what JBOSS can provide
  • Second time attending Judcon! It has always broaden my world of technical skills! Thanks JUDCON
  • Wild fly server is causing lots of heat. Its turning things up. Oh its so hot; I love to learn it
  • Good Exposure to latest technology
  • Excellent and Proud to be part of JUDCON
  • Its Awesome :-)
  • Love Java, Love Judcon
  • Judcon is the best
  • Food was good
  • It helps jump up development capabilities!!
  • Technologically motivating lively conference
  • Because its Inspiring, Fun, and filled with lots of new Surprises
  • Its fun over here, learn new things
  • Redhat is the sexiest technology service provide in this world. Love to be the 1st in the world
  • Shekar, Arun, Greg….. You guys really ROCK!
  • I am here this is 3rd time!!! The session are informative that is why I am here
  • Explore more about opensource & new technologies
  • If its ‘ON’ – its JUDCON, this is my first experience but I like this
  • Amazing lots of demo
  • All the hot JBOSS TEAM COMES HERE
  • It was Fun (across three post-its with a smiley)
  • Good one, Enjoyed, learned new things keep going JUDCON
  • Need! Expecting Hacking session on wildfly, not just introduction
  • Really Liked Forge
  • Key note is very inspiring & all the session relating to aerogear is very usefull
  • Arun Gupta Rocks
  • Love opensource. Love his way to learn technologies
  • Superb
  • Judcon Power
  • Fantastic……Useful
  • It was awesome, intel’s session was very outstanding
  • Very informative and interactive sessions. Too many new technologies to unfold. I WOULD DEFINITELY WANT TO COME BACK
  • Loving JUDCON 2014, judcon rocks
  • This is one of the 1st finest moment, I have ever seen all the products service oriented deveopres are presenting 
  • Refreshing, Enthusiastic, Energetic
  • Open Source is Open for all like heart
  • Learning lots of stuff helps in productivity
  • Java EE Hands on Ty, new concept explained with use cases were good. Hands on session is good
  • Awesome experience on new stuffs from Red Hat……KUDOS!!

What was your reason to attend JUDCon ?

Several more JUDCons are getting planned for this year, do plan on attending them. You can always find the latest event at jboss.org/events/JUDCon/ and by following @JBoss.

JUDCon India 2014 is a wrap!

JUDCon India 2014 is now in the records!

judcon-india-2014

This was my first JUDCon after joining Red Hat about 3+ months ago. It provides a unique opportunity to meet with customers, partners, developers, contributors, and members from the JBoss core team. Bangalore is #1 city for all traffic to jboss.org and that’s the reason JUDCon comes back to the city third year in a row.

There were lots of good talks covering a wide range of JBoss-related topics such as WildFly, Java EE 7, Vert.x, OpenShift, Arquillian, AeroGear, … and plenty of others. Other than the usual keynote, sessions, hallway conversations, we tried a couple of new things this time …

  • Hands-on labs gives attendees a unique opportunity to build applications using JBoss technologies following detailed instructions and BYOL. There were labs on OpenShift, Java EE 7, and WildFly 8. Internet connectivity was an issue in the labs and so the instructors eventually showed the labs but attendees enjoyed the code-driven tutorial nature of the session. All the hands-on lab material is available though:
    • Java EE MongoDB Applications in the Cloud
    • Java EE 7
    • WildFly 8 Administrative Lab
  • We introduced a new talent show that allowed the attendees a chance to showcase their talent in front of everybody. This was an open invitation to all conference attendees on Day 1 and the show was right after lunch on Day 2. Two mimicry artists, a singer, and a team with a skit performed on the stage.Its one thing to show up on the stage and do a technical talk but it takes different chops to show your non-technical skill in front of ~500 attendees. Talent show video will be going live shortly. We hope to build this a tradition and continue this at other JUDCons as well. You have enough time to prepare yourself before the next one :)

It was good to see Chennai JUG leader Raj Mahendra with his team at the show. He introduced me with Mahesh who is planning to revive Bangalore JBUG. In addition, he is working with other JBoss community members to kick start JBUG Coimbatore and JBUG Hyderabad. The complete list of JBUGs is listed here.

Here is some reaction from #NammaJUDCon and #JUDCon:

  • exposed to new technologies at #nammaJudCon thanks @EchidnaInc for the opportunity. An awesome event and met some gr8 speakers #JEE #judcon
  • Mr Greg, your session on Best practices with JPA and your liveliness & energy during the session is simply awesome #NammaJUDCon
  • Best speakers at #NammaJUDCon @aslakknutsen, Vinod Kiran and @galderz. They had the best content and focus. Thank you folks!
  • NammaJUDCon takeaways: – JavaEE7 hands-on lab by @arungupta – Peek into Forge & Arquillian – HornetQ to-be deprecated for AMQ in WildFly
  • Super gyaan in Evolution of BPM. #NammaJUDCon
  • @galderz your talk was fantastic indeed! We loved the work your team is doing. #vertx #NammaJUDCon
  • Wow. The same app on both ios and and firefox os with no platform specific code. @AeroGears at #NammaJUDCon 2014 pic.twitter.com/ImHJw6Hhfo

Attendees were also given an opportunity to share their feedback on a post-it wall. Check out some of the post-its captured in the complete photo album.

Check out some pictures from the show …

A complete album is available on WildFly’s facebook page. We are always looking forward to feedback. Leave a comment on this blog and let us know what worked and what didn’t. Also let us know what additional topics would you like to see at a future conference.