Monthly Archives: July 2012

Hilarious Programming Jargon

Today i found a funny article on www.businessinsider.com about the programming jargon: Heisenbug: A play on “Heisenberg,” a principle in quantum mechanics, a Heisenbug is a bug that disappears or alters its characteristics when an attempt is made to study it. Hydra: A bug that, when an attempt to fix is made, introduces two new read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

PHP Credit Card Validator – Class

If you ever need to validate credit card numbers, here is a simple validator class. Of course you can use it as simple as just defining validation rules in one array and use the php biult-in preg_match function to validate. But for the sake of good OOP practice, we need a class . Well, i read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Symfony 1.4 validate form fields depending on the other fields value

If you are working with Symfony, you might need from time to time validate a field, depending on the other filed value. There are a few ways to accomplish this. One quick method is to override the bind function: <?php public function bind(array $taintedValues = null, array $taintedFiles = null) { if($taintedValues["method"] == ‘firstAddress’) { read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

PHP Email Validator

The most common validator – email address validator: <?php $email = "[email protected]"; $pattern = "/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i"; $isValid = preg_match($pattern, $email); ?> Create a simple validation function, so you can use it as many times you need: <?php function validateEmail($email) { $pattern = "/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i"; return preg_match($pattern, $email); } ?> You can check more examples at http://php.net/manual/en/function.preg-match.php .

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Convert multidimensional array to object – PHP

As you may already know, you can convert an array into an object simple like this: <?php $array = array(‘first_name’ => ‘John’, ‘last_name’ => ‘Doe’); $object = (object) $array; ?> Then you call the object: <?php echo $object->first_name; ?> The problem is that you can’t do this with multidimensional array. So, for this, i’ve found read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Ubuntu server network problems – network down after reboot

I’ve experimented a strange situations a few days ago. After a few updates, my VPS became unreachable. Ifup command was throwing me errors – directory “/var/run/network” does not exists. After a few hours of researches, it seems that this is a problem that was solved back in 2008. Unfortunately, for some reasons – most probably read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

What is Web Development

Web development is a broad term for the work involved in developing a web site for the Internet (World Wide Web) or an intranet (a private network). This can include web design, web content development, client liaison, client-side/server-side scripting, web server and network security configuration, and e-commerce development. However, among web professionals, “web development” usually read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS