27 February 2007

The new Ning, polished and shiny!

Ning had been out for quite a while the whole of today (26th evening for my eastern readers). Readers in that time would have seen my blog going all whack, because all my scripts are stored externally using Steve's excellent Jscripts repository. Nonetheless, Ning is back up now, and ain't I glad it is! Developers at Ning had taken the giant down to upgrade it, and add new features. And by the looks of it, they've changed the terminology as well as made a few changes to how they define themselves.

Ning is the only online service where you can create, customize, and share your own Social Network for free in seconds.

Well, that's what 'they' say. They've gone away from calling them apps, and now call them 'networks'. So that would be the Jscripts 'network' now :P I don't know why they chose to go this way, and label themselves as a free 'network' host. I had written about how we need more Nings, because it provides a perfect place for people to start making web applications, and share them with the world. Usually, doing something like that requires you to have your own server and hosting, but Ning solves that problem. It's a great place to start out, or have basic applications to work with.

Although, in the past it has been seriously underutilised, with extremely useless applications hogging up their servers. This changed in the past year as more and more people realised and understood what Ning was actually about, and began to use the resources given to them properly. It still needed a good knowledge of programming languages like PHP (Ning's backend is solid PHP), so the quality apps only came from hardcore programmers and geeks. I guess Ning felt they had much more to offer than what people saw. Hence, their new approach is probably justified.

Ning CEO Gina Bianchini says growth has been strong and steady. Nearly 30,000 applications have been created to date, up from less than 5,000 a year ago. Page views have been spiking, reaching 20 million per month, 20x traffic a year ago. Unique visitors have reached nearly 5 million per month as well, 10x a year ago.

Well, they're a swell resource to exploit! :)

Ning now

Ning now boasts a completely refurbished interface, that drives just one point home. Ning is a 'quick social network creation tool'. As simple as that. Modules litter the place waiting to be drag-dropped into your new application, which seems to be the new formula of making applications for complete newbies succesffulyPipes does this with grace, allowing a similar approach. It's rather hard to hit a balance in design and functionality between making it for alpha geeks, or complete newbies. This seems to find that balance quite well..

This should give them the numbers - whether in terms of page views, or page use - they want. However, I really wish they wouldn't go down this path, and keep things the way were before. Tapping the coder's market was something extremely new. What Ning 'did' was extremely well thought idea, which is why caught it on slowly at first, but then the jump. Opening it to newbies like this will give rise to useless content which will unnecessarily clog their servers. The take-down for the upgrade was the first long time downtime Ning suffered in the last few months, after struggling with many downtimes early on. Just shows that they've become a stable deployed system, and can be trusted with important data now.

Nevertheless, it is a solid updgrade, with servings being faster now (they sure feel fast). I am going to continue working on/with Ning to develop a few apps. If you haven't tried it, I'd recommend you start now! Let's see what the new Ning can 'really' do! ;)

Further Reading

A Demo of the new Ning - The Ning Blog
Ning In Full - TechCrunch
Ning: let ‘000 Social Nets Bloom - Om Malik on broadband


Update: Stephen and I noticed something interesting. As of writing this update, the Ning app.. err..network view is down, but it is still generating outputs. If this is a feature of the update, then it's amazing! This means that when Ning goes down for maintenance, the networks will provide the output we depend on. I hope this is true! :)


26 February 2007

What Web 2.0 Actually Was

The Web 2.0 boom was something that stirred everybody and everything that had a remote connection with the Internet. Startups, mashups, networks ... you name it! Everything began to appear everywhere you looked. We called it 'opening the Internet to the people'. But was it really that? Thinking back at everything that has happened, everything we call and label 'Web 2.0', I realised that it can be put together with a better definition than what we've come to call it.

Web 2.0!!

Web 2.0, or the second generation Internet, served the purpose of defining the Internet as an application platform. Very simply put, it opened up the minds of (many more) people to the possibility of creating applications (or apps, as we call them) and developing them for the Internet. Adding functionalities, features and throwing it out to people for use, all pretty much free of cost and with minimum production glitches, well, at least for most. It makes sense! :D

Every social network or startup that you've seen since the boom offers some kind of a service which boosts inter-connectivity or exchange of data between people and applications. They became interfaces, becoming the middlemen between people and data. Offering choices as to how the user would like his data, it 'opened' up the Internet' to the 'people' to the data and technology that already existed. If you'd have noticed, close to nothing new was created during the entire time Web 2.0 was so heavy in our lives. Concepts were mixed and matched to organise the data better, and then present them to a user.

FeedsJSON became the format of choice for all developers, since it made transfer of data so easy, because of the format it uses. It also allowed a refreshing workaround to cross-domain AJAX calls. was one of the few creations and genius of this time, with many services depending on it. Bookmarking / Tagging was another, which served to just organise the data and make it shareable amongst people. Social Networks had existed before, but got more exposure thanks to the 'Connecting people' approach.

If you're thinking about the Web 2.0 'look' and other peripherals, then all I'll say it was just things that piggybacked on the success of the buzzword doing the rounds. The look was a simple, fresh, eye-catching and functional design, and the reason it was labelled Web 2.0-ish was because it did visually what applications did with data. It provided a simple interface between people and content/data.

So now what?

Well, nothing! The boom is now receding, and slowly fading. The madness is over, but good services will continue to rise and show up since the trend has been started. It was high time people saw the Internet as a platform for data, not just as a medium/media. Now, those with enough creativity can go ahead and develop new applications and services for this new (but old) Internet and continue to improve it for all of us!

Maybe my point of view has changed yours? :)


24 February 2007

Blasts from the past

From today, I'm allowing subscriptions to another feed (we love choices, don't we? :)). With the latest buzz being piping our existing feed and re-order them by published date, I think one (annoying but) good aspect of Blogger's native way of handling feeds got overlooked. But a brief history.

How we used to do it

In the old Blogger, the feed wouldn't be altered if you edited a post from your archives, like it does in the new Blogger. Mostly, edits used to be typos, or little bits of added information. These updates didn't need the posts in the feed jumping around. However, sometime later, someone discovered the RSS feed which would be sorted by the 'Updated' date, and not 'Published' date. Steve and I came up with a 'Recently Updated Posts' widget (weren't called widgets back then) for the sidebar. That was when we had a choice between the two feeds.

The primary (ATOM) would be sorted by published order, and secondary (RSS) would reflect the updated order. All was goood.

What we do now

Now, all the feeds are sorted by 'Updated' date. This is good only if you are like Phydeaux3 who doesn't touch his posts once they've gone into your archives, unless there is a major update. It's actually the best, because then a major update brings the post back into focus. However, we have been spoilt.

We (well, I atleast do) still edit old posts if we find a typo, and that minor change makes the post jump right to the top and show up as new. That can be very irritating, because an old post might show up above a post which you just posted, and hence may steal focus away. I'm trying to change that habit though, and I guess we all will have to at some point of time, unless Google opens the Blogger feeds to all the GData queries. The Pipes method does exist though, and that's what I use as my primary feed.

But I'd like to leave the decision to you. So what happens now is that I offer two separate feeds - one ordered by the 'Updated' date (the new one), and the old one is still ordered by the 'Published' date - and you can pick which one you want to subscribe to, as per your convenience. You can subscribe from the icon in the address bar, or the syndications list at the bottom (I just love choices!). You can subscribe to both too, if you want to be extra generous and give a slight boost to my readership counts! :)

Happy weekend!


Google bloopers caught in screenshots!

Over time and use, we might have noticed Google doing weird things! :P Whether it be a botched up search, or an advertisement for dead people, our favourite search people do have their bad days! :) I caught about three of these, but wasn't satisfied. So I went hunting around the Internet for other people who have chronicled their experience of a Google Goof-up! Here are the more funny one's that I found :) Something to get the weekend off with a laugh!


This was one of the weirder goofs! As you can see in the screenshot, the ads are not so appropriate for a place such as Google groups which are frequented by the elderly (supposedly) and young alike. Google's ads have slipped for other people as well, the funniest one being spotted by Ionut (of Google Operating System). They really need to fix these ones! :P

Last Indexed Email
I believe this is because of spam mails dated in the future to show up 'above' your normal non-spammy mails. But if that is the case, then 'why' is Google indexing spam mails? If that is 'not' the case however, then this comes out as another potential bug! Hehe! How does Google get itself into such spots :P

Blogger Date
You can find this post here and confirm it for yourself! Extremely weird! The date clearly says 22 December, and it's last year's, since it shows below other posts of 2006 in the feed. But still the URL shows the year as 2009? I don't know if this is a bug, because I tried republishing the post with the proper date, and still it refuses to change! Blogger URLs are static once they're created, we know that, but they should allow small mistakes like this to be fixed! :P


Haha! I think the picture says it all! :P Mr. Burns = Mr. Blair? I think Google's crawlers managed to unintentionally get this one perfectly right! Great job (and a laugh!) This one is from Ionut's collection some time back.

Definition of Zen
This was more of a crawler error than a Google goof up, but it is still funny. The thing is that Google definition crawlers look for certain patterns in text which allows it to find different kinds of definitions (for different contexts) from various pages. Unfortunately, a page which had a slightly warped definition for self-promotion got indexed as a legit one, and it showed up in the results! :P


Do you see dead people? Do want great deals on them? Ebay has some! :P Another Google advertisement blooper, also from Ionut's stash.

Do you have some of your own? :)


22 February 2007

Backlinks are better than trackbacks

I know I am someone who has actively asked Blogger for trackbacks since the new version came out. Trackbacks are a great way to get some traffic back to your blog, if you're someone who links a lot to other stories and your blog serves as a way of commentary on news broken on well known blogs. A simple link can do wonderful things. But the current system is inherently flawed.

Trackbacks explained

As things stand now, a trackback is essentially a simple post to the target blog's platform's trackback RDF with the necessary details about the new post. If all goes well, a link back to that post is displayed in the trackbacks listing of the target/old post. The post can be manual or automatic, depending on what Blogging platformWordpress and Movable Type can essentially recognise links to send trackbacks to based on the links in a post. This solves the problem of trackback spamming a bit, but still isn't foolproof you use. Can you see the problem that arises? The post itself doesn't need to have anything to do with the target post, and trackbacks can be sent to all kinds of unrelated posts just to get links back. This is called Trackback spamming.

Trackbacks are almost like the taxi's of the blogosphere, which helps you jump from post to post of related content, that being the essential purpose of blogs. A glitch such as this can cause for a minor setback, but setback nonetheless, in a truly wonderful system.

How are Backlinks better

Backlinks rely on Google's indexing of your new post to display snippets of other posts which link to your post, which Google's crawlers have indexed. The only good thing about this is that bogus links don't show up. I believe Google filters pages from it's index (even blog posts) and hence, the blogs which are marked in Google's index as spam blogs, won't show up in your backlinks list. It becomes sort of an AkismetDeveloped by Automattic originally for Wordpress. Akismet is considered the best protection against spam comments and trackbacks. Via a public API, it has been extended to other platforms as well. for Blogger, albeit a less effective one.

New Blogger's storing of post content in a central repository (for faster serving), should also improve the speeds with which your link is caught and displayed by Google for the simple reason that it's easier for them to now keep a track of links (it's easier to crawl just the post content rather than a whole page). This also means that links in people's sidebars (like mine) shouldn't be counted as backlinks.

With new spam blogs coming up everyday, each one innovating on what we today know spam as, it will only become hard to filter them out. But we do trust Google, don't we? :P I can now see why Google has stuck with backlinks for displaying incoming links despite people requesting trackbacks. As a good alternative, Stephen's Blogger Trackback user-script does the job fantastically. But I'd still like a trackback 'sending' system for platforms which still rely on a manual post to their RDF, natively from Blogger.


Another point to discuss, which I didn't throw in initially (goodness knows why) is how Google tackles (or should tackle) the problem of spammy links. I think it is safe to assume now that Blogger serves all post content from a central repository, or what we can call a 'database' for ease. Now, since Google itself is storing all the data, they can easily check for links, and add the required backlink to the respective post. Hence, I don't think they do so much as a reverse-blog search, but rather just look at the new posts being added to the database.

So in effect, not only did the page serving become faster, but essentially all data coming from Blogger's side became faster, including backlinks. And this is ideal to keep spam links away, because just content is much easier to analyse for spam rather than a whole page. So this is a good alternative to Akismet which, as Avatar points out in the comments, is not available to many platforms, and is almost Wordpress exclusive.

So these should sum up why backlinks are actually better than trackbacks, but keep track of the comments as discussions say more than a one man's view. :)

Further Reading

Trackback is dead - Tom Coates bids adieu to an old friend
Trackback Technical Specification
What is RDF - Building a more semantic web
Akismet


21 February 2007

My name is Aditya, and I'm a blog addict

No! I'm kidding :P I am obsessed, but not addicted, yet! I personally don't believe there is anything such as blog 'addiction', but there sure are people like me who are constantly thinking about blogs, feeds, posts, articles, news, reviews, and of-course, their trusty ol' blog! I am constantly writing up drafts, saving up for a rainy day, and to avoid a flurry of posts altogether only to have nothing to put up for the next one week. Thank goodness for online drafts :P

The simple addiction

Blogging can get obsessive! More particularly, 'Blogger' blogs can get obsessive. Something so personal, with so much customisability. The ability to add or remove little widgets that add something new and cool, then to post about it. Or to write what you think about your neighbour's dog. Knowing that someone out there will read what you've put up, and a countless other reasons make blogging one of the endless ways to happily pass time that I've come across in a long time. It's not a 'waste' of time, since we all gain somewhere down the line. But blogging can sure 'take' a lot of your time!

It is not just you blogging, but reading other blogs regularly. Waiting for the next update. Feeling a little disappointed when it isn't updated when you expected it to be, and so on are all a part of this mock disorder that we probably should analyse a little more seriously than we do at the moment.

Micro Persuasion has a good eight step rule to tackle this obession:

  • Post consistently
  • Post in the morning
  • Post frequently
  • Write about what interests you--within reason
  • Share and give credit
  • Have a point of view
  • Listen to everything--and everyone
  • Have fun

Seems something most power bloggers are likely to do. They treat their blogs as 'their' domain, and take it seriously. I do most of those 8 things myself, and do face a strange empty feeling whenever I haven't put up something for a long time. 24 hours seem too long to wait for the next post to go up, and yet I know I must keep a steady pace instead of creating irregular posting schedules.

Bloggers Anonymous calls it by a few names which make it sound really bad, but I think it is just being addicted to the 'freedom' of speech, and control over some form of communication. Just like writing in your diary, or reading a book can get you hooked, blogging is no different. This was also the initial reasons people began blogging, apart from it being the 'it' thing to do. People even today think blogging is something that is not their cup of tea, only to start and get hooked. It's like having your own newspaper. Having something to say, and people to listen to is the best feeling in the world, isn't it?

Blogging platforms make it easy for everyone these days, with Blogger's catch line being 'Push button blogging'. All you need to do is make a few clicks, type in a few names (and a weird looking captcha word) and presto! Your bright and shiny new blog is ready for you to start posting. All this ease, all the time ... how could we not? :P

Just can't help it

The compulsion is proportional to the number of readers you have. As they increase, so does the 'want' to constantly put up more and better posts than a previous time. As long as one knows one is being read by people, they will continue to put up posts. Rare is the case when a well read blog is taken down. It's true that good blogs aren't in plenty As compared to the 'total' number of blogs today. I don't have accurate statistics, but I seriously doubt that the percentage goes above 25, or even 20. It's not because of lack of good bloggers, but because of lack of 'serious' bloggers. For many it is a pass time, but for few it is a dear and loved hobby!, and that is the reason why blogging networks exist, to drive traffic to good quality blogs. Once one is part of a network, the blog surely becomes important. Any kind of reaffirmation of good work always makes the work important.

There is no real way of coming out of blogging. As I said before, the freedom can get pretty addictive, and blogging rehab isn't that popular. The solution would be spread the word, get more readers and continue blogging with new vigour and passion. After all, we all can gain from each other's perceptions and knowledge!

What are you waiting for?


19 February 2007

FeedBurner lost it!

I know one thing that publishers love to do everyday. Check their subscriber count! I take it to an almost feverish level where one tab stays open to the 'Live hits' page of FeedBurner, with an auto refresh of about one and a half hours, another tab open to the dashboard of 'Site stats', with another auto refresh. I just have to stay up to date (and time?) on these two things, and then of course comes the big kahuna - the number of subscribers - for the previous day. It has been on a rise the past couple of days since Google released their side of the numbers, so imagine my disappointment when I was faced with this:

After peaking in at 224 yesterday, it went dead at 0? Obviously something has gone wrong there. I checked up my FeedMedic log, but it said everything was perfect! I went looking for anything on their blog too, and found nothing there. I then went to see stats for all my feeds, and strangely again, found this:

The FeedCount chicklet is still showing the previous number (224) for me however, and for the other blogs that have them. However, calls to the FeedBurner API for the actual updated numbers returns a 0 for them too. Even TechCrunch! So it is a problem at FeedBurner's end. You can try it too. Append the name of the URI (lastword for my feed, for example) at the end of this line:

http://learningphp.ning.com/feedburner_stat.php?uri=

The output is a feed with the subscriber number. This is quite strange and unexpected. Nonetheless, I'll keep a watch on their space and other blogs for updates on this, so keep a tab on this post.


8:23 PM IST: Ok, this has been fixed! My latest numbers are up! You can read the reason in the comments (FeedBurner guys dropped by :P ).


18 February 2007

Misconceptions about Blogger #

Going through 9rules, I bumped into this discussion (note?), with one fella' asking which one of Wordpress and Blogger (for goodness sakes it's not Blogspot!) is better. The replies to this seemingly innocent question over there are absolutely crazy. But worst of all, it shows us the ugly side of how Blogger is looked at from Wordpress using bloggers, which (gulp) might get conveyed over to first time bloggers.

I will not take the immature route and shout 'Wordpress fanboys' and turn this into a rant post, but I sure am glad teeming cleared the things up, leaving no one to come back with rebuttals. It sure was painful to see people's ignorance.

Ignorance and a bad past

Blogger hasn't had a very illustrious past. We are all very aware of that. The update came in 'very' late, and with not too much fanfare (except for within Blogger). Hence, the outsideI really do sometimes feel Blogger users are cocooned in their own little niche. Maximum people who visit Blogspot blogs, are Blogger users themselves. I've yet to hear of a large number of other platform users coming to Blogspot blogs, or the other way around. world doesn't really know what these updates are, what they add and how much better it has made Blogger. And when Google tries to promote their product, we try to bash it down as Google going back down on it's own principles. How does one get out of such a rut? We as long time users of Blogger can help out, but alas, our words stand for only so much.

It's not like after the upgrade, Blogger is being all whiz-bang about it, with server issues still plaguing the platform. But at least it is not as bad as the old Blogger, which would go down for days.

Anadgouda's comment shows how people have a rather incomplete knowledge of the new features. OniTony takes the initial cake though, thinking Blogger doesn't allow non-members to comment. Alvinz says Wordpress is just easier to use. I don't see how from any point of view this can be correct. Blogger sold themselves with the 'Push-button blogging' line. It'll take the skill level of a hamster to not be able to set up a blog on Blogger and get blogging. I have a blog on Wordpress, and personally, though it does offer a lot of features out of the box, it is not any simpler than Blogger.

These are just three people. There are more on that page, and I am sure there are millions of people walking around reading these kind of comments, and carrying away a very wrong notion of Blogger blogs. This is something similar to the case of Windows or Macintosh. There is no winner or loser in the debate, or better or worse. It completely depends on use and need.

It has also been reported that Blogger hosts the most number of spam blogs on the Internet today. Ofcourse they would, since the sign-up is so simple. Apparently their initial captcha isn't working like it's supposed to. Wordpress can't get so many spam blogs because of the amazing Akismet, and just the fact that their main population and user base comes from self hosted blogs using their platform. It's the best strategy if you see.

9rules network doesn't like to add Blogger blogs too much, and this it the reason they give:

In all honesty I don’t like adding sites that are hosted by blogger or blogspot since there are so many other parts of the design of those sites which don’t really distinguish them from the rest, but if your site is worth it we will add it.
I don't know exactly what they mean by that, but if it's a preconceived notion about Blogger that keeps them away, then it's wrong anyway. I am guessing it's not 'just' the design, but the 'assumed' fact that Blogger blogs lack quality because they're free and anyone can have one. There are so many aspects to a prejudice, it's hard to figure out which reason triggers what.

Blogger vs. Wordpress for power

Wordpress has a solid backing of PHP. There is not a single person on Earth who will deny that Wordpress is the way to go if you want 'real' power. I have played around with Wordpressμ a little, and have been toying with the idea of having a blog on a standalone hosting with Wordpress 2.1. It truly is the stuff power platforms are made of. But that really doesn't mean you can't do any of that with Blogger. The best thing being you don't need your own hosting for Blogger, while getting the same customizability of a self-hosted Wordpress blog. Sure, Blogger doesn't give you everything Wordpress does, but you don't get everything with Wordpress that you get with Blogger.

Wordpress' brilliant usability and functioning comes from it being open source. Someone who knows what he's doing, can change the little aspects of the platform's coding to suit his own needs. This offers a lot of potential, and it the easiest way to come up with a custom platform to blog on, one suited to your needs and wants. Blogger doesn't allow this, even on self-hosted blogs, and I think this is solely where it loses out. There are so many things you wish you could change in Blogger, but you can't because the code is closed to you. You have to wait for the update to come from Blogger, and all you can do is suggest, suggest, and then suggest some more.

But all is not bad, because you have the bleet here trying to bridge the gap, and plug the holes that Blogger leaves open. We came up with categories when Blogger had none. An effective searching technique to show you search results without leaving the page. We still continue to innovate new hacks on the new Blogger, and we shall continue to do so. The same happens on Wordpress. That just proves that no platform is perfect, and they're both made popular only by their respective communities. We make do with what we can, and we've done quite a bit considering we don't have so much to work withI really don't mean to get all defensive, but we sure are reeling as the minority here. We don't have too many solid arguments to back our beloved Blogger, for the simple fact that we ourselves don't know what's happening behind the scenes, and what the future is..

The common user

Power users make for a rather small fraction of the total number of bloggers. The average user doesn't care for fancy script, killer hacks or any of that moolah. All they care about is getting their content out to the people in the best way possible, with a decent way of getting reader's comment back to them, and a good way to manage everything. A good look is always popular, but scripts and hacks? Not that much I'm guessing. People think only Wordpress blogs can look good. We can prove them wrong now, can't we? ;)

Here's a survey result from a ProBlogger poll:

Wordpress leads Blogger

The poll shows Wordpress with the tallest skyscraper. That is pretty expected, considering how people view the platform. But not very far away is Blogger. Considering it is a relatively 'closed' community, we have quite a lot of users! So, short of going 'Hah!', this is a good sign. And this poll is from January of last year, when Blogger wasn't even that good. Blogging really caught on by storm, and the number of bloggers would have shot up. What would be interesting to see is figures, and to know how many went which way (if you have any credible numbers, send them my way).

As a few closing words, I'd like to say that there is no need to try and rank platforms. They're both different, and for different people. Yes, given a proper opportunity I'd love to try my hand at Wordpress. I've heard a lot about it, and my brief stint with it was rather exciting. But I never have and never will undermine the power of Blogger, and what can be accomplished with it. That said, nothing should stop us from getting word out for Blogger to others, and let them know that it's not as bad as they think. I think every one deserves a Blogger blog! :)


Alright! Thanks to Avatar's comment, I went looking for the latest numbers and reviews/ratings of Blogging platforms, and guess what I found! :D PC World had done a review and rating of the blogging platforms existing today a few weeks back, and Blogger is right on top! It's followed by Wordpress (down 3 points) and TypePad (-7 points). This is fantastic news! You can see their review for Blogger here.


16 February 2007

Blogger feeds re-ordering #

Edit: As the comment by Pete goes, Blogger has added an orderby query string, that can take two values, namely published or updated, depending on how you want your feed ordered. This cuts out Pipes out of the equation as of now, and hence remove the overhead being added. Go Blogger! :)


You could call it Blogger Feed Corrector part deux! :) Carrying over from Ramani's post, I have worked up a new pipe which will re-order the feed coming out of Blogger, sorted in descending order (latest to earliest) of the published date.

This pipe comes because of the bug being filed by Ramani (which went unnoticed by Yahoo! inspite of high votes). I have worked it to correct the RSS version of the Blogger feed, to overcome the ATOM weirdness.

You just need to enter a simple URL, and get the final URL as RSS. Doing so will however give your feed a weird title (see for yourself! :P), so you'll be better off cloning the pipe. Also, as Ramani pointed out to me, the feeds are cached by feed readers, so don't worry if you don't immediately see any updates to your posts. Give it about half an hour or so, and you should see your new posts popping up :)

Ofcourse, once Pipes is fixed to properly parse ATOM, I'll change the pipe to not hack it's way out. But I'd wish Blogger would fix this natively, would reduce the big Pipes overhead being added to the feed call. Maybe we're all missing some GDATA query strings? :P

Let me know if you find any bugs!


Update (24/02): Ok, A Pipes employee responded to my feedback (Suggestion), and said that the error I was getting (below) has been fixed. He also said that it'd go live in a day or two, but I'm yet to see anything change. Let me know if you do...(27/02) This has been fixed now! Enjoy :)

Update (19/02): I don't know what's wrong, but the content from the feed being generated by this pipe has disappeared. If you're using it (cloned), tell me if you're seeing this (you will only see the titles). So now an ATOM to RSS transfer doesn't transfer the date, and an RSS to RSS transfer doesn't transfer the content! :( I don't know what's going on with Pipes!


15 February 2007

What's happening with Adsense?

Adsense was launched way back in June 2003 (Press Release) with the promise of allowing sites to make money by serving (relatively) unobtrusive ads on their pages.

Google AdSense, a program that enables website publishers to serve ads precisely targeted to the specific content of their individual web pages. With Google AdSense, publishers serve text-based Google AdWords ads on their site and Google pays them for clicks on these ads -- users benefit from more relevant ads and publishers can maximize the revenue potential of their websites. The self-service option augments the existing content targeting services for publishers announced by Google in March 2003, now making this service available to a broader universe of high-quality websites.

I used to run a small block on my previous blog, which didn't generate much. Hence I am not very keen on running ads on this blog. And for this reason, it makes me wonder where Google is going with their business plan for Adsense, and if it really works like people say it does.

Making sense of Adsense

For the uninitiated, Adsense actually works by displaying adsAds can be in the form of a row of simple text links, or blocks with more info and the latest new format, image ads - like the one's you see on high profile sites. that are targeted to the content on the page they are shown. There are various optimisation methods which you can use to improve the contextual part of it, but they aren't as unobtrusive as you'd like them to be.

You get paid by impression and/or per clickThis system, very cryptically is decided by Google to generate maximum revenue for the 'advertisers', not for you! Google decides what kind of ads (between impression or click paying) it serves. I don't know what algorithms it uses, but I don't think it generates the maximum potential revenue for the publisher :(, and you are paid in your currency whenever your collection reaches a 100 USD. Sounds simple? Well, things get murky from here.

Whenever Google doesn't find matching contentThis is always decided by their crawlers, who will try to figure out the topic of the content, and make the content of your ads target those keywords, it'll serve up public notice ads (you can change this configuration however) for which you do not get paid no matter what. The ad formats themselves are limited, hence you'll have to redesign elements in your sites to make them look a part of it. For example, I couldn't find a place which could hold an ad block in my template, hence one more reason I couldn't put one in. Google should offer more customisability than just allowing you to decide the colours. But more importantly, they should better their business plan to balance the kind of ads that are displayed. If they continue to serve CPC ads on a page where people don't click much, the publisher loses a lot of money and the ads make no sense. They have to give us some reason for wanting to put ads on our beloved blogs, don't they? The only good thing is that a tremendous percentage of the revenue share comes to the publisher, but that share is decreasing annually as wellGoogle Adsense Revenue Distribution.

What does it mean for us?

Viewers don't like to see ads. We have managed to estabilish that fact, and we don't need market research to tell us that. There is an immediate profile of the page we form in our heads whenever we see the familiar looking Adsense ads in any part of the page. Userscripts and Firefox extensions have been developed rigorously to block these ads along with the others. This defeats their purpose to quite an extent, although it doesn't cut out the publisher's revenue share.

At the end of the day, we can conclude that Adsense - barring a few success stories, and high profile bloggers who get tons of viewers everyday - holds nothing for the common blogger except an ambitious and shiney looking possibility. Advertising is always a dicey market to step into, and Google calls itself a contextual advertising company. This pulls in quite a lot of expectations from them by the publishers.

Let's see how Adsense evolves to meet these expectations.


14 February 2007

Pipes to the rescue!

Update: There is no need to do this anymore. Check out the update on this post.


It seems like at every step of the way, the fact that feeds are becoming ‘the’ way to get information and updates, it turning out to be true. It’s just fascinating how there have been so many new start–ups based around feeds, which is in itself so simple and logical you begin to wonder how we did without it all these days.

Blogger’s inherent mistake

Everyone who uses Blogger’s feed directlyYou’re making a mistake by doing so, and should serve it through FeedBurner. If not for any of the amazing statistics tracking features, then for the smart conversion of your feed to different formats and enabling different readers to get the format they’re compatible with., would have noticed that whenever you update an old post, it get’s bumped to the top of the feed. This works to disorient subscribers (although is a good way to bring to attention old posts), and can be a big headache. There are a couple of quick ways to get rid of it, but I’d not recommend anything but the pipes method. Just simply run it through Pipes, and you’ll have your feed sorted to your requirement. Pipes offers so many more options to filter/sort/merge and–what–not your feed. You don’t need any other feed masher, or jumbler, or blendr, or any of those things.

The next good thing

Pipes has tremendous potential, which you can see from the sample feeds they offer to show you when you first try to make a new pipe. It’s dead simple, and anyone can use it because of it’s simple interface.

One can create dynamic query strings, which can take inputs and give your proper outputs (something which can be used to sort multiple Blogger feeds with just one pipe). The output can be taken as RSS or JSON, and then worked upon by your code. It’s absolutely fantastic what can be achieved if someone just thinks hard enough.

I can’t come up with any ‘very’ fancy use of it at the moment (just got over with a heavy duty coding competition :P), and I’d love to hear new ideas. And I’ve got a feeling Avatar will come knocking here! :) So what’re you waiting for?

Furthur reading

5 cool ways of using Pipes!
Rewired Feeds


Update: Looks like a flaw in Pipes is preventing new posts from being detected by feed readers because the published dates remains empty. Ramani has made a suggestion about this, and to make it more visible to Yahoo!, you should vote for it.

It’s a good thing Pipes is in beta. It’s got quite a lot of bugs they need to iron out, some of which were discovered by Ramani and Stephen.


12 February 2007

Creativity with Conditionals

Making this new template, I had to filter out a lot of stuff for various pages. For example, you won't see the TOC on a post page, but you will on the main, archive and search pages. The hanging flowers in the bottom area disappear from the top left on post pages, and show up at the bottom, straightened out.

No, these aren't Javascript if-else statements. These are too trivial for that. Plus there aren't any fool proof checks to see which page we are working with, except regular expressions, which are overkill for things like these. The above mentioned tricks are all thanks to Blogger conditional tags, which gained a lot of power with the new Blogger. I'll explain some creative uses of these (even in Javascript), but first, a look at these tags for those who don't know. Skip the next section if you do know.

Conditions, conditions

The simple format of the new Blogger conditional tag is:

<b:if cond='--condition--'>
    <!-- codes to execute if True -->
<else/>
    <!-- codes to execute if False -->
</b:if>

That is pretty much all you need to know to get started. The cond attribute can hold any condition in the form of a Blogger data variable, operator (optional) and value (optional). I say optional for the last two because most of the data variables have either of two values, True of False. In this case, you can just check their content with a cond='data:variable' which translates to if true. The <b:else/> is optional too, in which case there will be no output in case the condition is false. Don't miss the forward slash, otherwise Blogger will give an error.

They are explained by Blogger here in case mine didn't suffice. You can take a look at all the layout tags to see which ones you can use for conditions. Comfortable? Let's move on!

Creativity and ingenuity

The first simple trick is conditional CSS. This means that certain parts of your CSS will be executed on certain pages. This let's you style main, archive and post pages separately if you want to. Sound cool? Hehe! There's a catch :P

You'll have give up on your <b:skin> tags (somewhat) for this. You see, Blogger doesn't like adding conditions to those tags, because the 'Page Elements' layout depends on those to draw the widgets and and their dimensions, with any other nitty gritty that you might have added. So, what do you do? Simple! Add your own pair of <style> tags! These won't be checked by Blogger in the Page Elements view, and you can style away to your hearts content.

However, be warned, this most probably 'will' warp your 'Page Elements' view pretty weirdly. If you don't use it too much, like me, then go ahead. If you do, try this. Keep the main styles within the <b:skin> tags, and move over only the conditional styles within <style> tags. You will still see some styles creep in, but they'll be minimum. You can use your conditional tags the same way you use them in your widgets. Nothing changes! :)

That's that for styles. You can't use conditional tags to hide widgets from certain pages. Apparently there can only be <b:widget> tags within sections. Anything else is rejected by Blogger. That little bug has been brought up by Phydeaux3, so you'll be better off using Javascript to fix that.

The next thing is the page content itself. You can literally use the conditional tags anywhere you feel like (except inside sections but outside widgets). You can use it to hide one sidebar, and show a different one. This can be achieved by making two sections, one for each sidebar. Then wrapping each of them with the conditionals, having the required conditions to suit your purpose. It's quite easy when you begin to think of it, and becomes more fun when you start to play with it.

Now the grand finale. This is probably the most useful of uses, and a great way to integrate Blogger's language with one we all know and love, Javascript. If you want to execute certain code on one page, but not on others, there is no good way short of using regular expressions, right? Nope! Again, we bring in the trusty conditionals. Have a look at this:

<script>
//Javascript to put in a greeting on proper pages

<b:if cond='data:blog.pageType == "index"'>
//<![CDATA
document.write('You are on the main page');
//]]>

<b:else/>
var main = '<data:blog.homepageUrl/>';

//<![CDATA[
document.write('You are not on the main page. <a href="'+main+'">Go there</a>.');
//]]>
</script>

See what it does? It'll print out the first message when the user is on the main page, and second one with a link to the homepage on any other page. The variable main gets the value of the main page because it is outside the CDATA tags. Anything outside those tags is parsed by the Blogger parser as tags. Anything inside is left as it is. That means, if you try to put the variable line inside a CDATA segment, it'll get the value '<data:blog.homepageURL/>' instead of getting the actual URL. This is why in my custom dates script, the actual date is passed to the function, and not the tag. This can be your best scripting friend if you want to work with separate page types in your scripts. A simple way to allow multiple functions/codes to check which page it is, is by writing out this code right under your <body> tag:

<b:if cond='data:blog.pageType == "item"'>
<input type='hidden' value='item' id='pagetype'/>
<b:else/>
   <b:if cond='data:blog.pageType == "archive"'>
   <input type='hidden' value='archive' id='pagetype'/>
   <b:else/>
      <b:if cond='data:blog.pageType == "index"'>
      <input type='hidden' value='index' id='pagetype'/>
      <b:else/>
      <input type='hidden' value='search' id='pagetype'/>
      </b:if>
   </b:if>
</b:if>

That (if everything is right) should print out 'one' hidden input tag with the value set to the page you're on. Then you can do a var page = document.getElementById('pageType').value, which will put that value in the variable, and then you can use that variable everywhere and anywhere you want (provided it is global). This trick works superbly, and since the page type is being decided by Blogger tags, there is no way your condition can be broken. This can also be used to hide individual widgetsThey will still load though, hence there will be no reduction in page load time, so you might want to keep that in mind., or other page elements until the pageType attribute begins to work as documented.

Let 'em flow

So, those are the few methods that I've been able to come up with to increase the mileage you get with the conditional tags. You're limited only by your creativity ofcourse. Give me a buzz in the comments whenever you come up with a cool new way of using them, and I'll gladly link to you! I'd love to see what people can come up with :)

Get 'em creative juices flowing!


11 February 2007

Google's OneBox

I am sure you would have heard of Google's OneBox. It's a way of searching multiple aspects/types of information with just one search keyword and submit. They've been quietly rolling it out to people, who don't even know that it's something new on their part. They would have just been noticing a flurry of new results showing up, and would have have nothing more than Google becoming a little more useful (noisy?). I think it's a brilliant move.

Google

Lessons from SearchMash

SearchMash is Google's playground for technology and new interfaces. It might be more than that, but that's all you get to see anyway. On that page, they have various modules on the sides which give you search results from videos, news, Wikipedia etc.. They've learnt well from seeing results from that page I guess, and have integrated it rather nicely into the mainstream Google search, by removing the clicking through other modules and just showing you the results. If you make people click for more info, they might not click. We have been trained to automatically filter out unwanted results from results automatically. It all adds up pretty well.

I think it would have been better if they would have announced it, and let people know of the various ways they can access results, giving preference to some based on what you're looking for. The latest addition to the OneBox results is information from Wikipedia. All you need to do is append an 'info' to your search term, and Wikipedia results will get bumped to the top. A very good way of searching Wikipedia and Google together :)

Eggs in one basket

As I've spoken about integrating things before, I'll commend Google for doing this because it just saves everyone the trouble of searching for different types of things separately. However, this method has a quickly-obvious pitfall. Google doesn't know which info to give preference, so you might have hunt through to get that perfect match. But this is not that major, so it's alright.

It would be ideal if Google 'learned' from the various searches being performed individually for the different types, and then try to match the relevancy to the search being performed. I don't think they already do this, but they should try and learn from the links people click from searchesThey know which one's you do, since you can go to your Search History and find the links you clicked on for a particular search., and rate them higher for the people. Sort of like a 'click-recommendation' in tandem with a 'link-recommendation'. More clicks, more votes. A simple little addition, but one that could really help.

I just love the way Google thinks. They make thinking up other not-so-probably stuff so much easier :)


09 February 2007

Resolution independent designs and standards

Making resolution independent designs becomes the focus of web designers when they start to become serious about the pages they work on. Making sure they look near about the same everywhere is a big issue today, and till web standards are followed properly, there is really no proper way to make sure your beautiful custom made template or layout will render perfectly at different resolutions. What do exist are however little loopholes that you can climb through to create the effect of a resolution independent design.

The situation at hand stands that out of the three main browsers being used in the market today, Opera is the only one which has passed the Acid2 test satisfactorilyFirefox Gran Paradiso (Fx 3.0 alpha 2) passes the Acid2 with the help of a new rendering engine.. So you'd think the ideal thing to do would be to make your pages look the best in Opera. But there is a catch! Opera only holds about 3-4% of the browser market. Which means that about 96% of the people using the Internet out there have probably never seen a perfect CSS standards compliant site. Macs have Safari, which is also an Acid2 test graduate, but we all know how many Macs are out there! :( So, who rule the roost here?

Firefox (18-19%) and Internet Explorer (doh! 70-75%) are what most of the people use. They follow CSS standards pretty closely, but not perfectly. Which is why something suited for Firefox will most probably be off in Opera, and definitely in Internet Explorer. IE has been the failure story of Microsoft since day one, with security problems and non-standard compliance. Don't even think of making your pages look good in Internet Explorer. They'll get messed up beyond recognition in the remaining two browsers.I talk from experience of designing over 6 different templates. It might not break in IE, however, but designing for IE is trying to run through a wall. It's hard and fruitless. However, with IE7, Microsoft has been able to rectify the problem quite bitThis template doesn't show up in IE at all. It begins to load, and then just gives up and stop. I have no inclination to find out what the problem is. I'd really suggest people to get a 'real' browser (hint: Firefox).. But these two browsers still have a distance to go.

Where do we go now?

To reach independence from design, there are two basic methods that I know of. One of them is followed here. But before we get into that, a small primer on the two basic layout methods used by designers today. The first one is using Tables. This has been there since web pages have existed I believe. Everything used to be arranged in Table rows, and the width and height attributes tweaked to give you the look you desired. Quite a few sites still use this, and this is probably the only method that works perfectly for IE, Firefox and Opera. The problem? The coding itself. If you look at the source code, you'll see nothing but Table tags. Rows and rows of them. Debugging them can really become a pain, and unless you're a whiz, they're usually one shot templates.

The second way, and the modern (smarter?) way of doing it is using DIVs. DIV elements can be (using proper CSS) made to do your bidding perfectly, and they show up with littleWhatever difference is there will be most visible only in IE. IE handles dimensions and positioning values quite differently. For example it doesn't handle em values well at all. This template uses mostly that and %. You can see the result in IE yourself difference in the three browsers. DIVs contain all three attributes of 'height', 'width', 'position' (left/right/bottom/top) that you'll ever need to position something. Now, onto the two methods themselves. Though I have been guilty of not following them in the past, I am trying to improve visibility and resolution independency of my templates everyday! :)

The first method is following a fixed width design. There is no real trick to doing this. Just use fixed positioning units, usually pixels (px) when setting position and dimension attributes. What you'll actually do is fix everything, which means in different resolutions, everything will show up with whatever pixels you provide, in accordance with whatever pixel spacings the resolution offers. Which means if you use an 8px font size in 800x600, it'll become 4px or lower in 1600x1800, making it virtually unreadable. But a resolution that high is seldom come across, hence if you can ignore the few setbacks, it's a good thing to follow.

The second method is to make dimensions and positions relative. This is done by generally using 'em''em' dimensions are decided by the current font size set in the browser, not the pixels themselves directly. and '%' when defining them. This will scale almost perfectly across different resolutions, however, you'll have to check them up to make nagging little changes here and there. I don't recommend this, because positioning might be fine, but dimensions can really go for a toss, sometimes reducing containers to sizes that can't hold their content. Hence, everything seems to be spilling out.

What I do

What I follow here is a little loophole that I spoke earlier about. I use a part of fixed width, and the rest relative. I have made my BODY tags fluid, so that the page can expand with the window size, but the content is all stuffed in a fixed width DIV at 1007pxThat's the width of the visible part of a page in a browser at 1024x768., since that's the resolution my screen is on, and according to W3schools, is the resolution of choice for almost 60% browsers out there. Then I use 'em', which depend on the font width, to make everything scalable. So if you use your zoom in and out key combinations, you'll see everything scale in and out, with more or less looking the same, just zoomed in.

So you see, there is no real perfect way of making sites degrade gracefully across different resolutions. You just have to find a compromise that suites you better than the others. I hope this will help you make your designs better for those who are still left behind, or who have advanced in resolutions beyond you! :P


07 February 2007

About hacks and licenses

Quietly sometime in the last 2 months, I switched my CC License to something more strict than what the community of hackers and those who implement these hacks, is used to. Usually you see a 'Attribution/Non-commercial/Share Alike' license, if there is a license. I went a step further and believe a little explanation, and attention directing is required to all my respected readers :)

License and rules

My license is a Attribution/Non-commercial/No derivative Creative Commons 2.5 license. This specifically translates to:

  • Attribution: You must attribute the work in the manner specified by me.
  • Non-commercial: You may not use this work for commercial purposes.
  • No Derivative Works: You may not alter, transform, or build upon this work

With the added caveats:

  • For any reuse or distribution, you must make clear to others the license terms of this work.
  • Any of these conditions can be waived if you get permission from the copyright holder.

The second caveat is the key here. My license doesn't aim to stop use of my work. It aims to 'make' people let me know about any and every use of my work, so that a) I know exactly where all my work is going and how many people are using it (to gauge popularity), and b) I can attribute and link to useful derivative or creative uses of my work. It is really as simple as that. So, along with my rules, there are a few general rules that everyone must follow.

Attribution is something that every hacker deserves, especially after the work they put in to develop their hacks, no matter how easy or simple they might seem. A lot of thinking and time goes into every hack, to make it easier for 'you' as users to implementWe might not succeed all the time in making them easy, but we do try :P. So as a personal request, whenever you implement a new hack on your blog, whether someone else's or mine, make it a point to at least make a post about it with a link backThat link will show up on the hack page's backlinks, so that's a good way of getting traffic to your blog as well!, or if you are really generous, add in a link to the author's post wherever the hack is visible (for eg. with the widget if the hack is like my Asynchronous Labels widget). This way, the hacker will show up on more people's radars, and get the recognition for good work that he deserves :)

Secondly, never use a hackers work for your commercial purposes without due attribution and permission. We make sure every license has the 'Non-commercial' clause, because we make our hacks for free, for the betterment of the community (and a little recognition as well :P). We don't mind you using it one bit, it's meant for you. But making money off of it, without anything coming back to hackers, is not only rude, but rather unfair! I am not asking you pay money to the hackers for your commercial use. That can be negotiated with hackers individually. Most people who implement our hacks aren't commercially blogging anyway (let's face it, they'd rather get professional coders to get their job done), but selling hacks and codes if they aren't yours, isn't the right thing either.

Share alike/No derivative is rather a Grey area, which should be left to individual hackers' discretion. Share alike opens up the work for other people to freely use to develop their own content, as long as they follow the same license. This might/might not cause the new work to attribute any derivation from the old work, which is again unfair since without the original work, the new work wouldn't have been there. This is where the 'No derivative' license does the trick. It forces people to ask for permission before starting their work. This makes sure the author knows that his work is being used. No author will want to hamper productivity and creativity, so the permission will usually fall through as green, but at least this way the author knows how his work is being used.

It can get hard to keep track of scripts and other content that bloggers/hackers come up with. Licenses help us to know exactly where everything is going. So please, respect the license. It's there for a reason. At the end of the day, there is practically nothing stopping you from using a piece of code you like which is on the Internet. If it's visible, you can take it. And we will not come knocking at your door with lawyers (CC let's us do that by the way) if we find you breaking our license. Atleast I won't. But, your adherence to it will enable hackers to generate more quality content, and with confidence that their work will not go unappreciated and wrongly/not credited.

We all like a little encouragement now, don't we? :) As always, thanks for the co-operation and support.

More on this

Mine and yours too - Ecmanaut's Johan posts about licensing
Why blogger's should blog with CC license
Creative Commons


06 February 2007

DLTP Labels widget updated

Thanks to Cyberbuff for pointing this out. I've become a little forgetful :( The code was (by mistake) set to get the labels from my personal blog, because I was testing it there. Get the updated code from below, and see the instruction! Sorry!


That's "Don't leave the page" Labels widget ;) Here's a quick update since people asked me for it and I thought the script could use it. If you want the original without frills, check it out. This update makes a few cosmetic changes, nothing more. So most of your people won't need to change your code. This update adds:

  • A +/- (toggling) sign before the label name, to give it a more hierarchical appearance. You can modify the code yourself to change the symbol to anything, I've marked it out in the code, but you'll have to download it to edit it (get it from here).

  • A loading animated image for all your huge list of posts which take a while to load. The script pre-loads the image, so there will be no delay in showing it. But if you don't see it, don't worry. It just means you have a stinkin' fast connection ;)

Add this line in (replace the previous code if you implemented the original --Sumesh pointed out a potential confusion):

<script>//<![CDATA[
var labels_blog = '<BLOGNAME>';
//]]></script>
<script type='text/javascript' src='http://aditya.vm.googlepages.com/labels.js'/>

Replace <BLOGNAME> with the name of your blog. You'll have to edit your widget code a little. Replace the line which generates the link:

<a href='#category' onclick='javascript:showLabel(this.innerHTML)'><data:label.name/></a>

With this:

<span expr:id='data:label.name + "-tog"'>+ </span><a href='#category' onclick='javascript:showLabel(this.innerHTML)'><data:label.name/></a>

You can change the symbol within the span tags to whatever you want :) Cool? Good!
Have a good day!


05 February 2007

Making the TOC: A look into DOM

I got the idea for it when I saw the two fixed menus over at Quirksmode. Now, I'm not a great book publishing, tutorial blog writing coder. But I can write code, so with the new look, I wanted to add that little detail in. It becomes a nuisance when you don't know what is exactly on the page you're looking at. Especially if you see one's like the archive pages, which stretch on foreverBlogger offers no way of restricting the number of posts, or am I missing something here?, and it can get very disorienting.

The concept

I came up with the TOC to be dynamic, as in it would adapt to the page you're on (rather than just show you the name of the posts on that page, a la Classic Blogger). A simple widget modified a little would have done the trick, but I wanted this one to go a step further and list out the sections in each post. I got into the habit of using headings after reading Postbubble, so those seemed the perfect section markers.

I also wanted the TOC to be visible all the time, but not really fixed like in other places. So here again I took the idea for scrolling it like in Quirksmode. Scroll with the page until it's about to scroll out, and then get fixed with the page. Creates a catchy effect of the page dragging it. When you scroll back up, it regains it's original position if you scroll to the top. Perfect! :)

I decided to hide it on post pages, because with just one post, you don't really need a table of contents. The purpose is to help navigate a page internally when on a multiple posts page. So if you want to see it, the front page would be a good start :)

Finally, to be expandable, or not to be expandable. That was the question. The initial plan was to make the sections list for every post to be expandable. But then the problem of an intuitive interface came up. How do you expand when the user wants to see the sections, and take him to the post itself when he wants to go to the post. I could have created the click-double click interface, but that doesn't become immediately obvious. So I stuck to an open sections list approach. I had to let it overflow, since this can cause the TOC to extend beyond the page on a page with a lot of posts (with a lot of sections), but that's only on the archive pages. Search pages see the best application of the TOC, since you get to see a list of posts matching your criteria, and immediately jump to the one you wish to.

Making it and DOM glory

I tried a few methods trying to get the optimum performance with least amount of code. Sure as heck, XPath crossed my path more than once, but I just couldn't generate a post specific section list. I always ended up with the same sections for every post. I'm sure I was doing something wrong, but I'm new to XPath, so until I perfect it, I rather not depend on it.

I then tried to use if...else statements to pin-point the exact node I wanted to extract information from. Here again I had the option of switching to PHP to easily scrape the data, but making an external call for something so native to a page seemed like overkill. So I decided to go hardcore, and make DOM Javascript do my bidding. This was harder than I had initially thought.

One of the basic mistakes I made was trying to append a bunch of children to one element. This was needed to generate the sections list, and append it as a child to the newly generated post list item. Of course, this would be only if that post had sections. The ideal way is to use document.createDocumentFragment() to create a fragment, then inside the loop I used to search for the headings (a simple nodeName == 'H4' checkEven now, I don't know why I didn't use element.getElementsByTagName('h4') to find all the headings in every post body. It wouldn't have reduced lines of code, but would have saved me a brain wreck.), I created a post list item, an internal linkI have a separate function which runs through the headings inside a post-body element, and gives them an ID of 'heading-(i)' where (i) comes from the loop counter (just for uniqueness). Then I create a link to point to the ID of the traversed heading to that heading, and then appending the link to the list item, and then the list item to the fragment, while the current node being traversed had child nodes.

Since code generated by Blogger follows the same pattern, it was easy hardcoding the position of the post body. I then traversed this node for the H4 elements. At the end of the loop, I created a new list, and appended the entire fragment to it. This is the 'only' way I know how to work with adding a lot of content in one go, and it also helped me to check if there 'were' nodes to append or not. No point adding a list if it has nothing, right? :) The code I ended up with was this:

body = posts[i].childNodes[7]; j=0;//body points to the post body
    fr = document.createDocumentFragment();//the fragment
    while(body.childNodes[j]){
            if(body.childNodes[j].nodeName == 'H4'){
            sec_li = document.createElement('li');
            sec_link = document.createElement('a');
     sec_link.href = '#'+body.childNodes[j].id;//assigns ID of the heading being traversed
  sec_link.innerHTML = '- '+body.childNodes[j].textContent;
  sec_li.appendChild(sec_link);
        fr.appendChild(sec_li);
        }
        j++;
    }//end of body.childNodes
    ul_child = document.createElement('ul');//create a new list
    ul_child.id = 'sectionUL';
    ul_child.className = 'headingList';
    if(fr.childNodes.length > 0)
        ul_child.appendChild(fr);//append fragment to new list if it has children
    if(ul_child.childNodes.length > 0)
        ul.appendChild(ul_child);//append new list to main list if it has children

Notice that I could have easily used innerHTML to come up with the required links and everything, and as the discussion here goes, it would have saved me lines of code. However, the beauty of DOM Javascript tipped the balance. It helped to visualise the hierarchy of the TOC being generated. It would be as simple as:

  • First post
    • Section 1
    • Section 2
  • Second post
  • Third post
    • Section 1
    • Section 2

And so on, with each section list being created only if the post was divided into sections. Remember though, that the way the script is written, a single H4 element in the post body resulted in this section list. I didn't want to add unnecessary jargon by putting in checks to ascertain the legality of dividing a post into sections.

That is the dynamic part of the function, which analyses the page. The remaining part (which you'll see if you view the source) works to create static links to the top, footnotes and the bottom content. The best part is, this is very easily extendible if one adds more sections or something. Blogger makes life easy with uniform hierarchy of posts, hence if you write the loop with one post in mind, you'll effectively be writing it for all of them. I used the excellent getElementsByClassName function to get references to the different post blocks on a page.

The one little thing to notice is that if you click the link before the posts have finished loading, it'll give an error. That's because it adds links to various parts of a post, and does that for all the posts. It won't be able to traverse the DOM properly if elements are missing, and wherever it catches an error, it'll halt. If that happens, just wait for the page to finish loading, and then click the link again. You'll have your TOC.

Conclusion

This was a nice and healthy experiment into scripting with proper DOM functions (for the most part). Took some nice brain racking to come up with the fastest method, and the result was a nice and fancy add-on to the page which I think people will appreciate in the long run. I hope to release it in the future, after it's survived my tests and hammering, and a few tweaks that I have planned for the public version. Hope you enjoy using it as much as I did making it!


03 February 2007

Three Halves

This has taken me long enough, so I will not put it off any more. Something more to do with 'me' than the web or the Internet! :) Let me introduce everyone to my nice (somewhat) little personal blog. It's called 'The Wrong Road to a Dead End'. Don't ask me why I decided to call it that, but it sure caught and stuck :P

What can you expect to see? Well, it's a few steps short of being a teen angst blog! Haha! It has whatever I think about when my mind is not busy with physics, maths and computers, or codes and music. It can get very random and completely non contextual, inconsequential at times. The posting is very irregular (my mind is not empty that often), but it's a nice place to just spend 5 minutes whenever you don't have something to read otherwise! :)

I designed it to be as fast as possible, with no frills attached at all. There is just one thing at the top right which is of consequence and something I'm proud of. The 'Now Playing' widget, which is tied to my Winamp. It updates with the song playing on my computer currentlyIt's lying very broken at the moment, but I'll fix it soon.

The content can get a little heavy at times. Those are the times when I'm really not feeling fine or something. The posts are probably the best indicators of my mood. Its content is very honest, and is absolutely 100% me. So you've been warned. It won't have what I did that day, or how the dog next door is so cute. All that is too trivial for me, and I'll throw those in in the middle of posts if it is of any consequence.

Three halves?

As for the address 'Three Halves', there was a little thought behind that too. If you've noticed, people sometimes make the mistake of describing something by saying 'one half this, one half that, and one half something else', to which we quip with 'three halves'? But if you see, that's when the person is concentrating on the content, and not how they are explaining it. That's the approach I follow on my blog. I think about what I'm talking about, and not how I get it out to the people. I leave the perceiving to them, and their judgement :)

You get the idea. You'll see the rest there. So pay 'me' a visit! :)


If you feel it's worth it, you can subscribe to the feed from here, the syndications' list, or from my personal blog itself!


02 February 2007

Linksharing (Jan - 1st week Feb '07)

I've always wanted to be able to share little interesting pages that I've come across the Internet in an unobtrusive and compact way. Short of adding a widget for it and overcrowding my sidebar, this is the most creative way I could think of for the moment :P So, here are a bunch of pages I bumped into in the recent past, or one's I thought you'd find fun:

  • ASCII art generator: Does what the name says, and beautifully too! You can see this example :)

  • Funny windows error messages: I don't know how many of these are true, but they sure are funny!

  • John Mayer - Neon: That's not that easy to play, though I can at a slower beat. Great song nonetheless!

  • iPod is introduced: Apple music even 2001, and the first ever iPod introduction.

  • The Daily Wtf?: This one is genuinely funny! You have to see it :P And don't miss all the comments either!

  • Optimus Keyboard: Something I'd love to see see the light of day. It's just gorgeous!

  • Google Rounded corners: Want rounded corners? Why not get 'em from Google? Check out this link to to build the rounded boxSubmit and get the box code, then replace the different URLs for the corner images with the Google corner image URLs! You won't need to go hunting for a filehost :P


01 February 2007

Design and Hack testing, and Google server woes

Though the new Blogger has made loading blogs faster, I guess it still has a little more way to go to be handle multiple requests for a page. This is most evident when you're trying to test a new design or a hack, which requires you to constantly preview and reload a page. I don't think is inherently a Blogger problem, because I noticed that requests to Googlepages (my choice file host) were taking long to get completed as well. As I write this, blog feeds have taken a hit. I don't see them on any blogI've checked Phydeaux3, Blogger Hacked, Hackosphere and my blog -- blogs which rely on feeds..

This brings up the question as to what 'is' actually the bandwidth and space that we're offered from Google when hosting at Blogspot. There have been estimates in the past, but I'd sure like a solid number to work with here. Avatar will have them, but he's a little busy on his own these days! :P

Atleast, the server doesn't refuse connections if you overshoot their requests per minute/hour/whatever barrier. It just slows down, which is a more desirable result than a downtime! But then again, it can't take too much server load if you're just having to serve text. As far as I know, all our post content is stored in a database, and is injected into our template by a faster (with bigger capacity?) server and shown to us when the page is requested. It can still get on my nerves when I need to go to bed but the pages won't load fast enough so that I can add that final touch to the CSS or code.

Is Google really ready for a GDrive any time in the near future? I doubt it.


Google Operating System is facing the same outages. I wonder what really is going on with Blogger... :(

Updates

1-Feb (7:49PM IST) Update: The feeds are still being a little moody, but they're slowly starting to reveal themselves. As Deepak points out in the comments, the Blogger Help Group is flooded with people posting encounters with a 502 server error page. I've managed to avoid it till now, but it sure can't be good.

(11:34PM IST) Update: For a small 5 minutes, I was greeted to this nice little message. I couldn't post, view my dashboard, or do anything else. It seemed like everything with the domain name of 'blogger' or 'blogspot' was down. It seems to have vanished now, with all feeds and Blogger related stuff back online in perfect shape! Strangeness of the highest order! 8|
But it's good everything is back!

A new build?