<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Muthukumar S</title>
	<atom:link href="http://dearsmk.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dearsmk.wordpress.com</link>
	<description>Internet and innovation is my passion...</description>
	<lastBuildDate>Thu, 08 May 2008 00:50:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dearsmk.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Muthukumar S</title>
		<link>http://dearsmk.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dearsmk.wordpress.com/osd.xml" title="Muthukumar S" />
	<atom:link rel='hub' href='http://dearsmk.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to use .htaccess</title>
		<link>http://dearsmk.wordpress.com/2008/05/08/how-to-use-htaccess/</link>
		<comments>http://dearsmk.wordpress.com/2008/05/08/how-to-use-htaccess/#comments</comments>
		<pubDate>Thu, 08 May 2008 00:50:26 +0000</pubDate>
		<dc:creator>dearsmk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://dearsmk.wordpress.com/?p=9</guid>
		<description><![CDATA[How to use .htaccess introduction to .htaccess There&#8217;s a good reason why you won&#8217;t see .htaccess files on the web; almost every web server in the world is configured to ignore them, by default. Same goes for most operating systems. Mainly it&#8217;s the dot &#8220;.&#8221; at the start, you see? If you don&#8217;t see, you&#8217;ll [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=9&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>How to use .htaccess</strong></p>
<p>introduction to .htaccess</p>
<p>There&#8217;s a good reason why you won&#8217;t see .htaccess files on the web; almost every web server in the world is configured to ignore them, by default. Same goes for most operating systems. Mainly it&#8217;s the dot &#8220;.&#8221; at the start, you see?</p>
<p>If you don&#8217;t  see, you&#8217;ll need to disable your operating system&#8217;s invisible file functions, or use a text editor that allows you to open hidden files, something like bbedit on the Mac platform. On windows, showing invisibles in explorer should allow any text editor to open them, and most decent editors to save them too**. Linux dudes know how to find them without any help from me.<br />
Mac Finder view with invisible files<br />
that same folder, as seen from Mac OS X</p>
<p>In both images, the operating system has been instructed to display invisible files. ugly, but necessary sometimes. You will also need to instruct your ftp client to do the same.</p>
<p>By the way; the windows screencap is more recent than the mac one, moved files are likely being handled by my clever 404 script.</p>
<p>** even notepad can save files beginning with a dot, if you put double-quotes around the name when you save it; i.e.. &#8220;.htaccess&#8221;. You can also use your ftp client to rename files beginning with a dot, even on your local filesystem; works great in FileZilla.</p>
<p>What are .htaccess files anyway?<br />
Simply put, they are invisible plain text files where one can store server directives. Server directives are anything you might put in an Apache config file (httpd.conf) or even a php.ini**, but unlike those &#8220;master&#8221; directive files, these .htaccess directives apply only to the folder in which the .htaccess file resides, and all the folders inside.</p>
<p>This ability to plant .htaccess files in any directory of our site allows us to set up a finely-grained tree of server directives, each subfolder inheriting properties from its parent, whilst at the same time adding to, or over-riding certain directives with its own .htaccess file. For instance, you could use .htacces to enable indexes all over your site, and then deny indexing in only certain subdirectories, or deny index listings site-wide, and allow indexing in certain subdirectories. One line in the .htaccess file in your root and your whole site is altered. From here on, I&#8217;ll probably refer to the main .htaccess in the root of your website as &#8220;the master .htaccess file&#8221;, or &#8220;main&#8221; .htaccess file.</p>
<p>There&#8217;s a small performance penalty for all this .htaccess file checking, but not noticeable, and you&#8217;ll find most of the time it&#8217;s just on and there&#8217;s nothing you can do about it anyway, so let&#8217;s make the most of it..</p>
<p>** Your main php.ini, that is, unless you are running under phpsuexec, in which case the directives would go inside individual  php.ini files</p>
<p>What can I do with .htaccess files?<br />
Almost any directive that you can put inside an httpd.conf file will also function perfectly inside an .htaccess file. Unsurprisingly, the most common use of .htaccess is to..</p>
<p>control access<br />
.htaccess is most often used to restrict or deny access to individual files and folders. A typical example would be an &#8220;includes&#8221; folder. Your site&#8217;s pages can call these included scripts all they like, but you don&#8217;t want users accessing these files directly. In that case you would drop an .htaccess file in the includes folder with content something like this..</p>
<p>NO ENTRY!<br />
# no one gets in here!<br />
deny from all</p>
<p>which would deny ALL direct access to ANY files in that folder. You can be more specific with your conditions, for instance limiting access to a particular IP range, here&#8217;s a handy top-level rule for a local test server..</p>
<p>NO ENTRY outside of the LAN!<br />
# no nasty crackers in here!<br />
order deny,allow<br />
deny from all<br />
allow from 192.168.0.0/24<br />
# this would do the same thing..<br />
#allow from 192.168.0</p>
<p>Generally these sorts of requests would bounce off your firewall anyway, but on a live server (like my dev mirror sometimes is) they become useful for filtering out undesirable IP blocks, known risks, lots of things. By the way, in case you hadn&#8217;t spotted; lines beginning with &#8220;#&#8221; are ignored by Apache; handy for comments.</p>
<p>Sometimes, you will only want to ban one IP, perhaps some persistent robot that doesn&#8217;t play by the rules..</p>
<p>post user agent every fifth request only. hmmm. ban IP..<br />
# someone else giving the ruskies a bad name..<br />
order allow,deny<br />
deny from 83.222.23.219<br />
allow from all</p>
<p>The usual rules for IP addresses apply, so you can use partial matches, ranges, and so on. Whatever, the user gets a 403 &#8220;access denied&#8221; error page in their client software (browser, usually), which certainly gets the message across. This is probably fine for most situations, but in part two I&#8217;ll demonstrate some cooler ways to deny access.</p>
<p>custom error documents<br />
I guess I should briefly mention that .htaccess is where most folk configure their error documents. Usually with sommething like this..</p>
<p>the usual method. the &#8220;err&#8221; folder (with the custom pages) is in the root<br />
# custom error documents<br />
ErrorDocument 401 /err/401.php<br />
ErrorDocument 403 /err/403.php<br />
ErrorDocument 404 /err/404.php<br />
ErrorDocument 500 /err/500.php</p>
<p>You can also specify external URLs, though this can be problematic, and is best avoided. One quick and simple method is to specify the text in the directive itself, you can even use HTML (though there is probably a limit to how much HTML you can squeeze onto one line). Remember to begin with a &#8220;, but DO NOT end with one.</p>
<p>measure twice, quote once..<br />
# quick custom error &#8220;document&#8221;..<br />
NO!     ErrorDocument 404 &#8220;</p>
<h2><tt>There is nothing here.. go away quickly!</tt></h2>
<p>Using a custom error document is a Very Good Idea, and will give you a second chance at your almost-lost visitors. I recommend you download mine. But then, I would.</p>
<p>password protected directories<br />
The next most obvious use for our .htaccess files is to allow access to only specific users, or user groups, in other words; password protected folders. a simple authorisation mechanism might look something like this..</p>
<p>a simple sample .htaccess file for password protection:<br />
AuthType Basic<br />
AuthName &#8220;restricted area&#8221;<br />
AuthUserFile /usr/local/var/www/html/.htpasses<br />
require valid-user</p>
<p>You can use this same mechanism to limit only certain kinds of requests, too..</p>
<p>only valid users can POST in here, anyone can GET, PUT, etc:<br />
AuthType Basic<br />
AuthName &#8220;restricted area&#8221;<br />
AuthUserFile /usr/local/var/www/html/.htpasses</p>
<p>require valid-user</p>
<p>You can find loads of online examples of how to setup authorization using .htaccess, and so long as you have a real  user (or create one, in this case, &#8216;jimmy&#8217;) with a real  password (you will be prompted for this, twice) in a real  password file (the -c switch will create it)..</p>
<p>htpasswd -c /usr/local/var/www/html/.htpasses jimmy</p>
<p>..the above will work just fine. htpasswd is a tool that comes free with Apache, specifically for making and updating password files, check it out. The windows version is the same; only the file path needs to be changed; to wherever you want to put the password file.</p>
<p>Note: if the Apache bin/ folder isn&#8217;t in your PATH, you will need to cd into that directory before performing the command. Also note: You can use forward and back-slashes interchangeably with Apache/php on Windows, so this would work just fine..</p>
<p>htpasswd -c c:/unix/usr/local/Apache2/conf/.htpasses jimmy</p>
<p>Relative paths are fine too; assuming you were inside the bin/ directory of our fictional Apache install, the following would do exactly the same as the above..</p>
<p>htpasswd -c ../conf/.htpasses jimmy</p>
<p>Naming the password file .htpasses is a habit from when I had to keep that file inside the web site itself, and as web servers are configured to ignore files beginning with .ht, they too, remain hidden. If you keep your password file outside the web root (a better idea), then you can call it whatever you like, but the .ht_something habit is a good one to keep, even inside the web tree, it is secure enough for our basic  purpose..</p>
<p>Once they are logged in, you can access the remote_user environmental variable, and do stuff with it..</p>
<p>the remote_user variable is now available..<br />
RewriteEngine on<br />
RewriteCond %{remote_user} !^$ [nc]<br />
RewriteRule ^(.*)$ /users/%{remote_user}/$1</p>
<p>Which is a handy directive, utilizing mod_rewrite; a subject I delve into far more deeply, in part two.</p>
<p>get better protection..<br />
The authentication examples above assume that your web server supports &#8220;Basic&#8221; http authorisation, as far as I know they all do (it&#8217;s in the Apache core). Trouble is, some browsers aren&#8217;t sending password this way any more, personally I&#8217;m looking to php to cover my authorization needs. Basic auth works okay though, even if it isn&#8217;t actually very secure &#8211; your password travels in plain text over the wire, not clever.</p>
<p>If you have php, and are looking for a more secure login facility, check out pajamas. It&#8217;s free. If you are looking for a password-protected download facility (and much more, besides), check out my distro machine, also free.</p>
<p>500 error<br />
If you add something that the server doesn&#8217;t understand or support, you will get a 500 error page, aka.. &#8220;the server did a boo-boo&#8221;. Even directives that work perfectly on your test server at home may fail dramatically at your real site. In fact this is a great way to find out if .htaccess files are enabled on your site; create one, put some gibberish in it, and load a page in that folder, wait for the 500 error. if there isn&#8217;t one, probably they are not enabled.</p>
<p>If they are, we need a way to safely do live-testing without bringing the whole site to a 500 standstill.</p>
<p>Fortunately, in much the same way as we used the<br />
tag above, we can create conditional directives, things which will only come into effect if certain conditions are true. The most useful of these is the &#8220;ifModule&#8221; condition, which goes something like this..</p>
<p>only if PHP is loaded, will this directive have any effect</p>
<p>php_value default_charset utf-8</p>
<p>..which placed in your master .htaccess file, that would set the default character encoding of your entire site to utf-8 (a good idea!), at least, anything output by PHP. If the PHP4 module isn&#8217;t running on the server, the above .htaccess directive will do exactly nothing; Apache just ignores it. As well as proofing us against knocking the server into 500 mode, this also makes our .htaccess directives that wee bit more portable. Of course, if your syntax is messed-up, no amount of if-module-ing is going to prevent a error of some kind, all the more reason to practice this stuff on a local test server.</p>
<p>groovy things to do with .htaccess<br />
So far we&#8217;ve only scratched the surface. aside from authorisation, the humble .htaccess file can be put to all kinds of uses. If you&#8217;ve ever had a look in my public archives you will have noticed that that the directories are fully browsable, just like in the old days before adult web hosts realized how to turn that feature off! a line like this..</p>
<p>bring back the directories!<br />
Options +Indexes +MultiViews +FollowSymlinks</p>
<p>will almost certainly turn it back on again. And if you have mod_autoindex.c installed on your server (probably, yes), you can get nice fancy indexing, too..</p>
<p>show me those files!</p>
<p>IndexOptions FancyIndexing</p>
<p>..which, as well as being neater, allows users to click the titles and, for instance, order the listing by date, or file size, or whatever. It&#8217;s all for free too, built-in to the server, we&#8217;re just switching it on. You can control certain parameters too..</p>
<p>let&#8217;s go all the way!</p>
<p>IndexOptions FancyIndexing IconHeight=16 IconWidth=16</p>
<p>Other parameters you could add include..</p>
<p>NameWidth=30<br />
DescriptionWidth=30<br />
IconsAreLinks SuppressHTMLPreamble (handy!)</p>
<p>I&#8217;m not mentioning the &#8220;XHTML&#8221; parameter in Apache2, because it still isn&#8217;t! Anyways, I&#8217;ve chucked one of my old fancy indexing .htaccess file onsite for you to have some fun with. Just add readme.html and away you go! note: these days I use a single header files for all  the indexes, and only drop in local &#8220;readme&#8221; files. Check out the example, and my public archives for more details.</p>
<p>custom directory index files<br />
While I&#8217;m here, it&#8217;s worth mentioning that .htaccess is where you can specify which files you want to use as your indexes, that is, if a user requests /foo/, Apache will serve up /foo/index.html, or whatever file you specify.</p>
<p>You can also specify multiple files, and Apache will look for each in order, and present the first one it finds. It&#8217;s generally setup something like..</p>
<p>DirectoryIndex index.html index.php index.htm</p>
<p>It really is worth scouting around the Apache documentation, often you will find controls for things you imagined were uncontrollable, thereby creating new possibilities, better options for your website. My experience of the magic &#8220;LAMP&#8221; (Linux-Apache-MySQL-PHP) has been.. &#8220;If you can imagine that it can be done, it can be done&#8221;. Swap &#8220;Linux&#8221; for any decent operating system, the &#8220;AMP&#8221; part runs on most of them.</p>
<p>Okay, so now we have nice fancy directories, and some of them password protected, if you don&#8217;t watch out, you&#8217;re site will get popular, and that means bandwidth..</p>
<p>save bandwidth with .htaccess!<br />
If you pay for your bandwidth, this wee line could save you hard cash..</p>
<p>save me hard cash! and help the internet!</p>
<p>php_value zlib.output_compression 16386</p>
<p>All it does is enables PHP&#8217;s built-in transparent zlib compression. This will half your bandwidth usage in one stroke, more than that, in fact. Of course it only works with data being output by the PHP module, but if you design your pages with this in mind, you can use php echo statements, or better yet, php &#8220;includes&#8221; for your plain html output and just compress everything! Remember, if you run phpsuexec, you&#8217;ll need to put php directives in a local php.ini file, not .htaccess. See here for more details.</p>
<p>hide and deny files<br />
Do you remember I mentioned that any file beginning with .ht is invisible? ..&#8221;almost every web server in the world is configured to ignore them, by default&#8221; and that is, of course, because .ht_anything files generally have server directives and passwords and stuff in them, most  servers will have something like this in their main configuration..</p>
<p>Standard setting..</p>
<p>Order allow,deny<br />
Deny from all<br />
Satisfy All</p>
<p>which instructs the server to deny access to any file beginning with .ht, effectively protecting our .htaccess and other files. The &#8220;.&#8221; at the start prevents them being displayed in an index, and the .ht prevents them being accessed. This version..</p>
<p>ignore what you want</p>
<p>Order allow,deny<br />
Deny from all<br />
Satisfy All</p>
<p>tells the server to deny access to *.log files. You can insert multiple file types into each rule, separating them with a pipe &#8220;|&#8221;, and you can insert multiple blocks into your .htaccess file, too. I find it convenient to put all the files starting with a dot into one, and the files with denied extensions into another, something like this..</p>
<p>the whole lot<br />
# deny all .htaccess, .DS_Store $hî†é and ._* (resource fork) files</p>
<p>Order allow,deny<br />
Deny from all<br />
Satisfy All</p>
<p># deny access to all .log and .comment files</p>
<p>Order allow,deny<br />
Deny from all<br />
Satisfy All</p>
<p>would cover all ._* resource fork files, .DS_Store files (which the Mac Finder creates all over the place) *.log files, *.comment files and of course, our .ht* files. You can add whatever file types you need to protect from direct access. I think it&#8217;s clear now why the file is called &#8220;.htaccess&#8221;.<br />
These days, using  is preferred over , mainly because you can use regular expression in the conditions (very handy), produce clean, more readable code. Here&#8217;s an example. which I use for my php-generated style sheets..</p>
<p>parse file.css and file.style with the php machine..<br />
# handler for phpsuexec..</p>
<p>SetHandler application/x-httpd-php</p>
<p>Any files matching the regular expression statement, that is files with a *.css or *.style extension, will now be handled by php, rather than simply served up by Apache. Any  statements you come across can be advantageously replaced by  statements. Good to know.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dearsmk.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dearsmk.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dearsmk.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dearsmk.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dearsmk.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dearsmk.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dearsmk.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dearsmk.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dearsmk.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dearsmk.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dearsmk.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dearsmk.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dearsmk.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dearsmk.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dearsmk.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dearsmk.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=9&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dearsmk.wordpress.com/2008/05/08/how-to-use-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/adc9f9b6c9229eab880b44df7351b777?s=96&#38;d=identicon" medium="image">
			<media:title type="html">dearsmk</media:title>
		</media:content>
	</item>
		<item>
		<title>How to set up Mysql replication</title>
		<link>http://dearsmk.wordpress.com/2008/04/21/how-to-set-up-mysql-replication/</link>
		<comments>http://dearsmk.wordpress.com/2008/04/21/how-to-set-up-mysql-replication/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 12:37:42 +0000</pubDate>
		<dc:creator>dearsmk</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[DB]]></category>
		<category><![CDATA[master slave]]></category>
		<category><![CDATA[mysql replication]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://dearsmk.wordpress.com/?p=8</guid>
		<description><![CDATA[Section 1: Master Slave replication For ex, if you want to replicate from master A to slave B 1. Create a replication account on master A &#8216;%&#8217; means all the other boxes, so all slave boxes can use the same user/passwd to replicate data from the master A mysql&#62; grant replication slave, reload, super on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=8&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Section 1: Master Slave replication<br />
     For ex, if you want to replicate from master A to slave B </p>
<p>   1. Create a replication account on master A<br />
      &#8216;%&#8217; means all the other boxes, so all slave boxes can use<br />
      the same user/passwd to replicate data from the master A<br />
      mysql&gt; grant replication slave, reload, super on *.*<br />
      to &#8216;slave_user&#8217;@'%&#8217; identified by &#8216;slave_pass&#8217;;</p>
<p>   2. Shut down the master server if it is running<br />
      sudo /home/y/bin/mysqladmin shutdown -u root &#8211;password=&#8217;root_passwd&#8217;</p>
<p>   3. Modify master&#8217;s configuration<br />
      in /home/y/etc/my.cnf generally<br />
      [mysqld]<br />
      server-id=master_server_id<br />
      log-bin=binlog_name<br />
      (do yinst set mysql_config.log_bin=log-bin</p>
<p>   4. Restart the master mysql server<br />
      then the master will log updates by writing them into the bin-log<br />
      to restart the mysql server, run<br />
      sudo /home/y/bin/mysqld_safe &amp;</p>
<p>   5. Copy the mysql db data from master to slave to make them in sync before replication<br />
      by following instructions in Section 2: To get a full copy of the master DB</p>
<p>      Note:in terms of how to copy the data from master to slave,<br />
      there are multiple ways, if all the database tables you are<br />
      replicating are myISAM tables, then you can use the method<br />
      mentioned here, otherwise, you might want to check the<br />
      Mysql replication link for more details</p>
<p>   6. Shut down the slave if it is running<br />
      using the same command as step 2 on slave box</p>
<p>   7. Configure slave server to know its replication id<br />
      modify /home/y/etc/my.cnf on slave server</p>
<p>      [mysqld]<br />
      server-id=slave_server_id<br />
      master-host=master_host<br />
      master-user=slave_user<br />
      master-password=slave_pass<br />
      #specify which database you want to replicate<br />
      replicate-do-db = database1_to_be_replicated<br />
      replicate-do-db = database2_to_be_replicated<br />
      replicate-do-db = database3_to_be_replicated &#8230;. (etc)<br />
          * slave_server_id is the replication id of the slave<br />
            server, it must be different from the master&#8217;s ID and<br />
            all the other slaves&#8217; ids<br />
          * master_host is the name of the master host.<br />
          * slave_user/slave_pass must be the user/passwd set up in step 1 </p>
<p>   8. Restart the slave mysql server (like step 3 and 5)</p>
<p>   9. Run &#8220;show slave status&#8221; under mysql prompt on slave B<br />
      check out if the replication is started</p>
<p>  10. You can also un &#8220;show master status&#8221; on master end<br />
      to see what is the current bin-log on master box</p>
<p>  11. To see if there is any issue, you can check /home/y/logs/mysql/mysqld.err<br />
      on both master and slave boxes, to see if there are any issues there. </p>
<p>Section2 :To get a full copy of the master DB</p>
<p>   1. Issue read lock to all databases to make sure the current data snapshot on master is consistent<br />
      mysql&gt; flush tables with read lock;</p>
<p>   2. IMPORTANT:Reset (clean up ) the binary log on master box<br />
      since we are going to first copy the current data snapshot from master to slave, the existing binary log has all the update commands logged until now, we need to clean them up before starting the replication, this step is very important, please run this first on the master box before continue to the next steps<br />
      mysql&gt; reset master;</p>
<p>   3. Stop the mysql processes on the slave box<br />
      sudo /home/y/bin/mysqladmin shutdown</p>
<p>   4. Scp all the relevant DB files from master box to slave box<br />
      scp -c blowfish -r /home/y/var/mysql/data/db_dir1&#8230; username@slave_box:/home/y/var/mysql/data<br />
      after this is done, change all files owner/group to mysql under /home/y/var/mysql/data on slave box</p>
<p>   5. Start the mysql server on slave box sudo /home/y/bin/mysqld_safe &amp;</p>
<p>   6. Log into the slave box (optional)</p>
<p>   7. Run check tables on command line(optional)<br />
      $&gt; mysqlcheck &#8211;all-databases<br />
      make sure the above give you ok status</p>
<p>   8. run &#8220;select count() from some_replicated_table&#8221; to compare the slave DB with the master DB<br />
      * to confirm they have the same data content</p>
<p>   9. Now it is good to say we have a good copy of the data from the master box</p>
<p>  10. Unlock the tables on the master box<br />
      mysql&gt; unlock tables </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dearsmk.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dearsmk.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dearsmk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dearsmk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dearsmk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dearsmk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dearsmk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dearsmk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dearsmk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dearsmk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dearsmk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dearsmk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dearsmk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dearsmk.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dearsmk.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dearsmk.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=8&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dearsmk.wordpress.com/2008/04/21/how-to-set-up-mysql-replication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/adc9f9b6c9229eab880b44df7351b777?s=96&#38;d=identicon" medium="image">
			<media:title type="html">dearsmk</media:title>
		</media:content>
	</item>
		<item>
		<title>Svn  sync &#8211; Mirroring a Subversion Repository</title>
		<link>http://dearsmk.wordpress.com/2007/10/20/svn-sync-mirroring-a-subversion-repository/</link>
		<comments>http://dearsmk.wordpress.com/2007/10/20/svn-sync-mirroring-a-subversion-repository/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 10:44:37 +0000</pubDate>
		<dc:creator>dearsmk</dc:creator>
				<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://dearsmk.wordpress.com/2007/10/20/svn-sync-mirroring-a-subversion-repository/</guid>
		<description><![CDATA[Mirroring a Subversion Repository As of version 1.4, Subversion provides an &#8220;svnsync&#8221; utility that may be used to create a mirror of a repository. It should be used only for read-only mirrors &#8212; it will break if any changes are committed in the target repository that were not made in the source repository. This is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=6&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Mirroring a Subversion Repository</h2>
<p>As of version 1.4, Subversion provides an &#8220;<tt>svnsync</tt>&#8221; utility that may be used to create a mirror of a repository. It should be used only for read-only mirrors &#8212; it will break if any changes are committed in the target repository that were not made in the source repository. This is primarily useful for backup purposes, or for creating a local mirror used by clients that have no intention of checking in changes, as it is not a trivial operation to check out from one repository and commit to another and it requires manipulation of the mirror repository.</p>
<p>To create a new Subversion repository that is a mirror of an existing repository, do the following:</p>
<ul>
<li>Create a new filesystem directory that will be used to hold the mirror, like:</li>
</ul>
<pre>$ mkdir /mirror/subversion</pre>
<ul>
<li>Use the <tt>svnadmin</tt> utility to create a new repository within that directory, like:</li>
</ul>
<pre>$ svnadmin create /mirror/subversion/OpenDS</pre>
<ul>
<li>The mirror repository must be configured to allow revision properties, and it should only allow those changes by the &#8220;<tt>svnsync</tt>&#8221; user, which can be done by creating a &#8220;<tt>hooks/pre-revprop-change</tt>&#8221; file in that repository with the execute permission set and with the following contents:</li>
</ul>
<pre>#!/bin/sh

if [ "$3" = "guest" ]; then exit 0; fi

echo "Only the guest user may edit revision properties through svnsync" &gt;&amp;2
exit 1</pre>
<ul>
<li>Initialize the mirror repository using the &#8220;<tt>svnsync init</tt>&#8221; command, like:</li>
</ul>
<pre>svnsync init --username guest file:///mirror/subversion/OpenDS https://opends.dev.java.net/svn/opends</pre>
<ul>
<li>Use the &#8220;<tt>svnsync sync</tt>&#8221; command to populate the mirror repository, like:</li>
</ul>
<pre>svnsync sync file:///mirror/subversion/OpenDS</pre>
<ul>
<li>To keep the mirror up to date, periodically re-issue the above &#8220;<tt>svnsync sync</tt>&#8221; command (e.g., using a cron job).</li>
</ul>
<p>See <a href="http://svn.collab.net/repos/svn/trunk/notes/svnsync.txt" class="external">http://svn.collab.net/repos/svn/trunk/notes/svnsync.txt</a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /> for more information on the <tt>svnsync</tt> utility.</p>
<p>&lt;!&#8211;</p>
<p class="block">&#8211;&gt;</p>
<p class="leftmenu">&nbsp;</p>
<h4><a href="https://www.opends.org/wiki//page/Main" class="wikipage">OpenDS Wiki Home</a></h4>
<ul>
<li><a href="https://www.opends.org/wiki//page/About" class="wikipage">About OpenDS </a></li>
<li><a href="https://www.opends.org/wiki//page/OpenDSFAQ" class="wikipage">Project FAQ </a></li>
<li><a href="https://www.opends.org/wiki//page/News" class="wikipage">Project News </a></li>
<li> <a href="https://www.opends.org/wiki//page/HowDoIGetHelp" class="wikipage">How Do I Get Help?</a></li>
<li> <a href="https://www.opends.org/wiki//page/OpenDSUserDocumentation" class="wikipage">User Documentation</a></li>
<li> <a href="https://www.opends.org/wiki//page/OpenDSDeveloperDocumentation" class="wikipage">Developer Documentation</a></li>
</ul>
<h4>Project Site Links</h4>
<ul>
<li><a href="http://www.opends.org/" class="external">OpenDS Home</a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
<li><a href="https://opends.dev.java.net/public/downloads_index.html" class="external">Downloads </a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
<li><a href="https://opends.dev.java.net/public/community_index.html" class="external">Community </a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
<li><a href="https://opends.dev.java.net/servlets/ProjectIssues" class="external">Issue Tracker </a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
</ul>
<h4>Wiki Contributor Resources</h4>
<ul>
<li><a href="https://www.opends.org/wiki/UserPreferences.jsp?tab=profile" class="external">Join the OpenDS Wiki </a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
<li><a href="https://www.opends.org/wiki//page/WriteAHowTo" class="wikipage">Creating a Page</a></li>
<li><a href="http://doc.jspwiki.org/2.4/wiki/TextFormattingRules" class="external">Text Formatting Rules</a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
<li><a href="https://www.opends.org/wiki//page/TextFormattingTips" class="wikipage">Text Formatting Tips</a></li>
<li><a href="https://www.opends.org/wiki//page/StyleSuggestions" class="wikipage">Style Suggestions</a></li>
<li><a href="https://www.opends.org/wiki//page/WikiEtiquette" class="wikipage">Wiki Etiquette </a></li>
<li><a href="https://www.opends.org/wiki//page/ContributorsAndReusersRightsAndResponsibilities" class="wikipage">Contributors&#8217; and Reusers&#8217; Rights and Responsibilities</a></li>
<li><a href="http://www.jspwiki.org/Wiki.jsp?page=OneMinuteWiki" class="external">What is Wiki?</a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
<li><a href="http://sandbox.jspwiki.org/" class="external">JSPWiki.org Sandbox </a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /></li>
<li><a href="https://www.opends.org/wiki//page/ToDo" class="wikipage">To Do</a></li>
</ul>
<h4>Wiki Info</h4>
<ul>
<li><a href="https://www.opends.org/wiki//page/RecentChanges" class="wikipage">Recent Changes</a></li>
<li><a href="https://www.opends.org/wiki//page/FindPage" class="wikipage">Find pages</a></li>
<li><a href="https://www.opends.org/wiki//page/PageIndex" class="wikipage">Page Index</a></li>
</ul>
<p><a href="https://www.opends.org/wiki//page/Feedback" class="wikipage">Leave Feedback </a><br />
<a href="https://www.opends.org/wiki//page/TermsOfUse" class="wikipage">Terms of Use</a></p>
<p class="username">&nbsp;</p>
<p class="pageactions">                                                                                                <span>                    <a href="https://www.opends.org/wiki//PageInfo.jsp?page=MirroringASubversionRepository" class="pageinfo">Page Info</a>                </span>       <span>                   <a href="https://www.opends.org/wiki/Wiki.jsp?page=MirroringASubversionRepository&amp;skin=print">Print Friendly</a>                </span>                             <span>           <a href="https://www.opends.org/wiki//page/UserPreferences" class="wikipage">My Prefs</a>         </span>                                      <span>           <a href="https://www.opends.org/wiki//Login.jsp">Log in</a>         </span>                                                     <span class="quick2Top"><a href="https://www.opends.org/wiki/Wiki.jsp?page=MirroringASubversionRepository&amp;skin=print#Top" title="Go to Top"> </a></span></p>
<p class="pageInfo">                     This page (revision-2) last changed on            <a href="https://www.opends.org/wiki//Diff.jsp?page=MirroringASubversionRepository&amp;r1=2&amp;r2=1">              20:56 05-May-2007            </a>            by <a href="https://www.opends.org/wiki//page/NeilWilson" class="wikipage">NeilWilson</a>.</p>
<p><span class="quick2Bottom"><a href="https://www.opends.org/wiki/Wiki.jsp?page=MirroringASubversionRepository&amp;skin=print#Bottom" title="Go to Bottom"> </a></span></p>
<p class="leftmenufooter">&nbsp;</p>
<h4>What Links Here</h4>
<p><a href="https://www.opends.org/wiki//page/SubversionTipsAndTricks" class="wikipage">Subversion Tips And Tricks</a></p>
<p class="wikiversion">JSPWiki v2.4.102</p>
<p class="rssfeed"><a href="https://www.opends.org/wiki//rss.rdf"><img src="https://www.opends.org/wiki//images/xml.png" alt="[RSS]" border="0" /></a></p>
<p class="pageactions">                                                                                                <span>                    <a href="https://www.opends.org/wiki//PageInfo.jsp?page=MirroringASubversionRepository" class="pageinfo">Page Info</a>                </span>       <span>                   <a href="https://www.opends.org/wiki/Wiki.jsp?page=MirroringASubversionRepository&amp;skin=print">Print Friendly</a>                </span>                             <span>           <a href="https://www.opends.org/wiki//page/UserPreferences" class="wikipage">My Prefs</a>         </span>                                      <span>           <a href="https://www.opends.org/wiki//Login.jsp">Log in</a>         </span>                                                     <span class="quick2Top"><a href="https://www.opends.org/wiki/Wiki.jsp?page=MirroringASubversionRepository&amp;skin=print#Top" title="Go to Top"> </a></span></p>
<p class="pageInfo">                     This page (revision-2) last changed on            <a href="https://www.opends.org/wiki//Diff.jsp?page=MirroringASubversionRepository&amp;r1=2&amp;r2=1">              20:56 05-May-2007            </a>            by <a href="https://www.opends.org/wiki//page/NeilWilson" class="wikipage">NeilWilson</a>.</p>
<p><span class="quick2Bottom"><a href="https://www.opends.org/wiki/Wiki.jsp?page=MirroringASubversionRepository&amp;skin=print#Bottom" title="Go to Bottom"> </a></span></p>
<p class="copyright"><strong>Did This Article Answer Your Questions?</strong>If not, please click <a href="mailto:docs@opends.dev.java.net" class="external">&#8220;Add Comment&#8221;</a><img src="https://www.opends.org/wiki//images/out.png" class="outlink" /> to enter topic requests, example requests, or any general (constructive) comments about this article.</p>
<p class="copyright">&nbsp;</p>
<p class="small"> By any use of this Wiki, you agree to be bound by this website&#8217;s <a href="https://www.opends.org/wiki//page/TermsOfUse" class="wikipage">Terms of Use</a>. Copyright 1994-2007 Sun Microsystems, Inc.</p>
<p class="wikiversion">&nbsp;</p>
<p style="clear:both;height:0;">&nbsp;</p>
<p style="clear:both;height:0;">&nbsp;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dearsmk.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dearsmk.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dearsmk.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dearsmk.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dearsmk.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dearsmk.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dearsmk.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dearsmk.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dearsmk.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dearsmk.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dearsmk.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dearsmk.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dearsmk.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dearsmk.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dearsmk.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dearsmk.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=6&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dearsmk.wordpress.com/2007/10/20/svn-sync-mirroring-a-subversion-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/adc9f9b6c9229eab880b44df7351b777?s=96&#38;d=identicon" medium="image">
			<media:title type="html">dearsmk</media:title>
		</media:content>

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />

		<media:content url="https://www.opends.org/wiki//images/xml.png" medium="image">
			<media:title type="html">[RSS]</media:title>
		</media:content>

		<media:content url="https://www.opends.org/wiki//images/out.png" medium="image" />
	</item>
		<item>
		<title>SVN Setup</title>
		<link>http://dearsmk.wordpress.com/2007/10/20/svn-setup/</link>
		<comments>http://dearsmk.wordpress.com/2007/10/20/svn-setup/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 08:21:06 +0000</pubDate>
		<dc:creator>dearsmk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dearsmk.wordpress.com/2007/10/20/svn-setup/</guid>
		<description><![CDATA[Setting up a SVN 1.4 server using Apache 2.2 on Ubuntu To setup svn 1.4 , we need to compile both apache 2.2 and svn 1.4 from source. This how to has been tested under Ubuntu Dapper and Edgy. sudo apt-get install build-essential libneon25-dev autoconf libtool -y --force-yes Before starting make sure you have removed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=5&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2><a href="http://ajopaul.wordpress.com/2006/12/11/setting-up-a-svn-14-server-using-apache-22-on-ubuntu/" rel="bookmark" title="Setting up a SVN 1.4 server using Apache 2.2 on Ubuntu">Setting up a SVN 1.4 server using Apache 2.2 on Ubuntu</a></h2>
<p>To setup svn 1.4 , we need to compile both apache 2.2 and svn 1.4 from source.<br />
This how to has been tested under Ubuntu Dapper and Edgy.</p>
<p><strong><code>sudo apt-get install build-essential libneon25-dev autoconf libtool -y --force-yes </code></strong></p>
<p>Before starting make sure you have removed previous apache2 and subversion installation from your system.<br />
To do this:<br />
<code>sudo apt-get --purge remove apache2 subversion<br />
sudo mv /etc/init.d/apache2 $HOME/apache2_bak</code></p>
<p><code>cd $HOME<br />
mkdir softwares<br />
cd softwares</code></p>
<p><code>wget http://www.zlib.net/zlib-1.2.3.tar.gz<br />
tar xvfz zlib-1.2.3.tar.gz<br />
cd zlib-1.2.3/<br />
./configure –prefix=/usr/local<br />
make<br />
sudo make install </code></p>
<p><code>cd ..<br />
wget http://apache.forbigweb.com/httpd/httpd-2.2.3.tar.gz<br />
tar xvfz httpd-2.2.3.tar.gz<br />
cd httpd-2.2.3/<br />
./buildconf</code></p>
<p><code>./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-dav --enable-so --enable-maintainer-mode</code></p>
<p><code>make<br />
sudo make install</code></p>
<p><code>sudo /usr/local/apache2/bin/apachectl start </code><br />
Now test your apache2! goto browser and type http://localhost, you should see it works!!</p>
<p><code>sudo /usr/local/apache2/bin/apachectl stop</code></p>
<p><code><br />
sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/apachectl<br />
sudo chmod +x /etc/init.d/apachectl </code></p>
<p>We just need to add a few lines to the file for it to work nicely:<br />
<code><br />
sudo vi /etc/init.d/apachectl </code></p>
<p>Add the followinig, so the top of the file looks like:</p>
<p><code>#!/bin/sh<br />
#<br />
# chkconfig: - 85 15<br />
# description: Apache is a web server. </code><br />
Save the file.</p>
<p><code>sudo /usr/sbin/update-rc.d apachectl defaults</code></p>
<p>Securing Apache</p>
<p>It?s also a good idea to create a dedicate Apache system user account. It?ll make your install much more secure.</p>
<p><code>sudo adduser --system apache </code></p>
<p>Now we just need to make sure that Apache runs under this user. We do that by editting the configuration file:</p>
<p><code>sudo vi /usr/local/apache2/conf/httpd.conf</code></p>
<p>You need to find the lines that say:</p>
<p>User daemon<br />
Group daemon</p>
<p>And change them so they look like:</p>
<p>User apache<br />
Group nogroup</p>
<p><code>sudo /usr/local/apache2/bin/apachectl start</code></p>
<p><strong>Installing Subversion 1.4</strong></p>
<p>As we have built Apache from source, we’ll need to do the same for Subversion in order to get the Apache 2 modules mod_dav_svn and mod_authz_svn.<br />
<code><br />
# rm -f /usr/local/lib/libsvn*<br />
# rm -f /usr/local/lib/libapr*<br />
# rm -f /usr/local/lib/libexpat*<br />
# rm -f /usr/local/lib/libneon*</code></p>
<p>#Get the latest svn tar ball<br />
<code>wget http://subversion.tigris.org/downloads/subversion-1.4.2.tar.gz<br />
tar xvfz subversion-1.4.2.tar.gz<br />
cd subversion-1.4.2/</code></p>
<p><code>sh autogen.sh</code></p>
<p><code>./configure --prefix=/usr/local --with-apxs=/usr/local/apache2/bin/apxs --with-httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr</code></p>
<p><code>make<br />
sudo make install </code></p>
<p>This will also add the relevant LoadModule directives into your Apache 2 configuration for you.<br />
Creating your repository</p>
<p>Now, create your Subversion repository:</p>
<p><code>svnadmin create /home/yourusername/subversion/repos</code></p>
<p>We have to make that repository owned by Apache so that it can be accessed via the web:</p>
<p><code>sudo chown -R apache /home/yourusername/subversion/repos</code></p>
<p>Authentication File</p>
<p>Now create a user/password file for authentication:</p>
<p><code>/usr/local/apache2/bin/htpasswd -cm /home/yourusername/subversion/dav_svn.passwd yourusername</code></p>
<p>When prompted, enter your password.<br />
Configuring Apache</p>
<p>Edit your<code> /usr/local/apache2/conf/httpd.conf</code> file with the following placed at the end:</p>
<p><code><br />
&lt;Location /svn&gt;<br />
DAV svn<br />
SVNPath /home/yourusername/subversion/repos<br />
AuthType Basic<br />
AuthName “Subversion Repository”<br />
AuthUserFile /home/yourusername/subversion/dav_svn.passwd<br />
Require valid-user<br />
&lt;/Location&gt;<br />
</code></p>
<p>If you want access control based on different users, add the following line after the Require valid-user line:</p>
<p>AuthzSVNAccessFile /home/yourusername/subversion/svn_access_control</p>
<p><strong>To setup a local mirror using svnsync</strong></p>
<p>To have a mirror setup first ensure that the local repo you are going to use as the mirror should have the same uuid as that of the master.</p>
<p>To get uuid of a repo, go to its working copy and type<br />
<code>svn info</code></p>
<p>now make the mirror svn’s uuid same as masters uuid, you can get the uuid by  typing<br />
<code>svn info URL/PATH</code></p>
<p>cat &#8211; &lt;&lt;EOF | sudo svnadmin load –force-uuid dest<br />
SVN-fs-dump-format-version: 2</p>
<p>UUID: d48dd586-eb1d-0410-b581-e6e13afcedeb<br />
EOF</p>
<p><code>cd /home/ajopaul/subversion/repos/hooks/<br />
vi pre-revprop-change<br />
sudo vi pre-revprop-change</code><br />
Add the following lines<br />
<code>#!/bin/sh<br />
USER=”3″<br />
if [ “USER” = “svnsync” ]; then exit 0; fi<br />
echo “Only svnsync user can change revprops” &gt;&amp;2<br />
exit 1 </code></p>
<p><code>sudo chmod +x pre-revprop-change</code></p>
<p><code>sudo svnsync init --username your_master_svn_username file:///home/ajopaul/subversion/repos http://xxx.xxx.xxx.xxx/svn</code></p>
<p><code>sudo svn proplist --revprop -r 0 http://xxx.xxx.xxx.xxx/svn</code></p>
<p><code>sudo svn propget file:///home/yourusername/subversion/repos --revprop -r 0 http://xxx.xxx.xxx.xxx/svn</code></p>
<p><code>time sudo svnsync sync file:///home/yourusername/subversion/repos </code><br />
<strong><br />
Remember! local mirrors is/should be read only<br />
</strong><br />
To ensure no commits happen on the local mirror add the following lines to hooks/pre-commit script<br />
<code><br />
#!/bin/sh<br />
SVNLOOK=/usr/local/bin/svnlook<br />
USER=`SVNLOOK author -t $3 $1`<br />
if [ “$USER” = “svnsync” ]; then<br />
exit 0;<br />
fi<br />
echo “Sorry no commit allowed on mirror! use ’svn switch’ to point to master repo and then point back to local mirror after the commit” &gt;&amp;2<br />
exit 1 </code></p>
<p>If by any chance your svnsync locks ur mirror repo or if you recieve a message such as:<br />
Failed to get lock on destination repos, currently held by ….<br />
Type this<br />
<code>svn propdel svn:sync-lock --revprop -r 0 file:///home/ajopaul/subversion/repos/</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dearsmk.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dearsmk.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dearsmk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dearsmk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dearsmk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dearsmk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dearsmk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dearsmk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dearsmk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dearsmk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dearsmk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dearsmk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dearsmk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dearsmk.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dearsmk.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dearsmk.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=5&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dearsmk.wordpress.com/2007/10/20/svn-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/adc9f9b6c9229eab880b44df7351b777?s=96&#38;d=identicon" medium="image">
			<media:title type="html">dearsmk</media:title>
		</media:content>
	</item>
		<item>
		<title>php Tips</title>
		<link>http://dearsmk.wordpress.com/2007/08/09/php-guys/</link>
		<comments>http://dearsmk.wordpress.com/2007/08/09/php-guys/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 15:49:28 +0000</pubDate>
		<dc:creator>dearsmk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dearsmk.wordpress.com/2007/08/09/php-guys/</guid>
		<description><![CDATA[Turn On Error Reporting Immediately The single most important thing I tell people who use PHP is to turn error reporting to its maximum level. Why would I want to do this? Generally the error reporting is set at a level that will hide many little things like: * declaring a variable ahead of time, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=3&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> Turn On Error Reporting Immediately</p>
<p>The single most important thing I tell people who use PHP is to turn error reporting to its maximum level. Why would I want to do this? Generally the error reporting is set at a level that will hide many little things like:</p>
<p>* declaring a variable ahead of time,<br />
* referencing a variable that isn’t available in that segment of code, or<br />
* using a define that isn’t set.</p>
<p>These factors might not seem like that big a deal &#8212; until you develop structured or object oriented programs with functions and classes. Too often, writing code with the error reporting turned up high would cost your hours as you scoured long functions that didn’t work because a variable was misspelled or not accessible.</p>
<p>PHP won’t tell you anything in that case – it’ll just create the new variable for you and initialize it to zero. The remedy is to put the following line at the top of every PHP document as you develop:</p>
<p>error_reporting(E_ALL);</p>
<p>It simply forces the error reporting to be at its highest level. Try putting this line in other PHP programs, and more often than not you’ll receive a barrage of warning messages that identify all the potentially wrong elements of the code.<br />
Single Quotes and Double Quotes are Very Different</p>
<p>I never recommend using &#8221; (double quotes) when programming with PHP. Always use &#8216; (single quotes) unless you need the features of &#8221; (double quotes). You might think it&#8217;s much easier to write code as:</p>
<p>echo &#8220;Today is the $day of $month&#8221;;</p>
<p>However, using single quotes forces variables to be outside the quotes; instead, you must use the period (.) to combine strings. It makes for faster coding but can be more difficult for other programmers to read. Let’s look at what would happen if we put an associative array value in the previous code:</p>
<p>echo &#8220;Today is the $date[‘day’] of $date[‘month’]&#8220;;</p>
<p>You would receive a parse error and it would be harder for another team member to read. Two correct ways to write that line of code would be:</p>
<p>echo &#8216;Today is the &#8216; . $date[‘day’] . &#8216; of &#8216; . $date['month'];</p>
<p>and</p>
<p>echo &#8220;Today is the {$date['day']} of {$date['month']}&#8221;;</p>
<p>These might not look as pretty as the original code, but syntactically they are both correct. Additionally, I believe the first method, with single quotes, is easier to read.</p>
<p>The use of single and double quotes also applies to associative arrays. Consider this code:</p>
<p>$SESSION[team] = $SESSION["old_team"];</p>
<p>One main problem exists in that line of code. The associative entry team on the left side needs to have single quotes around it; otherwise, PHP will think it’s a define and give you a warning message (only if error reporting is at maximum). I would recommend that the code should look like this:</p>
<p>$SESSION['team'] = $SESSION['old_team'];</p>
<p>I wish I’d known the difference between single and double quotes as they pertain to strings when I first learned PHP.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dearsmk.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dearsmk.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dearsmk.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dearsmk.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dearsmk.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dearsmk.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dearsmk.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dearsmk.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dearsmk.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dearsmk.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dearsmk.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dearsmk.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dearsmk.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dearsmk.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dearsmk.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dearsmk.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dearsmk.wordpress.com&amp;blog=1495264&amp;post=3&amp;subd=dearsmk&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dearsmk.wordpress.com/2007/08/09/php-guys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/adc9f9b6c9229eab880b44df7351b777?s=96&#38;d=identicon" medium="image">
			<media:title type="html">dearsmk</media:title>
		</media:content>
	</item>
	</channel>
</rss>
