<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The symphony of information technology</title>
	<atom:link href="http://www.mhf.ir/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mhf.ir</link>
	<description>Personal blog of Muhammad Hussein Fattahizadeh</description>
	<lastBuildDate>Thu, 02 Sep 2010 19:55:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get all objects that you need with Zend_Registry by simple method</title>
		<link>http://www.mhf.ir/web/get-all-objects-that-you-need-with-zend_registry-by-simple-method/</link>
		<comments>http://www.mhf.ir/web/get-all-objects-that-you-need-with-zend_registry-by-simple-method/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 14:13:59 +0000</pubDate>
		<dc:creator>Muhammad</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[getlist]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zend_registry]]></category>

		<guid isPermaLink="false">http://www.mhf.ir/?p=103</guid>
		<description><![CDATA[Frameworks always learn to developer to use the better and quickest way. The lovely class of Zend Framework is Zend_Registry, that you can set and get your object any scope of your application.
In most of PHP application you may have many of object that you must use is any part of your application.
Set the objects

	// [...]]]></description>
			<content:encoded><![CDATA[<p>Frameworks always learn to developer to use the better and quickest way. The lovely class of Zend Framework is Zend_Registry, that you can set and get your object any scope of your application.</p>
<p>In most of PHP application you may have many of object that you must use is any part of your application.</p>
<h3>Set the objects</h3>
<pre class="brush:php;">
	// set objects
	$myObject_1 = "I love Zend Framework.";
	Zend_Registry::set('myObject_1', $myObject_1);

	$myObject_2 = new My_Foo();
	Zend_Registry::set('myObject_2', $myObject_2);

	$myObject_3 = Zend_Db::factory($config);
	Zend_Registry::set('myObject_3', $myObject_3);
</pre>
<h3>Get the objects one by one</h3>
<pre class="brush:php;">
	// get objects
	$myObject_1 = Zend_Registry::get('myObject_1');
	$myObject_2 = Zend_Registry::get('myObject_2');
	$myObject_2 = Zend_Registry::get('myObject_2');
</pre>
<p>You can see you must call a get method of Zend_Registry for each object. But you can easily load every object that you need in your scope just with call a simple method and use <a href="http://php.net/manual/en/function.list.php">list</a>.</p>
<p><span id="more-103"></span></p>
<h3>Simple Zend_Registry method for load any objects that you need</h3>
<pre class="brush:php;">
class My_Registry extends Zend_Registry
{
	/**
	 * Get list of object that registered on Zend_Registry
	 * @return array
	 * @throws Zend_Exception if no entry is registered for $index.
	 */
	public static function getList()
	{
		// get indexes
		$indexArguments = func_get_args();

		// get the default registry instance.
		$instance = self::getInstance();

		// set the output objects
		$outputObjects = array();

		// check all arguments
		foreach($indexArguments as $index) {
			if ($instance->offsetExists($index)) {
				// set the object
				$outputObjects[] = $instance->offsetGet($index);
			} else throw new Zend_Exception("No entry is registered for key '$index'");
		}

		return $outputObjects;
	}
}
</pre>
<h3>Get the all objects</h3>
<p>On line require for get any objects that you need.</p>
<pre class="brush:php;">
	list($myObject_1, $myObject_2, $myObject_3) = My_Registry::getList('myObject_1', 'myObject_2', 'myObject_3');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mhf.ir/web/get-all-objects-that-you-need-with-zend_registry-by-simple-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Config tree solution</title>
		<link>http://www.mhf.ir/web/zend-config-tree-solution/</link>
		<comments>http://www.mhf.ir/web/zend-config-tree-solution/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 18:46:34 +0000</pubDate>
		<dc:creator>Muhammad</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[ini]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tree]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[zend config]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.mhf.ir/?p=65</guid>
		<description><![CDATA[The best part of my favorite PHP framework, Zend framework is Zend_Config. With Zend Config you can run you web application with more power full configuration that any one can change your application setting for use.
Read more information about Zend Config at Zend framework manual for Zend Config.
But in most web application you may have [...]]]></description>
			<content:encoded><![CDATA[<p>The best part of my favorite PHP framework, Zend framework is Zend_Config. With Zend Config you can run you web application with more power full configuration that any one can change your application setting for use.</p>
<p>Read more information about Zend Config at <a href="http://framework.zend.com/manual/en/zend.config.html">Zend framework manual for Zend Config</a>.</p>
<p>But in most web application you may have many configuration file with special format such as INI, XML or PHP. Also some of configuration is for one part of your application and may you put in special folders.</p>
<h4>My Zend framework folder structure</h4>
<p>So this is my default Zend framework folder structure that you have see more configuration file.<br />
<img src="http://www.mhf.ir/wp-content/uploads/2010/06/myzffs.gif" alt="My Zend framework folder structure" /></p>
<h5>Default solution</h5>
<p>In default solution you need to define a Zend Config object for each file to access file data.<br />
But with this solution you can globally access all files in any format in each folder.<br />
<span id="more-65"></span></p>
<h5>My_Config class for solve better this problem</h5>
<p>Look at my class</p>
<pre class="brush:php;">

	/**
	 * @copyright Copyright(c) Muhammad Hussein Fattahizadeh. All rights reserved.
	 * @author Muhammad Hussein Fattahizadeh
	 * @link &lt;http://mhf.ir/&gt;
	 */

	class My_Config
	{
		/**
		 * Base folder that contain config files
		 * @var string
		 */
		private $_baseFolder;

		/**
		 * Create config object
		 */
		public function __construct($baseFolder)
		{
			// check for valid folder
			if(is_dir($baseFolder)) $this-&gt;_baseFolder = $baseFolder;
			else throw new Zend_Exception(&quot;Invalid base folder for configurations.&quot;);
		}

		/**
		 * Set the config object is return the error.
		 * @param string $name
		 * @param object $value
		 */
		public function __set($name, $value)
		{
			throw new Zend_Exception(&quot;Configurations is readonly.&quot;);
		}

		/**
		 * Get the config data
		 * @param string $name
		 * @return object
		 */
		public function __get($name)
		{
			// set the configuration file path and format
			list($fileFormat, $configPath) = $this-&gt;_solvePath($name);

			// switch format for get configuration type
			switch ($fileFormat) {
				case 'ini':
					$value = new Zend_Config_Ini($configPath);
				break;
				case 'xml':
					$value = new Zend_Config_Xml($configPath);
				break;
				case 'php':
					$value = new Zend_Config(require $configPath);
				break;
			}
			return $value;
		}

		/**
		 * Path solver
		 * @param string $pathString
		 * @return array
		 */
		private function _solvePath($pathString)
		{
			// set file format
			$explodePath = explode('_', $pathString);
			$fileFormat = end($explodePath);
			if(!in_array(strtolower($fileFormat), array('ini', 'xml', 'php'))) throw new Zend_Exception(&quot;Invalid configuration file format.&quot;);

			// process path
			array_pop($explodePath);
			$configPath = implode(DIRECTORY_SEPARATOR, $explodePath);

			// return data
			return array(strtolower($fileFormat), $this->_baseFolder . DIRECTORY_SEPARATOR . $configPath . '.' . $fileFormat);
		}
	}
</pre>
<h5>Easy to use</h5>
<p>Here this is an example for using this method for the best way for my solution for tree and multi format configuration file.</p>
<pre class="brush:php;">
	$config = My_Config('/path/to/project/application/configs');

	// just dont forget last part of get method for config is file format look at the examples

	// load '/path/to/project/application/configs/database/mysql/news.xml' and get node adapter data
	echo $config-&gt;database_mysql_news_xml-&gt;adapter;

	// load '/path/to/project/application/configs/database/mysql/articles.ini' and get node 'params->username' data
	echo $config-&gt;database_postgresql_articles_ini-&gt;params-&gt;username;
</pre>
<h5>Waiting for your comments friends</h5>
<p>Be waiting for your comments for improve this solution. Maybe I add it into Zend framework as a new component. <img src='http://www.mhf.ir/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mhf.ir/web/zend-config-tree-solution/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Chart in web pages</title>
		<link>http://www.mhf.ir/web/chart-in-web-pages/</link>
		<comments>http://www.mhf.ir/web/chart-in-web-pages/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 09:17:12 +0000</pubDate>
		<dc:creator>Muhammad</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Chart]]></category>
		<category><![CDATA[Web 2]]></category>

		<guid isPermaLink="false">http://www.mhf.ir/?p=36</guid>
		<description><![CDATA[In many web application we need to show the users the result of processed data in graphical charts. It will be help you to have a good application that can serve data to user, friendly.




Solve the problem
For this problem we have two ways in web application.

Process the chart with data in server and send the [...]]]></description>
			<content:encoded><![CDATA[<p>In many web application we need to show the users the result of processed data in graphical charts. It will be help you to have a good application that can serve data to user, friendly.</p>
<div style="text-align: center;">
<img src="http://www.mhf.ir/wp-content/uploads/2008/12/webcharts.jpg" alt="Web based charts" title="Web based charts" />
</div>
<p><span id="more-36"></span></p>
<h5>Solve the problem</h5>
<p>For this problem we have two ways in web application.</p>
<ol>
<li>Process the chart with data in server and send the image of that process to the client.</li>
<li>Send the unprocessed data into the client and the client tool process the chart. It was the recommended web 2 application pattern for solving the chart processes.</li>
</ol>
<p>In method one we have to sure the image will be shown in the client side but when we use this method for live data the server must process many data in same time for any users and the server will be crashed.</p>
<p>But in method two we reduce much processes in server side and send the unprocessed data into the client that the client scripting tools process the data in SVG, VML, Canvas, Silverlight, and Flash modes. With this method we must have to sure the client browser support that (SVG, VML, Canvas, Silverlight or Flash). When you use this method with AJAX technique you have increase of your performance in you application.</p>
<p>Also with this method if you use the live chart data just the unprocessed data will be update and the chart engine is cached by network and your server is more rest than any.</p>
<h5>Available classes and tools</h5>
<h6>Server process</h6>
<ul>
<li><a href="http://jcharts.sourceforge.net/">jChart</a><br />Java based chart.</li>
<li><a href="http://pchart.sourceforge.net/">pChart</a><br />PHP based chart with full OOP features for creating most of graphical charting that I like it.</li>
<li><a href="http://teethgrinder.co.uk/open-flash-chart-2/">Open Flash Chart</a><br />Flash based chart system with server process.</li>
<li><a href="http://sourceforge.net/projects/phplot/">PHPLOT</a></li>
<li><a href="http://pear.php.net/package/Image_Graph">PEAR::Image_Graph</a></li>
<li><a href="http://ezcomponents.org/docs/api/latest/introduction_Graph.html">eZ Components Graph</a></li>
<li><a href="http://www.fusioncharts.com/free">FusionCharts</a></li>
<li><a href="http://www.aditus.nu/jpgraph/">JpGraph</a></li>
<li>I hope to complete the <a href="http://framework.zend.com/wiki/pages/viewpage.action?pageId=42524">Zend_Chart</a>. It will be a great tool in Zend Framework for draw the charts.</li>
</ul>
<h6>Client process</h6>
<ul>
<li><a href="http://www.dojotoolkit.org/">Dojo Chart</a><br />Dojo charting feature with SVG, VML, Canvas, Silverlight, and Flash support.<br />See <a href="http://www.sitepen.com/blog/2008/06/06/a-beginners-guide-to-dojo-charting-part-1-of-2/">sitepen tutorial</a>.</li>
<li><a href="http://www.reach1to1.com/sandbox/jquery/jqchart/">jQuery Chart</a></li>
</ul>
<p>Thank to <a href="http://dylanschiemann.com/">Dylan Schiemann</a> and <strong>Ravi</strong> for helping me to complete this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mhf.ir/web/chart-in-web-pages/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Payam Nour University SVG Logo</title>
		<link>http://www.mhf.ir/graphic/payam-nour-university-svg-logo/</link>
		<comments>http://www.mhf.ir/graphic/payam-nour-university-svg-logo/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 20:34:42 +0000</pubDate>
		<dc:creator>Muhammad</dc:creator>
				<category><![CDATA[Graphic]]></category>
		<category><![CDATA[Scalable Vector Graphics (SVG)]]></category>
		<category><![CDATA[Inkscape]]></category>
		<category><![CDATA[Logo]]></category>
		<category><![CDATA[Payam Nour University]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://www.mhf.ir/?p=26</guid>
		<description><![CDATA[I have to design and program my university web site and need a logo of centeral of Payam Nour logo.
I use Inkscape for desing it. Inkscape is a Vector Graphics Editor, similar to Adobe Illustrator, that strives to be SVG Compliant, open source, responsive and extensible. I recommend to you for designing any vector graphic [...]]]></description>
			<content:encoded><![CDATA[<p>I have to design and program my university web site and need a logo of centeral of Payam Nour logo.</p>
<p>I use Inkscape for desing it. Inkscape is a Vector Graphics Editor, similar to Adobe Illustrator, that strives to be SVG Compliant, open source, responsive and extensible. I recommend to you for designing any vector graphic logo and pictures.</p>
<div style="text-align: center;">
<img src="http://www.mhf.ir/wp-content/uploads/2008/12/pnu-logo.jpg" alt="Payam Nour University Logo" title="Payam Nour University Logo" />
</div>
<p><a href="http://www.mhf.ir/wp-content/uploads/2008/12/pnu.svg">Download Payam Nour University SVG Logo</a></p>
<p>Also see more about <a href="http://www.w3.org/Graphics/SVG/">Scalable Vector Graphics (SVG)</a></p>
<p><a href="http://www.inkscape.org/">Inkscape</a>. Use it. It&#8217;s a great tool for SVG.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mhf.ir/graphic/payam-nour-university-svg-logo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Security tip in network listening hack technique</title>
		<link>http://www.mhf.ir/web/security-tip-in-network-listening-hack-technique/</link>
		<comments>http://www.mhf.ir/web/security-tip-in-network-listening-hack-technique/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 21:43:21 +0000</pubDate>
		<dc:creator>Muhammad</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[crc32]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[network listening]]></category>
		<category><![CDATA[sha1]]></category>
		<category><![CDATA[web security]]></category>

		<guid isPermaLink="false">http://www.mhf.ir/?p=3</guid>
		<description><![CDATA[Did you ever thing the password that you submit into a page without SSL can be read from network listening hack technique?



It is a simple way to prevent this security issue.

In most of Content Management System, the user&#8217;s password store in database with hash algorithm. Such as the MD5 or SHA1 or etc&#8230;. Just your [...]]]></description>
			<content:encoded><![CDATA[<p>Did you ever thing the password that you submit into a page without SSL can be read from network listening hack technique?</p>
<div style="text-align: center;">
<img src="http://www.mhf.ir/wp-content/uploads/2008/12/network-listening.jpg" alt="Network listening hack technique" title="Network listening hack technique" />
</div>
<p>It is a simple way to prevent this security issue.</p>
<p><span id="more-13"></span></p>
<p>In most of Content Management System, the user&#8217;s password store in database with hash algorithm. Such as the MD5 or SHA1 or etc&#8230;. Just your server reduce one operate in Hashing algorithm if you have more than one.</p>
<p>You must do a function with JavaScript and hash the input element with type of password. The value of this element before sending must be hashed with JavaScript.</p>
<p>See the header of normal login :</p>
<pre class="brush:plain;">
Content-Type: application/x-www-form-urlencoded
Content-Length: 54
username=user&amp;password=MyPASS&amp;normallogin=Normal+Login
</pre>
<p>The hacker can read your data from header of your request.</p>
<p><strong style="color: red;">password=MyPASS</strong></p>
<h6>More security with JavaScript</h6>
<p>With this method you can create the secure form for login.</p>
<pre class="brush:plain;">
Content-Type: application/x-www-form-urlencoded
Content-Length: 80
username=user&#038;password=f4c0724be9899724b6d7549a71144441&#038;securelogin=Secure+Login
</pre>
<p><strong style="color: green;">password=f4c0724be9899724b6d7549a71144441</strong></p>
<h6>Use this method</h6>
<p>In my idea when you hashed the password before the submit that the user privacy have been increased.</p>
<p><a href="http://demo.mhf.ir/secure-login-with-hash/">See online demo</a></p>
<p>First we need a hash algorith that use in your password in server. For example we use MD5 in this example. Your password store in server with SHA1 hash.</p>
<p>In normal mode you use this method for checking sum for inputting password.</p>
<pre class="brush:php;">
	$password = sha1('myprivatevalue' . md5($_POST["password"]));
</pre>
<p>But when do hash in password value in client side reduce one operating:</p>
<pre class="brush:php;">
	// we do not use md5 for this because this method applied in client side with JavaScript
	$password = sha1('myprivatevalue' . $_POST["password"]);
</pre>
<p>It&#8217;s a simple way to protect real string password but hacker can still hack your login form with inject the request (Thank to <strong>Ben hockey</strong> to remember this issue.).</p>
<p>You must use some way to prevent the hackers to inject request to your server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mhf.ir/web/security-tip-in-network-listening-hack-technique/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>
