Archive for the 'Scripting' Category


Resolving encoding issues in WordPress instaslled by Fantastico

Saturday, December 20th, 2008

hosting with Lunarpages came with , which includes the latest out of box. It went well until I tried to compose entries in today, which turned into question marks. Obviously an encoding glich was there to prevent WordPress from saving UTF-8 chars even if I had set WP’s encoding into UTF-8. After performing checks for a little bit, I found that the Latin encoding would persist even if you try to alter the default encoding of the datatables after installation. Therefore, I had to open PhpMyAdmin and correct the “COLLATE” of EACH FIELD manually back to “utf8-general-ci”. The ‘DB_COLLATE’ variable was set to the same value in wp-config.

The following SQL expressions will alter the DEFAULT COLLATE of all the tables in my database, but not the existing collate for each field.

Done.

Technorati Tags: , , , , ,

A Manual Update hta for McAfee VirusScan

Monday, October 2nd, 2006

Don’t know why the automatic update of VirusScan can’t work in LAN, so I wrote this small to automatically unzip the definition pack and copy them to the VirusScan folder, then change the registry a bit to let VirusScan use the updated definition.

Anyway, it has not been carefully tested, so, think of it as an experiment. Note that during update, VirusScan will be stopped, and it’ll be started after updating.

How to use:

  • Download the definition file avvdat-####.zip, where #### is replaced by a 4-digit number, indicating the version.
  • Copy this file to the same folder that holds the update .
  • Run the exe, it will automatically compare the currently installed definition version and the new update pack. If it’s a newer pack, the program will let you install.

McAfee VirusScan AVVDat Manual Update Tool

Technorati Tags: , , ,

How melopia toggles its layout

Saturday, February 18th, 2006
Two layouts of melopia

I know that this changing technique has been dealt for many times by others, and I’m not the last one to deal with it.

I tend to make things flexible, not just a , but also real-life stuffs (so don’t fix a time with me, lol). OK, to make a layout flexible, it means to make everything inside it as flexible as possible. I have to decide what parts of the site is extensible while what’s not. The header and content area should expand according to user’s screen width, and in this case, I’ll leave the sidebar to its fixed size.

The things follows are regular:

Design the layout in any graphic apps you like( I use Macromedia Fireworks)
Keep in mind that what parts I was going to make flexible, so that I don’t put complicated graphic or effect to the extensible areas.
Prepare graphics
Export from the graphic design , and ajust them as needed.
Decide the markup
Some people may want to put this first
Write style sheet as if you’re making a flexible style
Make the whole layout flexible first, then it’ll be easier to fix it later if needed.

After the flexible layout is done, I need to wrap an extra div around the whole markup, so that the alternation of width will be a step away. The purpose of adding this layer is to make it the “canvas” of the page, to do so, just set its position to relative, so that absolute positioned elements won’t lose their way.

There, we got a flexible layout, but it’s now fixed, I’ll add a script to allow it to change width:

The first function fnToggleLayout(nLayout) is called on-demand by the user, when called, it changes the width directly by setting the style properties of the wrapper. The second function fnLoadSavedLayout() is automatically called when page loads. It writes html code to the document directly. You may ask why not re-use the first function in the window.onload handler. That’s because there’s a delay between the layout changing take place, and it’s annoying to see this effect every time you load a page.

There’re another two functions that I don’t list, the getCookie and newCookie, since they’re not the main points and could be found on the internet easily.

Some problems

However there’re some problems currently. As you may notice, I use the sIFR method to replace heading text. When switching from a wider layout to a narrower layout, the width of headding is not recaculated. But I think this could be easily fixed by re-calling the corresponding sIFR function.

Technorati Tags: , , , , ,