<?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>Numiko Labs</title>
	<atom:link href="http://numiko.com/labs/feed/" rel="self" type="application/rss+xml" />
	<link>http://numiko.com/labs</link>
	<description>Notes and inspiration, fresh from our studio.</description>
	<lastBuildDate>Thu, 22 Dec 2011 12:40:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Programmatically adding a node reference field to a type in Drupal 7</title>
		<link>http://numiko.com/labs/2011/programmatically-adding-a-node-reference-field-to-a-type-in-drupal-7/</link>
		<comments>http://numiko.com/labs/2011/programmatically-adding-a-node-reference-field-to-a-type-in-drupal-7/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 12:40:25 +0000</pubDate>
		<dc:creator>Andy Tawse</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=381</guid>
		<description><![CDATA[It wasn&#8217;t obvious how I could add new node reference fields to a content type. I had to work it out from node_reference_field_info() and from examining existing fields with field_info_field(). After some experimentation, this worked:   $field = array(     "field_name"=&#62;"field_field_name",     "label"=&#62;"Field label",     "type"=&#62;"node_reference",     "settings"=&#62;array(       "referenceable_types"=&#62;array(         "gallery_image"=&#62;"gallery_image"       ),     [...]]]></description>
			<content:encoded><![CDATA[<p>It wasn&#8217;t obvious how I could add new <a href="http://drupal.org/project/references">node reference</a> fields to a content type. I had to work it out from node_reference_field_info() and from examining existing fields with field_info_field(). After some experimentation, this worked:</p>
<pre>  $field = array(
    "field_name"=&gt;"field_field_name",
    "label"=&gt;"Field label",
    "type"=&gt;"node_reference",
    "settings"=&gt;array(
      "referenceable_types"=&gt;array(
        "gallery_image"=&gt;"gallery_image"
      ),
    ),
    "cardinality"=&gt;"-1"
  );

  field_create_field($field);

  $instance = array(
    "field_name"=&gt;"field_field_name",
    "label"=&gt;"Field label",
    "type"=&gt;"node_reference",
    "widget"=&gt;array(
      "type"=&gt;"options_select"
    ),
  );

  $instance["entity_type"] = "node";

  foreach(array("type1", "type2", "type3") as $type){
    $instance["bundle"] = $type;  
    field_create_instance($instance);
  }</pre>
<p>&#8220;gallery_image&#8221; is the machine name of the type that will be referenced by the field &#8211; put as many in here as you need (yes, the format really is &#8220;machine_name&#8221;=&gt;&#8221;machine_name&#8221;). &#8220;cardinality&#8221; is the number of references in the field, -1 being unlimited. In the example, the field will be added to 3 types &#8211; type1, type2 and type3.</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2011/programmatically-adding-a-node-reference-field-to-a-type-in-drupal-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Specificity Wars</title>
		<link>http://numiko.com/labs/2011/css-specificity-wars/</link>
		<comments>http://numiko.com/labs/2011/css-specificity-wars/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 17:56:41 +0000</pubDate>
		<dc:creator>James Hyatt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=347</guid>
		<description><![CDATA[Working on a project the other day I came across a problem with some existing CSS where the selectors for basic elements all included the ID&#8217;s for the layout containers. this was causing huge problems when any external mark-up was dropped into the page. The generic styles were already so specfiic that they were over-riding [...]]]></description>
			<content:encoded><![CDATA[<p>Working on a project the other day I came across a problem with some existing CSS where the selectors for basic elements all included the ID&#8217;s for the layout containers.</p>
<pre class="brush: css; title: ; notranslate">
#main #content #inner h3
</pre>
<p>this was causing huge problems when any external mark-up was dropped into the page. The generic styles were already so specfiic that they were over-riding most other CSS styles. Before you know it you needed to tag everything with:</p>
<pre class="brush: css; title: ; notranslate">
#main #content #inner #something .get .my .point
</pre>
<p>to make the styles to cascade properly.</p>
<p>It&#8217;s worth remembering that although</p>
<pre class="brush: css; title: ; notranslate">
#main #content a {color:black}
</pre>
<p>looks fairly innocuous but when you later to need to change the style of an anchor tag you&#8217;ll be stuck needed to add a lot of specification and worse external mark-up, unaware of your overly described selectors will end up being overridden. Before you know it your rules are flowing off the page and every new change requires a train of selectors, tags and classes.</p>
<p>It&#8217;s worth then noting how CSS decided what styles to use &#8211; Other people have done a better job than I would manage so I&#8217;ll just point you towards a few articles that cleverly explain the problem:</p>
<p><a href="http://iamacamera.org/default.aspx?id=95">http://iamacamera.org/default.aspx?id=95</a></p>
<p><a href="http://iamacamera.org/default.aspx?id=95">http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/</a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2011/css-specificity-wars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You Arent Gonna Need It &#8211; Code Reuse</title>
		<link>http://numiko.com/labs/2011/you-arent-gonna-need-it-code-reuse/</link>
		<comments>http://numiko.com/labs/2011/you-arent-gonna-need-it-code-reuse/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 14:25:32 +0000</pubDate>
		<dc:creator>Andy Tawse</dc:creator>
				<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=327</guid>
		<description><![CDATA[Here are two related articles (by Mike Mooney) where I found myself agreeing with every point and feeling relief that others have come to the same conclusions as I have over the years. The Framework Myth says you don&#8217;t need an internal omnipotent framework. I agree &#8211; over the years we have built up a small [...]]]></description>
			<content:encoded><![CDATA[<p>Here are two related articles (by Mike Mooney) where I found myself agreeing with every point and feeling relief that others have come to the same conclusions as I have over the years.</p>
<p><a href="http://mooneyblog.mmdbsolutions.com/index.php/2010/12/07/the-framework-myth">The Framework Myth</a> says you don&#8217;t need an internal omnipotent framework. I agree &#8211; over the years we have built up a small collection of re-usable code, based on experience of <em>actually needing that code in our situation</em>. Coders love to code, and I have to admit feeling a thrill at writing my own APIs but &#8220;you are probably not getting paid to fulfill your dreams, you are getting paid to write the damn code.&#8221;</p>
<p><a href="http://mooneyblog.mmdbsolutions.com/index.php/2010/07/30/reusable-code-is-bad/">Reusable Code is Bad</a> is a headline in the tradition of <a href="http://www.flamingspork.com/blog/2005/08/08/comments-are-evil/">hyperbolic blog post</a> headlines, but &#8220;never build something to be reused until you actually have two systems that actually need to reuse it <em>right now</em>.&#8221; is something that makes sense to me.</p>
<p>Crucially, I think, everybody&#8217;s situation is different so you always have to judge for yourself. But as I look back over a decade of projects, how much unused reusable code did I write? How many times did I sweat over whether to take the time to &#8220;add another layer of abstraction and logical branching to my function&#8221; and how many times was I wrong when I decided to? Less and less as experience has taught me not to.</p>
<p>You should understand the principles of code reuse, no doubt, but learn to use your own judgement in your current situation. As with all advice, just because Google/Facebook/37 Signals/some-guy-with-a-blog says it&#8217;s a good idea, doesn&#8217;t mean it is for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2011/you-arent-gonna-need-it-code-reuse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful New Bits &amp; Pieces in Drupal 7</title>
		<link>http://numiko.com/labs/2011/useful-new-bits-pieces-in-drupal-7/</link>
		<comments>http://numiko.com/labs/2011/useful-new-bits-pieces-in-drupal-7/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 14:11:06 +0000</pubDate>
		<dc:creator>Andy Tawse</dc:creator>
				<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=320</guid>
		<description><![CDATA[Everyone knows about the big changes in Drupal 7 but the details matter too, especially when they&#8217;re the kind of details that make life simpler and save time every day. Here&#8217;s some nice ones in Drupal 7. db_query No need to mess about with fetching rows any more, db_query() returns a Traversable object which can [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knows about the big changes in Drupal 7 but the details matter too, especially when they&#8217;re the kind of details that make life simpler and save time every day. Here&#8217;s some nice ones in Drupal 7.</p>
<h3>db_query</h3>
<p>No need to mess about with fetching rows any more, db_query() returns a Traversable object which can be foreach-ed. Also, placeholders no longer need quote marks. (The Numiko API has taken care of these conveniences for a while now, glad they are no longer needed).</p>
<h3>Comments</h3>
<p>It&#8217;s now easy to output comments separately, meaning they can be placed anywhere on a node. No more hacking it.</p>
<h3>Profiling</h3>
<p>The Devel module now integrates the XHProf Profiler, which looks useful for finding bottlenecks in code.</p>
<h3>Checkboxes</h3>
<p>Now simple and logical to create on types. Previously I always had to refer to how I did it the last time.</p>
<h3>More Granular Permissions</h3>
<p>Which is good, and they are more logical. It will require a bit more thought from developers when defining roles e.g. all of the following permissions would generally be required as a base for a site editor: &#8220;Use the administration toolbar&#8221;, &#8220;View the administration theme&#8221;, &#8220;Use the administration pages and help&#8221;, &#8220;Access the administrative overlay&#8221;, &#8220;View the administrative dashboard, &#8220;Access the content overview page&#8221;.</p>
<p>Thankfully the infamous &#8220;Administer content&#8221; permission has been tamed.</p>
<h3>Content List Page</h3>
<p>This page now has sortable columns, and an &#8220;Updated&#8221; column, instantly making content easier to find and identify. AJAX auto-complete filtering here would make it complete.</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2011/useful-new-bits-pieces-in-drupal-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook: Where did Post-Authorize Redirect URL go? (aka Oh facebook developers, what have you done this time?! )</title>
		<link>http://numiko.com/labs/2010/facebook-where-did-post-authorize-redirect-url-go-aka-oh-facebook-developers-what-have-you-done-this-time/</link>
		<comments>http://numiko.com/labs/2010/facebook-where-did-post-authorize-redirect-url-go-aka-oh-facebook-developers-what-have-you-done-this-time/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 13:34:39 +0000</pubDate>
		<dc:creator>Andy Tawse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=315</guid>
		<description><![CDATA[If you&#8217;re having problems getting the facebook login callback to fire &#8211; for example,  you&#8217;re using one of the social plugins and are not getting redirected back to the right place on login &#8211; you might be looking to set the &#8220;Post-Authorize Redirect URL&#8221; &#8211; except, it&#8217;s not there any more! Facebook seems to read [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re having problems getting the facebook login callback to fire &#8211; for example,  you&#8217;re using one of the social plugins and are not getting redirected back to the right place on login &#8211; you might be looking to set the &#8220;Post-Authorize Redirect URL&#8221; &#8211; except, it&#8217;s not there any more!</p>
<p>Facebook seems to read this from the canvas URL now instead &#8211; so try setting that to be the same as your Site URL.</p>
<p>Incidentally, I only had this problem when working from localhost &#8211; with sites on the public Internet,  setting the site URL only worked fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2010/facebook-where-did-post-authorize-redirect-url-go-aka-oh-facebook-developers-what-have-you-done-this-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal &#8211; number of registrations by month</title>
		<link>http://numiko.com/labs/2010/drupal-number-of-registrations-by-month/</link>
		<comments>http://numiko.com/labs/2010/drupal-number-of-registrations-by-month/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 14:51:44 +0000</pubDate>
		<dc:creator>Andy Tawse</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=309</guid>
		<description><![CDATA[Useful query &#8211; shows how many users registered on a Drupal site each month: select count(uid), month(from_unixtime(created)) as bmonth, year(from_unixtime(created)) as byear from users group by bmonth, byear order by byear, bmonth; SELECT count(uid),  MONTH(FROM_UNIXTIME(created)) as bmonth,  YEAR(FROM_UNIXTIME(created)) as byear  FROM users  GROUP BY bmonth, byear  ORDER BY byear, bmonth;]]></description>
			<content:encoded><![CDATA[<p>Useful query &#8211; shows how many users registered on a Drupal site each month:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">select count(uid), month(from_unixtime(created)) as bmonth, year(from_unixtime(created)) as byear from users group by bmonth, byear order by byear, bmonth;</div>
<pre>SELECT count(uid), 

  MONTH(FROM_UNIXTIME(created)) as bmonth, 

  YEAR(FROM_UNIXTIME(created)) as byear 

FROM users 

GROUP BY bmonth, byear 

ORDER BY byear, bmonth;</pre>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2010/drupal-number-of-registrations-by-month/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Workaround for Unit PNG Fix error: &#8220;This page contains both secure and nonsecure items&#8230;&#8221;</title>
		<link>http://numiko.com/labs/2010/workaround-for-unit-png-fix-error-this-page-contains-both-secure-and-nonsecure-items/</link>
		<comments>http://numiko.com/labs/2010/workaround-for-unit-png-fix-error-this-page-contains-both-secure-and-nonsecure-items/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 14:08:01 +0000</pubDate>
		<dc:creator>Djenan Kozic</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=298</guid>
		<description><![CDATA[Unit PNG Fix is a great workaround for those projects which require the use of alpha transparency in IE6. As well as being very compact—just over 1KB—it is also very easy to implement. However, using Unit PNG Fix on a secure domain can result in a &#8220;This page contains both secure and non–secure items…&#8221; error in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://labs.unitinteractive.com/unitpngfix.php" target="_blank">Unit PNG Fix</a> is a great workaround for those projects which require the use of alpha transparency in IE6. As well as being very compact—just over 1KB—it is also very easy to implement. However, using Unit PNG Fix on a secure domain can result in a &#8220;This page contains both secure and non–secure items…&#8221; error in IE.</p>
<p>Thankfully, this is pretty straightforward to fix…</p>
<p>The error is caused by <span style="font-family: monospace">src=&#8221;javascript:void(0)&#8221;</span> on line 3 of the unifpngfix.js file and there are two ways to work around this:</p>
<ol>
<li>Replace <span style="font-family: monospace">javascript:void(0)</span> with <span style="font-family: monospace">javascript:false;</span>.</li>
<li>Insert a link to an empty file in place of the <span style="font-family: monospace">javascript:void(0)</span>. You should note that this creates an extra server call and is my less favoured solution of the two. You could get around this by using a blank page and have the cache never expire on it as suggested <a href="http://stackoverflow.com/questions/541837/this-page-contains-both-secure-and-nonsecure-items-and-iframes" target="_blank">here</a>.</li>
</ol>
<p>And that&#8217;s that!</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2010/workaround-for-unit-png-fix-error-this-page-contains-both-secure-and-nonsecure-items/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Facebook: “Validation failed. Unable to update Developers.”</title>
		<link>http://numiko.com/labs/2010/facebook-%e2%80%9cvalidation-failed-unable-to-update-developers-%e2%80%9d/</link>
		<comments>http://numiko.com/labs/2010/facebook-%e2%80%9cvalidation-failed-unable-to-update-developers-%e2%80%9d/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 15:38:55 +0000</pubDate>
		<dc:creator>Clare Lindley</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[social]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=291</guid>
		<description><![CDATA[If  you come across this when trying to add developers to a Facebook app &#8211; yes, it&#8217;s a bug and no,  it doesnt seem to have been fixed despite its status having been set to RESOLVED &#8211; but dont worry! There&#8217;s another way to add developers to your app (thanks for pointing it out Numikon [...]]]></description>
			<content:encoded><![CDATA[<p>If  you come across this when trying to add developers to a Facebook app &#8211; yes, <a href="http://bugs.developers.facebook.net/show_bug.cgi?id=12620">it&#8217;s a bug</a> and no,  it doesnt seem to have been fixed despite its status having been set to RESOLVED &#8211; but dont worry! There&#8217;s another way to add developers to your app (thanks for pointing it out Numikon Ry!)</p>
<p>1. Go to the Application Profile Page (linked to from right hand col on your app&#8217;s main page (where it shows stats, your app id, site url etc)</p>
<p>2. From Application Profile Page click on &#8220;Edit Application&#8221; &#8211; left hand col underneath profile pic</p>
<p>3. On the Edit App page there&#8217;s a list of app devs in the right hand col &#8211; just click on the &#8220;Add&#8221; link</p>
<p>4. Phew!</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2010/facebook-%e2%80%9cvalidation-failed-unable-to-update-developers-%e2%80%9d/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Console.log without Firebug installed causes problems</title>
		<link>http://numiko.com/labs/2010/console-log-without-firebug-install-causes-problems/</link>
		<comments>http://numiko.com/labs/2010/console-log-without-firebug-install-causes-problems/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 12:41:55 +0000</pubDate>
		<dc:creator>Jaron Ghani</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=284</guid>
		<description><![CDATA[Console.log is great for debugging JS code with Firefox&#8217;s Firebug plugin. However leaving your console.log calls in the JS code will cause it to fail silently and mysteriously on Firefox without Firebug. After a morning of confusion on a recent project, we turned up this Heisenbergian gotcha. Here&#8217;s a full explanation.]]></description>
			<content:encoded><![CDATA[<p>Console.log is great for debugging JS code with Firefox&#8217;s Firebug plugin. However leaving your console.log calls in the JS code will cause it to fail silently and mysteriously on Firefox without Firebug. After a morning of confusion on a recent project, we turned up this Heisenbergian gotcha. <a href="http://blog.patspam.com/2009/the-curse-of-consolelog">Here&#8217;s a full explanation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2010/console-log-without-firebug-install-causes-problems/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery &#8220;g is undefined&#8221;</title>
		<link>http://numiko.com/labs/2010/jquery-g-is-undefined/</link>
		<comments>http://numiko.com/labs/2010/jquery-g-is-undefined/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 13:33:27 +0000</pubDate>
		<dc:creator>Clare Lindley</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://numiko.com/labs/?p=282</guid>
		<description><![CDATA[OK totally quick post this. Was getting this error inexplicably in the console, couldn&#8217;t work out what was causing it, commented out all but the most simple lines of code&#8230;.. Still there! If in doubt &#8211; check the version of jQuery you&#8217;re using and try upgrading it. Worked for me. Incidentally this had nothing to [...]]]></description>
			<content:encoded><![CDATA[<p>OK totally quick post this. Was getting this error inexplicably in the console, couldn&#8217;t work out what was causing it, commented out all but the most simple lines of code&#8230;.. Still there! If in doubt &#8211; check the version of jQuery you&#8217;re using and try upgrading it. Worked for me. Incidentally this had nothing to do with AJAX/JSON &#8211; as I was still getting the error even without making any calls to any AJAX methods, BUT <a href="http://www.google.co.uk/search?q=jquery+g+is+undefined&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-GB:official&amp;client=firefox-a">all the search results I&#8217;d found</a> seemed to suggest a probelm in this area.</p>
]]></content:encoded>
			<wfw:commentRss>http://numiko.com/labs/2010/jquery-g-is-undefined/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

