28 Feb

text-shadow hack for firefox

I was reading through the list of improvements for KDE 3.4rc1, which I compiled over the last two days on my lappy. One thing stood out for me, as I’m a web developer – the CSS3 item “text-shadow“.

Konqueror screenshot

After writing up a test page and viewing it in Konqueror, I realised that it could be faked pretty easily by using JavaScript and CSS2’s opacity.

So, I set to work. The script I’ve come up with reads through your CSS, notes what elements have a text-shadow applied to them, then fakes the text-shadow.

Firefox screenshot

Here’s an example page for you to see it yourself.

“So what?”, I here you say.

  • Firefox does not yet support text-shadows.
  • You don’t have to write hacky CSS for this – just include the script.

This may turn out useful for work, so I’ll see what I can do about IE, tomorrow.

update: I grabbed a copy of Dean Edwards’ cssQuery script. Now, the example should work just about all the time (in Mozilla-based and KHTML-based browsers).

25 Feb

selinux, me arse

If, like me, you spent the last few days wondering why your fancy web-based image manipulation suite suddenly won’t manipulate your images, then take a look at the /var/logs/messages file.

If you see a load of audit(436214532617:0) type messages, then you have that damned bastard of an idea, SELinux installed. SELinux stands for “Security Enhanced Linux”. In my case, that translates as “Broken Linux”.

You can turn off SELinux by typing “setenforce 0” as root.

My recommendation is to add that to the end of /etc/rc.local.

</rant>

23 Feb

AJAX

At last, I don’t have to say “XMLHTTPRequest” anymore, when trying to describe how a lot of the code I write works.

Only a few days ago, Jesse James Garrett wrote an article, which may be where the term AJAX (Asynchronous Javascript and XML) was coined.

Although it certainly irks me that XML is part of the definition, where XML is actually rarely used in these applications, I must admit it’s much easier to say. When you think about, AJAX is only two syllables long, while XMLHTTPRequest is a mouth-twisting nine.

My most popular AJAX script at the moment is the XMLHTTPRequest Calendar (AJAX Calendar sounds better), which was later made into a WordPress plugin by the name of Livecalendar.

I’d also like to point out that WebME CMS uses an AJAX shoppingcart, which has attracted a few positive comments.

23 Feb

livecalendar 1.5.4

In a wave of activity, I’ve upgraded Jon Abad’s LiveCalendar to support KHTML-basesd browsers. This means Konqueror, Safari, and probably Galeon. I’ve only tested it in Konqueror, so you apple-philes can test it for yourselves.

There were two reasons why the code didn’t work in KHTML.

  1. A possible bug in KHTML where insertRow no longer works on tables that have had captions appended to them. The script now doesn’t display the caption in KHTML (couldn’t be bothered working up a longer fix). Maybe I’ll work some more on this one, once KHTML is fixed.
  2. Another bug, which I haven’t bothered reporting yet – when you are sending the XMLHTTPRequest (using the send() method), KHTML does not allow the use of a NULL value as the first parameter. So, the fix in this case was to just not put a parameter in.

Anyway… here it is.

23 Feb

Version 0.3 of WebME released

The previous releases of the CMS were pretty tricky to install, but this release should make installation of a complete WebME system as easy as falling over a rock.

See here for the WebME release announcement.

Main points:

  • New installation method – no nasty fiddling around. Just download the install script to the root of your site, make the directory and file writeable by the server, then read the file through your browser.
  • New upgrade method. From 0.3 onwards, upgrading will be as easy as a single click in the administration area. There is a new area – “Server Administration”, which has an upgrade tool which downloads upgrade scripts if they exist, and runs them, automating the migration to more recent versions of the system.
  • New theme, developed by Maria of webworks.ie. Really makes the first impressions a bit easier on the eyes than my own design efforts!

Please do try it out. I haven’t had any feedback on it yet, but I think that was because installation has been tricky, up until now.

22 Feb

opacity problems

If you’re using Firefox to view this blog, you will have noticed the funky header and calendar, and their opacities (scroll down to view) when over content.

While putting together the CSS for the effect, I came across a deficiency in CSS3 and another in Firefox.

The CSS deficiency is that, once an element has an opacity of anything less than 1, it’s containers cannot have any higher opacity than that value.

To explain further, I’ll try describe the effect I was trying to achieve – I wanted to have a semi-transparent background, but fully opaque foreground. It seemed obvious to me that the way to achieve this was to apply an opacity of .7 to the container object, and 1.43 or so to the contained text (to bring it back to 1 in total). Unfortunately, the W3 specs forbid this:

Syntactically a <number>. The uniform opacity setting to be applied across an entire object. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range. If the object is a container element, then the effect is as if the contents of the container element were blended against the current background using a mask where the value of each pixel of the mask is <alphavalue>.

I feel tempted to sign up to the W3 CSS discussion to ask about this.

Anyway – I thought, then, that a less cool, but still funky method would be to apply a semi-transparent image as the background.

That would have been a perfect solution, and worked fine, except that (as you can see, if you’re in Firefox), the header and calendar have curved corners. In Firefox, the background color is confined within the radius, but the image is not.

I thought to report this to mozilla.org, but it turns out that this bug has already been reported …over three years ago!

Oh well – I’ll just have to suffer with the buggy CSS 🙂

Yes, I could generate the curve with a quick gimp, but I’m too lazy for that, and besides – I prefered the pure CSS method anyway.

21 Feb

installing a Netgear WG511 v2 (Marvell chipset) in Linux

So, earlier today, I posted about how the Netgear WG511 v2 from Taiwan (with the Marvell chipset) was a piece of shit because it was a damned pain to install.

I still think it’s a pain to install, but it’s no longer a piece of shit.

To install the card under Linux, you need to run the Windows driver through a wrapper. In this case, ndiswrapper.

Once ndiswrapper is installed, you need to also install the right driver. In the case of the Netgear WG511 v2 from taiwan, it’s these ones.

Once that’s installed, it’s a simple matter to install. Just follow the instructions on this page, which will get you up and running.

Don’t forget to tell your wireless network card to use the accesspoint for its gateway. In my case, the accesspoint is 192.168.1.107, and I want the wireless card to use 192.168.1.108 as its own IP:

 iwconfig eth1 scan
 ifconfig eth1 192.168.1.108
 route add default gw 192.168.1.107 dev eth1

That’s it! You’ll now find that if you remove your wired LAN (ifconfig eth0 down), you can access the LAN and the Internet through your wireless card.