Archive for ‘PHP’

November 5th, 2011

CodeIgniter 1.7 Professional Development – Review

I am done a considerable amount of web development over the years ranging from HTML to MySQL/PHP driven web applications utilizing the power of such things as javascript, AJAX, jQuery and many more…

I finally decided that it was about time for me to get serious and look into a FrameWork to better standardize my work. As such, I purchased a couple books on the matter, one of which was CodeIgniter 1.7 Professional Development by Adam Griffiths (272 pages) and published by PACKT Publishing.

All I can say is in comparison with the ZEND Framework in Action book, this was a real treat! It was easy to read and they started out with the very basics; Installing CodeIgniter!

The book is written in a manner that I found very fluid and the chapters just seems to flow one into the other.

I think this book is a great purchase for any new CodeIgniter developer looking to learn the basic quickly and easily. At +/-300 pages it isn’t too heavy to be intimidating, but does cover a lot of material in a manner you will understand.

I don’t regret this purchase in the least.

Share and Enjoy

  • Google Plus
  • Facebook
  • LinkedIn
  • Twitter
  • Email
  • Print
November 2nd, 2011

ZEND Framework in Action – Review

I will keep this very short and to the point.

I recently purchased a series of books, one of which was:

ZEND Framework in Action by Rob Allen, Nick Lo & Steven Brown, published by Manning with a total of 401 pages.

I can’t quite explain it, but something just doesn’t work. I seem to end up reading 3-4 times the same sections as if I am continually missing some key piece of information to allow me to actually understand and follow?! They cover everything I wanted to learn, but it just doesn’t seem to be complete. It just doesn’t seem to flow like other books I have read.

For instance, I had to go online to find out how to generate the ZEND directory structure, they seem to make a lot of assumption and/or skip over certain basic issues that, in my humble opinion, need to be part of the book to make it complete! I say this as I am also reading another book about CodeIgniter, which makes this one pale in comparison.

Case and point, I have been unable to date, to create a functional version of the helloworld example as explained in chapter 2 of the book! I keep getting errors no matter what I try. This book has ended up being more frustrating than anything else.

I think for a beginner looking to learn from scratch, this book leaves a lot to be desired. I’d keep looking. For an intermediate Zend developer, this book may be more appropriate.

I am still trying to complete the entire book and will post back with a final verdict.

Share and Enjoy

  • Google Plus
  • Facebook
  • LinkedIn
  • Twitter
  • Email
  • Print
June 6th, 2010

PHP Random String Generator

Have you ever need to generate a random string or generate a unique id using PHP. Below is a complete example of how to do so. Simply copy the entire code into a new php page and then open it.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP Random String Generator</title>
</head>
<body>
<?php
# AUTHOR: 		Daniel Pineault, CARDA Consultants Inc.
# DATE:			2010-06-25
# PURPOSE: 		Generate a random string or unique Id
# COPYRIGHT: 	You are free to use this code as you wish as long as
#	 			this header is include in the final work.  This is 
#				provided 'AS IS' and I assume no liability for its
#				usage.
#			

	foreach($_POST as $key=>$value) {
		$$key = strip_tags($value); //sanitize provided user entries
	}
 
	if(isset($GenRndStr)){
		$sUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		$sLower = "abcdefghijklmnopqrstuvwxyz";
		$sNumbers = "0123456789";
		$sSpecial = "!@#$%^&*()[]{},.;:'/\~-+=|<>";
 
		if($UCase==1){
			$s .= $sUpper;
		}
		if($LCase==1){
			$s .= $sLower;
		}
		if($Nbr==1){
			$s .= $sNumbers;
		}
		if($SpecChrs==1){
			$s .= $sSpecial;
		}
		if(strlen($ExChrs)>0){
			for($k = 0; $k <= (strlen($ExChrs)-1); $k++){
				$s = str_replace($ExChrs{$k}, "", $s);
			}
		}
 
		$sLen = $RandStrLen;
 
		for($i = 1; $i <= $sLen; $i++){
			$sRandString .= $s{rand(1,strlen($s))};
		}
	}
?>
<h1>PHP Random String Generator</h1>
<form id="RndStrGen" name="RndStrGen" method="post">
<table border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td valign="top"><strong>Password Characteristics</strong> </td>
    <td><input type="checkbox" id="UCase" name="UCase" value="1"<?php
			 if ($UCase == 1) {
			 	echo ' checked="checked"';
			 }
			 ?> />
      Upper Case Characters<br />
      <input type="checkbox" id="LCase" name="LCase" value="1"<?php
			 if ($LCase == 1) {
			 	echo ' checked="checked"';
			 }
			 ?> />
      Lower Case Characters<br />
      <input type="checkbox" id="Nbr" name="Nbr" value="1"<?php
			 if ($Nbr == 1) {
			 	echo ' checked="checked"';
			 }
			 ?> />
      Numbers<br />
      <input type="checkbox" id="SpecChrs" name="SpecChrs" value="1"<?php
			 if ($SpecChrs == 1) {
			 	echo ' checked="checked"';
			 }
			 ?> />
      Special Characters (!@#$%^&*()[]{},.;:'/\~-+=|<>)</td>
  </tr>
  <tr>
    <td valign="top"><strong>Characters to Exclude</strong></td>
    <td><input type="text" id="ExChrs" name="ExChrs" value="<?= $ExChrs ?>" /></td>
  </tr>
  <tr>
    <td><strong>Password Length</strong> </td>
    <td><input type="text" id="RandStrLen" name="RandStrLen" value="<?= $RandStrLen ?>" /></td>
  </tr>
</table>
<p>
  <input type="submit" id="GenRndStr" name="GenRndStr" value="Generate String" />
</p>
</form>
<?php
	if(isset($sRandString)){
		echo "<p>".$sRandString."</p>\n";
	}
?>
</body>
</html>

Share and Enjoy

  • Google Plus
  • Facebook
  • LinkedIn
  • Twitter
  • Email
  • Print