<?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>That Chris Brown's Blog &#187; Internet</title>
	<atom:link href="http://www.thatchrisbrown.com/category/internet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thatchrisbrown.com</link>
	<description>Another Chris Brown &#38; another blog</description>
	<lastBuildDate>Sat, 03 Apr 2010 13:05:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress backups with bash scripts</title>
		<link>http://www.thatchrisbrown.com/2009/wordpress-backups-with-bash-scripts/</link>
		<comments>http://www.thatchrisbrown.com/2009/wordpress-backups-with-bash-scripts/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 11:29:10 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.thatchrisbrown.com/?p=93</guid>
		<description><![CDATA[In memory of WordPress Backup Week four years ago, I thought I'd knock up a little script to backup my WordPress database and file content.  It's rough and untidy, but it seems ot [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Fwordpress-backups-with-bash-scripts%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Fwordpress-backups-with-bash-scripts%2F&amp;source=thatchrisbrown&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In memory of <a href="http://codex.wordpress.org/User:Lorelle/Backup_Week" target="_blank">WordPress Backup Week</a> four years ago, I thought I&#8217;d knock up a little script to backup my WordPress database and file content.</p>
<p>You might be wondering why I&#8217;d want to script it, seeing as there&#8217;s plenty of Wordpress plugins to backup your Wordpress content from the safe confines of WordPress administration. </p>
<p>Well, my thinking was that anything that is activated by a plugin in WordPress is fine if WordPress is working.  If it is completely out-of-action, you&#8217;re going to have to recover your backup from the command line.  I&#8217;m comfortable with the command line and a bit of (low quality) shell scripting, so why not roll my own simple backup that grabs all the file and database content and makes a backup file out of it?  Besides, while the Wordpress Mobile Pack gives you the administration essentials, it&#8217;s not great at handling plugins, and I quite like the idea of being able to perform an emergency restore with nothing but a Smartphone or PDA with a copy of <a href="http://www.pocketputty.net/" target="_blank">Pocket PuTTY</a> installed on it.</p>
<p>There&#8217;s advice on WordPress backups on the <a href="http://codex.wordpress.org/WordPress_Backups" target="_blank">Codex</a>, which makes a good starting point.  I also found some old script examples <a href="http://ocaoimh.ie/simple-mysql-backup/" target="_blank">here</a>.  Time to do a bit of modifying!  I liked the original idea of having a 7-day rolling backup set to prevent disk space being overrun, but I also liked the idea of backups stamped with the date they were taken, to ease any restore.  So, I decided that it would be simple to adjust the script to still create 7 day-of-week folders and just store the backed-up content in a compressed tar archive using the date taken as the filename.</p>
<p>There were a few more changes I made to the code.  While I appreciate the &#8216;clean&#8217; approach of putting usernames and passwords in a separate file, anyone finding the script would soon see where to look to find those details, so it&#8217;s not adding much in the way of security.  I also made a few tweaks to the MySQL commands used to get the table listing.</p>
<p>Here&#8217;s the code I got to:</p>
<pre class="brush:bash">#!/bin/bash # MYSQL Backup Script
# Contains portions of code and ideas from http://blogs.linux.ie/xeer/2005/06/28/simple-mysql-backup/
# and http://ocaoimh.ie/simple-mysql-backup/
# Get day of week to keep 7 rolling backups sequence, and date to name tgz files for ease of identification export d=$(date +%Y-%m-%d) export s=$(date +%u)
# Set up the paths that we're going to use for source and backup
export wppath=/var/www/html
export savepath=/var/www/backup
export tmppath=/tmp/wpback-$s-$d
# The wp database to backup
export db=wp_myblog
# Username and password for the wp database - SUGGEST A READ-ONLY USER IS USED!
export wpuser=wp_backupuser
export wppass=MyP4sswordG0esH3re
# Tell syslog and any interative user that we're running
logger "Wordpress backup script backing up $wppath to $savepath/$s/$d.tgz"
echo "Wordpress backup script backing up $wppath to $savepath/$s/$d.tgz"
# Make the temporary backup path
mkdir -p $tmppath
echo "Dumping database: $db..."
for tab in `mysql --user=$wpuser --password=$wppass -s -e "show tables;" $db`;
do
echo "Dumping table: $tab"        
mysqldump --user=$wpuser --password=$wppass --add-drop-table --allow-keywords -q -a -c $db $tab &gt; $tmppath/$tab.sql
done
echo "Archiving Wordpress file content..."
tar -cpf $tmppath/wp-files.tar $wppath/
# Clear and remake the backup path
rm -rf $savepath/$s
mkdir -p $savepath/$s
echo "Compressing database and files into $savepath/$s/$d.tgz"
tar -czf $savepath/$s/$d.tgz $tmppath/*
echo "Deleting temporary files"
rm -rf $tmppath
echo "Wordpress backup complete"</pre>
<p> So, what does the code do?  Well, first the date tool is used to obtain the day of week and date string, then a few user-modifiable strings define where to back up Wordpress content from, where to make temporary files and where to save the backup archive.  The script quickly informs any interative user, and the system log, that it is running then we get to the important bit.</p>
<p>The MySQL command-line client is called, specifying the username and password, using the -s parameter to tell the client to output a simple listing with one result per line, and the -e parameter with the command to execute, in this case &#8220;show tables&#8221; and finally the database to execute the command against.  This fills the tab script variable with a list of tables to back up.</p>
<p>A temporary location is created to store the database tables and files until the final backup file is created.</p>
<p>Next, the MySQL dump client is called once for each table, again supplying username and password, and with parameters indicating that the dump should create a file that deletes any existing table before inserting data, and ignores any reserved words it sees, and stores the results for each table in a text file in the temporary location.</p>
<p>Then, the Wordpress content directory is archived using the tar utility, specifying to preserve premissions attributes.  This backup is not compressed, as the script then goes on to clear any existing day-of-week directory, and creates the final backup archive in there as a compressed tar archive containing all the SQL table dumps and the single WordPress file archive just created.</p>
<p>Finally, the script clears out the temporary location it created.</p>
<p>To use the script, it needs to be downloaded to a place outside of your WordPress content area (so it can&#8217;t be viewed by visitors to your web site), and given suitable permissions to run, with a command such as such as &#8220;chmod 744 wp_backup.sh&#8221;.</p>
<p>The lines at the top of the script that define wppath (WordPress files location), savepath (place to put the day-of-week directories), tmppath (place to put temporary files), db (MySQL database to backup), wpuser (MySQL user account for backing up) and finally wppass (MySQL user password) will need to be edited to suit the local WordPress and MySQL installations.</p>
<p>Next the MySQL user account needs to be created.  For a little bit of extra security, I recommend using a dedicated user account with read-only access to the database.  This is easy to create.  Simply start the MySQL client with the -p parameter (type <strong>mysql -p</strong> from a shell prompt) and enter you MySQL root password when prompted.  Next create a user account and grant read rights with the command <strong>GRANT SELECT, LOCK TABLES on wp_myblog.* TO </strong><a href="mailto:'wp_backupuser'@'localhost'"><strong>&#8216;wp_backupuser&#8217;@'localhost&#8217;</strong></a><strong> IDENTIFIED BY &#8221;MyP4sswordG0esH3re&#8221;;</strong></p>
<p>The script will execute from the shell, and will display some progress as it goes.</p>
<p>To automate the process with cron, simply type crontab -e to edit the cron table, and add a line like this:</p>
<pre>1 0 * * * /var/www/domains/thatchrisbrown.com/www/backup/wp_backup.sh</pre>
<p>This tells cron to call the script at one minute past midnight every day.  You can verify the script has run my looking in the /var/log/messages file for the script announcing itself when run.</p>
<p><em>Disclaimer: This was written on a CentOS 5.3 box using fairly standard installs of Apache, PHP, MySQL and Wordpress.  Your environment may vary, so some elements may need adjusting to suit.  This script and its author makes no claims to fitness, usability, suitability for any specific purpose, safety or neatness, ingenuity, tidiness or prettiness of code.  You use it at your own risk.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thatchrisbrown.com/2009/wordpress-backups-with-bash-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>And I thought Microsoft Word could be frustrating!</title>
		<link>http://www.thatchrisbrown.com/2009/and-i-thought-microsoft-word-could-be-frustrating/</link>
		<comments>http://www.thatchrisbrown.com/2009/and-i-thought-microsoft-word-could-be-frustrating/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 14:50:50 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.thatchrisbrown.com/?p=81</guid>
		<description><![CDATA[
			
				
			
		
<p>You know when Word does stupid things, like changing the formatting of a whole paragraph when you simply edit a tiny piece of content, like a single word or sentence?  Well, it seems the Wordpress editor is just as bad.  I&#8217;ve just had to flip dozens of revisions and manually edit the HTML content to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Fand-i-thought-microsoft-word-could-be-frustrating%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Fand-i-thought-microsoft-word-could-be-frustrating%2F&amp;source=thatchrisbrown&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>You know when Word does stupid things, like changing the formatting of a whole paragraph when you simply edit a tiny piece of content, like a single word or sentence?  Well, it seems the Wordpress editor is just as bad.  I&#8217;ve just had to flip dozens of revisions and manually edit the HTML content to fix an issue that started when embedding an image, then editing its properties afterwards.  Wordpress started sticking post body text into the picture caption, almost randomly.</p>
<p>I <em>think</em> I&#8217;ve got it right now.  If the previous post looks odd (missing pictures, blocks of text in captions etc), do let me know and I&#8217;ll try to sort it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thatchrisbrown.com/2009/and-i-thought-microsoft-word-could-be-frustrating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protecting photography displayed online through branding</title>
		<link>http://www.thatchrisbrown.com/2009/protecting-photography-displayed-online-through-branding/</link>
		<comments>http://www.thatchrisbrown.com/2009/protecting-photography-displayed-online-through-branding/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 21:53:58 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[branding]]></category>
		<category><![CDATA[copyright]]></category>

		<guid isPermaLink="false">http://www.thatchrisbrown.com/?p=25</guid>
		<description><![CDATA[Some thoughts prompted by an article in Layers Magazine, on preventing copyright theft of images displayed [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Fprotecting-photography-displayed-online-through-branding%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Fprotecting-photography-displayed-online-through-branding%2F&amp;source=thatchrisbrown&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>A quick post prompted by an article in Layers magazine <a title="Protecting What’s Yours" href="http://www.layersmagazine.com/protecting-whats-yours.html" target="_blank">online</a>.  While I agree with the spirit of the article, and applaud the use of a high-profile site to remind artists and photographers to take steps to protect their work from copyright theft, I think some of the suggested protections are counterproductive, as even the article sort of admits in places.</p>
<p>Take  image sizes displayed online as an example.  Average screen sizes and display resolutions are getting bigger, and an 800 x 600 picture is no longer going to fill many viewer&#8217;s displays.  While sites like <a title="Flickr" href="http://www.flickr.com/" target="_blank">Flickr</a> will upscale a small image in the slideshow function, that upsizing is going to introduce some loss of quality.  Do you want to show your work off in a way that will likely decrease the perceived quality?</p>
<p>Speaking of which, over-compressing the JPEG file as an anti-theft mesaure?  Call me an old cynic if you like, but have you been to retailers like Next in the UK and had a close look at the images they sell ready-framed up as ready-to-hang artwork?  OK, they may only be £30 or so, but all the same, there&#8217;s some pretty nasty JPEG and/or upscaling artifacting going on in all of the ones I&#8217;ve seen.</p>
<p>So, keeping a small image size and adding JPEG compression artifacts isn&#8217;t going to put people off, not if they&#8217;ye already paying £30 for a badly-printed, poor-quality image in a wooden frame made in some cheap third-world factory.  Sad though it is, is you want some protection from abuse of your images that you put online, I think branding is the only way to add a modicum of security.</p>
<p>Years ago, I started branding with a small, discreet footer added to my pictures.  This started off as plain white text, in a rather nasty font, and later got slightly neater with a sans-serif font in white on a trasparent black bar, so it blended in the bottom of the image slightly more.  However, seeing examples where footers had just been cropped out by the abusers, I decided it was time to do something more difficult to erase.</p>
<p>I now have a Photoshop action that adds a white text footer on a 50% opaque black bar, and another that adds large 10% opaque white text right across the middle of an image.  It&#8217;s not often that an image is useful without the middle, so it&#8217;s pretty crop-proof.  This lets me still save at up to 1024 pixels, and fairly good quality levels; I tend to use Photoshop quality level 10 or the Lightroom equivalent for the web.  I&#8217;ve automated these using a droplet so I can invoke as a post-export action from Lightroom, which hopefully I&#8217;ll expand on a bit a future post. Ideally I&#8217;d like to set it up using ActionScript, so it can look at the metadata and stamp the right year on the file itself, and accomodate wildly differing image sizes automatically; another future post topic, should I ever get that working!</p>
<p>See some examples of this branding approach on my Flickr <a title="My Flickr photostream" href="http://www.flickr.com/photos/seebrown99/" target="_blank">Photostream</a>.  I don&#8217;t think it&#8217;s terribly intrusive, nor do I think it spoils the picture too badly.  I&#8217;d be interested to see any comments from other photographers and digital artists.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thatchrisbrown.com/2009/protecting-photography-displayed-online-through-branding/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Aggregating social networks</title>
		<link>http://www.thatchrisbrown.com/2009/aggregating-social-networks/</link>
		<comments>http://www.thatchrisbrown.com/2009/aggregating-social-networks/#comments</comments>
		<pubDate>Thu, 28 May 2009 11:25:28 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Social]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.thatchrisbrown.com/?p=16</guid>
		<description><![CDATA[Jim Goldstein's excellent article on social media connectivity chimed with my recent thoughts on social network overlaps and how to manage [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Faggregating-social-networks%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thatchrisbrown.com%2F2009%2Faggregating-social-networks%2F&amp;source=thatchrisbrown&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Having recently started a blog, and being a Twitter, Facebook and Flickr user, as well as a user of a few classic Internet forums, I had been thinking about the integration between the three, and how the &#8220;venn diagrams&#8221; of those various social groups overlap, and how that overlap affects what I post where, and how I should best cater to that &#8211; through aggregation or by keeping worlds apart?</p>
<p>Jim Goldstein&#8217;s excellent <a title="The Birds and the Bees of Social Media Connectivity" href="http://www.jmg-galleries.com/blog/2009/05/28/the-birds-and-the-bees-of-social-media-connectivity/" target="_blank">article</a> on social media connectivity set my thinking off again; thanks Jim!</p>
<p>Our online social networks come from a variety of places.  In the days before &#8220;Web 2.0&#8243; and the social web, my main way of getting to know strange people on the Internet was through forums.  If I was interested in a specific brand of car, I&#8217;d find forums where like-minded people would talk mainly about cars, but sometimes also about other interesting stuff like computing, photography etc.  As an active member of several forums, I ended up with a few separate and disparate social networks, with little overlap save for the few people who were on more than one of the same forums as I was, and when the inevitable forum split happens, and some people decided to join both camps.  The overlap of various groups had started.</p>
<p>Some of those forum friends pointed me towards Flickr, and once there I found people from other forums I was involved in; more overlap.</p>
<p>I started on Facebook at the invitation of an old friend from college days, who now lives in Canada.  It seemed like an interesting way to keep in touch with groups of people, so much easier than email.  I found a few disparate friends who were also Facebook users, and then family members, and extended family members and over time, groups of friends from those forums, and people I&#8217;ve worked with, including (frighteningly) ex-employees.  The venn diagram got yet more complex.</p>
<p>I&#8217;ll admit I first looked at Twitter when I found out that @<a href="http://twitter.com/stephenfry">stephenfry</a> uses it; must be worth a peek if a technophile such as he is using it, surely?  Having gone through the stage of posting trivia about my daily activities, I found people that I knew from Facebook or Forums, and then some people I&#8217;d never heard of started following me, and curiosity led me to look at their Twitter feeds and start following some of them too, and their other followers and followees.</p>
<p>The diagram of various social networks, and where they overlap is now getting beyond something I can easily visualise in my head!  This in itself presents some interesting issues about managing your social media output.  Should you post about your weekend adventures with late nights and alcohol for the enjoyment of friends, when family members are following your feed?  Disabusing your parents and aunts/uncles of the notion that you&#8217;re still that sweet little child they remember is one thing, but when impressionable younger members of your family are also following your feeds, you find yourself having to mentally check off every update against all those lists of people.</p>
<p>And then there&#8217;s the people you know.  I know of an incident fairly recently where a Facebook user who I know from one of those forum groups (but isn&#8217;t a Facebook friend) posted an innocuous status update on Facebook, and was quite thoroughly and crudely &#8216;graffitied&#8217; in the comments by a group of people from the forum, in a way that wasn&#8217;t compatible with family Facebook friends.  Mix your social networks with care; would you invite your drinking buddies round to a family gathering like a christening or wedding?  You&#8217;re possibly doing the equivalent thing online&#8230;</p>
<p>And then we come to blogs.  I&#8217;d like to blog about photography, because that&#8217;s a hobby of mine, and a Tweet is just too short to say it all.  Besides, I&#8217;d quite like to be able to steer the discussion elements of that process a bit more than I could on the likes of Twitter or facebook, or even Flickr (the home of &#8220;Oooh and aaah&#8221; feedback on even quite poor photographs that have been added to the right groups).  I also might like to blog about my adventures with Linux, networking, virtualisation, and making web servers and blogs work.  I might even be compelled to blog one day about my passion for cars, my love for my car and how motoring fits into the world of recessionary and environmental restraint.  I&#8217;m certainly going to want to stand on my soap box and put the world to rights at some point!</p>
<p>So, do I have one blog like this, with a mixture of posts on a mixture of topics, or do I have multiple blogs, some of which will end up with only a very few posts?  Where is my aggregation point?  Is it Twitter where I have a subset of all my social contacts following me?  Or is it really my blog(s), and then advertise those on Twitter, Facebook et al?  Would people follow a mixed blog if they&#8217;re interested in photography and not Linux?  Will people be able to sift their preferred content from what they see as noise?</p>
<p>In short, should my online persona across those various media be me, or a carefully managed set of me-brands across various topics?  Is the topic the be-all and end-all, or by specialising would I be closing doors to my readers finding new things and exploring new avenues they might not have otherwise considered?  I don&#8217;t propose to have one Twitter account for me the photographer, one for me the car enthusiast, one for me the family member and one for me the ex-college student.  Why should I have separate blogs for those things?</p>
<p>RSS looks like a potential answer.  I looked into having multiple blogs, one per major subject area, and then aggregating those plus general soap box content into a master blog, to give the reader the choice &#8211; follow the master &#8216;me&#8217; blog, or just follow a specific narrow-market one.  Wordpress doesn&#8217;t seem to be geared up to do this natively, though there are ways I could think to do that with a few code tweaks.  RSS would let me set up those separate blogs and just import the topic-specific ones into the master one.  It doesn&#8217;t give me single logon and administration though, but it does allow different branding of each, so there&#8217;s a mixed set of ups and downs to this approach.</p>
<p>If I could provide an RSS feed per category (I haven&#8217;t even looked to see if Wordpress can do this yet), that&#8217;s an alternative method, and allows one post that covers multiple subjects to reach both audiences (say I took photos of my car for example).  This doesn&#8217;t give me the option of branding different categories differently though, although some reseach again shows a few Wordpress tweaks could do just that.</p>
<p>That just leaves the non-technical questions of how much overlap I want between those various groups, and if I want to have multiple online personas, or if I just want the world to see one view of me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thatchrisbrown.com/2009/aggregating-social-networks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
