Archive

Archive for the ‘Technical’ Category

Speeding up Firefox under Ubuntu

February 14th, 2010 Mohammad Al-Shami No comments

Ever wonder why browsing under Ubuntu is slower than Windows even on the same network? Well, it has to do with Ubuntu enabling IPv6 by default. This means Ubuntu will try IPv4 only after IPv6 times out. Also, Firefox comes built with Pango by default which makes it slower than it should be. I’ve fixed that on Karmic Koala, other versions should be similar. Here’s how to do it:

Disable IPv6 globally:

sudo vi /etc/default/grub

then find

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and replace it with

GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”

Then update grub from the command line

sudo update-grub

Tell Firefox not to load Pango:

vi ~/.bashrc

and add

MOZ_DISABLE_PANGO=1

at the end

Tweak Firefox’s about:config settings:

network.http.pipelining -> True
- network.http.pipelining.maxrequests -> 8 or 10
- network.http.proxy.pipelining -> True
- network.dns.disableIPv6 -> True

Enjoy

Categories: Linux Tags:

Cleaning up your boot partition with Ubuntu

December 25th, 2009 Mohammad Al-Shami No comments

If you haven’t reinstalled Ubuntu in a while, the /boot partition will eventually fill up with all the updated kernels, and you’ll get an error when trying update.

At first I used to uninstall the old kernels manually but being lazy I think it’s too much work. When you get the error with update-manager or Synaptic try this:


sudo aptitude search linux -w 160 | egrep '(image|headers|restricted)' | egrep '^i' | grep -v 'KERNEL_VERSION' | grep -v -P '[^\d]-generic' | grep -v linux-restricted-modules-common | sed 's/i A/i  /' | awk '{print $2}' | xargs sudo aptitude remove

Replace “KERNEL_VERSION” with your currently running kernel.

This might break your grub configuration but update-manager will fix that for you so no need to worry. Just make sure you run this BEFORE update-manager does the update.

To be honest I didn’t try this without “grep -v ‘KERNEL_VERSION’” so I’m not sure if removing it would break something. Just leave it there to be safe.

Categories: Linux, Technical Tags:

My Experience with the Motorola CPEo 400 Wimax CPE

November 10th, 2009 Mohammad Al-Shami 14 comments

Where I live we have no proper DSL (512Kbps max), GSM signals are weak. Sometimes I have to stick my head out of the window just to be able to make a call. Even when I got my Wimax account the indoor CPE kept disconnecting every few minutes. I finally managed to get my hands on an Outdoor CPE which made things much better. Typical for someone living at the edge of the world (West Amman).

The Motorola CPEs act as network gateways, they connect to the Wimax network and do NATing for you. That’s nice for a home network, less stuff to configure and less clutter.

The indoor CPE worked well when it had coverage, but when I switched to the CPEo 400 I started running into all sorts of problems; DHCP and DNS stopped working, Connection drops, signal losses, and CPE restarts for no apparent reason.

Calling customer care for a week didn’t help, as you know it’s useless if your problem is a bit different. Oh believe me, Orange’s customer care is much worse, at least with Zain they tell you if they’re experiencing technical issues, with Orange it’s always your indoor wiring.

Turns out there are some bugs in the OS running on the CPE, I’m assuming it’s some sort of Linux distribution gone horribly wrong (Software version 02.01.90-02/11/2009). If you turn on UPnP all Hell breaks loose. I thought I should share this because of the lack of documentation and support for this particular unit.

You have 2 solutions, choose whichever fits your technical skills and/or your time.

Solution 1 (simple): This was the first one I went with, just connect the CPE to the WAN port of your aDSL router. Configure a static IP address and DNS on the router so it won’t use the CPE and use that IP as the DMZ. This will have the CPE forward all traffic to the router and have the router handle all the UPnP issues. This, however, you’d end up with double NATing, something not everybody likes.

Solution 2 (A bit technical): Install dd-wrt on your aDSL router and have it take of DHCP and DNS, then configure the default gateway as your CPE. You won’t have UPnP here but you can set up port forwarding on the CPE which should work fine.

VMware remote console Firefox plug-in and arrow keys

June 30th, 2009 Mohammad Al-Shami 2 comments

VMware remote console was working properly for me when I was using Ubuntu Hardy. After upgrading to Jaunty the arrow keys stopped working inside the remote console. Seems some people face this problem even under windows.

A search got me to this:

echo xkeymap.nokeycodeMap="TRUE" > ~/.vmware/config

Just close any open remote consoles and open up again and you’re in business.

Lighttpd, Joomla, and clean URLs

June 22nd, 2009 Mohammad Al-Shami No comments

So I’m working on a new web server but I don’t want to use Apache since it’s a virtual machine. Had some trouble with the rewirte rules but I think I got them

From this forum post


$HTTP["url"] !~ "\.(gif|png|css|jpg|jpeg|js)$" {
   server.error-handler-404 = "/index.php"
}

But I thought of a different approach and it seems to work so far, and maybe causes less error messages in the logs:


url.rewrite-once = ("^/(.*\.html)$" => "/index.php?page=$1", "^/(.*\.html\?.*)" => "/index.php?page=$1", "^/(.*/\?.*)" => "/index.php?page=$1")

Have a good one

Throttling outgoing emails to certain domains with Postfix

March 29th, 2009 Mohammad Al-Shami No comments

I’ve been busy setting up a PHPlist server for my employer. All tests went ok, but as soon as we sent our first newsletter Yahoo! blocked the server. After looking around for a solution people suggested we sign all outgoing emails with DomainKeys and not hammer Yahoo’s servers with consecutive connection.

Using DomainKeys was a simple setup with DKIMproxy, as for throttling, you all know Postfix is one high performance MTA, so that would be hard to do. PHPlist has a throttling feature but I didn’t want to use that because it would slow emails going to all domains and it took about half a day to send messages to about 6,000 users. That is unacceptable.

After some more digging around I found that Postfix 2.5 introduced the perfect solution, here you go:

First, add the following lines to your master.cf


domain1      unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=
domain2      unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=
domain3      unix  -       -       n       -       -       smtp
        -o smtp_fallback_relay=

Now, to use those transports add these lines to your transport_maps file


domain1.tld    domain1:
domain2.tld    domain2:
domain3.tld    domain3:

Finally, set the destination_rate_delay for those transports in main.cf


domain1_destination_rate_delay = 10s
domain2_destination_rate_delay = 20s
domain3_destination_rate_delay = 30s

This will effectively send all outgoing messages at full speed, except for messages going to domain1.tld, domain2.tld, and domain3.tld; Postfix will wait 10/20/30 seconds after sending each message to domain1.tld/domain2.tld/domain3.tld.

Categories: Mail Tags:

Fixing MySQL Error 1064 with PHPList when selecting new criteria

March 14th, 2009 Mohammad Al-Shami 8 comments

I’m currently experimenting with PHPlist to use for our corporate newsletters. During the tests I got the following error

Database error 1064 while doing query You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘1)’ at line 3

Tracking this problem down I found the following code segment in “admin/send_core.php”


if (is_array($_POST["criteria_values"])) {
$values = join(", ",$_POST["criteria_values"]);
} else {
$values = $_POST["criteria_values"];
}

$values in this segment will always start with a comma. We just need to add a substr statement to fix that. Just change it to


if (is_array($_POST["criteria_values"])) {
$values = join(", ",$_POST["criteria_values"]);
} else {
$values = $_POST["criteria_values"];
}
if (substr($values, 0, 1) == ",") {
$values = substr($values, 1);
}

That’s it. This will remove the starting comma (If it exists)

Categories: Mail, Technical Tags:

Empathy, the new kid on the block

February 5th, 2009 Mohammad Al-Shami No comments

If you’ve used Linux as a desktop, you’ll know it’s only playing catch-up when it comes to instant messaging. I’ve been using Pidgin since was called Gaim, I think I started using it back in 2003. I love how minimalistic it is. Sadly the developers are going nowhere with it, at least that’s my (as well as a few others) humble opinion.

I stumbled upon this post which mentions a new (or maybe just new to me) client called Empathy. After playing with it for a few days now I think it has great potential. It’s still pretty basic but also under heavy development. It’s very minimalistic and uses the Telepathy library, which IMHO is a better approach than Pidgin’s libpurple.

It still doesn’t have proxy support, but you can work around that, at least for MSN and Gtalk, the protocols that I use. Here is how I did it it:

Gtalk: Just create a tunnel with SSH


ssh -C -q -f -M 0 -N -L 5223:209.85.137.125:5223

Where 209.85.137.125 is the IP address of talk.google.com, then set the account to use localhost as a server

MSN is a little different, this trick didn’t work because the client connects to a login server, which redirects the client to a different server. MSN is implemented using the telepathy-butterfly executable. Just use a socks server like this:


mv /usr/lib/telepathy/telepathy-butterfly /usr/lib/telepathy/telepathy-butterfly-old
vi /usr/lib/telepathy/telepathy-butterfly

#!/bin/bash
exec /usr/bin/tsocks /usr/lib/telepathy/telepathy-butterfly-old

chmod +x /usr/lib/telepathy/telepathy-butterfly

Enjoy :)

Categories: Linux Tags:

Google Chrome on Ubuntu

September 5th, 2008 Mohammad Al-Shami 2 comments

I came across this guide about installing Google Chrome under Ubuntu. It is somewhat slow, slower than Windows and much slower than Firefox but it still works, well, kinda. You have a few problems with fonts, as well as sites that don’t work properly with Chrome yet. I’m sticking with Firefox for the time being, but at least I have an option for those sites that aren’t compatible with it.

I wrote this post from Chrome, so yeah, it does work :)

Categories: Linux, Technical Tags:

Slow Browsing Under Ubuntu

August 23rd, 2008 Mohammad Al-Shami 2 comments

EDIT: This post only covers IPv6, please check the update post which covers IPv6 and Firefox

Today when I rebooted to my Windows installation which I very rarely do, I noticed that browsing under Windows feels much faster than under Ubuntu. After booting back to Ubuntu I noticed the “looking up domain.tld” part was taking a lot of time, which seemed a little odd.

Anyways, after some googling I found out that Debian enables IPv6 by default and uses that before and uses it before IPv4. A quick remedy was:

sudo vi /etc/modprobe.d/bad_list

#Add this line
alias net-pf-10 off

After which you should reboot your system. Now browsing feels much faster. To speed it up a little I installed a local caching DNS server which works like a charm. A quick HOWTO can be found here

Hope this helps.

Categories: Linux, Technical Tags: , , , ,