<?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>... coding (the life) &#187; sos</title>
	<atom:link href="http://www.marvinmarcelo.com/tag/sos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marvinmarcelo.com</link>
	<description>Anything about programming, and a little about me.</description>
	<lastBuildDate>Mon, 09 Jan 2012 13:44:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Too many things</title>
		<link>http://www.marvinmarcelo.com/too-many-things/</link>
		<comments>http://www.marvinmarcelo.com/too-many-things/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 02:01:10 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[job]]></category>
		<category><![CDATA[work related]]></category>
		<category><![CDATA[sos]]></category>

		<guid isPermaLink="false">http://www.marvinmarcelo.com/?p=212</guid>
		<description><![CDATA[Gonna redo my work, urrrrrggghh! Thumbnail editor Models RSS Main RSS VXS Banner RSS Still have an AI integration on the other, (]]></description>
			<content:encoded><![CDATA[<p>Gonna redo my work, urrrrrggghh!</p>
<ul>
<li>Thumbnail editor</li>
<li>Models RSS</li>
<li>Main RSS</li>
<li>VXS Banner RSS</li>
</ul>
<p>Still have an AI integration on the other, <img src='http://www.marvinmarcelo.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> (</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marvinmarcelo.com/too-many-things/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup all DB in one shell script</title>
		<link>http://www.marvinmarcelo.com/backup-all-db-in-one-shell-script/</link>
		<comments>http://www.marvinmarcelo.com/backup-all-db-in-one-shell-script/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 02:55:47 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[work related]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[sos]]></category>

		<guid isPermaLink="false">http://www.marvinmarcelo.com/?p=159</guid>
		<description><![CDATA[#!/bin/bash MyUSER=&#34;SET-MYSQL-USER-NAME&#34; # USERNAME MyPASS=&#34;SET-PASSWORD&#34; # PASSWORD MyHOST=&#34;localhost&#34; # Hostname &#160; # Linux bin paths 'which' = autodetect MYSQL=&#34;$(which mysql)&#34; MYSQLDUMP=&#34;$(which mysqldump)&#34; CHOWN=&#34;$(which chown)&#34; CHMOD=&#34;$(which chmod)&#34; GZIP=&#34;$(which gzip)&#34; &#160; # Destination directory DEST=&#34;/backup&#34; &#160; # Main directory for backup MBD=&#34;$DEST/mysql&#34; &#8230; <a href="http://www.marvinmarcelo.com/backup-all-db-in-one-shell-script/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
<span style="color: #007800;">MyUSER</span>=<span style="color: #ff0000;">&quot;SET-MYSQL-USER-NAME&quot;</span>  <span style="color: #666666; font-style: italic;"># USERNAME</span>
<span style="color: #007800;">MyPASS</span>=<span style="color: #ff0000;">&quot;SET-PASSWORD&quot;</span>         <span style="color: #666666; font-style: italic;"># PASSWORD</span>
<span style="color: #007800;">MyHOST</span>=<span style="color: #ff0000;">&quot;localhost&quot;</span>            <span style="color: #666666; font-style: italic;"># Hostname</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Linux bin paths 'which' = autodetect</span>
<span style="color: #007800;">MYSQL</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(which mysql)</span>&quot;</span>
<span style="color: #007800;">MYSQLDUMP</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(which mysqldump)</span>&quot;</span>
<span style="color: #007800;">CHOWN</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(which chown)</span>&quot;</span>
<span style="color: #007800;">CHMOD</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(which chmod)</span>&quot;</span>
<span style="color: #007800;">GZIP</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(which gzip)</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Destination directory</span>
<span style="color: #007800;">DEST</span>=<span style="color: #ff0000;">&quot;/backup&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Main directory for backup</span>
<span style="color: #007800;">MBD</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$DEST</span>/mysql&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Get hostname - in target backup filename</span>
<span style="color: #007800;">HOST</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(hostname)</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Get data in dd-mm-yyyy format</span>
<span style="color: #007800;">NOW</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(date +&quot;%d-%m-%Y&quot;)</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># File to store current backup file</span>
<span style="color: #007800;">FILE</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #666666; font-style: italic;"># list of databases</span>
<span style="color: #007800;">DBS</span>=<span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># DO NOT BACKUP these databases</span>
<span style="color: #007800;">EXCLUDEDB</span>=<span style="color: #ff0000;">&quot;test&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$MBD</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$MBD</span> <span style="color: #000000; font-weight: bold;">||</span> :
&nbsp;
<span style="color: #666666; font-style: italic;"># Only root can access it!</span>
<span style="color: #007800;">$CHOWN</span> <span style="color: #000000;">0.0</span> <span style="color: #660033;">-R</span> <span style="color: #007800;">$DEST</span>
<span style="color: #007800;">$CHMOD</span> 0600 <span style="color: #007800;">$DEST</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Get all database list first</span>
<span style="color: #007800;">DBS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse 'show databases')</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> db <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$DBS</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #007800;">skipdb</span>=-<span style="color: #000000;">1</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$EXCLUDEDB</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;
    <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$EXCLUDEDB</span>
      <span style="color: #000000; font-weight: bold;">do</span>
      <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$db</span>&quot;</span> == <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">skipdb</span>=<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">||</span> :
      <span style="color: #000000; font-weight: bold;">done</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$skipdb</span>&quot;</span> == <span style="color: #ff0000;">&quot;-1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; 
    <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #007800;">FILE</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$MBD</span>/<span style="color: #007800;">$db</span>.<span style="color: #007800;">$HOST</span>.<span style="color: #007800;">$NOW</span>.gz&quot;</span>
      <span style="color: #666666; font-style: italic;"># the meat of everything</span>
      <span style="color: #007800;">$MYSQLDUMP</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$MyUSER</span> <span style="color: #660033;">-h</span> <span style="color: #007800;">$MyHOST</span> -p<span style="color: #007800;">$MyPASS</span> <span style="color: #007800;">$db</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #007800;">$GZIP</span> <span style="color: #660033;">-9</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$FILE</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.marvinmarcelo.com/backup-all-db-in-one-shell-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress</title>
		<link>http://www.marvinmarcelo.com/wordpress/</link>
		<comments>http://www.marvinmarcelo.com/wordpress/#comments</comments>
		<pubDate>Sun, 27 Jul 2008 01:34:28 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[work related]]></category>
		<category><![CDATA[category-tagging]]></category>
		<category><![CDATA[post2cat]]></category>
		<category><![CDATA[sos]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.marvinmarcelo.com/?p=55</guid>
		<description><![CDATA[Changes to my wordpress theme so that cattag_related_posts function will work. I&#8217;m using Ice theme by miloIIIIVII and inside the theme functions file is the embeded plugin Category Tagging by Bull3t. And guess what, it still reference some column from &#8230; <a href="http://www.marvinmarcelo.com/wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Changes to my wordpress theme so that <code>cattag_related_posts</code> function will work. I&#8217;m using <a href="http://milo.peety-passion.com/category/themes/">Ice</a> theme by <a href="http://milo.peety-passion.com/">miloIIIIVII</a> and inside the theme functions file is the embeded plugin <a href="http://blog.bull3t.me.uk/projects/category-tagging/">Category Tagging</a> by <a href="http://www.bull3t.me.uk/">Bull3t</a>. And guess what, it still reference some column from <code>post2cat</code> table which DOES NOT exists in my version.</p>
<p>It looks like wordpress is not going to release a fix when they dropped <a href="http://wordpress.org/tags/wp_post2cat">post2cat</a> table, starting from the 2.3 release. Or, I just haven&#8217;t found their fix on this. I also noticed this when the client I&#8217;m working for at <a href="http://www.staffoffshore.com/">Staff Off Shore</a> decided to upgrade his blog site. What I did is modify that block of code and use the <code>term_relationships</code> instead to come up with this SQL and return similar results.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">mysql <span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> p<span style="color: #66cc66;">.</span>ID<span style="color: #66cc66;">,</span> p<span style="color: #66cc66;">.</span>post_title <span style="color: #993333; font-weight: bold;">FROM</span> blog_posts p
      <span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> blog_term_relationships tr <span style="color: #993333; font-weight: bold;">ON</span> p<span style="color: #66cc66;">.</span>ID <span style="color: #66cc66;">=</span> tr<span style="color: #66cc66;">.</span>object_id
      <span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">WHERE</span> p<span style="color: #66cc66;">.</span>post_status <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'publish'</span> <span style="color: #993333; font-weight: bold;">AND</span> p<span style="color: #66cc66;">.</span>ID <span style="color: #66cc66;">&lt;&gt;</span> <span style="color: #cc66cc;">55</span>
      <span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">AND</span> p<span style="color: #66cc66;">.</span>post_type <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'post'</span> <span style="color: #993333; font-weight: bold;">AND</span> tr<span style="color: #66cc66;">.</span>term_taxonomy_id <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> p<span style="color: #66cc66;">.</span>post_date <span style="color: #993333; font-weight: bold;">DESC</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">5</span>;</pre></div></div>

<p>I have uploaded a version of <code>cattag_related_posts</code> function and it needs to be patch to any existing theme functions file (functions.php) or the &#8220;category-tagging&#8221; plugin that still queries on &#8220;wp_post2cat&#8221; table. This is what I am using, example of which are the items under &#8220;Possibly Related&#8221; header below this post (not the google of course).</p>
<p>Use it in your template like so, though I think I disabled the $exclude_ids parameter for now, but it should work without it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">cattag_related_posts<span style="color: #009900;">&#40;</span>
	<span style="color: #000088;">$limit</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span>		<span style="color: #666666; font-style: italic;"># number of posts to return
</span>	<span style="color: #000088;">$display_posts</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>	<span style="color: #666666; font-style: italic;"># swap values with display_page
</span>	<span style="color: #000088;">$display_pages</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>	<span style="color: #666666; font-style: italic;"># to get post or page
</span>	<span style="color: #000088;">$before</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;li&gt;'</span><span style="color: #339933;">,</span>	<span style="color: #666666; font-style: italic;"># html wrapper
</span>	<span style="color: #000088;">$after</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">,</span>
	<span style="color: #000088;">$notfound</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
	<span style="color: #000088;">$order</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'DATE_DESC'</span><span style="color: #339933;">,</span>	<span style="color: #666666; font-style: italic;"># DATE_DESC or RANDOM
</span>	<span style="color: #000088;">$exclude_ids</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Download: <a href="/wp-content/uploads/2008/07/cattag_related_posts.txt">cattag_related_posts.txt</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marvinmarcelo.com/wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

