Benchmark: subtring vs substr

After running benchmark for js substring vs substr I found the following results:


(() => {
 let start =;
 for (let i = 0; i < 1000000000; i++) {
	let val = "0.fr8gdqxstse".substring(2)
 console.log( - start);

This gave me run time of 21447ms

With end index:

(() => {
 let start =;
 for (let i = 0; i < 1000000000; i++) {
	let val = "0.fr8gdqxstse".substring(2, 10)
 console.log( - start);

This ran for 21271ms


(() => {
 let start =;
 for (let i = 0; i < 1000000000; i++) {
	let val = "0.fr8gdqxstse".substr(2)
 console.log( - start);

This gave me run time of 25522ms

With size:

(() => {
 let start =;
 for (let i = 0; i < 1000000000; i++) {
	let val = "0.fr8gdqxstse".substr(2, 8)
 console.log( - start);

Run time: 22510ms

After running several iterations, this was average result.

substring runs faster.

I may have missed something. Please comment if you like.

Remove adblock detection script

Just read the article All Eyeballs on Reader Reaction as Ad-Blocking War Comes to India, tried both ToI and HT sites. Ad removal banner is easy to remove, just follow the steps below.

1. Install SafeScript for chrome or NoScript for firefox, whichever browser you are using.
2. Restart the browser and poof no adblock detection will work.


Came across an addon for Firefox few days back. Indian News Anti Anti-AdBlock by Adblock Fan, nice work.Gemoji image for :thumbsup

Install Oxygen OS on OnePlus One

There are the steps to install Oxygen Os on OnePlus One:


  1. Download OxygenOS HERE
  2. On your device, go into Settings -> About and find the Build Number and tap on it 7 times to enable developer settings. Press back and go into Developer Options and enable USB debugging
  3. From your computer, open a command prompt and type:adb reboot bootloader
  4. Unlock the device: fastboot oem unlock (You can skip this step if your phone’s bootloader is already unlocked)
  5. Download latest recovery image from HERE
  6. Run the following command: fastboot flash recovery twrp.img
  7. Reboot the phone by: fastboot reboot
  8. Unzip In there, you will see a file. Copy to your phone. You can use Android File Transfer.
  9. Boot into recovery. You can do this on your OnePlus One by holding down both the volume down key and the power button.
  10. Once you are in the recovery interface, the first thing you want to do is a factory reset. Again, you will lose all your data so please make sure you have backed up everything before doing this.
  11. After the wipe, go to install and find Confirm flash. This will flash OxygenOS onto your device.
  12. After the flash succeeds, you can reboot the device, which will take you to the new OxygenOS. Enjoy!

Never Settle.

Troubleshoot recovery install HERE
More info HERE

2013 in review

The stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 4,500 times in 2013. If it were a NYC subway train, it would take about 4 trips to carry that many people.

Click here to see the complete report.

Varanasi, India: “Beyond” Documentary

I have lived in the city from birth for 24 years. Now I live in another city for my job. I miss my Varanasi so much. But the following documentary has helped me relive my past years again. I loved and enjoyed the work so much. Thanks Joey.

Read the director’s experience here:

Adding crosshair in ExtGWT chart

If you want to add crosshair on hover over chart in ExtGWT just like the chart in use the following code:

// wire up all series to interact with their highlight behavior
LinkedSeriesHighlightHandler link = new LinkedSeriesHighlightHandler(chart);

BarSeries bar = new BarSeries();
//explicitly not binding to a numeric axis, so that we dont care what values we return as our max
bar.addYField(new ValueProvider() {
    public String getPath() {
        return "max";
    public Number getValue(Data object) {
        return 100;
    public void setValue(Data object, Number value) {
//don't actually let them be visible
//not needed if you dont use legend
//no gaps between regions - you may want to play with this

//add a custom series highlighter to show the crosshair through the bar - this really
//only makes sense with multiple other series
bar.setHighlighter(new SeriesHighlighter() {
     private Map oldCrosshairs = new HashMap();
     public void unHighlight(Sprite sprite) {
        PathSprite crosshair = oldCrosshairs.remove(sprite);
        if (crosshair != null) {
       System.out.println("removed, new size is " + oldCrosshairs.size());

     public void highlight(Sprite sprite) {
     //we're especially insistent on only one being visible at a time, aggressively 
     //punch out existing ones

     PathSprite crosshair = new PathSprite();
     RectangleSprite bar = (RectangleSprite) sprite;
     //move to the top of the bar, in the middle
     crosshair.addCommand(new MoveTo(bar.getX() + bar.getWidth()/2, bar.getY()));
     //draw down to the bottom
     crosshair.addCommand(new LineTo(bar.getX() + bar.getWidth()/2, bar.getY() + 

     oldCrosshairs.put(sprite, crosshair);
     System.out.println("added, new size is   " + oldCrosshairs.size());
//The above impl isn't accounting for animations, so we should either 
//disable those or add some animation code in the highlighter. Also 
//remove the animation button below


//disable all shadows to stop the bar from having shadows - a better fix
//would be to add a custom shadow renderer to the bar series that does 
//nothing. Also remove the shadow button below

Install Sencha Touch 2 on Ubuntu 12.04

After trying a lot of tutorials, I finally got hold of one which worked like charm. Here is the link.