<?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>Fri, 18 May 2012 08:21:06 +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>PHP &#8220;__PHP_Incomplete_Class&#8221; 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>
		<item>
		<title>Issue with Flash uploader and Suhosin PHP patch</title>
		<link>http://graphicmaniacs.com/note/issue-with-flash-uploader-and-suhosin-php-patch/</link>
		<comments>http://graphicmaniacs.com/note/issue-with-flash-uploader-and-suhosin-php-patch/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 10:36:54 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://graphicmaniacs.com/?p=892</guid>
		<description><![CDATA[This is a very simply situation: we use multiple files Flash uploader to display progress, and for other extended functionality when uploading files. But this issue was killing me. After installing Suhosin patch, the session was breaking after any file upload. This was made because Suhosin checks the User-Agent also, and Flash has a different [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very simply situation: we use multiple files Flash uploader to display progress, and for other extended functionality when uploading files. But this issue was killing me. After installing Suhosin patch, the session was breaking after any file upload.</p>
<p>This was made because <strong>Suhosin checks the User-Agent</strong> also, and Flash has a different user agent from the browser. Even providing a session id to Flash won&#8217;t solve the issue because Suhosin checks the user agents when session_id/session_start is called.</p>
<p>To solve this issue, simply disable user agent encrypting, but leave the IP address encrypting in php.ini:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">suhosin<span style="color: #339933;">.</span>session<span style="color: #339933;">.</span>encrypt <span style="color: #339933;">=</span> On
suhosin<span style="color: #339933;">.</span>session<span style="color: #339933;">.</span>cryptraddr <span style="color: #339933;">=</span> On
suhosin<span style="color: #339933;">.</span>session<span style="color: #339933;">.</span>cryptua <span style="color: #339933;">=</span> Off</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://graphicmaniacs.com/note/issue-with-flash-uploader-and-suhosin-php-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

