<?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>phpDevelopment &#124; Blog &#187; Various</title>
	<atom:link href="http://phpdev.ro/category/various/feed" rel="self" type="application/rss+xml" />
	<link>http://phpdev.ro</link>
	<description>Bringing you the best of the webdevelopement ecosphere</description>
	<lastBuildDate>Thu, 22 Jul 2010 14:06:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Most interesting links of February 2010</title>
		<link>http://phpdev.ro/most-interesting-links-of-february-2010.html</link>
		<comments>http://phpdev.ro/most-interesting-links-of-february-2010.html#comments</comments>
		<pubDate>Mon, 01 Mar 2010 10:20:24 +0000</pubDate>
		<dc:creator>Andrei Gabreanu</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[Various]]></category>
		<category><![CDATA[links interesting february]]></category>

		<guid isPermaLink="false">http://phpdev.ro/?p=889</guid>
		<description><![CDATA[Monthly, I will publish an article with the most interesting links that I found during that month. These links will be addressed to both designers, developers and some even to Linux system administrators. Except to find useful resources that may (or may not) help you in your future projects. Each link will contain a small intro text so you can understand what the article is all about without having to navigate to the article itself.]]></description>
			<content:encoded><![CDATA[<p>Here is my collection of best link references of February 2010:</p>
<h2>Implement a Rest API with the Zend Framework</h2>
<p><strong><a href="http://blog.realmofzod.com/2009/05/06/implement-a-rest-api-with-the-zend-framework/" target="_blank">Implement a Rest API with the Zend Framework </a></strong> is a great article posted on the &#8220;Realm of Zod&#8221; blog by Brandon, which shows you how to build your own Rest Server and Rest Client with Zend Framework. It gives you all the details required to get you started on the RESTful path of WebServices.</p>
<h2>Font type tester (includes font-face tests for CSS3)</h2>
<p><strong><a href="http://www.typetester.org/" target="_blank">Typetester &#8211; Compare fonts for the screen</a></strong> is a very very useful site for both designers and developers who want to give a nice artistic touch to their website without having to research countless hours for an appropriate font that might work or not for their needs. </p>
<h2>960 Grid System &#8211; CSS Framework</h2>
<p><strong><a href="http://960.gs/" target="_blank">960.gs</a></strong> is the leading CSS framework on the market. Even if you don&#8217;t like to use CSS Frameworks or didn&#8217;t know they existed, 960gs will provide you with core elements that will help you speed up your design2html process. For all of you who didn&#8217;t try it yet, you should definitely give it a shot. You won&#8217;t regret it.</p>
<h2>High Resolution Bokeh Texture</h2>
<p><strong><a href="http://jaicca.deviantart.com/art/High-Resolution-Bokeh-Texture-114634537" target="_blank">High Resolution Bokeh Texture</a></strong> is part of the freebies category. It includes a pack of bokeh textures to share &#038; use in your design projects. The package contains 5 textures with high resolution (240 dpi) 3456 x 2304. </p>
<h2>Out of focus 30 free bokeh textures</h2>
<p><strong><a href="http://lostandtaken.com/2008/09/out-of-focus-30-free-bokeh-textures.html" target="_blank">Out of focus 30 free bokeh textures</a></strong> is part of the freebies category again, this time with more textures for your design needs. The package contains 30 textures for your free use.</p>
<h2>Getting Started with XSL(T)</h2>
<p><strong><a href="http://net.tutsplus.com/tutorials/html-css-techniques/getting-started-with-xslt/">Getting Started with XSL(T)</a></strong> is the final interesting link of the month. It is an article written by Chad Hietala for <strong>Net Tuts Plus</strong> where he explains how to get started with the XLS(T) which is an alternative to the HTML design we all have used so far. If you are curios why even bother looking this up, you might need to know that <a href="http://www.wowarmory.com/">Blizzard World of Warcraft armory</a> is purely made on XLS(T)</p>
 <img src="http://phpdev.ro/wp-content/plugins/feed-statistics.php?view=1&post_id=889" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpdev.ro/most-interesting-links-of-february-2010.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Replication for dummies tutorial</title>
		<link>http://phpdev.ro/mysql-replication-for-dummies-tutorial.html</link>
		<comments>http://phpdev.ro/mysql-replication-for-dummies-tutorial.html#comments</comments>
		<pubDate>Sat, 21 Nov 2009 01:05:12 +0000</pubDate>
		<dc:creator>Andrei Gabreanu</dc:creator>
				<category><![CDATA[Various]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Develop]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.uauzilla.ro/?p=569</guid>
		<description><![CDATA[A tutorial for begginers with MySQL that will teach you how to setup a simple Master-Server replication in an UNIX environment.The tutorial will guide you through the process of setting up the replication settings on the master server, configure a user with replication privileges and then setting up the slave settings. At the end, once data is inserted into the master sql server, it will be available in real time on the slave server.]]></description>
			<content:encoded><![CDATA[<p>One of the most used RDBMS (relational database management system) is <strong>MySQL</strong>. <strong>MySQL</strong> stands for &#8220;<strong><em>My Structured Query Language</em></strong>&#8220;.  It currently has more than 6 million installation world-wide and can be installed on almost any OS varying from UNIX systems to Windows. Thus, chances are you are already working with it.</p>
<p>Now, there comes a time when your fresh website explodes in terms of traffic and your server cannot face it. In such case, you should consider two things:</p>
<ul>
<li>Revise all your queries and try to optimize them</li>
<li>Use Database Replication</li>
</ul>
<p>We won&#8217;t talk about query optimizer since there are a lot of tutorials and sites that describe how exactly to do it and it should be your primary goal in the process of making your website run smoother.<span id="more-569"></span></p>
<h2>What is Database Replication</h2>
<p><strong>Database replication</strong> is the process of sharing information between redundant sources, to improve the overall performance and reliability.</p>
<p>This means that you can have your database on one server, manage all <strong>W</strong>rite dependent operation on that server and use a <strong>separate server</strong> for all the <strong>R</strong>eading operations. A practical example would be a <strong>search engine</strong>.</p>
<p>A search engine could consist of a crawler (the back-office) and the actual UI which is displayed to the user. The user would <strong>read information</strong> from the database while the crawler would <strong>write</strong> that information actively. This way, you could have the crawler set on a server (<strong><em>the master server</em></strong>) and the actual application on another server (<strong><em>the slave</em></strong>). Every time the master server writes data to the database, it will be <strong>almost instantaneously available to the slave server</strong>, thus the user will see no difference but your overall performance will be boosted.</p>
<p>Database replication can be of two types (master-master or master-slave).  The simplest and the most spread scenario is to the master-slave type.  Let&#8217;s see how we can create such a system on our own servers&#8230;</p>
<h2>Prerequisites</h2>
<p>In the next few chapters i will assume the following:</p>
<ul>
<li>You are in a Linux environment (i will be talking about CentOS but with a bit of research regarding each file path, you can set it up on any Linux distribution)</li>
<li>You have access to SSH as root (or a user with root privileges)</li>
<li>You have access to the MySQL root user</li>
<li>You have an empty database on both of your master and slave server.</li>
</ul>
<h2>Configuring the Master Server</h2>
<ul>
<li>Login to your Master server via SSH as root.</li>
<li>Go to your /etc folder ( run the following command: <strong>cd /etc </strong>)</li>
<li>Make a backup of your my.cnf file found here ( run the following command: <strong>cp /etc/my.cnf /etc/my.cnf.old </strong>)</li>
<li>Edit the file /etc/my.cnf with nano ( run the following command: <strong>nano /etc/my.cnf </strong>)</li>
<li>Add the following lines somewhere in the section <strong>[mysqld]</strong>
<pre>log-bin=mysql-bin
server-id=1
</pre>
</li>
<li>Restart MySQL (run the following command: <strong>/etc/init.d/mysql restart</strong> )</li>
</ol>
<h2>Adding a user with replication privileges to the master server</h2>
<ul>
<li>Login as root to your MySQL account ( run the following command: <strong>mysql -u root -p </strong>)</li>
<li>Enter your password</li>
<li>Grant replication privileges to a user for a database with the following command: (replace <strong>some_password</strong> with a real password and <strong>some_user</strong> with a random username you prefer)
<pre>GRANT REPLICATION SLAVE ON *.* TO
'some_user'@'%' IDENTIFIED BY 'some_password';
FLUSH PRIVILEGES;
</pre>
</li>
<li>Get the MySQL log file ID (it is mandatory that you fetch this so that you will have only one log file for the entire operation)
<pre>SHOW MASTER STATUS;
</pre>
</li>
<li>If you did everything ok you should now have a table in front of you with at least 2 columns: File and Position. Write the values of these columns somewhere.</li>
<li>Unlock the MySQL tables with the following command
<pre>UNLOCK TABLES;
</pre>
</li>
<li>Exit the MySQL interface by running
<pre>quit
</pre>
</li>
</ul>
<h2>Configuring the Slave Server</h2>
<ul>
<li>Login to your Slave server via SSH as root.</li>
<li>Go to your /etc folder (run the following command: <strong>cd /etc</strong> )</li>
<li>Make a backup of your my.cnf file found here ( run the following command: <strong>cp /etc/my.cnf /etc/my.cnf.old</strong> )</li>
<li>Edit the file /etc/my.cnf with nano ( run the following command: <strong>nano /etc/my.cnf</strong> )</li>
<li>Add the following lines somewhere in the section <strong>[mysqld]</strong>
<pre>server-id=2
</pre>
</li>
<li>Restart MySQL (run the following command: <strong>/etc/init.d/mysql restart</strong> )</li>
</ul>
<h2>Setting up the link between the Slave and the Master</h2>
<ul>
<li>Login as root to your MySQL account ( run the following command: <strong>mysql -u root -p</strong> )</li>
<li>Enter your password</li>
<li>Run the following LONG command:
<pre>mysql> CHANGE MASTER TO
     > MASTER_HOST='master_host_name'
     > MASTER_USER='replication_user_name'
     > MASTER_PASSWORD='replication_password'
     > MASTER_LOG_FILE='recorded_log_file_name'
     > MASTER_LOG_POS=recorded_log_position
</pre>
</li>
<li>Quit and restart mysql.</li>
</ul>
<h2>Conclusion</h2>
<p>If everything was setup ok, you should now be able to go to your Master server, insert data into your replication database, and then, when you go to your Slave server, you should be able to see each row inserted in real time.</p>
<p><strong>Would you like to have an article like this about master-master replication?</strong></p>
 <img src="http://phpdev.ro/wp-content/plugins/feed-statistics.php?view=1&post_id=569" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpdev.ro/mysql-replication-for-dummies-tutorial.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>11 Tips to maximize your web application performance</title>
		<link>http://phpdev.ro/11-tips-to-maximize-your-web-application-performance.html</link>
		<comments>http://phpdev.ro/11-tips-to-maximize-your-web-application-performance.html#comments</comments>
		<pubDate>Tue, 13 Oct 2009 21:27:44 +0000</pubDate>
		<dc:creator>Andrei Gabreanu</dc:creator>
				<category><![CDATA[Various]]></category>
		<category><![CDATA[Advices]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Develop]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.uauzilla.ro/?p=454</guid>
		<description><![CDATA[Every web developer should know these tips or at least take them into consideration before starting their next project. The list contains various tips that range from server configuration to application logic. Including all tips into your project might result into a bigger server load but will drastically improve your users experience (since your site will be lighting fast!). Also, don't forget, search engines LOVE speed and its more eco friendly if your site loads faster. So why not use these? ]]></description>
			<content:encoded><![CDATA[<p>It is incredible how much time it is spent on having awesome features in a web application but so little time spent on optimizing it. The user experience is composed of 80% page load time and 20% of the UI (user interface) and functionality. Although this fact is know for ages, there are tons of web applications and web sites that ignore this and tend to ignore each of the following tips focusing on giving the user a rich experience but ignoring the fact he has to <strong>get</strong> there first. And he has to get there <strong>fast</strong>.</p>
<p>The following tips should be taken in consideration <strong>before</strong> actually building your website (but they can still prove valuable if added after). The tips are a concise list formed from both Yahoo &amp; Google experience on the web that these two web giants freely shared with us, the web community.<span id="more-454"></span></p>
<div style="clear:both; margin-bottom:35px"></div>
<h2>1. Use a subdomain for your static files</h2>
<p>There are many explanations about why to do this, but the conclusion is that, you should distribute all your static files into HTTP requests from 2 to 4 (but no more then 4).<br />
The perfect example would be, for example:</p>
<ul>
<li><strong><em>www.yourdomain.com</em></strong> : This would be the base domain your users are going to land on.</li>
<li><strong><em> images.yourdomain.com</em></strong> : This would be  the domain where you will put all your PNG&#8217; and GIF files (or all static images)</li>
<li><strong><em>scripts.yourdomain.com</em></strong> : This would be the domain where you will hold all your javascript and other scripts (only use static scripts here!)</li>
<li><strong><em>static.yourdomain.com</em></strong> : This would be the domain where you should host all your CSS files and other static content</li>
</ul>
<div style="clear:both; margin-bottom:35px"></div>
<h2>2. Set cookies on the www subdomain</h2>
<p>In a few words, if you make a request to a domain above (like scripts.yourdomain.com) and you have in your application 10 cookies set, each having 0.5 kb, then for each image request you will send 5kb through. And you don&#8217;t need cookies for static content, do you?</p>
<pre><strong>Example: </strong>

Set all cookies to "www.yourdomain.com"  <em>(not *.yourdomain.com). </em>

Since<em> images.yourdomain.com </em>is not part of www.yourdomain.com 

then it won't send them through the request.</pre>
<div style="clear:both; margin-bottom:35px"></div>
<h2>3. Use cache-control for each of your static content to a long period</h2>
<p>Basically, since you are using static content then, you don&#8217;t want to change it very soon (that&#8217;s the whole idea of static content). This way you can make sure that the user will not make more requests or transfer any more precious kilobytes after 1 month of inactivity on your website for example. A good choice is to set them to 1 year or more.</p>
<pre>
<strong>Example</strong>

In your .htaccess file 

ExpiresDefault "modification plus 10 years"
ExpiresByType text/html "modification plus 1 minute"
</pre>
<div style="clear:both; margin-bottom:35px"></div>
<h2>4. Name your static files with the version number</h2>
<p>Every static file should include in its name the version of the file (ex: myFileName-1.2.3.js ). This way, in case you <strong>do</strong> need to change the static file then deleting it from the webserver and adding the new version won&#8217;t change a thing for old users since they will have the cache active in their browser.<br />
To overcome this,  upload your next version of the static file and tell your page to use the new version. This way, the browser will only make a request for the new file and the old file will be deleted from the cache (and also you should delete it from the server).</p>
<pre><em><strong>Tip for development: </strong></em>
You should (almost) never have more then 1 file for 
javascripts and stylesheets.
</pre>
<div style="clear:both; margin-bottom:35px"></div>
<h2>5. Always put your CSS file in the head tag.</h2>
<p>This is actually a fake performance improvement. The whole ideea is to let the browser first load the CSS then, since the css is loaded, the page will appear to load progressively rather then make the user see a white page for X mili/seconds and then *bam* see the whole page. You can think of it like an old-school progress bar without the bar.</p>
<div style="clear:both; margin-bottom:35px"></div>
<h2>6. Always put the javascript at the bottom</h2>
<p>You won&#8217;t need the javascript unless the document is loaded (or you&#8217;re doing preloading). It is a very good ideea to insert your javascripts at the end of the file. If you use a library like jquery, put it in the head but dont forget the $(document).ready(). In both of these cases, stop using javascript inline or if not possible, don&#8217;t use it in the entire document. Have a common place where to put the Javascript.</p>
<div style="clear:both; margin-bottom:35px"></div>
<h2>7. Use CSS sprites but dont overuse them!</h2>
<p>The ideea here basically a very easy comparison:</p>
<p>Basically if your web application has 10 images to load, made of 8 buttons, 1 background and 1 header, each having, let&#8217;s say, 10 kb then this means you will download 100 kbs in total.<br />
The problem here is that, for these 10 items, the browser will make 10 requests. This is very very bad. Instead of doing this, use CSS Sprites.</p>
<p>Your 10 images would become 1 image which should have the exact size(well ok, 0,001 bytes more since you&#8217;ll have a 1px delimitation  between elements. You will download the same amount of data from the server but all in one request. This is a <strong>huge improvment </strong>to the performance of your website.</p>
<p><em><strong>However</strong></em>, if you overuse CSS sprites, you will end up loading images that your user may never see! For instance, if those 10 images were in fact made of 7 menu buttons, 1 for header, 1 for background and <strong>one for a nice picture of you in the contact page</strong> then, if your application is not likely to provoke users to contact you, loading it in the homepage would be a bad idea overall. Try to group common items in the same image</p>
<div style="clear:both; margin-bottom:35px"></div>
<h2>8. Consider preloading items</h2>
<p>Preloading items is a very intelligent technique: For example, if your homepage contains a nice web 2.0 stylish button that says TRY FOR FREE then it might be a good idea to load (either by CSS or javascript/html) all or some of the static files that the user will find in the &#8220;<em>TRY IT FOR FREE&#8221;</em> area of your website. In a few words, you can load items that you think your visitors will likely access in their next step.</p>
<p><em>Again, <strong>don&#8217;t overuse</strong></em> this since studies have shown that with each 100ms loading time, you loose 1% of the traffic of your website. So don&#8217;t load your entire site in the homepage.</p>
<p><em><strong>Google uses </strong></em>this smart technique to load the items in their homepage for their results page since the user is most likely to  go there after visiting the homepage.</p>
<div style="clear:both; margin-bottom:35px"></div>
<h2>9 . Use gzip for all your content</h2>
<p>This is a very important aspect to take in consideration. The improvement given by GZIP compression is close to 90% faster then the actual speed of your content without it. To use GZIP you can either do it with PHP (or any other scripting language) or with Apache with mod_gzip.</p>
<div style="clear:both; margin-bottom:35px"></div>
<h2>10. Use a CDN for your files</h2>
<p>The costs of a CDN are so small nowadays that you should ask yourself, why not use it? It can give you that extra speed you need in your application to keep your users from going away. It is so simple to setup and yet so powerful, that you should do it as soon as your website turns into profit.</p>
<div style="clear:both; margin-bottom:35px"></div>
<h2>11. Minify your CSS and Javascript files</h2>
<p>It is common sense to know that, smaller files in size mean smaller bandwidth usage, ultimately giving you an extra speed boost. You can use either Yahoo or X to minify your scripts.</p>
<h3><em>Got any more cool techniques that you think could help the community? Share them in the comments below!</em></h3>
 <img src="http://phpdev.ro/wp-content/plugins/feed-statistics.php?view=1&post_id=454" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpdev.ro/11-tips-to-maximize-your-web-application-performance.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to make a simple backup program using a BAT file</title>
		<link>http://phpdev.ro/how-to-make-a-simple-backup-program-using-a-bat-file.html</link>
		<comments>http://phpdev.ro/how-to-make-a-simple-backup-program-using-a-bat-file.html#comments</comments>
		<pubDate>Fri, 11 Sep 2009 17:37:50 +0000</pubDate>
		<dc:creator>Andrei Gabreanu</dc:creator>
				<category><![CDATA[Various]]></category>
		<category><![CDATA[Advices]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.uauzilla.ro/?p=292</guid>
		<description><![CDATA[This tutorial teaches you how to make your own backup program. Its nothing fancy like SVN or CVS but it does help you if you don't have time to use something else (although i recommend you should make time)]]></description>
			<content:encoded><![CDATA[<p>Custom backup software are either very bad, expensive or too complicated for us. As developers, its our duty to backup our code all the time in case some major wastrel comes into stage.  In case anything wrong goes with the deployment of a project or perhaps just a power loss during a simple upload on a server, you can have your work backed up and just revert to that version of the application. In the following lines, we will see how to write a very simple backup software (nothing fancy like SVN or any other tool) that will backup our files from day to day (or even more frequent). All you have to do is write two lines of code in a BAT file(or perhaps more if your project has different locations overall) and setup a simple Task Schedule.<br />
<span id="more-292"></span><br />
The steps are simple:</p>
<pre>
<ol>
<li>Create a file on your machine, named backup.bat..</li>
<li>Right click on it and click EDIT</li>
<li>Copy paste the following lines into it: <br/>
Echo Making Backup <br/>
<strong>mkdir "your_backup_path\backup\%DATE%"</strong>
<strong>xcopy "path_to_project" "your_backup_path\backup\%DATE%" /E </strong>

Echo Finish
Pause</li>
<li>Now just go to control panel / task manager</li>
<li>Setup a task to run every day (or anything you like) and point <br/>the task to your BAT file.</li>
<li>You are done!</li>
</ol>
</pre>
<p>Make sure you schedule the task to run when you are not working (since it will backup your files with alterations of your current code).<br />
If you want more paths, just include the xcopy command more and change your paths there.</p>
 <img src="http://phpdev.ro/wp-content/plugins/feed-statistics.php?view=1&post_id=292" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://phpdev.ro/how-to-make-a-simple-backup-program-using-a-bat-file.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
