« August 2006 | Main | October 2006 »

1 2 Next

September 2006 Archives

September 6, 2006

Inprove the performance of SCode plugins of Movable Type

    My friend,Fenng close the SCode (Anti-Spam Plugins) on his blog, because of this plugins consumed too much host CPU, and introduced the high load of web host. So I am trying to tuning the performance by cache the security code images, when accessing the page, if the cached image does not exist then it will call the GD library to draw the image (I think this step consumed most resource), else it will just read the content of the cached image.

    I have finished the change, but I cannot test the effect, because of web clicks of my host is not high at all. Hopefully someone can tell me the performance improve.

    Two changes of SCode.pm file, add a new function to return the temporary directory, and limited the security code to between 1000 and 5000, as following:

###########################
#                        #
# Do not modify from here #
#                        #
###########################
sub scode_tmpdir {
    return $tmpdir;
}

if ($code>0 && $code<=$scode_maxtmp)
{
    $scode = 1000 + ($scode % 4000);
    open(OUTFILE,">${tmpdir}${code}");
    print OUTFILE $scode;
    close(OUTFILE);
}

    Changes to mt-scode.cgi file, if the image are cached the read the cached image, else generate a new one and cache it. As following:

View Full Article ...

More changes to the SCode plugins of Movable Type

    I have heard that Fenng got a lot of spam message even with SCode plugins in his blog system, seems some spam robot are able to get the security code from image. Imaged security code are widely used in everywhere, to SCode plugins, maybe the image is too simple, we can modify it. I made two changes here:

  1. Draw four digit in different color.
  2. Draw a verticle line with background color in the middle of digit

    Hopefully this change can help to prevent from spam message, but there is no spam message on my own site because of lower traffic. This time we just modify the mt-scode.cgi file. As following:

View Full Article ...

September 7, 2006

A JavaScript problem on IE7 Beta2

    Microsoft has released IE7 Beta2 program, when final version released, lot's of people will migrate their IE6 to IE7 for the new features and security issue. I have downloaded and installed IE7 Beta2 in my notebook, and tested the pages on my blog.

    I do hit two problems. First is CSS, one of my friend fixed the CSS problem. Second is a JavaScript problem for Lilina (The RSS page of my blog), it cannot coalapse the items by clicking the article title. It take me some time to find out the reason and fix it.

    We just need to add a new line to "js/engine.js" file as following (the red line):

function ItemShowHide(id)
{
  var status;
  var item = document.getElementById('IITEM-'+id) ;
  var i ;
  ......

    Seems JavaScript in IE7 need more strict syntax, like C programming. Variables must be declared first before use. According to JavaScript language specification, this should be fixed in final version.

    So declare variables first is a good habit for programmer.

September 12, 2006

Incorrect display of RSS items on Lilina 0.9 and fixed it.

    On my RSS page, I found it cannot display correctly some items from blogs based on WordPress. I have thought that it's the blog owner's problem that they should put some basic HTML tags(p,br etc) into their post. But after I check the rss display on feedburner.com, I found there are two copies of the entry body in the rss XML output, one is not processed by feed-burner, and the another copy is formated by feedburner that with right HTML tags in it. The problem is that lilina just display the unformatted part, if it display the formatted part, the the display is consistently with the original page.

    So I did some modification of the index.php file, replace the following

$summary = $item['summary'];   
if (!$summary) $summary = $item['atom_content'];       

    with

$summary = $item['atom_content'];     
if (!$summary) $summary = $item['summary'];   

    I begin to know why my friend Fenng choose Planet as the platform of his cnoug.net, Lilina does have performance problem, the display problem could be another reason.

    My another site IamDBA.com becomes a RSS aggregation of mainly China Oracle DBAs, still based on Lilina. The only issue is that access speed of DreamHost is a little slow in China.

September 18, 2006

Fasten tags based search by caching the result in Movable Type 3.3x

    Blog platform MT-3.3x provide useful tags feature, and you can search by tags easily. But if you deploy your blog on DreamHost, your blog will not response so quickly due to limited resource, in China it take us at least 4 seconds to get the query result. I am trying to relsove the problem by cache the tags based search result, usually tags based search result will not change a lot, unless you publish new entries, and there will not be so much tags in a blog, so cache them is a good solution.

    I make a copy of "Search.pm" file, I named it with "NewSearch", it will cache the tags based search result, the default cache file retention is 2 days. So for tags based search, only the first access will be a little slow, other clicks will come from the cached files. You could test the search speed here.

    To deploy this feature, please download NewSearch.zip, and extract it, upload the extracted file to "MT_HOME/lib/MT/App", create a "searchcache" directory under "MT_HOME", and finally change the following line in mt-search.cgi:

use MT::Bootstrap App => 'MT::App::Search';

    To:

use MT::Bootstrap App => 'MT::App::NewSearch';

    To fasten your blog search, download and deploy it!

1 2 Next

About September 2006

This page contains all entries posted to AnySQL.net English in September 2006. They are listed from oldest to newest.

August 2006 is the previous archive.

October 2006 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.36