Archive for October, 2007

Tk Verses Gtk(And Python verses Tcl)

Wednesday, October 31st, 2007

Back when I was using Windows, I searched for some language that would let me create GUI application. I knew C++ - but creating a GUI using C++ was very, very hard. After some searching I found Tcl/Tk - it was perfect. I liked Tk so much that I used it to create GUI in perl programs. And in Ruby. And in Python. I even wrote tutorials for Tcl/Tk and Perl/Tk. Then I discovered Linux. initially I was glad that I did not choose VB - that would mean that I have to throw away all my custom programs. But since I used open languages like Tcl, Perl, Ruby etc, they will run on Linux as well.

But when I actually ran the programs in Linux, I got the shock of a lifetime. The applications I created looked bad - really bad…

TK Screenshot - Ugly

I still use many Tk programs - but because of the looks issue, I decided to stop using Tk for my new programs. So I decided to try GTK. I even created a small application using PyGTK(my first) to view the harddisk space usage in Linux - Frees.

Frees Screenshot

It was a very simple application - all I had to do is run the ‘df’ command, parse its output, and display a small table using that data. I was expecting around 100, 150 lines of code at the most. But after I created the app, I have 500+ lines of code.

At first, I thought that it was a mistake on my part - I thought that I was not using the best method. But then I came across an article in Reddit - gnocl or PyGtk?.

PyGtk is still the most recommended binding for Gtk. A lot of programs in Linux is written using PyGtk. So naturally there are a few advantages for using it…

  • It will be the more ‘road-tested’ binding.
  • Many system will have it installed by default.
  • Bigger community - so…
    • more support
    • more examples
    • more tutorials
    • etc.

One the other hand, I have to write more code.

Conclusion

If it is a private script - only useful for myself, then I will use Tcl/Tk or Gnometcl. If the script could be distributed, like Frees, then I will use Python GTK.

What about the other options…

  • wxWidgets
  • PyQT
  • Ruby/GTK
  • Perl/GTK

Any recommendations for me on which library to use? Please leave it in the comments.

Case Sensitivity in URLs

Wednesday, October 17th, 2007

I am an open source guy - so naturally I prefer the flagship OSS software Apache to the proprietary Microsoft IIS. But there is one area where IIS does a better job than Apache - the case sensitivity of URLs.

Are URLs Case Sensitive?

They should not be - but they sometimes are. Domain names are not case sensitive - for example http://www.apache.org/ and http://WWW.Apache.Org/ goes to the same location. But in the LAMP platform, the path is case sensitive…

But in the case of Microsoft IIS server, this is not true - try…

Reason: Linux Filesystem is Case Sensitive

The root cause of this is that the filesystem in the Linux OS is case sensitive - while FAT32/NTFS filesystems in Windows are not.

Dynamic URLs

Now Dynamic/friendly/clean URLs are appearing in many CMS tools. A good example for this is the ‘permalink structure’ in WordPress. These dynamic URLs could be case sensitive or not - it depends on the software. In WordPress they are case insensitive. Del.icio.us is also case insensitive. TinyURL is another service that uses case insensitive URLs. But it is possible for the tool to make the URLs case sensitive.

From the SEO perspective

If the search bot visits two urls say, example.com/MyWebPage/Index and example.com/mywebpage/index , will the bot index both page contents? If they are same, will one get the duplicate content penalty? Or will google just index the URL with lower case and ignore the other - remember, in Linux/Apache, both pages may have different content.

Conclusion

The RFC for URL says they must be case insensitive.

For resiliency, programs interpreting URLs should treat upper case letters as equivalent to lower case in scheme names (e.g., allow “HTTP” as well as “http”).

Apache must not use the filesystem as an excuse - I really hope they provide case insensitive URLs

Article Templates - WordPress Plugin

Thursday, October 4th, 2007

Article Templates wordpress plugin lets you create templates that can be used when writing a new post or page. This will be very useful if you are writing many post with the same structure.

Download Article Templates 1.00.A Beta

Article Template Screenshot

This is my first WordPress Plugin. It was easier to create than I expected.

My plugin used the principles used in Post Templates plugin. It is another plugin to do the same thing - create templates for the post.

My plugin have a few advantages over the other plugin…

  • Easier to use
  • The templates created by each user is accessable only to them

There are a few disadvantages too…

  • Javascript must be enabled for my plugin to work
  • Beta release - expect bugs
Subscribe to Feed