scriptygoddess

03 Jun, 2003

Javascript Credit Card Number Validation…

Posted by: Jennifer In: Bookmarks

After much searching this morning, I think I found a credit card validation javascript that will work for the project I'm doing: here.

If you know of others please pass on the links! (10 points if you find one in ASP!) 😉

03 Jun, 2003

10 php functions (article)

Posted by: Jennifer In: Bookmarks

I stumbled across this article over at DevArticles. 10 PHP Functions I bet you didn't know about. (I didn't)

I talked about stored procedures here the other day. Today, I needed to create a page that would call one of those stored procedures (the selecting one) and display all data from a table. This code is very plug-and-play-ish – very little needs to be modified (that is, as long as you're using MS SQL Server). If all you need to do is a "screen dump" of everything in the table, this ASP takes care of everything for you… (it even uses an ASP version of the alternating color rows PHP script snippet I had posted awhile back here.
Read the rest of this entry »

01 Jun, 2003

Voicemonkey

Posted by: Jennifer In: Bookmarks

Hugh sent me an email telling me about a service called voicemonkey that he's developing. (Ok, I almost insta-deleted the email because I thought it might be spam. LOL!) But I signed up to give the service a try and it's pretty cool. (and FREE! at least for now while it's in beta-test mode) There's a few different levels you can sign up for – but the "blog" level I did works like this: there's one link (it never changes) and it will play you the latest message I've left. (Which in my case will likely always be the same, unless I get adventurous and start using it all the time.)

So if you've always wondered what I sounded like, if I had a NY or Boston accent, sounded like a wacko or whatever – Here's your chance to find out.

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…

31 May, 2003

writing and using stored procedures

Posted by: Jennifer In: Script snippet

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.)
Read the rest of this entry »

Comments Off on writing and using stored procedures

27 May, 2003

When a number isn't a number…

Posted by: Jennifer In: Lessons learned

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…

27 May, 2003

Javascript Fading Text

Posted by: Jennifer In: Bookmarks

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

27 May, 2003

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

Posted by: Jennifer In: CSS

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.)

22 May, 2003

Random stylesheet GEnerator – CSS in action

Posted by: Jennifer In: CSS

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]

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements