How to show update availability for a windows program on a PHP/Drupal site ?

With the release of the new version of Jaledit, I thought of introducing a new feature to all my programs. It’s the typical check for updates. I found that Opera does something similar, where in, when the check for update menu option is clicked, a message is displayed if there are no updates. If there’s an update the web page with the download link for the new version of Opera is is displayed.

I didn’t want a fully automatic update where the update file is downloaded in the background for selfish reasons (I want a page hit ) ūüôā
So here’s the base spec in my terms

  1. Have a check for updates menu item in the main form and button in the about box form of my Delphi program JALEdit.
  2. Once the user clicks the option, the JALEdit webpage is displayed .
  3. Display message on the page about the status of the update on the top of the page.

My PHP skills = 0, Delphi skills = Advanced

Digging a bit around PHP documentation led to  version_compare, generally used to check PHP versions, but works quite well for program versions as well.

Here’s the code that does the job
$latest = ‘0.5.6’; // define your latest version
$ver = $_GET[‘ver’]; // for me this is like a command line argument get whatever is there after ?ver=
if  ($ver)  // Do the check only if the version info is passed  if its just then nothing happens
if (version_compare($latest,$ver) == 1) // there is an update available
print(“<hr/><strong>”.”An update to JALEdit is available. Latest version is :”.$latest.”</strong>”) ;
 // display in bold about update status in between 2 lines
print(“<hr/><strong>”.”No update available.You are using the latest version.”.”</strong>”);
print “<hr/>”;

What I learnt,

  1. version_compare()  functions compares versions with “.”.
  2. $_GET[‘variable’] – function to sort of retrieve command line argument.
  3. . is equivalent to + for string concatenation.
  4. A semicolon is required before the else clause (different from Pascal syntax)

Delphi Code

procedure TfrmSecMain.acncheckUpdatesExecute(Sender: TObject);
  tempStr: string;
  tempStr := '';

  with TJclFileVersionInfo.Create(Application.ExeName) do
    tempStr := tempstr + Format('%s', [FileVersion]);
  ShellExecute(0, 'open', pcHAR(tempStr), '', '', SW_SHOW);

The Delphi code is pretty straight forward with the JCL function to retrieve the file version from the exe file and that’s passed to the Shellexecute function to do a default browser call.

The PHP code I guess should work with wordpress and any CMS.


FCK Editor installation problems and other notes on Import HTML module of Drupal

FCKEditor 2.5 Beta version does not work on Opera Versions below 9.5 Beta.

  • Replacing old version of Drupal FCK results in an error (user warning: Table ‘user328_jal.fckeditor_settings’ doesn’t exist query: SELECT * FROM fckeditor_settings in on line 172.) the error results even if upgrade script is run.
  • The right process is to uninstall, hopefully that will remove the tables that can otherwise cause problems from the db.
  • Import html requires tidy module. The exe version seems to work and is more reliable than the PHP module. The path has to be windows style with the back slash if you are running on windows.
  • Disable the path auto module  or you will end up with totally screwed up links from the imported site.

Working on a community site

For the past many days, I’ve been primarily working on nothing but Drupal and JAL. The site is the net result. Lots of work is still pending. I used many modules, found the backup module doesn’t work with my host. That reminds me, Manas Hosting¬†seems to have many problems. Their support is lousy. Lots of database problems and looks like they are over selling. Still on php 4 ¬†and MySQL 4.
I used the paypal and donation module and that required couple of edits, to change the donation request. Once everything’s over I think I’ll list all the modules that I used and its pros and cons. Discovered and reported a bug in the FAQ module where certain options in categories results in sprintf bug.


The Birth of a New WordPress Blog and My First thoughts on WordPress and Drupal

After hours,days,weeks and months of thinking, I finally installed WordPress for blogging and Drupal for the rest of it. I know its not an uncommon scenario, but everything with WordPress seems to be easier.

Let me list the already known facts of why WordPress is better for blogging with an out of the box WordPress install.

Yes, both Drupal and WordPress require you to create a new database and have its login information. So what’s the difference, Drupal being a complicated monster show’s its complication and power with a long installation doc. Drupal supports other databases than Mysql but MySQL seems to be the database that has most support.

Why I chose to blog with WordPress instead of Drupal?

  1. No need to learn about taxonomy, categories and tags to use it from the beginning. With Drupal you got to learn and configure the taxonomy module to get started. 
  2. Uploading images, to blog posts is automatic and very easy with WordPress whether you use an offline blog upload tool like WLW or even with the built in web editor of tiny MCE. Something, that’s not possible with a default Drupal installation. 
  3. Windows Live Writer(WLW), an offline blog publisher works seamlessly with WordPress. No tweaking necessary to get categories working with WordPress, but Drupal has lots of problems in getting categories and tags to work with WLW.
  4. WordPress import from other blogging tools work so well and you have options to import from almost any platform. I was able to import easily from .  The import options don’t require any plugins to be installed in WordPress. Drupal requires external modules to be installed and your options are limited for a direct import. You need to convert to a particular file format, export and then import.
  5. WordPress gets you going on a fast start with less power, but more ease of use. Drupal with more power and flexibility is more complex, with a not so intuitive user interface.

This is my first blog post with WLW on to my WordPress blog and Drupal site..