Posts

Showing posts from 2012

Removing Click Delays on Mobile Browsers

If you ever wanted to get rid of the 300ms delay between a physical tap and the the firing of a click event introduced on mobile browsers then the polyfill those guys from Financial Times created is the answer you are looking for.

Available on GitHub, FastClick is a simple, easy-to-use library for eliminating that delay and make your application feel more responsive to, for example, the touch of a button.

Have a look and fork the project at: https://github.com/ftlabs/fastclick

You can also give it a try running one of the demos on your mobile device pointing your browser to: http://ftlabs.github.com/fastclick/examples/layer.html (it won't work on your desktop browser as the library doesn't attach any listeners to them).

Fascinating and job well done...

Running iOS Simulator from Command Line

I've recently migrated to Mountain Lion and it looks like I couldn't start the iOS Simulator from command line as I used to do in Snow Leopard.

Luckily, I was able to find a solution and all development is back to normal now :)

Here is how to run the iOS Simulator from command line:

$ open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app


and that assumes that you have installed Xcode under /Applications.

You can also create a script with the content above and update your $PATH variable or even create a symbolic link under your /Applications folder using the following:

$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/ /Applications/

Time for another change...

Well, it's time for another career change... I've decided to take a slightly different direction and join TIBCO as Principal Consultant where I'm going to be involved with lots of architecture discussions, application design white boarding, development and deployment techniques, pre and post sales activities as well.

My story with TIBCO started a long time ago when I was primarily competing against the company on every single account I was working on. It definitely showed me how good the TIBCO technology is and how hard was to compete against a company that innovates a lot and definitely understands what customer are looking for.

Then moving over to a couple of smaller companies I could experience the partnership side from the EMS, Spotfire and Web Messaging perspectives which gave me a good way to start contributing from the first moment.

If you think about how the opportunities that have emerged from information silos to integration silos and consequently moving over to …

The mysterious behavior of Mac Mail and Yahoo! Mail Plus

If you, like me, uses Mac Mail as your primary email client and you also have an Yahoo! Mail Plus subscription (which gives you IMAP access to your Yahoo Mail account), you may have experienced an intermittent connection behavior where the email client is not able to connect due an invalid password even though you're using the correct one.

I've been reading lots of blog posts and forums reporting the exact same behavior and I was not able to find a concrete answer but the following approach seems to be working for me so far.

So, next time you see that dialog box requesting that you enter your password again to login to Yahoo, go to your web browser of choice and navigate to Yahoo Mail (mail.yahoo.com).

If you are automatically logged into the system then make sure you click on the Sign Out button first.

When you return to the login screen, type your username and password normally but make sure you select the Keep Me Signed In checkbox and then click Sign In. That should solve …

An Introduction to STOMP

STOMP (Simple (or Streaming) Text-Oriented Messaging Protocol) is a simple text-oriented protocol, similar to HTTP.

STOMP provides an interoperable wire format that allows clients to communicate with almost every available message broker. STOMP is easy to implement and gives you flexibility since it is language-agnostic, meaning clients and brokers developed in different languages can send and receive messages to and from each other.
There are lots of server implementations that support STOMP (mostly compliant with the STOMP 1.0 specification). The following is a list of STOMP 1.0 compliant message servers:

Apache ActiveMQ – http://activemq.apache.orgApache Apollo – http://activemq.apache.org/apolloCoilMQ – http://code.google.com/p/coilmqGozirra - http://www.germane-software.com/software/Java/GozirraHornetQ – http://www.jboss.com/hornetqMorbidQ – http://www.morbidq.comRabbitMQ - http://www.rabbitmq.com/plugins.html#rabbitmq-stompSprinkle - http://www.thuswise.org/sprinkle/index.htmlStomp…

The Definitive Guide to HTML5 WebSocket

Image
The book is on the way now! You can pre-order it here. It has been so much fun and a lot of work but I personally hope you can get a copy and enjoy all the content we're putting together.

Here is part of the book description if you want more information about it:

"The Definitive Guide to HTML5 WebSocket is the ultimate insider’s WebSocket resource. This revolutionary new web technology enables you to harness the power of true real-time connectivity and build responsive, modern web applications.   

This book contains everything web developers and architects need to know about WebSocket. It discusses how WebSocket-based architectures provide a dramatic reduction in unnecessary network overhead and latency compared to older HTTP (Ajax) architectures, how to layer widely used protocols such as XMPP and STOMP on top of WebSocket, and how to secure WebSocket connections and deploy WebSocket-based applications to the enterprise. Build real-time web applications with HTML5."


The b…

The WebSocket bufferedAmount attribute

If you have been working or planning to work with HTML5 WebSocket you may end up transporting large amounts of data and/or you may have the requirement to transport data as fast as possible. 
The WebSocket object has an attribute called bufferedAmount that's particularly useful to check for the amount of data buffered for transmission to the server. You can use the bufferedAmountattribute to check the number of bytes that have been queued but not yet transmitted to the server.
The values reported in that attribute don’t include framing overhead incurred by the protocol or buffering done by the operating system or network hardware.
The code below shows an example of how to use the bufferedAmountattribute to keep sending updates every second, if the network can handle that rate, or at whatever rate the network can handle, if that is too fast.
// Buffering threshold at 10k var THRESHOLD = 10240;

// Create a New WebSocket connection
var mySocket = new WebSocket(“ws://echo.websocket.org/u…

Checking for WebSocket Support on Your Web Browser

It’s frustrating to execute some code and don’t see anything happening after that. But, depending on the web browser you or the end user running your application is using that may be impacting the WebSocket functionality at this point since not all current browsers in use support HTML5 WebSocket natively yet.
So, let’s take a look on some techniques to make the web browser supports WebSocket.
We are going to use the JavaScript console available in all web browsers to start with the WebSocket support investigation. Each web browser has a different way to initiate the JavaScript console but if you’re using the suggested web browser (Google Chrome) take a look on the following resource to learn more about it (https://developers.google.com/chrome-developer-tools/docs/overview).
If you open your browser’s interactive JavaScript console and evaluate the expression window.WebSocket you should see the WebSocket constructor object:
function WebSocket() { [native code] }

which means that your w…

The WebSocket readyState attribute

The WebSocket object will report the state of its connection through a read-only attribute called readyState.

There are four different values that the readyState attribute can receive to represent the state of the connection.

0 - CONNECTING – The connection has not been established yet.
1 - OPEN – The connection has been established and messages can be exchanged between the client and the server.
2 - CLOSING – The connection is going through the closing handshake.
3 - CLOSED – The connection has been closed or could not be opened.

When the WebSocket object is first created its readyState is 0, indicating that the socket is CONNECTING.

Inspecting WebSocket Frames

So far, it has been a challenge for us working with HTML5 WebSocket to analyze the traffic going back and forth from the client to the server and from the server to the client. Without using packet sniffing tools like Wireshark or tcpdump the analysis and debugging of WebSocket messages is almost impossible.

But, recently, things are changing and it's now possible to see frame data along with arrows indicating the direction of the data is going to.

A WebKit patch has been created and you can use Chrome Canary to check the latest changes and start inspecting WebSocket frames. A huge advance for those working with HTML5 WebSocket.

There is also a step-by-step demo located here: http://blog.kaazing.com/2012/05/09/inspecting-websocket-traffic-with-chrome-developer-tools/

Accessing Databases with HTML5 WebSockets and Apache Camel

Image
As I have said on my previous post, I've been working with several companies with the most diverse use cases and one that really brought my attention was the requirement to access databases using HTML5 WebSockets which seems to be a clever thing to do with the right tools.

So, basically what I've setup for this is represented on the picture below:


Let's go over the implementation details of all of the components described here:
From right to left, the backend datasource I had to use was MySQL that you can download from http://www.mysql.com/downloads/. Then, I used Apache Camel as the backend framework accessing the database and also exposing a TCP-based component (Mina in this case). Moving to the left, we have the Kaazing WebSocket Gateway connecting to the Apache Camel framework and exposing WebSocket connectivity to the web clients (browser-based, mobile-based and desktop thick client applications).
The web-browser sample client is pretty straightforward and with a few …

It's not lack of content...

We all have that excuse of no time for blogging or lack of interesting content for not updating our tech-y blogs but in fact there are tons of interesting things that I'm working on right now like a JDBC over WebSocket project which seems to be a really nice thing to do and also an end-to-end prototype that we at Kaazing put together for an airline company.

Basically, the airline use case goes from backend JMS-based systems to mobile devices over WebSocket using Kaazing WebSocket Gateway JMS Edition notifying the users about gate changes and flight cancellations. You gotta see this in action! It's super cool... Since it has some proprietary systems I won't be able to show you all parts but I've been working on a generic version of it where you can install all the pieces in your machine and run the whole thing locally. Ping me if you want to take a look on that.

The other project that I'm working on is the JDBC over WebSocket which basically uses Kaazing WebSocket G…

How to Setup RabbitMQ Message Broker with Kaazing WebSocket Gateway - AMQP Edition

If you want to try the Kaazing WebSocket Gateway - AMQP Edition with RabbitMQ, take a look on the following steps...

If you are trying this setup on a Mac, make sure you have Erlang already installed otherwise have a look on my previous post on How to Install Erlang on Mac OS X Snow Leopard.

Install RabbitMQ


- Download RabbitMQ from http://www.rabbitmq.com/download.html

- Extract the file to the desired directory

- Navigate to RabbitMQ installation directory and run the following command:

$ sbin/rabbitmq-server

If RabbitMQ is started correctly you should see a message similar to the following:

Activating RabbitMQ plugins ...

********************************************************************************
********************************************************************************

0 plugins activated:


+---+   +---+
|   |   |   |
|   |   |   |
|   |   |   |
|   +---+   +-------+
|                   |
| RabbitMQ  +---+   |
|           |   |   |
|   v2.7.1  +---+   |
|                 …

Installing Erlang on Mac OS X Snow Leopard

Image
I'm working with a customer who is using the Kaazing WebSocket Gateway - AMQP Edition with RabbitMQ and while his install was pretty straightforward on Windows 7 I thought the same would be applicable to my case (a Mac user). Well, to summarize the process, it was quite of a challenge to get everything working, not from the complexity perspective but for the number of steps involved in the process to get the environment running starting from the point that RabbitMQ depends on Erlang to run. So, that was the first step... Installing Erlang on Mac OS X

Here are the steps I had to take:

- Download and install Apple Xcode 4.3 from Apple's AppStore (yeah, you read it right!)

- The tricky part here was to enable Command Line Tools which is not selected by default in Xcode. To do that, go to Xcode Preferences --> Downloads --> Components and install Command Line Tools. It's just another 170MB over the already downloaded 1.35GB of Xcode :)



- Download Erlang latest release fr…

Quick Start with the Kaazing WebSocket Gateway in Less Than 6 Minutes

One of my colleagues at Kaazing just recorded a very nice tutorial on how to get started with the Kaazing WebSocket Gateway using the extreme powerful JMS Edition. It only takes a few minutes to download, install, start up, and try out the Kaazing WebSocket Gateway. So, it's really worth it... You can take a peek here: http://vimeo.com/36919680

Enjoy...

Moving On...

Well, it has been a while since I updated this blog and there are many reasons just to say that I wasn't motivated enough to write anything lately. Some personal issues as well as another job change associated with a short vacation contributed to the delay but the good part is that I'm back and really happy with how the year is shaping up. 


It seems to be that all personal stuff is sorted out and I also have decided to join Kaazing as a Solutions Architect. Kaazing is the first Enterprise-grade Web Communications Platform leveraging HTML5 WebSockets designed for real-time, massive scalability and providing reliability necessary for companies to deploy those kind of solutions over the web.


If you're not familiar with HTML5 and WebSockets and I'd recommend you to take a look on the following presentation available at http://www.infoq.com/presentations/WebSockets-The-Web-Communication-Revolution.


Stay tuned for more...