Snippet: PHP, MySQL and IDN Email addresses

November 20th, 2008 by Richy B. No comments »

Here’s something to look out for if you are building an international website where you are handling email addresses…

Email addresses, as you are probably aware, comprise of two parts. The “local part” (the bit before the @ sign) and the “domain part” (the bit after the @ sign). Therefore with the email address richard@example.invalid , “richard” is the local part and “example.invalid” is the domain part.

The domain part of the email address can actually be 255 characters in length theoretically (it’s 63 characters for the actually domain name, then the TLD: however, you could have sub domains in force which can take it up to the 255 limit.

The local part of the email address can be 64 characters: bringing the count up to 319 characters. Allow an extra one for the “@” sign and 320… Just slightly too big to fit within the standard 255/256 character string field that has tended to be used. I’ve seen rumours that this section may be expanded to 128 characters, so plan for 383 characters.

Oh – don’t forget that Internationalised/Internationalized Domain Names are becoming popular in some countries and unless you want to handle conversion to/from Punycode or another storage format for the IDNs, then you’ll need to make your database store the email address in Unicode… However, that appears to cause a problem in some version of MySQL if you store it all in a Varchar field.

So in your programming language (such as PHP), you’re going to have to keep all the above in mind and then split the email address into two parts for storing in the database for sanity.

See http://www.faqs.org/rfcs/rfc2821.html, http://en.wikipedia.org/wiki/E-mail_address, http://www.santosj.name/general/stop-doing-email-validation-the-wrong-way/ and http://askville.amazon.com/maximum-length-allowed-email-address/AnswerViewer.do?requestId=1166932.

YouTube: The Incredible Quantum of Solace

November 19th, 2008 by Richy B. No comments »

Found via Neatorama

Snippet: How To Tell if Your Cat Is Plotting to Kill You

November 16th, 2008 by Richy B. No comments »

Let’s face it cat owners, we all know the little fur balls are plotting on taking over the world (I blame the Egyptians myself!). When they aren’t asking “I Can has Cheezburger?, they are working out how to get rid of us humans. Lucikly, there’s a list you can work down to try and work out if the cute little ball of fluff is trying to kill you. There’s even a quiz for you to check – odds are that your cat is trying to kill you.

Joke: 21 signs a geek girl likes you

November 15th, 2008 by Richy B. 2 comments »

Like Naughty Questions asked by teacher, the following post is also shamelessly stolen borrowed from Beautiful World:

21 Signs a geek girl likes you

  1. She tells you your hard drive is much bigger than her ex-boyfriend’s.
  2. She makes a point of telling you how the system upgrade you did for her totally revolutionized her life.
  3. She stops blogging in front of the TV and talks to you.
  4. She gets shivers up her spine when you raw-code her HTML.
  5. The first time you used the Command Prompt in front of her, she screamed in excitement.
  6. She invites you to “302 back to my place” after a night out.
  7. She doesn’t cook you dinner — she defrags your hard drive.
  8. She thinks you’re much cuter in person than in World of Warcraft.
  9. She devotes an entire blog entry to you.
  10. She invites you to a romantic night at her place that involves popcorn and Tron.
  11. She leaves you a love post – its written entirely in Visual Basic.
  12. She “casually” invites you to come with her to the next Linux Expo.
  13. She gives you her telephone number in binary.
  14. She gives you lots of link love.
  15. She regularly Diggs articles she thinks you’ll like.
  16. You’ve overheard her telling her friends you are “so 2.0.”
  17. She always tags you for memes.
  18. She puts memory cards in your stocking for Christmas.
  19. She always sides with you when someone brings up the “Mac vs. PC” debate.
  20. She likes your black jeans.
  21. She reminisces with you about those old-school Commodores you both had as kids.

Joke: Naughty questions asked by teacher

November 9th, 2008 by Richy B. 1 comment »

A first-grade teacher was having trouble with one of her students.

Teacher: What is your problem?

Bog: I’m too smart for the first-grade. My sister is in third-grade and I’m smarter then she is. I think I should in the third-grade too.

The teacher took the boy to the Principal office.while the boy waiting in the outer office, the teacher explained to the principal what the situation was.

The principal told her that he would give the boy a test and if he failed to answer any of his questions he was to go back to the first-grade and behave.

She agreed.

The boy was brought in and the condition were explained to him and he agreed to take the test.

Principal:What is 3×3?
Boy:9

Principal:What is 6×6?
Boy:36

And so it went with every question the principal thought a third-grade should know.”I think the boy can go to the third-grade”, said the principal.

The teacher said she had some of her own questions to ask.

The Principal and the boy agreed.

Teacher:What is that a cow has four and I have only two?
Boy: (after a moment) Legs.

Teacher:What is in your pants that you have but I do not have?
Boy:Pockets.

Teacher: What starts with a C and ends with a T, is hairy, oval, delicious and contains then whitish liquid?
Boy: Coconut.
» Read more: Joke: Naughty questions asked by teacher

gamy-dance
%d bloggers like this: