posted from Bloggeroid
Saturday, February 8, 2014
Tuesday, January 21, 2014
Continuing with the Modernizr series, we now start with the implementation.
So how to go about implementing these compatibility checks?
Listing 1 provides us an idea about implementing the user-agent header check (a.k.a. UA sniffing).
Listing 1: Function with user-agent header check
Though UA sniffing has been a standard practice, nevertheless it poses some issues. Considering the above example, we are faced with the inability to ascertain the exact ‘MSIE’ version in this case. Moreover, it also doesn’t provide any function specific checking.
For checking versions, the workaround is to use the navigator object in combination with regular expressions to detect the various browsers and their exact versions.
Specifically, we would query the navigator.appName and navigator.userAgent properties. However, using this approach again won’t solve the feature detection handicap mentioned above.
It would be both faster and more reliable to have the ability of using probing functions which can confirm the availability of objects, methods, attributes and so on (i.e. catering to the 4 points mentioned in the previous section)
We can always create these probing functions which then query for the required stuff, and if not found return null. But the overheads for these custom monitor functions increase if we are having a big web based project, intended to run on multitude browsers.
Sunday, December 29, 2013
If you have kids, then this post is for you!
Llifehack has a wonderful collection of 20 Excellent Websites That Make Your Children Smarter!
The post has a collection of links which will help you raise smarter kids. Internet is a strong medium, provided you know where to draw the line. Posts like this are what make it usefull.
Monday, December 9, 2013
The web-browser is a primal connection between any online service and a prospective user or client. With changing standards and old browser versions as common as they come, the need to evaluate ‘browser vs. new feature’ compatibility is now more important than ever.
Here-in I will give an introduction to the excellent Modernizr API. I am breaking this in easy to read parts, so stay tuned!
Introduction - HTML 5 & CSS 3 features
We know the importance of standards in the World Wide Web, one of which is the HTML markup standard. The HTML standard prevails as the ubiquitous structuring and presentation language for the World Wide Web.
HTML5 or the fifth iteration of HTML enables the provision of ‘beyond mark-up’ features, which until recently were available only by use of third party plugins. A good example of this is animation and video for web pages.
Web animation has long been a forte of Adobe’s Flash, which provides a rich end user experience. But the fact is that it is capable of burdening the bandwidth and occasionally causes memory issues for most modern browsers (this is especially prevalent in tabbed browser sessions having several flash widgets).
As far as the video is concerned, the HTML5’s canvas element makes it very easy to integrate and manipulate video related elements.
Rounded corners, fancy menu support, rich background integration etc. all these ultimately work towards enhancing the overall end user experience.
An important factor which spearheaded or necessitated the integration of external features in the current HTML and CSS standards are the multiple and evolving information access techniques, namely mobile devices.
With diversified ecosystems and non-uniformity in standards, it is nothing short of a ‘developer’s hell’ to develop a ‘code-once run-anywhere’ solution.
For example, it is common knowledge that Adobe’s flash has support issues and known incompatibility on some Apple as well as Android devices.
Hence, we needed standards like HTML5 with CSS3 for designing cross-platform solutions.
Why do we need feature compatibility checks?
One aim is common across all of the modern day Web-browsers – to render the Web pages optimally and according to the latest specifications. But sadly, this attitude wasn’t there in the past.
Browser providers have had the habit of implementing exquisite, unique and popularly demanded features in their own unique manner, which eventually led to a broken standard ecosystem.
Although this seemed to suffice as far as the end-user is concerned, the developers got the short end of the stick! Actual development became difficult since these custom feature implementations had to be taken care of at the coding level.
In the current scenario, the latest versions of nearly all browsers agree to the scope and viability offered by the feature-rich HTML5 standard. But HTML5 itself is still evolving.
The major HTML5 APIs (2D drawing, offline web applications, video and audio, DOM Levels, CSS3 and so on) are still not out of their core development cycle and are continuously changing.
If we talk of individual browsers, Firefox, Chrome and Opera are early standard adopters, which is a two edged sword in itself, since issues pertaining to security etc. could still be waiting to be discovered.
Talking of Microsoft’s Internet Explorer, it is nearly always at the end of the adopter line and is slow to support the common HTML5 features prevalent today.
On one hand while we as developers wonder how our application will run on “pre-HTML5” browsers, on the other we are never quite sure of what hardware and software combination our product or service would eventually be accessed on (a fact given shape due to many nonstandard mobile platforms)!
But the thing is that there is no fully HTML5 compatible browser.
HTML5 in itself is not a product or end feature; rather, it is a collection of individual feature evolutions.
Hence, our aim is to detect support for newer features (like canvas, video, or geolocation), and thus here-in comes the need of feature compatibility checks.
What checks exactly are required for ensuring compatibility or available features?
Each and every web-page in a browser is rendered according to its DOM (Document Object Model). In short, the DOM presents all the available HTML elements on that page to the browser.
So basically, if we need to check for compatible features, we need to check the DOM elements themselves.
The actual checks should include the following basic parameters or criteria –
1. Checking for a core property at a global level (e.g. a browser’s geolocation capability)
2. Checking for a property at an element level (e.g. a video element)
3. Check if an accessible method or function is available for the element & check the method calls for both getters and setters (e.g. if a video element is available, check for a specific video format support, or set the format for the current video element)
4. Check if the properties set by the above setters are retained.
In the up-coming parts, we will visit the compatibility check options, their implementation and how modernizer steps in as the leader of the pack. So stick around!
Thursday, November 7, 2013
Is your USB drive genuine OR How to test your USB thumb drive / memory card to ensure it is not a Banana!
7-Nov-2013 – NOTE: – I am bumping this old post and would be updating some parts of it with newer utilities out there (will be monitoring new stuff and adding as I find it) So keep checking
1. PC Advisor has an article on the same here.
2. Our dear ‘friend of the nerds’ Nir Sofer has an up-to-date page for ‘USB Flash Drive Speed Tests - Any Drive Size’. Provides good comparison with accurate data!
Now follows the original article as below --
NOTE: I recently did an article (hosted on Experts Exchange) WRT the said topic.
I wanted to add some stuff bit to the original to make it a bit easier to follow, thus am presenting the result below.
If you are planning on buying a USB drive from eBay or any other popular online e-commerce site, chances are that in spite of those high seller ratings, you may still end up getting a counterfeit!
Popular USB drive makers like Kingston, Transcend and the like are much more likely to be duplicated.
And when the sole usage of your latest thumb drive is going to be that crucial back-up routine, it becomes vastly important that the drive itself is trust-worthy and pristine, lest it ends up as a double whammy!
It becomes even more difficult when the forged units sport nearly 100% original looking packaging. And bar-codes and serial numbers are something too complex for an end user to verify until the same are verifiable online @ the drive maker’s website.
But wait, what exactly are counterfeit drives?
Counterfeiting in USB drives involves hacking of a USB drive’s firmware (basically a low-level editing of the firmware) so that the drive’s specifications report a higher than actual capacity (of the physical NAND chip on board)
As a result, when you try to write data to the drive over and above its actual capacity, your data gets stored as corrupted.
So, how can you actually go about validating your purchase as an actual genuine item?
1. Be aware of fake sellers!
An obvious first step would be to avoid buying from already proven fake websites and sellers. A nice catalog of this information is available online at the FlashDriveFacts site (URL: http://flashdrivefacts.wordpress.com/)
A problem here is that this site itself hasn’t been updated since February 2012. Nevertheless, it provides a good starting point. If you are betting on an eBay seller, you can check the seller’s rating and customer feedback too. Obviously never go in for buying from a seller already proven as dubious!
2. Be aware of original markings and counterfeit indications!
Another obvious second point would be to “research a bit before going in for an online purchase”. As simple as this may sound, many people fall in the irresistible deal trap.
When you are still contemplating the actual buy and are yet to place the online order (or visit a physical store), remember to Google and search for the exact model and its original price online.
If your seller’s deal is too good to be true and the price difference seems substantial, it would pay to be cautious, and be absolutely sure about the product being genuine!
Also, search for images of that model online and try to know before-hand how an original drive would look like. If yours is any different (as shown in online previews) feel free to question the seller.
You could also lookout for certain markings / engraved information on the USB drive’s body (see below image for reference).
Although this would not hold true for all the drive manufacturers out there, but makers like Kingston have made it a practice to engrave model related information on the steel USB plug. This marking is also verifiable for HP thumb-drives out there.
Moreover, Kingston also offers following URLs for online verification of its many products –
· For all memory products (including memory module/RAM modules) refer the URL –
· For USB Flash Memory Products refer the URL – http://legacy.kingston.com/asia/verifyflash/
· For visual product verification please refer – http://www.kingston.com/us/support/product_verification
3. Use software tools when you cannot decide or the forging is not that obvious!
Certain tools for testing out USB blanks are slowly becoming a sure shot, one step verification standard.
These can actually be used both for detecting the bogus USB as well as to check the actual / real world performance (i.e. capacity / operating speed and so on) and other advertised specifications.
The most popular and commonly used application of the lot is the H2testw which is the much proclaimed “Gold Standard in Detecting USB Counterfeit Drives”. The last documented version is the H2testw 1.4.
NOTE: this application is capable of testing USB thumb-drives as well as SD cards (Mobile/camera based MMC cards) memory cards!
The link discusses the counterfeit issue as well as the usage of this excellent piece of software. Although the application is hosted by a German site, the direct (German to English translated) link is http://translate.google.ca/translate?hl=en&sl=de&u=http://www.heise.de/software/download/h2testw/50539&sa=X&oi=translate&resnum=2&ct=result&prev=/search%3Fq%3DH2testw%26hl%3Den%26sa%3DG
The actual direct download URLs for the application are –
H2testw 1.4 Usage
1. Launching the application’s executable leads to the following UI –
2. Choose you language as English (or Deutsh if you are German!)
3. For best results, ensure that the drive to be tested is already backed up and formatted, as the test performed is data destructive. So copy off any data and format the drive already!
4. Select the target USB – browse and select, here H: is selected –
5. Select the option to “Write + verify”. The test will start and a similar window is displayed –
6. Wait for the test to complete and the results to display. On a large capacity drive, this would take some time. So sit back and let the application do its job J
7. After the completion, a similar looking test result is shown –
a. Sample Output for an authentic 2 GB Drive (what I tested on my machine)
The above is a pass message for a valid/authentic drive.
b. Sample Output for a Fake 64 GB Drive (from the sofakeflash site’s H2testw page (http://sosfakeflash.wordpress.com/2008/09/02/h2testw-14-gold-standard-in-detecting-usb-counterfeit-drives/).
Making sense of the test results –
Evaluating the above FAKE USB result, it is clear that a 4GB flash drive is masquerading as a 64 GB flash drive. Imagine the seller’s and the fake USB creator’s audacity!
Moreover, since a genuine 4GB drive should be about 3.9 GB after formatting (and not 3.8 GB), the difference indicates that some sectors are obviously not usable and have been marked as bad. This further indicates a low quality NAND chip.
So once you start using the drive beyond 3.8 GB capacity, the data will surely be un-recoverable
Oh no! I actually have a fake drive? Now what?
If your test results indicate a fake USB at your hands, you can approach the seller on eBay (or your e-commerce site) and tell him the situation. Thanks to H2testw 1.4, you have the required proof too to back-up your claims.
Most sellers would be quite forthcoming in helping you get a replacement or a refund. But In case of issues, you can always post comments on the e-commerce site with a copy of this report.
Following which, any self-respecting seller should be willing to help you, as the reputations are what eventually would get them their business.
The above is a short illustration about the ongoing counterfeit racket and the capabilities and usage of H2testw 1.4, which is quite easy in its usage and informative as well with its detailed report.
It can even test 64 GB media and finally report its detailed results in case of failure (as shown above).
For reference, you can check out the excellent article at Raymond’s site How to check and Test USB Flash Drive (Link - http://www.raymond.cc/blog/how-to-check-and-test-usb-flash-drive/).
Hope the above article helps you to keep counterfeit USBs at bay!
Tuesday, September 24, 2013
Hey Droid-o-holics, Android is 5 years old today… and with the hugely successful release of Android 4.3 a.k.a. Jelly Bean, Google, it seems, is trying hard to make all the right moves and getting there too!
Andy Rubin would be so proud!
Verge has covered the journey of Android right here… and quite nicely too.
And to top it all, the Jelly Bean's successor (Android 4.4) a.k.a. KitKat, is supposedly around the corner.
So where’s the party?
Thursday, September 12, 2013
Thursday, August 15, 2013
All work and no play makes jack a dull boy… but all work and no household chores will make any respectable husband getting labeled as useless!
Fellow husbands, read on…
So, this is something which is not about gadgets or coding, but about… life-hacking!
This hack has been ‘discovered’ and not invented, but nevertheless should be quite useful for my fellow brethren.
If your room’s ceiling fan has been getting slow with passing days, wait before calling that electrician. Maybe its just time to …. clean your fan!
Yes, just clean the blades of the friggin’ fan!
The accumulating dust on the fan-blades creates friction and also the precise angle required for air generation is countered.
So this can be tried before you call your electrician. No harm in trying it, and its free!
Also, to clean the blades of the fan, just use an old discarded pillow cover (get this from your wife, please do not guess!)
Just cover the blade with the cover, and rub the blade from the end to the tip, collecting the dust in the cover, easy! The cover collects the dust and prevent it from falling over, on your bed.
Simple genius, isn’t it?
The best part is, you *should* get some extra brownie points from your significant other, which as any husband knows, is a rare and significant event (in other words, totally worth it!)
So by all means, go and try this out, Tim Allen would be so proud!
Sunday, August 4, 2013
Thursday, August 1, 2013
I just read a great discussion on how Log4j 2 is awesome!
Being a developer, this is great news! And it is coming up to be a worthy successor of Log4j and seems to provides significant improvements too!
The improvements include -
- API Separation
- Improved Performance
- Support for multiple APIs
- Automatic Reloading of Configurations
- Advanced Filtering
- Plugin Architecture
- Property Support
Many of these follow the positives of LogBack (which has been touted as a successor to Log4j).