24 Nov

curved borders, with valid CSS and unobtrusive javascript

In recent evenings, I’ve been working on my Borders project, working to optimise the speed of the thing up to the point where it can be used in production websites.

I believe the script is just about ready. Thanks go out to Dylan Parry for pushing me to work on this!

try this out

Please note that no browser-specific CSS was used in this. The borders are defined in the W3C’s Borders module draft. Not one browser supports border-radius yet (no – Firefox’s -moz-border-radius does not conform to the W3C’s specs).

The script works in Konqueror, Safari, IE, Firefox and Opera.

In the case of Opera, only external CSS works. The demo is with CSS added to the head of the document (which is not recommended in production sites). I do not believe this is a problem.

Anti-aliasing is available for Firefox, IE, and Safari. Konqueror and Opera do not support opacity yet, so in their cases, borders are kinda pixelated (but still better than nothing!).

How to use this script: simply grab a copy of this file, and link to it in the head of your document, then use border-radius in your CSS as if the browser supported it natively. It’s that simple!

Example

		<script type="text/javascript" src="borders.js"></script>
		<style type="text/css">
			div{
				background: #ccc;
				border: 2px solid black;
				border-radius: 20px;
				padding: 20px;
				margin:5px
			}
		</style>

Noted Problems

  • I have not figured out a way to read plain un-edited internal CSS in Opera yet.
  • Optimisation would be much easier if it was possible to use the DOM to read un-edited CSS, as it was supplied, instead of after the browsers have adapted it to fit their own internal models.

If anyone can help with the above, or comes across other problems with this, please comment below.

22 Nov

interesting spammer trick

while converting a database of mailinglist addresses from one format to another (moving a user from an old ezine application to a newer one), I discovered some entries like the following one in the database:

INSERT INTO ez_addressbook VALUES (19485,16,’ftqilhf@uwalk.ie\nContent-Type: multipart/mixed; boundary=\\\”===============0469157119==\\\”\nMIME-Version: 1.0\nSubject: 47dea9d\nTo: ftqilhf@uwalk.ie\nbcc: jrubin3546@aol.com\nFrom: ftqilhf@uwalk.ie\n\nThis is a multi-part message in MIME format.\n\n–===============0469157119==\nContent-Type: text/plain; charset=\\\”us-ascii\\\”\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\n\nkboxczb\n–===============0469157119==–\n’,’ftqilhf@uwalk.ie\nContent-Type: multipart/mixed; boundary=\\\”===============0469157119==\\\”\nMIME-Version: 1.0\nSubject: 47dea9d\nTo: ftqilhf@uwalk.ie\nbcc: jrubin3546@aol.com\nFrom: ftqilhf@uwalk.ie\n\nThis is a multi-part message in MIME format.\n\n–===============0469157119==\nContent-Type: text/plain; charset=\\\”us-ascii\\\”\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\n\nkboxczb\n–===============0469157119==–\n’,”);

In the above row, the third field is the email address. It seems that, when faced with a form requesting an email address, a spam-bot will enter the above devious code. Then, when the ezine engine sends out either a confirmation request, or a real email, the spam will be sent instead.

So, how do you filter that out? Easy – just ensure that the submitted form contains a valid email in the email field.

Very devious…

22 Nov

syncing and bots

Been a while. I took two weeks off work after I got married, to just relax and play some geetar (practicing my speed soloing with some classical riffs and a metronome).

So, I was just reading through my daily blog list today and noted someone talking about kde.org and opensync.org collaberating to help reduce personal data redundancy.

I have a big problem with personal data redundancy. I use five computers on a regular basis. My laptop, my home server, my work machine (this one), my robot, and the office server. Forget about the bot, as I don’t do any personal computing on it, but on all of the others, I run programs such as Firefox, IE, Konqueror, Thunderbird and Kontact on a regular basis (as well as many others – vim, etc).

Sharing email is not a problem, as I use IMAP. However there are a number of itches that I’m tired of scratching:

  • Only yesterday, I was wishing that Firefox and Konqueror could share the same bookmarks file, as I have a well-categorised list of personal bookmarks on my laptop which I would not like to have to rebuild every time I move to a different browser or machine. Okay, I can share the same bookmark file between various Firefoxes on separate machines, by using NFS or something (which is insecure, slow, and can cause locking problems), but it’s a shame that there does not seem to be a simple way of sharing bookmarks between two browsers on the same machine without having to manually export and import it every time something changes!
  • In work, I do my coding in vim, on the office server, in KDE, viewed via vnc. I used to use Synergy for it, when I was sitting right next to the office server, but we moved everything around here and removed the monitor from teh server, so I need to use VNC. One crap thing about VNC is that I can’t seem to copy from outside it, and paste inside it. This means that if, for example, I am debugging some JavaScript for IE, and need to copy something from the output and paste it into what I’m working on, then I can’t do it! I need to either do a complex notepad and ftp dance, or write it out by hand. It would be nice to just select, copy, and paste. The same applies the other way around. If I come across an interesting blog post in Akregator in the VNC window, I can’t just copy the link and paste it in Firefox or IE on the main workstation.
  • The only other example I can think of is the preferences I have for vim – I have customised PHP and JavaScript folding commands, which I use on all four of my linux boxes, and the three production servers that I manage. That’s seven copies each of two files. That’s a pain to keep uptodate…
  • The only thing I can think of that would work for keeping the files uptodate is to keep those specific files in an exported NFS directory on a trusted computer (trusted not to go bye-bye in the middle of an important job). Unfortunately, NFS is not secure for a list of reasons, and I cannot think of a better way. Anyone?

Aaaanyway… I also spent some time working on my bot.

As people may know, my goal is to build a bot that can do my gardening for me. While many people just point and laugh (in the building here, I’m known as “Luke Skywalker” (actually, it was Anakin that built C3P0, but correcting the misnomer would prove that I’m a little geeky)), I am of the absolute and firm belief that this is possible, and inevitable.

So, what have I done already? Nothing much, I guess. I build a shell which holds an Epia ME6000 Mini-ITX mainboard. This board has a Netgear WG311 wireless card attached, as well as two generic webcams. The whole lot is powered by a 12V acid-lead battery, connected through a PW200M power convertor.

What that means, is that I have a working computer which does not rely on any cable connections for power or networking. At the moment, I guess the coolest thing I can do with it is to plonk it down somewhere in the garden, then go inside and do some bird-watching via the cameras, on a different computer.

I guess the next thing to do is to attach some wheels to it so it will be an actual moving robot! For that, I will need some tank tracks (feel free to buy them for me 😉 ).

Once the tank tracks are attached and working, I will have a remote control robot that I can move with my laptop, and see exactly what it sees.

After that, thinks get difficult… but I’ll get to that!

02 Nov

married, with child!

So, what did you do on Hallowe’en? I got married! I won’t go in depth into it, as it’s a quarter to ten at night and we’re about to delve into a celebratory bottle of champagne (thanks, Linda).

Suffice to say, that an atheist and pagan getting married to each other involves quite a lot of thought.

We had to write the ceremony ourselves, making sure that every word that was spoken meant something real to the person speaking the words (none of your mumbo-jumbo christian BS for me!)

Here are a few photos from the ceremony (as chosen by Bronwyn).

the gallery