Javascript Unique Syntax



This post is only means for my references, but maybe useful for you

1. Boolean Shorthand Replacement


// Normal
true, false

// Shorthand
!0, !1

// Because true === !0, false === !1

2. Convert to Number


var a = "1";

// Normal
new Number( a );

// Shorthand
+a;

// Result 1

3. Convert to fixed Number


var a = 3.5;

// Normal :
parseInt( a, 10 );

// Shorthand
~~a;

// Result 3

SVN commit does nothing



I run this problem when I tried to commit new folder with some files in my google code repository. I use svn command line from CollabNet Subversion in my windows OS. I accidently found a solution with running a command:

svn commit -m ''

By using commit with empty message has solved my problem :)

It seems the correct one is to use "" (double quotes) when commit something like

svn commit -m "fixed bugs"

Implement Inifinite Scroll to your Blogspot



Many websites, use pagination to limit result of displayed data on the page. The data can contain articles, content, product category, records in the table, search result, and etc. This is some example what pagination looks like:

Pagination Picture

You almost found it everytime when you search using google. But these days, many websites prefer using infinite scroll. Twitter, facebook, youtube, and many more already use it. And the new dynamic Blogger template also has already implemented this technique. The basic functionality of infinite scroll is when user scroll through content and more content will be loaded automatically using AJAX.

Pagination vs Infinite Scroll The different layout between pagination and infinite scroll (taken from smashingmagazine.com)

But can infinite scroll implemented in static Blogger template? Yes it can, by using this jQuery plugin called infinite-ajax-scroll created by Webcreate. It's very cool, because its options can adapt with blogspot layout, and worked really well with blogspot. The plugin also use History API to camouflage the url and handling the back button.

Here's the sample demo

Blogspot Table of Contents - BlogToc



Blogspot Table of Contents - BlogToc

So this is my first post, and in English language, although it's not my native language. So, sorry for grammar mistakes.

Blogger / Blogspot is great service for blogging and many other purposes. It's free and easy to use. But what I observe is lack when it comes for automating table of contents for its post. Table of contents is very important, it's like a navigation for user to easily find what type of contents your site offers. Actually blogspot has its own table of content which what we called it "Archive". But it still lacks something and serves more as post history list rather than as table of contents.

Luckily, Blogspot now has become a part of google products, so it offers API to bring access to developers who want to use its services. One of the services is called Blogger Feed API who doesn't require authentication to use it, as long as the blog is marked as public blog. As far as i know, this API offers 3 output format: xml, json, and json with callback a.k.a json-in-script/jsonp (see developer guide for more details).

So using that API I mentioned above, I decided to create a plugin/components/library/extension/widget or whatever it called to make Table of Contents for Blogspot with JavaScript as base programming language. This library will generate a table of contents for your blogspot site as long as your blog is not set to private. The initial design is like in DataTables example, and you can change it according your own taste. It facilitates with searching, pagination, filter by category or alphabet and can load all your post ( I hope so :) ), and etc...

So without further ado..., click the button to see the working example


Repository