July 2008 Archive

Create a File of Given Size

July 31st, 2008

Sometimes it’s useful to be able to create a file of a specific size for testing purposes, for example to test network bandwidth by copying a large file of known size. It easy to do on both Linux and Windows.

First on Linux:

dd if=/dev/zero of=file.img bs=1k count=10000

This creates a 10MB file called file.img, bs is the block size so this command would have the same effect.

dd if=/dev/zero of=file.img bs=1M count=10

You can try different block sizes and counts to get the desired result.

Now on Windows:

fsutil file createnew file.img 10485760

This creates a file called file.img of 10485760 bytes (1024*1024*10).

No More New Fonts May Be Applied In This Workbook

July 31st, 2008

I came across this very strange error message in Microsoft Excel today. The user has a workbook with 114 charts and he seemed to be hitting some hard limit in Excel.

It turns out that if you create a chart with it’s font set to ‘Auto scale’ then instead of using one font it uses 2 or more and there is a limit of 512 fonts per workbook. The fix is easy, there’s even a script to loop through all the chart objects and change the setting for you.

For the solution see the page on the Microsoft Help and Support.

Turn Off Post Revision In WordPress 2.6

July 25th, 2008

The title says it all. This page describes how to do it and to stop the wp_posts table filling up with multiple copies of the same post.

Public Domain File Icons

July 25th, 2008

I was looking for some small file icons to use in a web page on a company Intranet site. I found some icons at splitbrain.com that are in the public domain and so are free to use/modify/do whatever you feel like for personal or commercial use.

My Computer is the New Bottleneck

July 25th, 2008

I decided to download and install Ubuntu 8.04 into a Virtualbox virtual machine last night and something funny occurred to me for the first time.

In the past with slow internet connections it would take many hours to download a 694 MB iso file (even at 2Mbps it would take 46 minutes) but with my 25Mbps connection it took about 4 1/2 minutes! Then I stared the installation, my laptop hard drive chugged away at 4200 rpm while the processor struggled to uncompress the iso. In all it took about 30 minutes to install, so actually downloading the iso file was about 7 times faster than the installation procedure! How times have changed.

Systems always have a bottleneck and any system can only process data at the rate of the weakest (slowest) link. Upgrading computers and networks always involves replacing one slow link with another. In my own network I’m in a constant process of up replacing each new bottleneck as it appears.

Right now I have 2 devices with gigabit network cards but both my laptop and router are limited to 100Mbps so everything runs at 100mbps. The next step is to replace the router with a gigabit wireless N version (maybe the D-Link DIR-655) and then replace the laptop.

Diskstation Firmware Upgrade Deletes SSH Settings

July 23rd, 2008

I only recently discovered that when I upgrade my Diskstations firmware my SSH settings are wiped out. This includes the /etc/ssh/sshd_config file plus the certificate located at /root/.ssh/.

It’s not like I upgrade the firmware that often but it’s annoying that I have to go through this procedure every time I do.

I see the latest firmware also has an enable SSH option but I’d really like to see this expanded into a full SSH interface, allowing for different ports, not allowing password logins, certificate generation etc.

WordPress Directory Permissions

While I was upgrading my blog to WordPress 2.6 I noticed some strange files in my upload directory. As suggested in the WordPress codex my upload directory permissions were set to be world writeable (777) since this was required my my web host but it seems that someone has exploited this hole and uploaded files there. On top of that they then get linked by Google so searches on my site show content from the uploaded pages.

I’ve since disabled the WordPress upload capability by changing the directory permissions and I advise you to do the same. This page echoes my sentiments well.

Maybe Time to Change the Web Server?

July 13th, 2008

I was visiting a page on the Global Acer site when I came across this error message.

Too many connections in IIS 5.0

If you read the Microsoft Support pages on this error it seems that they exceeded the 10 connection allowed, I wonder if this is the first time that’s happened! Maybe they should try Apache instead ;-)

Homeplug Fails to Impress

July 12th, 2008

My Homeplug units arrived on Friday so I’ve tried them out over the last 24 hours. Before I go any further the bottom line is that they’re great in theory, easy to use but the performance is terrible, at least in my flat, YMMV.

My units are the Devolo dLAN 200 AVeasy Powerline Starter Kit. One unit was connected to my router and the other unit to my laptop which I moved around my flat to test the results in different locations. I was aware that they should be connected directly into a wall socket and not through an extension and after testing this is certainly true. From the advertising they claim 200 Mbps but having read some reviews I knew that around 80 Mbps was more realistic.

In summary my connection bandwidth varied from 4 (yes 4) Mbps to 40 Mbps with most locations around 9-12 Mbps, nowhere near good enough for their advertised purpose (streaming HD video). I was not trying to steam video but I really wanted to connect to my NAS box and use it as fast remote storage, but the prospect of copying 1GB Linux iso files over a connection at 10 Mbps is not something I look forward to.

On the plus side they are very easy to use, the units found each other every time within a few seconds, there was no setting up and the connection was reliable. If you were buying them to share a 2 Mbps internet connection and not using a LAN then they would probably satisfy your needs.

I’ve summarised my connection bandwidth below. I should explain that half my flat has very new wiring (2 years old) and my fuse box is also new but the other side of my flat has very old wiring, maybe 50 years+. The unit connected to the router was always in the newly wired side.

All the measurements were made copying a 690MB file from my NAS box to my laptop.

Test Details Bandwidth in Mbps
cifs ftp
Baseline Local LAN (no Homeplug) 56 93
Homeplug receiver on old wiring 9 10
Homeplug receiver on new wiring 11 13
Homeplug receiver in same room as router 20 40

From here it can be seen that ftp is always faster than cifs, no surprise there, but the actual bandwidths are all pretty bad in my opinion. Even when I used my laptop in the same room as my router, about 4 metres of wire apart from each other I still couldn’t get over 20 Mbps over cifs or 40 Mbps over ftp.

If the bandwidth never gets greater than that in near ideal condition (new wiring, same room) then they’re not much use for anything in the real world. Of course your results may differ but it’s a large investment for something that has a such a large performance drop off and you have no idea how it will perform until you try it in your home.

Needless to say I’ll be returning the units and spending my money on something more worthwhile, plus probably wiring my flat with Ethernet cable until a better solution comes along.

Using OpenDNS Nameservers on Fedora 9

July 11th, 2008

I decided to switch to using nameservers from OpenDNS just to see if it made a difference compared to my ISP’s nameservers. You don’t need to sign up if you don’t want, you are free to just use their nameservers as you wish (which are 208.67.222.222 and 208.67.220.220).

The main problem is that I use Network Manager to control my network and if you try to edit the connection from Network Manager but still use dhcp then it will, by default, just get the nameservers from your ISP and ignore any other servers you manually add.

Fortunately the solution is very simple. As root open the file /etc/dhclient-eth0.conf (assuming your wired interface is eth0 of course) and add the line as shown.

# vi /etc/dhclient-eth0.conf
prepend domain-name-servers 208.67.222.222,208.67.220.220; #add this line
send host-name "your-hostname";  # temporary RHL ifup addition

Next just restart your network.

# /sbin/service network restart

At this point I could not see my wired connection in Network Manager (the entry was greyed out) so I manually started the interface.

# /sbin/ifup eth0

This brought eth0 up and from then on Network Manager worked fine with the new nameservers. It might just be psychological but browsing does seems slightly faster, just a little bit less delay with each page load. I’ll leave it set up like this for a while to see how it goes, it’s easy enough to switch back at any time but for now I’m very happy.

Fix a Corrupted rpm Database

July 10th, 2008

During my system update yesterday yum would fail with an error containing this text over and over.

rpmdb: PANIC: fatal region error detected; run recovery

My rpm database was somehow corrupted (it’s the first time it’s ever happened to me in 3 years as a Fedora user) but at least the fix is pretty simple, all commands need to be run as root.

# cd /var/lib/rpm
# rm __db.00*
# rpm --rebuilddb
# yum clean all