<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Graphic Maniacs</title>
	
	<link>http://graphicmaniacs.com</link>
	<description />
	<lastBuildDate>Mon, 28 May 2012 19:21:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/graphicmaniacs" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="graphicmaniacs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">graphicmaniacs</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Windows 8 User Agent string</title>
		<link>http://graphicmaniacs.com/note/windows-8-user-agent-string/</link>
		<comments>http://graphicmaniacs.com/note/windows-8-user-agent-string/#comments</comments>
		<pubDate>Mon, 28 May 2012 19:21:15 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=927</guid>
		<description><![CDATA[Here we go again, with some examples: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0) Mozilla/5.0 (Windows NT 6.2; rv:10.0) Gecko/20100101 Firefox/10.0 Mozilla/5.0 (Windows NT 6.2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11 Mozilla/5.0 (Windows NT 6.2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1 Safari/534.50 Mozilla/5.0 (Windows NT 6.2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1 Safari/534.50 So it&#8217;s pretty [...]]]></description>
			<content:encoded><![CDATA[<p>Here we go again, with some examples:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
Mozilla/5.0 (Windows NT 6.2; rv:10.0) Gecko/20100101 Firefox/10.0
Mozilla/5.0 (Windows NT 6.2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11
Mozilla/5.0 (Windows NT 6.2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1 Safari/534.50 
Mozilla/5.0 (Windows NT 6.2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1 Safari/534.50</pre></div></div>

<p>So it&#8217;s pretty simple, let&#8217;s wrap up a small function:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">function detectWindows8() {
	var os = {};
	var ua = navigator.userAgent;
	if (ua.match(/Windows NT 6.2/i))
		os.windows8 = true;
	return os;
}
&nbsp;
/// .. later
&nbsp;
var os = detectWindows8();
if (os.windows8) {
	// do stuff
}</pre></div></div>

<p>Later on, you can expand the function to detect other OS versions too. Everything&#8217;s up to you</p>
]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/windows-8-user-agent-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP “__PHP_Incomplete_Class” error</title>
		<link>http://graphicmaniacs.com/note/php-incomplete-class-error/</link>
		<comments>http://graphicmaniacs.com/note/php-incomplete-class-error/#comments</comments>
		<pubDate>Fri, 18 May 2012 08:21:06 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=920</guid>
		<description><![CDATA[Had this error when loading an object from the $_SESSION? Here&#8217;s why, from official PHP docs: It&#8217;s possible to set a callback-function which will be called, if an undefined class should be instantiated during unserializing. (to prevent getting an incomplete object &#8220;__PHP_Incomplete_Class&#8221;.) Use your php.ini, ini_set() or .htaccess to define &#8216;unserialize_callback_func&#8217;. Everytime an undefined class [...]]]></description>
			<content:encoded><![CDATA[<p>Had this error when loading an object from the $_SESSION?<br />
Here&#8217;s why, from official PHP docs:</p>
<blockquote><p>It&#8217;s possible to set a callback-function which will be called, if an undefined class should be instantiated during unserializing. (to prevent getting an incomplete object &#8220;__PHP_Incomplete_Class&#8221;.) Use your php.ini, ini_set() or .htaccess to define &#8216;unserialize_callback_func&#8217;. Everytime an undefined class should be instantiated, it&#8217;ll be called. To disable this feature just empty this setting.</p></blockquote>
<p>A simple fix would be to load the session_start AFTER the object class declaration, but if it is not possible, then you could simply double-serialize the object. Like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// some code running in your application</span>
<span style="color: #666666; font-style: italic;">// then,</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'myobject'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$object</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// then when we need it</span>
<span style="color: #000088;">$object</span> <span style="color: #339933;">=</span> <span style="color: #990000;">unserialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'myobject'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The reason of the error is because the objects stored in sessions are converted to serialized string, and when we call session_start(), it tries to initialize the object with the class definition which isn&#8217;t available yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/php-incomplete-class-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting XLSX date-containing field to a real date</title>
		<link>http://graphicmaniacs.com/note/converting-xlsx-date-containing-field-to-a-real-date/</link>
		<comments>http://graphicmaniacs.com/note/converting-xlsx-date-containing-field-to-a-real-date/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 08:29:59 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=912</guid>
		<description><![CDATA[Lately, i was importing an XLSX file using a simple xml-based parser and noticed a strange thing.. The date fields were actually containing integers like 40305, which is actually 2010-05-07 (what??). A bit of investigation, and there&#8217;s what that means: the date fields have integers that are the amount of days from 1900-00-00. That means [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, i was importing an XLSX file using a simple xml-based parser and noticed a strange thing.. The date fields were actually containing integers like 40305, which is actually 2010-05-07 (what??). A bit of investigation, and there&#8217;s what that means: the date fields have integers that are the amount of days from 1900-00-00. That means that to convert it to a date we should make</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d'</span><span style="color: #339933;">,</span> <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #000088;">$value</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1900</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The reason why i subtract 1 from the $value because php counts from 1900-01-01, while XLSX has a date from 1900-00-00. So after that conversion we have a valid date.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/converting-xlsx-date-containing-field-to-a-real-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a list of WordPress hook actions</title>
		<link>http://graphicmaniacs.com/note/getting-a-list-of-wordpress-hook-actions/</link>
		<comments>http://graphicmaniacs.com/note/getting-a-list-of-wordpress-hook-actions/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 13:08:40 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=907</guid>
		<description><![CDATA[Sometimes content is outputted somewhere where I don&#8217;t need (when I run do_action), and I can&#8217;t really see what action does that. So to get the list of WordPress actions attached to a hook, use this kind of code: global $wp_filter; var_dump&#40;$wp_filter&#91;'comment_form'&#93;&#41;; You will get then something like this: array&#40;1&#41; &#123; &#91;10&#93;=&#62; array&#40;2&#41; &#123; &#91;&#34;wp_comment_form_unfiltered_html_nonce&#34;&#93;=&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes content is outputted somewhere where I don&#8217;t need (when I run <strong>do_action</strong>), and I can&#8217;t really see what action does that. So to get the list of WordPress actions attached to a hook, use this kind of code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_filter</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_filter</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment_form'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You will get then something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;wp_comment_form_unfiltered_html_nonce&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;function&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
      string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">37</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;wp_comment_form_unfiltered_html_nonce&quot;</span>
      <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;accepted_args&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
      int<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;akismet_add_comment_nonce&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;function&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
      string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;akismet_add_comment_nonce&quot;</span>
      <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;accepted_args&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
      int<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Pretty cool, now we know what produces all that output.</p>
]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/getting-a-list-of-wordpress-hook-actions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to disable Flash, JavaScript and Cookies in Google Chrome</title>
		<link>http://graphicmaniacs.com/note/how-to-disable-flash-javascript-and-cookies-in-google-chrome/</link>
		<comments>http://graphicmaniacs.com/note/how-to-disable-flash-javascript-and-cookies-in-google-chrome/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 13:51:37 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=901</guid>
		<description><![CDATA[For those who just need the shortcuts, here&#8217;s the link to JavaScript and Cookies options: chrome://settings/content For Flash, Silverlight, Quicktime and other similar addons, the link is: chrome://plugins]]></description>
			<content:encoded><![CDATA[<p>For those who just need the shortcuts, here&#8217;s the link to JavaScript and Cookies options:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">chrome://settings/content</pre></div></div>

<p>For Flash, Silverlight, Quicktime and other similar addons, the link is:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">chrome://plugins</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/how-to-disable-flash-javascript-and-cookies-in-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

