<?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>Galen Grover</title>
	<atom:link href="http://www.galengrover.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.galengrover.com</link>
	<description>Web Developer</description>
	<lastBuildDate>Wed, 16 May 2012 09:50:05 +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>Serving fonts with @font-face</title>
		<link>http://www.galengrover.com/css/serving-fonts-with-font-face/</link>
		<comments>http://www.galengrover.com/css/serving-fonts-with-font-face/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 18:20:24 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[fonts]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=189</guid>
		<description><![CDATA[@font-face allows you to use any font on your web page. It is supported by all major browsers, and has actually been supported by Internet Explorer for a long time. To use @font-face, first you have to make sure that your server is returning the correct mime types for fonts. Here are the correct mime [...]]]></description>
			<content:encoded><![CDATA[<p>@font-face allows you to use any font on your web page. It is supported by all major browsers, and has actually been supported by Internet Explorer for a long time.</p>
<p>To use @font-face, first you have to make sure that your server is returning the correct mime types for fonts. Here are the correct mime types:</p>
<ul>
<li>WOFF – application/x-font-woff</li>
<li>TTF – font/ttf</li>
<li>OTF – font/otf</li>
<li>EOT – application/vnd.ms-fontobject</li>
<li>SVG – image/svg+xml</li>
</ul>
<p>To do this in apache, add this to your .htaccess file:</p>

<div class="wp_syntax"><div class="code"><pre class="htaccess" style="font-family:monospace;">AddType font/ttf .ttf
AddType application/vnd.ms-fontobject .eot
AddType font/otf .otf
AddType application/x-font-woff .woff
AddType application/vnd.ms-fontobject .svg</pre></div></div>

<p>In IIS:</p>
<ol>
<li>Open IIS manager</li>
<li>Right click your server and click properties</li>
<li>Click Mime Types</li>
<li>Add the above mime types</li>
</ol>
<p>Now in your css file add the font with @font-face.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@font-face {</span>
    <span style="color: #808080; font-style: italic;">/* Name of the font */</span>
    <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'font name'</span><span style="color: #00AA00;">;</span> 
&nbsp;
    <span style="color: #808080; font-style: italic;">/* This is for IE */</span>
    src<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">/css/fonts/font.eot</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* This is for all other browsers */</span>
    src<span style="color: #00AA00;">:</span> local<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'font name'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span>
    <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">/css/fonts/font.woff</span><span style="color: #00AA00;">&#41;</span> format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'woff'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span>
    <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">/css/fonts/font.ttf</span><span style="color: #00AA00;">&#41;</span> format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'truetype'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> 
    <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">/css/fonts/font.svg</span><span style="color: #00AA00;">&#41;</span> format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'svg'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The browser will go through the fonts in the src descriptor until it successfully loads one.</p>
<p>You are all set to use your font now. Use your new font just like you would any other font.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">h1 <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'font name'</span><span style="color: #00AA00;">,</span> verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>More Info</p>
<ul>
<li><a href="http://hacks.mozilla.org/2009/06/beautiful-fonts-with-font-face/">Mozilla @font-face article</li>
<li><a href="http://enable-cors.org/">Cross-Origin Resource Sharing</li>
<li><a href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">Bulletproof @font-face syntax</li>
<li><a href="http://stackoverflow.com/questions/2436749/how-to-define-bold-italic-using-font-face">Defining bold, italic, etc&#8230; font faces</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/css/serving-fonts-with-font-face/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a custom ringtone or text message sound for iPhone IOS 5</title>
		<link>http://www.galengrover.com/iphone/how-to-make-a-custom-ringtone-or-text-message-sound-for-iphone-ios-5/</link>
		<comments>http://www.galengrover.com/iphone/how-to-make-a-custom-ringtone-or-text-message-sound-for-iphone-ios-5/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 08:07:21 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[ios5]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=184</guid>
		<description><![CDATA[Add the audio file to your iTunes library Right click the file in your library and click &#8220;Create AAC Version&#8221; Drag the newly create file from your library onto your desktop Change the extension of the file from .m4a to .m4r Finally, drag the .m4r file into your device in iTunes The file will be [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Add the audio file to your iTunes library</li>
<li>Right click the file in your library and click &#8220;Create AAC Version&#8221;</li>
<li>Drag the newly create file from your library onto your desktop</li>
<li>Change the extension of the file from .m4a to .m4r</li>
<li>Finally, drag the .m4r file into your device in iTunes</li>
</ol>
<p>The file will be available in the ringtones portion of the Ringtone and Text Tone sound setting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/iphone/how-to-make-a-custom-ringtone-or-text-message-sound-for-iphone-ios-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AJAX Requests with PHP</title>
		<link>http://www.galengrover.com/php/detecting-ajax-requests/</link>
		<comments>http://www.galengrover.com/php/detecting-ajax-requests/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 17:28:50 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[prototypejs]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=114</guid>
		<description><![CDATA[Recently I&#8217;ve seen a lot of questions on stackoverflow about how to detect/respond to AJAX requests. It&#8217;s actually quite simple. Most of the major players in the javascript framework will send a specific header(X-REQUESTED-WITH) to the requested page. You can check this header to detect AJAX requests. if &#40; isset&#40; $_SERVER&#91;'HTTP_X_REQUESTED_WITH'&#93; &#41; &#38;&#38; strtolower&#40; $_SERVER&#91;'HTTP_X_REQUESTED_WITH'&#93; [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve seen a lot of questions on stackoverflow about how to detect/respond to AJAX requests. It&#8217;s actually quite simple. <em>Most</em> of the major players in the javascript framework will send a specific header(X-REQUESTED-WITH) to the requested page. You can check this header to detect AJAX requests.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>
    <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span>
    <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'xmlhttprequest'</span>
<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// AJAX request</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Normal request</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You can add this to your request object or define a constant</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'IS_AJAX_REQUEST'</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#40;</span>bool<span style="color: #009900;">&#41;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_X_REQUESTED_WITH'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'xmlhttprequest'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Example usage</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Get an array of contacts for a user</span>
<span style="color: #000088;">$contacts</span> <span style="color: #339933;">=</span> Contacts<span style="color: #339933;">::</span><span style="color: #004000;">getForUser</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// If the page was requested via ajax, json encode the array and exit the script</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> IS_AJAX_REQUEST <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$contacts</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Normal request, require the view</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'views/contacts.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Frameworks verified to use the X-REQUESTED_WITH header: <a href="https://github.com/sstephenson/prototype/blob/1fb9728/src/ajax/request.js#L233">Prototype</a>, <a href="https://github.com/jquery/jquery/blob/master/src/ajax/xhr.js#L91">Jquery</a>, <a href="https://github.com/dojo/dojo/blob/master/_base/xhr.js#L726">Dojo</a>, <a href="https://github.com/mootools/mootools-core/blob/master/Source/Request/Request.js#L41">Mootools</a>, <a href="https://github.com/yui/yui3/blob/master/src/io/js/io-base.js#L63">YUI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/php/detecting-ajax-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Managing sensitive data in git projects</title>
		<link>http://www.galengrover.com/github/managing-sensitive-data-in-git-projects/</link>
		<comments>http://www.galengrover.com/github/managing-sensitive-data-in-git-projects/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 22:35:56 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Github]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=94</guid>
		<description><![CDATA[Many of my projects have files that contain usernames/passwords for various services (e.g. MySQL). For a public project on Github, this is unacceptable. Here is a solution: Make a duplicate of the file named &#60;filename&#62;_sample and remove the sensitive data from it. Add a line to your .gitignore file to untrack/ignore the file. If the [...]]]></description>
			<content:encoded><![CDATA[<p>Many of my projects have files that contain usernames/passwords for various services (e.g. MySQL). For a public project on Github, this is unacceptable. Here is a solution:</p>
<ol>
<li>Make a duplicate of the file named &lt;filename&gt;_sample and remove the sensitive data from it.</li>
<li>Add a line to your <a href="http://www.kernel.org/pub//software/scm/git/docs/gitignore.html">.gitignore</a> file to untrack/ignore the file.</li>
<li>If the file was previously tracked you must untrack it with

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">--cached</span> <span style="color: #000000; font-weight: bold;">&lt;</span>filename<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

</li>
</ol>
<p>The sensitive file will not be added to your future commits.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/github/managing-sensitive-data-in-git-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linking GitHub commit messages to issues</title>
		<link>http://www.galengrover.com/github/linking-github-commit-messages-to-issues/</link>
		<comments>http://www.galengrover.com/github/linking-github-commit-messages-to-issues/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 22:33:49 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Github]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=43</guid>
		<description><![CDATA[When performing a GitHub commit you can link the commit message to an issue: git commit -m &#34;fixed bug, closes #1&#34; Adding this closes will close the issue and link the commit message to the newly closed issue. Alternate syntaxes: Closes GH-1. Closes gh-1. here&#8217;s an example (hover over #9 in the commit message)]]></description>
			<content:encoded><![CDATA[<p>When performing a GitHub commit you can link the commit message to an issue:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;fixed bug, closes #1&quot;</span></pre></div></div>

<p>Adding this closes will close the issue and link the commit message to the newly closed issue.</p>
<p>Alternate syntaxes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Closes GH-<span style="color: #000000;">1</span>.
Closes gh-<span style="color: #000000;">1</span>.</pre></div></div>

<p><a href="https://github.com/galen/PHP-Google-Maps/commit/647bfca4eadbad37354bff149ee8d2ae9ca0d28e">here&#8217;s an example</a> (hover over #9 in the commit message)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/github/linking-github-commit-messages-to-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the marker icon in a Google Fusion Table</title>
		<link>http://www.galengrover.com/google-maps/changing-the-marker-icon-in-a-google-fusion-table/</link>
		<comments>http://www.galengrover.com/google-maps/changing-the-marker-icon-in-a-google-fusion-table/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 03:27:10 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[fusion table]]></category>
		<category><![CDATA[map marker]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=62</guid>
		<description><![CDATA[By default, when displaying a Fusion Table, the marker icon is a small red dot. To get a normal marker icon follow these steps: Go into the admin of your Fusion Table In the menu go to Visualize > Map Above the map click the link &#8220;Configure styles&#8221; In the left menu of the window [...]]]></description>
			<content:encoded><![CDATA[<p>By default, when displaying a Fusion Table, the marker icon is a small red dot. To get a normal marker icon follow these steps:</p>
<ol>
<li>Go into the admin of your <a href="http://tables.googlelabs.com">Fusion Table</a></li>
<li>In the menu go to Visualize > Map</li>
<li>Above the map click the link &#8220;Configure styles&#8221;</li>
<li>In the left menu of the window that pops up click the &#8220;Marker icon&#8221; link</li>
<li>There are a bunch of options, but if you just want to change all of the marker icons, under the &#8220;Fixed&#8221; tab select the marker you want to use</li>
<li>Click &#8220;Save&#8221;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/google-maps/changing-the-marker-icon-in-a-google-fusion-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making wordpress parent navigation items unclickable with jquery</title>
		<link>http://www.galengrover.com/wordpress/making-wordpress-parent-navigation-items-unclickable-with-jquery/</link>
		<comments>http://www.galengrover.com/wordpress/making-wordpress-parent-navigation-items-unclickable-with-jquery/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 23:17:18 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wp_list_pages]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=84</guid>
		<description><![CDATA[I&#8217;m developing a new site that has a navigation that is built dynamically via wordpress&#8217; wp_list_pages function &#60;?php wp_list_pages&#40;'sort_column=menu_order&#38;title_li=&#38;exclude=6'&#41;; ?&#62; Navigation items that have submenus (css dropdowns) are still clickable, but for this website they have no content. I wanted a way to make those items unclickable. I was unable to find any way with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m developing a new site that has a navigation that is built dynamically via wordpress&#8217; <a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages</a> function</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  wp_list_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sort_column=menu_order&amp;title_li=&amp;exclude=6'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Navigation items that have submenus (css dropdowns) are still clickable, but for this website they have no content. I wanted a way to make those items unclickable. I was unable to find any way with wordpress&#8217; api, but I did find a way with jquery.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#navigation_ul &gt; li &gt; a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span>
    <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">siblings</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'href'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'#'</span> <span style="color: #009900;">&#41;</span>
 .<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'onClick'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'return false'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>All navigation links that have submenus will have their href to &#8216;#&#8217;, and onClick set to &#8216;return false&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/wordpress/making-wordpress-parent-navigation-items-unclickable-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing dictionaries inside lists with Django templates</title>
		<link>http://www.galengrover.com/python/accessing-dictionaries-inside-lists-with-django-templates/</link>
		<comments>http://www.galengrover.com/python/accessing-dictionaries-inside-lists-with-django-templates/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 17:15:21 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[dictionaries]]></category>
		<category><![CDATA[django templates]]></category>
		<category><![CDATA[lists]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=54</guid>
		<description><![CDATA[Today while working on the new SVO i ran into an issue with the coding of breadcrumbs. I wanted to pull the breadcrumb code out of each page template and put it into the header template. This is what i had originally in each template: &#60;p id=&#34;breadcrumbs&#34;&#62; &#60;a href=&#34;/&#34;&#62;Home&#60;/a&#62;&#60;span class=&#34;bc_sep&#34;&#62;&#62;&#60;/span&#62; &#60;a href=&#34;{% url videos %}&#34;&#62;Videos&#60;/a&#62;&#60;span [...]]]></description>
			<content:encoded><![CDATA[<p>Today while working on the new <a href="http://www.skatevideosonline.net">SVO</a> i ran into an issue with the coding of breadcrumbs. I wanted to pull the breadcrumb code out of each page template and put it into the header template.</p>
<p>This is what i had originally in each template:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p id=&quot;breadcrumbs&quot;&gt;
    &lt;a href=&quot;/&quot;&gt;Home&lt;/a&gt;&lt;span class=&quot;bc_sep&quot;&gt;&gt;&lt;/span&gt;
    &lt;a href=&quot;{% url videos %}&quot;&gt;Videos&lt;/a&gt;&lt;span class=&quot;bc_sep&quot;&gt;&gt;&lt;/span&gt;
    &lt;a href=&quot;{% url company video.company.id video.company.name|slugify %}&quot;&gt;{{ video.company.name }}&lt;/a&gt;&lt;span class=&quot;bc_sep&quot;&gt;&gt;&lt;/span&gt;
    &lt;strong&gt;{{ video.name }}&lt;/strong&gt;
&lt;/p&gt;</pre></div></div>

<p>This quickly became annoying, repeating this code in every page&#8217;s template. I decided to create a list of dictionaries inside each view to represent the breadcrumbs:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">breadcrumbs = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
breadcrumbs.<span style="color: black;">append</span><span style="color: black;">&#40;</span> <span style="color: black;">&#123;</span> <span style="color: #483d8b;">'home'</span>:reverse<span style="color: black;">&#40;</span> <span style="color: #483d8b;">'home'</span> <span style="color: black;">&#41;</span> <span style="color: black;">&#125;</span> <span style="color: black;">&#41;</span>
breadcrumbs.<span style="color: black;">append</span><span style="color: black;">&#40;</span> <span style="color: black;">&#123;</span> <span style="color: #483d8b;">'skaters'</span>:reverse<span style="color: black;">&#40;</span> <span style="color: #483d8b;">'skaters'</span> <span style="color: black;">&#41;</span> <span style="color: black;">&#125;</span> <span style="color: black;">&#41;</span>
breadcrumbs.<span style="color: black;">append</span><span style="color: black;">&#40;</span> <span style="color: black;">&#123;</span> index:<span style="color: #483d8b;">''</span> <span style="color: black;">&#125;</span> <span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'index.html'</span>, <span style="color: black;">&#123;</span>...<span style="color: #483d8b;">'breadcrumbs'</span>:breadcrumbs<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Then in my template i loop the list and dictionary:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>p <span style="color: #008000;">id</span>=<span style="color: #483d8b;">&quot;breadcrumbs&quot;</span><span style="color: #66cc66;">&gt;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">for</span> breadcrumb <span style="color: #ff7700;font-weight:bold;">in</span> breadcrumbs <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span> <span style="color: #808080; font-style: italic;">#this loops the list</span>
	<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">for</span> text, link <span style="color: #ff7700;font-weight:bold;">in</span> breadcrumb.<span style="color: black;">items</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span> <span style="color: #808080; font-style: italic;">#this extracts the dictionary inside each list</span>
		<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">if</span> link <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
			<span style="color: #66cc66;">&lt;</span>a href=<span style="color: #483d8b;">&quot;{{ link }}&quot;</span><span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> text|capfirst <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/a<span style="color: #66cc66;">&gt;&lt;</span>span <span style="color: #ff7700;font-weight:bold;">class</span>=<span style="color: #483d8b;">&quot;bc_sep&quot;</span><span style="color: #66cc66;">&gt;&gt;&lt;</span>/span<span style="color: #66cc66;">&gt;</span>
		<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> <span style="color: #ff7700;font-weight:bold;">else</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
			<span style="color: #66cc66;">&lt;</span>strong<span style="color: #66cc66;">&gt;</span><span style="color: black;">&#123;</span><span style="color: black;">&#123;</span> text|capfirst <span style="color: black;">&#125;</span><span style="color: black;">&#125;</span><span style="color: #66cc66;">&lt;</span>/strong<span style="color: #66cc66;">&gt;</span>
		<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endif <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
	<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endfor <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
<span style="color: black;">&#123;</span><span style="color: #66cc66;">%</span> endfor <span style="color: #66cc66;">%</span><span style="color: black;">&#125;</span>
<span style="color: #66cc66;">&lt;</span>/p<span style="color: #66cc66;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/python/accessing-dictionaries-inside-lists-with-django-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS &amp; Javascript image preloader</title>
		<link>http://www.galengrover.com/javascript/css-javascript-image-preloader/</link>
		<comments>http://www.galengrover.com/javascript/css-javascript-image-preloader/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 01:55:55 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[image preloader]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=66</guid>
		<description><![CDATA[While building a photo gallery for a client I ran into an issue where the photos took too long to load and clicking thumbnails before all the photos loaded resulted in ugly transitions. My solution was to put a semi-transparent &#8220;shield&#8221; (containing a loading animation) over the gallery. The user will be able to see [...]]]></description>
			<content:encoded><![CDATA[<p>While building a photo gallery for a client I ran into an issue where the photos took too long to load and clicking thumbnails before all the photos loaded resulted in ugly transitions.</p>
<p>My solution was to put a semi-transparent &#8220;shield&#8221; (containing a loading animation) over the gallery. The user will be able to see the images loading, but will be unable to click anything until all images are loaded and the shield is hidden.</p>
<p>Explanation follows the code.</p>
<p>Here&#8217;s the html. This goes inside the div that contains your gallery.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;gallery_loader&quot;&gt; &lt;!-- wrapper for shield --&gt;
    &lt;div&gt;&lt;/div&gt; &lt;!-- this is the actual shield --&gt;
    &lt;img src=&quot;animated_loader.gif&quot;&gt;&lt;!-- image preloader --&gt;
&lt;/div&gt;</pre></div></div>

<p>&#8230;and the CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#gallery_loader</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Position the wrapper at the top left corner */</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* cover the entire width of your gallery */</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* cover the entire height of your gallery */</span>
    <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* hide anything that might overflow */</span>
    <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">999</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* make sure the shield is on top over everything */</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#gallery_loader</span> div <span style="color: #00AA00;">&#123;</span> <span style="color: #808080; font-style: italic;">/* the actual shield */</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Position the shield at the top left corner of the wrapper */</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Take up the entire wrapper */</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Take up the entire wrapper */</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
    opacity<span style="color: #00AA00;">:</span> .8<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* .8 = 80% opacity for all non-ie browsers*/</span>
    -ms-filter<span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=80)&quot;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* This and the next style are for IE */</span>
    filter<span style="color: #00AA00;">:</span> alpha<span style="color: #00AA00;">&#40;</span>opacity<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">80</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#gallery_loader</span> img <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Need this so we can center the image */</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span> <span style="color: #993333;">auto</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Set this to whatever looks good */</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Adjust to your needs */</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
    -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Round corners in mozilla browsers */</span>
    -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Round corners for webkit browsers */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Put this inside an included javascript file. This will wait until the page is loaded entirely (images and all) and then fade the loader out. Requires jquery.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#gallery_loader'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>#gallery_loader is positioned absolutely and placed on top of everything else (z-index:999). It&#8217;s set to take up the entire width/height of its parent.  Next comes the shield that will actually do the &#8220;blocking&#8221; of everything in the gallery. The shield is opacited and set to take up the entire width/height of the wrapper. Finally the animated loading image is loaded and centered.</p>
<p>As you can tell from the HTML, the actual shield is not the container of the loading animation gif. This is because the children of transparent elements can&#8217;t be more opaque than their parents. In other words if we put the loading image inside the transparent &#8220;shield&#8221; (which has an opacity of 80%) it would have a max opacity of 80%. To fix this we put the &#8220;shield&#8221; underneath the loading image and opacitate it. <a href="http://www.quirksmode.org/css/opacity.html">Here&#8217;s</a> a good page on opacity.</p>
<p>Note: If you&#8217;re having issues where the loading gif isn&#8217;t loading immediately add this right after the opening of your body element</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;body&gt;
&lt;img src=&quot;animated_loader.gif&quot; style=&quot;display:none&quot;&gt;
...</pre></div></div>

<p>This will cause the loading gif to load first.</p>
<p><a href="http://www.ajaxload.info/">Here</a> is where i obtained my loading gif</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/javascript/css-javascript-image-preloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Mac pandora dashboard widget</title>
		<link>http://www.galengrover.com/mac/creating-a-mac-pandora-dashboard-widget/</link>
		<comments>http://www.galengrover.com/mac/creating-a-mac-pandora-dashboard-widget/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 17:50:00 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[pandora]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=29</guid>
		<description><![CDATA[In safari (must use safari) go to pandora.com and login or signup Go to file->Open in dashboard Select the main pandora window and adjust the edges to fit the area you want Click Add on the top right of your screen On the widget click the i on the bottom right and uncheck the only [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>In safari (must use safari) go to <a href="http://www.pandora.com">pandora.com</a> and login or signup</li>
<li>Go to file->Open in dashboard</li>
<li>Select the main pandora window and adjust the edges to fit the area you want</li>
<li>Click Add on the top right of your screen</li>
<li>On the widget click the <em>i</em> on the bottom right and uncheck the <em>only play audio in dashboard option</em></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/mac/creating-a-mac-pandora-dashboard-widget/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

