Archive for October, 2006

Google maps

Tuesday, October 31st, 2006

Omg, this is so much fun! Google Maps has a complete API to implement a map on your site, customized to your very own needs.

It's quite simple, all you need to do is create a div-element and add some JavaScript, basically all that's needed is this:

JavaScript:
  1. var map = new GMap2(document.getElementById("map"));

A bit more in depth tutorial can be found at the API docs website (listed below).

Putting content

Monday, October 30th, 2006

Is so damn boooorrriiinnnnggg!!! :(

Cross Browser HTML Printing

Thursday, October 26th, 2006

There's a big difference between making a website look good on screen and for print. With a screen you can be save in using pixels for your fonts and more absolute measures. In print this is not done. First there are different paper-size, a4, letter, a3, etc... Than every printer has it's own margins too. Next to that a printer most of times works in 300 dpi (dots per inch) while a screen is only 72 dpi.
So when ur marking a page up for print be sure not to use any absolute measures like pixels, but only to use relative ones like em, %, pt, etc...

Another screw up for print is using floats, they display different with every browser. As I just now discovered. FF (FireFox) displayed a div through another div, while IE displayed them below each other, as intended. I guess that's what you get for using inline styles.
If you're like me are using 2 stylesheets, one for screen, one for print. You have to take care not to overlook any !important statements in your CSS for screen. This can majorly screw up your print size. I had a width: 1003px !important defined, while FF printed the page just fine, IE(6) would let the page overflow and not print what ran off the page.

A nice article about printing HTML can be found here: http://alistapart.com/articles/boom

Duplicated characters with floats in IE(6)

Wednesday, October 25th, 2006

I am working on a website for a client and all of a sudden I see the last two characters of my last float being repeated on the site when I use Internet Explorer 6. This is a bug in IE6 and can be fixed the best way (imo) by putting a condition in your comment that IE should skip it, like this:

More info and workarounds: http://www.positioniseverything.net/explorer/dup-characters.html

Anchors and CSS

Tuesday, October 24th, 2006

A nice thing to remember are these notes from the w3schools website:

Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!

Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!

Note: Pseudo-class names are not case-sensitive.

I wondered too often why my hovers didn't work while I clearly specified them.

Link: W3schools.com, look under "Anchor Pseudo-classes"

Time To Live

Sunday, October 22nd, 2006

Toyed around a bit working on a TTL class as discussed in my thread on ActionScript.org. It's getting there and I'll make the final classes avaible as soon as they're documented and completely working.

Code plugin

Thursday, October 19th, 2006

I definitely need a code plug-in here soon, so code will be nicely displayed. :)

EDIT: Ok, got it, but now I want tag highlighting. Guess that will have to wait a little bit ;)

Send data to PHP

Thursday, October 19th, 2006

In order to have a PHP script executed (and not opened in a window) through ActionScript use loadVars.sendAndLoad(url, your_data, method) instead of loadVars.send(url). In this way the opening of a new window isn't necessary.

example:

Actionscript:
  1. // create a new LoadVars instance
  2. var c_lv:LoadVars = new LoadVars();
  3.  
  4. // populate it with some data
  5. c_lv.bericht = input_bericht.text;
  6. c_lv.email = input_mail.text;
  7.  
  8. // offer the data to the PHP mail handler and execute it!
  9. c_lv.sendAndLoad("sendForm.php", c_lv, "POST");

$_POST empty or not

Thursday, October 19th, 2006

Use empty($_POST) instead of an if containing $_POST[0] == "". This gave me a lot of trouble to find out why there wasn't anything sent by my mailer, who can receive variables using both GET and POST. Oops! :S

This is valid obviously for any associative Array. ;)

- the empty() function documentation

In the beginning…

Wednesday, October 18th, 2006

Weee!!!

Started this blog to track all the great stuff I discover about web related programming.

PS: Yes, I am a big fan of Monsters Inc. :)