Technology news and views
RSS icon Email icon Home icon
  • Apache WINK: Issue with Single-Element JSON Array

    Posted on January 14th, 2011 Sandeep No comments

    For the last few weeks, I have been building a RESTful service using the very fine Apache WINK library. When the service is called, the server sends a response in JSON. One of the response elements was an array; in the resulting response, if the array contained a single element I noticed a strange thing:

    {
      "success": true,
      "subject": "Some subject",
      "origin": {
        "email": "some@email.example.com",
        "fullname": "Full name"
      },
      "listresult": {
        "r1": "yes",
        "r2": "no",
        "r3": "cancel"
      }
    }

    The expected response, of course, was for listresult to be as follows:

    "listresult": [
        {
        "r1": "yes",
        "r2": "no",
        "r3": "cancel"
        }
      ]

    The response class used JAXB annotations to set the element names and all the other good stuff. But for some reason, a single element list resulted in an erroneous response. Now, out-of-the-box, WINK comes configured with JSON4J as the  provider for JSON serialization. This library has an unfortunate side effect where the array serialization shows unexpected behavior: for a single element array, it was simply collapsing the array!

    Which led me to this posting on the WINK user forum. The solution was to use an alternative provider. As mentioned in that post, I decided to go ahead with Jackson, available here. I chose the easier route of simply replacing the JSON4J library with Jackson, both in my build environment and in the WEB-INF/lib folder.

    This approach worked out fine for my needs. If, however, you have multiple services hosted by the same application and want each of them to have a separate provider, I refer you to this excellent post on IBM developerWorks.

    Uncategorized
  • Apache Wink and REST Services in Java

    Posted on December 8th, 2010 Sandeep No comments

    Over the past couple of weeks, I have been evaluating Apache Wink for developing RESTful services in Java. I am very impressed with what it’s capable of. The project is still in ‘incubation’ stage, and implements the JAX-RS v1.1 spec providing both a server component and a client module.

    While I haven’t used the client capabilities yet, the server module is pretty feature-rich. I had some issues getting authentication to work, but I think I have mostly figured it out. Will post an update once I run some tests.

    You can download Wink from this link: http://incubator.apache.org/wink/

    Uncategorized
  • One possible way Square works

    Posted on December 1st, 2009 Sandeep No comments

    Square was launched today. I whipped out a quick diagram (in Dia) of how it might work since it’s not apparent from the website. Correct me if I’m wrong.

    This design provides a simple, extensible solution. The key module here is the card reader which plugs in to any device with an audio jack. At present, of course, only the iPhone/iPod touch feature the Square Up application. I am pretty sure it will soon be available for a plethora of smartphones out there.

    Square Up

    Square Up

    Uncategorized
  • Whoa, didn’t realize November went by

    Posted on November 30th, 2009 Sandeep No comments

    Much was achieved. We launched Call-n-Tweet!

    Uncategorized
  • Root CA of India

    Posted on July 28th, 2009 Sandeep No comments

    When it comes to secure transactions over the web, you probably would’ve seen that a website URL starts with “https” instead of “http”. For a website to be trusted, it needs to have a digital certificate issued by a trusted third party, called the Certificate Authority (CA). Companies like VeriSign and DigiCert are examples of CAs. It is also possible for governments to have their own Certificate Authorities.

    Which is exactly what the Indian Government has. The Controller of Certifying Authorities issues the root certificate for CAs in the country. Essentially, all certificates below this root gain the trustworthiness of the root certificate.

    Unfortunately this root certificate is not included by default in many browsers, so if you happen to visit sites carrying a digital certificate by any of the Indian CAs, your browser may incorrectly try to prevent you from accessing them. The fix for this is quite simple: you need to install the root certificate in your browser.

    The following steps assume Firefox 3.5.

    1. Download the root certificate from the Controller of Certifying Authorities
    2. Open Tools > Options > Advanced > Encryption tab
    3. Click on the “View Certificates” button
    4. In the subsequent “Certificate Manager” window, click on “Import”
      certificate-manager
    5. Browse to the downloaded file (it will be a .CER file) and select it
    6. Firefox will prompt if you wish to trust this certificate. Since this is the root certificate, you can select all the options listed in that dialog
      import-root-certificate
    7. The root certificate should be successfully imported. You are all set to go!
    Uncategorized
  • Gmail Language Selection Feature FAIL

    Posted on May 4th, 2009 Sandeep No comments

    Why? Because it doesn’t exist, apparently.

    The last few days I’ve been visiting maps.google.cz. Today when I opened Gmail, Google decided, for whatever reason, to present me with the Czech version of the site. I don’t speak Czech, and naturally I looked around for a “Gmail in English” or “Change Language” link – but couldn’t find it anywhere.

    gmail-other-language

    Click for a larger image

    Uncategorized
  • Bug on the BBC Website’s Most Popular Stories widget

    Posted on April 3rd, 2009 Sandeep No comments

    Bug on BBC\'s website

    In the last few days, I noticed that the “most shared” stories list on the BBC website has had duplicates. Anybody at BBC notice this?

    Uncategorized
  • Problem with WordPress File Upload

    Posted on April 1st, 2009 Sandeep 2 comments

    I had been having this problem uploading images and what not onto this blog. By default, WP 2.5 presents a Flash uploader (using the SWFUpload library); in case Flash is not available, it falls back to a simple HTML interface. However, when I tried to upload a file, I would get the “Choose file to upload” button but nothing worked after that. Even more annoying was the fact that I couldn’t conveniently fall back to the HTML mode.

    Finally, I found out that WP 2.5 and Flash 10 don’t mix, which was my case. Weblogs.us (my provider) is running WordPress 2.5, and I had upgraded to Flash 10 several weeks ago.

    So what was the fix? Whenever I want to upload a file, under Firefox, I go to Tools > Addons > Plugins, and disable the Flash plugin. This makes SWFUpload present me the HTML interface, and I can easily upload files. Once that’s done, I can re-enable the plugin.

    Uncategorized
  • Kirusa Introduces Video SMS

    Posted on February 18th, 2009 Sandeep No comments

    More info over at the press release. I was partly behind the Video SMS initiative, which is currently being demonstrated at the 2009 Mobile World Congress in Barcelona, Spain.

    Funny part is, I still haven’t seen it in action in a real phone. Most of my testing is done on a Windows computer involving simulators and software phones, plus there are the usual network limitations out here in the US.

    Uncategorized
  • The one thing that’s preventing me from switching to IE 8

    Posted on February 5th, 2009 Sandeep 2 comments

    Okay, okay – so it’s still the release candidate, but I am very impressed with the new Internet Explorer 8 from Microsoft. I have been a Mozilla Firefox user for the last few years, having taken back the web since version 1.5 of the browser. One of the most – and I do mean most – annoying bugs in Firefox is bug #348279, which has to do with keyboard accessibility on web pages with Flash and/or Java plugins.

    Now, people who know me can vouch that I am a keyboard guy. Sure, I use the mouse occasionally for places that really need a mouse; but whether it’s writing documents in Microsoft Word or using Visual Studio or Eclipse to develop software, I know my way around keyboard short-cuts. The above bug in Firefox is just too bad. It’s not the case in IE, and I don’t know about other browsers (I tried Chrome, but ditched it like a hot potato – more on that later).

    What’s preventing me from switching to IE 8 completely? One of the major things that’s still keeping me away is the browser’s delay in opening a new tab when I hit Ctrl+T. It’s very noticeable and very annoying. That’s not the case with Firefox (nor Chrome, I’ll have to give you that).

    I tried Microsoft’s suggestion of resetting browser settings to defaults and it seemed to speed up, but after a couple of browser restarts, it’s back to the old behaviour. If Microsoft can fix that, I’ll switch back.

    Uncategorized