<?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>adventures of a blogjunkieweb development » adventures of a blogjunkie</title>
	<atom:link href="http://blogjunkie.net/tag/web-development/feed" rel="self" type="application/rss+xml" />
	<link>http://blogjunkie.net</link>
	<description>thoughts and ramblings of David Wang</description>
	<lastBuildDate>Wed, 02 May 2012 08:48:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Solved: Cufon text not refreshing on jQuery UI Tabs</title>
		<link>http://blogjunkie.net/2011/01/cufon-text-refresh-jquery-ui-tabs</link>
		<comments>http://blogjunkie.net/2011/01/cufon-text-refresh-jquery-ui-tabs#comments</comments>
		<pubDate>Tue, 11 Jan 2011 15:49:06 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogjunkie.net/?p=2211</guid>
		<description><![CDATA[<p>Posted in <a href="http://blogjunkie.net/section/blog" title="Blog">Blog</a><a href="http://blogjunkie.net/section/geek" title="Geek">Geek</a></p>Today I was working on a project that: Made use of jQuery UI Tabs through the WordPress Post Tabs plugin Uses custom fonts for the tabs via Cufon Requires tab font to change color when selected My first attempt was to simply render the tabs with Cufon&#8230; ..and style the active and default states with...
Related posts:<ol>
<li><a href='http://blogjunkie.net/2010/09/simple-form-validation-with-fbjs-on-facebook-page-tabs' rel='bookmark' title='Simple form validation with FBJS on Facebook Page Tabs'>Simple form validation with FBJS on Facebook Page Tabs</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Posted in <a href="http://blogjunkie.net/section/blog" title="Blog">Blog</a><a href="http://blogjunkie.net/section/geek" title="Geek">Geek</a></p><p>Today I was working on a project that:</p>
<ol>
<li>Made use of <a title="jQuery UI - Tabs Demos &amp; Documentation" href="http://jqueryui.com/demos/tabs/">jQuery UI Tabs</a> through the <a title="WordPress Post Tabs plugin" href="http://www.clickonf5.org/wordpress-post-tabs">WordPress Post Tabs plugin</a></li>
<li>Uses custom fonts for the tabs via <a title="Cufon SVG font renderer" href="http://cufon.shoqolate.com/">Cufon</a></li>
<li>Requires tab font to change color when selected</li>
</ol>
<p><span id="more-2211"></span></p>
<p>My first attempt was to simply render the tabs with Cufon&#8230;</p>
<pre class="brush: jscript; title: Render Cufon text; notranslate">
jQuery(document).ready(function($){
    Cufon.replace('.ui-tabs .ui-tabs-nav li a');
});
</pre>
<p>..and style the active and default states with CSS.</p>
<pre class="brush: css; title: Give tabs some styles (simplified); notranslate">
/* default tab style */
.ui-tabs .ui-tabs-nav li a {
    color: #454545;
}

/* selected tab style */
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a {
    color: #FFFFFF;
}
</pre>
<p>So far so good. The tabs were customized quite heavily and now looked like this.</p>
<p><img class="size-full wp-image-2212 alignnone" title="jqueryui-tabs-cufon-01" src="http://blogjunkie.net/files/2011/01/jqueryui-tabs-cufon-01.png" alt="" width="441" height="50" /></p>
<p>However, there was a problem: the Cufon text wasn&#8217;t changing color when you clicked on different tabs.</p>
<p><img class="alignnone size-full wp-image-2213" title="jqueryui-tabs-cufon-02" src="http://blogjunkie.net/files/2011/01/jqueryui-tabs-cufon-02.png" alt="" width="440" height="100" /></p>
<p>The reason for this is because Cufon has already rendered on the page, and because there is no page reload when you click the tabs, Cufon doesn&#8217;t re-render to update the fonts and colors.</p>
<p>Checking the <a title="Cufon API" href="https://github.com/sorccu/cufon/wiki/API">Cufon documentation</a>, I found that you could manually refresh Cufon by calling the <code>Cufon.refresh()</code> function. With jQuery UI Tabs you can bind the refresh function to fire after the <code>tabsshow</code> event:</p>
<pre class="brush: jscript; title: Bind refresh function to tabs show event; notranslate">
$('#tabs_0').bind('tabsshow', function() {
    Cufon.refresh('.ui-tabs .ui-tabs-nav li a');
});
</pre>
<p>Now the tab fonts and colors update when you click on the tabs, yay!</p>
<p>One more thing. In the code above I had to target the <code>#tabs_0</code> selector because that is the selector which the Post Tabs plugin uses to render the tabs. However this wasn&#8217;t very flexible because it wouldn&#8217;t match the other instances of the jQuery UI Tabs which would have the IDs of <code>#tabs_1, #tabs_2, #tabs_3.. #tabs_<em>n</em></code>.</p>
<p>So I turned to Twitter and within minutes <a href="http://twitter.com/cheeaun/status/24758605890719744">I had my answer</a> (thanks <a title="Follow @cheeaun on Twitter" href="http://twitter.com/cheeaun">@cheeaun</a>!). Simply use jQuery&#8217;s <a href="http://api.jquery.com/attribute-starts-with-selector/">Attribute Starts With Selector</a>:</p>
<pre class="brush: jscript; title: Select all elements with IDs that begin with &#039;tabs_&#039;; notranslate">
$('[id^=&quot;tabs_&quot;]').bind('tabsshow', function() {
    Cufon.refresh('.ui-tabs .ui-tabs-nav li a');
});
</pre>
<p>Now, the Tabs are a lot more bulletproof.</p>
<ol>
<li>Cufon text will be updated when new tabs are selected</li>
<li>The code applies to multiple tabs generated by the Post Tabs plugin, i.e. <code>#tabs_1, #tabs_2, #tabs_3.. #tabs__n_</code>.</li>
</ol>
<p>I hope this saves a few people the time spent figuring this out.</p>
<p>Related posts:</p><ol>
<li><a href='http://blogjunkie.net/2010/09/simple-form-validation-with-fbjs-on-facebook-page-tabs' rel='bookmark' title='Simple form validation with FBJS on Facebook Page Tabs'>Simple form validation with FBJS on Facebook Page Tabs</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://blogjunkie.net/2011/01/cufon-text-refresh-jquery-ui-tabs/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Bulletproof domain redirection for CPanel Add-On domains</title>
		<link>http://blogjunkie.net/2010/12/bulletproof-domain-redirection-for-cpanel-add-on-domains</link>
		<comments>http://blogjunkie.net/2010/12/bulletproof-domain-redirection-for-cpanel-add-on-domains#comments</comments>
		<pubDate>Mon, 06 Dec 2010 05:45:39 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogjunkie.net/?p=2072</guid>
		<description><![CDATA[<p>Posted in <a href="http://blogjunkie.net/section/blog" title="Blog">Blog</a><a href="http://blogjunkie.net/section/geek" title="Geek">Geek</a></p>The simple way of domain redirection doesn't work as well for websites that are add-on domains in CPanel environments. This article shows you how to create bulletproof redirects that will work, even for add-on websites.<!--
No related posts.-->]]></description>
			<content:encoded><![CDATA[<p>Posted in <a href="http://blogjunkie.net/section/blog" title="Blog">Blog</a><a href="http://blogjunkie.net/section/geek" title="Geek">Geek</a></p><p>Recently I helped my friend Beth Heavrin of <a href="http://www.smartgreentips.com/">Smart Green Tips</a> to migrate her blog to a new domain name. Along the way I realized that the simple way of domain redirection doesn&#8217;t work as well for websites that are add-on domains in CPanel environments. This article shows you how to create bulletproof redirects that will work, even for add-on websites.</p>
<h3>The Problem</h3>
<p><div id="attachment_2084" class="wp-caption alignright" style="width: 250px"><img class="size-full wp-image-2084" title="cpanel-site-structure" src="http://blogjunkie.net/files/2010/12/cpanel-site-structure.jpg" alt="" width="240" height="270" /><p class="wp-caption-text">CPanel site structure</p></div></p>
<p>In CPanel environments, you start off with a primary domain that resides in the <code>public_html</code> directory. When you add new site to your CPanel hosting, they are added as add-on domains whose root folder are subdirectories of <code>public_html</code>.</p>
<p>You end up with a directory structure in your web hosting account like the image on the right.</p>
<h3>Simple .htaccess Redirects Don&#8217;t Work</h3>
<p>For our example, let&#8217;s assume that the primary domain is <strong>PrimaryDomain.com</strong> and the new domain we want to redirect it to is <strong>AddOn1.com</strong>. To redirect PrimaryDomain.com to AddOn1.com, you may have used this code in the <code>.htaccess</code> file for PrimaryDomain.com:</p>
<pre class="brush: plain; auto-links: false; light: true; title: ; notranslate">
# Redirect 301 / http://www.AddOn1.com/
</pre>
<p>Or, you may have used this code:</p>
<pre class="brush: plain; auto-links: false; light: true; title: ; notranslate">
# RewriteRule ^(.*) http://www.AddOn1.com/$1 [R=301,L]
</pre>
<p>With the code above, PrimaryDomain.com will get redirected to AddOn1.com. But unfortunately visitors to <strong>AddOn2.com</strong> will be wrongly redirected to <strong>AddOn1.com/AddOn2.com</strong>. Same for other add-on domains within the <code>public_html</code> directory.</p>
<p>This is because AddOn2.com is a <em>subdirectory</em> of <code>public_html</code>. The 2 code snippets above redirect everything, including add-on domain subdirectories to AddOn1.com. Confused? Never mind! Just use the solution below.</p>
<h3>The Solution</h3>
<p>The solution is to check the hostname (URL) that the visitor is trying to visit before redirecting them. So, let&#8217;s update our <code>.htaccess</code> file to the following:</p>
<pre class="brush: plain; auto-links: false; light: true; title: ; notranslate">
# Redirect PrimaryDomain.com to www.AddOn1.com
RewriteCond %{HTTP_HOST} ^PrimaryDomain\.com$
RewriteRule ^(.*)$ http://www.AddOn1.com/$1 [R=301,L]

#Redirect www.PrimaryDomain.com to www.AddOn1.com
RewriteCond %{HTTP_HOST} ^www\.PrimaryDomain\.com$
RewriteRule ^(.*)$ http://www.AddOn1.com/$1 [R=301,L]
</pre>
<p>The first block of rules only redirects visitors to <strong>PrimaryDomain.com</strong> and the second block only redirects visitors to <strong><span style="text-decoration: underline;">www</span>.PrimaryDomain.com</strong>. Visitors to AddOn2.com or AddOn3.com will not be redirected. Solved!</p>
<!--<p>No related posts.</p>-->]]></content:encoded>
			<wfw:commentRss>http://blogjunkie.net/2010/12/bulletproof-domain-redirection-for-cpanel-add-on-domains/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restarting MAMP when it gets stuck</title>
		<link>http://blogjunkie.net/2009/10/restarting-mamp-when-it-gets-stuck</link>
		<comments>http://blogjunkie.net/2009/10/restarting-mamp-when-it-gets-stuck#comments</comments>
		<pubDate>Wed, 14 Oct 2009 02:13:46 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[mamp]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blogjunkie.net/?p=528</guid>
		<description><![CDATA[<p>Posted in <a href="http://blogjunkie.net/section/blog" title="Blog">Blog</a></p>I&#8217;m a big fan of MAMP and use it to create development environments on my MacBook for websites I&#8217;m building. Ocassionally I run across a problem where the Apache and MySQL servers are stuck. What I mean is that MAMP says they&#8217;re on, but they&#8217;re not. And clicking the Stop/Start servers button doesn&#8217;t work. This...<!--
No related posts.-->]]></description>
			<content:encoded><![CDATA[<p>Posted in <a href="http://blogjunkie.net/section/blog" title="Blog">Blog</a></p><p>I&#8217;m a big fan of MAMP and use it to create development environments on my MacBook for websites I&#8217;m building. Ocassionally I run across a problem where the Apache and MySQL servers are stuck. What I mean is that MAMP says they&#8217;re on, but they&#8217;re not. And clicking the Stop/Start servers button doesn&#8217;t work. This usually happens when your system crashes with MAMP still running.</p>
<p>To fix it, simply go into MAMP preferences and click <strong>Reset MAMP Ports</strong>. Your Mac may ask you to enter your password. After that, click Set to default <strong>Apache and MySQL ports</strong>. Now you should be able to start/stop your servers again. Happy times <img src='http://blogjunkie.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<!--<p>No related posts.</p>-->]]></content:encoded>
			<wfw:commentRss>http://blogjunkie.net/2009/10/restarting-mamp-when-it-gets-stuck/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

