Tuesday, January 4, 2011

How to Fix the 500 Error for Wordpress SEO Ultimate on 1and1.com Hosting

When you are using Wordpress on 1and1.com hosting and want to install the SEO Ultimate plugin you will get the following error message:

Error 500 – Internal Server Error

Here is how to fix the "Error 500":
  1. Create a file called "php.ini" in the /wp-admin/ directory of your blog.
  2. In the file add the text "memory = 20MB" without the quotes.
That's it! Once the memory limit is increased, you should be able to install SEO Ultimate plugin without problem.

Sunday, June 6, 2010

What is your DNS speed?

I just tried the open-source DNS benchmark utility namebench. Here is the impressing result:

Google Public DNS-2 is

76.4%

Faster

than your current primary DNS server


Here is a graph of the mean response duration:




The full result is at http://namebench.appspot.com/id/424004. The question is: are you willing to give all your DNS queries to Google for an average of 67 ms speedup for each DNS query? Can you even feel the difference in speed?

Thursday, June 3, 2010

How to try out a new Linux distribution

Did you ever wonder how your favourite new Linux distribution looks like? Now how can you try it without installing it and ruining your current OS? All current Linux distributions allow you to boot it without installing it so that you can see how it looks and feels. I'm going to show you how you can try the new Kubuntu 10.04 LTS.

First, you have to download the ISO image from here:  http://releases.ubuntu.com/kubuntu/lucid/kubuntu-10.04-desktop-i386.iso

Once downloaded you are going to use UNetbootin, which allows you to create a bootable Live USB drive (type "sudo apt-get install unetbootin" if it's not installed). Then type unetbootin to start UNetbootin.

Select the diskimage you just downloaded, here it's kubuntu-10.04-desktop-i386.iso. Then make sure you select the correct USB drive. Choose the type "USB Drive" and the appropriate drive. After clicking on OK it will copy the files onto the USB drive.

Once the copying is done leave the USB drive plugged in and reboot. At the BIOS you might have to select to boot from the USB drive.

Tuesday, June 1, 2010

How to extract the audio from a Youtube video?

Did you ever encounter a Youtube video you really like the audio part? I'm sure you wonder now how you can extract the audio from your favorite Youtube video. Here is how you can do it for free in three easy steps.

a) Download the Youtube video
First, you have to download the Youtube video.

b) Extract the audio from the video
You have to install mplayer (on Ubuntu: sudo apt-get install mplayer)
$ mplayer -quiet youtubeVideo.MP4 -ao pcm:fast:file=audio.wav -vc dummy -vo null -channels 2

This will extract the audio from the file youtubeVideo.MP4 and will convert it to a WAV file called audio.wav.

c) Convert the WAV file to an MP3 file
The last step is to convert the WAV file to an MP3 file which is a lot smaller and allows you to save space. For this we are using "lame" (on Ubuntu: sudo apt-get install lame):

$ lame audio.wav audio.mp3

This will take the audio.wav file and save it as audio.mp3. That's it. The file audio.mp3 contains the audio part of the Youtube video.

Sunday, May 30, 2010

How to download Youtube videos

Have you ever wanted to download a Youtube video? This is very easy with Firefox as there is an add-on called 1-Click YouTube Video Download. Once you have installed this add-on there will be a link below every Youtube video where you can download them in the following formats: MP4 HD (High Definition), MP4 High-Quality and FLV.



Which format should I download?

This depends on what you want to do with it. The MP4 file format is usually the recommended format as it allows easy conversions to other formats. The FLV format is the container file format used to deliver video over the Internet using the Adobe Flash Player. Finally the 3GPP file format is mostly used on used on 3G mobile phones.

Saturday, May 29, 2010

How to change the user agent in Firefox

Did you ever reach a website which said something like "Your browser is too old". Sometimes it is not easily possible to upgrade your browser like if you have an Asus Eee PC. Here's how you can change your user agent so that those annoying websites will work again.

With Firefox this is a peace of cake. First install the User Agent Switcher add-on for Firefox. Once you have clicked on "Download Now" and have restarted your Firefox you will have a new menu under Tools (Default User Agent) which lets you change your user agent to anything you want.

Once you have changed your user agent you can verify it on this site.

How to get the window ID (Xwindows)

Here is how you can the the x windows id:

$ xwininfo

Now click on the window you would like to get the id, eg. Firefox. You will get some results like this:

$ xwininfo

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x28000c8 "Getting window id for certain process id (for sharing theapplication) - Unix Linux Forum - Fixunix.com - Mozilla Firefox"

  Absolute upper-left X:  107
  Absolute upper-left Y:  102
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 847
  Height: 627
  Depth: 24
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +107+102  -326+102  -326-295  +107-295
  -geometry 847x627+104+78

Here, the window id of Firefox is 0x28000c8.

Now you'll ask yourself why on earth would I need the window id. This is useful for example if you want to record a video with recordMyDesktop which takes the window id as an argument like this:

$ recordmydesktop -windowid 0x28000c8

Friday, May 28, 2010

Feisty Performance - "Fly Like A Butterfly"

This blogpost is a mirror of an old URL (http://www.xsol.se/index.php/2007/04/29/feisty-performance-fly-like-a-butterfly/) which does not exist anymore. As there are still plenty of sites linking to it I'm publishing it here so it stays online.


Disable IPv6
At least I dont need ipv6 yet so this is what I do to disable it. In the future there might be some use of ipv6 but until then I’ll keep disabling it.
sudo kate /etc/modprobe.d/aliases
And change the line:
alias net-pf-10 ipv6
to:
alias net-pf-10 off #ipv6
Now comment out all the lines that has to do with Ipv6 in your hosts file.
sudo kate /etc/hosts
This will disable IPv6 on all network interfaces. You need to reboot.


Run boot processes in parallel
This will make upstart to run the boot processes in parallel and speed up the boot process.
sudo kate /etc/init.d/rc
Find and change the line:
CONCURRENCY=none
to:
CONCURRENCY=shell
Make sure to check your spelling, one little mistype here and you won’t be able to boot!!!
This one seems to do best if you are using SATA or SCSI but even on my old computer with the old ATA it does make the KDM login screen show up a little bit faster.
There could actually be that this tweak slows down your boot if you are using old hardware…

Aliasing hostname to localhost
Right or wrong, you decide. But I picked this up in the Ubuntu forums some time ago and it does improve the startup of some apps.
sudo kate /etc/hosts
and add you hostname to the first line after localhost like this:
127.0.0.1 localhost yourhost
127.0.1.1 yourhost

Disable pango
I know that this is already taken care of in firefox but it still makes a good performance boost to thunderbird and some other apps.
sudo kate /etc/environment
and add:
MOZ_DISABLE_PANGO="1"

Disable gettys
Thank’s to some anonymous user for the tip.
sudo kate /etc/event.d/tty3
and comment out the lines starting with start and respawn with a number sign (#).
This does not improve my performance at all but it saves a little resources so why not


Preload
It does what you think. It preloads most common used libs and application = faster startup times on your applications (this does not increase your boot speed as some might think).
sudo apt-get install preload
What about prelink?
Prelink is no longer necessary in feisty. Feisty uses a new linking mechanism called DT_GNU_HASH which speeds up the linking process without the need for continuously running prelink.

Swappiness
The default value for vm.swappiness is 60 in Ubuntu Feisty whic is a good default value but if you want to tweak the performance a little bit more you can change this value to a lower value to reduce the load of the swap. If you run the follwing command:
sysctl -q vm.swappiness
You will se that the value is set to 60. And by running:
sudo sysctl vm.swappiness=10
You will change the value from 60 to 10 which will make your system write to swap a lot less and I would recommend this to everyone that has 512 MB of memory or more. If you find that you have very little use of swap set the value to 0. This will not disable the swap but it will make your system write to the swap as little as possible and keep as much as possible in memory. This makes a huge improvement when switching between applications since they are now likely to be in physical ram instead of on the swap partition.
To set your value permanent you need to change the sysctl.conf file:
sudo kate /etc/sysctl.conf
Add the line
vm.swappiness=10
To the end of the file. This way it will be set upon boot.
I’ve found that the value of 5 works very good for my use and I have 1 GB of memory.

Grub option profile
There is a option to grub called profile which will profile your startup. What it does is that it kind of indexing all the files read during boot/startup and later on it will find and read those files quicker.
Hit the escape button when booting to get to the grub menu.
Select your default boot kernel and hit the e button.
Go down to the second line and hit the e button again.
Add profile to the end of the line and press enter.
Hit the b button to boot with your new option.
The first time it will take a little bit longer to boot because it has to build the index (or whatever they want to call it) but every boot after this will be a lot smoother.
You need to do this every time you update your kernel or have made other huge changes to your system that might affect the files needed during boot.

sysv-rc-conf
Install sysv-rc-conf and disable the services you don’t need at startup.
As an example. On my computer I don’t have bluetooth or PCMCIA so I don’t need to start it at boot time.
So simply disable what ever you don’t have or use.
sudo apt-get install sysv-rc-conf
and then run:
sudo sysv-rc-conf

Xorg
This is just a general tip. I will not tell you what to remove. You know best what you need…
If you strip down the xorg.conf you can decrease the amount of resources that xorg will use.
sudo kate /etc/X11/xorg.conf
Remove any unnessesary fontpaths, modules and the wacom devices (unless you need them).
By removing the wacom devices you will also get rid of those anoying errors that usually prints out in the console whenever you run an application.

Kernel hacking
Even thought the new kernel in feisty is very good and already tuned a bit there still are some things you can do to the kernel that will make your system snappier and boot up even faster.
Use this thread from the ubuntu forums as a guide on how to compile your own kernel.
master kernel thread
What I do is that I make sure to add the file systems and drivers I use to the kernel instead of loading them as modules. Take out whatever I don’t have or use and then compile my new and hopefully improved kernel
If you don’t want to compile your own kernel there is now a low-latency kernel in the universe repos that you could try.

Disk and file system setup
This is probably the most important thing to think about when you are about to install your computer. The choice and use of the disks and file system is a huge issue when dealing with performance. Depending on your usage of your system you might need to configure your file system different.
For my usage I like to use the following setup (which I think is a good desktop setup).
Mountpoint File system Size
/boot ext2 100 MB
/ LVM, VG=system, XFS 6 GB
/swap LVM, VG=system, swap The size of RAM in your computer. Making it smaller and you will not be able to hibernate.
/home LVM, VG=system, XFS 1 GB, or the rest of the space in that VG
/data LVM, VG=data, XFS The rest of the free space
I’m using the following options in fstab for all my xfs partitions:
noatime,nodiratime,logbufs=8
Using LVM can really speed up the disk performance. And you get a lot of other good stuff with it as well. Read more about LVM here.
I choose to have /root and /home on one VolumeGroup and /data on another simply because I can then split them up on different physical disks and have them spanning over multiple physical disks witch really speeds up the reads and writes.
What about hdparm?
I have not found any use for hdparm on SATA disks (seems to lack support for SATA). But on older disks there are some things you could tune with hdparm.
Anyhow, since I don’t use it I won’t give you any example on how to use it. Simply search for hdparm on the net and you will find plenty
Defragmentation of XFS filesystem
Until just about a month ago I did not believe that the worlds best file system could get fragmented so I never even bothered to check it out. But then I accidentally came across an article discussing fragmentation on different file systems and I realized that it actually could.
So here is how to defrag your XFS filesystem
make sure that you have xfsdump installed and the run:
sudo xfs_db -r /dev/[your xfs partition]
at the prompt xfs_db> type in frag to view the fragmentation factor and then type in quit to exit the xfs_db util.
If your fragmentation factor is above 10% then I would recommend defragmentation.
Now, to actually defrag the filesystem you need to do this
sudo xfs_fsr -v /dev/[your xfs partition]
And then it is time for a well needed break from your computer for a while.
The results. The one thing that I immediately noticed is that after defragmentation is that the operations browse and delete are much faster on my XFS partitons.
At the moment this is pretty much it but I will update this guide as soon as I discover more performance tunings…

Tuning applications

At the moment there is not so much to add here but this what I like to do.
Firefox
Use swiftfox instead. It’s optimized for your CPU.
If it’s not already set, disable ipv6. In the url enter about:config and find the ipv6 entry and disable it. And while you are at it change the ui.allow_platform_file_picker to false to change the file dialogs to look a little bit better (if you are a KDE user like me).
Addons I use:
MediaPlayerConnectivity
Opens video stream directly in an external video player
fasterfox
A nice gui to tweak the performance of the browser
adblock plus
to disable ad’s it helps a lot
Mouse gestures
Cause it makes the surfing a lot easier…
Theme:
KDEFF
Gives it a little bit more of a KDE look and feel…
Openoffice
If you don’t need that extras that java JRE provides then simply disable it openoffice. That’s what I do.

Q & A

I followed this guide and managed to screw up, now I can’t boot…
Hey, what can I say. Life’s a bitch…
Well ok then. Here’s something that might help.
Boot up your computer with the Feisty desktop cd
mount your root file system and change/restore your files again.
If you are using LVM then apt-get install lvm and then run vgchange -ay to activate your LVM volumes before you can mount them.

Wednesday, May 26, 2010

Speedup old Linux PCs by disabling auto run of "updatedb"

Here is a way you can speedup old Linux PCs by disabling the auto run of updatedb. updatedb creates a database of all local files (an index) so they can be found faster. Most users won't need this so it can be safely disabled.There can be several files responsible for the daily update of this database:

/etc/cron.daily/find
/etc/cron.daily/slocate
/etc/cron.daily/mlocate

By default the run-parts program (which is used to run all the files there) only accepts files which contain letters, numbers and hyphens. Renaming the file to something with a dot in it for example will cron stop from executing this file.

To rename these files you have to type the following a console:

mv /etc/cron.daily/find /etc/cron.daily/find.old
mv /etc/cron.daily/slocate /etc/cron.daily/slocate.old 
mv /etc/cron.daily/mlocate /etc/cron.daily/mlocate.old

This will rename the three files so that cron will not execute them anymore.

Monday, May 24, 2010

Set up Kubuntu 8.04 (hardy) automatic updates

Here's how you can set up your Kubuntu 8.04 (hardy) for automatic updates. This is useful if you have set up a Linux system for someone who is not very familiar with the system but you still want them to have the most recent security updates.

First you have to start the Adept Installer by clicking on the "K" in the lower left corner and then "Add/Remove Programs". You'll the see the Adept Installer coming up:

Click the button "Edit Software Sources" in the bottom left corner. In the next window click on the tab "Updates":

Now you can select "Install security update without confirmation. From now on your Kubuntu will check daily for updates and install them automatically.

Saturday, May 22, 2010

How to download Apple trailers with wget

Did you ever try to download a trailer from trailers.apple.com? It doesn't work. Apple is trying to limit downloads to the iTunes application. Here's how you can change your user agent so the download works with wget.

Choose a trailer to download. For example the movie The Scientist produces the link
http://trailers.apple.com/movies/independent/thescientist/thescientist-tlr1_720p.mov

To get the correct URL you have to add the letter 'h' before the resolution. In our example the correct URL will look like this:
http://trailers.apple.com/movies/independent/thescientist/thescientist-tlr1_h720p.mov

Now you can use wget with the parameter -U QuickTime/7.6.4:

wget -U QuickTime/7.6.4 http://trailers.apple.com/movies/independent/thescientist/thescientist-tlr1_h720p.mov

Have fun watching the trailers.

The difference between a client and server SSL certificate

So what is the difference between client and server Secure Sockets Layer (SSL) certificates? Although client certificates and SSL server certificates both use certificates, they are not directly related to each other. SSL server certificates provide encryption and security functionality. Client certificates provide user authentication functionality. The client certificate identifies the user, the server certificate identifies the server.

Here is the technical difference between the two. The difference lies in the Certificate Extensions. The X.509 standard defines what information can go into a certificate, and describes how to write it down (the data format). X.509 Version 3 is the most recent (1996) and supports the notion of extensions.

This tech note by Mozilla describes the Certificate Extensions in detail. But here are the extensions which are necessary for a client certificate:

basicConstraints = CA:FALSE
nsCertType = client
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = clientAuth


If you want to know how to create such a client certificate, see my last blog entry.

How to create a self-signed SSL client certificate

Here's how to create a self-signed SSL client certificate with openssl on the command line.
First we have to create the private key:
openssl genrsa -out client.key 2048
Now we can create certificate request. Enter all the distinguished name information required to create a certificate request using the following command:

openssl req -key client.key -new -out client.req



OpenSSL commands expect to receive a file named: client.cnf. This file stores information that help generate extension fields to the certificate. You must create the client.cnf file with the following information:

[ ssl_client ]
basicConstraints = CA:FALSE
nsCertType = client
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = clientAuth

Create a certificate request into a self signed certificate using extensions for the client certifiacte:
openssl x509 -req -days 365 -in client.req -signkey client.key -out client.crt -extfile client.cnf -extensions ssl_client
Verify the certificate:
openssl x509 -text -noout -in client.crt
As you can see the SSL extensions are now part of the certificate:
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Cert Type:
SSL Client
X509v3 Key Usage:
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Client Authentication


Now you can test your SSL connection with the following command:
openssl s_client -connect localhost:443 -key client.key -cert client.crt