luminescente

How to kill yourself

Life — Pedro Cardoso on March 31, 2006 at 12:42 pm

Ah.. Nothing like starting the day reading [way on how to commit suicide](http://www.thebestpageintheuniverse.net/c.cgi?u=manly_suicide). Like a man, of course.

Reminds me of some hilarious usenet post I read a long time ago, leeched from the Reckless Life BBS, in a time where the internet was still something out of sci-fi movies. Not that I’m planning to do it, and never was, but it was a good laugh. Anyone knows where I can get it? I may have it at home on backup CDs, but having it online would be much better.

If you do it, goodbye letters are so old fashioned. Try to [do something a little different](http://www.theonion.com/content/node/30903).

Damn spam

Uncategorized — Pedro Cardoso on March 27, 2006 at 11:03 pm

My dear spammer friends are getting a little sloppy.

In my (almost) weekly check of the spam folder, I cam accross this particular piece of canned meat.

What’s ironic about this is that the low-life had so many things wrong in his/her spam assembly line, and yet the damn message still found it’s way to me.

spam

input type=search - Extreme overhauling

Programming, Projects — Pedro Cardoso on March 26, 2006 at 6:38 pm

If you’re using Apple’s Safari browser, you may have noticed the following input element, similar to a text box.

Safari Input Search

This element was introduced with Tiger (Mac OS X 10.4) integrated with Dashboard and Safari RSS, but it soon started to appear in some other sites. At it’s heart, this is just a special kind of INPUT element, of type “search”, that Safari renders as a Cocoa search field. Other browsers that don’t know what it is (ie, everyone else) default to a normal textbox, with no ill effects, apart from failing validation.

There are several new attributes for this element, documented here, but in short:

  • placeholder: the text to be shown in light gray when the box is empty
  • autosave: the identifier for auto saving entered values
  • results: the number of auto saved searches

What if there was a way to have this kind of element rendering in the other browsers like it does in Safari?

Well, I hacked away and now there is. I’ve been wanting to wait a little more and clean up the code but release early and release often, right? :)
Just include the code at the end of this post in your HTML, and that’s all, your search input elements will become like this in other browsers.

Input Search Test

Under the hood

At startup, all the INPUT elements of type search are parsed and this happens:

  • The element we are messing with is hidden, and a new container SPAN is created containing (in this order) the search image, a new textbox and the clear button. These elements are styled to look like a single element. In Mozilla, the corners are rounded using the -moz-corner-radius CSS rule.
  • The onBlur/onFocus events are defined so we can automatically clear and set the textbox’s default message (using the attribute placeholder)
  • Similar monkey business is done to the onChange so we can show/hide the clear button when appropriate.

Notes: This behaviour can be easily modified to apply this hack to elements with a certain className, instead of applying to elements of input type=search. When in the presence of Safari, replace the text with a search input. This way the (X)HTML could remain standards-compliant.

This code is yours to do as you please, just leave a comment if you like it… :)

    Todo
  • Re-use the text element instead of creating a new one and hiding the old one.
  • Paste-aware
  • Implement auto saving (using client-side cookies?)
  • Improve the positioning of the images

The files are here. You need the HTML along with the image files.

Hardcore iPod equivalent

Uncategorized — Pedro Cardoso on March 24, 2006 at 1:46 pm

On the way to work today there was a girl a few meters way from me on the subway. She had headphones on and was listening to some music, like a lot of people on the subway. I wouldn’t have noticed it if it weren’t for the fact that in the middle of the short commute she reached for her wallet, took out a CD player and a huge (about 8cm thick) CD case, happily started flipping through the CDs, chose one and replaced the one in the player.

It started me thinking. I wasn’t listening to music but I had my 512mb Shuffle tucked away in one of my pockets and I surely had more music in it than she had on all her stuff, in a much more convenient package. As an added feature, if I had my iPod stolen, i’d only lose the 100 euro it cost me back then. As a secondary added feature, I would have an excuse for getting a 2gb Nano :). She had some copies, but some were original CDs, and probably would cost her much more than my shuffle, music included.

Still, it’s some good food for thought that as we strive to know everyhing about the cutting edge (and given money, experience it), and then look at how far other people are from it, either by choice or by less unfortunate reasons.

Incidently, Russel talked about the Shuffle a couple of days ago, but I only took notice after writing most of this post. After reading his, just let me add that at the time I bought my Suffle, while I found it’s lack of display a huge turn down, it was the cheapest flash player I found. As much as I like the regular iPod, it was too expensive, and still is (at least for me), at the time I had gone through all the brand name and no-name flash players, and it was still common to find 128mb players for the same price as the Shuffle. Being a real iPod with 512mb for that price seemed enough to mitigate it’s lack of display.

Mac niceties

Apple — Pedro Cardoso on March 22, 2006 at 10:04 pm

Today at work accidentally pressed Command + Option + Eject and the computer went to sleep.

Nice, didn’t know this shortcut on OS X. Mac veterans will surely point out this probably predates MacOS X by a decade or so, but hey, my first Mac was bought a month after the release of 10.2 (Jaguar), and the only time I booted OS 9 on purpose was during the first week I had the computer. From then on my only experiences with OS 9 were mostly choosing “Force quit” when I accidentely started a classic app on OS X.

Still, there’s something about that interface. It lacks the bells and whistles of today’s GUIs, but it surely makes my crummy 1024×768 TFT seem huge compared to OS X.

Still, I googled for this shortcut and found the following:

  • http://kb.iu.edu/data/akrm.html
  • http://www.jmu.edu/computing/helpdesk/selfhelp/mackeys.shtml
Next Page »
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. | luminescente