<?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>dom111.co.uk &#187; mysql</title>
	<atom:link href="http://www.dom111.co.uk/blog/tag/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dom111.co.uk/blog</link>
	<description>Move along. Nothing to see here.</description>
	<lastBuildDate>Wed, 26 Oct 2011 16:37:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SequelPro: Twilight Theme</title>
		<link>http://www.dom111.co.uk/blog/coding/sequelpro-twilight-theme/252</link>
		<comments>http://www.dom111.co.uk/blog/coding/sequelpro-twilight-theme/252#comments</comments>
		<pubDate>Thu, 16 Sep 2010 16:56:21 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sequel pro]]></category>
		<category><![CDATA[sequel pro theme]]></category>
		<category><![CDATA[sequelpro]]></category>
		<category><![CDATA[sequelpro theme]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[twilight]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=252</guid>
		<description><![CDATA[I&#8217;ve been using SequelPro for quite some time. I think it&#8217;s a great app for working with MySQL databases and I love the ability to style the Query Editor. I created a theme (which might only work with the nightly builds&#8230;) that is not entirely disimilar to the Twilight theme for TextMate. Thought I&#8217;d share [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://www.sequelpro.com/">SequelPro</a> for quite some time. I think it&#8217;s a great app for working with MySQL databases and I love the ability to style the Query Editor.</p>
<p>I created a theme (which might only work with the <a href="http://nightly.sequelpro.com/">nightly builds</a>&#8230;) that is not entirely disimilar to the Twilight theme for TextMate.</p>
<p>Thought I&#8217;d share it, in case anyone else would like it too!</p>
<p>It looks like this:<br />
<a href="http://www.dom111.co.uk/blog/wp-content/2010/09/sequel-pro-twilight.jpg"><img class="alignnone size-full wp-image-253" title="SequelPro Twilight Theme" src="http://www.dom111.co.uk/blog/wp-content/2010/09/sequel-pro-twilight.jpg" alt="" width="332" height="285" /></a></p>
<p><a href="/files/sequelpro/twilight.tar.gz">Download it here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/sequelpro-twilight-theme/252/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trackr 0.1 &#8211; jQuery based user interaction tracking (PHP/MySQL)</title>
		<link>http://www.dom111.co.uk/blog/coding/trackr-0-1-jquery-based-user-interaction-tracking-phpmysql/114</link>
		<comments>http://www.dom111.co.uk/blog/coding/trackr-0-1-jquery-based-user-interaction-tracking-phpmysql/114#comments</comments>
		<pubDate>Tue, 28 Jul 2009 13:22:58 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[User Interaction]]></category>
		<category><![CDATA[click tracking]]></category>
		<category><![CDATA[mouse tracking]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tracking]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=114</guid>
		<description><![CDATA[Trackr is a very simple, lightweight (well, if you&#8217;re already using jQuery) user interaction tracker. It&#8217;s not particularly robust and is only in a fairly simple form right now. The back end is written in PHP using MySQL for storage, but could easily be implemented in other languages. To log data, you simply add a [...]]]></description>
			<content:encoded><![CDATA[<p>Trackr is a very simple, lightweight (well, if you&#8217;re already using jQuery) user interaction tracker. It&#8217;s not particularly robust and is only in a fairly simple form right now.</p>
<p>The back end is written in PHP using MySQL for storage, but could easily be implemented in other languages.</p>
<p>To log data, you simply add a call to Trackr.init() to the page load event, passing the desired options as the only parameter to the function.</p>
<p>There are a variety of options that can be specified and for more information please see the <a href="/files/trackr/">test page</a>.</p>
<p>You can get it <a href="/files/trackr/trackr-0.1.tar.gz">here</a> (includes jQuery 1.3.2).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/trackr-0-1-jquery-based-user-interaction-tracking-phpmysql/114/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MySQL backup script</title>
		<link>http://www.dom111.co.uk/blog/coding/mysql-backup-script/30</link>
		<comments>http://www.dom111.co.uk/blog/coding/mysql-backup-script/30#comments</comments>
		<pubDate>Thu, 16 Oct 2008 08:45:30 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=30</guid>
		<description><![CDATA[I&#8217;ve recently been learning more and more about bash scripting and the cool functions and features that are included, that i&#8217;ll probably never use&#8230; I recently had to set up a cron to backup all MySQL databases but I didn&#8217;t want them in one huge file. So I&#8217;ve written a little script, that is probably [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been learning more and more about bash scripting and the cool functions and features that are included, that i&#8217;ll probably never use&#8230;</p>
<p>I recently had to set up a cron to backup all MySQL databases but I didn&#8217;t want them in one huge file.</p>
<p>So I&#8217;ve written a little script, that is probably not entirely efficient, but serves it&#8217;s purpose for us:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># get todays date</span>
<span style="color: #007800;">DATE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%F&quot;</span><span style="color: #000000; font-weight: bold;">`</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># go to the backup directory</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>mysql
&nbsp;
<span style="color: #666666; font-style: italic;"># export the databases, each to it's own file</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># the first echo is sent to mysql, so we're basically echoing SHOW DATABASES; to mysql</span>
<span style="color: #666666; font-style: italic;"># then we're chopping off the first line (sed 1d) and passing the remaining input to</span>
<span style="color: #666666; font-style: italic;"># xargs which accepts \n or space delimited arguments as a list and echo's out the</span>
<span style="color: #666666; font-style: italic;"># string mysqldump -u &lt;username&gt; -p&lt;password&gt; % &gt; %.sql (replacing % with the name) to</span>
<span style="color: #666666; font-style: italic;"># /bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;SHOW DATABASES;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mysql <span style="color: #660033;">-u</span> <span style="color: #000000; font-weight: bold;">&lt;</span>username<span style="color: #000000; font-weight: bold;">&gt;</span> -p<span style="color: #000000; font-weight: bold;">&lt;</span>password<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> 1d <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">--replace</span>=<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;mysqldump -u &lt;username&gt; -p&lt;password&gt; % &gt; %.sql&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># compress the backups</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> czf mysql_backup_<span style="color: #007800;">$DATE</span>.tar.gz <span style="color: #000000; font-weight: bold;">*</span>.sql
&nbsp;
<span style="color: #666666; font-style: italic;"># remove the large .sql files</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">*</span>.sql</pre></div></div>

<p>This was tested on a SuSE 11 server, might need some tweaking on other dists.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/mysql-backup-script/30/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DB</title>
		<link>http://www.dom111.co.uk/blog/coding/db/8</link>
		<comments>http://www.dom111.co.uk/blog/coding/db/8#comments</comments>
		<pubDate>Wed, 23 Jul 2008 22:50:01 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=8</guid>
		<description><![CDATA[Here&#8217;s a little script I&#8217;ve wanted to make for a while, but have only just finally got the motivation to work on. It&#8217;s a lightweight Database wrapper with functions similar to Ruby on Rails&#8217; ActiveRecord. When I discovered the __call() method I wanted to make my own version in PHP, so here it is! It [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little script I&#8217;ve wanted to make for a while, but have only just finally got the motivation to work on.</p>
<p>It&#8217;s a lightweight Database wrapper with functions similar to Ruby on Rails&#8217; ActiveRecord.</p>
<p>When I discovered the __call() method I wanted to make my own version in PHP, so here it is!</p>
<p>It supports most basic functions, all based on the MySQL set of PHP functions, no other wrapper is required (PEAR etc.). There is not (yet?) any automatic mysql_real_escape_string or anything, although that could easily be added if required, my assumption is you&#8217;ve done that kind of thing already before passing anything to it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DB<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql://username:password@server:port/database'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$people</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">table</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'people'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$companies</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">table</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'companies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$company</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$company</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find_by_name_like</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%test%'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$person</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$people</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Dom'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'company_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$company</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'created_date'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$people</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dom</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$people</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$person</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Dom</span>
&nbsp;
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Dom</span>
&nbsp;
<span style="color: #000088;">$dom</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$person</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$new_users</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$person</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find_by_created_date_before</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'1 hour ago'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$new_users</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// loop through all the users with a create date more than 1 hour ago</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$company</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">company_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// and delete any that don't have a company associated with them</span>
    <span style="color: #000088;">$people</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">delete</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>It&#8217;s only a first draft, so any comments, questions or pointing out any typo&#8217;s in the code, (yeah, there are likely to be a few&#8230;) would be muchly appreciated.</p>
<p>This work is free under the <a href="http://creativecommons.org/licenses/by-sa/2.0/uk/">Creative Commons Share Alike 2.0 license</a>.</p>
<p>Download:</p>
<p><a href="/files/DB/DB_0.1.tar.gz" title="Download DB_01.tar.gz">DB_0.1.tar.gz (4.84Kb)</a></p>
<p>Edit: Think next on my list is TextMate syntax highlighting and maybe the non-default template&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/db/8/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

