How To Setup And Use Memcached With WordPress

A few days ago, I spoke about the architecture that powers Techie Buzz. In that post, I had mentioned that memcached was one of our key ingredients.

Memcache is a powerful tool to share objects across servers and it is used by several big sites including , Yahoo and many more. The best part about using memcached on your server is that you can cut down on your database queries significantly and store commonly used objects in memory and share it across multiple servers.

If you use WordPress on a multi-server setup, you can easily cut down on DB queries by up-to 50% by implementing memcached. If you are interested in knowing how to implement memcached on your server, here is a tutorial. The assumption is that you are using Ubuntu, if not, the installation steps might change.

How To Install Memcached And Configure It

Step 1: Install memcached using the command given below

sudo apt-get install memcached

Step 2: After you have installed memcached you will have to configure it through a .conf file, to do that use the command given below

vi /etc/memcached.conf

Step 3: In the configuration file you will find few parameters, you can ignore the -d, -u and logfile parameters and leave it as default. However, change the -m, -p and -i parameters to suit your servers. The -m parameter specifies the memory that will be allocated to memcache. The -p parameter specifies the port that memcached will run on and the -l (ell) parameter specifies the IP address the memcached server will run on. You will need to change the -l (ell) parameter value from 127.0.0.1 to a local or global IP address of your server. This is necessary because your memcached server will be accessed by outside servers and using 127.0.0.1 will not work then.

Once you have done that run the following command.

service memcached restart or /etc/init.d/memcached restart

Using Memcached With WordPress

Once you have setup your memcached server, it is time to now setup WordPress to use memcached to store your objects. To do that, head over to http://wordpress.org/extend/plugins/memcached/ and install the memcached plugin for WordPress. Unlike other plugins, you will have to drop this file into the wp-content directory and not the plugins directory.

You will have to install additional plugins for your server to make use of this plugin, namely PECL memcache extension which can be downloaded from http://pecl.php.net/package/memcache.

Now comes the part where you will actually tell WordPress to use memcached as an object storing mechanism. To do that, open the wp-config file and add the line below to it.

global $memcached_servers;
$memcached_servers = array(‘default’ => array(‘memcache-server-ip-or-name:11211′));

The array is used to define multiple memcached servers which can be used for your site. Please make sure to edit the name/ip of the server and the port before you save the file.

That’s it. Now just refresh your cache and WordPress should start storing the objects in memcache and will access your database very sparsely.  Do let me know if you have any problems or difficulties in setting this up through your comments.

Bonus Note: You can browse and manage your memcache server through a WordPress plugin called WP Memcached Manager which can be downloaded at http://wordpress.org/extend/plugins/wp-memcached-manager/.

How To Use Ubuntu Font On Your Website or Webpage

The Ubuntu font was released last year in August to everyone and it was definitely one of the best looking fonts I have come across. I also use the Ubuntu font extensively on my PC thanks to this handy trick to install Ubuntu font on Windows.

Use Ubuntu Font on Websites

As I was redesigning the website to give a fresher look to it, I wanted to make use of the Ubuntu font for it. Unfortunately, it is not a web font yet modern web browsers won’t understand it.

However, you can use the Ubuntu font for your website or any webpage on the internet thanks to Google Web Fonts. In , you can also change the font of any website using a called Google Font Directory.

Ubuntu Font for Websites

To implement the Ubuntu font on your website or webpage, head over to this page and click on the link which says "Use this font". On this page you will find code and instructions to use the Ubuntu font on your website. Just copy over the code to your webpage and you can specify your font as "Ubuntu"

Google Web Fonts also has several other fonts which can be used on any websites or webpages, head over to http://www.google.com/webfonts to browse the entire collection.

P.S. Don’t forget to tell me what you think of the new Techie Buzz design.

How to Run Windows Live Writer in Linux

Last week, an online buddy of mine told me that he’d use Linux more often if he could run Windows Live Writer in it. I had to agree, there are many different blog editors in Linux, but once you’ve gotten used to using Live Writer, you’ve been spoiled and won’t want to use anything less satisfying.

After a bit of searching around online, I finally figured out that the best solution might be to run a full copy of Windows inside a virtual machine. Then I’d have the best of both worlds within easy reach. After trying it, I discovered that it works quite well. In fact, this article was posted from Xubuntu Linux, using Windows Live Writer.

wlw-in-linux

virtualbox_logoI decided to use VirtualBox as the virtual machine server, because it’s open source, but mainly because it’s already in the Ubuntu Software Center. Installing it was as easy as searching for VirtualBoxand marking it for installation.

An old, unused copy of Windows XP was my choice for a guest operating system. I was familiar with the steps needed to set that up, but if you need help, you can find a great tutorial on installing XP in VirtualBox at Linux Journal.

After I had XP running the first time, I did have a few problems. I kept receiving warnings that I didn’t have the Automatic Updates enabled. Since this was virtual machine, I really didn’t want it to update. If I had any problems, I could always use VirtualBox’s snapshots to return to an older state when needed. I finally opened XP’s Services manager and turned off the Automatic Updatesand the Security Center.

You can launch the Services manager by clicking Start, Runand then typing services.mscinto the run box (without quotes).

services

I also noticed that I couldn’t copy and paste between Linux and Windows. I found out that I needed to install the Guest Additionsin XP. You can find these in the VirtualBox Devicesmenu while the virtual machine is running.

vb-guest-additions

There are two versions of Windows Live Writer. One version is for XP, while the most current version is for Vista and Windows 7.

Once you have Live Writer installed this way, you are ready to blog with ease, no matter what flavor of Linux you’re using. If you have your own favorite blog editor, let us know in the comments below.

Fix Syslinux No Default or UI Configuration Error While Booting from USB

Quite recently my laptop’s backlight stopped working and I had to start using an older laptop whose HDD no longer works. I created a Live CD USB drive using Pendrive Linux’s utility for Linux Mint.

However, while booting with the pendrive I got an error saying:

SYSLINUX 3.85 2010-02-20 CBIOS Copyright (c) 1994-2010 H. Peter Anvin et al
No DEFAULT or UI configuration directive found!
boot:

This error kept happening no matter what I did. I tried to use another USB drive to create a new bootable drive, used different flavors of Linux but had the same problem. I searched around several forums but the solution for it wasn’t easy.

However, I did find the solution and wanted to post it here so that other users who face this problem can find it easily. In order to fix this problem, you will have to plugin the USB drive into another computer and then rename the “isolinux” folder to “syslinux”. In addition to that also rename the “isolinux.bin” and “isolinux.cfg” files in the same folder to “syslinux.bin” and “syslinux.cfg” respectively and try booting with the USB drive again.

If the above solution does not fix your problem, you can try formatting your drive as FAT instead of FAT32. And by the way, I would be getting a Dell XPS Studio 1645 soon, so you can expect a review of the monster laptop soon :-)

SYSLINUX 3.85 2010-02-20 CBIOS Copyright (c) 1994-2010 H. Peter Anvin et al

How To Access Your Linux Partitions From Windows

[Windows only] We’ve all been in this situation before. A lot of times. Imagine you have a dual boot system, running Linux and Windows. You spend quite a lot of time on your Linux partition. On the occasion that you boot into Windows, you realize that the important file you have been working on is saved on your Linux partition. Now to get that file, you could boot back into your Linux partition, save it on your Windows partition and boot back into Windows but that’s a drag.

This is where Ext2Read comes in. Ext2Read is a Free & Open Source Software which allows you to browse your Linux partitions in a very Windows Explorer-esque interface. Unlike other tools that we’ve covered before, Ext2Read also supports ext4 filesystem, even if extents feature is enabled. Like the name suggests Ext2Read can only read, not write to the partitions so in case you are paranoid about the tool causing data corruption to your Linux partitions, you can drop those fears.

Using the tool is pretty easy just download the file from its SourceForge page, and run it. Windows Vista/ Windows 7 users will have to run it as an Administrator to Ext2Read to work correctly. To do this, just right click on the file and Select Run as Adminstrator’

Once you start the application, it will show all your Linux partitions on the left and the files on the respective partitions on the right.

ext2explore

To transfer a file just right click on it and select save.

ext2explore-save

Overall, the application is pretty good, and quite honestly, the only negative thing about it is the way the icons are arranged, especially if you have lots of files with varying filename lengths in which case it looks pretty shabby.

ext2explore-arrangement

Techie Buzz Verdict:

Ext2Read is probably one of the best tools to read data from your Linux partition. If you dual boot your system with Windows & Linux, this is a must have tool.

Techie Buzz Rating: 4/5 (Excellent)

Add Extra Swap Space To Your Linux Box with a USB drive [Linux Hacks]

You must have heard about a feature called “Readyboost” in Windows Vista and Windows 7, which lets you add a flash drive or USB thumb drive as an extra drive for disk cache. By using this feature system performance is significantly increased, as the newly added flash drive increases the virtual memory of your computer.

In a similar way, you can use a USB flash drive to add extra swap space to your Linux OS. Increasing the swap space means increasing the system performance. Christer Edwards has written a shell script, which allows you to add a USB drive as an extra swap space in Linux. You can download the shell script file from here : http://bit.ly/6V87XK

The steps required to use the extra space on the USB drive as swap space are :

  1. Insert USB disk and allow KDE/Gnome to auto-mount the device.
  2. Open a Terminal and run ./swapboost.sh -n to create a new swap addition.
  3. After executing these steps the swap space would have been increased, by the amount of free space on the USB drive. You can check the available swap space for your Linux OS with swapon -s .

When you no longer want to use the USB drive as an extra swap space, you can do the following:

  1. In the Terminal, run ./swapboost.sh -d to delete added swap and safely unmount your USB disk.
  2. Your swap should now have been reduced by the amount of space previously added. swapon -s will now show only your default swap space.

Note: This script is still in alpha stage, so use it on your own risk.

Create Bootable USB Drive for CentOS/RedHat

ISO2USB is a handy utility for users who want to create bootable USB drives for CentOS or RedHat 5.X. You can create the bootable CentOS or RedHat USB drive by using your install CD or ISO image file.

Create Bootal CentOS/RedHat 5.x USB Drive

You can then use the USB stick to perform installations on computers which do not have optical drives. ISO2USB also supports custom installations disks.

The bootable USB drive can perform the full install and does not require network support.

Download ISO2USB

How to transform Ubuntu(Gnome) into Windows XP desktop

You are using Linux desktop for advanced features and security, but do you still miss the Windows XP looks and layout?

There are many options, using which, you can tinker around and experiment with themes and icons etc., until you get that perfect XP look for your Linux Box running Gnome.
Well, the good news is that you can now theme Gnome desktop, completely into XP style, using a single script.

PhrankDaChicken has launched XpGnome script that transforms Ubuntu (Gnome) into Windows XP look-alike.
You can download the script from here .

transform gnome into windows xp
transform gnome into windows xp

The script changes the following components:

  • Icons
  • GTK
  • Metacity
  • Usplash
  • GDM theme
  • Mouse
  • Panel background
  • Desktop background
  • Nautilus tree view

It deletes all the Gnome panels and adds a new panel at the bottom with:

  • Start Menu
  • Show Desktop
  • Window switcher
  • Notification area
  • Volume control
  • Clock

But as a general rule with Linux, be prepared for things to screw up.
So, in case if you want to get your old and working desktop back by reverting the settings. Simply run the Restore_Settings script in the restore folder.

Here is a complete video tutorial on how to install and then revert XpGnome script, on Youtube.

So why does anyone want this script?

Techie-buzz verdict: This script is for people who often screw their Windows XP desktop. So, now they can have a stable Linux OS with familiar Windows Xp looks and feel.

Single Command to Reinstall Ubuntu

Did you screw up your Ubuntu install? No need to download all the packages or get our your Ubuntu CD for a new installation. A single command can help you reinstall Ubuntu and reinstall all the packages from core and reconfigure them.

To reinstall or restore Ubuntu to a factory install from the command line, run the following command:

   1: sudo dpkg-reconfigure -phigh -a

To run minor restores and dependency issues, you can run the command:

   1: sudo apt-get install -f

Don’t forget to your data before you run any of the commands.

Reinstall Ubuntu automatically [via Kabatology]

Crontab Generator

Cron jobs are basically scheduled tasks for Linux based OS, that are supposed to run at certain intervals, users can manually add cron jobs to their system by using the command crontab eand editing the file to add new cron job.

However not many people are familiar with the syntax of Crontab, to help them out there is a excellent service that will allow users to generate the syntax, by providing with a wizard interface.

You can use the wizard to get the syntax for the cron by inputting the command name and choosing the frequency you want to run it at.

crontab_generator

Once you have selected the settings, click on Create Crontab Line button, the service will automatically generate the syntax for the cron.

You can then copy the syntax and use the command crontab eto edit cron jobs and insert the new syntax. Can’t get any simpler than this.

Crontab Generator [via tweet from @SathyaBhat]