27 Sep

fckeditor vs tinymce vs everything else

A few questions for the webdev community – especially javascript coders

Which is easier to use, FCKeditor or TinyMCE? Which is less buggy? Which has the better developers? Which is easier to extend? Are there better editors out there?

I’ve been working with FCKeditor for the last few years, and am getting a bit tired of it.

Almost two years ago, I extended their file manager by providing the ability to delete files or rename them. I submitted the code back to them, and …two years later, you still can’t delete files in the FCKeditor file manager.

Yesterday, I discovered that FCKeditor’s HTML-standards are a little restrictive – it assumes the code will be directly embedded in either the <body>, <noscript> or <blockquote> element. This means that the following code is illegal according to FCKeditor, even though it is legal according to the W3C specifications (if embedded in, say, a <div> element):

<p>some text</p>
<img alt="" src="http://www.fckeditor.net/images/logos.gif" />
<p>some text</p>

I have written some pretty complex code for FCKeditor in the past, including the ability to drag elements from an external list into it, and the ability to create and destroy instances pretty much on the fly, for AJAX apps.

The last paragraph is probably the only reason I am wary of swapping to another WYSIWYG like that *snaps fingers*. I don’t look forward to having to rewrite that functionality – it was hard enough in the first place…

However, today, I spent hours trying to track down a reason why plugins were not loading even though the rest of FCKeditor was. I’m preparing to jump ship now. It’s just too exhausting fixing this editor. I’d prefer to work on a simpler, more robust editor.

I’m tired of its bloat and slowness and am asking you all out there in the web world to tell me what you use, why you use it, and would you recommend it.

26 Sep

return of the autocropper

Yesterday, I remembered a little demo I announced almost two years ago and tried it in IE6 to find it did not work.

I’ve fixed it up and the source is now available. Very very simple source (I wrote it two years ago – it’s not the prettiest in the world), but it does the job.

the demo (sources)

It’s a simple trick for automatically curving text around an image.


How to use: add the script to your document’s <head> section, making sure that the hard-coded URLs in it (to the .php and the .gif) are correct.

The images you want cropped, give a class of autocrop. The image must have a float set as well.

23 Sep

a triangle maths formula

When i was 6th class in primary school, we had just finished the primary maths curriculum and had a few days to spare, so the teacher decided he’d try teach us a bit of algebra.

As a test of our out-of-the-box thinking, he posed this little puzzle:

Given a triangle of balls, where there are x balls on the bottom, x-1 above that, x-2 above that, and so on until there is only one on top, how can you figure out x if you are given the overall total y

   O O
  O O O
 O O O O
x=5, y=15

In other words, if x is 5, then there are 5+4+3+2+1=15 balls in total. Given the number 15, how would you figure out that the original x was 5?

I was a bit of a whiz back then and waded in to the problem. About 5 minutes later, I had an answer – but it was for the other way around – given x, I could figure out y with a simple formula:


So, given x=5, y=5((5+1)/2), y=15.

The teacher was a bit surprised at this. After all, I was about 12 years old at the time.

It didn’t solve the problem as it was asked, though.

All through secondary school, I tried reversing the formula to put it in terms of y instead of x. I didn’t succeed until only recently:

2y=(x+1/2)(x+1/2)-1/4 <-- this step only occurred to me a few weeks ago

How a primary school student was supposed to guess that formula, I have no idea!

To test, we plug in the 15 Y example we had:


Success, but not pretty!

There /is/ a way of doing it which doesn’t involve quite as much maths.

First, you imagine how the triangle looks:

   O O
  O O O
 O O O O

Nothing obvious yet… But, shift all the levels over to the left:


Now, it is obvious that the triangle is half of a square.

It’s not /exactly/ half, but it’s close enough that you can easily figure out x by getting the square root of 2y, then rounding down.

x = Floor[2y1/2]

I am almost certain that that’s the method that my teacher expected us to come up with. Took me 15 minutes to figure out the original formula, and 18 years to notice the much more obvious way to do it.

09 Sep


A call to Irish speakers (you know who you are) Рwhat are your favourite examples of B̩arlachas? Add them here!.

An example I have not added is the wonderful “Ná bí ag thónáil timpeall” – what a fantastic fscking up of the language!

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.

04 Sep

Daniel in Computer Arts

Daniel - Computer Arts

This is an “artist exposure” page from this month’s Computer Arts (issue 140). Daniel Shiels is one of our designers, who we are training up in various web techs before we decide to fire him 😉

Daniel was thrilled to find he had been profiled in the magazine. We’re thrilled for him.

Speaking of web designers, we’re hiring! If you are Monaghanese and looking for a job in web design, and have experience in CSS and HTML, and perhaps even creating templates for CMSes, then come talk to us! You’ll get to see my face all day!