<?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>Monie Studios &#187; Tutorials</title>
	<atom:link href="http://www.moniestudios.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.moniestudios.com</link>
	<description>So much to learn, so little time!</description>
	<lastBuildDate>Sat, 21 Aug 2010 04:59:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Create Simple Animation with Illustrator</title>
		<link>http://www.moniestudios.com/tutorials/create-simple-animation-with-illustrator/</link>
		<comments>http://www.moniestudios.com/tutorials/create-simple-animation-with-illustrator/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 07:00:12 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[illustrator]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=1297</guid>
		<description><![CDATA[<a href="http://www.thewebsqueeze.com/web-design-articles/create-simple-animation-with-illustrator.html" target="_blank">Thewebsqueeze blog post</a>: Adobe Flash isn't the only way to create an animated banner!  Learn how to create one using Adobe Illustrator.  ]]></description>
			<content:encoded><![CDATA[<p>At some point in time in every designer’s life there comes a time where you need to make an animated web banner.</p>
<p>Illustrator itself has always been a print based application and one thing it just doesn&#8217;t do is animation.</p>
<p>There is an application called Adobe Flash. Flash does have the ability to create animation. It&#8217;s also one of the most popular applications being used to create animation. Flash uses the concept of framed based animation whereas in Illustrator, there is no frame. However, there are layers inside Illustrator and the beauty of Illustrator is that it can turn layers into frames for you.</p>
<p>Let&#8217;s see how we can do that.</p>
<h2>Creating Layers</h2>
<p><img class="alignnone size-full wp-image-5716" title="Illustrator1" src="/wp-content/uploads/image-1.jpg" alt="" width="549" height="77" /></p>
<p>Opening my layers panel will show you that my banner is made up of 5 different layers. If you are familiar with the Flash application, you&#8217;ll know how easy it is to create an image like that. Now, just think of a layer as a frame and you&#8217;ll see how easy this will be.</p>
<p><img class="alignnone size-full wp-image-5717" title="illustrator2" src="/wp-content/uploads/image-2.jpg" alt="" width="550" height="220" /></p>
<p>What I have done here is basically to put every frame of my animation onto a separate layer. Right now I have five different layers and when combined, it will produce the full image like the example above.</p>
<p>Once you have completed setting up your layers, let’s create our animation.</p>
<h2>Saving Your Animation</h2>
<p><img class="alignnone size-full wp-image-5718" title="illustrator3" src="/wp-content/uploads/image-3.jpg" alt="" width="550" height="220" /></p>
<p>Things to consider when setting up the Save for Web &#038; Devices command:</p>
<ul>
<li>Optimized file format: SWF</li>
<li><strong>Flash Player version:</strong> Flash Player 9 (the latest version on your machine)</li>
<li><strong>Type of export:</strong> Layers to SWF Frames (this is the most important setting)</li>
<li><strong>Curve Quality:</strong> 7</li>
<li><strong>Frame Rate:</strong> 1 second</li>
<li><strong>Loop:</strong> Play animation repeatedly (tick this checkbox)</li>
</ul>
<p><strong>Saving the file to SWF</strong>, a Flash format, Illustrator will ask you which flash player you want to optimize. <strong>Select Flash Player 9</strong> which is the latest version at the time of writing this tutorial.</p>
<p><strong>Type of export</strong>, this is the most important setting that you need to set. You can tell Illustrator to save your file into a big flash file by selecting the AI File to SWF File. You can also turn all your Illustrator layers into frames by selecting the second option which is Layers to SWF Frames and that&#8217;s going to create an animation.</p>
<p>Next, if you want to play the animation over and over again, put a tick in the Loop check box. Setting the frame rate to one frame per second means that every one second it&#8217;s going to switch within the layer.</p>
<p>Let&#8217;s go ahead and save the animation and select HTML and Images (*.html) in the Save as type. This will then automatically export an html demo file with the table already in it, so on and so forth.</p>
<p>This is how your html will look like, automatically generated for you by Illustrator.</p>
<pre class="brush: xml;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Simple-Animation-In-Illustrator-2&lt;/title&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt;&lt;script src=&quot;images/Simple-Animation-with-Illustrator.js&quot; type=&quot;text/javascript&quot; &gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#FFFFFF&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot;&gt;&lt;noscript&gt;
&lt;!-- ImageReady Slices (Simple-Animation-with-Illustrator.ai) --&gt;
&lt;embed src=&quot;images/Simple-Animation-with-Illustrator.swf&quot; width=&quot;569&quot; height=&quot;80&quot; alt=&quot;&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/shockwave/download/&quot;&gt;
&lt;!-- End ImageReady Slices --&gt;&lt;/noscript&gt;&lt;script type=&quot;text/javascript&quot;&gt;fn00000()&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h2>DEMO</h2>
<p><a href="http://www.moniestudios.com/wp-content/uploads/Simple-Animation-with-Illustrator1.swf">Click here to view demo!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/create-simple-animation-with-illustrator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Change Remote Desktop Default Port Number</title>
		<link>http://www.moniestudios.com/tutorials/how-to-change-remote-desktop-default-port-number/</link>
		<comments>http://www.moniestudios.com/tutorials/how-to-change-remote-desktop-default-port-number/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 00:16:33 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cache control]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=1190</guid>
		<description><![CDATA[Ever wonder how to remote access your computer from miles away, across country and sea using the  built in windows RDP connection? Here is the tips.]]></description>
			<content:encoded><![CDATA[<p>This article applies to you if you have total control over your firewall devices, administration privileges to your computer and of course, some background in computer networking.</p>
<p><strong>Note</strong> The default Remote Desktop Connection Client for Windows XP Professional is 3389. </p>
<p>You can use the Remote Desktop feature in Microsoft Windows XP Professional to connect to your computer from another remote computer. To change the port that Remote Desktop listens on, follow these simple steps.</p>
<h2>Changing The Default Windows XP Pro RDP Port Number</h2>
<blockquote><p><strong>Important</strong> This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs.</p></blockquote>
<ol>
<li>Start Registry Editor. (regedit)</li>
<li>Locate and then click the following registry subkey:<br />
<strong>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control \TerminalServer\WinStations\RDP-Tcp\PortNumber</strong></li>
<li>On the <strong>Edit</strong> menu, click <strong>Modify</strong>, and then click <strong>Decimal</strong>.</li>
<li>Type the new port number, and then click <strong>OK</strong>.</li>
<li>Quit Registry Editor.</li>
</ol>
<p>You have successfully changed your default RDP port number at this point.</p>
<p><strong>Note</strong> When you try to connect to this computer by using the Remote Desktop connection, you must type the new port.<br />
<a href="http://www.moniestudios.com/wp-content/uploads/rdp-connection.jpg"><img src="http://www.moniestudios.com/wp-content/uploads/rdp-connection.jpg" alt="" title="rdp-connection" width="600" height="288" class="alignnone size-full wp-image-1193" /></a></p>
<h2>Port Forwarding Your Firewall To RDP To Your Computer</h2>
<p>Once you have successfully changed your Windows XP default port number, it is time to do another trick (configuration in your firewall) to port forward your newly created RDP port number to point to your computer. Here is the setting and it may vary from different types/model of firewall.<br />
<a href="http://www.moniestudios.com/wp-content/uploads/rdp-firewall.jpg"><img src="http://www.moniestudios.com/wp-content/uploads/rdp-firewall.jpg" alt="" title="rdp-firewall" width="600" height="196" class="alignnone size-full wp-image-1204" /></a></p>
<h2>Alternative To Windows RDP</h2>
<p>You can use some third party application to access into your computer in a similar way by using any of this following application:</p>
<ul>
<li><a href="http://www.realvnc.com/" target="_blank">Real VNC</a></li>
<li><a href="http://www.teamviewer.com/index.aspx" target="_blank">TeamViewer</a></li>
<li><a href="http://www.uvnc.com/" target="_blank">Ultra VNC</a></li>
<li><a href="https://secure.logmein.com/" target="_blank">LogMeIn</a></li>
</ul>
<p>Hope this helps you with your RDP activity.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/how-to-change-remote-desktop-default-port-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tips: Connecting Multiple MySQL Databases On A Single Page</title>
		<link>http://www.moniestudios.com/tutorials/connecting-multiple-mysql-databases-on-a-single-page/</link>
		<comments>http://www.moniestudios.com/tutorials/connecting-multiple-mysql-databases-on-a-single-page/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 02:00:05 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=1160</guid>
		<description><![CDATA[Learn how to connect multiple MySQL database on a single page.]]></description>
			<content:encoded><![CDATA[<h2>The Scenario</h2>
<blockquote><p>I have information spread out across a few databases and want to put all the information onto one webpage using PHP. I was wondering how I can connect to multiple databases on a single PHP webpage.</p></blockquote>
<h2>The Solution</h2>
<p>You can make multiple calls to mysql_connect(), but if the parameters are the same you need to pass the value &#8220;true&#8221; as the forth parameter, otherwise the same connection is reused. Here is a demonstration on connecting multiple MySQL databases on a single Page.</p>
<h3>Database One</h3>
<pre class="brush: php;">
    // Database ONE Connection

    // Constant variable declaration
    $host = 'localhost';
    $user = 'database_user';
    $pass = 'password';
    $name = 'database_name';

    // 1. Create database connection
    $db1_connection = mysql_connect($host, $user, $pass) or die(mysql_error());

    // 2. Select database to use
    $db1 = mysql_select_db($qn_name, $db1_connection) or die(mysql_error());
</pre>
<h3>Database Two</h3>
<pre class="brush: php;">
    // Database TWO Connection

    // 1. Create the second database connection
    // Passing the &quot;true&quot; value in the forth parameter here
    $db2_connection = mysql_connect($host, $user, $pass, true) or die(mysql_error());

    // 2. Select database to use
    $db2 = mysql_select_db($name, $db2_connection) or die(mysql_error());
</pre>
<p>Problem solved! Happy coding&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/connecting-multiple-mysql-databases-on-a-single-page/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create Short URLs Using PHP Functions</title>
		<link>http://www.moniestudios.com/tutorials/create-short-urls-using-php-functions/</link>
		<comments>http://www.moniestudios.com/tutorials/create-short-urls-using-php-functions/#comments</comments>
		<pubDate>Wed, 12 May 2010 02:12:17 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=1136</guid>
		<description><![CDATA[Learn how to turn ridicules long links into super short links with Bit.ly with the help of PHP function.]]></description>
			<content:encoded><![CDATA[<p>You might have notice that whenever you retweet some post to your twitter account, or whenever you share some link to your twitter account, you will see that your link become something that you don’t quite understand, weird and definitely a lot shorter than it used to be. So, what is that all about?</p>
<pre class="brush: xml;">
&lt;a href=&quot;http://bit.ly/asSkuN&quot;&gt;MonieStudios.com&lt;/a&gt;
</pre>
<h2>Introduction To URL Shortening Services</h2>
<p>One of the most popular URL shortening services is <a href="http://bit.ly/">Bit.ly</a>, which you see a lot in your twitter post link sharing. <a href="http://bit.ly/">Bit.ly</a> requires you to sign up for an account and once you have an account, you may attain your login detail, your appkey (you can find your appkey by clicking your username link) and your URL information. That is where you will be doing your URL shortening activity manually.</p>
<p><img src="http://www.moniestudios.com/wp-content/uploads/api-key.png" alt="" title="api-key" width="580" height="170" class="alignnone size-full wp-image-1148" /></p>
<p>Most CMS like WordPress have a plugins of built in support for this service where you don’t have to be logged in to <a href="http://bit.ly/">Bit.ly</a> in order for you to shorten your link. It will be done right at your page just before it passed on to your twitter account.</p>
<p>What if you want to do the same thing with your custom made website. After all, custom made website doesn’t have shortening URL plugins like WordPress do!</p>
<p>I’ll show you how to create Bit.ly URLs remotely with PHP function.</p>
<h2>The Functions</h2>
<pre class="brush: php;">
/* make a URL small with bit.ly */
function make_bitly_url($url,$login,$appkey,$format = 'xml',$version = '2.0.1') {

    //create the URL
    $bitly = 'http://api.bit.ly/shorten?version='.$version.'&amp;longUrl='.urlencode($url).'&amp;login='.$login.'&amp;apiKey='.$appkey.'&amp;format='.$format;

    //get the url, could also use cURL here
    $response = file_get_contents($bitly);

    //parse depending on desired format
    if(strtolower($format) == 'json') {
        $json = @json_decode($response,true);
        return $json['results'][$url]['shortUrl'];
    }
     //xml
    else {
        $xml = simplexml_load_string($response);
        return 'http://bit.ly/'.$xml-&gt;results-&gt;nodeKeyVal-&gt;hash;
    }
}
</pre>
<h2>The Usage</h2>
<p>Just put this code where you want to share the page to your social boorkmark (facebook, twitter, etc..). Your new URL that has been shorten can be access with the variable: $short</p>
<p>Example of usage would be something like this:</p>
<pre class="brush: php;">
    // Get the full address of your website page
    $url = &quot;http://&quot;.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

    // Authentication details
    $login = &quot;your.email.id@gmail.com&quot;;
    $appkey = &quot;R_22c9bc44570b459ab9d095d7ef5e78fe&quot;;

    /* Calling up the function */
    $short = make_bitly_url($url,$login,$appkey,'json');

    /* Share on Twitter link */
    &lt;a class=&quot;twitter&quot; href=&quot;http://twitter.com/home?status=Your Website Title - &lt;?php echo $short; ?&gt;&quot;&gt;Twitter&lt;/a&gt;
</pre>
<p>Happy shortening!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/create-short-urls-using-php-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding Multiple Widgets In Your WordPress Theme</title>
		<link>http://www.moniestudios.com/tutorials/adding-multiple-widgets-in-your-wordpress-theme/</link>
		<comments>http://www.moniestudios.com/tutorials/adding-multiple-widgets-in-your-wordpress-theme/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 07:45:13 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=1078</guid>
		<description><![CDATA[<a href="http://www.thewebsqueeze.com/web-design-tutorials/adding-multiple-widgets-in-your-wordpress-theme.html">Thewebsqueeze blog post</a>:  This quick tip will show you how you can add extra widgets inside your current Wordpress theme.]]></description>
			<content:encoded><![CDATA[<p>I was playing around with my WordPress theme. At the moment, I have three portions in my main page, which have the same div class;  i.e div class = &#8220;box&#8221;. All of them are referring to <em>About Me</em>, <em>My Service</em> and <em>Blog Updates</em>. Suddenly I realize that I wanted to have something more dynamic! A theme with  maximum flexibility to be exact! Then I was thinking, I should have a sidebar widget instead of a raw html hardcoded footer. Let’s see how a widget can help to solve the problem.</p>
<p>The WordPress theme that I have right now supports only one sidebar widget. Let me show you how you can add in more sidebar widgets into your current theme.</p>
<pre class="brush: php;">
&lt;div id=&quot;sidebar_widget&quot;&gt;
    &lt;div class=&quot;box&quot;&gt;
          &lt;h2&gt;About Me&lt;/h2&gt;
          &lt;p&gt;About me description here...&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;box&quot;&gt;
        &lt;h2&gt;My Services&lt;/h2&gt;
        &lt;ul&gt;
            &lt;li&gt;Custom Web Design&lt;/li&gt;
            &lt;li&gt;WordPress Theme&lt;/li&gt;
            &lt;li&gt;Technical Support&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
    &lt;div class=&quot;box&quot;&gt;
        &lt;h2&gt;Blog Updates&lt;/h2&gt;
        &lt;ul&gt;
            &lt;li&gt;Writing Functions In PHP - Return Values&lt;/li&gt;
            &lt;li&gt;Writing Functions In PHP - Flexibility&lt;/li&gt;
            &lt;li&gt;Writing Functions In PHP - Introduction&lt;/li&gt;
            &lt;li&gt;Install WordPress In Windows&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre>
<h2>Registering The Sidebars</h2>
<p>I am assuming that you are familiar with the WordPress platform; otherwise you won’t end up reading this tutorial.</p>
<p>To begin this tutorial, firstly you need to tell WordPress how many widget(s) that you need. Navigate to your functions.php page, the one that is in your theme folder. Without much difficulty, you will see these few lines of code.  If it’s difficult to find, search for the string called <em>register_sidebars</em>.</p>
<pre class="brush: php;">
&lt;?php
    if ( function_exists('register_sidebars') )
    register_sidebars(2);
?&gt;
</pre>
<p>Once you have found them, all you need to do is change the number according to your requirement and then save the file. You can increase this number if you want to have more sidebars as long as your theme layout can accommodate it.</p>
<p>Now, go to your WordPress <strong>Admin</strong> section and browse to the widgets under the menu item called <strong>Appearance</strong>. You can see there are three sidebars listed there. You can drag your widget items into any of the sidebars to start using it.</p>
<p><img class="size-full wp-image-1081 alignnone" title="sidebar" src="http://www.moniestudios.com/wp-content/uploads/sidebar.png" alt="" width="570" height="170" /></p>
<h2>Building The Sidebars</h2>
<p>Here comes the part where we actually build the sidebars. If your theme has only one sidebar, locate the file called <em>sidebar.php</em> in your theme folder. If for some reason your theme has two sidebars, you should have the files called <em>sidebar.php</em>, <em>sidebar1.php</em> and <em>sidebar2.php</em>. So if you want to add another sidebar widget into your theme, you should duplicate either <em>sidebar1.php</em> or <em>sidebar2.php</em> and rename it as <em>sidebar3.php</em>.</p>
<p>In this tutorial, we will modify the theme by adding two more sidebars and let’s rename <em>sidebar.php</em> to <em>sidebar1.php</em> and duplicate this file and rename it as <em>sidebar2.php</em>. Add the code below into the widget template, <em>sidebar2.php</em> and save the file:</p>
<pre class="brush: php;">
&lt;div class=&quot;box&quot;&gt;
&lt;ul&gt;
&lt;?php if ( function_exists('dynamic_sidebar') &amp;&amp; dynamic_sidebar(2) ) : else : ?&gt;
&lt;?php endif; ?&gt;
&lt;/ul&gt;
&lt;/div&gt;
</pre>
<p>Remember that this code, <em>dynamic_sidebar(2)</em> is referring to your widget template which is sidebar2.php. So for your <em>sidebar1.php</em>, you would call this as <em>dynamic_sidebar(1)</em> instead.</p>
<p>Just to add more flexibility to your theme, the page won’t display an empty sidebar widget if you didn’t add any widgets into your theme. Add in this default value for your widget, replacing the code above.</p>
<pre class="brush: php;">
&lt;div class=&quot;box&quot;&gt;
&lt;ul&gt;
&lt;?php if ( function_exists('dynamic_sidebar') &amp;&amp; dynamic_sidebar(2) ) : else : ?&gt;
&lt;h2&gt;Sidebar 2&lt;/h2&gt;
&lt;p&gt;This is your sidebar 2. You can drag your widget here from your WordPress admin section and browse to the widgets under the menu item called Appearance.&lt;/p&gt;
&lt;?php endif; ?&gt;
&lt;/ul&gt;
&lt;/div&gt;
</pre>
<h2>Calling The Sidebar</h2>
<p>Now, we have the two sidebars ready but how do we call it? How do we place them in the area that we want in our page? You can call them from anywhere in your theme with this line of code;</p>
<pre class="brush: php;">&lt;?php include  (TEMPLATEPATH . '/sidebar1.php'); ?&gt;</pre>
<p>or for the second sidebar,</p>
<pre class="brush: php;">&lt;?php include  (TEMPLATEPATH . '/sidebar2.php'); ?&gt;</pre>
<p>Let’s go back to our <em>index.php</em> page with the current sidebar being hardcoded. Let’s update them and call this widget.</p>
<pre class="brush: php;">
&lt;div id=&quot;sidebar_widget&quot;&gt;
&lt;?php include (TEMPLATEPATH . '/sidebar1.php'); ?&gt;
&lt;?php include (TEMPLATEPATH . '/sidebar2.php'); ?&gt;
&lt;?php include (TEMPLATEPATH . '/sidebar3.php'); ?&gt;
&lt;/div&gt;
</pre>
<p>Preview your theme. You will see your new widgets appearing on your website just the way you want it. There may be some minor issues on the div alignment and positioning. I’m sure you can easily fix that with your CSS. If you have not placed any widgets yet, you will still see the default value that we’ve created earlier. You can add more sidebars in a similar way to your WordPress theme.</p>
<p><img class="size-full wp-image-1082 alignnone" title="widget" src="http://www.moniestudios.com/wp-content/uploads/widget.png" alt="" width="570" height="216" /><br />
I hope this tutorial is helpful and enjoy blogging.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/adding-multiple-widgets-in-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade Windows XP Home To Professional Without Reinstallation</title>
		<link>http://www.moniestudios.com/tutorials/upgrade-windows-xp/</link>
		<comments>http://www.moniestudios.com/tutorials/upgrade-windows-xp/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 01:33:21 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cache control]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=914</guid>
		<description><![CDATA[This quick tips will show you how you can convert or upgrade your Windows XP Home edition into Windows XP Professional without re-installation.]]></description>
			<content:encoded><![CDATA[<p class="italic">This quick tips will show you how you can convert or upgrade your Windows XP Home edition into Windows XP Professional without re-installation.</p>
<p><span id="more-914"></span><br />
<h2></h2>
<p>Back in a few years ago, my boss gave me one simple assignment. He says:</p>
<blockquote><p>I want you to join all this PC’s to this server and create an active directory account for each of the user.  And don’t forget to set the wallpaper as well!</p></blockquote>
<p>At first, I am thinking that this person is out of his mind! So I went to seek some advice with the old fashion way and there I am spending a few hours in front of my computer asking for some miracle answers. After a few click and scroll, this angel comes to my rescue.</p>
<h2>Legal vs Illegal Action</h2>
<p>After installing Windows XP Home Edition or Windows XP Professional Edition onto a computer, officially it’s impossible for user to convert, or upgrade from Windows XP Home to Pro edition, or downgrade from Windows XP Professional to Home edition without reformatting and reinstalling the operating system from clean and fresh state.</p>
<p>A lot of people always associate conversion of Windows XP edition to illegitimate or privacy reason, but sometimes, there may be legitimate and genuine reason for change, such as customer, who all the while using Windows XP Home Edition finally buy a genuine license product key for Professional edition to replace the illegal pirated version installed, or user receives additional license as gift, but don’t want to go through clean install Windows XP again, or want to keep using the computer with all data intact without interruption. </p>
<p>Here’s a trick to convert and turn Windows XP Home Edition to Windows XP Pro Edition, from within the operating system without going through installation again. Ok, let’s be frank. The hack doesn’t actually install and add in all the features from Windows XP Professional that Windows XP Home lacks of, such as Remote Desktop Server and Group Policy Editor utility tools, which has been removed on Windows XP Home edition.</p>
<p>Basically, the trick only work to let Windows XP recognizes itself as Professional edition.</p>
<h2>The Procedure</h2>
<ul>
<li>Open Registry Editor (regedit).
<li>Navigate to <strong>HKEY_LOCAL_MACHINE/SYSTEM/ControlSet00X/Control/ProductOptions</strong>, where <strong>ControlSet00X</strong> is the one with the highest number.
<li>Delete the <strong>ProductSuite</strong> registry key.
<li>Then, create a new <strong>DWORD</strong> value and named it as <strong>Brand</strong>.
<li>Set the <strong>Brand</strong> value data as 0.
<li><strong>Reboot</strong> the system.
<li>On boot up after the BIOS screen, press <strong>F8</strong> to display Windows XP Startup Menu.
<li>Choose <strong>Last Known Good Configuration (LNG)</strong> and hit Enter.
</ul>
<p><a href="http://www.moniestudios.com/wp-content/uploads/system_properties.png"><img src="http://www.moniestudios.com/wp-content/uploads/system_properties.png" alt="" title="system_properties" width="419" height="486" class="alignnone size-full wp-image-916" /></a><br />
Windows XP will start up as usual. After logging into the desktop, check the system properties to verify that it’s now Windows XP Professional.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/upgrade-windows-xp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing Functions In PHP – Default Values</title>
		<link>http://www.moniestudios.com/tutorials/writing-functions-in-php-default-values/</link>
		<comments>http://www.moniestudios.com/tutorials/writing-functions-in-php-default-values/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 06:30:21 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=862</guid>
		<description><![CDATA[<a href="http://www.thewebsqueeze.com/web-design-tutorials/writing-functions-in-php-default-values.html">Thewebsqueeze blog post</a>: This final tutorial in the series called “Writing Functions In PHP” explains what a default value is and what it can do. We encourage you to read the prior tutorials in this series by clicking the links in the "Related Post" section below.]]></description>
			<content:encoded><![CDATA[<p>We saw earlier how the numbers of arguments that were passed into a function needed to match the number of arguments that the function was defined with. But with default arguments, that’s not entirely true because we can set some defaults so that if it doesn’t get a value, it has something that it can assume, and this not only will make our functions more flexible but also error resistant. Let’s go ahead and try one now…</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Default Values&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;?php

        function paint($color) {
            echo &quot;The color of the room is {$color}.&quot;;
        }

        paint(&quot;blue&quot;);

    ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Output: the color of the room is blue.</strong></p>
<p>That is a simple straight forward example. What if we didn’t pass a value into the function?</p>
<pre class="brush: php;">
&lt;?php

    function paint($color) {
        echo &quot;The color of the room is {$color}.&quot;;
    }

    paint();

?&gt;
</pre>
<p>Sure we will get an error message.</p>
<p><strong>Output:<br />
Warning: Missing argument 1 for paint()…<br />
Notice: Undefined variable…<br />
The color of the room is .</strong></p>
<h2>Functions With Default Values</h2>
<p>In the example above, we can set a default value for $color, so that if it doesn’t get a $color, we have something to fall back on. We do that by simply putting in a normal equal assignment in the function right after the arguments.</p>
<pre class="brush: php;">
&lt;?php

    function paint($color=&quot;red&quot;) {
        echo &quot;The color of the room is {$color}.&quot;;
    }

    paint();

?&gt;
</pre>
<p>So now, “red” will be our default value if we haven’t passed any value to the function. In other words, if no value were passed into the function, use “red”! The default value is overwritten when you specify a value, otherwise the value will stay the same. Even though we didn’t ask for another argument, it went ahead and assume “red”. If instead we tell it “blue”, it goes ahead and uses “blue”.</p>
<p>So you can see how this is going to make our function a little more error resistant because it will not give us that big nasty error if we didn’t pass something in.</p>
<h2>Flexible Functions With Default Values</h2>
<p>Let’s go ahead and make this function even more flexible. Lets say we just are not going to paint the “room”, but instead we are going to paint the $room as a variable.</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Default Values&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;?php

        function paint($room=&quot;office&quot;,$color=&quot;red&quot;) {
            echo &quot;The color of the {$room} is {$color}.&quot;;
        }

        paint(&quot;bedroom&quot;,&quot;blue&quot;);

    ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Output: The color of the bedroom is blue.</strong></p>
<p>So, this function takes two arguments into it and we must pass two values into it as well. Even though we didn’t pass anything into the function, it went ahead and made the assumption with the default value that we have declared earlier. All of this will work:</p>
<pre class="brush: php;">&lt;?php paint(); ?&gt;</pre>
<p><strong>Output: The color of the office is red.</strong></p>
<pre class="brush: php;">&lt;?php paint(&quot;bedroom&quot;); ?&gt;</pre>
<p><strong>Output: The color of the bedroom is red.</strong></p>
<p>What if we say “blue” and leave out the other one which is the $room?</p>
<pre class="brush: php;">&lt;?php paint(&quot;blue&quot;); ?&gt;</pre>
<p><strong>Output: The color of the blue is red.</strong></p>
<p>It went ahead and says “The color of the blue is red.”, and why is that? This is because it’s going to still assume that the arguments are coming in the correct order. So we have to make sure that we always pass something in the right order.</p>
<h2>Required Value vs Not Required value</h2>
<p>Consider this example:</p>
<pre class="brush: php;">
&lt;?php

    function paint($room,$color=&quot;red&quot;) {
        echo &quot;The color of the {$room} is {$color}.&quot;;
    }

    paint(&quot;bedroom&quot;,&quot;blue&quot;);

?&gt;
</pre>
<p><strong>Output: The color of the bedroom is blue.</strong></p>
<p>We know this will work. $room is a required value and $color is not a required value, in this function. This means, a required value is a value that is having the highest priority for us, we want to make sure that we pass the correct value to this required value. Not like the $color value, which is not a required value, we can choose whether we want to specify the value or just let the function go ahead and assume for us.</p>
<p>If we did it the other way around and made our $color as the required value and pass in only one argument into the function:</p>
<pre class="brush: php;">
&lt;?php

    function paint($room=&quot;office&quot;,$color) {
        echo &quot;The color of the {$room} is {$color}.&quot;;
    }

    paint(&quot;bedroom&quot;);

?&gt;
</pre>
<p><strong>Output:<br />
Warning: Missing argument 2 for paint3()…<br />
Notice: Undefined variable…<br />
The color of the bedroom is.</strong></p>
<p>This function will take “bedroom” as being the $room, and it’s going to ask for the required value which is the $color. We didn’t pass any value to the function for the variable $color. This will return an error message to us.</p>
<p>So you want to always make sure that your default values occur last in line. In other words, anything that is required needs to come first in the arguments list, anything that is optional needs to come later and the order of this doesn’t matter and you can’t skip spaces in between. So you need to pass in something along the way.</p>
<h2>Conclusion</h2>
<p>Another thing that I found helpful with default arguments is that you very quickly get a sense of what kind of information you’re expecting to be passed in to your function.</p>
<pre class="brush: php;">&lt;?php function paint($color=&quot;red&quot;,$room=&quot;office&quot;) {?&gt;</pre>
<p>Clearly here, I am looking for a color, I know it is going to be “red” and I am looking for a room which I know is something like an “office”. This gives us some context for knowing what those variables actually mean in our function.</p>
<p>Now that we’ve looked into default argument values, I think we’ve explored enough of functions that we will be able to get a lot out of them once we start coding and developing.</p>
<p>Thank you and enjoy learning.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/writing-functions-in-php-default-values/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Writing Functions In PHP &#8211; Global Variable</title>
		<link>http://www.moniestudios.com/tutorials/writing-functions-in-php-global-variable/</link>
		<comments>http://www.moniestudios.com/tutorials/writing-functions-in-php-global-variable/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 09:04:19 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=851</guid>
		<description><![CDATA[<a href="http://www.thewebsqueeze.com/web-design-tutorials/writing-functions-in-php-global-variable.html">Thewebsqueeze blog post</a>: In the last couple of tutorials, we’ve been looking at how to get values into a function and return back values back out of the function. We can get the same end result by using Global Variable.]]></description>
			<content:encoded><![CDATA[<h2>Global Scope Variable vs Local Scope Variable</h2>
<p>Take a look at the following code, and give it your best guess whether it’s going to come back with “outside” or “inside”?</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Global Variable&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;?php

        $bar = &quot;outside&quot;; // global scope variable

        function foo() {
            $bar = &quot;inside&quot;; // local scope variable
        }

        foo();
        echo $bar . &quot;&lt;br&gt;&quot;;

    ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Output: outside</strong></p>
<p>Why does it output “outside” instead of “inside”?</p>
<p>This is because the variable $bar (local scope variable) inside of the function has no relationship to the variable $bar (global scope variable) that was on the outside of the function. The variable inside of the function doesn’t know what value $bar is and has nothing to return out of the function. So it took the original value of $bar which is global scope variable that is “outside”. Let us see another example.</p>
<p>Now, take a guess whether it’s going to come back with “outside” or “inside” with this one?</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Global Variable&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;?php

        $bar = &quot;outside&quot;; // global scope variable

        function foo2($var) {
            $var = &quot;inside&quot;; // local scope variable
            return $var;
        }

        $bar = foo2($bar);
        echo $bar . &quot;&lt;br&gt;&quot;;

    ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Output: inside</strong></p>
<p>Yes, it’s going to display “inside” for this function. We’ve set the value for the variable $bar to “outside”, pass it as an argument into the function foo2(). The function received it and reset them with the value “inside”, a function’s local variable, and later on return back the value out of the function which will be assigned to the variable $bar.</p>
<p>There is another way that we can do this kind of variable declaration, that is by using Globals.<br />
Global Variable Declaration</p>
<p>Referring back to our first example,</p>
<pre class="brush: php;">
&lt;?php

    $bar = &quot;outside&quot;; // global scope variable

    function foo() {
        $bar = &quot;inside&quot;; // local scope variable
    }

    foo();
    echo $bar . &quot;&lt;br&gt;&quot;;

?&gt;
</pre>
<p>The variable $bar which is on the outside of the function is considered as a global variable. It has a global scope. It can be accessed anywhere inside the same page that we are working with. What ever happens inside the function is considered a local variable. It’s local only to the function and it doesn’t exist in the global scope. Anyway, we can change that by simply saying “Global $bar” inside of the function.</p>
<pre class="brush: php;">
&lt;?php

    $bar = &quot;outside&quot;;

    function foo() {
        global $bar; // declaring global variable
        $bar = &quot;inside&quot;; // local scope variable
    }

    foo();
    echo $bar . &quot;&lt;br&gt;&quot;;

?&gt;
</pre>
<p><strong>Output: inside</strong></p>
<p>What we are doing here is that we’ve told it to pull in that global variable $bar, go outside of the function and grab the variable for $bar, the global scope and pull that in so we can use it inside the function.</p>
<p>When the function finished execution, any changes that we’ve made to the variable $bar inside the function are going to be to that variable, no matter whether if it is a global scope variable or a local scope variable. In other words, the changes that we’ve made to the variable $bar inside the function are going to reset any other variable $bar outside of the function.</p>
<h2>Method Comparison</h2>
<p>When using global variable, you want to be careful because once you’ve declared something global, you’re effecting what happens outside of the function. So my advice is, use it with caution. You might be better off, passing in a variable into the function like we did in the second example.</p>
<p>If you are sure that you want to use your variable globally, then it is fine to declare your variable as global, but if you want to keep track on the values as they move around your script then you will declare your variable as a local variable. It’s a stylish choice that you’ll have to make. Here is the functions comparison that produces the same end result.</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Global Variable&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;?php

        /* using global variable */

        $bar = &quot;outside&quot;;

        function foo() {
            global $bar; // declaring global variable
            $bar = &quot;inside&quot;; // local scope variable
        }

        foo();
        echo $bar . &quot;&lt;br&gt;&quot;;

    ?&gt;

    &lt;br&gt;

    &lt;?php

        /* using local variables, argumants and return values */

        $bar = &quot;outside&quot;; // global scope variable

        function foo2($var) {
            $var = &quot;inside&quot;; // local scope variable
            return $var;
        }

        $bar = foo2($bar);
        echo $bar . &quot;&lt;br&gt;&quot;;

    ?&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Now we are ready to look at how we can set some default values to the arguments that can pass into a function so that a function can have some reasonable default values in case the user doesn’t pass in information or an argument into the function.</p>
<p>We will do that in the next tutorial in this series which is the final topic that we will be discussing about php function.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/writing-functions-in-php-global-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing Functions In PHP &#8211; Return Values</title>
		<link>http://www.moniestudios.com/tutorials/writing-functions-in-php-return-values/</link>
		<comments>http://www.moniestudios.com/tutorials/writing-functions-in-php-return-values/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 07:44:14 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=771</guid>
		<description><![CDATA[<a href="http://www.thewebsqueeze.com/web-design-tutorials/writing-functions-in-php-return-values.html">Thewebsqueeze blog post</a>: In the last two tutorial series, we've been looking at functions.  In this tutorial, we are going to look into a specific aspect of function, where function can return a value back out of them.]]></description>
			<content:encoded><![CDATA[<h2>Catch Up!</h2>
<p>(You can see part 1 <a href="http://www.moniestudios.com/tutorials/writing-functions-in-php/">here</a> and part 2 <a href="http://www.moniestudios.com/tutorials/writing-simple-functions-php-flexibility/">here</a>)</p>
<p>Referring back to our previous overtime() function:</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Return Values&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    /* declaring our third function */
    function overtime($salary, $month, $day, $rate){
        $hourly_pay = ($salary / $month / $day) * $rate;
        echo $hourly_pay;
    }
    overtime(2000,24,8,1.5); /* passing four arguments into the function */
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Output: 15.625</strong></p>
<h2>Function With Return Values</h2>
<p>We know that we must get the value out of the function (instead of just displaying it) in order for us to keep using it and keep working with it even if the function has finished execution. In order to do that, we need to return the value of $hourly_pay from the function and that&#8217;s just done with simply the word return, that&#8217;s the function that we are calling. We are telling the function, return this value!</p>
<p>It also is going to exit out of the function at that point when we say return. It&#8217;s a lot like break was when we were working with the loop. Let&#8217;s update our overtime() function so that it can return a value out of the function. The only thing that you should do is to replace the word &#8220;echo&#8221; with &#8220;return&#8221; and some modification in how we call the function.</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Return Values&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    /* declaring our third function */
    function overtime($salary, $month, $day, $rate){
        $hourly_pay = ($salary / $month / $day) * $rate;
        return $hourly_pay;
    }
    $returned_value = overtime(2000,24,8, 1.5);
    echo $returned_value;
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>So we called the function overtime(), we are going to return the value $hourly_pay to $returned_value and then echo back the new value.</p>
<p>Now, its a good idea whenever we are working with functions, especially functions that don&#8217;t just do display like we did with say_hello(), that you  always return a value out of them. Just get in a habit of making sure every function has a return. Maybe all it returns is true or false based on whether it works successfully, but we want to have something returned out of the end of that function just to let you know.</p>
<p>So for our say_hello() function, we should write something like this:</p>
<pre class="brush: php;">
&lt;?php
   function say_hello(){
     echo &quot;Hello World!&quot;;
     return true;
   }
   say_hello();
?&gt;
</pre>
<p>So, a quick tips for you. You could actually have several return values inside a function. You could have it like this:</p>
<pre class="brush: php;">
&lt;?php
   function multiple_return($val2, $val2){
      if this happens{
         return this value;
      }
      if that happens{
         return this value;
      }
   }
?&gt;
</pre>
<p>You could even have a function that had dozens of return value in it and a final return value at the very end of the function so that if none of the others were true, non of the others happen, than it would return something like FALSE or a DEFAULT value.</p>
<p>Of course if I am returning a value, then I also have to receive (or catch) the value at the other end. Unlike say_hello() function where I called it on it&#8217;s own,</p>
<pre class="brush: php;">
&lt;?php
   function say_hello($word){
     echo &quot;Hello {$word}!&quot;;
   }
   say_hello(&quot;Everyone&quot;);
?&gt;
</pre>
<p>I set it to the variable $returned_value so I can echo it back.</p>
<pre class="brush: php;">
&lt;?php
    $returned_value = overtime(2000,24,8, 1.5);
    echo $returned_value;
?&gt;
</pre>
<p>The next return value tips that I want to tell you about is that return one and only one value. If you need to return more than one value, there is a way to do that.</p>
<h2>Function With More Than One Return Values</h2>
<p>For this, let me explain in a new example.</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Return Values&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    function add_subt($val1, $val2){
        $add = $val1 + $val2;
        $subt = $val1 - $val2;
        return $add;
    }
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>This function will take the two values I give it, it will do both addition and subtraction, and right now it&#8217;s going to return addition. Subtraction will just get lost like nothing ever happen. So we can&#8217;t return more than once so we have to choose. But what if we want both?</p>
<p>Array is going to be our friendly solution here. Let&#8217;s see how array can help us.</p>
<pre class="brush: php;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Writing Functions In PHP - Return Values&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    function add_subt($val1, $val2){
        $add = $val1 + $val2;
        $subt = $val1 - $val2;
        $result = array($add, $subt);
        return $result;
    }
    $result_array = add_subt(10,5);
    echo &quot;Add: &quot; . $result_array[0] . &quot;&lt;br&gt;&quot;;
    echo &quot;Subt: &quot; . $result_array[1] . &quot;&lt;br&gt;&quot;;
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Output: Add: 15</strong><br />
<strong>Output: Subt: 5</strong></p>
<p>Let me guide you in the solution provided.</p>
<pre class="brush: php;">$result = array($add, $subt);</pre>
<p>The reason we use array is because array simply takes variables and put then into a single structure and assigns it to a single value like the above example. So when we want to echo both of the returned value, we call them like so:</p>
<pre class="brush: php;">
    $result_array = add_subt(10,5);
    echo &quot;Add: &quot; . $result_array[0] . &quot;&lt;br&gt;&quot;;
    echo &quot;Subt: &quot; . $result_array[1] . &quot;&lt;br&gt;&quot;;
</pre>
<p>The number in the bracket [0] and [1] indicates the $add and the $subt variable from the function attributes that we called earlier: array($add, $subt); So [0] for additional and [1] for subtraction.</p>
<p>So that&#8217;s the way that we can pass multiple results out of the function. So if we need to pass something more that just one value, we can do it with an array.</p>
<p>Now that we&#8217;ve talked about return values. We seen how a functions can do it&#8217;s processing and return a result back to what ever call the function. Next, we will look into <strong>Global Variable</strong>, a variable that is accessible from any method, procedure, or function and whose value can therefore be changed anywhere in the application.</p>
<p>We will look into that in the next series in <strong>Writing Functions In PHP &#8211; Global Variable</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/writing-functions-in-php-return-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: How To Use Your Favorite Font In Your Website?</title>
		<link>http://www.moniestudios.com/tutorials/quick-tip-how-to-use-your-favorite-font-in-your-website/</link>
		<comments>http://www.moniestudios.com/tutorials/quick-tip-how-to-use-your-favorite-font-in-your-website/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 04:44:18 +0000</pubDate>
		<dc:creator>Monie</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.moniestudios.com/?p=779</guid>
		<description><![CDATA[<p class="italic">Let me introduce you to the best way to [...]</p>]]></description>
			<content:encoded><![CDATA[<p class="italic">Let me introduce you to the best way to do your @font-face definitions, and you can start using your most favorite font type in your website!</p>
<p><span id="more-779"></span></p>
<h2></h2>
<p>I know the first thing that comes to your mind is:</p>
<p><strong>&#8220;Will my browser support it?&#8221;<br />
&#8220;Will anyone see my font type even if they don&#8217;t have the font installed on their computer?&#8221;<br />
&#8220;What about licensing?<br />
&#8220;Do I need extra script to make this work?&#8221;</strong></p>
<p>I do believe that you should forget about all the &#8220;question&#8221; first and start to learn how this things is done and later on then you decide. This wont take much of your time so let us proceed.</p>
<p>Before we begin, just to let you know that an IE browser doesn&#8217;t support of use any .ttf or .otf font type. What IE needs is .eot. Other browsers must take a .ttf or .otf.</p>
<h2>The best possible solution for both IE and Firefox user</h2>
<pre class="brush: css;">
@font-face {
font-family: 'AniversRegular';
src: url('font/Anivers_Regular.eot');
src: local('Anivers Regular'), local('Anivers-Regular'),
    url('font/Anivers_Regular.otf') format('opentype');
}
</pre>
<p>Notice the difference in font format. We have .eot and .otf. Why do we have all this different format in this declaration?</p>
<p>Internet Explorer has its own method and they prefer to use the .eot method. They will not even response to the opentype or the truetype method, if you are using .ttf font format here. So, we have to make sure that we load the .eot font format first in order to make sure IE will not load all the other font format that will lead to bandwidth wastage.</p>
<h2>How do we make sure IE wont load the .otf or the .ttf font format?</h2>
<blockquote><p>
Here, non-IE browsers skip any .eot file and move on. IE will try to parse the second src value, but it can&#8217;t understand the local() location nor the multiple locations, so it resorts to the EOT instead.</p>
<p>Quote from <a href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">Paul Irish</a></p></blockquote>
<p>IE browser does not understand all the <strong>commas</strong> and the <strong>local()</strong> declaration, so it will skip that line completely and it will only render the .eot file format (code line #3).</p>
<h2>Why do we have extra font name declaration?</h2>
<pre class="brush: css;">
src: local('Anivers Regular'), local('Anivers-Regular'),
    url('font/Anivers_Regular.otf') format('opentype');
</pre>
<p>The first local declaration &#8220;<strong>local(&#8216;Anivers Regular&#8217;)</strong>&#8221; will find the existing font type in the user local computer and load that. If it can&#8217;t find that, then it will execute the second selection which is the &#8220;<strong>local(&#8216;Anivers-Regular&#8217;)</strong>&#8220;, just in case they have a different name in the user&#8217;s PC. The last resort, it will load the font that we have included in our website.</p>
<h2>How to use it?</h2>
<pre class="brush: plain;">
h1 { font: 32px 'Anivers','AniversRegular',Georgia, sans-serif; }
</pre>
<p>The first declaration, &#8220;<strong>Anivers</strong>&#8221; is going to find if the font exist in the user&#8217;s computer. The second one &#8220;<strong>AniversRegular</strong>&#8221; will load our favorite font that we&#8217;ve declared earlier, and when everything else went wrong, the backup font type will be loaded which is &#8220;Georgia&#8221; or &#8220;sans-serif&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moniestudios.com/tutorials/quick-tip-how-to-use-your-favorite-font-in-your-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
