<?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>James' Blog</title>
	<atom:link href="http://www.bangheadonwall.net/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.bangheadonwall.net</link>
	<description>James' personal blog</description>
	<lastBuildDate>Thu, 09 Sep 2010 23:14:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Image not refreshing reading from cache</title>
		<link>http://www.bangheadonwall.net/?p=180</link>
		<comments>http://www.bangheadonwall.net/?p=180#comments</comments>
		<pubDate>Thu, 09 Sep 2010 07:15:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=180</guid>
		<description><![CDATA[I found this little trick when you have an image or some other object that needs to be refreshed but for some reason the browser is reading from the cache.  

var timestamp = new Date().getTime();

Simple get the date and time from the above code and append that after a &#8216;?&#8217; + timestamp after your [...]]]></description>
			<content:encoded><![CDATA[<p>I found this little trick when you have an image or some other object that needs to be refreshed but for some reason the browser is reading from the cache.  </p>
<pre class="brush:html">
var timestamp = new Date().getTime();
</pre>
<p>Simple get the date and time from the above code and append that after a &#8216;?&#8217; + timestamp after your image name.  This will not affect the image that gets loaded and the browser will automatically reload the image.</p>
<p>*Update*<br />
It was brought to my attention that this method may not be good SEO as you are effectively adding garbage to the image name and lengthening the name significantly as well.  Alternative solutions seem to include using nocache option in the meta tags or possibly using javascript for a refresh</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=180</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animated GIF not animated in Internet Explorer</title>
		<link>http://www.bangheadonwall.net/?p=173</link>
		<comments>http://www.bangheadonwall.net/?p=173#comments</comments>
		<pubDate>Tue, 07 Sep 2010 08:15:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=173</guid>
		<description><![CDATA[Issue:  In order to show the user that the system is working during an AJAX call I use an animated gif.  A problem arose in Internet Explorer 8 that when I submitted the form the animated gif would stop and freeze.  This issue does not come up with any other browsers.  I looked for various [...]]]></description>
			<content:encoded><![CDATA[<p>Issue:  In order to show the user that the system is working during an AJAX call I use an animated gif.  A problem arose in Internet Explorer 8 that when I submitted the form the animated gif would stop and freeze.  This issue does not come up with any other browsers.  I looked for various solutions and some people mentioned resetting the img src in javascript or to use some time of setTimeout, but none of those methods worked for me.  </p>
<p>Here is the line of code that ultlimately worked:</p>
<pre class="brush:javascript">
document.getElementById('ajax_spinner').parentNode.style.display = 'block';
</pre>
<p>The only reasoning that I was able to find from the original poster was that it somehow established a connection with the parent node.  In this case, I put a div tag around the image and set the style to display:none, so this line of code actually modifies the div which encapsulates the image.  The image style does not control the visibility or display of itself.</p>
<p>*Update*<br />
Additional I have found that putting this code in the onclick of a submit button does not work.  I had to replace the submit button with a standard button and submit the form via javascript.<br />
 jQuery(&#8220;#my_form_name&#8221;).submit();</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=173</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>return JSON to Rails via AJAX</title>
		<link>http://www.bangheadonwall.net/?p=167</link>
		<comments>http://www.bangheadonwall.net/?p=167#comments</comments>
		<pubDate>Fri, 03 Sep 2010 17:26:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JSON]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=167</guid>
		<description><![CDATA[If you need to request some data asynchronously via AJAX one option is to use the Ajax.request object from prototype.  If you call/create this object you can create a callback function for when the function completes (onComplete) and this will have the return data in it ready for you to process.
In my case I used [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to request some data asynchronously via AJAX one option is to use the Ajax.request object from prototype.  If you call/create this object you can create a callback function for when the function completes (onComplete) and this will have the return data in it ready for you to process.</p>
<p>In my case I used my Rails controller to return JSON data first on the backend:</p>
<pre class="brush:ruby">result_lat_lon = processNgaNums(params[:map])

respond_to do |format|
    format.json { render :json =&gt; result_lat_lon.to_json}
end</pre>
<p>Then on the client side I created an ajax request:</p>
<pre class="brush:ruby">new Ajax.Request(path, {
         asynchronous:true,
         evalScripts:true,
         method:'get',
         onComplete: function(transport){
                       var json = transport.responseText.evalJSON();
                       jQuery.each(json, function(i, val){
                          locations.push([i, val[0], val[1]]);
                       });
                       setMarkers(map, locations);
                     }
        });</pre>
<p>The main block of code to take note of here is to declare the transport variable which the onComplete function will receive when it is called.  Then you can do an evalJSON on that text and treat it as an array.   Also in the loop to process the JSON each entry contains a key and a value which corresponds to the i and val variables.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=167</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sort array in Ruby on Rails</title>
		<link>http://www.bangheadonwall.net/?p=166</link>
		<comments>http://www.bangheadonwall.net/?p=166#comments</comments>
		<pubDate>Fri, 16 Jul 2010 04:26:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ruby Rails]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=166</guid>
		<description><![CDATA[>> arr = []
=> []
>> arr  [[3, 2, 1]]
>> arr [[3, 2, 1], [1, 2, 3]]
>> arr  [[3, 2, 1], [1, 2, 3], [2, 1, 3]]
>> arr.sort{ &#124;a,b&#124; a[0]  b[0]}
=> [[1, 2, 3], [2, 1, 3], [3, 2, 1]]
]]></description>
			<content:encoded><![CDATA[<p>>> arr = []<br />
=> []</p>
<p>>> arr << [3,2,1]<br />
=> [[3, 2, 1]]</p>
<p>>> arr<< [1,2,3]<br />
=> [[3, 2, 1], [1, 2, 3]]</p>
<p>>> arr << [2,1,3]<br />
=> [[3, 2, 1], [1, 2, 3], [2, 1, 3]]</p>
<p>>> arr.sort{ |a,b| a[0] <=> b[0]}<br />
=> [[1, 2, 3], [2, 1, 3], [3, 2, 1]]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=166</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Safari Mobile on your Desktop</title>
		<link>http://www.bangheadonwall.net/?p=162</link>
		<comments>http://www.bangheadonwall.net/?p=162#comments</comments>
		<pubDate>Mon, 15 Mar 2010 19:15:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=162</guid>
		<description><![CDATA[On OSX,
Open Safari and go to Preferences
Under the Advanced tab, check “Show Develop menu in menu bar”.
Safari&#8217;s menu go to Develop-&#62;User Agent-&#62;Mobile Safari (there should be multiple versions) pick the most appropriate
]]></description>
			<content:encoded><![CDATA[<p>On OSX,</p>
<p>Open Safari and go to Preferences</p>
<p>Under the Advanced tab, check “Show Develop menu in menu bar”.</p>
<p>Safari&#8217;s menu go to Develop-&gt;User Agent-&gt;Mobile Safari (there should be multiple versions) pick the most appropriate</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=162</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increase ESX Virtual Machine Size (ubuntu linux)</title>
		<link>http://www.bangheadonwall.net/?p=158</link>
		<comments>http://www.bangheadonwall.net/?p=158#comments</comments>
		<pubDate>Thu, 28 Jan 2010 19:49:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=158</guid>
		<description><![CDATA[These instructions are to allow you to increase the size of a virtual machine&#8217;s harddrive.  This was done on an ESX 4.0 system running ubuntu 8.10 with thin provisioning, meaning the harddrive only takes up as much space as it uses.  The main problem was that the swap partition was created after the primary partition, [...]]]></description>
			<content:encoded><![CDATA[<p>These instructions are to allow you to increase the size of a virtual machine&#8217;s harddrive.  This was done on an ESX 4.0 system running ubuntu 8.10 with thin provisioning, meaning the harddrive only takes up as much space as it uses.  The main problem was that the swap partition was created after the primary partition, so it would not allow the primary to expand to the &#8220;right&#8221; of the swap.  The solution was to delete the swap and then reallocate the partition, then recreate the swap.</p>
<p>This command may be done via ssh access to ESX to change the VM to use thin provisioning.</p>
<p>vmkfstools -i Ubuntu-s001.vmdk new.vmdk -d thin -a lsilogic<br />
-increase the size from the vsphere client of the hardrive in question<br />
-load gparted iso and set it to boot on startup from vsphere client<br />
-Make sure the cd-rom is &#8220;conenct at power on&#8221;<br />
-I deleted the linux swap partition (turned it off first) by right clicking on the swap partition<br />
-then I was able to resize my primary partition<br />
-recreated the swap partition at the end  [primary + additional partition][swap]</p>
<p>Doing a &#8220;df -h&#8221; shows that the disk space was automatically recognized by Ubuntu after running gparted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=158</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JQuery + Prototype in Rails</title>
		<link>http://www.bangheadonwall.net/?p=153</link>
		<comments>http://www.bangheadonwall.net/?p=153#comments</comments>
		<pubDate>Tue, 08 Dec 2009 21:10:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[jquery prototype]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=153</guid>
		<description><![CDATA[      ]]></description>
			<content:encoded><![CDATA[<p>Original info was found <a title="jquery" href="http://b.lesseverything.com/2006/12/31/making-jquery-and-prototype-play-nice-in-rails">here</a>.  It was posted about 3 years ago, so JQuery has changed a little since then with the implementation of <a title="jquery noconflict" href="http://docs.jquery.com/Core/jQuery.noConflict">JQuery.noconflict()</a>.</p>
<p>In a nutshell, just in clude JQuery first and then include the other libraries(s) that may use the $( function. Make sure you call JQuery stuff with JQuery(xxx) instead of $( from now on.  You include JQuery in rails usually in your main layout file by typing:</p>
<p>&lt;%= javascript_include_tag &#8216;jquery&#8217; %&gt;</p>
<p>Make sure the jquery download files are in your /public/javascript directory of your project.</p>
<p>The JQuery site suggested adding the noconflict at the end of the jquery.js file, but instead I did it this way in the layout file.</p>
<p>&lt;script&gt;jQuery.noConflict(); &lt;/script&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=153</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>change validation error names in rails</title>
		<link>http://www.bangheadonwall.net/?p=150</link>
		<comments>http://www.bangheadonwall.net/?p=150#comments</comments>
		<pubDate>Tue, 08 Dec 2009 21:01:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[validations]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=150</guid>
		<description><![CDATA[Put the below code in to your model.  I found this info on railsforums.com.
HUMANIZED_COLUMNS = {
:Column_name =&#62; &#8220;New Name&#8221;,
:OtherColumn_name =&#62; &#8220;New Name 2&#8243;
}
def self.human_attribute_name(attribute)
HUMANIZED_COLUMNS[attribute.to_sym] &#124;&#124; super
end
]]></description>
			<content:encoded><![CDATA[<p>Put the below code in to your model.  I found this info on railsforums.com.</p>
<p>HUMANIZED_COLUMNS = {<br />
:Column_name =&gt; &#8220;New Name&#8221;,<br />
:OtherColumn_name =&gt; &#8220;New Name 2&#8243;<br />
}<br />
def self.human_attribute_name(attribute)<br />
HUMANIZED_COLUMNS[attribute.to_sym] || super<br />
end</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=150</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using VMWare converter + ESXi 4.0 + RHEL 5.3</title>
		<link>http://www.bangheadonwall.net/?p=145</link>
		<comments>http://www.bangheadonwall.net/?p=145#comments</comments>
		<pubDate>Tue, 15 Sep 2009 18:47:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=145</guid>
		<description><![CDATA[Installing ESXi 4.0 as the base metal Hypervisor OS.  I tried to use converter to create a VM image of various redhat machines.  Problems encountered with Converter:
1. Failed: File is larger than the maximum size supported by datastore
Solution: Split up the files to different datastores, or use Thin instead of Flat so it only takes [...]]]></description>
			<content:encoded><![CDATA[<p>Installing ESXi 4.0 as the base metal Hypervisor OS.  I tried to use converter to create a VM image of various redhat machines.  Problems encountered with Converter:</p>
<p>1. Failed: File is larger than the maximum size supported by datastore</p>
<p>Solution: Split up the files to different datastores, or use Thin instead of Flat so it only takes the space used and not the full amount of allocated space for a partition.</p>
<p>2. Failed: MethodFault.summary</p>
<p>Solution: Changed number of processors from 8 to 4, because my VM server only has one quad core processor.</p>
<p>3. Failed: Unable to obtain the IP address of the helper virtual machine.</p>
<p>Solution: Assign a DHCP or static IP to the &#8220;Helper VM Network&#8221; at the bottom of the configuration.  Edit this value.</p>
<p>4.  Failed: An error occurred during the conversion.   Error: Failed to clone the volume mounted on &#8216;/boot&#8217;</p>
<p>Solution: Add the DNS suffix to the Helper VM Network.  Also, I needed to add the IP address to the hosts.allow in my Redhat Linux of the Helper VM, that I assigned in #3 from above.</p>
<p>UPDATE</p>
<p>5. Error: Failed to clone the volume mounted on &#8216;/&#8217;</p>
<p>Solution: again this was a problem with the fact that the machine to duplicate had the security settings setup to block the helper VM.  I had to add the entry into the hosts.allow.  But I can see other potential problems with the firewall (i.e. iptables) where certain ports must be open.  <a title="vmware ports" href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1010056">Here is a link to vmware showing which ports to open. </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=145</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>VMWare ESX on Workstation</title>
		<link>http://www.bangheadonwall.net/?p=137</link>
		<comments>http://www.bangheadonwall.net/?p=137#comments</comments>
		<pubDate>Fri, 11 Sep 2009 03:13:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.bangheadonwall.net/?p=137</guid>
		<description><![CDATA[I needed to do capture an existing physical machine to virtual (P2V) of an old linux box that was getting on in age.  I thought that VMWare would be the clear solution to capture this through the VMWare Converter tool.  Unfortunately, Converter doesn&#8217;t directly support capturing a linux machine.
The solution I found was to create [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to do capture an existing physical machine to virtual (P2V) of an old linux box that was getting on in age.  I thought that VMWare would be the clear solution to capture this through the VMWare Converter tool.  Unfortunately, Converter doesn&#8217;t directly support capturing a linux machine.</p>
<p>The solution I found was to create a virtual VMWare ESXi OS install on my VMWare Workstation.  This was not very straight forward as ESXi 4.0 is only for 64-bit systems.  I found that ESXi 3.5 was 32-bit and decided to give it a try.  For some reason the ESXi install would not proceed correctly choosing to throw PANIC errors.  Later I realized that it was due to the fact that I <strong>did not allocate enough RAM</strong> to this machine.  The default value was 256MB and the solution was to up that value to over 1GB of RAM.  Then, I would get stuck during the installation in the first 10% or so and would just not move on.  I found the solution through a youtube video which showed that I need to select an <strong>Intel VT option</strong> for the processor settings.  This allowed me to continue with the installation.</p>
<p>Note:  On a Dell Quad-core server I had to enable the hardware Intel VT instructions.  Otherwise the installation of ESX may hang.</p>
<p>More to come&#8230;</p>
<p>ESXi booted up with some lvm error, but for some reason, I could not get an IP address.  Edited my myvmName.vmx file with note pad and added the blow lines.<br />
Check out this video <a href="http://www.youtube.com/watch?v=rdghryRrzlo" target="_blank">here</a></p>
<p><a href="http://www.youtube.com/watch?v=rdghryRrzlo" target="_blank"></a><br />
monitor_control.restrict_backdoor = &#8220;TRUE&#8221;<br />
monitor_control.vt32 = &#8220;TRUE&#8221;<br />
SMBIOS.reflectHost = &#8220;TRUE&#8221;<br />
ethernet0.VirtualDev = &#8220;e1000&#8243;</p>
<p>After that I was able to get a DHCP address!  In my production environment we use static ip addresses, so for now I had to switch it to use NAT.</p>
<p>Now I can use Converter to capture a base virtual image of my remote physical machine.  Make sure to give root remote access rights and use the IP address of your server as the source.  For the destination, in a p2V situation using linux we can only use ESXi and so we need to capture to a VMWare Infrastructure virtual machine.  The IP address is that of your virtual ESX installation and don&#8217;t forget to set a root password, otherwise it will not work.</p>
<p>After the image was transferred, I used converter again to bring it over from the VMWare Infrastructure virtual machine to the VMware Workstation or other VMware virtual machine.  This allows me to open the vm from workstation instead of from ESX.  At some point I may deploy to an ESX installation but for now I am content to access my linux box from workstation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bangheadonwall.net/?feed=rss2&amp;p=137</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
