Saturday, March 9, 2013

Opera Beta User Agent String (Android)

I just downloaded the latest beta of Opera onto my Gingerbread phone and it's now running on Webkit. Of course, the first thing I did was look up it's user agent string. :-) Here it is:

Opera/9.80 (Android; Opera Mini/14.0.1025/28.4150; U; en) Presto/2.8.119 Version/11.10

My initial impression of the browser?? Not bad!! It scrolls a lot smoother than the default android browser and the UI feels very intuitive. It has an "Off-Road mode" that's supposedly saved me 98% data thus far. Not sure how it's measuring it, but it sounds good. I don't see any kind of developer options yet, but they're still in beta, so I'll cut them some slack.


Saturday, September 8, 2012

HTML5 support in current PC browsers

Hi there.

I just wanted to post up some quick numbers on how well some of the non-mobile browsers I have on my mac (sorry IE!!) are keeping up-to-date with the (currently proposed) HTML5 recommendations so far. These numbers are the scores received on the website html5test.com. All scores are out of a maximum score of 500. Here they are:

  1. Google Chrome 21: 346 + 9 bonus points.
  2. Safari 6: 366 + 8 bonus points
  3. Firefox 15: 346 + 9 bonus points
  4. Opera 12: 385 + 9 bonus points
Unsurprisingly, Opera leads the pack, with Chrome and Firefox in second. Overall, these numbers have increased quite dramatically over the last few months, which is quite encouraging to developers, designers and (I'm sure) business folks!! More to come in the following posts.....

Cheers.

Friday, December 9, 2011

Tip of the day - Compare syntax

A good practice when checking against null, nil or any value (such as an integer) is to use the following syntax:
if(nil == object)
This avoids the situation where, if one uses the single equals to (=) instead of the double equals to (==), a compiler error will be generated and no executable created. On the other hand, if the other (more commonly used) syntax such as the following is used, no compiler errors would be generated:
if(object == nil)
The above code would also run as expected. However, if I wrote
if(object = nil)
this would cause the object to be set to nil and could lead to mysterious behavior when the program runs. The code may not be as natural to read, but does help in avoiding the obvious pitfall.

Saturday, October 2, 2010

jQuery, XML and XSLT (jqXSLT)

Hey.

jQuery has been a boon to JavaScript programmers and designers ever since it's introduction. With the official support of Microsoft with it's inclusion in MVC frameworks and the default application in VS 2010, it's here to stay!!.

Anyway, while having an extremely "jQuery"-fied conversation with a buddy of mine, I decided to put together a simple jQuery extension that puts data into a DOM element given an XML and a XSL document. The documents could either be provided as URLs or as JS objects in code. The syntax is pretty simple:

//HTML snippet
< div id='content' >< /div>

//JS code
$(document).ready(function(){
$('#content').xslt('XslDocument.xsl','XmlDocument.xml');
});

Simple enough? The extension itself if less than 3kb (lesser than 2kb minified). This example has been tested in the following browsers:
  • Firefox 3.6.10
  • Chrome 6.0.472.63
  • IE 9 beta (9.0.7930.16406)
  • Opera 10.62
  • Safari for Win (5.0.2)
Here is the jqXSLT.js file I wrote as well as compressed versions of all required files. Run "test.html" from either of the compressed files to view the example. Note that the example does not work in Chrome when run as a local file. This is due to the security restriction (that's also labelled as a bug here) in Chrome that prevents reading local files using AJAX. There's a work-around suggested as well there, though I couldn't get it to work. Take a shot it it and let me know if it does work for you!!

jqXSLT.rar
jqXSLT.zip
jqXSLT.js
jqXSLT-min.js

Cheers.

Wednesday, June 2, 2010

My new Nokia Neuron and the S60 app

Hey.

I just purchased a Nokia Neuron from Costco (for T-Mobile) for $120, along wih the unlimited internet data plan for just 10 bucks!! Yep! For some reason, the Neuron isn't considered a smart phone, although it has a lot of it's features. A few of them are listed below:

  • Preloaded with Ovi maps, the free navigation software from Nokia

  • The Ovi app, which gives one access to plenty of apps written specifically for the phone and platform (called S60)

  • An accelerometer thats nice to view/type in portrait mode


One of the things it lacks is support for WiFi networks, but that's negated by the cheapest data plan around. It comes with a 2GB micro SD memory card (expandable to 32 gigs). Not much else is loaded on the phone, but it's easy to fill up the 2 gigs with all the apps from the Ovi store. Besides, there are plenty of websites around from where one can download free apps, music, themes etc. Just search for "S60 free applications" in Google and you can download and install any app.

I'll post some pics and reviews of the phone soon. And yeah..have also submitted an app to the Ovi store that reads the RSS feed from this blog and displays it in a default application skin. Here's where I went to create it:
Ovi app wizard beta

Their developer program is currently closed but I'm hoping to get my hands dirty soon with writing some apps I'd like to see in the Ovi store.

Cheers.

Tuesday, March 30, 2010

HTML5 getElementsByClassName

Hi.

Here is one great addition to HTML5 I had nearly forgotten about. The function "getElementsByClassName" has been added to nearly every javascript framework in existance, and now it's part of the (upcoming) standard!! Wohoo!!! And here's the best news...it's already supported in all the latest browsers (except IE (8), of course!!).

Here's a simple way to check if your browser supports it: Click here

I've added the detection of this function to the detections files I've been blogging about. In addition, I've included a minified version of the file (using the YUI compressor).

Here is the updated zip file: Html5.zip

Cheers.

Monday, March 8, 2010

Simple worker example in HTML5

Hi.

I just added an example of workers to the HTML5 detection and examples code on which I talked about in my two previous posts. Workers are, undoubtedly, the most interesting feature of the HTML5 specs. A lot of the specifications derive from the work done by the Google gears team. Kudos for finally bringing multi-threaded applications to the web!!!

Here's a statement on web workers in the current specifications:

This specification defines an API that allows Web application authors to spawn background workers running scripts in parallel to their main page. This allows for thread-like operation with message-passing as the coordination mechanism.

It also has the following statement:

Workers are relatively heavy-weight, and are not intended to be used in large numbers. Generally, workers are expected to be long-loved, have a high start-up cost, and a high per-instance memory cost.

Example initialization: (in parent page)
var worker = new Worker("worker.js");
worker.onmessage = function(){}

In worker.js:
postMessage();//used to send a message back to the "parent" thread.

Currently, most browsers support just strings being passed as messages, although the developers working with the W3C are also trying to get it into the specifications to pass around generic objects.

There are also some stipulations on what can be done within a worker thread:
  1. Workers have no access to the DOM
  2. Workers do not have direct access to the 'parent' page.
The first point above means that one cannot do any DOM manipulations within the worker thread. i.e. no access to document, window, document.body or any of the DOM elements.

The second stipulation means that the worker thread can communicate with only it's parent thread, and cannot call any functions or use any variables on the "parent" page that initialized it.

The demo I have put together works quite well in Chrome 4 and Safari 4. The demo works quite weirdly in FF 3.5, but only for the "terminate" call, where it seems to terminate the worker thread after a random period of time after I click the "Stop" button. However, that might be due to Firebug or any other extensions I may have installed. Do let me know in case you experience otherwise.

Here is the zip file once more: Html5.zip

Cheers.