Archive for May, 2003

CSS tutorials, Font browser, PHP debugging, project management links…

Saturday, May 31st, 2003

A few links I wanted to note…

Simon Willison: CSS ain’t Rocket Science (RSS ver.)
Looks like some interesting tutorials there. [link via Kristine]

Font Browser
A neato Flash thingy that will show you the fonts you have installed on your machine with a little sample on the side. You can change the sample’s text and size. [link via Jennifer's ETC.]

Debugging PHP
A little tutorial on how to figure out why your code doesn’t work - when it… uh… doesn’t work. ;0) I was actually considering writting a similar tutorial - listing just a few of the errors that I’ve come to know and love hate ;-) and what they mean to me. (from a “where do I look to fix it” perspective - not like an “I’m personally attached them” one) LOL! Maybe that’ll be my weekend project… [link via Donna]

I know there was a few other links I wanted to take note of that I saw earlier this week… but now I can’t find them (guess I should have made this post sooner. LOL!)

update: Here’s one I wanted to add:
Dot Project
If you need a (free!) project management package - I installed this one and so far it’s pretty cool!! It’s actually got a lot more than what I needed, and the “trouble ticket” feature needs a little work (it doesn’t email the person assigned when a trouble ticket is first created) but it’s still in beta, so maybe they’ll be fixing that soon. In either case, I’m really liking this so far and haven’t found too much else (that’s free!!) that does what I need…

writing and using stored procedures

Saturday, May 31st, 2003

I’ve been learning about stored procedures and calling them from ASP pages. So just wanted to jot down some examples/templates…

(note from my technical editor, Mike: This code is specific to MS SQL Server and probably wouldn’t work with other databases.)
(more…)

When a number isn’t a number…

Tuesday, May 27th, 2003

John (no URL provided) sent me a question based on some problems he was having with a javascript he had written. I’ve seen this happen with a few people now so I think a “tip” is in order. In javascript, ASP, and PHP(?) (and I believe other scripting and programming languages) - you can not have a number (ie. Integer, Float, etc.) with leading zeros. If you do - it will think it’s something else (specifically a hexidecimal, or octal number.)

Here’s a definition of hexidecimal and octal numbers I found here:

Hexadecimal and Octal numbers may also be represented in JavaScript. A hexadecimal number (base 16) is represented with a leading 0x, or 0X. The case of the X represents whether to use upper-case of lower-case letters for the hexadecimal number. Octal numbers are represented with a leading 0.

(don’t ask me to explain hexadecimal or octal numbers more than that. I’ve never had to use them, and I don’t know how I would. I only understand the textbook explanation you see above. LOL!)

If you have a number with leading zeros, and you need to KEEP the leading zeros, you need to treat it like a string. (i.e. put quotes around it).

So let’s say you have a function that takes an ID number. Your ID number has leading zeros. (Lets say this function simply needs to take your number and forward you to a page with the ID number as the “name” of the page).

function fakeFunction(id) {
document.location= id + “.htm”
}
… some code …
<a href=”#” onClick=”fakeFunction(00123)”>This link to page 00123 won’t work</a>
but
<a href=”#” onClick=”fakeFunction(’00123′)”>this one will</a>

If you want to see what it’s reading (and this is a really good bugtesting tip in general) put in an alert. So make this the first line in your function:

alert(id)

In this example - the first link will pop up an alert that says “83″ (I guess 00123 is the octal (?) equivalent to 83) the second will pop up the correct value; “00123″.

Additionally - if you’re populating a database - and the database is expecting a *NUMBER* you can’t pass it a string. So if you’ve made your number with leading zeros into a string - you won’t be able to put it into the database. If your “id” field is set to accept a number, this insert statment will give you errors:

INSERT into student (name, id) values (”Joe Schmo”, “00123″)

It needs to be this:

INSERT into student (name, id) values (”Joe Schmo”, 123)

Yes, the leading zeros are gone. I suggest adding them in later (or changing your field type). You can easily add leading zeros to a number in php using the sprintf function like this

$aNumberThatsAString = sprintf(”%05d”.”id”);

Breaking that down: %0 (pad with zeros) 5 (so that there are 5 “digits”) d (this is an integer/decimal number)

Feel free to add to this or correct me in the comments. Some of the above may be incorrect assumptions…

Javascript Fading Text

Tuesday, May 27th, 2003

Sharp looking fade-in and fade-out effects using javascript. Cross-browser, able to handle big chunks of multi-element html: See examples here.

The Search for the Missing Link (link-hover tricks)

Tuesday, May 27th, 2003

A short article showing how to use CSS pseudo-classes to help users find hard to spot links on an otherwise well designed page. This involves using the :hover pseudo-class on paragraphs, so you’ll need to use the newest version of Mozilla (1.3) to get the full effect!

(update: this technique has also been confirmed to work in Netscape 6+, Opera 7, Safari, and Konqueror.)

Random stylesheet GEnerator - CSS in action

Thursday, May 22nd, 2003

Are Cascading Style Sheets a mystery to you? Are you looking for new design ideas? Visit StrangeBanana’s Random Style Generator and reload, reload, reload the page to see how different style choices affect the content elements on a page. It’s an excellent learning tool, and if you find one you like, you can view the source and save it for yourself - a unique design all your own. [via a.wholelottanothing.org]

TRH Link Manager with optional MT plug-in

Thursday, May 22nd, 2003

Introduction
Do you have lots of links you want to keep up with? Browser bookmarks
just not cutting it? The TRH Link Manager is designed to work with a
web hosting provider that provides both PHP and access to MySQL. While
the TRH Link Manager includes hooks for the Moveable Type weblog
manager, you are not required to use it with MT.
(more…)

bookmarklets galore

Thursday, May 22nd, 2003

Recently I needed a bookmarklet I had rememberd seeing on webgraphics. I did a search and ended up finding a BUNCH of bookmarklets they’ve linked to in the past…

This post about a ruler bookmarklet here

This one about a bookmarklet (for mozilla) that will let you move the images on page around (great for if you’re playing around with a design) [link here]

This one and this one (which was the one I was originally looking for) that will parse out all the images on the page, and give you info about them all… The code on their page looks a little messed up (maybe because it’s an older post, etc.?) In any case, this is what I needed: Image ALT Info

Remove Documents/Favorites from Start Menu (Win98)

Tuesday, May 20th, 2003

I think with Windows 2000 you can do this from the menu, but my laptop is Windows 98 (it’s an old laptop) and those extra menus really annoy me and tend to just clutter everything up. I keep having to go back and find these links, and I figured it might be nice to bookmark them where I and others who might be interested can find them.

Remove Documents Folder from Start Menu

Remove Favorites Folder from Start Menu

“Blog last Updated…” for non-blog-only sites

Tuesday, May 20th, 2003

On sites where the homepage is not the main page of the blog, it isn’t always easy to tell when the last update was, and for those of us whose sites are built that way, it can sometimes be a pain to keep the “Last Updated: #########” line up to date. I realized a while back that since I generally write a blog entry of the “hey I added something to {link}this page{/link}” sort even when my updates weren’t directly blog content related, so I built this little PHP script that keeps my last updated tag correct without my even thinking about it, since it gets it from the most recent blog entry and pastes it into any page on my site. I use Greymatter, but I don’t think it would be too hard to modify this to any other blog program.
(more…)