<?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>Zulius</title>
	<atom:link href="http://www.zulius.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zulius.com</link>
	<description>Advanced Application Development</description>
	<lastBuildDate>Tue, 07 Feb 2012 16:09:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Setup a Bitcoin mining rig powered by Linuxcoin &amp; Smartcoin</title>
		<link>http://www.zulius.com/how-to/setup-bitcoin-mining-rig-powered-by-linuxcoin-smartcoin/</link>
		<comments>http://www.zulius.com/how-to/setup-bitcoin-mining-rig-powered-by-linuxcoin-smartcoin/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 21:09:00 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=1054</guid>
		<description><![CDATA[This guide will cover how to build a dedicated/headless/automated GPU Bitcoin mining rig running the Linuxcoin operating system and Smartcoin miner management. Wait... is Bitcoin mining even worth it? In terms of profitability, it all depends on the how much you pay for electricity, the current mining difficulty, and the BTC exchange rate. There's some [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right;">
<div style="clear: both">
<div class="wp-caption alignright" style="width: 160px"><img src="/img/blog/btc-mining-rig/btc-icon.jpg" alt="Bitcoin: distributed crypto-currency" /><p class="wp-caption-text">Bitcoin: distributed crypto-currency</p></div>
</div>
<div style="clear: both"></div>
</div>
<p>This guide will cover how to build a dedicated/headless/automated GPU Bitcoin mining rig running the <a href="http://www.linuxcoin.co.uk/">Linuxcoin</a> operating system and <a href="https://en.bitcoin.it/wiki/SmartCoin">Smartcoin</a> miner management.</p>
<h2>Wait... is Bitcoin mining even worth it?</h2>
<p>In terms of profitability, it all depends on the how much you pay for electricity, the current mining <a href="https://en.bitcoin.it/wiki/Difficulty">difficulty</a>, and the BTC exchange rate.  There's some <a href="http://bitcoinx.com/profit/">calculators</a> on the web that can help you figure out your projected costs and BTC earnings.</p>
<p>Would spending over $1K on a rig be profitable in the long run? Probably not, unless you're getting very cheap electricity.  Also consider that the current payout for a solved block is 50 BTC.  Every 210,000 blocks, the BTC payout for a solved block is halved.  <a href="http://bitcoin.stackexchange.com/questions/2291/when-is-the-bitcoin-payout-for-solving-a-block-going-to-change" rel="nofollow">It's estimated</a> that the payout will be reduced to 25 BTC in December 2013, greatly reducing the incentive to mine Bitcoins.  But who knows? The exchange rate of BTC may be up to $50 USD by then.</p>
<p>Maybe you're not in it for profit, but instead to support Bitcoin.  The security of the Bitcoin network <a href="http://bitcoin.stackexchange.com/questions/910/how-does-the-mining-process-support-the-currency">relies completely on the collective computational power of miners</a>.  Bitcoin mining ensures that <a href="https://en.bitcoin.it/wiki/Blocks">new block creation</a> is not controlled by a single entity.</p>
<p><b>Disclaimer:</b><br/>I still consider myself a Bitcoin mining newbie, and there's a good chance that the info in this post could be improved.  This guide is simply documentation of how I got my rig up and running, so use it at your own risk.</p>
<h2>Selecting the hardware</h2>
<div style="float: right;">
<div style="clear: both">
<div class="wp-caption alignright" style="width: 210px"><a id="ss1" href="/img/blog/btc-mining-rig/mining-rig.jpg" rel="colorbox"><img alt="2x5970s" src="/img/blog/btc-mining-rig/mining-rig-tn.jpg" title="2x5970s" width="200" height="200"/></a><p class="wp-caption-text">2x5970s</p></div></p>
</div>
<div style="clear: both"></div>
</div>
<p>The goal is to choose hardware that:</p>
<ul>
<li>will maximize your hashrate.</li>
<li>will minimize your electricity usage.</li>
<li>will not break your bank account and eventually be profitable.</li>
<li>could either be resold or reused in some other scenario.</li>
</ul>
<p>Your hardware and component quality will be the primary determining factor of your rig's BTC mining performance.  Certain components (GPU, PSU, MOBO) are more important in this regard than others (HDD, RAM, CPU).  Here's an overview of the hardware I chose, and why:</p>
<table class="dt1">
<tr class="category">
<td>Component</td>
<td>What I Used</td>
<td>Why</td>
<td>Cost</td>
</tr>
<tr>
<td>GPU(s)</td>
<td><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16814105001" rel="nofollow">Two AMD Radeon HD 5970's</a></td>
<td>
Efficient power usage (~290W per card)<br />
650 - 700 Mhash/sec<br />
More afforadable high-end card
</td>
<td>$789</td>
<tr class="odd">
<td>PSU</td>
<td><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16817371043" rel="nofollow">Antec High Current Pro 1200W</a></td>
<td>High quality power supply<br />
More than enough wattage
</td>
<td>$255</td>
</tr>
<tr>
<td>MOBO</td>
<td><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813130290" rel="nofollow">MSI 870-G45 AMD</a></td>
<td>Supports AMD Sempron CPU<br />
2 PCI-express 2.0 slots<br />
Enough room for 2 big graphics cards
</td>
<td>$70</td>
</tr>
<tr class="odd">
<td>CPU</td>
<td><a href="http://www.outletpc.com/jm7362.html#axzz1WOOhoHD5" rel="nofollow">Sempron 140</a></td>
<td>Very power efficient<br />
Cheap</td>
<td>$40</td>
</tr>
<tr>
<td>
RAM
</td>
<td><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820148149" rel="nofollow">Crucial 2GB DDR3</a></td>
<td>Dependable<br />
Cheap
</td>
<td>$15</td>
</tr>
<tr class="odd">
<td>HDD</td>
<td><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820226079" rel="nofollow">Mushkin 16GB USB 2.0</a></td>
<td>High quality</td>
<td>$30</td>
</tr>
<tr>
<td>CASE</td>
<td><a href="http://www.google.com/products/catalog?hl=en&#038;cid=5538102268142621207&#038;os=sellers" rel="nofollow">Top Deck Tech Station, Open-Air</a></td>
<td>Cheap cooling<br />
Reusable</td>
<td>$80</td>
</tr>
<tr class="odd">
<td>misc</td>
<td><a href="http://www.google.com/search?q=box+fan&#038;tbm=shop&#038;hl=en&#038;aq=f" rel="nofollow">box fan</a></td>
<td>Cheap cooling</td>
<td>$20</td>
</tr>
<tr>
<td>misc</td>
<td><a href="http://www.google.com/products/catalog?hl=en&#038;q=kill+a+watt+p3&#038;cid=5525303247386121198&#038;os=sellers" rel="nofollow">Kill-A-Watt</a></td>
<td>Monitor elec. usage</td>
<td>$17</td>
</tr>
<tr>
<td></td>
<td></td>
<td><b>Total:</b></td>
<td><b>$1316</b></td>
</tr>
</table>
<p>Make sure your <b>MOBO</b> has enough room and slots for your graphics cards. If you get multiple graphics cards, there should be at least 1 inch of space between them so heat they generate can dissipate.  Keeping the graphics cards cool is primary: it will increase both their performance and life expectancy.</p>
<p>I'm not going to cover assembling the hardware as that will be relative to your rig.  Just make sure to put the rig in a place where it can breathe.  If you put it in a closet, leave the door open, and point the GPU fans so they blow out the door.</p>
<p><b>Safety first:</b> make sure the electrical circuit you plug your rig into can handle the load.  You want to keep your max draw under 60-80% of what the circuit can handle (most regular US household circuits/breakers are rated at 15 amps).  So if you've got other high wattage electronics running on the same circuit, add up all the amperage of each device (Watts / Volts = Amps).  Don't start a fire.</p>
<p><b>UPDATE:</b> I <a href="https://github.com/timbowhite/linuxcoin-setup">started a github repo</a> that has some of the example files that are created/modified in this guide.  I also wrote a few bash scripts that can automate many of the setup steps below.  Look for the <b>one-liner</b> commands in this guide: they can be used instead of some of the manual steps.</p>
<h2>Install Linuxcoin on the USB, with persistence</h2>
<p>Your USB device will be acting as the rig's hard drive and it's recommended be at least 4GB, but you could probably get away with 2GB.  It will be running <a href="http://www.linuxcoin.co.uk/wiki/index.php/Main_Page" rel="nofollow">Linuxcoin 02.b-final</a> with persistence so that written data survives across boots.  Linuxcoin comes with pretty much everything you need to get up and mining fast.</p>
<p>This guide uses a Windows 7 desktop to setup the USB.  Many of the following steps came from a combination sources listed at the bottom of this page.</p>
<div style="float:right; width: 250px; margin-top: 150px">
<div class="caption-spacer">
	<div class="wp-caption alignright" style="width: 160px"><a id="ss2" href="/img/blog/btc-mining-rig/format-usb.jpg" rel="Linuxcoin persistence"><img alt="Linuxcoin persistence" src="/img/blog/btc-mining-rig/format-usb-tn.jpg"  title="Linuxcoin persistence" /></a><p class="wp-caption-text"> </p></div>
</div>
<div class="caption-spacer">
	<div class="wp-caption alignright" style="width: 160px"><a id="ss3" href="/img/blog/btc-mining-rig/bootice1.jpg" rel="Linuxcoin persistence"><img alt="Linuxcoin persistence" src="/img/blog/btc-mining-rig/bootice1-tn.jpg"  title="Linuxcoin persistence" /></a><p class="wp-caption-text"> </p></div>
</div>
<div class="caption-spacer">
	<div class="wp-caption alignright" style="width: 160px"><a id="ss4" href="/img/blog/btc-mining-rig/bootice2.jpg" rel="Linuxcoin persistence"><img alt="Linuxcoin persistence" src="/img/blog/btc-mining-rig/bootice2-tn.jpg"  title="Linuxcoin persistence" /></a><p class="wp-caption-text"> </p></div>
</div>
<div class="caption-spacer">
	<div class="wp-caption alignright" style="width: 160px"><a id="ss5" href="/img/blog/btc-mining-rig/bootice3.jpg" rel="Linuxcoin persistence"><img alt="Linuxcoin persistence" src="/img/blog/btc-mining-rig/bootice3-tn.jpg"  title="Linuxcoin persistence" /></a><p class="wp-caption-text"> </p></div>
</div>
<div class="caption-spacer">
	<div class="wp-caption alignright" style="width: 160px"><a id="ss5b" href="/img/blog/btc-mining-rig/bootice4.jpg" rel="Linuxcoin persistence"><img alt="Linuxcoin persistence" src="/img/blog/btc-mining-rig/bootice4-tn.jpg"  title="Linuxcoin persistence" /></a><p class="wp-caption-text"> </p></div>
</div>
<div class="caption-spacer">
	<div class="wp-caption alignright" style="width: 160px"><a id="ss6" href="/img/blog/btc-mining-rig/unetbootin1.jpg" rel="Linuxcoin persistence"><img alt="Linuxcoin persistence" src="/img/blog/btc-mining-rig/unetbootin1-tn.jpg"  title="Linuxcoin persistence" /></a><p class="wp-caption-text"> </p></div>
</div>
<div class="caption-spacer">
	<div class="wp-caption alignright" style="width: 160px"><a id="ss7" href="/img/blog/btc-mining-rig/unetbootin-boot.jpg" rel="Linuxcoin persistence"><img alt="Linuxcoin persistence" src="/img/blog/btc-mining-rig/unetbootin-boot-tn.jpg"  title="Linuxcoin persistence" /></a><p class="wp-caption-text"> </p></div>
</div>
<div style="clear: both"></div>
</div>
<ol>
<li>Download the following stuff:
<ul>
<li><a href="http://www.linuxcoin.co.uk/index.php?page=downloads" rel="nofollow">LinuxCoin 0.2b-final ISO</a></li>
<li><a href="http://www.pendriveapps.com/bootice-partition-flash-drive-edit-boot-sector/" rel="nofollow">BOOTICE</a> - used to partition the USB drive</li>
<li><a href="http://unetbootin.sourceforge.net/" rel="nofollow">unetbootin</a> - used to install Linuxcoin</li>
</ul>
</li>
<li>Plug the USB stick into your desktop.  Right-click the drive, choose "Format...", and format it with the default FAT32 file system.</li>
<li>Run the downloaded bootice.exe. Select the USB device from the "Destination Disk" dropdown.</li>
<li>
<p>Click the "Parts Manage" button, then "ReFormat USB Disk".  Set: </p>
<ul>
<li>Disk Mode = <b>USB-HDD mode (Multi-Partitions)</b></li>
<li>Partition Alignment = <b>Align to cylinder</b></li>
</ul>
</li>
<li>
<p>Click <b>Next</b> and set:</p>
<ul>
<li>size field of Partition 1 = <b>1024 MB</b></li>
<li>File System for Partition 1 and Partition 4 = <b>FAT32</b></li>
</ul>
<p>Leave the remaining fields at their defaults.  Click <b>OK</b>.  You'll be prompted to confirm the reformat and partitions a couple of times, just click <b>Yes/OK</b> on each one.</p>
</li>
<li>
<p>When it's finished, close BOOTICE.  Run the downloaded unetbootin exe file. Set the following values:</p>
<ul>
<li>Diskimage option enabled</li>
<li>ISO option enabled and browse to and select the Linuxcoin ISO file</li>
<li>"Space used to preserve files..." = <b>1024 MB</b></li>
</ul>
</li>
<li>Click <b>OK</b> and wait awhile.  When it finishes, choose "No" when <b>UNetbootin</b> prompts to reboot.</li>
<li>Plug your USB stick, a mouse, a keyboard, network cable, and a monitor into the mining rig.  I connected my monitor into one of the 5970's DVI plugs.  Power the rig on.  You should see the Unetbootin splash screen - if not, make sure your BIOS allows for botting from a USB device.  Select "Linuxcoin Persistent".</li>
<li>
<p>Once Linuxcoin boots up, it should automatically display a desktop.  If you're seeing a login screen, enter username = <b>user</b> and the password = <b>live</b>.</p>
<p>Now we want to create a Linux file system on the USB's persistence partition so that data persists across boots.  Click the yellow &#x0243; button in the bottom left-hand corner, then goto <b>Accessories > Root Terminal</b>.</p>
<p><b>* one-liner:</b> The rest of the stuff for persistence (step #9) can be done automatically with this bash command:</p>
<pre class="brush: plain;">
# curl https://raw.github.com/timbowhite/linuxcoin-setup/master/setup/persistence.sh | bash
</pre>
<p>Or you can do it manually:</p>
<p>Run <b>df</b> to see your mounted file systems:</p>
<pre class="brush: plain;">
# df
</pre>
<p>Look for <b>/dev/sda2</b>, which will be mounted on at a temporary moutnpoint like <b>/media/AE90-5228</b> or something similar.  Unmount it and use mkfs to create the live-rw filesystem:</p>
<pre class="brush: plain;">
# umount /media/AE90-5228
# mkfs.ext4 /dev/sda2 -L live-rw
</pre>
<p>Edit <b>/live/image/syslinux.cfg</b>, and add a new boot entry so that Linuxcoin boots with persistence by default:</p>
<pre class="brush: plain;">
label unetbootindefault
menu label LinuxCoin
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live config quiet persistent rw vga=791 edd=off
</pre>
<p>The above entry should be placed as the first entry underneath the UNetbootin menu section:</p>
<pre class="brush: plain;">
default menu.c32
prompt 0
menu title UNetbootin
timeout 100
</pre>
<p>Example <b>/live/image/syslinux.cfg</b> <a href="https://github.com/timbowhite/linuxcoin-setup/blob/master/system_files/syslinux.cfg">available here</a>.</p>
<p>Reboot the machine.  The bootloader will now automatically boot Linuxcoin with persistence.</p>
</li>
</ol>
<h2>Make it headless</h2>
<p>The goal here is to be able to run the rig without it being attached to any I/O devices: monitor, mouse, keyboard, etc. You can then store the rig somewhere else and access it via SSH on your LAN.</p>
<p><b>* one-liner:</b> most of the following steps for "headless-ness" can be done automatically with this bash command:</p>
<pre class="brush: plain;">
# curl https://raw.github.com/timbowhite/linuxcoin-setup/master/setup/headless.sh | bash
</pre>
<p><b>*</b> You will still need to manually assign the correct network settings in your <b>/etc/rc.local</b>.  The above command assigns a default 192.168.0.150 static IP address, see step #2.  SSH should also be manually secured, see steps #5 and #6.</p>
<p>The manual steps:</p>
<ol>
<li>
<p>First, update all packages the system:</p>
<pre class="brush: plain;">
# apt-get update
</pre>
</li>
<li>
<p>Next, assign a static IP by putting the following lines in <b>/etc/rc.local</b>.  The example below sets the static IP to 192.168.0.150 with a gateway of 192.168.0.1.  Your network settings will different, make sure to change them appropiately:</p>
<pre class="brush: plain;">
sudo ifconfig eth0:0 address 192.168.0.150 up
sudo ifconfig eth0:0 broadcast 192.168.0.255
sudo ifconfig eth0:0 netmask 255.255.255.0
sudo route add default gw 192.168.0.1
</pre>
<p>Example <b>/etc/rc.local</b> <a href="https://github.com/timbowhite/linuxcoin-setup/blob/master/system_files/rc.local"> available here</a>.</p>
<p>Now run rc.local and restart the network interface:</p>
<pre class="brush: plain;">
# /etc/rc.local
# /etc/init.d/networking restart
</pre>
</li>
<li>
<p>The default user in Linuxcoin is simply the <b>user</b> user.  We'll setup <b>user</b> as a password-less sudoer to make automation and running the miners as root seamless:</p>
<pre class="brush: plain;">
# echo &quot;user ALL = NOPASSWD : ALL&quot; &gt;&gt; /etc/sudoers
</pre>
</li>
<li>
<p>Start SSH and enable the SSH daemon to start on boot:</p>
<pre class="brush: plain;">
# /etc/init.d/ssh start
# update-rc.d ssh enable
</pre>
<p>You should now be able to detach the monitor, keyboard, mouse, and throw the rig in a closet somewhere.  Make sure to connect it to your LAN.  The remainder of the setup will all be done via SSH.</p>
</li>
<li>
<p>Now SSH into the rig from your desktop.  The user password is the word <b>live</b>:</p>
<pre class="brush: plain;">
# ssh user@RIG.IP.ADDRESS.HERE
</pre>
</li>
<li>
<p><b>Warning:</b> this step is optional, but the current SSH configuration is very insecure.  It's recommended that you use SSH auth keys to secure SSH logins, or at the very least, change the <b>user</b>'s password.</p>
<p>For instance, you can configure SSH to disable root login and use SSH auth keys by editing <b>/etc/ssh/sshd_config:</b></p>
<pre class="brush: plain;">
PermitRootLogin no
PasswordAuthentication no
</pre>
<p>Add your public SSH key to the <b>user</b>'s authorized_keys files:</p>
<pre class="brush: plain;">
# mkdir -p /home/user/.ssh
# vi /home/user/.ssh/authorized_keys
[PASTE KEY ON A NEW LINE]
# sudo /etc/init.d/ssh restart
</pre>
<p>Open up a new SSH session from your desktop and ensure you're able to SSH into the rig using your auth key.</p>
</li>
</ol>
<h2>Initialize and overclock the GPU(s)</h2>
<p>We'll be using <b>aticonfig</b> to initialize and overclock the GPU(s) on your rig.  Overclocking the GPU cores is optional: the higher your core clock, the higher the hashrate, the more BTC you'll make.  But it's not necessarily recommended as it will increase the graphics card's running temperatures and <a href="https://bitcointalk.org/index.php?topic=48222.0" rel="nofollow">decrease their life expectancy</a>.</p>
<p>Underclocking the GPU(s) memory clocks is recommended as it lowers electricity usage and doesn't affect hashrates.</p>
<ol>
<li>
<p>First, "accept" the AMD license agreement by extracting the icd-registration.tgz (this could've also been done manually via the rig's GUI desktop menu):</p>
<pre class="brush: plain;">
$ sudo su -l
# cd /
# tar zxvf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz
</pre>
</li>
<li>
<p>su as <b>user</b>, and add the AMD app SDK library to the LD_LIBRARY_PATH system variable, export the display for all users, and reboot:</p>
<pre class="brush: plain;">
# su -l user
$ echo &quot;export LD_LIBRARY_PATH=\&quot;/opt/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/:\$LD_LIBRARY_PATH\&quot;&quot; &gt;&gt; ~/.bashrc
$ echo &quot;export DISPLAY=\&quot;:0\&quot;&quot; &gt;&gt; ~/.bashrc
$ echo &quot;xhost +&quot; &gt;&gt; ~/.bashrc
$ echo &quot;:0&quot; &gt; ~/.display
$ sudo shutdown -r now
</pre>
</li>
<li>
<p>When the rig comes back up, ensure that aticonfig has detected your GPU's.  Keep in mind that some cards (like the 5970) have two GPU's per card:</p>
<pre class="brush: plain;">
$ sudo aticonfig --adapter=all --odgt
</pre>
<p>You should see a line starting with "Adapter X" for each GPU, followed by some info about it and it's current temperature.</p>
</li>
<li>
<h3>Overclocking</h3>
<p>Overclocking can be a trial-and-error process: if you overclock your GPU cores too high, your cards will experience frequent hard lockups, and can only be revived by rebooting the rig.</p>
<p>If you decide to overclock your GPU cores, start out overclocking slightly above the stock core MHz value.  Gradually increase the core clock while monitoring your GPU temperatures.  If hard lockups start to occur, roll back the core MHz until the system is stable.</p>
<p>Enable overclocking by:</p>
<pre class="brush: plain;">
# sudo aticonfig --adapter=all --od-enable
</pre>
<p>Then set the clocks for each GPU.  In the example below there are 4 GPUs, and it's setting the core clock = <b>750MHz</b> and the memory clock = <b>300MHz</b> on each GPU.  The format of the <b>--od-setclocks</b> parameter is <b>core clock MHz,memory clock</b>.  Again, I recommend underclocking the memory MHz to the lowest configurable value to reduce electricity consumption:</p>
<pre class="brush: plain;">
# sudo aticonfig --adapter=0 --od-setclocks=750,300
# sudo aticonfig --adapter=1 --od-setclocks=750,300
# sudo aticonfig --adapter=2 --od-setclocks=750,300
# sudo aticonfig --adapter=3 --od-setclocks=750,300
</pre>
<p>Commit the clock settings so they'll persist across reboot:</p>
<pre class="brush: plain;">
# sudo aticonfig --odcc --adapter=all
</pre>
</li>
</ol>
<h2>Setup miners and automate Smartcoin</h2>
<ol>
<li>
<p>You may want to update the miners that came with Linuxcoin to their latest versions.  For example, I use the <a href="https://github.com/jedi95/Phoenix-Miner">Phoenix 1.7.3 miner</a>, and updated it by:</p>
<pre class="brush: plain;">
$ sudo su -l
# cd /opt/miners/
# mv phoenix phoenix-old
# wget https://github.com/jedi95/Phoenix-Miner/tarball/master -O phoenix.tar.gz
# tar zxvf phoenix.tar.gz &amp;&amp; rm phoenix.tar.gz
# mv jedi95-Phoenix-Miner-297945a phoenix
</pre>
</li>
<li>
<p>Before starting Smartcoin, let's get it updated to it's latest version and automated to start whenever the rig is booted.  This way you won't have to SSH into the box to start Smartcoin whenever you the machine on.</p>
<p>First, update to the latest version of smartcoin:</p>
<pre class="brush: plain;">
$ sudo su -l
# cd /opt/smartcoin
# svn update
</pre>
<p>Create a desktop autostart entry for <b>user</b>.  This is run everytime the rig boots and <b>user</b> is autologged in to an X session:</p>
<pre class="brush: plain;">
# su -l user
$ mkdir -p ~/.config/autostart
</pre>
<p>Paste in this text into a new file at <b>/home/user/.config/autostart/auto.desktop</b>:</p>
<pre class="brush: plain;">
[Desktop Entry]
Type=Application
Name=&quot;autostart-smartcoin&quot;
Exec=&quot;/home/user/autostart-smartcoin.sh&quot;
Terminal=true
</pre>
<p>Now create a Smartcoin autostart bash script that will start Smartcoin running under root at <b>/home/user/autostart-smartcoin.sh</b>:</p>
<pre class="brush: plain;">
sleep 10
xhost +
sudo smartcoin --silent
</pre>
<p>And make it executable:</p>
<pre class="brush: plain;">
$ chmod +x /home/user/autostart-smartcoin.sh
</pre>
<p>Smartcoin has the capability to run a custom-defined initialization bash script whenever it's started. We'll use this feature to ensure the GPU fans are always turned up to 80% when mining starts:</p>
<p>Edit <b>/opt/smartcoin/init.sh</b> and paste the following:</p>
<pre class="brush: plain;">
#!/bin/bash

DISPLAY=:0.0 aticonfig --pplib-cmd &quot;set fanspeed 0 80&quot;
</pre>
<p><b>NOTE:</b> If you've got more than one card, make sure to add a fanspeed command targetting each card.  You'll have to change the <b>DISPLAY</b> variable on each line to match the GPU # (ie. DISPLAY=:0.1, DISPLAY=:0.2, etc).  If your card has two GPU's in it (like the 5970's), then increment the DISPLAY variable by 2.  For instance, I have two 5970's, so my <b>init.sh</b> looks like this:</p>
<pre class="brush: plain;">
#!/bin/bash

DISPLAY=:0.0 aticonfig --pplib-cmd &quot;set fanspeed 0 80&quot;
DISPLAY=:0.2 aticonfig --pplib-cmd &quot;set fanspeed 0 80&quot;
</pre>
<p>You can optionally create a script at <b>/opt/smartcoin/lockup.sh</b> that gets executed whenever your GPU(s) lockup.  It's useful for automatically rebooting whenever a lockup occurs. For instance, a simple <b>lockup.sh</b> to reboot on lockup:</p>
<pre class="brush: plain;">
#!/bin/bash

sleep 5
/etc/init.d/gdm stop
shutdown -fr now
smartcoin --kill
</pre>
<p>You could also get fancy with it and send yourself an email notification that reports the GPU stats at the time of the lockup, example <a href="https://github.com/timbowhite/linuxcoin-setup/blob/master/smartcoin/lockup.sh">available here</a>.</p>
<p>Make sure the above scripts are all executable:</p>
<pre class="brush: plain;">
$ sudo chmod +x /opt/smartcoin/init.sh
# sudo chmod +x /opt/smartcoin/lockup.sh
</pre>
</li>
<li>
<p>Now we need to install Smartcoin for the root user:</p>
</li>
<pre class="brush: plain;">
$ sudo su -l
# /opt/smartcoin/smartcoin_install.sh
</pre>
<p>During the Smartcoin install process, you should probably enter the default "yes" answer to the prompts to autodetect your rig's GPU(s), miners and environment.  You might be prompted to choose the location of the Phoenix miner:</p>
<pre class="brush: plain;">
Found phoenix miner installed on local system
1) /live/cow/opt/miners/phoenix-old/phoenix.py
2) /live/cow/opt/miners/phoenix/phoenix.py
3) /opt/miners/phoenix-old/phoenix.py
4) /opt/miners/phoenix/phoenix.py
Select the phoenix installation from the list above
</pre>
<p>In which case you should choose "4", which is the path to the latest version of the Phoenix miner you previously downloaded.</p>
<p>I think the last prompt is how many daily mining minutes you'd like to donate to Smartcoin: your call, but donations help keep Smartcoin awesome and free.</p>
</li>
</ol>
<h2>Configuring Smartcoin</h2>
<ol>
<li>
<p>The following quick example will create a new Smartcoin profile that uses the <a href="http://deepbit.net" rel="nofollow">deepbit.net mining pool</a> and the <a href="https://github.com/jedi95/Phoenix-Miner" rel="nofollow">Phoenix miner</a>.</p>
<p>If you're not already in the Smartcoin interface, fire it up as root:</p>
<pre class="brush: plain;">
$ sudo smartcoin
</pre>
<p>You'll be presented with the Smartcoin main menu:</p>
<pre class="brush: plain;">
Smartcoin r657s 08:17:46
----------------------------------------
1) Reboot Computer
2) Kill smartcoin (exit)
3) Disconnect from smartcoin (leave running)
4) Edit Settings
5) Select Profile
6) Configure Miners
7) Configure Workers
8) Configure Profiles
9) Configure Devices
10) Configure Pools
11) Update Smartcoin
12) Set Failover Order
13) Configure Machines
14) Configure Macros
15) Execute Macro
</pre>
</li>
<li>First we'll configure the Phoenix miner.  Type "6" and hit enter to configure your miner, then type "e" and hit enter to edit existing miners.  Then enter "1" to edit the Phoenix miner:</p>
<pre class="brush: plain;">
Smartcoin r657s 10:05:10
----------------------------------------
SELECT MINER TO EDIT
1) localhost
Select the machine the miner resides on
1
1) phoenix
2) poclbm
Select the miner you wish to edit
1
</pre>
<p>From there, you should accept each pre-populated value.  The only value I would recommend updating is the "Enter the miner's launch string", which I change to use the <b>phatk2</b> kernel for increased performance:</p>
<pre class="brush: plain;">
python &lt;#path#&gt;/phoenix.py -v -u http://&lt;#user#&gt;:&lt;#pass#&gt;@&lt;#server#&gt;:&lt;#port#&gt;/ device=&lt;#device#&gt; worksize=128 vectors aggression=11 bfi_int fastloop=false -k phatk2
</pre>
<p>Enter "y" at the last prompt to set the Phoenix miner as the default miner:</p>
<pre class="brush: plain;">
Smartcoin r657s 10:06:01
----------------------------------------
EDITING MINER
------------
1) localhost
Please select the machine from the list above that is hosting this
 miner
1
Please give this miner a nickname
phoenix
Enter the miner's path (i.e. /home/you/miner/)
/opt/miners/phoenix/
Enter the miner's launch string
Note:use special strings &lt;#user#&gt;, &lt;#path#&gt;, &lt;#server#&gt;
&lt;#port#&gt;, and &lt;#device#&gt;
python &lt;#path#&gt;/phoenix.py -v -u http://&lt;#user#&gt;:&lt;#pass#&gt;@&lt;#server#&gt;:&lt;#port#&gt;/ device=&lt;#device#&gt; worksize=128 vectors aggression=11 bfi_int fastloop=false -k phatk2
Do you want this to be the the default miner for this machine?
y
</pre>
</li>
<li>
<p>Next, we need to setup the workers associated with your mining pool.  From the Smartcoin main menu, enter "7" to configure workers, and then enter "a" to add workers. Enter in the info for your worker, and enter "n" when prompted to add this worker to the automatic profile:</p>
<pre class="brush: plain;">
ADDING WORKER
-------------
1) DeepBit
2) Bitcoin.cz (slush)
3) BTCGuild
4) BTCMine
5) Bitcoins.lc
6) SwePool
7) Continuum
8) MineCo
9) Eligius
10) CoinMiner
11) ZABitcoin
12) BitClockers
13) MtRed
14) SimpleCoin
15) Ozco
16) EclipseMC
17) BitP
18) BitcoinPool
19) EcoCoin
20) BitLottoPool
21) X8S
22) Ars Technica
23) TripleMining
24) Mainframe
25) Bitcoin Monkey
26) Best Bitcoin
27) Eclipse MC
What pool listed above is this worker associated with?
1

Give this worker a nickname
deepbit1

Enter the username for this worker
foobar

Enter the password for this worker
123456

Would you like this worker to be available to the automatic profile? (y)es or (n)o?
n
</pre>
<p>Make sure to enter "n" when prompted to make the worker available to the automatic profile.</p>
</li>
<li>
<p>The last step is to configure a profile, which basically groups the previous settings and assigns a worker to each GPU.</p>
<p>From the Smartcoin main menu, enter "8" to configure profiles, and then "a" to add a new profile, and enter a name for the new profile:</p>
<pre class="brush: plain;">
Smartcoin r657s 10:41:54
----------------------------------------
Would you like to (A)dd, (E)dit or (D)elete profiles?
(X) to exit back to the main menu.
a
1) localhost
Select the machine you wish to add a profile on
1
Enter a name for this profile
deepbit
</pre>
<p>This part is a little tedious: you'll have to add a new instance to the profile for each of your GPU(s):</p>
<pre class="brush: plain;">
Smartcoin r657s 10:42:30
----------------------------------------
Profile: deepbit (adding miner instance #1)

1) phoenix
2) poclbm
Please select the miner from the list above to use with this instance
1

1) DeepBit.deepbit1
Please select the pool worker from the list above to use with this instance
1

1) GPU[0]
2) GPU[1]
3) GPU[2]
4) GPU[3]
Please select the device from the list above to use with this instance
1
</pre>
</li>
<li>Finally, you're ready to start mining! From the Smartcoin main menu, enter "5" to select your newly created profile:</p>
<pre class="brush: plain;">
Smartcoin r657s 10:46:58
----------------------------------------
1) localhost
Select the machine from the list above that you wish to change the profile on
1
1) Donation
2) Automatic
3) Failover
4) Idle
5) deepbit
Select the profile from the list above that you wish to switch to
5
</pre>
<p>Then hit <b>CTRL + a</b> and then <b>1</b> to view the mining status screen:</p>
<pre class="brush: plain;">
Smartcoin r657s 10:50:23
----------------------------------------
Host: localhost
GPU[0]: Temp: 45.00 load: 99%
GPU[1]: Temp: 45.50 load: 99%
GPU[2]: Temp: 52.00 load: 99%
GPU[3]: Temp: 54.00 load: 99%
CPU Load Avgs: 0.70 0.33 0.17

Profile: deepbit
--------DeepBit--------
GPU[0]: [340.05 MHash/sec] [6 Accepted] [0 Rejected] [0% Rejected]
GPU[2]: [329.10 MHash/sec] [6 Accepted] [0 Rejected] [0% Rejected]
GPU[1]: [340.41 MHash/sec] [3 Accepted] [0 Rejected] [0% Rejected]
GPU[3]: [329.29 MHash/sec] [3 Accepted] [0 Rejected] [0% Rejected]
Total : [1338.85 MHash/sec] [18 Accepted] [0 Rejected] [0% Rejected]

Grand Total : [1338.85 MHash/sec] [18 Accepted] [0 Rejected] [0% Rejected]
</pre>
<p>When you're done watching your stats, hit <b>CTRL + a</b> and then <b>d</b> to exit the Smartcoin interface.  Your miners will continue to run in the background! Type <b>smartcoin</b> with root privileges to re-enter the Smartcoin interface.</p>
</li>
</ol>
<p>Smartcoin uses the <a href="http://linux.die.net/man/1/screen" rel="nofollow">screen utility</a> to display it's user interface. A few quick shortcuts for navigating the interface for a single mining rig (see <a href="https://en.bitcoin.it/wiki/SmartCoin#How_To_Use" rel="nofollow">here</a> for more details):</p>
<ul>
<li><b>CTRL + a</b> then <b>0</b>: goto the Smartcoin main menu.</li>
<li><b>CTRL + a</b> then <b>1</b>: goto the mining status screen.</li>
<li><b>CTRL + a</b> then <b>2</b>: goto the miner log screen.</li>
<li><b>CTRL + a</b> then <b>d</b>: exit the Smartcoin interface.</li>
</ul>
<p>We've only setup one mining rig in this tutorial, but keep in mind that Smartcoin can manage multiple mining rigs if you decide to scale operations.  You may also choose to setup some failover profiles in the event that your primary mining pool is down.</p>
<h2>Tweaks</h2>
<p>The following is some optional system setup stuff.  I recommend it to get additional features and increased performance on your rig.  Legend:</p>
<ul>
<li>lines starting with 3 ###'s = <b>a comment</b></li>
<li>indented lines = <b>stuff that goes in a configuration file</b></li>
<li>all other lines = <b>command to run from the console</b></li>
</ul>
<pre class="brush: plain;">
### If you're in the US, you probably want to update the apt-get
### source.list. Replace:
### deb http://www.mirrorservice.org/sites/amd64.debian.net/debian/ sid main non-free contrib
### with
### deb http://ftp.us.debian.org/debian/ sid main non-free contrib
vi /etc/apt/sources.list
apt-get update

### the munin-node software isn't really used and
### had a bad habit of crushing my CPU at 100%,
### so disable it
sudo /etc/init.d/munin-node stop
sudo update-rc.d -f munin-node remove

### disable all munin crons, comment out their cron entries
sudo vi /etc/cron.d/munin
sudo vi /etc/cron.d/munin-node

### set date/timezone
sudo dpkg-reconfigure tzdata

### keep the system clock synchronized
sudo apt-get install ntp ntpdate
sudo update-rc.d -f ntp enable
sudo /etc/init.d/ntp start

# optional: disable tor
sudo update-rc.d -f tor disable
</pre>
<h2>Maintenance</h2>
<p>A few quick tips on rig upkeep:</p>
<ul>
<li>Try to keep your GPU core temps under 80&deg; C.  The highest temperature they can withstand without permanent damage is 89&deg; C.</li>
<li>Smartcoin stores it's settings in an <a href="http://www.sqlite.org/" rel="nofollow">SQLite</a> database in the <b>~/.smartcoin</b> directory.  In this case, you can backup your smartcoin settings by copying the <b>/root/.smartcoin</b> directory to another location.</li>
<li>Dust your rig every 2 weeks to improve performance and life expectancy.  Get some canned air, take the rig outside, and blow that shit out of there.  You'll be suprised how much dust can accumulate in a short period of time: more airflow = more dust.</li>
<li>If your graphics card is locking up a lot, or experiencing consistently high temperatures, replace the thermal paste on it's GPU(s).  Take the card off the rig, unscrew the back of it, and use a q-tip and 99% rubbing alchohol to clean off the old, crusty thermal paste from both the GPU(s) and heatsink.  Apply a new layer of thermal paste (I use Artic Silver 5) on the top of the GPU(s), and screw it back together.</p>
</ul>
<h3>Sources</h3>
<ul>
<li><a href="http://www.linuxcoin.co.uk/wiki/index.php/Headless_Linuxcoin">Headless Linuxcoin</a></li>
<li><a href="http://hacktolive.org/wiki/Persistence_files">Persistence Files</a></li>
<li><a href="https://bitcointalk.org/index.php?topic=7374.msg286940#msg286940">bitcointalk.org topic #7374</a></li>
</ul>
<p><script type="text/javascript">jQuery(document).ready(function(){
jQuery("#ss1").colorbox({title: '2x5970s'});
jQuery("#ss2").colorbox({title: ' '});
jQuery("#ss3").colorbox({title: 'BOOTICE'});
jQuery("#ss4").colorbox({title: 'BOOTICE'});
jQuery("#ss5").colorbox({title: 'BOOTICE'});
jQuery("#ss5b").colorbox({title: 'BOOTICE'});
jQuery("#ss6").colorbox({title: 'UNetbootin'});
jQuery("#ss7").colorbox({title: 'UNetbootin'});
});
</script></p>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=1054&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/setup-bitcoin-mining-rig-powered-by-linuxcoin-smartcoin/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Make a favicon .ico file in Photoshop CS4</title>
		<link>http://www.zulius.com/how-to/make-a-favicon-ico-file-in-photoshop-cs4/</link>
		<comments>http://www.zulius.com/how-to/make-a-favicon-ico-file-in-photoshop-cs4/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 17:03:24 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=1037</guid>
		<description><![CDATA[This is a quick guide on making a favicon in Photoshop CS4. A favicon is a 16x16px website-specific icon that was originally used to identify websites in a browser's site bookmark list. In most browsers today, it is displayed left adjacent to the url bar when visiting a site. First, you need to install a [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 160px"><img alt="" src="/img/blog/faviconPhotoshopCS4.jpg" title="favicon thingy" width="150" height="110" /><p class="wp-caption-text">favicon thingy</p></div>
<p>This is a quick guide on making a favicon in Photoshop CS4.  A favicon is a 16x16px website-specific icon that was originally used to identify websites in a browser's site bookmark list. In most browsers today, it is displayed left adjacent to the url bar when visiting a site.</p>
<p>First, you need to install a plugin that enables Photoshop to save files in the .ico format.  It's provided for free by <a href="http://www.telegraphics.com.au" rel="nofollow">Telegraphics</a>, and can be downloaded <a href="http://www.telegraphics.com.au/sw/icoformat.en.html" rel="nofollow">here</a>.  Select the version that's specific to your OS and/or Photoshop version.</p>
<p>The plugin should be unzipped and saved to the "Adobe Photoshop CS4\Plug-ins\File Formats" directory.  On Windows, the default location of this directory is:</p>
<pre class="brush: plain;">
C:\Program Files\Adobe\Adobe Photoshop CS4\Plug-ins\File Formats
</pre>
<p>Next, fire up photoshop and start designing the icon.  It's best to start with a 64x64px or similar sized canvas, so that the icon can be proportionately scaled down to 16x16px.</p>
<p>You must also have the following enabled in order to save in .ico format:</p>
<p><b>Image > Mode > 8 Bits/Channel</b><br />
<b>Image > Mode > Indexed Color...</b></p>
<p>When you've finished the design, scale the image size down to 16x16px:</p>
<p><b>Image > Image Size...</b></p>
<ul>
<li>Width: 16px</li>
<li>Height: 16px</li>
<li>Constrain Proportions: checked</li>
<li>Resample Image: Bicubic Sharper (best for reduction)</li>
</ul>
<p>Then save as an .ico file:<br />
<b>File > Save As...</b></p>
<ul>
<li>Format: ICO (Windows Icon) (*.ICO)</li>
</ul>
<p>If you want to setup the favicon for your website, save the .ico file to the document root, and add the following to your <head></head> tags.</p>
<pre class="brush: xml;">
&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/ico&quot; href=&quot;/favicon.ico&quot;&gt;
</pre>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=1037&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/make-a-favicon-ico-file-in-photoshop-cs4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a static IP to a Debian/Ubuntu box</title>
		<link>http://www.zulius.com/how-to/add-a-static-ip-to-a-debianubuntu-box/</link>
		<comments>http://www.zulius.com/how-to/add-a-static-ip-to-a-debianubuntu-box/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 16:00:33 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=1023</guid>
		<description><![CDATA[This tutorial describes how to permanently add any number of static IP addresses to a network interface from the console. Login as root and open /etc/network/interfaces in your favorite editor. By default, it should look something like this: # The loopback network interface auto lo iface lo inet loopback Let's assume your network interface is [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 160px"><img alt="" src="/img/blog/addStaticIpDebian.jpg" title="interfaces" width="150" height="110" /><p class="wp-caption-text">interfaces</p></div>
<p>This tutorial describes how to permanently add any number of static IP addresses to a network interface from the console.</p>
<p>Login as root and open /etc/network/interfaces in your favorite editor.  By default, it should look something like this:</p>
<pre class="brush: plain;">
# The loopback network interface
auto lo
iface lo inet loopback
</pre>
<p>Let's assume your network interface is eth0.  To assign it a static IP address, add the following lines to /etc/network/interfaces:</p>
<pre class="brush: plain;">
auto eth0
iface eth0 inet static
        address 192.168.0.41
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
</pre>
<p>You should of course replace the values for address, netmask, gateway, and broadcast with values specific to your desired IP address and network.</p>
<p>Additional static IP's can be added by repeating the above code in the interfaces file.  Just increment the interfaces using "eth0:1", "eth0:2", etc, for each IP address.  Example:</p>
<pre class="brush: plain;">
# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.0.41
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

auto eth0:1
iface eth0:1 inet static
        address 192.168.0.56
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

auto eth0:2
iface eth0:2 inet static
        address 192.168.0.89
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
</pre>
<p>If you're not using DHCP at all, you may need to add/edit your DNS servers.  Open up /etc/resolv.conf and make sure the IP's of your DNS servers are in there. For example:</p>
<pre class="brush: plain;">
nameserver 192.168.0.1
nameserver 192.168.0.2
</pre>
<p>Finally, restart the network interfaces.</p>
<pre class="brush: plain;">
/etc/init.d/networking restart
</pre>
<p>If you're SSH'd into the box, don't log out yet.  Log into the box with a new SSH session to verify the network interface came back up.  Once verified, try pinging the new IP from a different box.</p>
<pre class="brush: plain;">
# ping 192.168.0.41
PING 192.168.0.41 (192.168.0.41) 56(84) bytes of data.
64 bytes from 192.168.0.41: icmp_seq=1 ttl=64 time=0.051 ms
64 bytes from 192.168.0.41: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 192.168.0.41: icmp_seq=3 ttl=64 time=0.068 ms
</pre>
<p><b>Optional: remove dhcp client</b><br />
It may be necessary to remove the dhcp client in order to keep your IP address static.  It seems that by default, dhcp3-client is setup to automatically renew it's lease 1 per day.  You can remove dhcp3-client like this:</p>
<pre class="brush: plain;">
apt-get remove dhcp3-client
</pre>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=1023&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/add-a-static-ip-to-a-debianubuntu-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a static IP to a Redhat/Fedora/CentOS box</title>
		<link>http://www.zulius.com/how-to/add-static-ip-address-to-redhat-fedora-centos-box/</link>
		<comments>http://www.zulius.com/how-to/add-static-ip-address-to-redhat-fedora-centos-box/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 18:12:32 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=947</guid>
		<description><![CDATA[Need to permanently assign a static IP address to a Linux box? This tutorial describes how to add any number of IP addresses to a network interface from the console. Login as root and change directory to /etc/sysconfig/network-scripts and list the configurations of your network interface. In this example, we're assuming the network interface is [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 160px"><img alt="iPhone on T-Mobile" src="/img/blog/addStaticIpLinux.jpg" title="ifcfg-eth0" width="150" height="110" /><p class="wp-caption-text">ifcfg-eth0</p></div>
<p>Need to permanently  assign a static IP address to a Linux box?  This tutorial describes how to add any number of IP addresses to a network interface from the console.</p>
<p>Login as root and change directory to <strong>/etc/sysconfig/network-scripts</strong> and list the configurations of your network interface. In this example, we're assuming the network interface is eth0.</p>
<pre class="brush: plain;">
# cd /etc/sysconfig/network-scripts
# ls -l ifcfg-eth0*
-rw-r--r-- 1 root root 38 Dec  8  2009 ifcfg-eth0
</pre>
<p>Take note of the files listed.  In the above example, eth0 only has one config file, but there could be many.</p>
<pre class="brush: plain;">
# cd /etc/sysconfig/network-scripts
# ls -l ifcfg-eth0*
-rw-r--r-- 5 root root 235 Sep 29  2009 ifcfg-eth0
-rw-r--r-- 1 root root 237 Sep 29  2009 ifcfg-eth0:1
-rw-r--r-- 1 root root 237 Sep 29  2009 ifcfg-eth0:2
-rw-r--r-- 1 root root 237 Sep 29  2009 ifcfg-eth0:3
</pre>
<p>Make a copy of the <strong>ifcfg-eth0</strong> file and name the new file <strong>ifcfg-eth0:X</strong> where <strong>X</strong> is the next increment of the file names.  For example, if there was only a single <strong>ifcfg-eth0</strong> file, the new file should be named <strong>ifcfg-eth0:1</strong>.  If the last config file was <strong>ifcfg-eth0:3</strong>, name the new file <strong>ifcfg-eth0:4</strong>.</p>
<pre class="brush: plain;">
cp ifcfg-eth0 ifcfg-eth0:1
</pre>
<p>Edit the new file and change/add the settings below.  The DEVICE, NETMASK, IPADDR, GATEWAY settings must be set to your specific values.  For example:</p>
<pre class="brush: plain;">
# DEVICE should be the network interface name and increment
DEVICE=eth0:1
IPADDR=192.168.0.102
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
BOOTPROTO=none
</pre>
<p>Repeat these steps for each IP address you need to add.  For each static IP address, create a new network interface config file named with the ":X" increment, and similarly set the DEVICE directive.</p>
<p>If you're not using DHCP at all, you may need to add/edit your DNS servers.  Open up /etc/resolv.conf and make sure the IP's of your DNS servers are in there. For example:</p>
<pre class="brush: plain;">
nameserver 192.168.0.1
nameserver 192.168.0.2
</pre>
<p>Finally, restart the network interfaces.</p>
<pre class="brush: plain;">
/etc/init.d/network restart
</pre>
<p>If you're SSH'd into the box, don't log out yet.  Log into the box with a new SSH session to verify the network interface came back up.  Once verified, try pinging the new IP from a different box.</p>
<pre class="brush: plain;">
# ping 192.168.0.102
PING 192.168.0.102 (192.168.0.102) 56(84) bytes of data.
64 bytes from 192.168.0.102: icmp_seq=1 ttl=64 time=0.051 ms
64 bytes from 192.168.0.102: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 192.168.0.102: icmp_seq=3 ttl=64 time=0.068 ms
</pre>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=947&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/add-static-ip-address-to-redhat-fedora-centos-box/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change your iPhone carrier to T-Mobile</title>
		<link>http://www.zulius.com/how-to/change-iphone-carrier-to-t-mobile/</link>
		<comments>http://www.zulius.com/how-to/change-iphone-carrier-to-t-mobile/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 21:40:09 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[AT&T]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[jailbreak]]></category>
		<category><![CDATA[T-Mobile]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=878</guid>
		<description><![CDATA[Please note: a reliable jailbreak for the iPhone 4 is not yet available, so this article currently applies only to the iPhone 3G/3GS. A lot of folks out there are frustrated with AT&#038;T's iPhone service. Its got a reputation for sucking. Recently detailed in Wired magazine, Apple has seriously considering ending its exclusive contract with [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 160px"><img alt="iPhone on T-Mobile" src="/img/blog/iphone-tmobile/titleImage.jpg" title="yum fun" width="150" height="110" /><p class="wp-caption-text">iPhone on T-Mobile</p></div>
<p><em style="font-style: italic"><strong><em>Please note:</em></strong><br />
<strike>a reliable jailbreak for the iPhone 4 is not yet available,</strike> so this article currently applies only to the iPhone 3G/3GS.</em></p>
<p>A lot of folks out there are frustrated with AT&#038;T's iPhone service.  Its got a <a href="http://search.twitter.com/search?q=attfail">reputation for sucking</a>.  Recently <a href="http://www.wired.com/magazine/2010/07/ff_att_fail/">detailed in Wired magazine</a>, Apple has seriously considering ending its exclusive contract with the telecommunications giant.  Apparently, AT&#038;T's network hasn't been able to handle the new load of iPhone users, and upgrades to it's network aren't happening fast enough.</p>
<p>As an iPhone user, I never really experienced any problems with AT&#038;T's service - until I moved to my new home.  For some reason, my iPhone's reception dropped from 5 bars to none whenever I was inside or within 10 feet of my house. Other cell phones got great reception there - I can only presume that something nearby was causing interference on AT&#038;T's operating frequencies.</p>
<p>After the 1000th dropped call and another $85 bill, it was time to dump AT&#038;T.</p>
<h2>Comparing AT&#038;T to T-Mobile</h2>
<p>The iPhone only works with the <a href="http://en.wikipedia.org/wiki/GSM">GSM network</a>.  AFAIK, T-Mobile is the only other <a href="http://www.gsmworld.com/roaming/index.html">major carrier in the United States with a GSM network</a> and hence was the 1st choice for an alternative carrier.  Plus, my friend's T-Mobile phone worked great in my home.</p>
<p>Here's how my original AT&#038;T plan from July 2009 (<a href="http://www.att.com/gen/general?pid=10950">Nation 450 Rollover &#038; 5000 Night/Weekend</a>) stacked up against T-Mobile's most similar plan (<a href="http://www.t-mobile.com/shop/plans/cell-phone-plans-detail.aspx?tp=tb1&#038;rateplan=Even-More-Plus-500-Talk-Text-Web">Individual Even More Plus 500 Talk + Text + Web</a>).</p>
<table class="dt1">
<tr class="category">
<td>AT&#038;T's Nation 450 Rollover </td>
<td>T-Mobile Individual Even More Plus 500</td>
</tr>
<tr>
<td>~ $85/month (after all fees) </td>
<td style="color: #ff6100">~ $65/month (after all fees) </td>
</tr>
<tr class="odd">
<td>$36 activation fee</td>
<td style="color: #ff6100">$35 activation fee</td>
</tr>
<tr>
<td>450 minutes/month</td>
<td style="color: #ff6100">500 minutes/month</td>
</tr>
<tr class="odd">
<td>5000 Night/Weekend minutes/month</td>
<td style="color: #ff6100">Unlimited Night/Weekend minutes/month</td>
</tr>
<tr>
<td style="color: #ff6100">minutes rollover</td>
<td>minutes don't rollover</td>
</tr>
<tr class="odd">
<td>200 texts/month</td>
<td style="color: #ff6100">unlimited texts/month</td>
</tr>
<tr>
<td>2 year contract with $175 Early Termination Free</td>
<td style="color: #ff6100">No contract, month to month</td>
</tr>
<tr class="odd">
<td>Unlimited data</td>
<td>Unlimited data</td>
</tr>
<tr>
<td style="color: #ff6100">Relatively fast 3G network</td>
<td>3G network not available for iPhone, slower Edge network only</td>
</tr>
<tr class="odd">
<td style="color: #ff6100">Visual voicemail</td>
<td>No visual voicemail</td>
</tr>
<tr>
<td>Shitty reception in my new home</td>
<td style="color: #ff6100">Excellent reception in my new home</td>
</tr>
<tr class="odd">
<td>Feeling forced into a contract just for an iPhone</td>
<td style="color: #ff6100">Feeling like an iPhone ninja that does whatever he/she wants</td>
</tr>
</table>
<p style="margin-top: 20px">T-Mobile was the clear winner - but its worth reiterating it's major drawbacks:</p>
<ul>
<li>No 3G, slower Edge data network only</li>
<li>No visual voicemail</li>
</ul>
<h2>Wait... I don't have an iPhone yet.  How should I get one?</h2>
<p>No problem.  If you're looking to get an iPhone without the AT&#038;T plan, there are a few different things you can do.</p>
<ul>
<li><strong>Newegg.com:</strong>
<ul>
<li>
<a href="http://www.anrdoezrs.net/rq114shqnhp49588BEC46599B5CB?url=http%3A%2F%2Fwww.newegg.com%2FProduct%2FProduct.aspx%3FItem%3DN82E16875100011%26cm_re%3Diphone-_-75-100-011-_-Product" target="_top" onmouseover="window.status='http://www.newegg.com';return true;" onmouseout="window.status=' ';return true;">new unlocked iPhone 3GS 16GB</a><img src="http://www.ftjcfx.com/nc117m-3sywHMILLORPHJIMMOIPO" width="1" height="1" border="0"/>: $769
</li>
</ul>
</li>
<li><strong>New/used on Ebay:</strong>  Depending on the model:
<ul>
<li><a href="http://shop.ebay.com/i.html?_nkw=unlocked+iphone+3G&#038;_sacat=0&#038;_dmpt=Cell_Phones&#038;_odkw=unlocked+iphone&#038;_osacat=0&#038;_trksid=p3286.c0.m270.l1313">used unlocked iPhone 3G</a> goes for about $200
</li>
<li>
<a href="http://shop.ebay.com/i.html?_nkw=unlocked+iphone+3G&#038;_sacat=0&#038;_dmpt=Cell_Phones&#038;_odkw=unlocked+iphone&#038;_osacat=0&#038;_trksid=p3286.c0.m270.l1313">a used unlocked iPhone 3GS</a> goes for about $500
</li>
<li><a href="http://shop.ebay.com/i.html?_nkw=unlocked+iphone+4&#038;_sacat=0&#038;_dmpt=Cell_Phones&#038;_odkw=unlocked+iphone+3GS&#038;_osacat=0&#038;_trksid=p3286.c0.m270.l1313">a used iPhone 4</a> goes for about $800
</li>
</ul>
</li>
<li><strong>Signup for AT&#038;T and cancel after 30 days:</strong> According to <a href="http://www.wireless.att.com/cell-phone-service/legal/return-policy.jsp">AT&#038;T's latest return policy</a>, you can cancel the service after 30 days and you can keep the phone.  This comes at the cost of $325 (minus $10 for each additional month you have service).  So a few examples of the total cost:
<ul>
<li><strong>iPhone 3G 16GB (refurb):</strong> $99 phone + $60 for 1 month of cheapest service + $36 activation fee + $325 termination fee = <strong>$520</strong></li>
<li><strong>iPhone 3GS 16GB: </strong>$149 phone + $60 for 1 month of cheapest service + $36 activation fee + $325 termination fee = <strong>$570</strong></li>
<li><strong>iPhone 4 16GB:</strong> $199 phone + $60 for 1 month of cheapest service + $36 activation fee + $325 termination fee = <strong>$620</strong></li>
</ul>
</li>
<li><strong>Signup for AT&#038;T and cancel immediately:</strong> You can avoid the $325 "Early Termination Fee" by canceling service within 30 days of the activation date.  In this case, AT&#038;T expects you to return the phone - but since you're not going to do that, they'll charge you for it's retail price.  Oddly enough, Apple could only tell me the retail prices of the following models:
<ul>
<li><strong>iPhone 3GS 8GB:</strong> $499 phone + $36 activation fee = <strong>$535 *</strong></li>
<li><strong>iPhone 4 16GB:</strong> $599 phone + $36 activation fee = <strong>$635 *</strong></li>
</ul>
</li>
</ul>
<p><strong>*Note:</strong> this does not include the pro-rated amount of your plan for X number of days before you cancel.</p>
<h2>Uh... is this legal?</h2>
<p>Yes.  Your contract with AT&#038;T was not signed in blood (I hope). Neither Apple nor AT&#038;T can sue you for using a phone, that you've paid for, on a different network.  And although you'll have to jailbreak and unlock your iPhone, jailbreaking is not against the law.  The Library of Congress recently determined that jailbreaking mobile devices is <a href="http://arstechnica.com/tech-policy/news/2010/07/apple-loses-big-in-drm-ruling-jailbreaks-are-fair-use.ars">exempt from the Digital Millennium Copyright Act</a>, and hence is legal.</p>
<p><strong>Disclaimer:</strong> I'm not a lawyer, so if you're still concerned, go talk to one.</p>
<p>OK enough yapping - let's do this thing.</p>
<h2>Step 1 - Jailbreak and Unlock</h2>
<p>Jailbreaking allows you to install 3rd party applications and modify your iPhone's software.  Unlocking allows you to use your iPhone with carriers other than AT&#038;T.  It's necessary to jailbreak your iPhone first, and then unlock it.</p>
<p>There are currently a lot of ways to do this, and they all depend on your phone's OS and baseband version.  For example, I used <a href="http://redsn0w.com/">redsn0w</a> to jailbreak and <a href="http://blog.iphone-dev.org/post/128573459/ultras-now">ultrasn0w</a> to unlock my iPhone 3G on OS 3.1.2 on baseband 05.11.07.</p>
<p>The easiest way to figure out what to do is to use iClarified.com's online wizards:</p>
<ul>
<li><strong>Jailbreak: </strong><a href="http://www.iclarified.com/jailbreak">http://www.iclarified.com/jailbreak</a></li>
<li><strong>Unlock: </strong><a href="http://www.iclarified.com/unlock">http://www.iClarified.com/unlock</a></li>
</ul>
<p>If your device/OS is not listed in iClarified, visit <a href="http://www.jailbreakmatrix.com/">www.jailbreakmatrix.com</a> for the best software to jailbreak your phone with.</p>
<p>Most jailbreak software requires you to have the device's .ipsw firmware file.  You can download any device firmware from <a href="http://www.felixbruns.de/iPod/firmware/">http://www.felixbruns.de/iPod/firmware/</a>.</p>
<p>Not to worry - your iPhone will still work with AT&#038;T's service after you jailbreak and unlock.</p>
<p><!--</p>
<p>Once you've jailbroken, unlocking is easy.  If the above tutorials didn't mention it, first, disable 3G service before unlocking by going to <strong>Settings > General > Network > Enable 3G</strong>. You'll be able to re-enable it after the unlock if you want to continue to use AT&#038;T 3G service.  Then open <strong>Cydia app > Search > enter "ultrasn0w" > Install > Reboot (when prompted)</strong>.  Done.</p>
<p>--></p>
<h2>Step 2 - Signup with T-Mobile</h2>
<p>Head over to <a href="http://www.t-mobile.com/shop/plans/Cell-Phone-Plans-Overview.aspx?WT.z_unav=mst_shop_plans">t-mobile.com</a> and choose a plan.  When prompted to purchase a phone, scroll through their models until you find the SIM card - it should be free.</p>
<p>I was unable to complete my purchase online, their web page blew up on the very last step.  So I called them up and finished the order with a live rep.  The rep had no problems when I mentioned I would be using an unlocked iPhone.  The whole process took about 45 minutes due to the rep's "slow system".</p>
<h2>Step 3 - Swap the SIM card</h2>
<p><script type="text/javascript">jQuery(document).ready(function(){
jQuery("#ss0").colorbox({title: ''});
jQuery("#ss1").colorbox({title: ''});
jQuery("#ss2").colorbox({title: ''});
});
</script></p>
<div style="margin-top: 10px">
<div style="float: left;width: 330px">
The SIM card will take about a week and a half to arrive unless you ordered expedited shipping.  When you get it, do this:</p>
<ol style="margin-top: 10px">
<li>Power off the iPhone.  Grab a paper clip, stick it in the hole in the top of the iPhone, and pop out the AT&#038;T SIM card.</li>
<li>Carefully push the T-Mobile SIM card out of it's "credit card" sized holder.  Try not to touch/damage the side with the "grid" contacts on it.  Place it in the little plastic iPhone SIM tray.</li>
<li><strong>Bonus points:</strong> if you want to boost your reception a little, <a href="http://reviews.cnet.com/8301-19512_7-10115365-233.html">attach "a small piece of scotch tape to the outer side of the iPhone's SIM card (the side that does not have metal contacts)"</a>.  This apparently adds to the pressure of the SIM card's contact enough to increase the phone's reception.
</li>
<li>Slide the SIM card and tray back into the iPhone and power it up.</li>
</ul>
</div>
<div style="float: right; width: 250px;">
<div style="clear: both">
			<div class="wp-caption alignright" style="width: 235px"><a id="ss0" href="/img/blog/iphone-tmobile/sim-0-large.jpg" rel="sim"><img alt="sim" src="/img/blog/iphone-tmobile/sim-0-small.jpg"  title="sim" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss1" href="/img/blog/iphone-tmobile/sim-1-large.jpg" rel="sim"><img alt="sim" src="/img/blog/iphone-tmobile/sim-1-small.jpg"  title="sim" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss2" href="/img/blog/iphone-tmobile/sim-2-large.jpg" rel="sim"><img alt="sim" src="/img/blog/iphone-tmobile/sim-2-small.jpg"  title="sim" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div style="clear: both"></div>
</p></div>
<div style="clear: both"></div>
</div>
<p>With any luck, you should see "T-Mobile" displayed as the carrier in the upper-left corner of your phone.  Try a few test calls, text messages, etc.  You can view your new phone number by dialing #686#.</p>
<h2>Step 4 - Transfer your old number</h2>
<p>Call up T-Mobile customer service and tell them you're a new customer and you want to transfer your old AT&#038;T number to your phone.  When I called, I was transferred twice, and the last rep (who barely spoke english) set up the transfer.  The call took about 15 minutes.  Within 2 minutes of hanging up, I received 2 text messages from "907" stating:</p>
<p>"Welcome to T-Mobile! To change your plan, pay your bill, or check your minutes go to my.t-mobile.com.  Your mobile number is XXXXXXXXXX."</p>
<h2>Step 5 - Verify Edge network</h2>
<p>You may want to test the Edge data network connectivity and compare to the previous AT&#038;T 3G service.  Disable any wifi connection, open the Safari browser app, and try to browse.  In my scenario, every time I tried to browse I was redirected to a T-Mobile branded web page (http://10.176.76.164/resources/webpages/error.jsp) that stated:</p>
<p>"Error Unknown</p>
<p>Your homepage is temporarily unavailable.  Please try later."</p>
<p>I called T-Mobile again, and they noted that even though I had the unlimited data plan, they hadn't enabled a "Smart Phone Web" option on my account.  The tech specified it may take 2 hours to be activated.  About 1.5 hours later the Edge connection was working and I was able to browse freely.</p>
<h2>Step 6 - Configure MMS (picture messaging)</h2>
<p><script type="text/javascript">jQuery(document).ready(function(){
jQuery("#ss3").colorbox({title: ''});
jQuery("#ss4").colorbox({title: ''});
});
</script></p>
<div style="margin-top: 10px">
<div style="float: left;width: 350px">
<p>If you'd like to send/receive picture messages, it's necessary to manually configure your iPhone's MMS settings.</p>
<p>On your iPhone, goto <b>Settings > General > Network > Cellular Data Network</b>.  Enter the following <a href="http://support.t-mobile.com/doc/tm21387.xml?docid=212&#038;navtypeid=1&#038;pagetypeid=7&#038;prevPageIndex=2&#038;lid=y">T-Mobile MMS settings</a> into the MMS section.</p>
<ul>
<li><b>APN</b>: epc.tmobile.com</li>
<li><b>MMSC</b>: mms.msg.eng.t-mobile.com/mms/wapenc</li>
</ul>
<p>Restart your iPhone and try sending a new message.  There should now be a small camera icon next to the text input box that allows you to attach pictures.</p>
<p><strike><b>Please note that MMS messaging seems to fail if you're connected to the internet via wifi - so disable any active wifi connections before sending a message</b>.</strike></p>
<p>If sending the text message still fails, check out <a href="http://forums.t-mobile.com/t5/Non-T-Mobile-Phones/iPhone-Questions-Answered/td-p/117596/page/25">the lengthy MMS discussion on the T-Mobile forum</a>.</p>
</p></div>
<div style="float: right; width: 225px;">
<div style="clear: both">
			<div class="wp-caption alignright" style="width: 210px"><a id="ss3" href="/img/blog/iphone-tmobile/mms-settings.png" rel="mms"><img alt="mms" src="/img/blog/iphone-tmobile/mms-settings-small.png"  title="mms" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 210px"><a id="ss4" href="/img/blog/iphone-tmobile/mms-message.png" rel="mms"><img alt="mms" src="/img/blog/iphone-tmobile/mms-message-small.png"  title="mms" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div style="clear: both"></div>
</p></div>
<div style="clear: both"></div>
</div>
<h2>Step 7 - Cancel AT&#038;T service</h2>
<p>Once you've verified everything's working, drop that AT&#038;T plan like it's hot.  You'll have to call them up to do so, and of course, the rep will try to talk you into keeping your AT&#038;T account.  Be assertive and continue to repeat that you just want to cancel your account.  Don't provide any reasons if you don't want to.  If you're getting pegged with an "Early Termination Fee", it will show up on your final bill.  I had signed up a year ago when the fee was only $175, so my termination fee was $115 = ($175 - (12 months x $5)).</p>
<h2>Optional final step - Visual Voicemail</h2>
<p>T-Mobile's visual voicemail doesn't yet work with the iPhone.  You'll still get notifications and Phone app's "Voicemail" button will dial to your T-Mobile voicemail.</p>
<p>If you really want visual voicemail, as well as a bunch of other voicemail features, try out the <a href="http://www.youmail.com/home/apps/iphone.do">YouMail app</a>.  Their service is free and offers voice-to-text transcriptions of your voicemails.  The app will automatically switch your voicemail over to their service, and you can cancel anytime.</p>
<h2>Booyah, Grandma.  Booyah.</h2>
<p>Congrats - you're officially a jailbreaking, phone unlocking, freedom loving, renegade iPhone ninja.  If <a href="http://en.wikipedia.org/wiki/Braveheart">William Wallace</a> was here, he'd tell you:</p>
<p>"They may take our money, but they will never take OUR FREEDOM!"</p>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=878&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/change-iphone-carrier-to-t-mobile/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Make a &#8220;Deluxe iPhone Pencil Stand&#8221;</title>
		<link>http://www.zulius.com/how-to/make-a-deluxe-iphone-pencil-stand/</link>
		<comments>http://www.zulius.com/how-to/make-a-deluxe-iphone-pencil-stand/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 18:05:47 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=724</guid>
		<description><![CDATA[If you've made it here, chances are you're a DIY-er. You hate spending money and you'd rather build stuff with your own hands. You chuckle at rich suckers who shell out $350 for a pure crystal iPhone stand. And you'd get a much more rewarding experience making your own stand using office supplies stolen from [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right;">
<div style="clear: both">
<div class="wp-caption alignright" style="width: 335px"><a id="ss1" href="/img/blog/iphone-pencil-stand/done-portrait-large.jpg" rel="colorbox"><img alt="Deluxe iPhone Pencil Stand" src="/img/blog/iphone-pencil-stand/done-portrait-small.jpg" title="Deluxe iPhone Pencil Stand" width="325" height="281" /></a><p class="wp-caption-text">Deluxe iPhone Pencil Stand <br />3 pics</p></div><br />
<a id="ss2" style="display: none" href="/img/blog/iphone-pencil-stand/done-landscape-large.jpg" rel="colorbox"></a><br />
<a id="ss3" style="display: none" href="/img/blog/iphone-pencil-stand/done-empty-large.jpg" rel="colorbox"></a>
</div>
<div style="clear: both"></div>
</div>
<p>If you've made it here, chances are you're a <a href="http://en.wikipedia.org/wiki/Do_it_yourself">DIY-er</a>.  You hate spending money and you'd rather build stuff with your own hands.  You chuckle at rich suckers who shell out <a href="http://www.calypsocrystal.com/">$350 for a pure crystal iPhone stand</a>.  And you'd get a much more rewarding experience making your own stand using office supplies stolen from your employer.</p>
<p style="margin-bottom: 30px"><strong>Disclaimer:</strong> we didn't come up with the original idea for this stand.  This "deluxe" model offers a few modifications of <a href="http://www.geeky-gadgets.com/feature-the-pencil-iphone-stand/">Geeky Gadget's Pencil iPhone Stand</a>.</p>
<h2>Features</h2>
<ul>
<li>Uses two pencils as rear support for more sturdiness</li>
<li>Front and back paper clip "guard rails" prevents the iPhone from slipping off</li>
<li>Holds the iPhone in either landscape or portrait orientation</li>
</ul>
<div style="margin-top: 20px">
<div style="float: left; width: 230px">
<h2>What You'll Need</h2>
<ul>
<li>8 rubber bands</li>
<li>2 paper clips</li>
<li>6 pencils (unsharpened for safety or sharpened for bad-assed-ness)</li>
<li>Needle nose pliers (unless you're a tough guy)</li>
</ul></div>
<div style="float: right;">
<div style="clear: both">
		<div class="wp-caption alignright" style="width: 335px"><a id="ss4" href="/img/blog/iphone-pencil-stand/supplies-large.jpg" rel="supplies"><img alt="Deluxe iPhone Pencil Stand" src="/img/blog/iphone-pencil-stand/supplies-small.jpg" title="Supplies"  /></a><p class="wp-caption-text">Supplies</p></div>
		</div>
<div style="clear: both"></div>
</p></div>
<div style="clear: both"></div>
</div>
<div style="margin-top: 10px">
<div style="float: left; width: 330px">
<h2>Guard Rails</h2>
<p>We'll start by straightening out the paper clips to create the stand's "guard rails".</p>
<ol>
<li>Grab a paper clip, and unbend the first 3 folds till you have a "U" shape (or upside down "U").</li>
<li>Use the pliers to get rid of that kink in the middle.</li>
<li><i>Optional:</i> Notice one side of the "U" is longer than the other?  You can try to make them even, but we'll be able to hide this difference in the rubber bands later.</li>
<li>Using the pliers, make a new, 90 degree outward bend in each side of the "U" about a half inch from the previous bend.  This should create a more "3 dimensional" shape.</li>
<li>Repeat for the other clip.  The more even and identical they are, the better the end result will look.</li>
</ol></div>
<div style="float: right; width: 250px; margin-top: 20px;">
<div style="clear: both">
			<div class="wp-caption alignright" style="width: 235px"><a id="ss5" href="/img/blog/iphone-pencil-stand/clips-1-large.jpg" rel="clips"><img alt="clips" src="/img/blog/iphone-pencil-stand/clips-1-small.jpg"  title="clips" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss6" href="/img/blog/iphone-pencil-stand/clips-2-large.jpg" rel="clips"><img alt="clips" src="/img/blog/iphone-pencil-stand/clips-2-small.jpg"  title="clips" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss7" href="/img/blog/iphone-pencil-stand/clips-3-large.jpg" rel="clips"><img alt="clips" src="/img/blog/iphone-pencil-stand/clips-3-small.jpg"  title="clips" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div style="clear: both"></div>
</p></div>
<div style="clear: both"></div>
</div>
<div style="margin-top: 10px">
<div style="float: left;width: 330px">
<h2>The Cradle</h2>
<p>Two pencils and those bent paper clips are going to hold the cellular telephone.</p>
<ol>
<li>Place 2 pencils side-by-side and loop and tighten a rubber band around each end.  Make sure the distance between the rubber bands is the same as the width of the paper clips from the previous step.</li>
<li>Grab a guard rail and thread each underneath a rubber band on the conjoined pencils. The guard rail leg doesn't need to go underneath all of the loops, just one loop is fine.</li>
<li>Grab the other guard rail and thread it through the rubber bands on the other side of the pencils.</li>
<li>Try to make the paper clips as straight and even as possible.  It's alright if they feel loose, we'll tighten them down in the next step.</li>
</ol></div>
<div style="float: right; margin-top: 20px; width: 250px;">
<div style="clear: both">
			<div class="wp-caption alignright" style="width: 235px"><a id="ss8" href="/img/blog/iphone-pencil-stand/cradle-1-large.jpg" rel="cradle"><img alt="cradle" src="/img/blog/iphone-pencil-stand/cradle-1-small.jpg"  title="cradle" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss9" href="/img/blog/iphone-pencil-stand/cradle-2-large.jpg" rel="cradle"><img alt="cradle" src="/img/blog/iphone-pencil-stand/cradle-2-small.jpg"  title="cradle" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss10" href="/img/blog/iphone-pencil-stand/cradle-3-large.jpg" rel="cradle"><img alt="cradle" src="/img/blog/iphone-pencil-stand/cradle-3-small.jpg"  title="cradle" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss11" href="/img/blog/iphone-pencil-stand/cradle-4-large.jpg" rel="cradle"><img alt="cradle" src="/img/blog/iphone-pencil-stand/cradle-4-small.jpg"  title="cradle" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss12" href="/img/blog/iphone-pencil-stand/cradle-5-large.jpg" rel="cradle"><img alt="cradle" src="/img/blog/iphone-pencil-stand/cradle-5-small.jpg"  title="cradle" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div style="clear: both"></div>
</p></div>
<div style="clear: both"></div>
</div>
<div style="margin-top: 10px">
<div style="float: left;width: 330px">
<h2>The Frame</h2>
<p>In this step, we'll make a frame for the phone to lean on and attach it to the cradle thing.</p>
<ol>
<li>Cross 2 pencils at their pointy ends and wrap a rubber band around them.  The rubber band should be wrapped about 1 inch from the end of the pencils.</li>
<li>Thread each leg of these two pencils through the rubber bands of the cradle.  Again, just getting each leg under a single loop is fine.</li>
<li>Now its time to tighten this thing down.  Grab a rubber band and loop it around the joint you just made.  Make it tight.  If you have some thicker rubber bands, now is the time to use them.  If not, you can repeat this step with extra rubber bands for more stability.</li>
<li>If any paper clip ends are sticking out, try to move a rubber band loop over them.  Those things can be pretty sharp.</li>
</ol></div>
<div style="float: right; margin-top: 20px; width: 250px;">
<div style="clear: both">
			<div class="wp-caption alignright" style="width: 235px"><a id="ss13" href="/img/blog/iphone-pencil-stand/frame-1-large.jpg" rel="frame"><img alt="frame" src="/img/blog/iphone-pencil-stand/frame-1-small.jpg"  title="frame" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss14" href="/img/blog/iphone-pencil-stand/frame-2-large.jpg" rel="frame"><img alt="frame" src="/img/blog/iphone-pencil-stand/frame-2-small.jpg"  title="frame" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss15" href="/img/blog/iphone-pencil-stand/frame-3-large.jpg" rel="frame"><img alt="frame" src="/img/blog/iphone-pencil-stand/frame-3-small.jpg"  title="frame" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div style="clear: both"></div>
</p></div>
<div style="clear: both"></div>
</div>
<div style="margin-top: 10px">
<div style="float: left;width: 330px">
<h2>Complete the Stand</h2>
<p>Let's finish this thing off.</p>
<ol>
<li>Grab the last 2 pencils and loop a rubber band around them just below the metal of their erasers.  This is going to be the 3rd leg of the stand.</li>
<li>Spread the 3rd leg's pencils apart and thread the pointy ends through the rubber band on each side of the top of the frame.</li>
<li>Grab a rubber band and tightly wrap it around the new joint.  Repeat with another rubber band.  If it's still not stable, wrap a 3rd rubber band around the joint.</li>
</ol></div>
<div style="float: right; margin-top: 20px; width: 250px;">
<div style="clear: both">
			<div class="wp-caption alignright" style="width: 235px"><a id="ss16" href="/img/blog/iphone-pencil-stand/stand-1-large.jpg" rel="stand"><img alt="stand" src="/img/blog/iphone-pencil-stand/stand-1-small.jpg"  title="stand" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss17" href="/img/blog/iphone-pencil-stand/stand-2-large.jpg" rel="stand"><img alt="stand" src="/img/blog/iphone-pencil-stand/stand-2-small.jpg"  title="stand" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss18" href="/img/blog/iphone-pencil-stand/stand-3-large.jpg" rel="stand"><img alt="stand" src="/img/blog/iphone-pencil-stand/stand-3-small.jpg"  title="stand" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div style="clear: both">
			<div class="wp-caption alignright" style="width: 235px"><a id="ss19" href="/img/blog/iphone-pencil-stand/stand-4-large.jpg" rel="stand"><img alt="stand" src="/img/blog/iphone-pencil-stand/stand-4-small.jpg"  title="stand" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss20" href="/img/blog/iphone-pencil-stand/stand-5-large.jpg" rel="stand"><img alt="stand" src="/img/blog/iphone-pencil-stand/stand-5-small.jpg"  title="stand" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div>
			<div class="wp-caption alignright" style="width: 235px"><a id="ss21" href="/img/blog/iphone-pencil-stand/stand-6-large.jpg" rel="stand"><img alt="stand" src="/img/blog/iphone-pencil-stand/stand-6-small.jpg"  title="stand" /></a><p class="wp-caption-text"> </p></div>
		</div>
<div style="clear: both"></div>
</p></div>
<div style="clear: both"></div>
</div>
<div style="margin-top: 10px">
<h2>Done</h2>
<p>With any luck, you should now have something that looks like this.</p>
<div>
		<div class="wp-caption aligncenter" style="width: 570px"><img alt="done" src="/img/blog/iphone-pencil-stand/done-empty-large.jpg"  title="done" /><p class="wp-caption-text">The finished product</p></div>
	</div>
<p style="margin-top: 10px">If any of the joints feel loose or unstable, loop another rubber band band around it.  The thicker the rubber band, the more stability you'll get.</p>
</div>
<p><script type="text/javascript">jQuery(document).ready(function(){
jQuery("#ss1").colorbox({title: 'Deluxe iPhone Pencil Stand'});
jQuery("#ss2").colorbox({title: 'Deluxe iPhone Pencil Stand'});
jQuery("#ss3").colorbox({title: 'Deluxe iPhone Pencil Stand'});
jQuery("#ss4").colorbox({title: 'Supplies'});
jQuery("#ss5").colorbox({title: 'bend those clips'});
jQuery("#ss6").colorbox({title: 'bend those clips'});
jQuery("#ss7").colorbox({title: 'bend those clips'});
jQuery("#ss8").colorbox({title: 'the cradle'});
jQuery("#ss9").colorbox({title: 'the cradle'});
jQuery("#ss10").colorbox({title: 'the cradle'});
jQuery("#ss11").colorbox({title: 'the cradle'});
jQuery("#ss12").colorbox({title: 'the cradle'});
jQuery("#ss13").colorbox({title: 'the frame'});
jQuery("#ss14").colorbox({title: 'the frame'});
jQuery("#ss15").colorbox({title: 'the frame'});
jQuery("#ss16").colorbox({title: 'complete the stand'});
jQuery("#ss17").colorbox({title: 'complete the stand'});
jQuery("#ss18").colorbox({title: 'complete the stand'});
jQuery("#ss19").colorbox({title: 'complete the stand'});
jQuery("#ss20").colorbox({title: 'complete the stand'});
jQuery("#ss21").colorbox({title: 'complete the stand'});
});
</script></p>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=724&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/make-a-deluxe-iphone-pencil-stand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get yum to install a specific package version</title>
		<link>http://www.zulius.com/how-to/yum-install-specific-package-version/</link>
		<comments>http://www.zulius.com/how-to/yum-install-specific-package-version/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 05:53:53 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=710</guid>
		<description><![CDATA[Every once in a while you may need to install a specific version of a package on your system. If you're using the yum package manager, it isn't blatantly obvious how to do this, even after pouring over the man pages. So let's do this thing. First, if you've already installed a newer version of [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 160px"><img alt="yum fun" src="/img/blog/yumPackageVersion/titleImage.png" title="yum fun" width="150" height="110" /><p class="wp-caption-text">yum fun</p></div>
<p>Every once in a while you may need to install a specific version of a package on your system.  If you're using the yum package manager, it isn't blatantly obvious how to do this, even after pouring over the man pages.</p>
<p>So let's do this thing.</p>
<p>First, if you've already installed a newer version of the package, you'll have to downgrade it.  In that case, make sure you've got yum's downgrade plugin installed:</p>
<pre class="brush: plain;"># yum install yum-allowdowngrade</pre>
<p>Second, do you know exactly which package version you want to install?  If not, list the all available versions using the --showduplicates flag.  This example looks for available versions of the GD extension for PHP.</p>
<pre class="brush: plain;"># yum --showduplicates list php-gd

Available Packages
php-gd.i386                    5.2.3-3.el5s2                        testing
php-gd.i386                    5.2.6-2.el5s2                        testing
php-gd.i386                    5.2.9-2.el5.centos                   testing
php-gd.i386                    5.2.10-1.el5.centos                  testing
</pre>
<p>Yum uses the RPM package manager, and it's package names are based on the <a href="http://en.wikipedia.org/wiki/RPM_Package_Manager#Package_label">RPM package label format</a>.  In the above example, the first column displays the package name and architecture in the format NAME.ARCHITECTURE.  The middle column displays the version and release info in the format VERSION-RELEASE.  Don't ask me why yum rearranges the RPM package label format.</p>
<p>Anyways, if you're downgrading, remove the previous package:</p>
<pre class="brush: plain;"># yum remove php-gd</pre>
<p>Now that you know which version to install, it's a matter of specifying the package name with the version.  Use the format NAME-VERSION.</p>
<pre class="brush: plain;"># yum install php-gd-5.2.6</pre>
<p>Or if you want to get even more specific, use NAME-VERSION-RELEASE (which might be easier to copy/paste since VERSION-RELEASE is the second column).</p>
<pre class="brush: plain;"># yum install php-gd-5.2.6-2.el5s2</pre>
<p>If you're downgrading, you may need to throw in the --allow-downgrade flag.</p>
<pre class="brush: plain;"># yum --allow-downgrade install php-gd-5.2.6</pre>
<p>And you should be good to go.  If you want to lock the version you installed to prevent any future updates, install the versionlock plugin.</p>
<pre class="brush: plain;"># yum install yum-versionlock</pre>
<p>Then lock it.</p>
<pre class="brush: plain;"># yum versionlock php-gd</pre>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=710&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/yum-install-specific-package-version/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Resolve Windows netbios names from Linux</title>
		<link>http://www.zulius.com/how-to/resolve-windows-netbios-names-from-linux/</link>
		<comments>http://www.zulius.com/how-to/resolve-windows-netbios-names-from-linux/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 11:59:57 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[netbios]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=704</guid>
		<description><![CDATA[Platforms: any *nix distro What You'll Need: Samba In a heterogeneous LAN it is often useful to resolve network addresses by a computer's name (ie. netbios name). This is especially true if the LAN does not have a DNS server so that host names can be used instead of IP addresses (which if dynamically assigned, [...]]]></description>
			<content:encoded><![CDATA[<p><div class="wp-caption alignleft" style="width: 159px"><img alt="Ping a Windows box" src="/img/blog/resolveWindowsNetbiosTitleImate.png" title="Ping a Windows box" width="150" height="110" /><p class="wp-caption-text">Ping a Windows box</p></div>
<p><strong>Platforms: </strong><br />any *nix distro</p>
<p><strong>What You'll Need:</strong><br /> <a href="http://www.samba.org/">Samba</a></p>
<p>
In a heterogeneous LAN it is often useful to resolve network addresses by a computer's name (ie. <a href="http://en.wikipedia.org/wiki/NetBIOS">netbios</a> name).  This is especially true if the LAN does not have a DNS server so that host names can be used instead of IP addresses (which if dynamically assigned, could change often).</p>
<p>
To enable Windows netbios name resolution from a Linux computer, make sure that <a href="http://www.samba.org/">Samba</a> is installed (although the smb service does not need to be running).  The Samba suite includes <a href="http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/winbind.html">winbind</a>, which enables Windows host names to be resolved.</p>
<p>Then edit /etc/nsswitch.conf and change this line:</p>
<pre class="brush: plain;">hosts:      files dns</pre>
<p>to this:</p>
<pre class="brush: plain;">hosts:      files dns wins</pre>
<p>Then test by pinging the computer name of Windows machine on the LAN:</p>
<pre class="brush: plain;">$ ping windowsbox
PING windowsbox (192.168.0.100) 56(84) bytes of data.
64 bytes from 192.168.0.100: icmp_seq=1 ttl=128 time=0.117 ms
64 bytes from 192.168.0.100: icmp_seq=2 ttl=128 time=0.127 ms
64 bytes from 192.168.0.100: icmp_seq=3 ttl=128 time=0.127 ms
64 bytes from 192.168.0.100: icmp_seq=4 ttl=128 time=0.127 ms
64 bytes from 192.168.0.100: icmp_seq=5 ttl=128 time=0.128 ms</pre>
<p>This setting really comes in handy when mounting a shared folder of a dynamically IP'ed Windows box from Linux.  Instead of using the Windows' box IP address, just specify it's netbios name.  Example entry in /etc/fstab:</p>
<pre class="brush: plain;">
//windowsbox/my_share/ /mnt/my_mount_point/ cifs rw,username=xxx,password=xxx,domain=xxx 0 0
</pre>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=704&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/resolve-windows-netbios-names-from-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Send multidimensional arrays to PHP with jQuery and AJAX</title>
		<link>http://www.zulius.com/how-to/send-multidimensional-arrays-php-with-jquery-ajax/</link>
		<comments>http://www.zulius.com/how-to/send-multidimensional-arrays-php-with-jquery-ajax/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 14:48:46 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=656</guid>
		<description><![CDATA[AJAX communication between the client browser and web server is a handy method of transferring data without forcing the user to refresh the page. Typically, the data sent to the server is a simple set of form fields or flags. However, it is also possible to submit more complex structured data. This tutorial will demonstrate [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 170px"><img alt="AJAX" src="/img/blog/assocArrayPhpJqueryAjax.png" title="AJAX" width="150" height="110" /><p class="wp-caption-text">javascript array</p></div>
<p><a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29">AJAX</a> communication between the client browser and web server is a handy method of transferring data without forcing the user to refresh the page.  Typically, the data sent to the server is a simple set of form fields or flags.  However, it is also possible to submit more complex structured data.  This tutorial will demonstrate 4 different methods used to pass multidimensional javascript arrays using <a href="http://jquery.com/">jQuery</a> and AJAX to a <a href="http://www.php.net/">PHP</a> web server.</p>
<h2>UPDATE: The Easy Way... for jQuery 1.4.0+</h2>
<p>Thanks to Pirumpi for pointing out that jQuery 1.4.0 now <a href="http://api.jquery.com/jQuery.param/">automatically serializes arrays and objects parameters</a> for AJAX functions.  That means it's super easy to pass them to PHP:</p>
<pre class="brush: xml; first-line: 1; gutter: true;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; dir=&quot;ltr&quot; lang=&quot;en-US&quot;&gt;
    &lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
        &lt;title&gt;jQuery AJAX arrays&lt;/title&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.js&quot;&gt;&lt;/script&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
                sendAjax = function(){
                    var data = {
                                  foo:  123,
                                  bar:  456,
                                  rows: [
                                          {
                                            column1 : 'hello',
                                            column2 : 'hola',
                                            column3 : 'bonjour',
                                          },
                                          {
                                            column1 : 'goodbye',
                                            column2 : 'hasta luego',
                                            column3 : 'au revoir',
                                          },
                                        ],
                                  test1:{
                                          test2: {
                                                   test3:  'baz'
                                                 }
                                        }
                                };

                    $.ajax({
                            type:           'post',
                            cache:          false,
                            url:            './ajax/',
                            data:           data
                           });
                }

        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;input type=&quot;button&quot; style=&quot;width: 130px; height: 60px&quot; value=&quot;send AJAX&quot; onclick=&quot;sendAjax();&quot; /&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>When the button is clicked, the following structured data shows up in PHP's $_POST variable:</p>
<pre class="brush: plain;">
Array
(
    [foo] =&gt; 123
    [bar] =&gt; 456
    [rows] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [column1] =&gt; hello
                    [column2] =&gt; hola
                    [column3] =&gt; bonjour
                )

            [1] =&gt; Array
                (
                    [column1] =&gt; goodbye
                    [column2] =&gt; hasta luego
                    [column3] =&gt; au revoir
                )

        )

    [test1] =&gt; Array
        (
            [test2] =&gt; Array
                (
                    [test3] =&gt; baz
                )

        )

)
</pre>
<p>This will only work with jQuery 1.4.0+.  Otherwise jQuery simply calls .toString() on the nested array at key "rows" and nested object at key "test1", and they get passed to PHP with the useless values "[object Object]".</p>
<p><b>NOTE:</b> The remainder of this article will demonstrate how to send objects and arrays for jQuery versions lower than 1.4.0.</p>
<h2>Method 1 - Form input arrays</h2>
<p>It's possible to name the keys of the JS array as HTML form input arrays (ie. named with square brackets) so that <a href="http://php.net/manual/en/language.variables.external.php">PHP decodes the array's key names as nested arrays</a>.  I don't recommend this method because it does not maintain the JS array's original structure in the Javascript.  However, it can be used if you just need to get the AJAX request working without using JSON.</p>
<p>
The original JS "data" array can be renamed/restructured as:
</p>
<pre class="brush: jscript;">
sendAjax = function(){
	var data = {
				  foo:  123,
				  bar:  456,
				  'rows[0][column1]':    'hello',
				  'rows[0][column2]':    'hola',
				  'rows[0][column3]':    'bonjour',
				  'rows[1][column1]':    'goodbye',
				  'rows[1][column2]':    'hasta luego',
				  'rows[1][column3]':    'au revoir',
				  'test1[test2][test3]': 'baz'
				};
	$.ajax({
			type:           'post',
			cache:          false,
			url:            './ajax/',
			data:           data
		   });
}
</pre>
<p>And the data is correctly received in PHP's $_POST variable:</p>
<pre class="brush: plain;">
Array
(
    [foo] =&gt; 123
    [bar] =&gt; 456
    [rows] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [column1] =&gt; hello
                    [column2] =&gt; hola
                    [column3] =&gt; bonjour
                )

            [1] =&gt; Array
                (
                    [column1] =&gt; goodbye
                    [column2] =&gt; hasta luego
                    [column3] =&gt; au revoir
                )
        )

    [test1] =&gt; Array
        (
            [test2] =&gt; Array
                (
                    [test3] =&gt; baz
                )
        )
)
</pre>
<h2>Method 2 - JSON string parameter</h2>
<p>This method converts the JS array to a <a href="http://www.json.org/">JSON</a> string, and passes it as a POST or GET parameter, which can be manually decoded back into an array by PHP.  Modern browsers (Firefox 3, IE 8) now have a native JSON object that can be used to stringify JS arrays to JSON strings.  The following example uses the <a href="http://developer.yahoo.com/yui/json/">YUI JSON utility</a> to convert the JS array to a string ( <a href="http://www.json.org/json2.js">json2</a> is another populary lightweight utility for handling JSON).</p>
<pre class="brush: jscript;">
sendAjax = function(){
	var data = {
				  foo:  123,
				  bar:  456,
				  rows: [
						  {
							column1 : 'hello',
							column2 : 'hola',
							column3 : 'bonjour',
						  },
						  {
							column1 : 'goodbye',
							column2 : 'hasta luego',
							column3 : 'au revoir',
						  },
						],
				  test1:{
						  test2: {
								   test3:  'baz'
								 }
						}
				};
	data = YAHOO.lang.JSON.stringify(data);

	$.ajax({
			type:           'post',
			cache:          false,
			url:            './ajax/',
			data:           {myJson:  data}
		   });
}
</pre>
<p>On the PHP side, it's necessary to use <a href="http://us2.php.net/manual/en/function.json-decode.php">json_decode()</a> to convert the JSON $_POST parameter string (named "myJson") to an array:</p>
<pre class="brush: php;">
&lt;?php
$data = json_decode($_POST['myJson'], true);
print_r($data);
</pre>
<p>And the array is good to go:</p>
<pre class="brush: plain;">
Array
(
    [foo] =&gt; 123
    [bar] =&gt; 456
    [rows] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [column1] =&gt; hello
                    [column2] =&gt; hola
                    [column3] =&gt; bonjour
                )

            [1] =&gt; Array
                (
                    [column1] =&gt; goodbye
                    [column2] =&gt; hasta luego
                    [column3] =&gt; au revoir
                )
        )

    [test1] =&gt; Array
        (
            [test2] =&gt; Array
                (
                    [test3] =&gt; baz
                )
        )
)
</pre>
<h2>Method 3 - JSON content-type</h2>
<p>My favorite method is to simply JSON stringify the JS array, and pass it as the AJAX request's body.  This requires that the content-type of the request be changed from the default "application/x-www-form-urlencoded" to "application/json", and that $.ajax()'s <a href="http://docs.jquery.com/Ajax/jQuery.ajax#options">processData</a> parameter be set to false so that the JSON data is not converted into a query string.  Also, the type of request must be POST, as the GET method does not support submitting data in the request body.</p>
<pre class="brush: jscript;">
sendAjax = function(){
	var data = {
				  foo:  123,
				  bar:  456,
				  rows: [
						  {
							column1 : 'hello',
							column2 : 'hola',
							column3 : 'bonjour',
						  },
						  {
							column1 : 'goodbye',
							column2 : 'hasta luego',
							column3 : 'au revoir',
						  },
						],
				  test1:{
						  test2: {
								   test3:  'baz'
								 }
						}
				};
	data = YAHOO.lang.JSON.stringify(data);

	$.ajax({
			type:           'post',
			cache:          false,
			url:            './ajax/',
			data:           data,
			processData:    false,
			contentType:   'application/json'
		   });
}
</pre>
<p>On the PHP side, it's necessary to manually read the JSON string directly from the request body using the <a href="http://php.net/manual/en/wrappers.php.php">php://input</a> stream.  The returned string can then be decoded into an array:</p>
<pre class="brush: php;">
&lt;?php
$data = file_get_contents('php://input');
$data = json_decode($data, true);
print_r($data);
</pre>
<p>Which gives us the array:</p>
<pre class="brush: plain;">
Array
(
    [foo] =&gt; 123
    [bar] =&gt; 456
    [rows] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [column1] =&gt; hello
                    [column2] =&gt; hola
                    [column3] =&gt; bonjour
                )

            [1] =&gt; Array
                (
                    [column1] =&gt; goodbye
                    [column2] =&gt; hasta luego
                    [column3] =&gt; au revoir
                )
        )

    [test1] =&gt; Array
        (
            [test2] =&gt; Array
                (
                    [test3] =&gt; baz
                )
        )
)
</pre>
<p>Hopefully this tutorial has helped you get multidimensional array data passed to your webserver using AJAX.  If you know of another method, please submit it in the comments - thanks!</p>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=656&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/send-multidimensional-arrays-php-with-jquery-ajax/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Get numlock working with PuTTY and vim</title>
		<link>http://www.zulius.com/how-to/get-numlock-working-with-putty-and-vim/</link>
		<comments>http://www.zulius.com/how-to/get-numlock-working-with-putty-and-vim/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 08:34:45 +0000</pubDate>
		<dc:creator>Tim White</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.zulius.com/?p=643</guid>
		<description><![CDATA[By default, your keyboard's numlock enabled number pad doesn't work well with console applications running on a PuTTY SSH connection. The numpad's numbers seem to get mapped to inserting the characters "q" thru "y". This is especially annoying when using vim. To get numlock working, open PuTTY's configuration window, goto Terminal > Features. Enable the [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 170px"><img alt="PuTTY" src="/img/blog/putty-vim-numpad/puttyTitleImage.jpg" title="PuTTY" width="150" height="110" /><p class="wp-caption-text">PuTTY</p></div>
<p>By default, your keyboard's numlock enabled number pad doesn't work well with console applications running on a PuTTY SSH connection.  The numpad's numbers seem to get mapped to inserting the characters "q" thru "y".  This is especially annoying when using vim.</p>
<p>To get numlock working, open PuTTY's configuration window, goto <b>Terminal > Features</b>.  Enable the "Disable application keypad mode" checkbox.</p>
<p>  If you want this setting to persist, make sure to select a saved session and click "Save".</p>
<p style="padding: 15px 0 0 0"><img class="alignnone" src="/img/blog/putty-vim-numpad/terminal-features.jpg" alt="Putty Configuration" /></p>
<img src="http://www.zulius.com/blog/?ak_action=api_record_view&id=643&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.zulius.com/how-to/get-numlock-working-with-putty-and-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

