Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of Zepto.js, of script.aculo.us, and I'm a Ruby on Rails core alumnus. With Amy Hoy I'm building cheerful software, like Noko Time Tracking and Every Time Zone and write books like Retinafy.me.
   Want me to speak at your conference? Contact me!

Agile Web Development with Rails

May 19th, 2005

The book Agile Web Development with Rails which holds a chapter that I’ve written (on Ajax and the Prototype library) will be released (tentative date!) in July.

When it’s out, be sure to grab a copy! It’s the perfect companion to your Pickaxe. The book is really, really great. Thanks to Dave Thomas of the Pragmatic Programmers to have the chance to be part of making this wonderful book.

Effects, next level

May 17th, 2005

A quick glimpse of what’s going to happen for the next version of my Effects stuff in the wonderful Prototype javascript library

Check out the demo page for the next-generation effects.

These effects are thought of as a complete replacement of the current ones:

  • You can now specify durations (which are now completetely independent of your users computer speed as they are time-based!) in a default way
  • You can easily add your own Effects and combine them with each other.
  • You can choose among some transition modifiers (it defaults to a smooth sinoidal transition) and priovide your own

Think of them as more mature now.

Of course, the effects are there to support the user to help her or him to tell what’s going on (especially for visual feedback with an Ajax application). But I can see artistic uses, too.

Note: it’s a work in progress, so check back often (or get the RSS feed). I’m happy to hear your comments. I hope to have most of the “1.0” effects migrated by the end of this week.

Fun tricks with the prototype Effects

May 5th, 2005

Here are some hints and tricks for using the prototype effects.

(Note that my Typo CSS styles make some of the examples not work too good here. But you get the basic ideas. Play around yourself!)

Trick #1:
Using em units to allow Effect.Squish to scale text and child elements.


Testing Effect.Squish—click me!

I’m big!

HTML for this:


<div onclick="new Effect.Squish(this)"
  style="font-size:1em;border:1px solid #888;
  background-color:#eee;
  line-height:1em;padding:1em;width:50%">
    <span style="font-size:1em">
    Testing Effect.Squish -- click me!
    </span>
    <div style="margin-top:0.5em;margin-bottom:0.5em;
    width:5em;height:2em;font-size:2em;
    background-color:#888;color:white;text-align:center;">
       I'm big!
   </div>
</div>

Trick #2:
Using multiple effects on one element.

Click me to do a Appear
and Scale at the same time!

Code:

<div
  onclick="new Effect.Scale(this, 150); new Effect.Appear(this);"
  style="background-color:#eee;width:50%;font-size:1em;">
  Click me to do a Appear <br/>
  and Scale at the same time!
</div>

Trick #3:
Mix em units and px units for great Scale usage.

(move your mouse here)

I don’t get scaled
I get scaled!

Code:


<div onmouseover="new Effect.Scale(this, 120)"
  onmouseout="new Effect.Scale(this, 100)"
  style="width:50%;border:1px solid #888;
  background-color:#eee;padding:0.5em;">
    (move your mouse here)
    <div style="font-size:12px">
       I don't get scaled
    </div>
    <div style="font-size:1em">
       I get scaled!
    </div>
</div>

(Hmmm. Looking at what happens here, I guess there’s a bug in Effect.Scale. I’ll fix that soon.)

PostgreSQL on Mac OS X Tiger

May 3rd, 2005

If you go with the best (and you do that by using Mac OS X), you’ll want to use PostgreSQL with your Rails application (and not that other “database”).

So, what’s the deal?

First of all, install Rails on your Mac OS X Tiger system like described on this wiki page. Head straigt for the first option “Mac OS X Installer Package” of you are just starting out with Tiger, or check the other options for your setup.

Next, grab the PostgreSQL package from entropy.ch and follow the installation instructions for Mac OS X 10.3 (don’t mind the .3). If you’re like me, you’ll want full unicode support when creating your db, so change step 6 to something like (that’s all in one line!):

/usr/local/bin/initdb -D /usr/local/pgsql/data
--locale=en_US.UTF-8 --encoding=UNICODE

So, you’ve a nice running PostgreSQL setup on your Mac OS X Tiger box now. But, wait a minute—you want it to use with Rails, right? You want to grab the Ruby PostgreSQL driver from this page (get the snapshot version if you want to stay on the edge).
Follow the compile instructions. You’ll want to do a:

sudo make install

as the last step here. (Note: there’s a Gem version too, but it doesn’t compile out of the box on Mac OS X).

Then, get the Mac OS X native pgAdmin version. Just use the latest snapshot.

Untar, and launch. Have fun!

UPDATE: One thing that bugs me with this is that script/console seems to be broken, as I get a SIGBUS error from ruby-postgres. Webrick and script/runner work fine, though. Has anyone experienced this too?

UPDATE 2: The script/console not working correctly is discussed in greater detail and including a workaround over at the Ruby on Rails development site in ticket 1283.

Fun with the canvas element

May 1st, 2005

The need for better 2d graphics in HTML (and to have some eyecandy in Dashboard) led the Safari developers to implement an all-new HTML tag, called “canvas” (read the spec).

The latest Mozilla trunk now has support for it too.

And of course, someone made a demo page. (Note: works with Safari 1.3 and 2.0—that means Panther and Tiger, and with the latest-and-greatest Mozilla nightly). Here’s a nice demo of this too.

UPDATE: I’ve modified the the code of the second example and present my own, animated demo here.

Some more info on the Mozilla implementation.

Oh yes, while you’re at it, check out this post on how to use all the great new Safari features.

Cat on a hot coffee machine roof

April 28th, 2005

Once, it was one of the most amazing cool sites on the web. Now, everyone can do it from the comfort of his own home. Here’s a live updated video stream of my coffee machine:

(Well, actually, it’s not live. But most of the time my cat likes my coffee machine more than i do).

Google Maps – (some of) my places

April 25th, 2005

Although Austria hasn’t made it yet in to Google Maps (well, here is Vienna, Austria), there are some places in there that bear memories for me.

Like these:

  • My brother’s current location (he goes to Hockey School there!):
  • The house of my late grandmother
  • Long ago, I visited one of those lakes (can’t rememeber which)
  • And I suspect this to be a gas station I happen to know a funny story about (but won’t tell you)

I hope Europe will be added soon…

Note: Google Maps is perhaps the finest example of Ajax use on the web. It really shows what you can achieve. Look Ma, no proprietary plug-ins…

Delicious Library 1.5

April 24th, 2005

Yeah! Delicious Library 1.5 will come out soon (that is when the Tiger is let out into the wild)—and they promise support for international users, too!

That’s a good thing, as my books and DVD collections seem to shrink from time to time as I borrow something out and forget about it don’t get it back afterwards…

Inspect and visualize style sheets with ease

April 24th, 2005

If you’re looking for a (very) nice way to inspect CSS, give Xylescope by Cultured Code a try.

A beta version is available as a free download (requires Mac OS X 10.3.9).

Some light relief…

April 24th, 2005

Sometimes, program errors can make you happy. What? You don’t believe me?

Then hop over to Fehler10, a site dedicated to documenting the most humorous Mac OS errors known to mankind.

Yes, it’s in german, but that shouldn’t pose ein großes Problem big trouble.

Update: There’s a collection of the funniest ‘in english’ errors too. Thanks, Nils!