<?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>SoftLayer Blog &#187; walkthrough</title>
	<atom:link href="http://blog.softlayer.com/tag/walkthrough/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.softlayer.com</link>
	<description>A Behind the Scenes Look at the Best Hosting Provider in the World</description>
	<lastBuildDate>Wed, 15 May 2013 15:33:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Server Challenge II &#8211; The Retro Upgrade of a Fan Favorite</title>
		<link>http://blog.softlayer.com/2012/server-challenge-ii-the-retro-upgrade-of-a-fan-favorite/</link>
		<comments>http://blog.softlayer.com/2012/server-challenge-ii-the-retro-upgrade-of-a-fan-favorite/#comments</comments>
		<pubDate>Tue, 09 Oct 2012 15:15:35 +0000</pubDate>
		<dc:creator>Kevin Hazard</dc:creator>
				<category><![CDATA[Culture]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[booth]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[explanation]]></category>
		<category><![CDATA[expo]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[launch]]></category>
		<category><![CDATA[leader board]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[server challenge]]></category>
		<category><![CDATA[SuperMicro]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[Top 10]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[video games]]></category>
		<category><![CDATA[walkthrough]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=9412</guid>
		<description><![CDATA[Wakka wakka wakka wakka. All your base are belong to us. I&#8217;m sorry Mario, but our princess is in another castle. It&#8217;s dangerous to go alone. Do a barrel roll. If you can place any of those quotes from the video games of yore, you&#8217;ll probably love the Server Challenge II. Taking cues from classic [...]]]></description>
			<content:encoded><![CDATA[<p>Wakka wakka wakka wakka. All your base are belong to us. I&#8217;m sorry Mario, but our princess is in another castle. It&#8217;s dangerous to go alone. Do a barrel roll. </p>
<p>If you can place any of those quotes from the video games of yore, you&#8217;ll probably love the Server Challenge II. Taking cues from classic arcade games, we&#8217;ve teamed up with <a href="http://www.supermicro.com/index_home.cfm">Supermicro</a> to build a worthy sequel to our <a href="http://blog.softlayer.com/2011/blood-sweat-and-tears-the-server-challenge/">original Server Challenge</a>:</p>
<p><a href="http://cdn.softlayer.com/innerlayer/GDC-ServerChallengeII.jpg"><img class="centered" src="http://cdn.softlayer.com/innerlayer/GDC-ServerChallengeIIs.jpg" alt="Server Challenge II"/><br />
</a><br />
If you come across Server Challenge II at a conference, your task is clear. You step up to the full-sized server rack and perform three simple tasks:</p>
<ol>
<li>Load the data.</li>
<li>Connect the network.</li>
<li>Save the world.</li>
</ol>
<p>You&#8217;ve got two attempts per day to install twenty-four drive trays into two 2U Supermicro servers and plug eighteen network cables into their correct switches. Get all of that done in the fastest time at the conference, and you walk away with a brand new Macbook Air. During booth setup at <a href="http://www.gdconline.com/">GDC Online</a>, we shot a quick video of what that looks like:</p>
<div class="yt560"><iframe src="http://www.youtube.com/embed/SB3Ctdon2S0" frameborder="0" width="560" height="349"></iframe></div>
<p>The new challenge is sure to garner a lot of attention, and we&#8217;re excited to see the competition heat up as the show progresses. Beyond being a fun game, the Server Challenge II is also a great visual for what SoftLayer does. When you get to touch servers in a server hosting company&#8217;s booth, you&#8217;re probably going to remember us the next time you need to order a new server. You also get to see the Cisco and Supermicro switches that you&#8217;d see in all of our thirteen data centers around the world &#8230; It&#8217;s a tech geek&#8217;s dream come true.</p>
<p>In honor of the launch of Server Challenge II, we&#8217;re going to offer some &#8220;live&#8221; coverage of the competition at GDC Online this week. If you want to watch the Server Challenge II GDC Online 2012 remotely via &#8220;challenge-cast,&#8221; bookmark this blog post and refresh frequently. We&#8217;ll update the leader board every hour or two so that you can keep track of how the times are progressing throughout the show: </p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/sclb/gdco18.gif" alt="Server Challenge II Leader Board - GDC Online 2012"/> </p>
<p>Game on.</p>
<p>**UPDATE** GDC Online has officially wrapped, and after some last-minute heroics, Derek Manns grabbed the top spot (and the MacBook Air) for his Server Challenge II efforts! If you&#8217;ve been watching the leader board throughout the conference, you saw the top attendee time fall from 1:59.30 all the way down to 1:09.48. We hope you&#8217;ve enjoyed the &#8220;challenge-cast&#8221; &#8230; Keep an eye on SoftLayer&#8217;s <a href="http://www.softlayer.com/about/media/event-schedule">event schedule</a> to prepare for your next chance to take on the Server Challenge II.</p>
<p>-<a href="http://twitter.com/khazard">@khazard</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/server-challenge-ii-the-retro-upgrade-of-a-fan-favorite/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>No iFrames! Dynamically Resize Divs with jQuery.</title>
		<link>http://blog.softlayer.com/2012/no-iframes-dynamically-resize-divs-with-jquery/</link>
		<comments>http://blog.softlayer.com/2012/no-iframes-dynamically-resize-divs-with-jquery/#comments</comments>
		<pubDate>Wed, 08 Aug 2012 20:30:20 +0000</pubDate>
		<dc:creator>Cassandra Wolff</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[coder]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[divs]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[walkthrough]]></category>
		<category><![CDATA[width]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=8988</guid>
		<description><![CDATA[It&#8217;s no secret that iframes are one of the most hated methods of web page layouts in the web development world &#8212; they are horrible for SEO, user experience and (usually) design. I was recently charged with creating a page that needed functionality similar to what iframes would normally provide, and I thought I&#8217;d share [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s no secret that iframes are one of the most hated methods of web page layouts in the web development world &mdash; they are horrible for SEO, user experience and (usually) design. I was recently charged with creating a page that needed functionality similar to what iframes would normally provide, and I thought I&#8217;d share the non-iframe way I went about completing that project. </p>
<p>Before I get into the nitty-gritty of the project, I should probably unpack a few of the reasons <em>why</em> iframes are shunned. When a search engine indexes a page with iframes, each iframe is accurately recorded as a separate page &mdash; iframes embed the content of one we page inside of another, so it makes sense. Because each of those &#8220;pages&#8221; is represented in a single layout, if a user wanted to bookmark your site, they&#8217;d probably have a frustrating experience when they try to return to your site, only to find that they are sent directly to the content in one of the frames instead of seeing the entire layout. Most often, I see when when someone has a navigation bar in one frame and the main content in the other &#8230; The user will bookmark the content frame, and when they return to the site, they have no way to navigate the pages. So what&#8217;s a developer to do?</p>
<p>The project I was tasked with required the ability to resize only certain sections of a page, while asynchronously shrinking another section so that the entire page would always stay the same size, with only the two sections inside changing size. </p>
<p>Let&#8217;s look at an example with two divs, side by side on a web page:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/iframetutorial.png" alt="iFrame Tutorial"/></p>
<p>One div will contain a navigation menu to jump to different pages of the website (<code>#sidebar</code>), and the second div will contain all the content for that page (<code>#content</code>). If some of the elements in #sidebar are too long to read with the default width of the div, we want to let the user freely resize the two divs without changing the width of the page.</p>
<p>Our task is straightforward: When <code>#sidebar</code> expands in width, also expand the navigation and shrink <code>#content</code> along with the main content inside <code>#content</code>. If <code>#sidebar</code> shrinks, the navigation, <code>#content</code> and main content would respond accordingly as well:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/iframetutorial2.png" alt="iFrame Tutorial"/></p>
<p>It&#8217;s a relatively easy concept to do with iFrames &#8230; But then you remember that iframes are no longer cool (yes, there was a time long ago when iframes were cool). I decided to turn to my favorite alternative &mdash; jQuery &mdash; and the fix was actually a lot easier than I expected, and it worked beautifully. Let&#8217;s run through a step-by-step tutorial.</p>
<h3>1. HTML</h3>
<p>Lay out your two divs:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sidebar&quot;</span><span style="color: #339933;">&gt;</span> 
	<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sidebar-menu&quot;</span><span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;!--</span> all your sidebar<span style="color: #339933;">/</span>navigational items go here <span style="color: #339933;">--&gt;</span>
	<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;!--</span> all your main content goes here <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<h3>2. CSS</h3>
<p>Style your divs:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#sidebar {
</span>       width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">49</span><span style="color: #339933;">%;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">#content {
</span>	width<span style="color: #339933;">:</span> <span style="color: #cc66cc;">49</span><span style="color: #339933;">%;</span>
        float<span style="color: #339933;">:</span> left<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>3. jQuery</h3>
<p>Now that we have our two divs side by side, let&#8217;s apply some jQuery magic. To do that, Let&#8217;s include our jQuery files in the <code>&lt;HEAD&gt;</code> of our document:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>link href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Now that we have the necessary scripts, we can write our function:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</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: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;#sidebar&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">resizable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>      
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#sidebar &quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;resize&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> ui<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> setWidth <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#sidebar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content).width(1224-setWidth);
            $('</span>.<span style="color: #660066;">menu</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span>setWidth<span style="color: #339933;">-</span><span style="color: #CC0000;">6</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>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>I know that might seem like an intimidating amount of information, so let&#8217;s break it down:</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;">&quot;#sidebar&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">resizable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>      
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This portion simply makes the div with the ID of &#8220;sidebar&#8221; resizable (which accomplishes 33% of what we want it to do).</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;">&quot;#sidebar &quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;resize&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> ui<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>By using the <code>.bind</code>, we are able to trigger other events when <code>#sidebar</code> is called.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">            <span style="color: #003366; font-weight: bold;">var</span> setWidth <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#sidebar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#content).width(1224-setWidth);</span></pre></div></div>

<p>This is where the magic happens. We&#8217;re grabbing the current width of <code>#sidebar</code> and subtracting it from the width you want your site to be. This code is what keeps your page stays the same width with only the divs changing sizes.</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;">'.menu).width(setWidth-6);</span></pre></div></div>

<p>This part of the code that expands the contents in the navigation along with <code>#sidebar</code>.</p>
<p>You can see a working example of iframe-like functionality with jQuery here: <a href="http://jqueryui.com/demos/resizable/">http://jqueryui.com/demos/resizable/</a></p>
<p>The only part you <em>won&#8217;t</em> find there is the trick to adjust a corresponding div&#8217;s size to make it grow/shrink with the first &#8230; I had a heck of a time searching that on the web, so hopefully this quick tutorial will help other developers who might be searching for this kind of functionality!</p>
<p>- Cassandra</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/no-iframes-dynamically-resize-divs-with-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SoftLayer &#8216;Cribs&#8217; ≡ DAL05 Data Center Tour</title>
		<link>http://blog.softlayer.com/2012/softlayer-cribs-dal05-data-center-tour/</link>
		<comments>http://blog.softlayer.com/2012/softlayer-cribs-dal05-data-center-tour/#comments</comments>
		<pubDate>Fri, 27 Jul 2012 15:30:07 +0000</pubDate>
		<dc:creator>Kevin Hazard</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Sales]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[cooling]]></category>
		<category><![CDATA[DAL05]]></category>
		<category><![CDATA[Dallas]]></category>
		<category><![CDATA[data center]]></category>
		<category><![CDATA[data center tour]]></category>
		<category><![CDATA[datacenter]]></category>
		<category><![CDATA[datacentre]]></category>
		<category><![CDATA[DC]]></category>
		<category><![CDATA[dc tour]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[pod]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[racks]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[walkthrough]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=8913</guid>
		<description><![CDATA[The highlight of any customer visit to a SoftLayer office is always the data center tour. The infrastructure in our data centers is the hardware platform on which many of our customers build and run their entire businesses, so it&#8217;s not surprising that they&#8217;d want a first-hand look at what&#8217;s happening inside the DC. Without [...]]]></description>
			<content:encoded><![CDATA[<p>The highlight of any customer visit to a SoftLayer office is always the data center tour. The infrastructure in our data centers is the hardware platform on which many of our customers build and run their entire businesses, so it&#8217;s not surprising that they&#8217;d want a first-hand look at what&#8217;s happening inside the DC. Without exception, visitors to a SoftLayer data center pod are impressed when they walk out of a SoftLayer <a href="http://www.softlayer.com/about/datacenters">data center pod</a> &#8230; even if they&#8217;ve been in dozens of similar facilities in the past.</p>
<p>What about the customers who aren&#8217;t able to visit us, though? We can post pictures, share stats, describe our architecture and show you diagrams of our facilities, but those mediums can&#8217;t replace the experience of an actual data center tour. In the interest of bridging the &#8220;data center tour&#8221; gap for customers who might not be able to visit SoftLayer in person (or who want to show off their infrastructure), we decided to record a <em>video</em> data center tour.</p>
<p>If you&#8217;ve seen &#8220;professional&#8221; video data center tours in the past, you&#8217;re probably positioning a pillow on top of your keyboard right now to protect your face if you fall asleep from boredom when you hear another baritone narrator voiceover and see CAD mock-ups of another &#8220;enterprise class&#8221; facility. Don&#8217;t worry &#8230; That&#8217;s not how we roll:</p>
<div class="yt560"><iframe src="http://www.youtube.com/embed/YQERVf9ibzY?hd=1" frameborder="0" width="560" height="349"></iframe></div>
<p><a href="http://blog.softlayer.com/author/jdaley/">Josh Daley</a> &mdash; whose role as site manager of <a href="http://www.softlayer.com/about/datacenters/dallas-five">DAL05</a> made him the ideal tour guide &mdash; did a fantastic job, and I&#8217;m looking forward to feedback from our customers about whether this data center tour style is helpful and/or entertaining. </p>
<p>If you want to see more videos like this one, &#8220;Like&#8221; it, leave comments with ideas and questions, and share it wherever you share things (Facebook, Twitter, your refrigerator, etc.).</p>
<p>-<a href="http://twitter.com/khazard">@khazard</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/softlayer-cribs-dal05-data-center-tour/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tips and Tricks &#8211; How to Use SFTP</title>
		<link>http://blog.softlayer.com/2012/tips-and-tricks-how-to-use-sftp/</link>
		<comments>http://blog.softlayer.com/2012/tips-and-tricks-how-to-use-sftp/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 19:38:08 +0000</pubDate>
		<dc:creator>Lyndell Rottmann</dc:creator>
				<category><![CDATA[Customer Service]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[manage]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[SFTP]]></category>
		<category><![CDATA[support]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[walkthrough]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=7619</guid>
		<description><![CDATA[Too often, new customers can get overwhelmed by a small administrative task on a Linux server. One of the more common questions I see in technical support is when a drive partition runs out of space. The website appears offline, and on of my coworkers advises you to just free-up some space. &#8220;Just?! Where can [...]]]></description>
			<content:encoded><![CDATA[<p>Too often, new customers can get overwhelmed by a small administrative task on a Linux server. One of the more common questions I see in technical support is when a drive partition runs out of space. The website appears offline, and on of my coworkers advises you to just free-up some space. &#8220;Just?! Where can I find files that are deletable without affecting my website?&#8221;</p>
<p>Don&#8217;t worry &#8230; it&#8217;s really quit simple. If you can use FTP (File Transfer Protocol), you can handle this bit of server management. Depending on the exact problem, we might instruct you to free up space by removing files in one of the following directories:</p>
<ul>
<li><code>/var/log</code></li>
<li><code>/usr/local/cpanel</code></li>
<li><code>/usr/local/apache/logs</code></li>
<li><code>/usr/local/apache/domlogs</code></li>
</ul>
<p>The reason these directories are usually overlooked is because they are not accessible by normal FTP users &mdash; users who only upload website content. When you upload website content to the server via FTP, the FTP user is limited to the directory structure for that website. Directories starting with &#8220;<code>/var</code>&#8221; and &#8220;<code>/usr</code>&#8221; cannot be accessed by these non-root users (The &#8220;root&#8221; user can access anything). And while root is a powerful user, for the sake of security, it is not normally allowed to log in over FTP because FTP is not secure &#8230; That&#8217;s where SFTP (Secure File Transfer Protocol) comes in.</p>
<p>Most FTP clients support SFTP, so you don&#8217;t have to learn a new environment to securely access any file on the server. Every FTP client is different, but I&#8217;ll illustrate with <a href="http://filezilla-project.org/">FileZilla</a> because it&#8217;s free and available on Mac, Windows and Linux. If you don&#8217;t already have an FTP client, I highly recommend FileZilla. Because there are a few ways to use FileZilla to get an SFTP connection, I can share different options for you to try:</p>
<p style="margin-bottom:0; padding-bottom:0;"><strong>Quick Connect</strong></p>
<p style="margin-top:0; padding-top:0;">The Quick Connect bar is the quickest way to connect to your server. Start FileZilla and look immediately under the toolbar for the Quick Connect bar:</p>
<p><a href="http://cdn.softlayer.com/innerlayer/fzquickconnect.png"><img class="centered" src="http://cdn.softlayer.com/innerlayer/fzquickconnect_sm.png" alt="SFTP Tutorial"/></a></p>
<p>Enter the hostname (IP address or domain name), “root” in the Username field, the root password in the Password field, and “22″ in the port field. Remember, port 22 is for SFTP, the same as SSH.  Click the Quickconnect button to connect.</p>
<p style="margin-bottom:0; padding-bottom:0;"><strong>Using the Site Manager</strong></p>
<p style="margin-top:0; padding-top:0;">The Site Manager lets you save your login details. Start FileZilla and you&#8217;ll see the following:</p>
<p><a href="http://cdn.softlayer.com/innerlayer/fzsitemanager.png"><img class="centered" src="http://cdn.softlayer.com/innerlayer/fzsitemanager_s.png" alt="SFTP Tutorial"/></a></p>
<p>To open the Site Manager, click the left-most icon in tool bar or go to <code>File &gt;&gt; Site Manager</code> in the menu.</p>
<p><a href="http://cdn.softlayer.com/innerlayer/fznewsite.png"><img class="centered" src="http://cdn.softlayer.com/innerlayer/fznewsite_s.png" alt="SFTP Tutorial"/></a></p>
<p>Enter an IP address or domain name for your server in the Host field, and select &#8220;SFTP&#8221; as your protocol. You&#8217;ll enter the root user&#8217;s login information, and you&#8217;re ready to connect by clicking the &#8220;Connect&#8221; button or you can click the &#8220;OK&#8221; button to save and close the dialog box.</p>
<p>If you just saved your settings and the Site Manager is not open, click the Site Manager icon again. From there, you can select the site under the &#8220;Select Entry&#8221; box, and you just have to click &#8220;Connect&#8221; to initiate the SFTP connection with your saved settings.</p>
<p>If you see a pop-up that warns of an &#8220;Unknown host key,&#8221; clicking the &#8220;Always trust this host, add this key to the cache&#8221; option will prevent this interruption from showing in the future. Once you click &#8220;OK&#8221; to complete the connection, your FileZilla screen should look like this:</p>
<p><a href="http://cdn.softlayer.com/innerlayer/fzrootlogin.png"><img class="centered" src="http://cdn.softlayer.com/innerlayer/fzrootlogin_s.png" alt="SFTP Tutorial"/></a></p>
<p>Notice the &#8220;Remote site&#8221; section on the middle right of the FileZilla screen:</p>
<p><a href="http://cdn.softlayer.com/innerlayer/fzremotesite.png"><img class="centered" src="http://cdn.softlayer.com/innerlayer/fzremotesite_s.png" alt="SFTP Tutorial"/></a></p>
<p>This area in FileZilla is the directory and file listing of the server. Navigate the server&#8217;s file structure here, and click &#8220;<code>/</code>&#8221; to access the top of the folder structure. You should see the &#8220;<code>/usr</code>&#8221; and &#8220;<code>/var</code>&#8221; directories, and you can explore the filesystem to delete the files technical support recommended to create space!</p>
<p style="margin-bottom:0; padding-bottom:0;"><strong>Message Log</strong></p>
<p style="margin-top:0; padding-top:0;">If you have a problem connecting to your server by FTP or SFTP, the open area below the Quickconnect bar is the Message Log. If you can copy and paste this text into a ticket, you&#8217;ll help technical support troubleshoot your connection problems. Below is an example log of a successful FTP session:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Status: Connecting to server.example.com...
Response:   fzSftp started
Command:    open <span style="color: #ff0000;">&quot;root@server.example.com&quot;</span> <span style="color: #000000;">22</span>
Command:    Trust new Hostkey: Once
Command:    Pass: <span style="color: #000000; font-weight: bold;">**********</span>
Status: Connected to server.example.com
Status: Retrieving directory listing...
Command:    <span style="color: #7a0874; font-weight: bold;">pwd</span>
Response:   Current directory is: <span style="color: #ff0000;">&quot;/root&quot;</span>
Command:    <span style="color: #c20cb9; font-weight: bold;">ls</span>
Status: Listing directory <span style="color: #000000; font-weight: bold;">/</span>root
Status: Calculating timezone offset of server...
Command:    mtime <span style="color: #ff0000;">&quot;.lesshst&quot;</span>
Response:   <span style="color: #000000;">1326387703</span>
Status: Timezone offsets: Server: <span style="color: #660033;">-21600</span> seconds. Local: <span style="color: #660033;">-21600</span> seconds. Difference: <span style="color: #000000;">0</span> seconds.
Status: Directory listing successful</pre></div></div>

<p>And here&#8217;s an example of a failed connection:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Status: Resolving address of example.com
Status: Connecting to 192.0.43.10:<span style="color: #000000;">21</span>...
Error:  Connection timed out
Error:  Could not connect to server
Status: Waiting to retry...
Status: Resolving address of example.com
Status: Connecting to 192.0.43.10:<span style="color: #000000;">21</span>...
Error:  Connection attempt interrupted by user</pre></div></div>

<p>If you have any questions, leave them in a comment below. Enjoy your new-found SFTP powers!</p>
<p>-Lyndell</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/tips-and-tricks-how-to-use-sftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AMS01 DC Tour: Built by SoftLayer, Powered by Innovators</title>
		<link>http://blog.softlayer.com/2012/ams01-dc-tour-built-by-softlayer-powered-by-innovators/</link>
		<comments>http://blog.softlayer.com/2012/ams01-dc-tour-built-by-softlayer-powered-by-innovators/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 18:47:05 +0000</pubDate>
		<dc:creator>Jonathan Wisler</dc:creator>
				<category><![CDATA[Executive Blog]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[International]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[AMS01]]></category>
		<category><![CDATA[Amsterdam]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[cabling]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[data center tour]]></category>
		<category><![CDATA[data center video]]></category>
		<category><![CDATA[dc tour]]></category>
		<category><![CDATA[entrepreneurs]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[equipment]]></category>
		<category><![CDATA[innovate]]></category>
		<category><![CDATA[innovators]]></category>
		<category><![CDATA[racks]]></category>
		<category><![CDATA[server racks]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[walkthrough]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=7504</guid>
		<description><![CDATA[About a month ago, Kevin Hazard visited SoftLayer Amsterdam after a conference in London, and while he was here, I invited him on a data center tour. You saw a few glimpses of the data center in his &#8220;This is Different&#8221; video, but he turned the camera around on me to give a simpler &#8220;Data [...]]]></description>
			<content:encoded><![CDATA[<p>About a month ago, <a href="http://blog.softlayer.com/author/khazard/">Kevin Hazard</a> visited SoftLayer Amsterdam after a conference in London, and while he was here, I invited him on a data center tour. You saw a few glimpses of the data center in his <a href="http://www.youtube.com/watch?v=LIrQg0Y2CzA">&#8220;This is Different&#8221;</a> video, but he turned the camera around on me to give a simpler &#8220;Data Center Tour&#8221; video to show off some of the key characteristics of the server room environment in AMS01.</p>
<p>Given the fact that nearly everything in the data center <a href="http://blog.softlayer.com/2012/amsterdam-data-center-ams01-does-it-measure-up/">is the same</a>, if you&#8217;ve ever seen a SoftLayer data center, this tour will seem very familiar. The configuration and architecture of all 13 of our data centers are identical, and with the exceptions of a few Dutch words on the walls, this tour could be given (and <em>is</em> frequently given to customers) in all of our facilities around the world:</p>
<div class="yt560"><iframe src="http://www.youtube.com/embed/uOMIg9lggiI?hd=1" frameborder="0" width="560" height="349"></iframe></div>
<p>As we were recording this video, I started thinking about all the similarities and differences between all the entrepreneurs I have worked with during my career &mdash; which coincidentally lines up well with Clayton&#8217;s &#8220;<a href="http://blog.softlayer.com/2012/building-business-softlayer/">Building. Business. SoftLayer.</a>&#8221; blog. I cut my technology teeth in Silicon Valley during the dot-com tsunami of the late 90&#8242;s, and since then, I have collaborated on-location with entrepreneurs from the Netherlands, United Kingdom, Spain, Germany, Austria, Switzerland, France, Chile, Ukraine and Italy. While these cultures often vary widely with customs, manners, food and methods of business, I would have to say that entrepreneurs have far more similarities than they do differences.</p>
<p>At the peak of the dot-com boom, money was raining from the sky, and anyone with a decent PowerPoint presentation containing the word &#8220;Internet,&#8221; could raise million dollars of dollars in a matter of days. After the bubble popped, funding all but dried up. Even real businesses with profitable business models couldn&#8217;t raise a cent. My neighbor went from being worth over $10M on paper and keeping company with the Queen of the Netherlands to scrambling to pay the rent and fighting for a seat at the local coffee shop.</p>
<p>In my opinion, that&#8217;s when the real magic happened: The creators just kept on creating. Despite all our friends making fun of us &mdash; telling us &#8220;the Internet thing&#8221; was dead &mdash; we kept building cool stuff and coming up with innovative products that pushed the limits of technology.</p>
<p>While entrepreneurs liked the idea of making tons of money and building a global company from a simple idea, money and fame are <em>not</em> the primary drivers of true entrepreneurs. They were really more interested in creating something that would impact peoples&#8217; everyday lives and disrupt tired industries &#8230; Just look at SoftLayer. In 2005, &#8220;tired&#8221; would have been one of the nicest things you could have said about the hosting industry, and in response to that environment, our &#8220;Innovate or Die&#8221; mentality shot us to the front of the pack.</p>
<p>Entrepreneurs are a lot like our data centers &#8230; They may look a little different from the outside, but they are exactly the same on the inside. Ask them how they&#8217;d change the world, and take note of the wild look in their eyes. Our growth is fueled by the passions of our customers, and as long as we have brilliant customers doing amazing things, you can expect to see more and more of these &#8220;new data center&#8221; tour videos in the coming months and years.</p>
<p>-<a href="http://twitter.com/jpwisler">@jpwisler</a></p>
<p>P.S. If you don&#8217;t have time to watch the video right now, you can head to our Flickr page to see a few pictures we snapped while recording the tour: <a href="http://www.flickr.com/photos/softlayer/sets/72157626358733931/">AMS01 &#8211; Amsterdam Data Center</a></p>
<p>P.P.S. Make sure you watch the video all the way to the end. <img src='http://blog.softlayer.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/ams01-dc-tour-built-by-softlayer-powered-by-innovators/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tips and Tricks &#8211; Remote Audio Over RDP in Windows 2008</title>
		<link>http://blog.softlayer.com/2012/tips-and-tricks-remote-audio-over-rdp-in-windows-2008/</link>
		<comments>http://blog.softlayer.com/2012/tips-and-tricks-remote-audio-over-rdp-in-windows-2008/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 20:00:26 +0000</pubDate>
		<dc:creator>Bill Sehmel</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[RDP]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[remote connection]]></category>
		<category><![CDATA[remote desktop]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[walkthrough]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=7268</guid>
		<description><![CDATA[I was working on my server the other night, and I found myself needing to get sound from my Windows 2008 box through an RDP (Remote Desktop Protocol) connection. Because we have a huge customer base with Windows 2008 installed now, I figured there may be someone else out there that would like to be [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on my server the other night, and I found myself needing to get sound from my <a href="http://www.microsoft.com/en-us/server-cloud/windows-server/default.aspx">Windows 2008</a> box through an RDP (Remote Desktop Protocol) connection. Because we have a huge customer base with Windows 2008 installed now, I figured there may be someone else out there that would like to be able to hear sounds from their server on their local computer when connected, so I put together a quick walkthrough with how I got it to work:</p>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Configuring Your Server</strong></p>
<ol>
<li>Open <em>Windows Services</em> (Start -> Run -> Services.msc)</li>
<li>Change the properties of the <em>Windows Audio Endpoint Service</em> and <em>Windows Audio Service</em> to &#8220;Automatic&#8221;. If the services are not already started, you can manually start them at this time.
<li>Open <em>Terminal Services</em> ( Start -> Run -> tsconfig.msc)</li>
<li>Right-click on the RDP-TCP connection and bring up its properties. Go to the &#8220;Client Settings&#8221; and make sure that on &#8220;Redirection Audio&#8221; is not disabled.</li>
<li>Fully log out and log back into the RDP connection to the server. You will see a balloon error on your speaker icon that states &#8220;No Audio Output Device is installed.&#8221;</li>
</ol>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Making Registry Changes</strong></p>
<ol>
<li>You will now need to back up your registry and some registry changes.</li>
<li>I want to reiterate the instruction to <strong>back up your registry</strong> &#8230; As with most technical guides/walkthroughs, SoftLayer will not be held liable for any corruptions that may result from you attempting these changes. The next two steps will show how to quickly back up your registry.</li>
<li>Log into your server on an account with Administrator rights, and open <em>regedit</em> (Start -> Run -> regedit)</li>
<li>Export the current registry (from the &#8220;File&#8221; menu) and copy it to a location off of your server so you have it backed up.</li>
<li>Locate the following key: <code>HKEY_CLASSES_ROOT\AudioEngine\AudioProcessingObjects</code>. This will contain several subkeys all each named with a GUID.</li>
<li>Click on each subkey, then right-click and select &#8220;Permissions.&#8221; You will then click on the &#8220;Advanced&#8221; button and the &#8220;Owner&#8221; tab. The current owner should be listed as &#8220;TrustedInstaller.&#8221;
<li>Select the Administrative account and/or group from the list and click &#8220;OK&#8221; to change the ownership.</li>
<li>Select the account you just chose and give it &#8220;Full Control,&#8221; then click &#8220;OK.&#8221;</li>
<li>In the &#8220;Detail&#8221; box of each subkey, double-click on the <code>DWORD</code> value &#8220;<code>MinOutputConnections</code>&#8221; and change it from 1 to 0, then click &#8220;OK.&#8221; </li>
<li>Once you have done this for each subkey in <code>HKEY_CLASSES_ROOT\AudioEngine\AudioProcessingObjects</code>, you can close <em>regedit</em> and restart the <em>Windows Audio</em> and <em>Windows Audio Endpoint services</em>. </li>
</ol>
<p style="margin-bottom:0;padding-bottom:0;"><strong>Configuring Your RDP Client</strong></p>
<p style="margin-top:0;padding-top:5px;">Now that you have everything ready on the server, you just need to make sure your RDP client recognizes the audio. Log off of the server so you can configure your RDP client. Open RDP, go to the &#8220;Options&#8221; menu, and under &#8220;Local Resources,&#8221; select &#8220;Configure Remote Audio Settings.&#8221; Select &#8220;Play on this Computer,&#8221; and hit &#8220;OK.&#8221; Voila! You now should be able to hear sound from your Windows 2008 RDP connection.</p>
<p>-Bill</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/tips-and-tricks-remote-audio-over-rdp-in-windows-2008/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Web Development &#8211; HTML5 &#8211; Custom Data Attributes</title>
		<link>http://blog.softlayer.com/2012/web-development-html5-custom-data-attributes/</link>
		<comments>http://blog.softlayer.com/2012/web-development-html5-custom-data-attributes/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 17:30:29 +0000</pubDate>
		<dc:creator>Philip Thompson</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[data attributes]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[form validation]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[walkthrough]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=6843</guid>
		<description><![CDATA[I recently worked on a project that involved creating promotion codes for our clients. I wanted to make this tool as simple as possible to use and because this involved dealing with thousands of our products in dozens of categories with custom pricing for each of these products, I had to find a generic way [...]]]></description>
			<content:encoded><![CDATA[<p>I recently worked on a project that involved creating promotion codes for our clients. I wanted to make this tool as simple as possible to use and because this involved dealing with thousands of our products in dozens of categories with custom pricing for each of these products, I had to find a generic way to deal with client-side form validation. I didn&#8217;t want to write custom JavaScript functions for each of the required inputs, so I decided to use custom data attributes.</p>
<p>Last month, we started a series focusing on web development tips and tricks with a post about <a href="http://blog.softlayer.com/2011/html5-javascript-web-development-part-i/">JavaScript optimization</a>. In this installment, we&#8217;re cover how to use HTML5 custom data attributes to assist you in validating forms.</p>
<p><a href="http://www.w3.org/TR/html5/elements.html#custom-data-attribute">Custom data attributes</a> for elements are &#8220;[attributes] in no namespace whose name starts with the string &#8216;data-&#8217;, has at least one character after the hyphen, is XML-compatible, and contains no characters in the range U+0041 to U+005A (LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z).&#8221; Thanks W3C. That definition is bookish, so let&#8217;s break it down and look at some examples.</p>
<style type="text/css">
code{color:blue;}
</style>
<p style="margin-bottom:0; padding-bottom:0;"><strong>Valid:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div data<span style="color: #339933;">-</span>name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Philip&quot;</span><span style="color: #339933;">&gt;</span>Mr<span style="color: #339933;">.</span> Thompson is an okay guy<span style="color: #339933;">.&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;softlayer.com&quot;</span> data<span style="color: #339933;">-</span>company<span style="color: #339933;">-</span>name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SoftLayer&quot;</span> data<span style="color: #339933;">-</span>company<span style="color: #339933;">-</span>state<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;TX&quot;</span><span style="color: #339933;">&gt;</span>SoftLayer<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>li data<span style="color: #339933;">-</span>color<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;blue&quot;</span><span style="color: #339933;">&gt;</span>Smurfs<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span></pre></div></div>

<p style="margin-bottom:0; padding-bottom:0;"><strong>Invalid:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// This attribute is not prefixed with 'data-'</span>
    <span style="color: #339933;">&lt;</span>h2 database<span style="color: #339933;">-</span>id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;244&quot;</span><span style="color: #339933;">&gt;</span>Food<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// These 2 attributes contain capital letters in the attribute names</span>
    <span style="color: #339933;">&lt;</span>p data<span style="color: #339933;">-</span>firstName<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Ashley&quot;</span> data<span style="color: #339933;">-</span>lastName<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Thompson&quot;</span><span style="color: #339933;">&gt;...&lt;/</span>p<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This attribute does not have any valid characters following 'data-'</span>
    <span style="color: #339933;">&lt;</span>img src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/images/pizza.png&quot;</span> data<span style="color: #339933;">-=</span><span style="color: #0000ff;">&quot;Sausage&quot;</span> <span style="color: #339933;">/&gt;</span></pre></div></div>

<p style="margin-bottom:0;padding-bottom:0;">Now that you know what custom data attributes are, why would we use them? Custom attributes allow us to relate specific information to particular elements. This information is hidden to the end user, so we don&#8217;t have to worry about the data cluttering screen space and we don&#8217;t have to create separate hidden elements whose purpose is to hold custom data (which is just bad practice). This data can be used by a JavaScript programmer to many different ends. Among the most common use cases are to manipulate elements, provide custom styles (using CSS) and perform form validation. In this post, we&#8217;ll focus on form validation. </p>
<p><span id="more-6843"></span></p>
<p>Let&#8217;s start out with a simple form with two radio inputs. Since I like food, our labels will be food items!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;food&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pizza&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;food&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>show<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;.pizza&quot;</span> <span style="color: #339933;">/&gt;</span> Pizza
<span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;food&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sandwich&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;food&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>show<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#sandwich&quot;</span> <span style="color: #339933;">/&gt;</span> Sandwich
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden required&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>error<span style="color: #339933;">-</span>food<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">&gt;</span>A food item must be selected<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Here we have two standard radio inputs with some custom data attributes and a hidden div (using CSS) that contains our error message. The first input has a name of <code>food</code> and a value of <code>pizza</code> &ndash; these will be used on the server side once our form is submitted. There are two custom data attributes for this input: <code>data-sl-required</code> and <code>data-sl-show</code>. I am defining the data attribute <code>data-sl-required</code> to indicate that this radio button is required in the form and one of them must be selected to pass validation. Note that I have prefixed <code>required</code> with <code>sl-</code> to <a href="http://en.wikipedia.org/wiki/Namespace">namespace</a> my data attribute. <code>required</code> is generic and I don&#8217;t want to have any conflicts with any other attributes – especially ones written for other projects! The value of <code>data-sl-required</code> is <code>food</code>, which I have tied to the div with the attribute <code>data-sl-error-food</code> (more on this later). </p>
<p>The second custom attribute is <code>data-sl-show</code> with a selector of <code>.pizza</code>. (To review selectors, jump back to the <a href="http://blog.softlayer.com/2011/html5-javascript-web-development-part-i/">JavaScript optimization</a> post.) This data attribute will be used to show a hidden div that contains the class <code>pizza</code> when the radio button is clicked. The <code>sandwich</code> radio input has the same data attributes but with slightly different values.</p>
<p style="margin-bottom:0;padding-bottom:0;">Now we can move on to our HTML with the hidden text inputs:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden pizza&quot;</span><span style="color: #339933;">&gt;</span>
    Pizza type<span style="color: #339933;">:</span> <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pizza&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pizza&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>depends<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{&amp;quot;type&amp;quot;:&amp;quot;radio&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;food&amp;quot;,&amp;quot;value&amp;quot;:&amp;quot;sandwich&amp;quot;}&quot;</span> <span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden required&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>error<span style="color: #339933;">-</span>pizza<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">&gt;</span>The pizza type must not be empty<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sandwich&quot;</span><span style="color: #339933;">&gt;</span>
    Sandwich<span style="color: #339933;">:</span> <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sandwich&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>required<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;sandwich&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>depends<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{&amp;quot;type&amp;quot;:&amp;quot;radio&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;food&amp;quot;,&amp;quot;value&amp;quot;:&amp;quot;sandwich&amp;quot;}&quot;</span> <span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden required&quot;</span> data<span style="color: #339933;">-</span>sl<span style="color: #339933;">-</span>error<span style="color: #339933;">-</span>sandwich<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">&gt;</span>The sandwich must not be empty<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p style="margin-bottom:0;padding-bottom:0;">These are hidden divs that contain text inputs that will be used to input more data depending on the radio input selected. Notice that the first outer div has a class of <code>pizza</code> and the second outer div has an id of <code>sandwich</code>. These values tie back to the <code>data-sl-show</code> selectors for the radio inputs. These text inputs also contain the <code>data-sl-required</code> attribute like the previous radio inputs. The <code>data-sl-depends</code> data attribute is a fun attribute that contains a JSON-encoded object that&#8217;s been run through PHP&#8217;s <em>htmlentities()</em> function. For readability, the <code>data-sl-depends</code> values contain:</p>
<div style="margin-left:20px;margin-top:0;"><code>{"type":"radio","name":"food","value":"pizza"}</code><br />
<code>{"type":"radio","name":"food","value":"sandwich"}</code></div>
<p>This first attribute says that our text input “depends” on the <code>radio</code> input with the name <code>food</code> and value <code>pizza</code> to be visible and selected in order to be processed as required. You can just imagine the possibilities of combinations you can create to make very custom functionality with very generic JavaScript.</p>
<p>Now we can examine our JavaScript to make sense of all these custom data attributes. Note that I&#8217;ll be using Mootools&#8217; syntax, but the same can fairly easily be accomplished using jQuery or your favorite JavaScript framework. I&#8217;m going to start by creating a <em>DataForm</em> class. This will be generic enough so that you can use it in multiple forms and it&#8217;s not tied to this specific instance. Reuse is good! To have it fit our needs, we&#8217;re going to pass some options when instantiating it.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">new</span> DataForm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    ...<span style="color: #339933;">,</span>
    dataAttributes<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
        required<span style="color: #339933;">:</span> <span style="color: #3366CC;">'data-sl-required'</span><span style="color: #339933;">,</span>
        errorPrefix<span style="color: #339933;">:</span> <span style="color: #3366CC;">'data-sl-error'</span><span style="color: #339933;">,</span>
        depends<span style="color: #339933;">:</span> <span style="color: #3366CC;">'data-sl-depends'</span><span style="color: #339933;">,</span>
        show<span style="color: #339933;">:</span> <span style="color: #3366CC;">'data-sl-show'</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you can see, I&#8217;m using the data attribute names from our form as the options – this will allow you to create your own data attribute names depending on your uses. We first need to make our hidden divs visible whenever our radio buttons are clicked – we&#8217;ll use our <em>initData()</em> method for that.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">initData<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: #003366; font-weight: bold;">var</span> attrs <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">dataAttributes</span><span style="color: #339933;">,</span>
        divs <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    $$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=radio]['</span><span style="color: #339933;">+</span>attrs.<span style="color: #660066;">show</span><span style="color: #339933;">+</span><span style="color: #3366CC;">']'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> div <span style="color: #339933;">=</span> $$<span style="color: #009900;">&#40;</span>input.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span>attrs.<span style="color: #660066;">show</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        divs.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>div<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        input.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'change'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            divs.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>div<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> div.<span style="color: #660066;">hide</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>
            div.<span style="color: #660066;">show</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>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This method grabs all the radio inputs with the <em>show</em> attribute (<code>data-sl-show</code>) and adds an <em>onchange</em> event to each of them. When a radio input is checked, it first hides all the divs, and then shows the div that&#8217;s associated with that radio input.</p>
<p>Great! Now we have our text inputs showing and hiding depending on which radio button is selected. Now onto the actual validation. First, we&#8217;ll make sure our required radio inputs are checked:</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;">'input[type=radio]['</span><span style="color: #339933;">+</span>attrs.<span style="color: #660066;">required</span><span style="color: #339933;">+</span><span style="color: #3366CC;">']:not(:checked)'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span> <span style="color: #339933;">=</span> input.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    checkError<span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">,</span> isRadioWithNameSelected<span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This grabs all the unchecked radio inputs with the <em>required</em> attribute (<code>data-sl-required</code>) and checks to see if any radio with that same name is selected using the function <em>isRadioWithNameSelected()</em>. The <em>checkError()</em> function will show or hide the error div (<code>data-sl-error-*</code>) depending if the radio is checked or not. Don&#8217;t worry &#8211; you&#8217;ll see how these functions are implemented in the JSFiddle below.</p>
<p>Now we can check our text inputs:</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;">'input[type=text]['</span><span style="color: #339933;">+</span>attrs.<span style="color: #660066;">required</span><span style="color: #339933;">+</span><span style="color: #3366CC;">']:visible'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span> <span style="color: #339933;">=</span> input.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        depends <span style="color: #339933;">=</span> input.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span>attrs.<span style="color: #660066;">depends</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        value <span style="color: #339933;">=</span> input.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>depends<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        depends <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">encode</span><span style="color: #009900;">&#40;</span>depends<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>depends.<span style="color: #660066;">type</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'radio'</span><span style="color: #339933;">:</span>
                <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>depends.<span style="color: #000066;">name</span> <span style="color: #339933;">&amp;&amp;</span> depends.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #003366; font-weight: bold;">var</span> radio <span style="color: #339933;">=</span> $$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=radio][name=&quot;'</span><span style="color: #339933;">+</span>depends.<span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot;][value=&quot;'</span><span style="color: #339933;">+</span>depends.<span style="color: #660066;">value</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot;]:checked'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>radio<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        checkError<span style="color: #009900;">&#40;</span>input.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span>attrs.<span style="color: #660066;">required</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    checkError<span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">,</span> value<span style="color: #339933;">!=</span><span style="color: #3366CC;">''</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>This obtains the required and visible text inputs and determines if they are empty or not. Here we look at our <code>depends</code> object to grab the associated radio inputs. If that radio is checked and the text input is empty, the error message appears. If that radio is not checked, it doesn&#8217;t even evaluate that text input. The <code>depends.type</code> is in a <em>switch</em> statement to allow for easy expansion of types. There are other cases for evaluating relationships &#8230; I&#8217;ll let you come up with more for yourself.</p>
<p>That concludes our usage of custom data attributes in form validation. This really only touched upon the very tip of the iceberg. Data attributes allow you &ndash; the creative developer &ndash; to interact in a new, HTML-valid way with your web pages.</p>
<p>Check out the working example of the above code at <a href="http://jsfiddle.net/philthathril/YyKbt/1/">jsfiddle.net</a>. To read more on custom data attributes, see what Google has to say. If you want to see really cool functionality that uses data attributes plus so much more, check out Aaron Newton&#8217;s <a href="http://www.clientcide.com/code-releases/clientcide-3-0-behavior-1-0-mootools-development-and-so-much-more/">Behavior module</a> over at <a href="http://www.clientcide.com/">clientcide.com</a>.</p>
<p>Happy coding!</p>
<p>-Philip</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/web-development-html5-custom-data-attributes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>iptables Tips and Tricks &#8211; Port Redirection</title>
		<link>http://blog.softlayer.com/2011/iptables-tips-and-tricks-port-redirection/</link>
		<comments>http://blog.softlayer.com/2011/iptables-tips-and-tricks-port-redirection/#comments</comments>
		<pubDate>Mon, 26 Dec 2011 18:10:16 +0000</pubDate>
		<dc:creator>Mark Ridlen</dc:creator>
				<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[walkthrough]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=6733</guid>
		<description><![CDATA[One of the most challenging and rewarding aspects of Linux administration is the iptables firewall. To the unenlightened, this can be a confusing black box that breaks your web server and blocks your favorite visitors from viewing your content at the most inconvenient times. This blog is the first in a series aimed at clarifying [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most challenging and rewarding aspects of Linux administration is the <a href="http://www.netfilter.org/projects/iptables/index.html">iptables</a> firewall. To the unenlightened, this can be a confusing black box that breaks your web server and blocks your favorite visitors from viewing your content at the most inconvenient times. This blog is the first in a series aimed at clarifying this otherwise mysterious force at work in your server.</p>
<p>Nothing compares with the frustration of trying to make a program listen on a different port &ndash; like if you wanted to configure your mail client to listen on port 2525. Many times, configuring a program the hard way (some would say the &#8220;correct&#8221; way) using configuration files may not be worth your time and effort &#8230; Especially if the server is running on a control panel that does not natively support this functionality.</p>
<p>Fortunately, iptables offers an elegant solution:</p>
<p><code>iptables -t nat -A PREROUTING -p tcp --dport 2525 -j REDIRECT --to-ports 25</code></p>
<p>What this does:</p>
<ol>
<li>This specifies <code>-t nat</code> to indicate the nat table. Typically rules are added to the &#8220;filter&#8221; table (if you do not specify another table), and this is where the majority of the traffic is handled. In this case, however, we require the use of the nat table.</li>
<li>This rules appends (<code>-A</code>), which means to add the rule at the bottom of the list.
<li>This rule is added to the <code>PREROUTING</code> chain.</li>
<li>For the tcp protocol (<code>-p tcp</code>)</li>
<li>The destination port (<code>--dport</code>) is <code>2525</code> &#8211; this is the port that the client is trying to access on your server.</li>
<li>The traffic is jumped (<code>-j</code>) to the <code>REDIRECT</code> action. This is the action that is taken when the rule matches.</li>
<li>The port is redirected to port <code>25</code> on the server.</li>
</ol>
<p>As you can see, by changing the protocol to either <code>tcp</code> or <code>udp</code> or by adjusting the <code>dport</code> number and the <code>to-ports</code> number, you can redirect any port incoming to any listening port on the server. Just remember that the <code>dport</code> is the port the client machine is trying to connect to (the port they configure in the mail client, for example).</p>
<p>But check this out: Say for example you have a website (shocking, I know). You don&#8217;t have a load balancer or a firewall set up, but you want to split off your email traffic to a second server to reduce strain on your web server. Essentially, you want to take incoming port 25 and redirect it &#8230; to ANOTHER SERVER. With iptables, you can make this work:</p>
<p><code>iptables -t nat -A PREROUTING -p tcp -d 123.123.123.123 --dport 25 -j DNAT --to-destination 10.10.10.10:25</code></p>
<p>What this does:</p>
<ol>
<li>It specifies a destination (<code>-d</code>) IP address. This is not needed, but if you want to limit the email redirection to a single address, this is how you can do it.</li>
<li>It is jumped to <code>DNAT</code>, which stands for destination nat.</li>
<li>The destination and port are specified as arguments on <code>to-destination</code></li>
</ol>
<p>As you can see, this forwards all traffic on port 25 to an internal IP address.</p>
<p>Now, say you want to redirect from a different incoming port to a port on another server:</p>
<p><code>iptables -t nat -A PREROUTING -p tcp --dport 5001 -j DNAT --to-destination 10.10.10.10:25<br />
iptables -t nat -A POSTROUTING -p tcp --dport 25 -j MASQUERADE</code></p>
<p>In this example, the incoming port is different, so we need to change it back to the standard port on the way back out through the primary server.</p>
<p>If you would like further reading on this topic, I recommend this great tutorial:<br />
<a href="http://www.karlrupp.net/en/computer/nat_tutorial">http://www.karlrupp.net/en/computer/nat_tutorial</a></p>
<p>Remember, when you are modifying your running configuration of iptables, you will still need to save your changes in order for it to persist on reboot. Be sure to test your configuration before saving it with &#8220;<code>service iptables save</code>&#8221; so that you don&#8217;t lock yourself out.</p>
<p>-Mark</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2011/iptables-tips-and-tricks-port-redirection/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>UNIX Sysadmin Boot Camp: Your Logs and You</title>
		<link>http://blog.softlayer.com/2011/unix-sysadmin-boot-camp-your-logs-and-you/</link>
		<comments>http://blog.softlayer.com/2011/unix-sysadmin-boot-camp-your-logs-and-you/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 14:15:36 +0000</pubDate>
		<dc:creator>Ryan Robson</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[boot camp]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[walkthrough]]></category>
		<category><![CDATA[workout]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=4794</guid>
		<description><![CDATA[We&#8217;re a few exercises into UNIX Sysadmin Boot Camp, and if you&#8217;re keeping up, you&#8217;ve learned about SSH and bash. In those sessions, our focus was to tell the server what we wanted it to do. In this session, we&#8217;re going to look at the logs of what the server has done. Logs are like [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re a few exercises into UNIX Sysadmin Boot Camp, and if you&#8217;re keeping up, you&#8217;ve learned about <a href="http://blog.softlayer.com/2011/unix-sysadmin-boot-camp-an-intro-to-ssh/">SSH</a> and <a href="http://blog.softlayer.com/2011/unix-sysadmin-boot-camp-bash/">bash</a>. In those sessions, our focus was to tell the server what we wanted it to do. In this session, we&#8217;re going to look at the logs of what the server has done. </p>
<p>Logs are like an overbearing mother who sneakily follows her teenage son around and writes down the addresses of each house he visits. When he realizes he lost a really important piece of baseball history at one of those houses, he&#8217;ll be glad he has that list so he can go desperately search for the soon-to-be-noticed missing bat. Ahem.</p>
<p><strong>MAKE BEST FRIENDS WITH THIS DIRECTORY:</strong> <code>/var/log/</code></p>
<p>When something goes wrong &ndash; when there&#8217;s hitch in the flux capacitor or too many gigawatts in the main reactor &ndash; your logs will be there to let you know what&#8217;s going on, and you can pinpoint the error with educated vengeance. So treat your logs with respect. </p>
<p>One of the best places to start harnessing this logged goodness is <code>/var/log/messages</code>. This log file reports all general errors with network and media, among other things. As you add to and learn your server&#8217;s command line environment, you&#8217;ll see specific logs for applications as well, so it&#8217;s a very good idea to keep a keen eye on these. They just might save your life &#8230; or server.</p>
<p>Some of the most commonly used logs (may vary with different Linux distributions):</p>
<ul>
<li><code>/var/log/message</code> &ndash; General message- and system-related info</li>
<li><code>/var/log/cron.log</code> &ndash; Cron job logs</li>
<li><code>/var/log/maillog</code> &ndash; Mail server logs</li>
<li><code>/var/log/kern.log</code> &ndash; Kernel logs</li>
<li><code>/var/log/httpd/</code> &ndash; Apache access and error logs</li>
<li><code>/var/log/boot.log</code> &ndash; System boot logs</li>
<li><code>/var/log/mysqld.log</code> &ndash; MySQL database server logs</li>
<li><code>/var/log/secure</code> &ndash; SSH authentication logs</li>
<li><code>/var/log/auth.log</code> &ndash; Authentication logs</li>
<li><code>/var/log/qmail/</code> &ndash; Qmail log directory (more files inside this directory)</li>
<li><code>/var/log/utmp</code> or <code>/var/log/wtmp</code> &ndash; Login records file</li>
<li><code>/var/log/yum.log</code> &ndash; Yum log files</li>
</ul>
<p>There are plenty more in-depth logs &ndash; particularly involving raw system components &ndash; and others that act similarly to logs but are a bit more active like <code>tcpdumps</code>. Those are a little more advanced to interpret, so I&#8217;ll save them for another guide and another day.</p>
<p>At this point in our UNIX workout series, you&#8217;re familiar with the command line, you know the basics of how to tell your server what to do and you just learned how to let the server tell you what it&#8217;s done. There&#8217;s still a bit of work to be done before you can call yourself a UNIX ninja, but you&#8217;re well on your way. In our next installment, we&#8217;re going to take a step back and talk about p455w0rd5.</p>
<p>Keep learning.</p>
<p>-Ryan</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2011/unix-sysadmin-boot-camp-your-logs-and-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SOAP API Application Development 101</title>
		<link>http://blog.softlayer.com/2011/softlayer-soap-api-application-development-101/</link>
		<comments>http://blog.softlayer.com/2011/softlayer-soap-api-application-development-101/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 13:30:47 +0000</pubDate>
		<dc:creator>Kevin Trachier</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SoftLayer]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[coder]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[SLDN]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[walkthrough]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/2011/</guid>
		<description><![CDATA[Simple Object Access Protocol (SOAP) is built on server-to-server remote procedure calls over HTTP. The data is formatted as XML; this means secure, well formatted data will be sent and received from SoftLayer&#8217;s API. This may take a little more time to set up than the REST API but it can be more scalable as [...]]]></description>
			<content:encoded><![CDATA[<p>Simple Object Access Protocol (SOAP) is built on server-to-server remote procedure calls over HTTP. The data is formatted as XML; this means secure, well formatted data will be sent and received from SoftLayer&#8217;s API. This may take a little more time to set up than the REST API but it can be more scalable as you programmatically interface with it. SOAP&#8217;s ability to tunnel through existing protocols such as HTTP and innate ability to work in an object-oriented structure make it an excellent choice for interaction with the SoftLayer API.</p>
<p>This post gets pretty technical and detailed, so it might not appeal to our entire audience. If you&#8217;ve always wondered how to get started with SOAP API development, this post might be a good jumping-off point.</p>
<p><span id="more-3919"></span></p>
<p><strong>Authentication</strong><br />
Before you start playing with the SoftLayer SOAP API, you will need to find your API authentication token. Go into your portal account, and click the &#8220;Manage API Access&#8221; link from the API page under the Support tab. At the bottom of the page you&#8217;ll see a drop down menu for you to &#8220;Generate a new API access key&#8221; for a user. After you select a user and click the &#8220;Generate API Key&#8221; button, you will see your username and your API key. Copy this API key, as you&#8217;ll need it to send commands to SoftLayer&#8217;s API.</p>
<p><strong>PHP</strong><br />
In PHP 5.0+ there are built in classes to deal with SOAP calls. This allows us to quickly create an object oriented, server side application for handling SOAP requests to SoftLayer&#8217;s API. This tutorial is going to focus on PHP 5.1+ as the server side language for making SOAP function calls. If you haven’t already, you will need to install the soap client for php, <a href="http://www.php.net/manual/en/soap.installation.php">here</a> is a link with directions.</p>
<h3>Model View Controller </h3>
<p>Model-View-Controller or MVC is a software architecture commonly used in web development. This architecture simply provides separation between a data abstraction layer (model), the business logic (controller), and the resulting output and user interface (view). Below, I will describe each part of our MVC &#8220;hello world&#8221; web application and dissect the code so that you can understand each line.</p>
<p>To keep this entry a little smaller, the code snippits I reference will be posted on their own page: <a href="http://blog.softlayer.com/soap-api-code-examples/">SOAP API Code Examples</a>. Protip: Open the code snippit page in another window so you can seamlessly jump between this page and the code it&#8217;s referencing.</p>
<p><strong>Model</strong><br />
The first entry on the API Code Examples page is &#8220;The Call Class,&#8221; a custom class for making basic SOAP calls to SoftLayer&#8217;s API. This class represents our model: The SOAP API Call. When building a model, you need to think about what properties that model has, for instance, a model of a person might have the properties: first name, height, weight, etc. Once you have properties, you need to create methods that use those properties. </p>
<p>Methods are verbs; they describe what a model can do. Our &#8220;person&#8221; model might have the methods: run, walk, stand, etc. Models need to be self-sustaining, that means we need to be able to set and get a property from multiple places without them getting jumbled up, so each model will have a &#8220;set&#8221; and &#8220;get&#8221; method for each of its properties. A model is a template for an object, and when you store a model in a variable you are instantiating an instance of that model, and the variable is the instantiated object. </p>
<ul>
<li><strong>Properties and Permissions</strong><br />
Our model has these properties: username, password (apiKey), service, method, initialization parameters, the service&#8217;s WSDL, SoftLayer&#8217;s type namespace, the SOAP API client object, options for instantiating that client, and a response value. The SOAP API client object is built into php 5.1+ (take a look at the “PHP” section above), as such, our model will instantiate a SOAP API object and use it to communicate to SoftLayer&#8217;s SOAP API. </p>
<p>Each of our methods and properties are declared with certain permissions (protected, private, or public), these set whether or not outside functions or extended classes can have access to these properties or methods. I &#8220;set&#8221; things using the &#8220;<code>$this</code>&#8221; variable, <code>$this</code> represents the immediate class that the method belongs to.  I also use the arrow operator (<code>-></code>), which accesses a property or method (to the right of the arrow) that belongs to <code>$this</code> (or anything to the left of the arrow). I gave as many of the properties default values as I could, this way when we instantiate our model we have a fully fleshed out object without much work, this comes in handy if you are instantiating many different objects at once.</li>
<li><strong>Methods</strong><br />
I like to separate my methods into 4 different groups: Constructors, Actions, Sets, and Gets:</p>
<ul>
<li><strong>Sets and Gets</strong><br />
Sets and Gets simply provide a place within the model to set and get properties of that model. This is a standard of object oriented programing and provides the model with a good bit of scalability. Rather than accessing the property itself, always refer to the function that gets or sets the property. This can prevent you from accidentally changing value of the property when you are trying to access it. Lines 99 to the end of our call are where the sets and gets are located.<br/><br/></li>
<li><strong>Constructors</strong><br />
Constructors are methods dedicated to setting options in the model, lines 23-62 of the call model are our constructors. The beauty of these three functions is that they can be copied into any model to perform the same function, just make sure you keep to the <a href="http://framework.zend.com/manual/en/coding-standard.overview.html">Zend coding standards</a>.</p>
<p>First, let’s take a look at the <code>__construct</code> method on line 24. This is a special <a href="http://php.net/manual/en/language.oop5.magic.php">magic php method</a> that always runs immediately when the model is instantiated. We don’t want to actually process anything in this method because if we want to use the default object we will not be passing any options to it, and unnecessary processing will slow response times. We pass the options in an array called <code>Setup</code>, notice that I am using <a href="http://www.php.net/manual/en/language.oop5.typehinting.php">type hinting</a> and <a href="http://php.net/manual/en/functions.arguments.php">default parameters</a> when declaring the function, this way I don’t have to pass anything to model when instantiating. If values were passed in the <code>$Setup</code> variable (which must be an array), then we will run the “<code>setOptions”</code> method.</p>
<p>Now take a look at the <code>setOptions</code> method on line 31. This method will search the model for a set method which matches the option passed in the <code>$setup</code> variable using the built in <code>get_class_methods</code> <a href="http://us.php.net/manual/en/function.get-class-methods.php">function</a>. It then passes the value and name of that option to another magic method, the <code>__set</code> method.</p>
<p>Finally, let’s take a look at the <code>__set</code> and <code>__get</code> methods on lines 45 and 54. These methods are used to create a kind of shorthand access to properties within the model, this is called overloading. Overloading allows the controller to access properties quicker and more efficiently.<br/></li>
<li><strong>Actions</strong><br />
Actions are the traditional verbs that I mentioned earlier; they are the “run”, “walk”, “jump”, and “climb” of our person model. We have 2 actions in our model, the response action and the createHeaders action.</p>
<p><strong>The createHeaders action</strong> creates the SOAP headers that we will pass to the SoftLayer API; this is the most complicated method in the model. Understanding how SOAP is formed and how to get the correct output from php is the key to access SoftLayer’s API. On line 77, you will see an array called Headers, this will store the headers that we are about to make so that we can easily pass them along to the API Client.</p>
<p>First we will need to create the initial headers to communicate with SoftLayer’s API. This is what they should look like:</p>

<div class="wp_syntax"><div class="code"><pre class="nolang" style="font-family:monospace;">&lt;authenticate xsi:type=&quot;slt:authenticate&quot; xmlns:slt=&quot;http://api.service.softlayer.com/soap/v3/SLTypes/&quot;&gt;
    &lt;username xsi:type=&quot;xsd:string&quot;&gt;MY_USERNAME&lt;/username&gt;
    &lt;apiKey xsi:type=&quot;xsd:string&quot;&gt;MY_API_ACCESS_KEY&lt;/apiKey&gt;
&lt;/authenticate&gt;
&lt;SoftLayer_API_METHODInitParameters xsi:type=&quot;v3:SoftLayer_API_METHODInitParameters&quot; &gt;
    &lt;id xsi:type=&quot;xsd:int&quot;&gt;INIT_PERAMETER&lt;/id&gt;
&lt;/SoftLayer_API_METHODInitParameters&gt;</pre></div></div>

<p>In order to build this we will need a few saved properties from our instantiated object: our api username, api key, the service, initialization parameters, and the SoftLayer API type namespace. The api username and key will need to be set by the controller, or you can add in yours to the model to use as a default. I will store mine in a separate file and include it in the controller, but on a production server you might want to store this info in a database and create a &#8220;user&#8221; model. </p>
<p>First, we instantiate SoapVar objects for each authentication node that we need. Then we store the SoapVar objects in an array and create a new SoapVar object for the &#8220;<code>authenticate</code>&#8221; node. The data for the &#8220;<code>authenticate</code>&#8221; node is the array, and the encoding is type <code>SOAP_ENC_OBJECT</code>. Understanding how to nest SoapVar objects is the key to creating well formed SOAP in PHP. Finally, we instantiate a new SoapHeader object and append that to the Headers array. The second header we create and add to the Headers array is for initialization parameters. These are needed to run certain methods within SoftLayer’s API; they essentially identify objects within your account. The final command in this method (<code>__setSoapHeaders</code>) is the magical PHP method that saves the headers into our SoapClient object. Now take a look at how I access the method; because I have stored the SoapClient object as a property of the current class I can use the arrow operator to access methods of that class through the <code>$_client</code> property of our class, or the <code>getClient()</code> method of our class which returns the client.</p>
<p><strong>The Response method</strong> is the action which actually contacts SoftLayer’s API and sends our SOAP request. Take a look at how I tell PHP that the string stored in our <code>$_method</code> property is actually a method of our $_client property by adding parenthesis to the end of the <code>$Method</code> variable on line 71.</li>
</ul>
</li>
</ul>
<p><strong>View</strong><br />
The view is what the user interprets, this is where we present our information and create a basic layout for the web page. Take a look at &#8220;The View&#8221; section on <a href="http://blog.softlayer.com/soap-api-code-examples/">SOAP API Code Examples</a>. Here I create a basic webpage layout, display output information from the controller, and create a form for sending requests to the controller. Notice that the View is a mixture of HTML and PHP, so make sure to name it view.php that way the server knows to process the php before sending it to the client. </p>
<p><strong>Controller</strong><br />
The controller separates user interaction from business logic. It accepts information from the user and formats it for the model. It also receives information from the model and sends it to the view. Take a look at &#8220;The Controller&#8221; section on <a href="http://blog.softlayer.com/soap-api-code-examples/">SOAP API Code Examples</a>. I accept variables posted from the view and store them in an array to send to the model on lines 6-11. I then instantiate the <code>$Call</code> object with the parameters specified in the <code>$Setup</code> array, and store the response from the Response method as <code>$Result</code> in line 17 for use by the view.</p>
<p><strong>Have Fun!</strong><br />
Although this tutorial seems to cover many different things, this just opens up the basic utilities of SoftLayer&#8217;s API. You should now have a working View to enter information and see what kind of data you will receive. The first service and method you should try is the <code>SoftLayer_Account</code> service and the <code>getObject</code> method. This will return your account information. Then try the <code>SoftLayer_Account</code> service and the <code>getHardware</code> method; it will return all of the information for all of your servers. Take the IDs from those servers and try out the <code>SoftLayer_Hardware_Server</code> service and the <code>getObject</code> method with that <code>id</code> as the <code>Init</code> property. </p>
<p>More examples to try: <a href="http://sldn.softlayer.com/wiki/index.php/SoftLayer_Account">SoftLayer Account</a>, <a href="http://sldn.softlayer.com/wiki/index.php/SoftLayer_Dns_Domain">SoftLayer DNS Domain</a>, <a href="http://sldn.softlayer.com/wiki/index.php/SoftLayer_Hardware_Server">SoftLayer Hardware Server</a>. Once you get the hang of it, try adding <a href="http://sldn.softlayer.com/article/Using-Object-Masks-SoftLayer-API">Object Masks</a> and <a href="http://sldn.softlayer.com/article/Using-Result-Limits-SoftLayer-API">Result Limits</a> to your model.</p>
<p>Have Fun!</p>
<p>-Kevin</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2011/softlayer-soap-api-application-development-101/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
