Archive for the 'Technical' Category

Separate home page layout for Zen Cart

I’ve been playing around with Zen Cart for a while now, and for the last couple of days I’ve been trying to get the home page layout to be completely different to the rest of the site layout. Most online shops seem to be able to do this, so I thought why not Zen Cart? After some searching and a bit of poking around I finally figure it out. the good news is that it’s really easy to do with Zen Cart.

“This is assuming that you have already created your Custom Template theme, or at least know how the Custom Template themes work in Zen Cart.”

Okay here’s how to create your custom Zen Cart homepage, starting from the base of your Zen Cart directory go to your custom made template directory “includes/templates/Your_Template/” and create a new directory inside that called: index

Next copy the tpl_main_page.php template from
includes/templates/templates_defaults/common/” to the new index directory that you just created.

Then the last thing that you need to do is go to your custom css directory located in “includes/templates/Your_Template/css/” and copy the existing stylesheet.css to index.css

Success - Your Zen Cart home page is now completely independent from the rest of your site design, all you need to do is edit either of the the two files you just created tpl_main_page.php or index.css to make changes.

includes/templates/Your_Template/index/tpl_main_page.php
includes/templates/Your_Template/css/index.css

Creating Custom Grub Splash Image

I’ve not posted anything technical for a while, well if you can call this technical. I just thought I would write a quick ‘how to’ for creating your own custom grub splash images.

I am assuming that since you are trying to create a grub splash image that you are using some variation of Linux and have the gimp & gzip installed.

Creating The Grub Splash Image

To begin you need to either create your image or find one you like. Once you have an image, open it up with the gimp and resize it to 640 x 480. To do this go to Image > Scale Image and then enter the width 640px & the height 480px and then click scale. now you need to reduce the amount of colors used in the image to 14 to do this select Image > Mode > Indexed Colours and then where it shows maximum number of colors set this to 14 and click ‘ok’.

Now save the image with an .xpm extension by selecting File > Save As then entering the name of you new grub splash image followed by .xpm (mygrubsplash.xpm) or you can select the file extension from a list by selecting File > Save As then clicking Select File (Type By Extension) then just click save, but it is probably easier just to type the .xpm extension after you enter the file name.

The last step to creating your custom grub splash image is to gzip it. Just as long as you remembered where you saved it, if you are using Gnome (not sure about KDE) you should be able to right click on your new .xpm file and select create archive then select the .gz file extension from the drop down list and click create. If for some reason you are unable to do this, then you can do it all through the command line as a normal user, just make sure to change to the directory that your splash image resides in first.

$ cd /foo/bar/
$ gzip -c mygrubsplash.xpm > mygrubsplash.xpm.gz

Installing The Grub Splash Image

Now you can install it. All you have to do is move your .xpm.gz file to /boot/grub/, You can do this through the command line but you must be root, so either su - or sudo like so:

# su -
# mv /foo/mygrubsplash.xpm.gz /boot/grub/

or

# sudo mv /foo/mygrubsplash.xpm.gz /boot/grub/

You then have to edit a file called menu.lst which is located in the same directory /boot/grub/menu.lst and adding this line: splashimage=(hd0,0)/grub/mygrubsplash.xpm.gz to it where mygrubsplash is the name of your.xpm.gz file. first check to see if this is already present in your menu.lst file, if so just edit the name of the .xpm.gz bit to match your own.

I’m using Vi to edit the file, because it’s pretty much the default text editor for most Linux distros. Feel free to use a text editor you feel more familiar with.

# vi /boot/grub/menu.lst
splashimage=(hd0,0)/grub/mygrubsplash.xpm.gz

Quick tip if you have never used Vi to edit with, you must first press ‘i‘ to start editing and when you are done editing press the escape key in order to save the changes to the document you must press ‘:wq‘ that will save changes and exit the document. if you just want to quit without saving the changes press ‘:q!‘.

Also you may want to change the default background colour and text colour to better suite your new splash image. You can do so by adding the text below to your menu.lst.

foreground = ffffff
background = 000000

If you are using Debian like me, you may want to comment out the default colours first before you add your custom colours. You can comment them out using the hash ‘#’ symbol.

#Pretty colours
#color cyan/blue white/blue

Hopefully if you followed everything correctly you should have your custom grub splash installed and ready. You should now be able to view it the next time you reboot. Have fun ;).

DHCP Installation & Setup on Centos 4

DHCP (Dynamic Host Configuration Protocol) is used to assign IP addresses to clients on the network. We can use the server package to assign the IP addresses of valid DNS servers, WINS name servers, TFTP boot servers etc.

Installation of DHCP is fairly straight forward. Simply install the DHCP server from your nearest repository.

# yum install dhcp

After the installation script has finished running, the configuration file will need to be edited to suit the needs of your enviroment.

# vi /etc/dhcpd.conf

An example of standard DHCP configuration file follows.

ddns-update-style none;
deny bootp;
authoritstive;
subnet 192.168.0.0 netmask 255.255.255.0
{
option subnet-mask 255.255.255.0;
option domain-name "example.com";
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1, 192.168.0.10;
option netbios-name-servers 192.168.0.2;
range dynamic-bootp 192.168.0.60 192.168.0.120;
default-lease-time 31200;
max-lease-time 62400;
}

OK lets explain the above DHCP configuration. Any machine that connects to the server will recive a dynamic IP address between 192.168.0.60 and 192.168.0.120 and a subnet mask of 255.255.255.0.

The server will dish out the default DNS servers for the client of 192.168.0.1 and 192.168.0.10 along with the default domain name suffix of example.com. The configuration also specifies a default WINS server of 192.168.0.2. This is useful if there are Microsoft Windows clients connecting to a Samba Server on the network.

The default lease time is 520 minutes (counted in seconds) and the maximum lease time is set to 1040 minutes (again, counted in seconds).

Once the DHCP server has been configured, and the file saved, it can be started by executing:

# /etc/init.d/dhcp start

Make sure that once everything is working correctly, and you are satisfied with the configuration, you make sure the dhcpd init script is set to start on system reboot.

# chkconfig dhcpd on

Linux Preformance Tweaks

This post just quickly explains how to tweak your linux distribution for better performance. Hope it helps.

Fix constant memory swapping

System swap settings are normally set too high on an initial kernal installation (unless the kernel has been optimised by yourselves.)
To check this setting run:

# cat /proc/sys/vm/swappiness

Standard kernels are set at 60, but I have found benefits to changing this to 10.

Change on the fly:

# sysctl -w vm.swappiness=10

To change permanently add the following to the file /etc/sysct1.conf:

# vm.swappiness=10

Disable virtual terminals that are not required

This procedure will increase system memory that is normally required for virtual terminals. Edit /etc/inittab and comment out the terminals that are not require. Make sure you leave a couple for emergencies though!

# vi /etc/inittab

example:

1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

Speeding up OpenOffice on desktop machines

OpenOffice can take upto 30 seconds to open on some systems, this should speed it up. Another method is to pre-link OpenOffice with either Gnome or KDE.

Start OpenOffice.Org writer
Click Tools
Select Options
Click Memory
Set the options as follows (under graphics cache)
128Mb
20Mb
00:10

Speed up Mozilla Firefox

Mozilla is set to attach to a single HTTP object at a time when initially installed. make the following changes, and you will see a noticeable speed improvement.

Go to the following URL about:config and change these values

network.http.max-connections = 128
network.http.max-connections-per-server =48
network.http.max-persistant-connections-per-server = 12
network.http.max-persistant-connections-per-proxy = 24
network.http.pipelining = true
network.http.pipelining.max-requests = 30
network.http.proxy-piplining = true

Hard Disk Performance Tuning

IDE HDD’s can sometimes be configured incorrectly. Make sure that the changes you make here are compatible with the drive!!!!

hdparm -c1 /dev/hda (set IO to 32 bit)
hdparm -d1 /dev/hda (set DMA to on)

as ever, test before and after by running

hdparm -t /dev/hda