Subscribe to Alvin Poh's Blog by RSS reader
Subscribe to Alvin Poh's Blog by Email
Gadgets, Technology, Public speaking and IT from an undergraduate's perspective.
Windows XP PHP Bug / Easter Egg?
I just stumbled upon this accidentally! I realised that contact us pages are more exposed to spam bots and whatnot when you actually name the contact us page as contact.php or something similar. So I tried naming the file con.php. Works great on the server, but something interesting happened on my Windows desktop.

Apparently con.php cannot be created, copied or moved on to a Windows desktop for some reason. I’ve tried this on two different computers, both running Windows XP, and I got the same result.
Subscribe to my blog:
RSS reader
Email
Use Javascript to Display Random Image and Link
I was editing a PHP script today when I realised that one of the files did not allow PHP code. Weird. But the annoying thing was that I NEEDED it to run PHP code — or rather, I needed it to randomly display an image with a link.
So I had to find other means, which turned out to be good ol’ Javascript. The code below will allow you to use Javascript to randomly output or show an image with a link.
Download the Javascript here (Right click and save target as)
Subscribe to my blog:
RSS reader
Email
ZenCart Removing The “Show Quantity in Stock” Message From Template
I just found this out while playing around in ZenCart. If you have a ZenCart installation and you’re wondering how to remove that “Show Quantity in Stock” message from your product pages, there’s actually a setting in your admin panel to turn it off. Simply log into your admin panel and go to Admin > Catalog > Product types > Product general > Show Quantity in Stock. Set the value to “0″ and that’s it!
Note: Apparently some themes have issues with this function — even after setting this value to “0″, you’ll still find that the product page displaying that message. The only option now is to remove that line from your template.
Subscribe to my blog:
RSS reader
Email
Simple Machine Forums (SMF) Photo Gallery Installation and Setup
Been playing around with Simple Machine Forums (SMF) — it’s a cool forum software that’s robust and well-supported by an active online community.

For those who are unaware of this software, SMF is a free open-source forum application that can be installed on web servers. In contrast to paid software such as vBulletin and Invision Forums, SMF is available for free.
I didn’t want to shell out any money for vBulletin, so this will suffice. If it grows, I might have to migrate the forum to vBulletin though. Each vBulletin license is USD $160, but well worth it — it’s the holy grail of forums!
Summary of New SMF Features:
* * Database abstraction - with support for PostgreSQL and SQLite planned alongside that of MySQL.
* * Automatic installation of packages into themes other than just the default.
* * Email templates to simplify customization of forum emails.
* * Moderation center including post, topic and attachment moderation - to allow approving of user content before it is made public.
* * User warning system.
* * Additional group functionally including group moderators and requestable/free assignable groups.
* * WYSIWYG editor to provide an intuitive user interface to those users not familiar with BBC.
* * Permission improvements such as group inheritance and permission profiles to further reduce the complexity of the permissions system.
* * File based caching for a performance increase on all forums regardless of whether an accelerator is installed.
* * Mail queuing system to stagger the sending of emails to improve performance on large forums.
* * Advanced signature settings to allow the administrator of a forum to more tightly control the contents of users signatures.
* * Personal messaging improvements including ability to automatically sort incoming messages and a variety of display options.
* * Improved upgrade script with better timeout protection and simpler user interface.
* * Custom profile fields to enable administrators to add additional member fields from the administration center.
* * User configurable posts and topics per page; an improved calendar interface.
* * Option to allow guests to vote in polls.
Installing SMF
Installation of SMF is a breeze! I only had to make sure that I had a database created, but other than that, SMF’s installation wizard guides you through everything, and tries to fill in whatever it can find out first. Pretty nifty!
Installing a Custom SMF Theme
SMF supports custom themes, and there’s a whole bunch of themes available at the SMF Theme Site, all for free! I found some that I really liked there, and installed them.

Installation of SMF themes is fairly straightforward. You’ll need to upload your theme files to the SMF themes directory, and then install them using the link in your Admin panel. After which, you have to remember to reset your forum’s default theme to that if you’re only planning to have one look for your forum.
Installing SMF Photo Gallery
I got the lite version of SMF Gallery and installed it. Installation of a SMF package (or SMF mod) is not that straightforward because packages only install to the default SMF theme. I installed a custom theme, so I had to manually create the link to the photo gallery.
This means that you need to edit the custom theme’s index.template.php file. To get to that, go to your Admin menu, click on Configuration >> Themes and Layout >> Modify Themes.
Then look for this line of code:
// the [member] list button
Found it? Mine was in the code block beginning from line 463. You’ll find a small chunk of code following that line, and right after that, paste the following code, and you should now see a link that says “Gallery” on your forum!
// the [SMF Gallery] button
if ($context['allow_smfgallery_view'])
echo'<td align="center" class="maintab_' , $current_action == 'gallery' ? '2' : " , '">
' , $txt['smfgallery_menu'] , '
</td>';
Subscribe to my blog:
RSS reader
Email
Free ZenCart Templates / ZenCart Themes / Zen Cart Skins
If you’re thinking of creating an online ecommerce store, then you’ve probably seen the exorbitant prices that web design firms charge for creating a customised ecommerce shopping cart system.
Well, the good news is that there are really powerful open-source (read: free) software available that can do a good job. That’s right - not just cheap, but really free. ZenCart’s a great example of a free ecommerce store - it’s a customised branch of the popular osCommerce shopping cart software. There are thousands of successful live ZenCart stores, so it’s a proven, reliable shopping cart - one of the best you can get for that price!
The only trouble you have when you’re dealing with open-source software like ZenCart is the fact that the default template’s really ugly - functional no doubt, but it really shouldn’t be used for your live ecommerce store.
So you will need templates - nice looking templates that lend your ecommerce store some measure of credibility, so that your potential customers will actually become your customers. Now if you’re interested, TemplateMonster has some really nice templates. Problem is, the templates cost around USD $150.
The alternative is free ZenCart templates. However, they aren’t that common, and they’re pretty hard to find. I’ve been sourcing around for free ZenCart templates, and I’ve put all the templates that I found into a list of free ZenCart templates below. Enjoy!
Free ZenCart Templates
- Apple Zen - Demo | Download
- Cherry Zen - Demo | Download
- Clean Business - Demo | Download
- Red Passion - Demo | Download
- Virtual Shop - Demo | Download
- Mihluna - Demo | Download
- Zencart Zen - Demo | Download
- Pretty in Pink - Demo | Download
- Acadame - Demo | Download
- Atheme- Demo | Download
- Clothing Shop - Demo | Download
- Darkness - Demo | Download
- Amplify - Demo | Download
- Free Yellow, Free Red, Free Blue - Demo | Download
Subscribe to my blog:
RSS reader
Email
Formatting a Decimal Number to 2 Decimal Places in Java or JSP
I was looking around for the class to format a number to 2 decimal places while I was coding Java, or specifically JSP, and I found it.
First, you need to import the DecimalFormat class, so have this line at the top of your Java file:
import java.text.DecimalFormat;
Or if you’re running JSP:
<%@page import="java.text.DecimalFormat" %>
And here’s the actual code that does the magic:
double price = 10.59;
DecimalFormat priceFormatter = new DecimalFormat("$#0.00");
return priceFormatter.format(price);
That’s all there is to it! Simply change the Formatting string “$#0.00″ to anything you wish. The pound (#) sign simply means there can be optional digits there. The two zero’s (0) to the right of the decimal place means that it has only 2 decimal places, and will be replaced by 0s if you don’t have digits there. Te $ sign right at the start is something that I put in, because I wanted to display my prices in dollars ($).
So for example, you can also have the formatting string as “#0.00 seconds more” and it’ll show “2343.36 seconds more”.
Subscribe to my blog:
RSS reader
Email
HTML Button That’s A Link
Making your own link button with your own custom text is easy. You might want this because it looks different from a normal HTML link (you know, the blue underlined text).
Here’s how the linkable HTML button looks like:
Sometimes you might want a linkable HTML button because it fits into your overall design look and feel as well. So here’s the code - it requires Javascript, but it’s really simple. Just copy and paste the following line of code and you’re done!
<INPUT TYPE="button" value="Link Button" onClick="parent.location='yourpage.html'">
Just replace “yourpage.html” with the URL of the page you want to click and go to, and replace “Link Button” with whatever words you want your button to show.
Subscribe to my blog:
RSS reader
Email
14 Dec 07 | 


