Friday, May 27, 2011

My Bookmarks fly to the Cloud

Updated: 15-Mar-2012

With latest version of Google Chrome (I'm using 17.x), you can now directly sign into Chrome from Options->Peronsal and access your bookmarks across computers. You no longer would need to export the bookmarks to Firefox using the Google Toolbar for Firefox, which is no longer supported by Google. The Google Toolbar is now available only for IE.

Original (dated) article below ...
-------
I have a queer problem of too many! I surf a lot, I subscribe to a lot and I bookmark a lot. Some numbers: 1 laptop and 1 netbook at home, 1 laptop and 1 desktop at office, sometimes its my Kindle and definitely my N900 when I'm on the move. So 6 devices out there and usually 2 browsers on most of them (yes Kindle only as one webkit based experimental implementation).

So my bookmarks are all over the place, scattered over at least 10 different places. And each time I'm working on one box, I wish I had access to the bookmark I made a few hours ago on the other box. And forget the upgrades. Its a nightmare. Backup everything and then restore. What a pain!

So here comes the cloud to the rescue. I decided to move it all to the cloud! Definitely sounds better than "I decided to move it all to the web". I decided to use Google Bookmarks to store all my bookmarks in one central place so that I can access them from anywhere, from everywhere. No export-import/migration-upgrade issues. Well to be precise just one final time and then no more! I had to move my current bookmarks right ...

Here are the steps on how to move all your existing bookmarks to the Google Cloud. The basic approach is to export existing bookmarks from all your browsers, i.e. Chrome, IE, Opera to Firefox and then using Google Toolbar for Firefox to publish these bookmarks to the cloud. Yes you read it right, even Chrome bookmarks have to be pushed using Firefox. There is no other option available in Chrome at present. Somebody definitely forgot something :P

Export Bookmarks:

No need to export bookmarks to a separate file from IE and Opera. Firefox can handle them direct. But you will need to export bookmarks from Chrome as below:

1. Open the Chrome wench or settings icon and select Bookmark Manager
2. You get all bookmarks listed in a new tab
3. Select the Organize -> Export Bookmarks
4. Enter the html file and location where to save your bookmarks

Import Bookmarks to Firefox:

Now lets centralize all bookmarks into Firefox. Follow these steps:

1. Press Ctrl + Shift + B or click on the Firefox Menu on top left and select Bookmarks -> Show all Bookmarks to get to the Bookmarks Library dialog.
2. Now click on Import and Backup -> Import HTML... to open the Import From dialog.
3. Select Opera and run through the steps
4. Repeat the above steps for IE and get in the bookmarks.
5. Finally select the From an HTML file and point to the html file exported earlier from Chrome.

Now all your bookmarks are in Firefox. You can verify this by checking the available Bookmarks from the drop down.

Publish to the Cloud:

Now get Google toolbar for Firefox from this link: http://toolbar.google.com

Once installed you will see the Google toolbar come up in your browser. Select the Bookmarks drop down menu and click on Import Firefox Bookmarks.

This will now take you to Google Bookmarks page with all the Firefox bookmarks listed. You can multi-select all the bookmarks that you want to push to Google Bookmarks and finally click on the Import button.

Hurrah! All your bookmarks are on the cloud now and accessible at www.google.com/bookmarks. You can now create lists, set bookmark permissions, share the lists with others and even tweet about your bookmark lists.

Wednesday, May 25, 2011

A Custom Blog and 404 errors!


I struggled for over a day with 404 errors and domain mapping issues and finally figured out the simple steps to set up my Google blog mapped to my custom domain. I also managed to add an alias to this blog site. Just jotting down the steps here for future reference ...

You would've created your blog under the name say:
myblog.blogspot.com

Now you want to move it to your custom domain which you just purchased say:
www.mydomain.com

Also you might want to map blog.mydomain.com and mydomain.com to land the user on your blog page directly. The latter is called a "naked" domain and has to be handled as this is not mapped by default.

Steps to create custom blog at www.mydomain.com

1. Go to your blog Dashboard (link is on the top right of your screen)
2. Select the Settings tab
3. Select the Publishing tab
4. Click on the Custom Domain link and switch to Advanced Settings
5. Enter your domain name here  www.mydomain.com
6. Check the "Redirect mydomain.com to www.mydomain.com"
7. Enter the captcha and save settings.

Now you will see that on entering www.mydomain.com, you directly land on your blog page.
Entering the naked domain mydomain.com also lands you directly to your blog page.

But if you try blog.mydomain.com, you will get a page not found error. Yes of course, its never been mapped so far!

Now we'll add the mapping to blog.mydomain.com. You could directly map to the subdomain in step 5 above if you have your own home page.
But then accessing www.mydomain.com will give you an error if you've just registered and don't have your home page ready. It happened in my case.
So I intend to soon move the blog from www.mydomain.com to directly blog.mydomain.com.
But for now, both of them map to the blog site.

Steps to map to http://blog.mydomain.com

Go to your domain name provider's webpage and login to administer your domain. For me it was https://access.enom.com.

In the Host Records section, click on edit and add the following records:
Host Name: blog
Address: http://www.mydomain.com
Record Type: URL Frame

Save the settings and in your browser try to access blog.mydomain.com, you will be taken to the blog and the URL remains at blog.mydomain.com
If you had chosen URL Redirect in the record type above, it will change the URL in your browser to show www.mydomain.com, which might not be what you want.

If you are finding issues in the mappings and getting errors, and feel totally stuck, switch your blog from custom domain to blogspot and then switch back. This will clear any wrong settings done in your mappings. Go through the above steps and you should have it working.

So finally, Happy blogging !

Tuesday, May 24, 2011

Falsy JavaScript

In continuation of my previous blog on the basic JavaScript expressions, this blog is about Falsy and Truthy values in JavaScript.

When presented with a non boolean expression instead of a boolean value, JavaScript uses Truthy or Falsy values instead to determine the result. At first glance, this could be confusing and could lead to errors while scripting.

var a = "someval";
var b;
if (a) { // this is a truthy
    // Block is executed
}
if (b) { // b is undefined and so a falsy
    // Block is not executed
}


The Falsy Values
All expressions, objects and values are Truthy by default. There are exceptions and they are called the Falsy values and are listed below:
  # The empty string; ""
  # null
  # undefined
  # The number 0
  # NaN
  # The boolean false

It gets tricky
If you see the below table, you will note that it gets tricky or rather one should be a little extra careful while dealing with Falsy values.

ExpressionValue
Falsy Values
falsefalse
NaNfalse
undefinedfalse
0false
""false
nullfalse
Truthy Values
Infinitytrue
truetrue
1true
"1"true
"0"true
Complicating things now
0+0false
0+"0"true
"0"+"0"true
1-1false
"1"-1false
"1"-"1"false
Double Negation
!!0false
!!1true
!!"0"true
!!"1"true
Logical comparison
null == nulltrue
null == undefinedtrue
null == NaNfalse
null == ""false
null == 0false
null == falsefalse
undefined == undefinedfalse
undefined == NaNfalse
undefined == ""false
undefined == 0false
undefined == falsefalse
NaN == NaNfalse
NaN == ""false
NaN == 0false
NaN == falsefalse
"" == ""true
"" == 0true
"" == falsetrue
0 == 0true
0 == falsetrue
false == falsetrue
Strict Logical comparison
null === nulltrue
"" === ""true
"" === 0false
"" === falsefalse
0 === 0true
0 === falsefalse
false === falsetrue
Arrays
[ ]true
![ ]false
[ ] == truefalse

To remember:
# An empty array evaluates to Truthy whereas any boolean operation on an empty array results in a Falsy
# NaN is not equal to anything, not even itself
# Undefined is not equal to anything, not even itself
# Use strict equals (===) to be extra sure while comparing. This compares by type and value
# Avoid using Falsy value and stick to plain  true or  false to be sure of the results.

Now that you have read this far, Congratulations! I expect 0 bugs from your code henceforth :)

JavaScript - Undefined Infinity or Not a Number?

Had a heated discussion with a friend about a particular expression and so this blog with ready references for some basic JavaScript expressions.

ExpressionValue
InfinityAnything beyond +/-1.7976931348623157e+308
typeof Infinity"number"
typeof NaN"number"
typeof undefined"undefined"
typeof null"object"
Infinity + InfinityInfinity
Infinity - InfinityNaN
-Infinity + InfinityNaN
Infinity / InfinityNaN
Infinity * InfinityInfinity
Infinity * 1Infinity
Infinity / 1Infinity
Infinity / 0Infinity
Infinity * 0NaN
Infinity - 1e308Infinity
Infinity - 1e309NaN
-Infinity + 1e308-Infinity
-Infinity + 1e309NaN
Infinity / 1e308Infinity
1 * "a"NaN
1 + NaNNaN
1 * NaNNaN
undefined + 1NaN
undefined * 1NaN
undefined + InfinityNaN
undefined * InfinityNaN
undefined + NaNNaN
undefined * NaNNaN
undefined + nullNaN
undefined * nullNaN
1 + null1
1 * null0
null + null0
null * null0
Infinity + nullInfinity
Infinity * nullNaN
NaN + nullNaN
NaN * nullNaN
"" + Infinity"Infinity"
"" + NaN"NaN"
"" + null"null"
"" + undefined"undefined"

Having fun yet ?

Monday, May 2, 2011

India's first KDE conference

This article was published in Qt Blogs here. Thanks to Alexandra and Qt Community for the same!

I recently attended conf.KDE.in at the RV College of Engineering in Bangalore. It was the first KDE conference ever held in India, and it was followed up with two days of code sprints attended by over 300+ people. I’m pretty late with this write up, but better now than never.

KDE-India is a growing group of volunteers totally committed to contributing to and popularizing FOSS in India. The event was primarily focussed on introducing KDE and Qt to young developers still studying engineering butof course there were also a fair number of professionals like me.

In short, above all else, it was tons of fun. I networked with people, shared knowledge, promoted the Qt DevNet India group and even had the chance to watch live break dancing on stage – not once but twice! That’s Knut Yrvin for you, a great speaker with some special gifts needed for a Community Manager.

There were great sessions held over 3 days and I actually regretted that I could be at only one place at a time. I managed to attend a few great sessions like Qt for beginners (by VCreate Logic), and their session on the really cool VTK Designer tool and GCF framework. I made sure not to miss sessions by Adriaan de Groot (VP KDE e.V.) and of course Knut. He was literally mobbed on the final day for photos and autographs.

One new pleasant thing I came to know about Qt (and I suspect it was news to most of the attendees there) was the KDE free Qt foundation, which you can read more about here. There were a lot of questions as to where Qt was headed and some very good answers.

Sessions on KDE.edu by Anne-Marie Mahfouf and also on Calligra by Inge Wallin were captivating. I’m now looking at contributing some time to KDE.edu; they are up to some pretty neat things. I topped off the third day by listening to the ins and outs of Model View Framework by Volker Krause. Unfortunately, I had to miss out on the code sprints.

Kudos to the group of volunteers organized and led by Pradeepto B. to make this a reality. They showed an amazing drive and conviction and it was fun to see the entire audience walk up to Pradeepto after the closing note on the final day to give him bear hugs, thanking him for bringing a KDE conference to India.

This was my first Open Source conference and it was a really good experience. I could pester long time KDE contributors with questions on how things work, where the whole of KDE is headed towards, and more. If you ask me if it was worthwhile and rewarding for one to spend time on it, my answer is a big YES!