Monthly Archives: August 2007

KFM 1.1 released

It’s not even been a month yet, but I think 1.1 is ready. 1.0 was the real test, and a load of bug fixes went into it on an almost daily rate until a week ago, when no more bugs were reported. I managed to squeeze in a number of the requested improvements, and KFM 1.1 is now ready for release.

I think the most important part of this current release is that SQLite PDO is now supported. This means that a person who does not have a MySQL or PostGres database as part of their hosting package might still be able to use KFM. This involved building a database abstraction layer abstraction layer (not a typo), so MDB2 can be used for the “normal” databases.

It was fun to solve the IE7 problem where normal JavaScript dialogs are considered to be “popups”. The way I solved it was to create a modal window which passes its value forward to a referred function. Those of you that are good JavaScript writers might be interested to read the source and see my solution – I’m damned proud of it!

There’s a lot of work to do to prepare KFM for the next big thing (changeable view types – icon view, details view, etc), and I’m “rearing at the bit” to get started on that!

Anyway, please download and try it!, and if you feel very happy that I’ve improved your customers’ online experiences, there is a handy PayPal button just below the big green Download button.

Progress Bar for Mootools

I was admiring the Progress Bar that World Of Solitaire has for loading its deck images, and noticed that when the value gets beyond 50%, the colour of the text changed from black to white to make it easier to read on the newly dark background.

Unfortunately, when the value was between about 49% and 51%, the numbers were half on a dark background and half on a light background, and therefore less legible because the text itself was either dark or light.

Thinking about that, I realised that some progress bars I’ve seen in Desktop environments get around this by colouring the text such that the part which was on the dark background was light and the rest was dark.

progressbar.png

Of course, how would you actually do that using HTML and CSS??

Here’s the solution I came up with (works in Firefox – I’ll have a look at IE if anyone asks for it in that…):

The Demo

Note that the default value in the demo is 48%. In my browser, the ‘8’ is half on a dark background, and half on a light one. I’ve managed to come up with a way to colour half of the number dark and half light.

How I did it was draw the progress bar twice, once with a dark background and light text, and once with a light background and dark text. Then, I clip the bars so that only a certain amount of each is actually visible.

When you see a white 4, white/black 8, black %, you’re actually seeing two halves of separate elements’ text, stuck together to fool the eye!

The script is written for MooTools. Feel free to rewrite it for any other framework.

To use, do something like this:

var obj=new ProgressBar(48);
$('wrapper').appendChild(obj);

That simple!

There are optional parameters you can use as well. Here is an example using them all:

var pb=new ProgressBar(48,{
	'width':200,
	'height':20,
	'darkbg':'#006', // dark background
	'darkfg':'#fff', // dark foreground
	'lightbg':'#fff', // light background
	'lightfg':'#000' // light foreground
});
$('wrapper').appendChild(pb);

There are default values for all of these, so use what you need.

The Source

online schema designer

check this out! – pointed out to me by the ever-zestful Liam Robertson.

Although this is called “SQL Designer”, it looks like its purpose is actually just for the design of database schemas.

Still – an impressive script!

Exports SQL in a number of formats – MySQL, MSSQL, PostGres, etc.

online autism test hack

I was speaking with m1 in the ILUG chatroom today, and he mentioned an online autism test on Wired.com.

When you fill that out, and submit it, though, you will be shown the source code of the script which was supposed to calculate the results.

To get it to work, download the source, copy it into a .pl file, and upload it to your own server into your own cgi-bin (chmod to 755 before uploading). Then open up the test, use Firebug to edit the ‘action’ parameter of the form to point to your machine, and there you go!

If you want to try it out yourself, my copy of the file is here: http://verens.com/cgi-bin/autistic.pl – go to the wired.com form, change its action using Firebug (“inspect” the form, and click the action parameter to change it), then fill in the form and submit.

I scored 32, by the way, which is not quite the social animal I’m sure everyone takes me for, but also not extremely autistic. (of course, a few of those questions were confusing, so I may have got them wrong 😉 )

add a key handler to CodePress

as part of KFM 1.1, I was asked to add a few key bindings to some parts. The trickier part was to treat the Esc key as a “Close” request in CodePress embedded text editors.

It was tricky, as I did not want to directly hack CodePress – I inevitably forget the hack when it comes to time for an upgrade, and overwrite my hack with the latest new copy.

So, the hack is slightly different. Instead, I have a setTimeout loop running in the parent window, testing to see if the CodePress window has finished loading yet. When it has, a keypress event function is manually inserted into the CodePress window, testing for the Esc key.

Code for the CodePress creation (I’m using MooTools in the parent window):

function kfm_textfile_createEditor(){
    CodePress.run();
    if($("kfm_tooltip"))$("kfm_tooltip").remove();
    kfm_textfile_attachKeyBinding();
}

Now, start the onload loop – note that I’m using browser-based event attaching here, as CodePress does not use mootools:

function kfm_textfile_attachKeyBinding(){
    if(!codepress.editor||!codepress.editor.body)return setTimeout('kfm_textfile_attachKeyBinding();',1);
    var doc=codepress.contentWindow.document;
    if(doc.attachEvent)doc.attachEvent('onkeypress',kfm_textfile_keybinding);
    else doc.addEventListener('keypress',kfm_textfile_keybinding,false);
}

And finally, the test for the esc key

function kfm_textfile_keybinding(e){
    e=new Event(e);
    if(e.code!=27)return;
    e.stopPropagation();
    kfm_textfile_close();
}

Autism

Today, I add a new tag to my wordpress collection.

Yesterday, Jareth’s psychiatrist, the jazz-playing Michael McDonough, verified that Jareth is autistic.

This was not a snap decision. Jareth has been in observation for over a year now. Almost every week, I’ve taken half a day off work to bring him to sessions at Enable Ireland. the Monaghan branch is very very friendly.

Some of the signs of his autism:

  • He will be four next month. He has not spoken a single sentence yet.
  • He expresses excitement by jumping up and down and flapping his hands
  • He has extraordinary sequencing ability – can write numbers from 0 to whatever, and letters from a to z. Also the reverse – z to a, whatever to 0.
  • His drawing ability is more complex than one would expect of a three year old.

There are more symptoms (see here for the more common characteristics), but they are not as visually obvious.

So why am I putting this in my blog? Surely one non-technical post this month is more than enough?

Well, if you are reading this blog, you are probably a technical person. And you probably exhibit those same characteristics. Are you very good in some areas (programming, for example) and other people think you are anti-social (even if you don’t think so yourself)? Do you fidget?

The reason I say all this is that I see myself in Jareth. As a child, I was always alone, I was nicknamed “Einstein II” because I had a great ability in maths and general knowledge (the maths ability stagnated as I got bored with school), I still fidget (rocking, finger tapping), people say I am antisocial and arrogant and even sometimes obnoxious although I really don’t see it at the time and am always surprised when someone says it.

Autism is about 80% genetic, and there is a 4.3:1 ratio of male to female incidence. this means that if Jareth’s autism is hereditary, then he most likely got it from me than from Bronwyn.

There is a plus side, though – I grew out of most of the symptoms, and I think he will as well.

Also, his abilities are perfect for the 21st century – his interests lie in areas that are perfect for engineering, programming, or other technical careers. I think he’ll go far.

Autism is not a bad thing. It is just another way of approaching life. There is no cure, but autistics say that they don’t want to be “cured” anyway.

My son enjoys his life, even if communication is frustrating, and I would not have him any other way.

jareth the artist

Jareth is always suprising me with his drawing skills. Usually, there is a point to them – he would draw a wineglass on a table with himself standing right next to it, looking at it. He draws all humans like Blue from Fosters Home For Imaginary Friends, except for his sister Boann, who he draws like a small sitting human. It’s fascinating.

Here are some of his recent creations.

  • Boann got a toy laptop from her uncle Mick (my brother). Jareth has drawn himself playing with it, in the hope that his drawing will come true.
    Jareth playing with his sister’s laptop
  • Not sure why the bowl says “Dog” – we have two cats, but no dogs. But impressive for a 3-year-old to do this anyway!
    Jareth feeds a dog…
  • He’s drawn a scene like this one a few times before. From left-to-right, it’s my fridge/freezer, microwave (with something cooking in it) and stove (with something cooking on it). I think it was a hint that he was hungry.
    cooking
  • His latest – looks like him riding a bike, but not enjoying it too much.
    riding a bike

Last night, I was considering whether to try interest him in architecture or engineering when he gets to that age – if he’s this attentive to detail at 3, imagine how he will be at 18?

update – 15:38

Just caught him in the act. Here he is drawing two people. I presume one of them is me (holding an umbrella???) and the other is Bronwyn.

p8080050.jpgp8080052.jpg

PS: KFM 1.0 was released over the weekend – get it!

KFM 1.0 released

Today, I released KFM 1.0, a web-based file manager powered by php/ajax with mysql/postgresql/sqlite.

This is an important release for me, as it marks the completion of the original feature-set that I had in mind when I first started the project – match and exceed FCKeditor‘s default file manager, and provide extras such as multiple file upload and tags.

I was considering giving this a rest for a while before starting on version 2, which will have a lot more “desktop” tricks in it – different view modes, live streaming of videos, vector graphics, plugins – but I feel energised right now, so may just get to work on it.

ohloh considers this project to be worth about $889,277, and you get it for free, so please download it, try it, and comment about it.

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.