<?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>Royal Tutorials</title>
	<atom:link href="http://royaltutorials.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://royaltutorials.com</link>
	<description>Helpful tutorials on how to solve technical problems</description>
	<lastBuildDate>Mon, 06 Feb 2012 23:16:53 +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>Javascript isArray</title>
		<link>http://royaltutorials.com/javascript-isarray/</link>
		<comments>http://royaltutorials.com/javascript-isarray/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 23:16:53 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=657</guid>
		<description><![CDATA[To check wether a variable contains an Array in Javascript, use the following code: var foo = []; if(foo instanceof Array){ alert("Foo is an array!"); } Note: This does not work when accessing iframe contents.]]></description>
			<content:encoded><![CDATA[<p>To check wether a variable contains an Array in Javascript, use the following code:</p>
<pre>
var foo = [];

if(foo instanceof Array){
  alert("Foo is an array!");
}
</pre>
<p>Note: This does not work when accessing iframe contents.</p>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/javascript-isarray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP inline object</title>
		<link>http://royaltutorials.com/php-inline-object/</link>
		<comments>http://royaltutorials.com/php-inline-object/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 04:55:52 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=655</guid>
		<description><![CDATA[To make a PHP object &#8220;inline&#8221; &#8211; that is to instantiate the object and populate its properties in one statement &#8211; use the following code: $my_obj = (object) array("foo" => 1, "bar" => 2); Also, this can be used when constructing JSON output, for example: json_encode( array( my_array => array("foo", "bar"), my_obj => (object) array( [...]]]></description>
			<content:encoded><![CDATA[<p>To make a PHP object &#8220;inline&#8221; &#8211; that is to instantiate the object and populate its properties in one statement &#8211; use the following code:</p>
<pre>
$my_obj = (object) array("foo" => 1, "bar" => 2);
</pre>
<p>Also, this can be used when constructing JSON output, for example:</p>
<pre>
json_encode(
  array(
    my_array => array("foo", "bar"),
    my_obj => (object) array(
      "foo" => 1,
      "bar" => 2
    )
  )
);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/php-inline-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP_Filesystem init</title>
		<link>http://royaltutorials.com/wp_filesystem-init/</link>
		<comments>http://royaltutorials.com/wp_filesystem-init/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 00:58:03 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=652</guid>
		<description><![CDATA[When working with some internal WordPress functions, sometimes you get a &#8220;fs_unavailable&#8221; &#8220;Could not access filesystem&#8221; error, and if you look at the source code, there is a comment that says: &#8220;Assumes that WP_Filesystem() has already been called and set up&#8221;, you might wonder how to call and setup the WP_Filesystem. To do this, just [...]]]></description>
			<content:encoded><![CDATA[<p>When working with some internal WordPress functions, sometimes you get a &#8220;fs_unavailable&#8221; &#8220;Could not access filesystem&#8221; error, and if you look at the source code, there is a comment that says: &#8220;Assumes that WP_Filesystem() has already been called and set up&#8221;, you might wonder how to call and setup the WP_Filesystem.</p>
<p>To do this, just do the following before you call your function:</p>
<pre>
WP_Filesystem();

//unzip_file etc &hellip;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/wp_filesystem-init/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZWAMP Unable to allocate memory for pool</title>
		<link>http://royaltutorials.com/zwamp-unable-to-allocate-memory-for-pool/</link>
		<comments>http://royaltutorials.com/zwamp-unable-to-allocate-memory-for-pool/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 16:59:19 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=650</guid>
		<description><![CDATA[When using ZWAMP and running a non-trivial PHP script, the said error might occur several times. This is because the APC (which is enabled by default in ZWAMP) runs out of space when caching. To fix this, go to the folder vdrive\.sys\php\php.ini in your ZWAMP folder, and look for the following code: apc.shm_size=4M Change 4M [...]]]></description>
			<content:encoded><![CDATA[<p>When using <a href="http://www.google.se/url?sa=t&#038;rct=j&#038;q=zwamp&#038;source=web&#038;cd=1&#038;ved=0CDMQFjAA&#038;url=http%3A%2F%2Fzwamp.sourceforge.net%2F&#038;ei=UfoWT7TZOIbR4QTEqdDnAw&#038;usg=AFQjCNG6215E6xBvunQ2g4EnJoiaANQYRQ&#038;sig2=uJ6zn6WUcbL_OsU3EnHo5Q">ZWAMP</a> and running a non-trivial PHP script, the said error might occur several times. This is because the <a href="http://www.php.net/manual/en/intro.apc.php">APC</a> (which is enabled by default in ZWAMP) runs out of space when caching.</p>
<p>To fix this, go to the folder <code>vdrive\.sys\php\php.ini</code> in your ZWAMP folder, and look for the following code:</p>
<pre>
apc.shm_size=4M
</pre>
<p>Change 4M to something like 12M.</p>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/zwamp-unable-to-allocate-memory-for-pool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZWAMP Your PHP installation appears to be missing the MySQL extension which is required by WordPress</title>
		<link>http://royaltutorials.com/zwamp-your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-required-by-wordpress/</link>
		<comments>http://royaltutorials.com/zwamp-your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-required-by-wordpress/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:05:13 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=648</guid>
		<description><![CDATA[To install WordPress on the ZWAMP portable server, you need to enable the native MySQL extension in PHP. By default, only the PDY MySQL extension is enabled. To enable the native MySQL extension in PHP, go to the folder vdrive\.sys\php\php.ini in your ZWAMP folder, and look for the following code: ;extension=php_mysql.dll Remove the semicolon, save [...]]]></description>
			<content:encoded><![CDATA[<p>To install WordPress on the ZWAMP portable server, you need to enable the native MySQL extension in PHP. By default, only the PDY MySQL extension is enabled.</p>
<p>To enable the native MySQL extension in PHP, go to the folder <code>vdrive\.sys\php\php.ini</code> in your ZWAMP folder, and look for the following code:</p>
<pre>
;extension=php_mysql.dll
</pre>
<p>Remove the semicolon, save the file, and restart the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/zwamp-your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-required-by-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP unCamelCase</title>
		<link>http://royaltutorials.com/php-uncamelcase/</link>
		<comments>http://royaltutorials.com/php-uncamelcase/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 11:31:17 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=643</guid>
		<description><![CDATA[To convert a string from CamelCase to underscore_notation in PHP, use the following code: $my_camel_case_string = "fooBar"; $resulting_string = strtolower(preg_replace("[A-Z]", "_\$1", $my_camel_case_string)); $my_un_camel_cased_string = $resulting_string; The code can be made into a function like this: function un_camel_case($string){ return strtolower(preg_replace("[A-Z]", "_\$1", $string)); }]]></description>
			<content:encoded><![CDATA[<p>To convert a string from CamelCase to underscore_notation in PHP, use the following code:</p>
<pre>
$my_camel_case_string = "fooBar";

$resulting_string = strtolower(preg_replace("[A-Z]", "_\$1", $my_camel_case_string));

$my_un_camel_cased_string = $resulting_string;
</pre>
<p>The code can be made into a function like this:</p>
<pre>
function un_camel_case($string){
  return strtolower(preg_replace("[A-Z]", "_\$1", $string));
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/php-uncamelcase/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>EPiServer change master language</title>
		<link>http://royaltutorials.com/episerver-change-master-language/</link>
		<comments>http://royaltutorials.com/episerver-change-master-language/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 18:16:48 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=637</guid>
		<description><![CDATA[To change the default language for a website in EPiServer, add the language attribute to all your &#60;add/&#62; elements inside the &#60;siteHostMapping/&#62;, &#60;siteHosts/&#62; section inside EPiServerFramework.config. The following code changes the default language to swedish: &#60;siteHostMapping&#62; &#60;siteHosts siteId="&#8230;"&#62; &#60;add name="*" language="sv" /&#62; &#60;add name="foo:80" language="sv" /&#62; &#60;add name="foo" language="sv" /&#62; &#60;/siteHosts&#62; &#60;/siteHostMapping]]></description>
			<content:encoded><![CDATA[<p>To change the default language for a website in EPiServer, add the <code>language</code> attribute to all your <code>&lt;add/&gt;</code> elements inside the <code>&lt;siteHostMapping/&gt;</code>, <code>&lt;siteHosts/&gt;</code> section inside EPiServerFramework.config.</p>
<p>The following code changes the default language to swedish:</p>
<pre>
&lt;siteHostMapping&gt;
  &lt;siteHosts siteId="&hellip;"&gt;
    &lt;add name="*" <strong>language="sv"</strong> /&gt;
    &lt;add name="foo:80" <strong>language="sv"</strong> /&gt;
    &lt;add name="foo" <strong>language="sv"</strong> /&gt;
  &lt;/siteHosts&gt;
&lt;/siteHostMapping
</pre>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/episerver-change-master-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No VirtualPathProvider is set to handler Page files or the virtualPath attribute is invalid.</title>
		<link>http://royaltutorials.com/no-virtualpathprovider-is-set-to-handler-page-files-or-the-virtualpath-attribute-is-invalid/</link>
		<comments>http://royaltutorials.com/no-virtualpathprovider-is-set-to-handler-page-files-or-the-virtualpath-attribute-is-invalid/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 18:03:02 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=632</guid>
		<description><![CDATA[When configuring an EPiServer site (sometimes migrated from 4.62 with upload paths), you might encounter this error when experimenting with the new VPP section in EPiServer.config. The problem is that the currently used &#60;site&#62; element has a pageFolderVirtualPathProvider attribute that points to an &#60;add&#62; (inside the &#60;virtualPath&#62;, &#60;providers&#62; section) with a virtualPath attribute, for which [...]]]></description>
			<content:encoded><![CDATA[<p>When configuring an EPiServer site (sometimes migrated from 4.62 with upload paths), you might encounter this error when experimenting with the new VPP section in EPiServer.config.</p>
<p>The problem is that the currently used <code>&lt;site&gt;</code> element has a <code>pageFolderVirtualPathProvider</code> attribute that points to an <code>&lt;add&gt;</code> (inside the <code>&lt;virtualPath&gt;</code>, <code>&lt;providers&gt;</code> section) with a <code>virtualPath</code> attribute, for which no match is found.</p>
<p>To fix this, change the <code>pageFolderVirtualPathProvider</code> attribute to point to the <code>virtualPath</code> attribute of an existing <code>&lt;add&gt;</code> element.</p>
<p>The following code contains such a fix:</p>
<pre>
&lt;site &hellip; pageFolderVirtualPathProvider="SitePageFiles" /&gt;

&hellip;

&lt;virtualPath&gt;
  &lt;providers&gt;
    &lt;add &hellip; virtualPath="SitePageFiles" /&gt;
  &lt;/providers&gt;
&lt;/virtualPath&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/no-virtualpathprovider-is-set-to-handler-page-files-or-the-virtualpath-attribute-is-invalid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript popup onclose</title>
		<link>http://royaltutorials.com/javascript-popup-onclose/</link>
		<comments>http://royaltutorials.com/javascript-popup-onclose/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 01:23:52 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=629</guid>
		<description><![CDATA[To make a callback function fire whenever your popup window is closed, use the following code: var myWindow = &#8230; // create window popup var callback = function(){ alert("foo"); }; $(myWindow).unload(function(){ if(this.location == "about:blank"){ $(myWindow).unload(callback); } else { callback(); } }); Note: The fix for &#8220;about:blank&#8221; is needed for browsers who create popups with about:blank, [...]]]></description>
			<content:encoded><![CDATA[<p>To make a callback function fire whenever your popup window is closed, use the following code:</p>
<pre>
var myWindow = &hellip; // create window popup
var callback = function(){
  alert("foo");
};

$(myWindow).unload(function(){
  if(this.location == "about:blank"){
    $(myWindow).unload(callback);
  } else {
    callback();
  }
});
</pre>
<p>Note: The fix for &#8220;about:blank&#8221; is needed for browsers who create popups with about:blank, then navigate to the specified URL. Also, this callback will fire whenever you navigate away from the initial popup page, not just closing.</p>
<p>Another solution is to continously poll for window closure. See the following code:</p>
<pre>
var myWindow = &hellip; // create window popup
var callback = function(){
  alert("foo");
};

function pollForWindowClosure(){
  if(myWindow.closed){
    callback();
    return;
  }

  setTimeout(pollForWindowClosure, 10);
}

pollForWindowClosure();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/javascript-popup-onclose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery load CSS callback</title>
		<link>http://royaltutorials.com/jquery-load-css-callback/</link>
		<comments>http://royaltutorials.com/jquery-load-css-callback/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 01:07:50 +0000</pubDate>
		<dc:creator>Björn Ali Göransson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://royaltutorials.com/?p=624</guid>
		<description><![CDATA[To load a CSS file asynchronously with jQuery while providing a callback function for when the file has been included, use the following code: var stylesheet = "foo.css"; var callback = function(){ alert("CSS is now included"); }; $.get(stylesheet, function(contents){ $("&#60;style type=\"text/css\"&#62;" + contents + "&#60;/style&#62;").appendTo(document.head); callback(); });]]></description>
			<content:encoded><![CDATA[<p>To load a CSS file asynchronously with jQuery while providing a callback function for when the file has been included, use the following code:</p>
<pre>
var stylesheet = "foo.css";
var callback = function(){
  alert("CSS is now included");
};

$.get(stylesheet, function(contents){
  $("&lt;style type=\"text/css\"&gt;" + contents + "&lt;/style&gt;").appendTo(document.head);
  callback();
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://royaltutorials.com/jquery-load-css-callback/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

