<?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>Graphic Maniacs</title>
	<atom:link href="http://graphicmaniacs.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://graphicmaniacs.com</link>
	<description></description>
	<lastBuildDate>Tue, 24 Aug 2010 08:34:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MySQL query to change character set, connection encoding, collation etc.</title>
		<link>http://graphicmaniacs.com/note/mysql-query-to-change-character-set-connection-encoding-collation-etc/</link>
		<comments>http://graphicmaniacs.com/note/mysql-query-to-change-character-set-connection-encoding-collation-etc/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 01:21:01 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=461</guid>
		<description><![CDATA[This may become handy in case your database and website encoding is a bit different from what the server thought would be perfect. Simply run this query after successful mysql_connect: mysql_query&#40;&#34;SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'&#34;&#41;; Don&#8217;t forget to adjust the encoding names according to [...]]]></description>
			<content:encoded><![CDATA[<p>This may become handy in case your database and website encoding is a bit different from what the server thought would be perfect.<br />
Simply run this query after successful mysql_connect:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Don&#8217;t forget to adjust the encoding names according to your configs (because not every website and database uses utf8).</p>
<p>Additionally, it may be possible to fix your encoding bugs with a simple single query (works in every 3rd situation):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">mysql_set_charset</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'utf8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/mysql-query-to-change-character-set-connection-encoding-collation-etc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performing multiple MySQL queries in PHP</title>
		<link>http://graphicmaniacs.com/note/performing-multiple-mysql-queries-in-php/</link>
		<comments>http://graphicmaniacs.com/note/performing-multiple-mysql-queries-in-php/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 01:14:03 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=455</guid>
		<description><![CDATA[Yes, i mean multiple. Usually this is used when you have for ex. big export file from phpMyAdmin with multiple CREATE TABLEs, INSERTs etc. I came across the solution provided with some website i can&#8217;t remember Basically, split the queries at the point where there are semicolons and query each split. $sql = &#34; CREATE [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, i mean multiple. Usually this is used when you have for ex. big export file from phpMyAdmin with multiple CREATE TABLEs, INSERTs etc.<br />
I came across the solution provided with some website i can&#8217;t remember<br />
Basically, split the queries at the point where there are semicolons and query each split.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot; 
CREATE TABLE IF NOT EXISTS `zcta` ( `zip` char(5) NOT NULL, `city` varchar(64) default NULL, PRIMARY KEY  (`zip`)) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
INSERT INTO `zcta` (`zip`, `city`) VALUES
('00211', 'Portsmouth'),
('00212', 'Portsmouth');
&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Something like that, now we split the string where the ; is and make sure it isn&#8217;t the value inside the query (this weird regexp does it all)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$queries</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/;+(?=([^'|^<span style="color: #000099; font-weight: bold;">\\</span>\']*['|<span style="color: #000099; font-weight: bold;">\\</span>\'][^'|^<span style="color: #000099; font-weight: bold;">\\</span>\']*['|<span style="color: #000099; font-weight: bold;">\\</span>\'])*[^'|^<span style="color: #000099; font-weight: bold;">\\</span>\']*[^'|^<span style="color: #000099; font-weight: bold;">\\</span>\']$)/&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$queries</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/performing-multiple-mysql-queries-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Highlighting paragraphs like table rows with SimpleXML</title>
		<link>http://graphicmaniacs.com/note/highlighting-paragraphs-like-table-rows-with-simplexml/</link>
		<comments>http://graphicmaniacs.com/note/highlighting-paragraphs-like-table-rows-with-simplexml/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 21:30:46 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=425</guid>
		<description><![CDATA[I&#8217;ll show you how to highlight every odd or even paragraph with PHP5 and SimpleXML. What do i mean? Let&#8217;s say we have this html structure: &#60;p&#62;Hi, this is the first paragraph&#60;/p&#62; &#60;p&#62;And here's the second one&#60;/p&#62; Now imagine we have 100 of these paragraphs, they are generated dynamically and we need to highlight every [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll show you how to highlight every odd or even paragraph with PHP5 and SimpleXML. What do i mean? Let&#8217;s say we have this html structure:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;Hi, this is the first paragraph&lt;/p&gt;
&lt;p&gt;And here's the second one&lt;/p&gt;</pre></div></div>

<p>Now imagine we have 100 of these paragraphs, they are generated dynamically and we need to highlight every even paragraph (i.e. 2nd, 4th, 6th). This can be made very simple if we break it up with SimpleXML.<br />
First, let&#8217;s wrap the paragraphs with &lt;xml&gt; tag to make sure we have one top level element (this is the XML requirement)</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;xml&gt;
&lt;p&gt;Hi, this is the first paragraph&lt;/p&gt;
&lt;p&gt;And here's the second one&lt;/p&gt;
&lt;/xml&gt;</pre></div></div>

<p>Now, let&#8217;s initialize our SimpleXML object (and let&#8217;s silence it with @ to make sure we don&#8217;t have any errors visible):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;xml&gt;&lt;p&gt;Hi, this if the first paragraph&lt;/p&gt;&lt;p&gt;And here's the second one&lt;/p&gt;&lt;/xml&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">simplexml_load_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now, to iterate through all paragraphs, we&#8217;ll use the <strong>xpath</strong> method of the simplexml object. Let&#8217;s not forget to set the counter to 0, we&#8217;ll use it to check if the row is even or odd. If we want to highlight odd rows, we need to set the counter to 1.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xpath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//p'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p class=&quot;row'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">%</span><span style="color:#800080;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$p</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$a</span><span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As you see, we use the result of $a%2 to output 0 or 1 and, thus, generate a class for paragraph with row0 or row1 name. The output will be as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p class='row0'&gt;Hi, this if the first paragraph&lt;/p&gt;
&lt;p class='row1'&gt;And here's the second one&lt;/p&gt;</pre></div></div>

<p>As you see, this is very simple. If we want to make 3 different row colors we can iterate like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">if ($xml) {
	$a = 0;
	foreach($xml-&gt;xpath('//p') as $p) {
		echo '&lt;p class=&quot;row'.($a%3).'&quot;&gt;'.$p.'&lt;/p&gt;';
		$a++;
	}
}</pre></div></div>

<p>This will output row0, row1 and row2 class names. We only need to define the appropriate class names in our stylesheets.</p>
<p>The full source may look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;xml&gt;&lt;p align=&quot;center&quot;&gt;bla bla&lt;/p&gt;&lt;div&gt;&lt;span&gt;&lt;p&gt;bla bla&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p class=&quot;somethingelse&quot;&gt;aha&lt;/p&gt;&lt;/div&gt;&lt;/xml&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">simplexml_load_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xpath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//p'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p class=&quot;row'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #339933;">%</span><span style="color:#800080;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$p</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$a</span><span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>If you are using WordPress and need to highlight paragraphs inside a post or page, you can write it like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> get_the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">']]&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">']]&amp;gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;xml&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$content</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/xml&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">simplexml_load_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">...</span></pre></div></div>

<p>Additionally, if we want to get only those paragraphs that have align=&#8217;center&#8217; we can run the xpath like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xpath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'//p[@align=&quot;center&quot;]'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>XPath is a very simple and powerful way to access the DOM of HTML or XML document. Enjoy it <img src='http://graphicmaniacs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/highlighting-paragraphs-like-table-rows-with-simplexml/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hiqh quality PNG and ICO Japan Icons</title>
		<link>http://graphicmaniacs.com/note/hiqh-quality-png-and-ico-japan-icons/</link>
		<comments>http://graphicmaniacs.com/note/hiqh-quality-png-and-ico-japan-icons/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 22:20:36 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Graphics]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=423</guid>
		<description><![CDATA[An awesome set of high-quality Japanese Icons or Japan theme icons if you wish. Download from any of the sources below: RapidShare LetItBit DepositFiles]]></description>
			<content:encoded><![CDATA[<p>An awesome set of high-quality Japanese Icons or Japan theme icons if you wish.</p>
<p><img src="http://graphicmaniacs.com/wp-content/uploads/2010/06/2e92d9915d81.jpg" alt="" title="Japanese Icons" width="455" height="450" class="aligncenter size-full wp-image-422" /></p>
<p>Download from any of the sources below:<br />
<a href="http://rapidshare.com/files/395340971/disain-ikonki-v-iaponskom-stile.rar.html">RapidShare</a><br />
<a href="http://letitbit.net/download/42328.42db095e59a606aacbc29b587/disain_ikonki_v_iaponskom_stile.rar.html">LetItBit</a><br />
<a href="http://depositfiles.com/files/ih8bnhf2w">DepositFiles</a></p>
]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/hiqh-quality-png-and-ico-japan-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting video files to WebM format</title>
		<link>http://graphicmaniacs.com/note/converting-video-files-to-webm-format/</link>
		<comments>http://graphicmaniacs.com/note/converting-video-files-to-webm-format/#comments</comments>
		<pubDate>Sun, 30 May 2010 22:39:06 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Apps]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=414</guid>
		<description><![CDATA[For Windows users, the easiest way to convert the video will be to download the WebM DirectShow filters and use the makewebm tool inside the package. To run the encoding process, simply run the makewebm in command line with the input video parameter: makewebm myvideo.avi It will start the process of encoding the video for [...]]]></description>
			<content:encoded><![CDATA[<p>For Windows users, the easiest way to convert the video will be to <a href="http://code.google.com/p/webm/downloads/list">download the WebM DirectShow</a> filters and use the <strong>makewebm</strong> tool inside the package.</p>
<p>To run the encoding process, simply run the makewebm in command line with the input video parameter:<br />
<strong>makewebm myvideo.avi</strong></p>
<p>It will start the process of encoding the video for you. If you receive an error about muxing audio or something like that, then probably you don&#8217;t have the Vorbis DirectShow filters installed. To do so, navigate to <a href="http://xiph.org/dshow/">OGG page</a> and download the codecs from their website.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/converting-video-files-to-webm-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
