22 Jun

fckeditor+firefox 3, lcd vertical lines and missing sound

FCKeditor

If your project uses FCKeditor, then you may need to re-think how the FCKeditor instance is attached to the page – Firefox 3 has changed something (I’m not sure what) which causes FCKeditor to fail in some cases (not all).

The cause is not absolutely clear (the first bug mentioned above states that it relates to loading file:/// URIs, but in my case, that’s not true), but I have managed to fix a few cases by avoiding the dynamic method of on-the-fly initialising FCKeditor (var o=new FCKeditor('blah');o.ReplaceTextarea();, etc) and instead creating the required IFrames and hidden inputs manually. This is a hack – not a true solution, so hopefully someone at the source (FCKeditor) will fix the problem soon.

This bug in their Trac is probably the exact problem I’m experiencing. Note that that bug was “confirmed” by a member of the dev team 9 months ago, and has since been ignored by them.

LCD vertical lines

A few months back, my Acer Travelmate 2420 started developing vertical lines. It would have been expensive to replace the screen, so I instead opted to go for a new machine. I gave the machine to my son Jareth, who doesn’t complain too much about it.

Yesterday, while troubleshooting a sound problem, I noticed that if the screen was twisted /just so/, then the lines vanished. After a bit of experimentation, I found that pressure applied in a certain spot at the back of the screen would clear the lines.

So, there was no other option – I needed to fix it. I got my screwdrivers out, took the screen apart, and MacGyvered a solution together with some paper I had lying around – fold it into a thin strip, then fold one end of it down to form a bulky part, then slot that into place between the screen and the back cover so the bulky part is at the pressure point. When the cover was replaced, the vertical lines were gone.

I have no idea how long the solution will work for, and I am guessing that the solution is causing stress to parts of the screen which may cause a more complete failure at some point in the future, but for now, Jareth is very happily watching a DVD on his machine (Bear In The Big Blue House – Shapes, Sounds And Colours on Fedora 9, KDE4, for those interested).

Missing sound

As stated, Jareth’s laptop had a sound problem – as in lack of sound. this was eventually traced to pulseaudio simply not starting. The solution was to add pulseaudio --system & to /etc/rc.local so the sound engine would start when the machine started.

04 May

nvidia in Fedora 9

…doesn’t work properly (at least on my laptop, using a GeForce 7000M). the reason for this is that Fedora 9 uses the latest version of xorg and NVidia‘s driver does not yet work with it (3D is not fully working).

To get stuff at least minimally working, you need to downgrade your xorg RPMs to the Fedora 8 versions.

Unfortunately, KDE4 appears to require fully working GLX in order to display the kicker (or whatever the hell they’re calling it now), so my KDE is slightly crippled at the moment. A pity, really, as KDE4 is beautiful and almost as usable as 3.5 was.

12 Apr

HP G6000 in Linux

My old laptop, an Acer Travelmate 2420 (good machine) started developing vertical lines on its TFT over the last few weeks, so I thought it was time to upgrade, and eventually fix the old lappie up for my son.

I bought an HP G6000. Ken Guest recommended a Lenovo x300 (or something like that) – I was in a bit of a rush, though – I can’t stand being without a functional machine, so I headed into Gillanders in Monaghan and bought the HP.

I spent a few hours on Friday dual-booting Linux onto the machine. FC7 initially, as that’s all I had with me, then upgraded to FC8 as soon as possible.

It wasn’t until I got home until I realised that the WIFI was broken (my office network is mostly wire-networked).

A few hours of study showed there was no simple solution to this. lspci claimed that the card is an AR5006EG from Atheros. the card is actually an AR5007EG. Either way, there is no “official” Linux support for this, and the unoffical support is not perfect either.

After reviewing the available information, I thought the easiest solution was to replace the WIFI car.d. I had an old Sony Vaio upstairs, so I pulled out the WIFI card from that, an Intel 3945abg, and placed that in the machine (if you unscrew the RAM plate at the back, you will see the WIFI card in its Mini-PCI-Express slot – lever the aerials off it and replace the card – simple, innit). unfortunately, that was far from perfect – the Intel 3945abg is not even seen by lspci – some hints I found online suggested that the 3945 doesn’t adhere to the standards.

Long story (asked Trevor in Gillanders for permission to dig through their laptop graveyard for a WIFI replacement – found nothing. tried some machines I had in the office – nothing found) – eventually, I figured out the solution.

Here’s the trick. You will not get the AR5007EG working in 64-bit Linux. Instead, you need to compile a custom kernel using the 386 mode, and download the patched version of MadWifi to compile the kernel module.

After that, everything’s simple. To fix the xorg – download the official NVidia driver module installer and let it compile a kernel module for you. That’s it – done.

Sorry for the length of this – I tried to throw in all the keywords that I searched for while trying to solve this.

25 Mar

error loading kqemu?

Fedora does not come with the kqemu kernel module installed. You need to either compile it yourself, or download an RPM of it from somewhere. I use ATrpms myself.

When you try to install it, with the line “modprobe kqemu“, you might get this error:

FATAL: Error inserting kqemu (/lib/modules/2.6.24.3-34.fc8/updates/kernel/kqemu.ko): Invalid module format

All you need to do to fix this is to open the kqemu.ko file with Vim (or a lesser text editor if you will), and replace the string ‘586’ with ‘686’ then save and retry.

06 Mar

vm's and bridges and proxies

oh my!

We bought a rack server for the office, to help replace our aging systems with something a little more civilised. I spent a lot of time this week trying to figure out how to configure it best.

I wanted to install services and servers on the machine in such a way that I could easily move them onto a new machine if things get too busy. For this, I chose to use the QEMU virtual machine emulator. Some people might think that VMWare would be a better choice, but I did some research on it and couldn’t find any compelling reason why I should choose VMWare over QEMU.

To have the system networked properly in the LAN, I wanted to be able to address each vm using a separate IP number. To do this, I had to set up QEMU to use eth0 as a bridge. So, I had this in the host’s /etc/rc.local.

echo 1024 > /proc/sys/dev/rtc/max-user-freq
modprobe kqemu
modprobe tun
/etc/init/iptables down

/sbin/ifdown eth0
/sbin/ifconfig eth0 0.0.0.0 up
/usr/sbin/brctl addbr br0
/usr/sbin/brctl addif br0 eth0
/usr/sbin/brctl stp br0 off
/sbin/ifconfig br0 192.168.2.1 netmask 255.255.0.0 up
/sbin/route add default gw 192.168.1.254

and this was in /etc/qemu-ifup

#!/bin/sh
/sbin/ifdown eth0
/sbin/ifconfig eth0 0.0.0.0 up
/sbin/ifconfig $1 0.0.0.0 promisc up
/usr/sbin/brctl addif br0 $1
/sbin/route del default
/sbin/route add default gw 192.168.1.254

Note that I’ve used $1 instead of tap0 (which is shown in some examples) – this is because when you start up your QEMU instances, each one should use a different tap device.

When loading the QEMU instance, be sure to give each one a different MAC address. Otherwise strange stuff will happen.

xhost +local:root
su -c "qemu -boot c -hda vmServices.img -localtime -net nic,macaddr=52:54:00:00:00:01 -net tap -m 192 -usb -soundhw sb16 &"

In the above case, I’m loading a QEMU instance saved as “vmServices.img”, and have given it a MAC address 52:54:00:00:00:01. The default address is 52:54:00:12:34:56. Be sure to override that.

You’ll have noticed that I turned off iptables in the host’s /etc/rc.local. I’m not an expert at that stuff so that was the simplest solution to enable networking without problems. Be sure to also do it in the client’s /etc/rc.local files as well – otherwise you may have problems accessing hosted web servers, for example.

When the client is loaded up, assign a static IP address to it. I choose static IPs for these servers because they’re not client machines, and I need to be able to consistently access the right one from an external request.

Now you have your network up and running properly, with separate IP addresses for each vm.

The next step is to route incoming web traffic to the right machines.

Let’s say that you want a worker outside the office to access dotproject.youroffice.com, and you want a client to see his test server using blah.com.test.youroffice.com. The problem is that you are using a standard DSL connection, only have one static IP, and the dotproject and test web servers are held in separate VMs on the machine.

In this case, the solution is to use mod_proxy to route to the right machine.

So, you set up a rudimentary virtual hosted webserver on the host machine. The first virtual host should be something generic which perhaps just reports the status of the host. After that, we add the magic:

<VirtualHost *>
  ServerName dotproject.youroffice.com
  ProxyPreserveHost On
  ProxyPass / http://192.168.2.2/
  ProxyPassReverse / http://192.168.2.2/
</VirtualHost>
<VirtualHost *>
  ServerName test.youroffice.com
  ServerAlias *.test.youroffice.com
  ProxyPreserveHost On
  ProxyPass / http://192.168.2.3/
  ProxyPassReverse / http://192.168.2.3/
</VirtualHost>

From an external browser’s perspective, both web servers are running on the same machine, but internally, we can see that there are three involved – a proxy router, and the two separate virtual machines’ web servers.

There may be more-correct ways of doing the above, but this works for me.

19 Feb

oki b2200 shared over samba

Spent a while looking for info on this online, but couldn’t find it.

We have a windows machine which has a few printers on it. I want to connect to it from Linux (Fedora 8).

First, share the printer via windows share. Give it a name like OKIB2200.

Now, open system-config-printer

Choose “New Printer”, then “Windows Printer via SAMBA”. If that option does not appear, then close out of system-config-printer and install samba (yum install samba*) then repeat the above.

Enter the appropriate smb address. In my case, it was smb://mshome/192.168.1.252/OKIB2200.

Click “Verify” to make sure it’s accessible (if not, check spelling in the URL. if still not, I dunno…).

For the Make, choose Generic

For the Model, choose PCL 4 (laserjet).

test, and you’re done.

09 Sep

some (sys/web)admin hints

Just thought I’d regale ye with two errors from my past.

The first involves SSH. SSH rules. It is /so/ handy to be able to work on many machines simultaneously. However, there is a single fundamental flaw to this method of working.

[root@localhost ~]# poweroff

I turn my laptop off every night. As I usually have my fingers on the keyboard, I usually turn it off using the above command.

One night, I turned my machine off, then went upstairs to bed. I realised I’d forgotten to lock the back door, and came down to do so.

My laptop was still humming away.

I don’t think you can imagine the feeling of dread that came over me. A cold sweat welled up, and I could feel the hair on the back of my neck raising. I realised I must have typed poweroff in an active SSH connection. I checked, and it was our live production server, with a hundred or more active websites on it.

The next hour or two was frantic, as I tried to get in contact with the hosting provider (which has a supposed “24-7” phone line which is only ever answered from 9-5).

Luckily, it was Sunday, so no-one noticed before the provider’s support techies finally turned up for work in the morning and turned it back on.

As soon as I knew the machine was on, I logged into it and added this line to the ~/.bashrc file:

alias poweroff="echo No! Step away from the computer and think about what you\'re doing"

The second error is probably a common one.

It /sounds/ like a good idea to set up an error log which emails you if an error ever occurs on your server.

Don’t! Or at least, read on and find out how to do it properly.

I made the mistake of setting up an error catcher which would email me as soon as an error occurred. The reasoning was that I’m usually online, so I could catch the error quickly and fix it before the client even noticed the error was happening.

Unfortunately, one day I made an upgrade to one piece of code which adversely affected another piece that was almost unrelated (so it didn’t occur to me to check it – admit it, you’ve all made this mistake).

I went home and was offline for the rest of the day. The following day, I came in to find the office phone’s answering machine was blinking. Apparently, that client’s site had “stopped responding”.

I thought it would be something simple, so tried to log in. The system was /slow/. After a few minutes of painful testing (even SSH is very slow if your load is high enough!), I found the problem – about 5 million emails in the email queue, and qmail was going CPU mad trying to deal with it all.

It turns out that any time anyone accessed the client’s site, it would trigger a recursive chain of events which each caused an error. Before we could even start on solving the problem, we needed to turn off web access to the machine! Not a good thing, when your business is the web.

The next few hours days were spent clearing the emails and scouring for any code which sends an automatic error email…

The solution to the above? Log your errors to the syslog instead of via email. If you still want an email sent out, then set it up using a cron job which emails the contents of the log file then clear it.

Moral of the story is – there is always a better way to do things. Usually, though, it will not occur to you until after the damage is done.

03 Aug

fedora 7 on the acer travelmate 2420

This post is a reminder to myself in case I re-install my OS (as I do every now and then).

Fedora has a few bugs on the Acer TravelMate 2420. The most annoying one is that every now and then, the system freezes for a few seconds at a time. There have been reports of this in the Fedora forums, but no clear indication of what was causing it.

To solve the freezes, you need to compile a new kernel – there is something wrong with the Fedora kernel, but I’m not sure what it is (scheduler, maybe, but I can’t be certain).

So, get a copy of the most recent full kernel from kernel.org. I’m using version 2.6.23-rc2. Create a directory ~/compile/ and unzip the file in there.

The simplest way to get up and running is to go into that directory and run make bzImage && make modules, then su -c "make modules_install && make install". That will build and install the kernel, but with a load of modules that you don’t need. It will also take a very long time to finish, as it is compiling almost /everything/…

If you want, though, you can use my own kernel config. I’ve tried to cut it down to only the modules used by the TravelMate 2420. I’ve left out PCMCIA and Parallel Port support (I don’t use them). Download this file, move it into the root of your kernel source, and rename it to .config. Then run the above commands.

You will also need MadWifi to get your Atheros wifi to work. cd ~/compile; svn checkout http://svn.madwifi.org/trunk madwifi.

Now build MadWifi: cd ~/compile/madwifi; make -C /lib/modules/2.6.23-rc1/build SUBDIRS=/home/kae/compile/madwifi modules. Make sure to replace the 2.6.23-rc1 with your kernel version, and kae with your username. Then, reboot into the new kernel.

Install madwifi: cd ~/compile/madwifi; su -c "make install". Reboot again. Sorry about that – can’t be bothered finding the right way to do this, but it only takes a minute or so anyway.

That’s it – you’re done. You should not experience any of those freezes, and the system should be a tiny tiny little bit faster as well.

If you upgrade your kernel at any time, or recompile the present one, then remember to install madwifi again.

20 Apr

kfm, stuff

I’m currently listening to Nine Inch Nails’ new album, Year Zero. There are some cool songs on it – “Me, I’m not”, “God-given” and “My Violent Heart” for example. “The Beginning Of The End” sounds just like the cover they did of Gary Numan’s “Metal” a few years back. I guess the beat was difficult to get out of the head. Anyway – good album.

KFM is coming along steadily. version 0.9 is about three weeks away, I think, and the big 1.0 will only be a few weeks past that. I’m thinking of 0.9 as “feature complete”, and a release candidate, but I want to give it a few weeks of bug testing before officially announcing it as 1.0. 0.9 has a few new things, the most interesting of which (in my opinion) is the ability to upload multiple files, using SWFUpload. Also, there’s a new Slideshow trick, and other stuff.

Just got online again at home. Using digiweb‘s “wireless” broadband. What they mean by “wireless” is that the DSL comes in through an aerial instead of the phoneline, and is then “wired” from that point. So, I got a wireless router today to replace the wired one they had provided (which was causing amusing trips by the kids etc) and am just setting up this machine’s wifi as I type.

Next week, I’m heading down to the big smoke (Dublin) to do the final exam for my course. I was hoping to attend the monthly PHPUG pub-crawl, but my wife has other plans (her plans are to stop me from attending it).

09 Feb

KFM 0.8

function getKfmFile(version){
window.SetUrl=function(value){
value=value.replace(/[a-z]*:\/\/[^\/]*/,”);
document.getElementById(‘filename’).value=value;
}
var lang=document.getElementById(‘lang’).value
window.open(‘http://kfm.verens.com/demo/0.8/?lang=’+lang,’kfm’,’modal,width=700,height=500′);
}

Demo English
Bulgarian
Danish
German

Spanish
Finnish
French
Irish
Italian
Dutch
Romanian
Russian

Browse…

download it at the KFM website

New Features

  • New language: Romanian (thanks to Andrei Suscov)
  • Return thumbnails to the opener (35, 142)
  • Tag engine (12, 13, 143), allowing files to be categorised, and searched by category.
  • Client-side syntax highlighted text editing (125, 126) using CodePress.
  • Rename multiple files (103). This allows you to select a group of files, and rename them all to a common format.

Improvements

  • Multi-line captions (89)
  • ImageMagick used where possible (152, 111), allowing huge images to be edited without PHP running out of memory.
  • KFM will return either a normal URL (155), or a URL which allows the get.php script to be used to retrieve the file. The advantage to using get.php is that in the future, we will be able to apply authentication, so only authorised users can read a file. This also allows thumbnails to be built on-the-fly.
  • The database tables can use a specified prefix now (129).
  • Double-click can be configured to either send the file back to the opener (FCKeditor, your CMS, etc), or to open the file directly (120).
  • config.php split into two files, allowing easier upgrades (146).
  • when moving through files with the arrow keys, the selected file will always be visible (110).
  • KFM can now be used to manage multiple sites through one instance (154).
  • A metrics logger has been added (134). This will allow us to know what versions of KFM are in use, and whether it is safe to deprecate certain features if need be.
  • Comments can now be extracted from .gif files to be used as captions (88).
  • Documentation written on how to transfer a KFM archive from one machine to another (161).
  • Many bug fixes (159, 97, 156, 149, 68, 157, 147, 148, 144, 102, 145, 118, 140, 141, 98, 139, 135, 150, 151, 165, 167, 164, 162, 160, 113, 163).
  • Some ideas were rejected (112, 21, 131, 19, 18).

As usual, this release has been helped along by the many testers in the forum, testers who have contacted me by email, and all of the translators.

Very large thanks to Benjamin Ter Kuile, who has been very actively hacking away at the KFM code and produced such gems as the CodePress integration.