Cake PHP Framework Resources #16

From: http://sitestree.com/?p=5170
Categories:16
Tags:
Post Data:2013-06-24 11:24:46

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Zend Framework: Programmer’s Reference Guide #16

From: http://sitestree.com/?p=5169
Categories:16
Tags:
Post Data:2006-10-26 13:05:07

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

PHP Language Features: Tools Strengths #16

PHP Language Features: Tools Strengths: Some resources from the Internet are provided below.

From: http://sitestree.com/?p=5143
Categories:16
Tags:
Post Data:2009-08-13 21:28:24

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

PHP Features for Enterprise Application Development #16

From: http://sitestree.com/?p=5142
Categories:16
Tags:
Post Data:2012-06-23 11:00:43

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

PHP in the Enterprises #16

From: http://sitestree.com/?p=5141
Categories:16
Tags:
Post Data:2011-07-04 14:41:16

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Cheat Sheets for Better Productivity #16

Cheat sheets can increase productivity in programming. How?In a cheat sheet, you can write down different functions [with parameters and syntax] that you use frequently [or all the important functions of a programming language]. Whenever, you are confused, take a quick look at the cheat sheets. Sometimes it can be faster than searching the internet. You can categorize the functions based on the purpose, within a category – sort them alphabetically for easier search/scan. You can create, many cheat sheets for a particular language. Keep them beside you while you are writing codes. A sample cheat sheet regarding PHP functions to handle MySQL database is provided below. Note, the cheat sheet needs to be improved such as: categorize the functions [like for connection management, retrieving data, keep track of database/operation status, collecting information about the database [meta-data]], sort the functions alphabetically. Keep the font size small to list more functions in a small space

resource mysql_unbuffered_query ( string $query [, resource $link_identifier ] ) Send an SQL query to MySQL, without fetching and buffering the result rows
int mysql_thread_id ([ resource $link_identifier ] ) Return the current thread ID
bool mysql_ping ([ resource $link_identifier ] ) Ping a server connection or reconnect if there is no connection
resource mysql_list_processes ([ resource $link_identifier ] ) List MySQL processes
string mysql_tablename ( resource $result , int $i ) the table name from a result
string mysql_stat ([ resource $link_identifier ] ) Get current system status
bool mysql_set_charset ( string $charset [, resource $link_identifier ] ) Sets the default character set for the current connection.
bool mysql_select_db ( string $database_name [, resource $link_identifier ] ) Select a MySQL database
string mysql_result ( resource $result , int $row [, mixed $field ] ) Retrieves the contents of one cell from a MySQL result set.
string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] ) Escapes special characters in the unescaped_string , taking into account the current character set of the connection so that it is safe to place it in a mysql_query(). If binary data is to be inserted, this function must be used
resource mysql_query ( string $query [, resource $link_identifier ] ) sends a unique query (multiple queries are not supported) to the currently active database
resource mysql_pconnect ([ string $server [, string $username [, string $password [, int $client_flags ]]]] ) Establishes a persistent connection to a MySQL server.
int mysql_num_rows ( resource $result ) Retrieves the number of rows from a result set
int mysql_affected_rows ([ resource $link_identifier ] ) Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE
int mysql_num_fields ( resource $result ) Retrieves the number of fields from a query.
resource mysql_list_tables ( string $database [, resource $link_identifier ] ) Retrieves a list of table names from a MySQL database.
resource mysql_list_fields ( string $database_name , string $table_name [, resource $link_identifier ] ) Retrieves information about the given table name.
use mysql_query() to issue a SQL SHOW COLUMNS FROM table
resource mysql_list_dbs ([ resource $link_identifier ] ) List databases available on a MySQL server
int mysql_insert_id ([ resource $link_identifier ] ) Get the ID generated from the previous INSERT operation
string mysql_info ([ resource $link_identifier ] ) Get information about the most recent query
string mysql_get_server_info ([ resource $link_identifier ] ) Retrieves the MySQL server version.
int mysql_get_proto_info ([ resource $link_identifier ] ) Retrieves the MySQL protocol.
string mysql_get_host_info ([ resource $link_identifier ] ) Describes the type of connection in use for the connection, including the server host name.
string mysql_get_client_info ( void ) returns a string that represents the client library version.
bool mysql_free_result ( resource $result ) free all memory associated with the result identifier result .
string mysql_field_type ( resource $result , int $field_offset ) Get the type of the specified field in a result
string mysql_field_table ( resource $result , int $field_offset ) Get name of the table the specified field is in
bool mysql_field_seek ( resource $result , int $field_offset ) Set result pointer to a specified field offset
string mysql_field_name ( resource $result , int $field_offset ) Get the name of the specified field in a result
int mysql_field_len ( resource $result , int $field_offset ) returns the length of the specified field.
string mysql_field_flags ( resource $result , int $field_offset ) Get the flags associated with the specified field in a result
array mysql_fetch_row ( resource $result ) Get a result row as an enumerated array
object mysql_fetch_object ( resource $result [, string $class_name [, array $params ]] ) Fetch a result row as an object
array mysql_fetch_lengths ( resource $result ) Get the length of each output in a result
object mysql_fetch_field ( resource $result [, int $field_offset ] ) Get column information from a result and return as an object
array mysql_fetch_assoc ( resource $result ) Fetch a result row as an associative array
array mysql_fetch_array ( resource $result [, int $result_type ] ) Fetch a result row as an associative array, a numeric array, or both
string mysql_escape_string ( string $unescaped_string ) Escapes a string for use in a mysql_query
string mysql_error ([ resource $link_identifier ] ) Returns the text of the error message from previous MySQL operation
int mysql_errno ([ resource $link_identifier ] ) Returns the numerical value of the error message from previous MySQL operation
bool mysql_drop_db ( string $database_name [, resource $link_identifier ] ) Drop (delete) a MySQL database
resource mysql_db_query ( string $database , string $query [, resource $link_identifier ] ) selects a database, and executes a query on it.
string mysql_db_name ( resource $result , int $row [, mixed $field ] )
bool mysql_data_seek ( resource $result , int $row_number ) Move internal result pointer
bool mysql_create_db ( string $database_name [, resource $link_identifier ] Create a MySQL database
resource mysql_connect ([ string $server [, string $username [, string $password [, bool $new_link [, int $client_flags ]]]]] ) Open a connection to a MySQL Server
bool mysql_close ([ resource $link_identifier ] ) Close MySQL connection
string mysql_client_encoding ([ resource $link_identifier ] ) Returns the name of the character set
int mysql_change_user ( string $user , string $password [, string $database [, resource $link_identifier ]] ) Change logged in user of the active connection
int mysql_affected_rows ([ resource $link_identifier ] ) Get number of affected rows in previous MySQL operation

From: http://sitestree.com/?p=5139
Categories:16
Tags:
Post Data:2011-11-14 22:16:24

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Database Operation Handling in PHP #16

Not the best approach. Just one approach. At least to help with thinking. to start with.

< ?php       

//you can keep database parameters in a file [text file or xml file]. 

/*
Create two users one with only read permission, another with read-write permission. 
Use read user related connection in read only operations. 
read-write user related database connection should be used only when writing is associated
*/

//database user with read only permission   
$roUser = "";   
$roPassword = "";   

//database user with read-write permission      
$rwUser = "";   
$rwPassword = "";           

//database and the host $host = "localhost";    
$database = "your_database";    

?>

< ?php            

//read only handle to database  
$dbhReadOnly = null;         

//read-write handle to database 
$dbhReadWrite = null;   

//read-write connection creation    
function getDbhReadWrite(){         

global $rwUser, $rwPassword, $host, $database;              
//connect to db with user that has read-write permission to the database        $dbhReadWrite = mysqli_connect( "$host",  "$rwUser", "$rwPassword", "$database");       //var_dump($dbhReadWrite);              
if (!($dbhReadWrite))           
return null;                
return  $dbhReadWrite;          

}   

//read-only connection creation 
function getDbhReadOnly(){          
global $roUser, $roPassword, $host, $database;              

//connect to the database with a user that has only read permission to the database     

$dbhReadOnly = mysqli_connect( "$host",  "$roUser", "$roPassword", "$database");                        

if (!($dbhReadOnly))            
return null;                
return  $dbhReadOnly;           
}       

//read-only connection - can be used from other php files    
$dbhReadWrite = getDbhReadWrite();

//read-write connection-     
$dbhReadOnly = getDbhReadOnly();

?>

From: http://sitestree.com/?p=5135
Categories:16
Tags:
Post Data:2007-01-01 17:15:46

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

PHP: How to Execute Remote Scripts/Services #16


$url is the URL to execute

$url = $_GET['url'];$file = fopen ($url, "r");if (!$file){echo "Error.n";}else{header('Content-Type: text/xml');while (!feof ($file)){$line = fgets ($file, 1024);echo $line;}}fclose($file);

How to pass information from JavaScript to PHP/JSP – mix of PHP and JavaScript

//we are passing some value say 15 from JavaScript to PHPlocation.href="?xyz=15";   

fsockopen

$fp = fsockopen("$urlToExecute");        if (!$fp) {         echo "$errstr ($errno)
n"; } else { $out = "GET / HTTP/1.1rn"; $out .= "Host: $urlToExecutern"; $out .= "Connection: Closernrn"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp); } fclose($fp); }

CURL: activate curl in php.ini



XML-RPCCreating and Consuming Web Services With PHP
check: http://webservices.xml.com/pub/a/ws/2004/03/24/phpws.html


http_get
$response = http_get($urlToExecute, array(“timeout”=>1), $info);


From: http://sitestree.com/?p=5133
Categories:16
Tags:
Post Data:2008-08-22 11:42:28

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Payment Processing Implementation: Concept and PHP Implementation #16

Payment Processing Implementation: Concept and PHP Implementation. The following is referring to a short-note in another part of our web-site.

From: http://sitestree.com/?p=5131
Categories:16
Tags:
Post Data:2007-09-09 05:04:56

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Emailing in PHP: use PHP Mailer Package #16

  • Download PHPMailer Package from: http://sourceforge.net/project/showfiles.php?group_id=26031
  • Unzip=install
  • In the class “class.smtp.php”, there is a send method that can be used to send emails
  • PHPMailer provides different ways of mailing: default php mail function [capabilities limited], Using a SMTP server [with or without authentication], using Sendmail software
  • PHP mailer can attach files, can send HTML emails
  • In the class “class.smtp.php”, you can write a function that can use send method to send emails. Your method can take parameters to set mailing parameters. Callers will supply the parameters.
  • A sample method can be as follows:
    public function prepareAndSendMail($fields){                date_default_timezone_set('America/Toronto');               $this->IsSMTP();     $this->IsHTML(true); // send as HTML     $this->SMTPAuth   = true;                  // enable SMTP authentication     $this->SMTPSecure = "ssl";                 // sets the prefix to the servier     $this->Host       = "SMTP server address"; // set SMTP server        $this->Port       = port usually 25 or 465;// set the SMTP port              $this->Username   = "user name for smtp server"; // smtp server username     $this->Password   = "user password"; // smtp server password             $this->AddReplyTo("reply to email address","");              $this->From       = "email address to send from";        $this->FromName   = "sender's name";             $this->Subject    = "subject of the email";              //$this->Body       = "Hi, This is the HTML BODY
"; $this->AltBody = $fields["altBody"]; //non-html body $this->WordWrap = 50; // set word wrap $this->MsgHTML($fields["body"]); $this->AddAddress($fields["to"]); $this->AddAttachment($fields["attachment"]); // attachment if(!$this->Send()) { echo "Mailer Error: " . $this->ErrorInfo; } else { echo "Message sent!"; } }

From: http://sitestree.com/?p=5128
Categories:16
Tags:
Post Data:2010-12-19 23:49:23

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>