<?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>Gamecreatures&#039; Development Blog</title>
	<atom:link href="http://www.gamecreatures.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gamecreatures.com/blog</link>
	<description>Software Development Adventures</description>
	<lastBuildDate>Mon, 02 Apr 2012 13:47:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A ruby idea</title>
		<link>http://www.gamecreatures.com/blog/2012/04/02/a-ruby-idea/</link>
		<comments>http://www.gamecreatures.com/blog/2012/04/02/a-ruby-idea/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 13:30:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[misc]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=226</guid>
		<description><![CDATA[In ruby you can check ranges via de &#8216;range&#8217; language construct. For example: (12..23).include?( value). But how about chaining &#8216;&#8217; operators. For example. currently in Ruby I must write the following Why isn&#8217;t it possible to write Well in fact &#8230; <a href="http://www.gamecreatures.com/blog/2012/04/02/a-ruby-idea/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In ruby you can check ranges via de &#8216;range&#8217; language construct. For example: (12..23).include?( value).<br />
But how about chaining &#8216;<', '<=', '=>&#8216; and &#8216;>&#8217; operators. </p>
<p>For example. currently in Ruby I must write the following</p>
<pre class="brush: ruby; title: ; notranslate">
if 10 &lt; x &amp;&amp; x &lt; 15
  # code
end
</pre>
<p>Why isn&#8217;t it possible to write</p>
<pre class="brush: ruby; title: ; notranslate">
if 10 &lt; x &lt; 15
  # code
end
</pre>
<p>Well in fact it is possible with some hacks :)<br />
The example below is only valid for Fixnum, but it describes the possibilities:</p>
<p>The hack is to just simply return the right hand. In Ruby this shouldn&#8217;t be a problem, because every object/values is true except false and nil.</p>
<pre class="brush: ruby; title: ; notranslate">
class Fixnum
  def &lt;(val)
    super ? val : false
  end
  def &lt;=(val)
    super ? val : false
  end
  def &gt;(val)
    super ? val : false
  end
  def &gt;=(val)
    super ? val : false
  end
end
</pre>
<p>To make this work the FalseClass should also support these operators, and simply return false to make the complete expression return false if one of them fails:</p>
<pre class="brush: ruby; title: ; notranslate">

class FalseClass
  def &lt;(val)
    false
  end
  alias :&lt;= :&lt;
  alias :&gt; :&lt;
  alias :&gt;= :&lt;
end
</pre>
<p>So 10 < x just returns 'x' on succes and returns false on error.</p>
<pre class="brush: ruby; title: ; notranslate">
if 10 &lt; x &lt; 15
  # code
end
</pre>
<p>I'm wondering what could/would be the 'problem' by using this construct? Is there a specific reason this has not been implemented this way? </p>
<p>BTW: just found a 'nice' implementation for this construct on: <a href='http://refactormycode.com/codes/1284-chained-comparisons-in-ruby'>http://refactormycode.com/codes/1284-chained-comparisons-in-ruby</a></p>
<pre class="brush: ruby; title: ; notranslate">
[:&lt;, :&gt;, :&lt;=, :&gt;=].each do |operator|
  [Float, Fixnum, Comparable].each do |klass|
    klass.class_eval {
      alias_method(&quot;__#{operator}__&quot;, operator)
      define_method(operator) do |operand|
        send(&quot;__#{operator}__&quot;, operand) and operand
      end
    }
  end
  FalseClass.send(:define_method, operator) { false }
end
</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2012%2F04%2F02%2Fa-ruby-idea%2F&amp;title=A%20ruby%20idea" id="wpa2a_2">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2012/04/02/a-ruby-idea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My ruby external-encoding hack</title>
		<link>http://www.gamecreatures.com/blog/2012/02/10/my-ruby-external-encoding-hack/</link>
		<comments>http://www.gamecreatures.com/blog/2012/02/10/my-ruby-external-encoding-hack/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 14:22:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=218</guid>
		<description><![CDATA[Reading (text)-files from disk is very easy in Ruby. When you are trying to do something with this content you can get in trouble. I&#8217;ve setup my environment very nicely, so Ruby treats external files as UTF-8. The trouble begins &#8230; <a href="http://www.gamecreatures.com/blog/2012/02/10/my-ruby-external-encoding-hack/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Reading (text)-files from disk is very easy in Ruby. </p>
<pre class="brush: ruby; title: ; notranslate">
content = IO.read( &quot;filename.txt&quot; )
</pre>
<p>When you are trying to do something with this content you can get in trouble.</p>
<pre class="brush: ruby; title: ; notranslate">
content.split(&quot;,&quot;)  # =&gt; invalid byte sequence in UTF-8
</pre>
<p>I&#8217;ve setup my environment very nicely, so Ruby treats external files as UTF-8. The trouble begins when you are trying to handle files that are encoded in the ISO-8859-1 or CP-1252 format and Ruby thinks they are UTF-8.</p>
<p>To accept both UTF-8 and ISO-8858-? formats I&#8217;ve implemented the following hack:</p>
<pre class="brush: ruby; title: ; notranslate">
  def convert_to_utf8(content)
    if content.valid_encoding?
      content
    else
      content.force_encoding(&quot;ISO-8859-1&quot;).encode(&quot;UTF-8&quot;)
    end
  end

  # reading the content:
  content = convert_to_utf8 IO.read( &quot;filename.txt&quot; ) 
</pre>
<p>This hack works for me because the text-files I use are in one of those formats.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2012%2F02%2F10%2Fmy-ruby-external-encoding-hack%2F&amp;title=My%20ruby%20external-encoding%20hack" id="wpa2a_4">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2012/02/10/my-ruby-external-encoding-hack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>has_many tricky replace method</title>
		<link>http://www.gamecreatures.com/blog/2011/12/23/has_many-tricky-replace-method/</link>
		<comments>http://www.gamecreatures.com/blog/2011/12/23/has_many-tricky-replace-method/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 13:15:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[has_many]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=209</guid>
		<description><![CDATA[Today I discovered a small bug / feature of rails 3.1.3. Having the following structure: It&#8217;s possible to completely replace the has_many collection with a new collection. Make this collection: All fine for the moment. As expected the enabled flag &#8230; <a href="http://www.gamecreatures.com/blog/2011/12/23/has_many-tricky-replace-method/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I discovered a small bug / feature of rails 3.1.3. </p>
<p>Having the following structure:</p>
<pre class="brush: ruby; title: ; notranslate">
class Item &lt; ActiveRecord::Base
  has_many :tags
end

class Tag &lt; ActiveRecord::Base
  # Tag has a boolean flag 'enabled'
  belongs_to :item
end
</pre>
<p>It&#8217;s possible to completely replace the has_many collection<br />
with a new collection. Make this collection:</p>
<pre class="brush: ruby; title: ; notranslate">
item = Item.find(1)
tags = [
  item.tags.create( :enabled =&gt; true, :name =&gt; &quot;tag1&quot; )
]
</pre>
<p>All fine for the moment. As expected the enabled flag of the first item is set:</p>
<pre class="brush: ruby; title: ; notranslate">
tags[0].name      # =&gt; &quot;tag1&quot;
tags[0].enabled?  # =&gt; true
</pre>
<p>Now replacing the existing tags:</p>
<pre class="brush: ruby; title: ; notranslate">
item.tags.replace( tags )
item.tags[0].name        # =&gt; &quot;tag1&quot;
item.tags[0].enabled?    # =&gt; false
</pre>
<p>What?? It just forgot the enabled flag!!</p>
<p>The way to replace the items is by assigning:</p>
<pre class="brush: ruby; title: ; notranslate">
item.tags = tags
item.tags[0].name        # =&gt; &quot;tag1&quot;
item.tags[0].enabled?    # =&gt; true
</pre>
<p>So remember when replacing collections of has_many do not replace them but assign them&#8230;. </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F12%2F23%2Fhas_many-tricky-replace-method%2F&amp;title=has_many%20tricky%20replace%20method" id="wpa2a_6">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/12/23/has_many-tricky-replace-method/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Slow response testing localhost sites in Google Chrome on Mac OS X</title>
		<link>http://www.gamecreatures.com/blog/2011/11/21/slow-response-testing-localhost-sites-in-google-chrome-on-mac-os-x/</link>
		<comments>http://www.gamecreatures.com/blog/2011/11/21/slow-response-testing-localhost-sites-in-google-chrome-on-mac-os-x/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 08:39:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[privacy]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=198</guid>
		<description><![CDATA[Last week I noticed the response of localhost requests were slow in Google Chrome, but responded very quickly in Safari. I suspected Chrome was submitting my local requests to it&#8217;s data hunger servers to build an even better profile of &#8230; <a href="http://www.gamecreatures.com/blog/2011/11/21/slow-response-testing-localhost-sites-in-google-chrome-on-mac-os-x/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last week I noticed the response of localhost requests were slow in Google Chrome, but responded very quickly in Safari. I suspected Chrome was submitting my local requests to it&#8217;s data hunger servers to build an even better profile of me.<br />
I tweaked a lot of Chrome settings so everything would be kept private, but no success. After several attempts I found the problem:</p>
<p>To test multiple sites and testing multi-domain rails applications I&#8217;ve changed my /etc/hosts file to contain the following items.</p>
<pre class="brush: plain; title: ; notranslate">
127.0.0.1 nice-domain.local
127.0.0.1 nice.sub-domain.local
127.0.0.1 gamecreatures.local
</pre>
<p>So calling: &#8220;gamecreatures.local&#8221; in Chrome causes a too long delay for showing something..<br />
calling &#8220;gamecreatures.local&#8221; in Safari responded instantly..</p>
<p>After doing some research, I&#8217;ve learned Apple is doing something special with the .local postfix. It is used by the Bonjour services somehow. I don&#8217;t know exactly what, but they do&#8230;</p>
<p>So changing all the extension from &#8220;.local&#8221; to something else for example &#8220;.loc&#8221; solved the issue for me:</p>
<pre class="brush: plain; title: ; notranslate">
127.0.0.1 nice-domain.loc
127.0.0.1 nice.sub-domain.loc
127.0.0.1 gamecreatures.loc
</pre>
<p>Now Chrome also responds instantly&#8230;<br />
Sorry Google for &#8220;assuming&#8221; you trying to steal all data from me&#8230; (Or should I use the <a href="http://www.gizmodo.co.uk/2011/11/dont-want-google-to-map-your-wi-fi-add-_nomap-to-your-ssid/">_nomap extension</a>  for this one too ?!?)</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F11%2F21%2Fslow-response-testing-localhost-sites-in-google-chrome-on-mac-os-x%2F&amp;title=Slow%20response%20testing%20localhost%20sites%20in%20Google%20Chrome%20on%20Mac%20OS%20X" id="wpa2a_8">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/11/21/slow-response-testing-localhost-sites-in-google-chrome-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 3.1 Assets Precompilation</title>
		<link>http://www.gamecreatures.com/blog/2011/10/20/rails-3-1-asset-precompilation/</link>
		<comments>http://www.gamecreatures.com/blog/2011/10/20/rails-3-1-asset-precompilation/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 04:49:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[assets]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=193</guid>
		<description><![CDATA[Today I tried to &#8216;release&#8217; our rails 3.1 product to the production environment. Which of course has precompiled assets. The app deployed nicely. But when I tried to start the app, I&#8217;ve got the following error: Deploying the app with &#8230; <a href="http://www.gamecreatures.com/blog/2011/10/20/rails-3-1-asset-precompilation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I tried to &#8216;release&#8217; our rails 3.1 product to the production environment. Which of course has precompiled assets.</p>
<p>The app deployed nicely. But when I tried to start the app, I&#8217;ve got the following error:</p>
<pre class="brush: plain; title: ; notranslate">
ActionView::Template::Error (locales/nl.js isn't precompiled):
...
</pre>
<p>Deploying the app with capistrano (which precompiles my assets) did not compile my javascript-locales.</p>
<p>The cause of this seeems to the that the assets pipeline precompilation task, only precompiles the application.js file&#8230; </p>
<p>To add extra files for precompilation, place the following code in your config/application.rb:</p>
<pre class="brush: plain; title: ; notranslate">
    config.assets.precompile &lt;&lt; &quot;locales/*.js&quot;
    config.assets.precompile += %w(rails_admin/rails_admin.js rails_admin/rails_admin.css)
</pre>
<p>This examples precompiles ALL my locale files in the app/assets/locales/* directory.</p>
<p>And as a bonus it also compiles the assets of the the rails_admin plugin.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F10%2F20%2Frails-3-1-asset-precompilation%2F&amp;title=Rails%203.1%20Assets%20Precompilation" id="wpa2a_10">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/10/20/rails-3-1-asset-precompilation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails / ChiliProject encoding issues</title>
		<link>http://www.gamecreatures.com/blog/2011/09/15/ruby-on-rails-chiliproject-encoding-issues/</link>
		<comments>http://www.gamecreatures.com/blog/2011/09/15/ruby-on-rails-chiliproject-encoding-issues/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 12:31:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=186</guid>
		<description><![CDATA[This week I&#8217;ve decided to exchange Redmine for the ChiliProject. The reason for this is the support for Ruby 1.9. My Apache Passenger server runs Ruby 1.9 so for Redmine I needed a seperate webserver. When I tried to access &#8230; <a href="http://www.gamecreatures.com/blog/2011/09/15/ruby-on-rails-chiliproject-encoding-issues/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This week I&#8217;ve decided to exchange <a href='http://redmin.org'>Redmine</a> for the <a href='http://chiliproject.org'>ChiliProject</a>. The reason for this is the support for Ruby 1.9. My Apache Passenger server runs Ruby 1.9 so for Redmine I needed a seperate webserver.</p>
<p>When I tried to access the &#8220;My Account&#8221; page I recieved the following error:</p>
<pre class="brush: plain; title: ; notranslate">
ArgumentError (invalid byte sequence in US-ASCII):
  &lt;internal:prelude&gt;:10:in `synchronize'
  passenger (3.0.7) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.7) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  passenger (3.0.7) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.7) ...
`handle_spawn_application'
  passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.7) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.7) helper-scripts/passenger-spawn-server:99:in `&lt;main&gt;'

Rendering /data/www/rails/chili/public/500.html (500 Internal Server Error)
</pre>
<h2>Solution</h2>
<p>How should I solve this? The chiliproject has an issue related to this: <a href='https://www.chiliproject.org/issues/591'>https://www.chiliproject.org/issues/591</a>. </p>
<p>The following Apache configuration fixed the issue: (The sample is on a FreeBSD system)</p>
<p>I added the following code to a file in the  /usr/local/apache22/envvars.d/environment.env</p>
<pre class="brush: plain; title: ; notranslate">
export LC_CTYPE=&quot;en_US.UTF-8&quot;
</pre>
<h2>Problems I ruled out or fixed</h2>
<p>While trying I also made sure the following things were configured:</p>
<p>I made sure the database is UTF-8. I re-created the database<br />
an ran the migrations again.</p>
<pre class="brush: plain; title: ; notranslate">
create database chiliproject character set utf8;
</pre>
<p>I used the mysql2 connector instead of the mysql connector in database.yml</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F09%2F15%2Fruby-on-rails-chiliproject-encoding-issues%2F&amp;title=Ruby%20on%20Rails%20%2F%20ChiliProject%20encoding%20issues" id="wpa2a_12">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/09/15/ruby-on-rails-chiliproject-encoding-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Ruby on Rails 3.1 on FreeBSD</title>
		<link>http://www.gamecreatures.com/blog/2011/09/06/running-rail-3-1-on-freebsd/</link>
		<comments>http://www.gamecreatures.com/blog/2011/09/06/running-rail-3-1-on-freebsd/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 07:45:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[freebsd]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=177</guid>
		<description><![CDATA[Are you trying to install / run Rails 3.1 on a FreeBSD system&#8230;? You will probably get errors of a missing javascript engine. You should try to install node and google V8 as javascript engine Now it should work :-)]]></description>
			<content:encoded><![CDATA[<p>Are you trying to install / run Rails 3.1 on a FreeBSD system&#8230;?<br />
You will probably get errors of a missing javascript engine.</p>
<p>You should try to install node and google V8 as javascript engine</p>
<pre class="brush: plain; title: ; notranslate">
cd /usr/ports/lang/v8
make install clean
</pre>
<pre class="brush: plain; title: ; notranslate">
cd /usr/ports/www/node
make install clean
</pre>
<p>Now it  should work :-)</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F09%2F06%2Frunning-rail-3-1-on-freebsd%2F&amp;title=Running%20Ruby%20on%20Rails%203.1%20on%20FreeBSD" id="wpa2a_14">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/09/06/running-rail-3-1-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mac OS X Lion hangs on boot</title>
		<link>http://www.gamecreatures.com/blog/2011/09/06/mac-os-x-lion-hangs-on-boot/</link>
		<comments>http://www.gamecreatures.com/blog/2011/09/06/mac-os-x-lion-hangs-on-boot/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 05:05:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[misc]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=160</guid>
		<description><![CDATA[I&#8217;ve got a very grumpy Lion version&#8230; Once ever 2/3 boots it hangs on startup&#8230; Lion is almost booted and shows a white screen with the Apple inside. But 15-20 minutes later the image is the same. (I never waited &#8230; <a href="http://www.gamecreatures.com/blog/2011/09/06/mac-os-x-lion-hangs-on-boot/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got a very grumpy Lion version&#8230; Once ever 2/3 boots it hangs<br />
on startup&#8230;</p>
<p>Lion is almost booted and shows a white screen with the Apple inside.<br />
But 15-20 minutes later the image is the same. (I never waited longer, so maybe it&#8217;s still booting).</p>
<p>The next boot it just works again&#8230;</p>
<p>After inspecting the log files I see this logged on the end (the last log item of the previous boot)</p>
<pre class="brush: plain; title: ; notranslate">
Sep  5 19:12:05 MacCreature mds[48]: (Error) ImportServer: &lt;MDSImporterWrangler: 0x7fc21bc4ddc0&gt; still waiting for plug-in info from mdworker
Sep  5 19:12:06 MacCreature mds[48]: (Error) ImportServer: &lt;MDSImporterWrangler: 0x7fc21bc92710&gt; still waiting for plug-in info from mdworker
</pre>
<p>MDS seems to be the spotlight indexer&#8230;</p>
<h2>Plugins</h2>
<p>The message tells me its waiting for a plugin. (not which plugin).</p>
<p>I&#8217;ve tried to move all plugins I do not use. Well I only use spotlight to quickly start apps and find filenames or search textfiles. So I disabled ALL plugins:</p>
<pre class="brush: plain; title: ; notranslate">
mkdir /Library/Spotlight/Disabled
mv /Library/Spotlight/*.mdimporter /Library/Spotlight/Disabled
</pre>
<p>That went well..<br />
Rebooting (a few times): still the same issue<br />
Bad luck</p>
<h2>Disabling Indexing Service</h2>
<p>View the status of the indexing service, for all (-a) drives.</p>
<pre class="brush: plain; title: ; notranslate">
sudo mdutil -s -a
</pre>
<p>Disable indexing for all drives</p>
<pre class="brush: plain; title: ; notranslate">
sudo mdutil -a -i off
</pre>
<p>Erase all indices.</p>
<pre class="brush: plain; title: ; notranslate">
sudo mdutil -a -E
</pre>
<p>Remove the true file. Doing this &#8216;forgets&#8217; all your spotlight setttings<br />
WARNING: Remember all your spotlight exclusions!!</p>
<pre class="brush: plain; title: ; notranslate">
cd /Volumes/your_hard_drive_name_1
sudo rm -fr .Spotlight-V100
</pre>
<p>Turn back on indexing (And put the exclusion back on)</p>
<pre class="brush: plain; title: ; notranslate">
sudo mdutil -i on /
</pre>
<h2>Disable Mobile Backups</h2>
<p>Not required for my problem, but I don&#8217;t like these mobile backups. I&#8217;ve got a rsync script to a local server and use an external harddisk every week.</p>
<pre class="brush: plain; title: ; notranslate">
sudo tmutil disablelocal
</pre>
<p>It seem to have worked&#8230;.<br />
Now cross my fingers. I hate Windows-like issues on my Mac!! :S</p>
<hr />
<p>The complete failing bootlog was:</p>
<pre class="brush: plain; title: ; notranslate">
05-09-11 19:08:15,000 bootlog: BOOT_TIME 1315242495 0
05-09-11 19:08:25,000 kernel: Darwin Kernel Version 11.1.0: Tue Jul 26 16:07:11 PDT 2011; root:xnu-1699.22.81~1/RELEASE_X86_64
05-09-11 19:08:25,000 kernel: vm_page_bootstrap: 941374 free pages and 33474 wired pages
05-09-11 19:08:25,000 kernel: kext submap [0xffffff7f8072e000 - 0xffffff8000000000], kernel text [0xffffff8000200000 - 0xffffff800072e000]
05-09-11 19:08:25,000 kernel: zone leak detection enabled
05-09-11 19:08:25,000 kernel: standard timeslicing quantum is 10000 us
05-09-11 19:08:25,000 kernel: mig_table_max_displ = 72
05-09-11 19:08:25,000 kernel: AppleACPICPU: ProcessorId=0 LocalApicId=0 Enabled
05-09-11 19:08:25,000 kernel: AppleACPICPU: ProcessorId=1 LocalApicId=1 Enabled
05-09-11 19:08:25,000 kernel: calling mpo_policy_init for TMSafetyNet
05-09-11 19:08:25,000 kernel: Security policy loaded: Safety net for Time Machine (TMSafetyNet)
05-09-11 19:08:25,000 kernel: calling mpo_policy_init for Sandbox
05-09-11 19:08:25,000 kernel: Security policy loaded: Seatbelt sandbox policy (Sandbox)
05-09-11 19:08:25,000 kernel: calling mpo_policy_init for Quarantine
05-09-11 19:08:25,000 kernel: Security policy loaded: Quarantine policy (Quarantine)
05-09-11 19:08:25,000 kernel: Copyright (c) 1982, 1986, 1989, 1991, 1993
05-09-11 19:08:25,000 kernel: The Regents of the University of California. All rights reserved.
05-09-11 19:08:25,000 kernel: MAC Framework successfully initialized
05-09-11 19:08:25,000 kernel: using 16384 buffer headers and 10240 cluster IO buffer headers
05-09-11 19:08:25,000 kernel: IOAPIC: Version 0x11 Vectors 64:87
05-09-11 19:08:25,000 kernel: ACPI: System State [S0 S3 S4 S5] (S3)
05-09-11 19:08:25,000 kernel: AppleIntelCPUPowerManagement: (built 13:08:12 Jun 18 2011) initialization complete
05-09-11 19:08:25,000 kernel: PFM64 0xf10000000, 0xf0000000
05-09-11 19:08:25,000 kernel: [ PCI configuration begin ]
05-09-11 19:08:25,000 kernel: console relocated to 0xf10030000
05-09-11 19:08:25,000 kernel: PCI configuration changed (bridge=6 device=3 cardbus=0)
05-09-11 19:08:25,000 kernel: [ PCI configuration end, bridges 7 devices 19 ]
05-09-11 19:08:25,000 kernel: FireWire (OHCI) Lucent ID 5901 built-in now active, GUID 002332fffec9f878; max speed s800.
05-09-11 19:08:25,000 kernel: mbinit: done [64 MB total pool size, (42/21) split]
05-09-11 19:08:25,000 kernel: Pthread support ABORTS when sync kernel primitives misused
05-09-11 19:08:25,000 kernel: com.apple.AppleFSCompressionTypeZlib kmod start
05-09-11 19:08:25,000 kernel: com.apple.AppleFSCompressionTypeDataless kmod start
05-09-11 19:08:25,000 kernel: handsoff: os version is 10.7
05-09-11 19:08:25,000 kernel: com.apple.AppleFSCompressionTypeZlib load succeeded
05-09-11 19:08:25,000 kernel: com.apple.AppleFSCompressionTypeDataless load succeeded
05-09-11 19:08:25,000 kernel: AppleIntelCPUPowerManagementClient: ready
05-09-11 19:08:25,000 kernel: BTCOEXIST off
05-09-11 19:08:25,000 kernel: wl0: Broadcom BCM432b 802.11 Wireless Controller
05-09-11 19:08:25,000 kernel: 5.100.98.75
05-09-11 19:08:25,000 kernel: [IOBluetoothHCIController::setConfigState] calling registerService
05-09-11 19:08:25,000 kernel: rooting via boot-uuid from /chosen: F58F69CF-CB44-3EC7-96CD-2E70F97504AA
05-09-11 19:08:25,000 kernel: Waiting on &lt;dict ID=&quot;0&quot;&gt;&lt;key&gt;IOProviderClass&lt;/key&gt;&lt;string ID=&quot;1&quot;&gt;IOResources&lt;/string&gt;&lt;key&gt;IOResourceMatch&lt;/key&gt;&lt;string ID=&quot;2&quot;&gt;boot-uuid-media&lt;/string&gt;&lt;/dict&gt;
05-09-11 19:08:25,000 kernel: Got boot device = IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/SATA@B/AppleMCP79AHCI/PRT0@0/IOAHCIDevice@0/AppleAHCIDiskDriver/IOAHCIBlockStorageDevice/IOBlockStorageDriver/Hitachi HTS725050A9A364 Media/IOGUIDPartitionScheme/Mac OS X@2
05-09-11 19:08:25,000 kernel: BSD root: disk0s2, major 14, minor 2
05-09-11 19:08:25,000 kernel: Kernel is LP64
05-09-11 19:08:17,083 com.apple.launchd: *** launchd[1] has started up. ***
05-09-11 19:08:24,422 com.apple.launchd: (com.parallels.desktop.launchdaemon) Unknown key for boolean: HopefullyExitsFirst
05-09-11 19:08:24,422 com.apple.launchd: (com.stclairsoft.AppTamerAgent) Unknown key for string: Version
05-09-11 19:08:24,422 com.apple.launchd: (com.stclairsoft.AppTamerAgent) Unknown key: Version
05-09-11 19:08:26,608 UserEventAgent: starting CaptiveNetworkSupport as SystemEventAgent built Jun 13 2011 17:29:21
05-09-11 19:08:26,612 UserEventAgent: CaptiveNetworkSupport:CreateInterfaceWatchList:2788 WiFi Devices Found. :)
05-09-11 19:08:26,612 UserEventAgent: CaptiveNetworkSupport:CaptivePublishState:1211 en1 - PreProbe
05-09-11 19:08:26,612 UserEventAgent: CaptiveNetworkSupport:CaptiveSCRebuildCache:81 Failed to get service order
05-09-11 19:08:26,613 UserEventAgent: CaptiveNetworkSupport:CaptiveSCRebuildCache:81 Failed to get service order
05-09-11 19:08:26,613 UserEventAgent: CaptiveNetworkSupport:CaptivePublishState:1211 en1 - PreProbe
05-09-11 19:08:26,613 UserEventAgent: CaptiveNetworkSupport:CaptiveSCRebuildCache:81 Failed to get service order
05-09-11 19:08:26,613 UserEventAgent: CaptiveNetworkSupport:CaptiveSCRebuildCache:81 Failed to get service order
05-09-11 19:08:26,955 UserEventAgent: CertsKeychainMonitor: configuring
05-09-11 19:08:27,000 kernel: NVEthernet: Ethernet address 00:23:32:c9:f8:78
05-09-11 19:08:27,000 kernel: AirPort_Brcm4331: Ethernet address 00:23:12:54:97:49
05-09-11 19:08:27,000 kernel: IO80211Controller::dataLinkLayerAttachComplete():  adding AppleEFINVRAM notification
05-09-11 19:08:28,829 com.apple.SecurityServer: Session 100000 created
05-09-11 19:08:28,975 airportd: _processDLILEvent: en1 attached (down)
05-09-11 19:08:29,000 kernel: Created virtif 0xffffff800cc57e00 p2p0
05-09-11 19:08:29,245 com.apple.SecurityServer: Entering service
05-09-11 19:08:29,000 kernel: AGC: 3.0.7b1, HW version=1.7.3, flags:0, features:4
05-09-11 19:08:29,000 kernel: NVDANV50HAL loaded and registered.
05-09-11 19:08:29,343 UserEventAgent: CaptiveNetworkSupport:CaptivePublishState:1211 en1 - PreProbe
05-09-11 19:08:29,683 UserEventAgent: ServermgrdRegistration cannot load config data
05-09-11 19:08:30,000 kernel: AirPort: Link Down on en1. Reason 8 (Disassociated because station leaving).
05-09-11 19:08:30,000 kernel: NVDANV50HAL loaded and registered.
05-09-11 19:08:30,000 kernel: Previous Shutdown Cause: 5
05-09-11 19:08:30,000 kernel: DSMOS has arrived
05-09-11 19:08:30,382 com.apple.pfctl: No ALTQ support in kernel
05-09-11 19:08:30,382 com.apple.pfctl: ALTQ related functions disabled
05-09-11 19:08:30,538 com.apple.ucupdate.plist: ucupdate: Checked 1 update, no match found.
05-09-11 19:08:31,000 kernel: 00000000  00000020  NVEthernet::setLinkStatus - not Active
05-09-11 19:08:31,535 UserEventAgent: get_backup_share_points no AFP
05-09-11 19:08:32,000 kernel: Ethernet [nvenet]: Link up on en0, 100-Megabit, Full-duplex, Symmetric flow-control, Debug [796d,0000,0de1,0005,45e1,0000]
05-09-11 19:08:32,000 kernel: 05f5e100  00500026  NVEthernet::setLinkStatus - Active
05-09-11 19:08:32,000 kernel: Ethernet [nvenet]: Link up on en0, 100-Megabit, Full-duplex, Symmetric flow-control, Debug [796d,0000,0de1,0005,45e1,0000]
05-09-11 19:08:32,000 kernel: 05f5e100  00500026  NVEthernet::setLinkStatus - Active
05-09-11 19:08:32,000 kernel: macx_swapon SUCCESS
05-09-11 19:08:34,682 configd: bootp_session_transmit: bpf_write(en1) failed: Network is down (50)
05-09-11 19:08:34,682 configd: DHCP en1: INIT-REBOOT transmit failed
05-09-11 19:08:36,854 Parallels: Loading kernel extension  prl_hypervisor.kext
05-09-11 19:08:37,322 com.apple.usbmuxd: usbmuxd-211 built on May 16 2011 at 00:14:56 on May 16 2011 at 00:14:55, running 64 bit
05-09-11 19:08:37,322 configd: setting hostname to &quot;MacCreature.local&quot;
05-09-11 19:08:37,335 configd: network configuration changed.
05-09-11 19:08:40,711 systemkeychain: done file: /var/run/systemkeychaincheck.done
05-09-11 19:08:41,537 rpcsvchost: sandbox_init: com.apple.msrpc.netlogon.sb succeeded
05-09-11 19:08:43,039 com.apple.launchd: (com.apple.netbiosd[72]) Exited abnormally: Hangup: 1
05-09-11 19:08:44,906 loginwindow: Login Window Application Started
05-09-11 19:08:45,324 configd: network configuration changed.
05-09-11 19:08:46,000 kernel: NTFS driver 3.8 [Flags: R/W].
05-09-11 19:08:47,111 mds: (Normal) FMW: FMW 0 0
05-09-11 19:08:48,745 Parallels: Loading kernel extension  prl_hid_hook.kext
05-09-11 19:08:49,000 kernel: /drv/ HypApic.c:230   Host APIC  phy 0xFEE00000  lin 0xffffff80795cd000  ver 0x14
05-09-11 19:08:49,000 kernel: /drv/ HypVtd.c:3718   [vtdInit]
05-09-11 19:08:49,000 kernel: /drv/ HypVtd.c:3734   [vtdInit] VTD initialization disabled
05-09-11 19:08:49,000 kernel: /drv/ HypLowCache.c:173   Low cache initialized (6848 kB for 8 VMs on 4096 MB)
05-09-11 19:08:49,000 kernel: /drv/ HypSMBios.c:54   Failed to find SMBios entry point
05-09-11 19:08:49,000 kernel: /drv/ HypModule.c:174   Parallels IPI irq = 0 ipi = 0(0x0)
05-09-11 19:08:49,000 kernel: /drv/ HypModule.c:181   Parallels Hypervisor 6.0.12094.676494 loaded.
05-09-11 19:08:49,000 kernel: NTFS volume name BOOTCAMP, version 3.1.
05-09-11 19:08:50,049 Parallels: Loading kernel extension  prl_usb_connect.kext
05-09-11 19:08:51,000 kernel: /prl_hid/ Parallels HID Helper started.
05-09-11 19:08:55,030 Parallels: Trying to load kernel extensions, exit status: 0
05-09-11 19:08:55,034 Parallels: Starting Parallels networking...
05-09-11 19:08:55,000 kernel: nstat_lookup_entry failed: 2
05-09-11 19:08:55,215 Parallels: Loading kernel extension  prl_netbridge.kext
05-09-11 19:08:55,465 UserEventAgent: ServermgrdRegistration cannot load config data
05-09-11 19:08:55,465 UserEventAgent: ServermgrdRegistration oldConfig is nil during net changed notification
05-09-11 19:08:56,817 Parallels: Loading kernel extension  prl_vnic.kext
05-09-11 19:08:57,000 kernel: com.parallels.kext.prlnet 6.0.12094.676494 has started.
05-09-11 19:08:58,000 kernel: 0        0 AppleUSBCDC: start - initDevice failed
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,000 kernel: No interval found for . Using 8000000
05-09-11 19:08:58,038 UserEventAgent: servermgr_certs[11] -[CertsRequestHandler(HelperAdditions) identitiesFromKeychain:]:	SecItemCopyMatching (err = -25300)
05-09-11 19:08:59,000 kernel: com.parallels.kext.vnic 6.0.12094.676494 has started.
05-09-11 19:09:00,279 mDNSResponder: mDNSResponder mDNSResponder-320.5.1 (Aug  3 2011 19:57:38) starting OSXVers 11
05-09-11 19:09:08,423 com.apple.UserEventAgent-System: SecItemCopyMatching: Het opgegeven onderdeel komt niet voor in de sleutelhanger.
05-09-11 19:09:08,435 UserEventAgent: servermgr_certs[11] -[CertsRequestHandler(HelperAdditions) identitiesFromKeychain:]:	SecItemCopyMatching (err = -25300)
05-09-11 19:09:08,435 com.apple.UserEventAgent-System: SecItemCopyMatching: Het opgegeven onderdeel komt niet voor in de sleutelhanger.
05-09-11 19:09:08,436 UserEventAgent: CertsKeychainMonitor: ready to process keychain &amp; timer events
05-09-11 19:12:05,281 mds: (Error) ImportServer: &lt;MDSImporterWrangler: 0x7fc21bc4ddc0&gt; still waiting for plug-in info from mdworker
05-09-11 19:12:06,463 mds: (Error) ImportServer: &lt;MDSImporterWrangler: 0x7fc21bc92710&gt; still waiting for plug-in info from mdworker
</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F09%2F06%2Fmac-os-x-lion-hangs-on-boot%2F&amp;title=Mac%20OS%20X%20Lion%20hangs%20on%20boot" id="wpa2a_16">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/09/06/mac-os-x-lion-hangs-on-boot/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing Ruby on Rails with Mysql on Windows</title>
		<link>http://www.gamecreatures.com/blog/2011/08/31/installing-ruby-on-rails-with-mysql-on-windows/</link>
		<comments>http://www.gamecreatures.com/blog/2011/08/31/installing-ruby-on-rails-with-mysql-on-windows/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 20:58:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql2]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=131</guid>
		<description><![CDATA[No I don&#8217;t like working on Windows, but unfortunately my co-workers haven&#8217;t seen the light yet. To make the rails setup a bit easier I needed to document the installation of Ruby on Rails on Windows with a Mysql database. &#8230; <a href="http://www.gamecreatures.com/blog/2011/08/31/installing-ruby-on-rails-with-mysql-on-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>No I don&#8217;t like working on Windows, but unfortunately my co-workers haven&#8217;t seen the light yet. </p>
<p>To make the rails setup a bit easier I needed to document the installation of Ruby on Rails on Windows with a Mysql database.<br />
The description is about Ruby 1.9.?, Rails 3.0, Mysql 5.5 with the mysql2 gem.. and a lot of gems that got installed and compiled via &#8220;bundle install&#8221;</p>
<p>Here&#8217;s a raw extract of the document I build:</p>
<h2>1. Install MySQL</h2>
<p>In our situation MySQL was installed. But you should install MySQL with development files. (C++ headers and Libraries).<br />
Just download the Community Server at <a href='http://mysql.com/'>http://mysql.com/</a>.</p>
<h2>2. Install Ruby</h2>
<p>Install the base Ruby version. Download the installer at <a href='http://rubyinstaller.org/'>http://rubyinstaller.org/</a><br />
Run the installer and check the following items:</p>
<ul>
<li>Add Ruby executables to your PATH</li>
<li>Associate .rb and .rbw files with this Ruby Installation</li>
</ul>
<h2>3. Install DevKit</h2>
<p>Because a lot of Ruby plugins make use of Native extensions you need a compiler. For windows there&#8217;s devkit to the rescue. Download it at rubyinstaller: <a href='http://rubyinstaller.org/'>http://rubyinstaller.org/</a>.</p>
<p>Extract this to (for example) c:/devkit (this text assumes this location)<br />
Open a command prompt: (cmd.exe) and enter the following commands.</p>
<pre class="brush: plain; title: ; notranslate">
cd c:/devkit
ruby dk.rb init
</pre>
<p>DevKit wil probably find your ruby installation. But to make sure check the file c:/devkit/config.yml. It should contain the path of your Ruby installation:</p>
<pre class="brush: plain; title: ; notranslate">
---
- C:/Ruby192
</pre>
<blockquote><p>This step installs (or updates) an operating_system.rb file into the relevant directory needed to implement a RubyGems pre_install hook and a devkit.rb helper library file into <RUBY_INSTALL_DIR>\lib\ruby\site_ruby. NOTE: you may need to use the –force option to update (with backup of the originals) the above mentioned files as discussed at the SFX DevKit upgrade FAQ entry.</p></blockquote>
<p>Test the Devkit installation Confirm your Ruby environment is correctly using the DevKit by running.</p>
<pre class="brush: plain; title: ; notranslate">
gem install rdiscount --platform=ruby
</pre>
<p>RDiscount should install correctly and you should see:</p>
<blockquote><p>
Temporarily enhancing PATH to include DevKit&#8230; in the screen messages.
</p></blockquote>
<p>After this double check if it works by running:</p>
<pre class="brush: plain; title: ; notranslate">
ruby -rubygems -e &quot;require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html&quot;
</pre>
<p>to confirm that the rdiscount gem is working. (This should generate HTML)<br />
(More info: <a href='https://github.com/oneclick/rubyinstaller/wiki/Development-Kit'>https://github.com/oneclick/rubyinstaller/wiki/Development-Kit</a> )</p>
<h2>4. Install Git</h2>
<p>If you not already have installed git, please do it. You will like it!<br />
Git is required for many plugins so you need it.</p>
<ul>
<li>download git at <a href='http://code.google.com/p/msysgit/'>http://code.google.com/p/msysgit/</a> (choose a version I don&#8217;t know :P, the latest .exe ?? )</li>
<li>execute the installer, select the following options:
<ul>
<li>check “Run Git and included tools from the windows command prompt” (Select the option with the red letters that scream &#8220;don&#8217;t pick me&#8221; :P )</li>
<li>checkout-as-is and commit-as-it.</li>
</ul>
</ul>
<h2>5. Install Rails with the mysql2 plugin</h2>
<p>Next install Ruby on Rails. (We don&#8217;t install/generate the docs)</p>
<pre class="brush: plain; title: ; notranslate">
gem install rails --no-ri --no-rdoc
</pre>
<h2>6. Install the mysql2 gem</h2>
<p>To build mysql2 support do this: (Point the paths to your MySQL install directory!)</p>
<p>NOTE: When using a 64bit version of windows you probably run into issues. Thanks for mentioning Luis! (Read more about it: <a href='http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/'>http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/</a> ).</p>
<pre class="brush: plain; title: ; notranslate">
gem install mysql2 -- '--with-mysql-lib=&quot;c:\Program Files\MySQL\MySQL Server 5.5\lib&quot; --with-mysql-include=&quot;c:\Program Files\MySQL\MySQL Server 5.5\include&quot;'
</pre>
<p>(Mysql5.1 seems to have the path: c:\Program Files\MySQL\MySQL Server 5.1\lib\opt)</p>
<p>Fix up Bundler (the gem management tool) to know what the mysql2 gem build settings need to be..<br />
Else you&#8217;re &#8220;bundle install&#8221; will fail when installing or updating the mysql2 gem!!</p>
<pre class="brush: plain; title: ; notranslate">
bundle config build.mysql2 '--with-mysql-lib=&quot;c:\Program Files\MySQL\MySQL Server 5.5\lib&quot; --with-mysql-include=&quot;c:\Program Files\MySQL\MySQL Server 5.5\include&quot;'
</pre>
<p>As soon as you start using this installation you could get errors like &#8216;libmysql.dll not found.<br />
To solve this copy this file from the  mysql-installation/lib directory to the ruby/bin directory.</p>
<h2>Slightly Unrelated, install the Rails app</h2>
<p>Pull the rails app from git. (Or copy it). And run bundler install to install all gems..</p>
<pre class="brush: plain; title: ; notranslate">
cd /rails/app
bundle install
</pre>
<p>I&#8217;ve recieved the following error when doing this:</p>
<pre class="brush: plain; title: ; notranslate">
Resolving deltas: 100% (3434/3434), done.
Checking out files: 100% (85/85), done.
Fetching source index for http://rubygems.org/

Could not find devise-1.4.0 in any of the sources
</pre>
<p>I seems that devise was updated and the specific version in Gemfile.lock wasn&#8217;t available anymore.<br />
You can Force the installation of this updated package</p>
<pre class="brush: plain; title: ; notranslate">
bundle update devise
</pre>
<p>These were my steps to build a working rails environment under windows&#8230;<br />
Enough of windows, Now back to my Mac :P</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F08%2F31%2Finstalling-ruby-on-rails-with-mysql-on-windows%2F&amp;title=Installing%20Ruby%20on%20Rails%20with%20Mysql%20on%20Windows" id="wpa2a_18">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/08/31/installing-ruby-on-rails-with-mysql-on-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL Concat method can make string searching case-sensitive</title>
		<link>http://www.gamecreatures.com/blog/2011/08/26/mysql-concat-method-can-make-string-searching-case-sensitive/</link>
		<comments>http://www.gamecreatures.com/blog/2011/08/26/mysql-concat-method-can-make-string-searching-case-sensitive/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 09:09:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.gamecreatures.com/blog/?p=126</guid>
		<description><![CDATA[I have the following table-structure in the database. An integer column for the number and a varchar as the prefix. billings: The following record is in the database: The complete billing number is represented to the client as &#8220;FatOrders-42&#8243;. Now &#8230; <a href="http://www.gamecreatures.com/blog/2011/08/26/mysql-concat-method-can-make-string-searching-case-sensitive/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have the following table-structure in the database.<br />
An integer column for the number and a varchar as the prefix.</p>
<p>billings:</p>
<pre class="brush: plain; title: ; notranslate">
billing_prefix VARCHAR(200)
billing_nr     INTEGER NOT NULL
.. and more field, but unimportant for this example
</pre>
<p>The following record is in the database:</p>
<pre class="brush: plain; title: ; notranslate">
billing_prefix: FatOrders-
billing_nr    : 42
</pre>
<p>The complete billing number is represented to the client as &#8220;FatOrders-42&#8243;.<br />
Now I have a application that enables the user to search the list with a string. (on several fields)<br />
A client searching for &#8216;fat&#8217; results in the following query:</p>
<pre class="brush: plain; title: ; notranslate">
SELECT * FROM billings WHERE CONCAT( billing_prefix, billing_nr ) LIKE '%fat%'
</pre>
<p>No results..<br />
This is not the behaviour I need :P</p>
<p>Mysql tells me this:</p>
<blockquote><p>
If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string. A <strong>numeric argument</strong> is converted to its equivalent binary string form
</p></blockquote>
<p>An simple solution is to modify the query to this one:</p>
<pre class="brush: plain; title: ; notranslate">
SELECT * FROM billings WHERE CONCAT( billing_prefix, CAST( billing_nr AS char) ) LIKE '%fat%'
</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.gamecreatures.com%2Fblog%2F2011%2F08%2F26%2Fmysql-concat-method-can-make-string-searching-case-sensitive%2F&amp;title=MySQL%20Concat%20method%20can%20make%20string%20searching%20case-sensitive" id="wpa2a_20">share!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.gamecreatures.com/blog/2011/08/26/mysql-concat-method-can-make-string-searching-case-sensitive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

