Friday, June 29, 2012

Gigabit Wireless Router from Cisco

Today while I was browsing through the Cisco website, found out that they’ve started taking pre-orders for Gigabit Wireless router based on the 802.11ac draft spec. The model is Linksys EA6500 scheduled to release in August 2012. This means that speeds upto a Gb/s is achievable using off-the-shelf consumer routers already. They are listing “Ultimate Speeds upto 450 + 1300Mbps*”. Seriously wow!! Dual Band, so you get the 450Mbps from the n-spec and 1300Mbps from draft-ac spec.

Now, most of you would wonder why the hell do we need that much speed… I was recently trying to stream my favorite BD-Rip Avataar 3D through the XBox 360 on to my TV. But alas, I had to transcode to lower quality because my wireless-n router at 300Mbps was not good enough Sad smile. So, we definitely need this soon as more and more content is available in full HD and we want to start streaming and communicating between the different devices in our household.

Another interesting thing, is that router has built-in NFC (Near Field Communication), which can use a phone (which has NFC) for transmitting configuration. But this feature sounds like just using a technology for the heck of it. How hard is it to type a passphrase or open the router page on the browser and configure. Nevertheless, some nice technologies packed into one experimental device. And then there is also an Acer router with similar 5th gen Wifi stuff…

Saturday, January 28, 2012

Making Love to Webkit

I just viewed Steven Wittens Acko.net and it is just awesome. You have to click here, to see the amazing stuff done with CSS 3D on the website. Don’t forget to click on the Load Scene, a little down in the post and then using the mouse to drag the scene. Classic Stuff!!

The site has used mrdoob’s JavaScript 3D library that also has some amazing examples to look at. It is very interesting to see how 3D in JavaScript is coming along in Webkit. People have been making Love to Webkit and it all looks so aesthetically pleasing and romantic…

Friday, January 27, 2012

NetCAT goodies

Some people might have followed on the blog that I had been participating in the NetbeansDSC00501 Community Acceptance Test (NetCAT) program for the 7.1 release. The release in my opinion is one of the most stable versions of Netbeans ever. This should be attributed to the co-operative effort between the developers, quality managers, community of testers and Jiri Kovalsky, who manages the NetCAT program.

There are some points for bugs, fixes, RFE, feedback, surveys etc. during the alpha and beta phase of the development and the NetCAT final tally for 7.1 is here. The best part in my opinion during this NetCAT release compared to earlier years was the quick bug fixes delivered by the Netbeans Engineering Team.

I also got some goodies for participating in NetCAT.

Thursday, January 26, 2012

Why REST with JSONP when you can CORS?

JSONP (JSON with padding) is a hack used by JavaScript developers by wrapping a JSON (JavaScript Object Notation) document within a function call. So, if the JSON document looked like {"givenName":"John", "familyName":"Smith"}, the JSONP for the same would be callback({"givenName":"John", "familyName":"Smith"}) (callback being the commonly used wrapper function). So, if you are familiar with JSONP, you will realize that it is used to make Cross-Domain calls where JSON is not accepted by the browsers if they come from another domain. Thus, AJAX requests across a different domain was not possible through JSON and hence using JSONP was the common hack.

The problem with using JSONP is that it is called as a JavaScript function response and hence CORS-supportyou will not be able to use it as normal HTTP calls. That means you would not be able to send HTTP headers and that can be a problem at many places. There are hacks to deal with the problem, but these are best described as hacks. Another limitation of the JSONP hack was that you could only make GET requests and nothing more. Hence to make a standard, W3C created the CORS (Cross-Origin Resource Sharing) standard which nearly all modern browsers support.

The main issue with using JSON or AJAX (XHR – XMLHttpRequest) across domain was that browsers would not be able to acknowledge if the response was malicious or in response to the request that they made. The same-origin-policy, prevented making cross-domain requests. Then came CORS, a technique by browsers to check the origin policy first and then accept responses. So a server that wants to allow getting any type of HTTP request from another domain would list the domain or * in its HTTP response header as follows:

Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: http://example.com:8080 http://foo.example.com

This means that there is some modification to be done on the server-side resource to add these headers to the response. Another point to note is that it works with XHR requests as well as client errors (4xx) and server errors (5xx).

Excellent examples on how to use CORS can be found at HTML5Rocks. On the server-side of things, you can find resources to enable CORS.

In Tomcat for a Java web application, you can enable CORS using the CORS Filter library. Basically you copy the jar file into Tomcat lib or WEB-INF/lib of your application and then add filters in your application’s web.xml or tomcat’s global conf/web.xml. For a resource which requires Basic Authentication and Cookies can be configured as follows:

<filter>
<filter-name>CORS</filter-name>
    <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
    <init-param>
     <param-name>cors.allowOrigin</param-name>
        <param-value>*</param-value>
    </init-param>
    <init-param>
     <param-name>cors.supportedMethods</param-name>
        <param-value>GET, POST, HEAD, PUT, DELETE</param-value>
    </init-param>
    <init-param>
     <param-name>cors.supportedHeaders</param-name>
        <param-value>Content-Type, Last-Modified</param-value>
    </init-param>
    <init-param>
        <param-name>cors.exposedHeaders</param-name>
        <param-value>Set-Cookie</param-value>
    </init-param>
    <init-param>
        <param-name>cors.supportsCredentials</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>
<filter-mapping>
        <filter-name>CORS</filter-name>
        <servlet-name>MyServlet</servlet-name>
</filter-mapping>

Instructions for Cookies in Safari can be challenge. A nice post to workaround can be found here.

Wednesday, January 25, 2012

Difference between iPad2’s Safari and Desktop Safari

Since we are targeting the Raxa EMR for JSS for Webkit-based browser, it is important that the team understands the subtle differences between the Desktop shipped Safari and the version of Safari shipped for iPad2. The differences with Chrome are quite a few, so I won’t list those here.

Following are some of the differences to remember:

  • No Flash support
  • Safari iPad does not support position:fixed in CSS
  • Safari iPad creates link for 10-digit numbers automatically
  • Safari iPad does not allow scrolling over textareas and iframes
  • Safari iPad has issues with CSS Animations that cause flickering. Use JavaScript animation or hacks in CSS -webkit-backface-visibility:none; and -webkit-perspective:1000;
  • Safari iPad greys the upload button

Things have been improving compared to the first iPad and iPad2 and the differences are minimizing.

Saturday, January 7, 2012

EMR at JSS Bilaspur – In pursuit of happyness

Over the last 3yrs, I have travelled across the world and looked at 100+ health facilities of different scales. My last encounter with a health facility in rural Bilaspur was very different. Having looked at systems of practice in a variety of health facilities including subcenters, private clinics, primary health centers, community health centers, district hospitals, tertiary hospitals and super-specialty hospitals, each of these places have different characteristics. What makes Jan Swasthya Sahyog (JSS), situated in rural Bilaspur in Chattisgarh special is the motivation levels among all the staff at the health facility. This includes clinicians, nurses, technicians and computer operators… And the motivation of these people stems from the fact that they still believe in care, rather than just providing health services. I use “still” because in my worldview of health facilities, most often I see people missing out on the “care” from the notion of health-care.

My visit to JSS was for volunteer work that I have been doing over the last few months to see an Electronic Medical Record (EMR) system to be setup at JSS. Over 100 volunteers across the world have come together in this pursuit to build an EMR system that is easy to use, suited to low-resource settings and can help improve work of the providers as well as help provide better services to patients. JSS was founded 15yrs back by post-graduates doctors of All India Institute of Medical Sciences (AIIMS), India’s most prestigious medical school and hospital to provide healthcare to people who are deprived from it because of poverty, neglect and lack of development. And when I visited JSS on Christmas 2011, I could see the savior work done by JSS for the many people who come from far-flung places because they are treated with dignity and care.

The EMR system broadly from interviews and discussions with some doctors, nurses, other staff and my interpretation of the context needs to do the following:

  1. Help to improve efficiency in use of resources and providing patient care
  2. Help to maintain correct medical practices through validations
  3. Help to understand who, what, why is being treated at JSS

EMRs or for that matter any computerization process advertises many-fold benefits. Technology is most often considered the silver bullet that will solve all problems. From my experience this is rarely the case. So these 3 points might provide a guiding path to decisions that we make in the design of the EMR. In the design of the EMR, just like JSS we have to put “care” at the forefront of our efforts rather than technology prowess. Thus, this system is envisaged to be a point-of-care systems where providers will look up records and use the system to provide “care”.

The other very unique thing about JSS is that is it rooted in the locale of the context. Having seen other health facilities setup by “change-makers-coming-from-the-outside”, JSS is uniquely very much part of the context. This is one of the reasons I see why people come from more than 100kms away to JSS for treatment. People view JSS as locals and one among their own. This is one aspect that I think the EMR system should incorporate. It should embody in itself the locale. By locale, I mean the local practices, language, usability… among other things.

I would say we have some lofty goals for the EMR. One that the project lead calls as “Linux of EMRs”, but in my opinion even if we achieve more humble ends, like not causing burden to providers and patients that would make me happy. It is this pursuit that drives me to work towards this cause. I call it a pursuit because I realize this is not something that is a stagnant phenomenon. It will change with every small change that we make. Every morning it is this pursuit of happyness that drives me to understand what an EMR system would be of use at JSS.

Thursday, November 10, 2011

PhoneGap under Incubation at Apache Foundation

When Adobe announced the acquisition of Nitobi, the creators of the nice cross-phonegaplogomobile  development tool, like many people I was worried that this would become a closed-source Adobe Air mobile. Adobe has recently been voicing that it would deprecate Flash mobile and instead move towards HTML5 and JavaScript. Thus, PhoneGap seemed like the perfect acquisition to make money out of the new generation of cross-platform mobile development.

The heart-warming announcement came a couple of days back when it was decided that PhoneGap was moved to Apache Foundation as an incubation project. The project is called Callback and the code has been moved to github for now. There are also some nice tools coming in Adobe Dreamweaver which can be used to work with PhoneGap and with the acquisition it might get better and better integrated. This means that Adobe will hope to make money out of the development and probably the build service, yet keep the platform open-source and free…

All in all, I think this is great movement for PhoneGap and cross-platform mobile development. What has been hard for ages since the promise of JavaME, seems more likely now. Good job Adobe!!

Thursday, September 22, 2011

A Review of NetBeans IDE 7 Cookbook

A few weeks (actually a month+) ago, I was sent a request to review the NetBeans IDE 7 Cookbook and blog about it. Incidentally, I was preaching/teaching Netbeans to a few students during the same time. So, although I thought it came at the right time, later I was travelling quite a bit and didn’t have much time to read through the book. Finally, in the last few days, I decided that I should read through the book and see what it is all about. 

The book is published by Packt Publishers and written by the Brazilian Rhawi Dantas. It is nicely arranged in terms of the chapters and the kind of details that it talks about. Starting from the basics of creating projects, importing projects, to designing GUIs, Web projects, Mobile development, Profiling and Testing… It covers most parts of the IDE pretty well.

What it lacks is the depth of coverage. Like Maven and some of the options like skipping tests is a very useful feature in Netbeans is missing from the book. Or the WSDL Editor. Or Navigation features like Go To Implementation is missing!!

In conclusion I’d say the book is interesting for beginners and slightly boring for experienced Netbeans users. If you are preparing for Netbeans Certification, then this is a book you should read, but otherwise I feel the web documentation of Netbeans is good enough to find your way through… I’d rate this book 2.5/5

NetCAT 7.1 Bug Counting

Since, I have signed to NetCAT 7.1 (Community Acceptance Program), I wanted a quick way to see the number of bugs that I have filed compared to the other top 20, I’ve written a small script to go through bugzilla. The one that is on the page seems a little complex to look at and has lots of numbers to look at.

I’ve done this instead:

Beyond the bugs, there is also the email count… We will get to that later!!

Sunday, September 18, 2011

Speeding up Unit Tests by running them in parallel

I just discovered an interesting parameter in the maven-surefire-plugin when using JUnit 4.7+, that tests can be executed in parallel. With multi-threaded CPUs, OS and the like, this helps a lot when you want to decrease the time of your test suites.

So, what are the configurations options that you have:
  1. Running test methods in parallel:
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.9</version>
    <configuration>
    <parallel>methods</parallel>
    </configuration>
    </plugin>

  2. Running test classes in parallel:
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.9</version>
    <configuration>
    <parallel>classes</parallel>
    </configuration>
    </plugin>

There are some things to take care when running unit tests in parallel. Some of them might not be independent, isolated and reproducible. There are times when you have some test methods that might depend on other methods in the test class. That time you should use the parallel test class execution. You may also want to tweak the number of threads and core on which these threads run, using this configuration:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<parallel>methods</parallel>
<threadCount>4</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
</configuration>
</plugin>