Archive for May, 2007

Google Gears - Offline Functionality for Web Apps

Thursday, May 31st, 2007

Google Gears Logo

There has been many ideas about a offline storage mechanism for web applications. Dojo implemented this in its Library. Firefox 3 promises this. Now we have a new arrival in this area - Google Gears. Unlike Dojo’s implementation, Gears require an extension for it to work.

Google Gears is an open source browser extension that lets developers create web applications that can run offline.

See Gears In Action

To see Gears in action, first install the extension…

Google Gears

Then go to Google Reader - you will see a ‘Offline’ mode button in the top right corner. If you click on that the script will download 2000 entries into your local database(SQLite).

Downloading Online Entries using Google Gears

To see this database, open up the Firefox Profile folder and enter the ‘Google Gears for Firefox’ folder. You will find many Database files there. Just open any of these in a SQLite V3 supporting viewer.

After the download is complete, you can use the Reader without a net connection.

When you get the connection back, just click on the same button - all the changes will be send to the online server.

Syncing Local DB changes with online server in Google Gears

Advantages of the Google Gears

  • Once the extension is installed, the script will work across all the supported browser. No JavaScript hacks required.
  • Full featured Database support - this makes it much easier to work with.
  • Supported by Google
  • Open Source

Disadvantages of Google Gears

  • The user must install an extension for this to work.
  • Requires user action before going offline. If your connection breaks suddenly(as it often happens here in India), you are left with nothing.
  • All browsers are not supported(yet)
  • Beta software - some bugs are to be expected. But, this will be solved in time.

I am still exploring the code - expect a new post with working javascript examples soon.

Google Gear Links

What I learned from Nexty

Sunday, May 27th, 2007

Nexty Logo

Remember Nexty? Recently I was able to make the 1.0 version. Currently I am planning for the second version. But before starting on that I want to document the different things I learned when creating Nexty. These are a list of things you can expect on this series…

Client Side

  • CSS
    • Icons
    • Theming using CSS
  • JavaScript
    • Ajax - Success/Failure Pattern

Server Side

  • Installer
  • Framework
  • API
  • Distributed Apps

Before starting, a small notice - I will include links to Nexty’s internal pages in this series. Most of these pages are behind a login. So I would advice that you get an account in Nexty and login into it using the ‘Remember Me’ option enabled. This would make sure that you have the most seamless experience.

iFrame Features

Tuesday, May 22nd, 2007

iFrame Logo

In the previous post I introduced my new PHP framemwork - iFrame. It had the reasons why you should not use the framework. In these post, I will talk of the advantages you get if you use my framemwork. But remember - do not use my framework.

No routing - Fully file based

There are no complicated routing rules - the URL should specify which file should be used. For example…

http://www.example.com/user/create.php

Here, ‘user’ is the controller and ‘create’ is the action.

Folder Structure

Like many other framemworks, iFrame has a rigid folder structure.

/
+-commen.php
+-configeration.php
+-/includes/  #System files
+-index.php
+-/user/
	+-index.php
	+-create.php
+-/templates/
	+-index.php
	+-/user/
		+-index.php
		+–create.php
+-/js/
	+-/user/
		+–create.php
+-/css/
	+-/user/
		+–create.php

Auto inclustion of CSS/JS files

The system will auto include the CSS/JS files with the same file name as the current file - the files colored colored in green in the above ‘Folder Structure’ will be included automatically when ever the create.php(red color) file is called.

Library for Paging/Tagging

These two classes are great time savers. Unfortunatly they have no documentation - yet.

Small/Managable Files

The framemwork forces the code to be broken down into smaller parts. In this framemwork, one action is one file - instead of one controller per file as in other framemworks. I find this easier to manage than the other approch.

Uses OOPs only when it is required

I only use Object Orinted Programming only if there is a clear need to use it. This step made the system much simpler.

Three Layers

This framemwork tries to follow both MVC(server side 3 layer) and Content/Behaviour/Presentation(client side 3 layer) approches.

iFrame - My PHP Framework

Friday, May 18th, 2007

iFrame Logo

I have created a number of Web Applications - Nexty and Jus5 are just a few examples. I used a common code base when creating these sites - but I did not consider it a full fledged framework. However, now the code base has evolved enough to be called a framework. So, I called it a framework - the iFrame framework. I know, lame joke - geek humor ;-)

Before moving further, a word of warning - Do not use this framework for your project. There are plenty of great PHP frameworks out there - use one of those. For example…

These are professional, enterprise level frameworks. They are secure, well designed and documented. Use any of those when creating your site - do not use mine. There are no legal restrictions - the code for iFrame is under BSD License. These are the reasons why you should not use my framework…

Disadvantages

Documentation
Many Users of frameworks complain that there is not enough documentation. My framework has no such problems - it has no documentation whatsoever . They only way to find what a function is supposed to do, is to read the code.
Bugs
This system is developed, used and tested by just one person - me. So, there are many yet undiscovered bugs.
No ORM
Those who are in love with ORM will be disappointed when using iFrame - I have not implemented ORM.
Currently, only MySQL is supported
There is a database abstraction layer - but as of yet, only MySQL is supported.
And a lot more other reasons
The reasons why you should not use this framework is too numerous to list here.

Advantages

Despite all the given disadvantages, I will use this framework - these are the reasons for that…

Lightweight
This is the most lightweight framework that I have ever seen.
Helpful functions that reduce coding time

All my PHP functions are available in the framework - If you know how to use them, these functions save a lot of time. For example…

Encourages clean code
iFrame is an MVC framework(although the ‘Model’ is a bit limited for now). By default, each controller has its own folder and each action has its own file. This will greatly increase the number of files - but will reduce the number of lines in each file. Some might find it hard to use - but I find it more manageable this way.
A lot of cool features
I will talk about these ‘cool features’ in the next post.

Code

What good is a framework without the code…

View the iFrame code online

You can get the code from my subversion server - use this command…

svn checkout http://www.bin-co.com/php/scripts/iframe/code/ iframe

Using FeedBurner may hurt your PageRank!

Thursday, May 10th, 2007

FeedBurner Logo

FeedBurner has a feature called ‘clickthrough tracking’. If a feed has this feature enabled, FeedBurner will track the number of clickthrough from your feed. You will be able to see how many users have come to your site after reading the feed. But there is a problem - they do the tracking by modifying the link URL - this could hurt your Google PageRank in the long run.

The problem happens as FeedBurner changes the URL in the feed to point to their site. It is not a FeedBurner issue - that is the only possible way to track clicks in a feed. This becomes an issue because google will not credit these links to you.

For example, this is the URL of my last post…

http://www.bin-co.com/blog/2007/05/jus5-light-weight-cms/

In the FeedBurner RSS feed, this link becomes

http://feeds.feedburner.com/~r/bin-blog/~3/114722273/

Both points to the same location - but in case of the FeedBurner link, the user goes to the FeedBurner server and is redirected from there to my site. This link is counted as a link to feedburner by google.

How this Affect Google Page Rank

This system is designed for humans - not for machines. But these feeds are are harvested by bots and used on other sites. I have seen my content being swiped and used in other sites. Earlier I used to get angry about it - now that phase is over. I have accepted the situation. Like people accept spam and ads, after a while you learn to accept the fact that others are using your content without your permission.

There is one good thing about this - most people link back to the the original page when using the content. And as all bloggers know, links are very important. Recently I found this page…

http://www.fixmood.com/indian-college-students-face-bleak-prospects/2006/12/11/

This is an exact copy of one of my blog post over at BinnyVA.

Like many others, this site links to the original article - but to my horror, it uses the FeedBurner link…

Original post by <em><a href="http://feeds.feedburner.com/%7Er/BinnyvaBlog/%7E3/59866721/” title=”" onclick=”javascript:urchinTracker(’/outbound/feeds.feedburner.com’);”>BinnyVA</a></em> …

Google will not count this link as a link to my site. The only advantage of others using my content is lost.

Another problem is that people copy the URL right from the feed reader into their blog - and if they are using a WYSIWYG editor when creating the post, they will not notice that they used the wrong URL.

Turn ‘Clickthrough Tracking’ Off

The benefits of ‘clickthrough tracking’ are not worth the problems caused by it. Fortunately, it is easy to turn it off. If you are not using FeedBurner to publish your feed, you don’t have this problem. Even if you are using FeedBurner, chances are that you don’t have the problem - you have to explicitly turn this option on. If you have turned it on here’s how to turn it off…

Login to the FeedBurner site and elect your feed. At the bottom left side of the Feed page, there will be a link called ‘Standard Stats’.

FeedBurner Standard Stats

See the checkbox ‘Item link clicks (clickthrough tracking)’ - make sure its off.

Disable Click Thru in FeedBurner

Click ‘Save’. Do this for all your feeds.

Jus5 - Light Weight CMS

Monday, May 7th, 2007

As promised in my previous post about the release of Nexty, I want to announce my new project - Jus5. It is not exactly ‘new’ - I have been working on it for a couple of weeks. Jus5 is a light weight CMS. It is also a total failure :-(

Download Jus5 (Updated)

See Jus5 In Action

What is Jus5?

Jus5 is perhaps the smallest Content Management System. The system only requires 9 files(less than 100KB) - without the editor. The entire system can be compressed into just 2 files - but my conscience is not letting me do that.

Features

Jus5 is a Lightweight CMS that can be used to create and manage smaller sites. It includes only the most essential features of a CMS tool.

  • Customizable Themes
  • Add/Edit/Delete Pages
  • Add/Edit/Delete Categories
  • mod_rewrite support(User Friendly URLs)
  • Client/Admin Model
  • Single Admin
  • WYSIWYG Editor Support(TinyMCE)
  • Easy to Install/Use
  • And More…

Purpose

The purpose of this software is to let people set up micro sites with the least amount of troubles. My aim is this - the web master copies the files over to the server and calls up the location in the browser and the system is in place. No configuration - no editing config files - no going through wizards to set up this software(ideally).

A good example for this is sourceforge sites - ie. the web hosting support that sourceforge site provides for open source projects. I have some OSS projects in sourceforge - and each of them have a site - nexty and bdir. The problems with this is, the site is too limited to use a professional CMS tool like Drupal or Mambo. The only other options is to manage it manually. This is what I have been doing so far - and it is getting a bit tedious.

Enter Jus5 - just upload the necessary files to the server - and you have the system running!

At least that was the plan.

Problems

If you have been in the Web development field for some time, you will immediately spot the problem when I said that I want the program to have zero configuration. You will know that at the very least, the user have to provide the database connection details.

But there is one method that can be used to overcome this limitation - SQLite. I used this method to create the entire application. The problem is not all servers have SQLite support in PHP. SourceForge don’t!

As a result, I have added MySQL driver support to this system - but now the user must configure the system before running it. Not what I wanted.

With that change I am releasing a ‘working’ version of Jus5. Please remember that this is a beta release - expect broken stuff. Don’t use it in a production system.

PHP Session issue in SourceForge Hosting

Thursday, May 3rd, 2007

If you are using sourceforge to host your project, be careful when using the web hosting provided by them - it’s session handler for PHP is broken. I learned this the hard way when I tried to set up a demo for my latest project.

Many other have found this problem as well. You you have actually gone through the SourceForge documentation, you will find that this issue is documented.

Nexty had this problem as well - but back then, I thought it was a problem with sourceforge’s caching mechanism. Now I know that it is an issue with their session management.

Just an FYI

Subscribe to Feed