Archive for February, 2009

In the Woods – Vertical Centering With CSS

In the Woods – Vertical Centering With CSS

There are a few different ways to vertically centre objects with CSS, but it can be difficult to choose the right one. I’ll show you all the best ways I’ve seen and also how to create a nice little centered website.
Vertical centering with CSS isn’t an easy thing to do. There are many different ways that may not work in some browsers. Let’s review 5 different ways to vertically centering objects, as well as the pros and cons of each method. (You can see my test page briefly explaining all of them.)


Method chaining with PHP 5

Since the introduction of PHP 5 and it’s better OO capabilities it is possible to use method chaining. In most modern frameworks, like Zend Framework‘s Zend_Mail for example, it’s widely used.

An example of method chaining from the Zend Framework documentation for the Zend_Mail component looks like this:

$mail = new Zend_Mail();
$mail->setBodyText('This is the content of the mail.')
     ->setFrom('somebody@example.com', 'Some Sender')
     ->addTo('somebody_else@example.com', 'Some Recipient')
     ->setSubject('My own subject')
     ->send();

The code above can also be written like below, without method chaining:

$mail = new Zend_Mail();
$mail->setBodyText('This is the content of the mail.');
$mail->setFrom('somebody@example.com', 'Some Sender');
$mail->addTo('somebody_else@example.com', 'Some Recipient');
$mail->setSubject('My own subject');
$mail->send();

It depends on your likings of which method you want to use, but you can extend your methods with the chaining way without harming the traditional way so in the end the programmer can decide the method he desires. If you want to make the methods ready for it the method simply needs to return the object itself, like so:

public function foo() {
    // ... do something here ...
    return $this;
}

I’ve highlighted line 3 where the magic applies. If you had foo(), bar(), baz() and bat() methods you could then do this:

$myClass->foo()->bar()->baz()->bat();

You may not want or need to do this in any of your code, but the possibility is there if you or any colleague wants to.


Font Generator – Make Your Own Handwriting Font With Your Fonts

Font Generator – Make Your Own Handwriting Font With Your Fonts

Convert your handwriting to a font in 7 easy steps, the only things you need are a printer, pen and a scanner. Upload the scanned pages and recieve your digitized handwriting for usage in most common programs!


pChart – a PHP class to build charts

pChart – a PHP class to build charts

One of the best PHP classes to create beautifull charts with! If you see this you wish you had more clients demanding charts in their applications. You need PHP with GD compiled to be able to use this.

pChart is a PHP class oriented framework designed to create aliased charts. Most of todays chart libraries have a cost, our project is intended to be free. Data can be retrieved from SQL queries, CSV files, or manually provided.


Wanted: Layout System

Wanted: Layout System

Eric Meyer elaborates on why we need a better layout mechanism for web content (whether it be via CSS or not). We know we shouldn't use tables for layout. Floats are a hack, positioning is flawed, and display:table-cell is no better than using a table itself. But Eric explains here why table behavior works moderately well for layout:
… this is why the old “only use tables for layout” argument keeps coming up over and over: strip away the overheated rhetoric and obvious link-baiting, and you find the core of a real need. Because as powerful as CSS can be, table cells do certain things very easily that CSS makes very, very hard. Cells stretch vertically, keeping equal heights as a matter of their intrinsic nature. They stay out of each others’ way, while still being allowed to sit next to each other and use any sizing dimensions. They tie their layout to their parent elements, and vice versa.


How To: Hackintosh a Dell Mini 9 Into the Ultimate OS X Netbook

How To: Hackintosh a Dell Mini 9 Into the Ultimate OS X Netbook

A very good how-to about how you can convert a Dell Mini 9 into the perfect Mac OS X netbook. Something I definitely want to try someday!

There are a lot of netbooks on which you can install and run OS X, but if you're mindful of the handy comparison chart those lads at Boing Boing Gadgets have compiled, you'll know that the Mini 9 is about as ideal a platform as you'll find for a Hackintosh ultraportable: Everything from wi-fi, sound and the function keys down to the optional integrated mobile broadband card and the SD card reader are supported and work as they should. No hardware compromises at all. It's awesome.


Copyright © 1996-2010 Re:morse.nl. All rights reserved.
iDream theme by Templates Next | Powered by WordPress