<?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"
	>

<channel>
	<title>IONCANNON</title>
	<atom:link href="http://www.ioncannon.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ioncannon.net</link>
	<description>What are you building?</description>
	<pubDate>Thu, 24 Apr 2008 13:19:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Examples of why netcat is still useful</title>
		<link>http://www.ioncannon.net/system-administration/134/netcat-examples/</link>
		<comments>http://www.ioncannon.net/system-administration/134/netcat-examples/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 13:18:41 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[system administration]]></category>

		<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=134</guid>
		<description><![CDATA[I recently got a new work PC and was worried that stuck somewhere in the 40G hard drive of the old PC was something I would one day need. The new PC had 300G of space so I figured I would just copy the entire drive over and keep it forever. This isn&#039;t the most [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got a new work PC and was worried that stuck somewhere in the 40G hard drive of the old PC was something I would one day need. The new PC had 300G of space so I figured I would just copy the entire drive over and keep it forever. This isn&#039;t the most difficult task in the world and I actually started out using ssh to transfer the image.</p>
<p><span id="more-134"></span></p>
<p>To transfer the drive using ssh I was using the following command from the new PC:</p>
<div class="codesnip-container" >
<div class="codesnip">ssh -c blowfish old-pc-ip <span class="st0">&#034;dd if=/dev/hda&#034;</span> &gt; dd <span class="re2">of=</span>old-pc.hda</div>
</div>
<p>This worked fine but the old PC seemed to be having a hard time keeping up. I did some adjusting to the block size of the transfers using dd but that didn&#039;t seem to help. That is when I decided to give netcat a try.</p>
<p>On the old PC side I ran:</p>
<div class="codesnip-container" >
<div class="codesnip">dd <span class="re2">if=</span>/dev/hda | nc -l <span class="nu0">10001</span></div>
</div>
<p>and on the new PC side I ran:</p>
<div class="codesnip-container" >
<div class="codesnip">nc old-pc-ip <span class="nu0">10001</span> | dd <span class="re2">of=</span>old-pc.hda</div>
</div>
<p>This worked like a charm and transfered the drive about twice as fast as ssh using blowfish encryption.</p>
<p>Just for reference I was using dd here to give myself more control over block sizes, skip any read errors, and at times I was actually trying to just transfer parts of the drive instead of the entire thing using the seek and count options. Another useful trick with dd is that you can find out the current amount transfered and rate by sending it a USR1 signal with kill. After poking around I actually found another nice utility that you can stick in the stream call <a href="http://www.ivarch.com/programs/pv.shtml" onclick="javascript:urchinTracker ('/outbound/article/www.ivarch.com');">pipe viewer</a> that is able to give you a nice display of the count instead of having to send signals to dd.</p>
<p>Another great use for netcat that I ran into recently was setting up a ppp tunnel between two machines. Again at first I started by using ssh:</p>
<div class="codesnip-container" >
<div class="codesnip">pppd updetach noauth passive pty <span class="st0">&#034;ssh remote-host-ip -lroot -o Batchmode=yes pppd nodetach notty noauth&#034;</span> ipparam vpn <span class="nu0">192</span>.<span class="nu0">168</span>.<span class="nu0">77</span>.<span class="nu0">1</span>:<span class="nu0">192</span>.<span class="nu0">168</span>.<span class="nu0">77</span>.<span class="nu0">2</span></div>
</div>
<p>This worked between two machines that were already connected by a network but my real goal was build the tunnel over a device that wouldn&#039;t work with ssh traffic. I turned to netcat again.</p>
<p>On the initiating side I ran this:</p>
<div class="codesnip-container" >
<div class="codesnip">/usr/sbin/pppd connect-delay <span class="nu0">30000</span> updetach noauth passive pty <span class="st0">&#034;echo connect-585 | nc device-ip 2000&#034;</span> ipparam root <span class="nu0">192</span>.<span class="nu0">168</span>.<span class="nu0">77</span>.<span class="nu0">1</span>:<span class="nu0">192</span>.<span class="nu0">168</span>.<span class="nu0">77</span>.<span class="nu0">2</span></div>
</div>
<p>Here I send the traffic to a device in between that forms a connection over a non-network link to the end point machine. I don&#039;t need netcat on the endpoint because the communication channel is not a network. On the end point I run this:</p>
<div class="codesnip-container" >
<div class="codesnip">/usr/sbin/pppd nodetach notty noauth</div>
</div>
<p>In this case netcat saved me from having to write some intermediate code that would communicate with the device and just pipe the bits through.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/134/netcat-examples/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java GIF Adventure</title>
		<link>http://www.ioncannon.net/php/79/java-gif-adventure/</link>
		<comments>http://www.ioncannon.net/php/79/java-gif-adventure/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 14:14:29 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/php/79/java-gif-adventure/</guid>
		<description><![CDATA[I was recently working on a project that generated PNGs using Java from a Java2D canvas. Along the way someone wanted to change the graphics to have transparent backgrounds and because they were needed for display on the web I knew this would become an issue because IE doesn&#039;t support transparency in PNGs out of [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently working on a project that generated PNGs using Java from a Java2D canvas. Along the way someone wanted to change the graphics to have transparent backgrounds and because they were needed for display on the web I knew this would become an issue because <a href="http://blogs.msdn.com/dmassy/archive/2004/08/05/209428.aspx" onclick="javascript:urchinTracker ('/outbound/article/blogs.msdn.com');">IE doesn&#039;t support transparency in PNGs</a> out of the box. And so my journey started.</p>
<p><span id="more-79"></span></p>
<p>I decided to start by making the PNGs I was generating transparent just to verify that it wasn&#039;t that difficult to do. It turned out to be very easy. I&#039;m using the standard ImageIO libraries and wanted to stick to using them. Here is an example of making the background of an image transparent:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="kw2">public</span> <span class="kw2">class</span> Test<br />
<span class="br0">&#123;</span><br />
&nbsp; <span class="kw2">public</span> <span class="kw2">static</span> <span class="kw4">void</span> main<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">String</span></a><span class="br0">&#91;</span><span class="br0">&#93;</span> args<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Exception</span></a><br />
&nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a> image = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a><span class="br0">&#40;</span><span class="nu0">100</span>, <span class="nu0">100</span>, <a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a>.<span class="me1">TYPE_INT_ARGB</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AGraphics2D+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Graphics2D</span></a> canvas = <span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AGraphics2D+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Graphics2D</span></a><span class="br0">&#41;</span> image.<span class="me1">getGraphics</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; canvas.<span class="me1">setRenderingHint</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ARenderingHints+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">RenderingHints</span></a>.<span class="me1">KEY_ANTIALIASING</span>, <a href="http://www.google.com/search?q=allinurl%3ARenderingHints+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">RenderingHints</span></a>.<span class="me1">VALUE_ANTIALIAS_ON</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; canvas.<span class="me1">setColor</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AColor+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Color</span></a>.<span class="me1">white</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; canvas.<span class="me1">setBackground</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AColor+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Color</span></a>.<span class="me1">white</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; canvas.<span class="me1">setComposite</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AAlphaComposite+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">AlphaComposite</span></a>.<span class="me1">getInstance</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AAlphaComposite+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">AlphaComposite</span></a>.<span class="me1">SRC_OVER</span>, <span class="nu0">0</span>.0f<span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; canvas.<span class="me1">fillRect</span><span class="br0">&#40;</span><span class="nu0">0</span>, <span class="nu0">0</span>, <span class="nu0">100</span>, <span class="nu0">100</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; canvas.<span class="me1">setComposite</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AAlphaComposite+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">AlphaComposite</span></a>.<span class="me1">getInstance</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AAlphaComposite+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">AlphaComposite</span></a>.<span class="me1">SRC_OVER</span>, <span class="nu0">1</span>.0f<span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; canvas.<span class="me1">setColor</span><span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AColor+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Color</span></a>.<span class="me1">black</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; canvas.<span class="me1">drawLine</span><span class="br0">&#40;</span><span class="nu0">10</span>, <span class="nu0">10</span>, <span class="nu0">20</span>, <span class="nu0">20</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; canvas.<span class="me1">dispose</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">OutputStream</span></a> ostream = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3AFileOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">FileOutputStream</span></a><span class="br0">&#40;</span><span class="st0">&#034;test.png&#034;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; ImageIO.<span class="me1">write</span><span class="br0">&#40;</span>image, <span class="st0">&#034;png&#034;</span>, ostream<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; ostream.<span class="me1">flush</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>The next thing I did was try to just change the format that was being saved from &#034;png&#034; to &#034;gif&#034; thinking that because I had a recent version of Java 1.5 this might just work. However it appears that <a href="http://forum.java.sun.com/thread.jspa?threadID=770668&#038;messageID=4391702" onclick="javascript:urchinTracker ('/outbound/article/forum.java.sun.com');">writting GIFs is not supported until Java 1.6</a> so I was out of luck.</p>
<p>As it turns out though I did some more searching and found that there is actually a <a href="https://gif-plugin.dev.java.net/" onclick="javascript:urchinTracker ('/outbound/article/gif-plugin.dev.java.net');">plugin for GIFs</a> that was made for the ImageIO system. It was very easy to install, just download the jar and put it into the classpath. After that changing &#034;png&#034; to &#034;gif&#034; worked. However, the plugin doesn&#039;t support alpha or doesn&#039;t support it in the same way as the PNG writer. I then tried to change the transparency around a number of ways but nothing worked and in some cases the GIF generated was broken. The most promising hack I tried was to change the alpha flag on the background color using a BufferedImageOp filter like this:</p>
<div class="codesnip-container" >
<div class="codesnip"><a href="http://www.google.com/search?q=allinurl%3ABufferedImageOp+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImageOp</span></a> filter = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ABufferedImageOp+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImageOp</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a> filter<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a> src, <a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a> dest<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>dest == <span class="kw2">null</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dest = createCompatibleDestImage<span class="br0">&#40;</span>src, <span class="kw2">null</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> width = src.<span class="me1">getWidth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> height = src.<span class="me1">getHeight</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> y = <span class="nu0">0</span>; y &lt; height; y++<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> x = <span class="nu0">0</span>; x &lt; width; x++<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> src.<span class="me1">getRGB</span><span class="br0">&#40;</span>x, y<span class="br0">&#41;</span> == <a href="http://www.google.com/search?q=allinurl%3AColor+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Color</span></a>.<span class="me1">white</span>.<span class="me1">getRGB</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dest.<span class="me1">setRGB</span><span class="br0">&#40;</span>x, y, 0&#215;00FFFFFF &amp; <a href="http://www.google.com/search?q=allinurl%3AColor+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Color</span></a>.<span class="me1">white</span>.<span class="me1">getRGB</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> dest;<br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ARectangle2D+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Rectangle2D</span></a> getBounds2D<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a> src<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> src.<span class="me1">getRaster</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">getBounds</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a> createCompatibleDestImage<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a> src, <a href="http://www.google.com/search?q=allinurl%3AColorModel+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">ColorModel</span></a> destCM<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>destCM == <span class="kw2">null</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destCM = src.<span class="me1">getColorModel</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> width = src.<span class="me1">getWidth</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> height = src.<span class="me1">getHeight</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ABufferedImage+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedImage</span></a><span class="br0">&#40;</span>destCM, destCM.<span class="me1">createCompatibleWritableRaster</span><span class="br0">&#40;</span>width, height<span class="br0">&#41;</span>, destCM.<span class="me1">isAlphaPremultiplied</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="kw2">null</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3APoint2D+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Point2D</span></a> getPoint2D<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3APoint2D+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Point2D</span></a> srcPt, <a href="http://www.google.com/search?q=allinurl%3APoint2D+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Point2D</span></a> dstPt<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>dstPt == <span class="kw2">null</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dstPt = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3APoint2D+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Point2D</span></a>.<a href="http://www.google.com/search?q=allinurl%3AFloat+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Float</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; dstPt.<span class="me1">setLocation</span><span class="br0">&#40;</span>srcPt.<span class="me1">getX</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, srcPt.<span class="me1">getY</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> dstPt;<br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ARenderingHints+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">RenderingHints</span></a> getRenderingHints<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">null</span>;<br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</div>
<p>The problem with this approach is that the anti-aliasing caused the borders to stand out. While this was close it also wasn&#039;t good enough to use.</p>
<p>In the end I gave up and went back to PNGs. I fixed my issues with IE by using the <a href="http://www.twinhelix.com/css/iepngfix/" onclick="javascript:urchinTracker ('/outbound/article/www.twinhelix.com');">IE AlphaImageLoader fix</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/php/79/java-gif-adventure/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgrading from Fedora 7 to Fedora 8 with yum</title>
		<link>http://www.ioncannon.net/system-administration/133/upgrading-from-fedora-7-to-fedora-8-with-yum/</link>
		<comments>http://www.ioncannon.net/system-administration/133/upgrading-from-fedora-7-to-fedora-8-with-yum/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 21:51:08 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[system administration]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/system-administration/133/upgrading-from-fedora-7-to-fedora-8-with-yum/</guid>
		<description><![CDATA[Fedora 8 has been released so it is time to upgrade once again. First you should go back and upgrade to Fedora 7 if you haven&#039;t already. From there it is even easier this time to upgrade. Here are the steps you need to do the upgrade from Fedora 7 to Fedora 8:

yum update
yum clean [...]]]></description>
			<content:encoded><![CDATA[<p>Fedora 8 has been <a href="http://docs.fedoraproject.org/release-notes/" onclick="javascript:urchinTracker ('/outbound/article/docs.fedoraproject.org');">released</a> so it is time to upgrade once again. First you should go back and <a href="http://www.ioncannon.net/linux/68/upgrading-from-fc6-to-fedora7-with-yum/" >upgrade to Fedora 7</a> if you haven&#039;t already. From there it is even easier this time to upgrade. Here are the steps you need to do the upgrade from Fedora 7 to Fedora 8:</p>
<ol>
<li>yum update</li>
<li>yum clean all</li>
<li>I like to repeated update and clean all a second time to make sure everything got updated</li>
<li>Run the following command to update the yum repo on your box:
<div class="codesnip-container" >
<div class="codesnip">rpm -Uhv http://mirror.anl.gov/pub/fedora/linux/releases/<span class="nu0">8</span>/Fedora/i386/os/Packages/fedora-release-<span class="nu0">8</span>-<span class="nu0">3</span>.noarch.rpm&nbsp; http://mirror.anl.gov/pub/fedora/linux/releases/<span class="nu0">8</span>/Fedora/i386/os/Packages/fedora-release-notes-<span class="nu0">8</span>.<span class="nu0">0</span>.<span class="nu0">0</span>-<span class="nu0">3</span>.noarch.rpm</div>
</div>
</li>
<li>Next do a yum -y update</li>
<li>I needed to remove a couple packages to get the dependencies to work out. This seems to be a normal need now when upgrading but isn&#039;t usually a big deal. In this case I had to remove the heliodor and beryl-settings that both had to do with beryl.</li>
<li>In my case the total set of packages it needed to download was 1.2G so it took about an hour to download and install. Now it was time for a reboot.</li>
<li>The reboot went so fast I almost didn&#039;t believe it rebooted. This was the smoothest upgrade I have had so far.</li>
</ol>
<p>Tags: <a href="http://technorati.com/tag/linux" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">linux</a>, <a href="http://technorati.com/tag/fedora" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');"> fedora</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/133/upgrading-from-fedora-7-to-fedora-8-with-yum/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Connection timeouts with the Apache commons TelnetClient</title>
		<link>http://www.ioncannon.net/java/132/connection-timeouts-with-the-apache-commons-telnetclient/</link>
		<comments>http://www.ioncannon.net/java/132/connection-timeouts-with-the-apache-commons-telnetclient/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 16:13:57 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/java/132/connection-timeouts-with-the-apache-commons-telnetclient/</guid>
		<description><![CDATA[I recently used the Apache commons net package in a project to create a small telnet client that automated a login process. It is hard to find a lot of documentation on TelnetClient but there are some examples. For what I wanted to use the telnet client for I ran into a problem because I [...]]]></description>
			<content:encoded><![CDATA[<p>I recently used the <a href="http://jakarta.apache.org/commons/net/" onclick="javascript:urchinTracker ('/outbound/article/jakarta.apache.org');">Apache commons net package</a> in a project to create a small telnet client that automated a login process. It is hard to find a lot of documentation on <a href="http://jakarta.apache.org/commons/net/apidocs/org/apache/commons/net/telnet/TelnetClient.html" onclick="javascript:urchinTracker ('/outbound/article/jakarta.apache.org');">TelnetClient</a> but there are some examples. For what I wanted to use the telnet client for I ran into a problem because I needed the connect call to time out. Try as I might I couldn&#039;t get <a href="http://jakarta.apache.org/commons/net/apidocs/org/apache/commons/net/SocketClient.html#setDefaultTimeout(int)" onclick="javascript:urchinTracker ('/outbound/article/jakarta.apache.org');">setDefaultTimeout</a> to work as advertised.</p>
<p><span id="more-132"></span></p>
<p>As it turns out the Apache commons developers are trying to keep the net commons package compatible with java 1.3 for some reason (see <a href="http://issues.apache.org/jira/browse/NET-141" onclick="javascript:urchinTracker ('/outbound/article/issues.apache.org');">this issue in jira</a>). If you want to have your connect request time out you have to implement your own <a href="http://jakarta.apache.org/commons/net/apidocs/org/apache/commons/net/SocketFactory.html" onclick="javascript:urchinTracker ('/outbound/article/jakarta.apache.org');">SocketFactory</a> first. Since there seems to be a lot of confusion on this and the commons net project seems to be idle now I figured it was worth writing about in case other people ever go looking.</p>
<p>Here is an example with a custom SocketFactory that will get the timeouts to work on connect:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="kw2">package</span> net.<span class="me1">ioncannon</span>;</p>
<p><span class="co2">import org.apache.commons.net.telnet.TelnetClient;</span><br />
<span class="co2">import org.apache.commons.net.SocketFactory;</span></p>
<p><span class="co2">import java.io.IOException;</span><br />
<span class="co2">import java.io.InputStreamReader;</span><br />
<span class="co2">import java.io.BufferedReader;</span><br />
<span class="co2">import java.net.*;</span></p>
<p><span class="kw2">public</span> <span class="kw2">class</span> TelAllTestMain<br />
<span class="br0">&#123;</span><br />
&nbsp; <span class="kw2">public</span> <span class="kw2">static</span> <span class="kw4">void</span> main<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">String</span></a><span class="br0">&#91;</span><span class="br0">&#93;</span> args<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; TelnetClient telnetClient = <span class="kw2">new</span> TelnetClient<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; telnetClient.<span class="me1">setSocketFactory</span><span class="br0">&#40;</span><span class="kw2">new</span> TimeoutSockectFactory<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; telnetClient.<span class="me1">setDefaultTimeout</span><span class="br0">&#40;</span><span class="nu0">1000</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; telnetClient.<span class="me1">connect</span><span class="br0">&#40;</span><span class="st0">&#034;localhost&#034;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; telnetClient.<span class="me1">setSoTimeout</span><span class="br0">&#40;</span><span class="nu0">1000</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; telnetClient.<span class="me1">setSoLinger</span><span class="br0">&#40;</span><span class="kw2">true</span>, <span class="nu0">1000</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ABufferedReader+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedReader</span></a> reader = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ABufferedReader+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">BufferedReader</span></a><span class="br0">&#40;</span><span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3AInputStreamReader+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">InputStreamReader</span></a><span class="br0">&#40;</span>telnetClient.<span class="me1">getInputStream</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AStringBuffer+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">StringBuffer</span></a> stringBuffer = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3AStringBuffer+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">StringBuffer</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw2">try</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw4">char</span> buffer<span class="br0">&#91;</span><span class="br0">&#93;</span> = <span class="kw2">new</span> <span class="kw4">char</span><span class="br0">&#91;</span><span class="nu0">1024</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; <span class="kw4">int</span> size = -<span class="nu0">1</span>;<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">while</span><span class="br0">&#40;</span><span class="br0">&#40;</span>size = reader.<span class="me1">read</span><span class="br0">&#40;</span>buffer<span class="br0">&#41;</span><span class="br0">&#41;</span> != -<span class="nu0">1</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; stringBuffer.<span class="me1">append</span><span class="br0">&#40;</span>buffer, <span class="nu0">0</span>, size<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>stringBuffer.<span class="me1">toString</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">endsWith</span><span class="br0">&#40;</span><span class="st0">&#034;something&#034;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">System</span></a>.<span class="me1">err</span>.<span class="me1">println</span><span class="br0">&#40;</span><span class="st0">&#034;Found the string&#8230;&#034;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw2">catch</span> <span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Exception</span></a> e<span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">System</span></a>.<span class="me1">err</span>.<span class="me1">println</span><span class="br0">&#40;</span><span class="st0">&#034;Didn&#039;t find the string&#8230;&#034;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span>&nbsp; &nbsp; &nbsp; </p>
<p>&nbsp; &nbsp; telnetClient.<span class="me1">disconnect</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; <span class="kw2">private</span> <span class="kw2">static</span> <span class="kw2">class</span> TimeoutSockectFactory <span class="kw2">implements</span> SocketFactory<br />
&nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a> createSocket<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">String</span></a> hostname, <span class="kw4">int</span> port<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a> socket = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; socket.<span class="me1">connect</span><span class="br0">&#40;</span><span class="kw2">new</span> InetSocketAddress<span class="br0">&#40;</span>hostname, port<span class="br0">&#41;</span>, <span class="nu0">1000</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; <span class="kw2">return</span> socket;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a> createSocket<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AInetAddress+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">InetAddress</span></a> hostAddress, <span class="kw4">int</span> port<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a> socket = <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; socket.<span class="me1">connect</span><span class="br0">&#40;</span><span class="kw2">new</span> InetSocketAddress<span class="br0">&#40;</span>hostAddress, port<span class="br0">&#41;</span>, <span class="nu0">1000</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; <span class="kw2">return</span> socket;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a> createSocket<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">String</span></a> remoteHost, <span class="kw4">int</span> remotePort, <a href="http://www.google.com/search?q=allinurl%3AInetAddress+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">InetAddress</span></a> localAddress, <span class="kw4">int</span> localPort<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a> createSocket<span class="br0">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AInetAddress+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">InetAddress</span></a> remoteAddress, <span class="kw4">int</span> remotePort, <a href="http://www.google.com/search?q=allinurl%3AInetAddress+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">InetAddress</span></a> localAddress, <span class="kw4">int</span> localPort<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3ASocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">Socket</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3AServerSocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">ServerSocket</span></a> createServerSocket<span class="br0">&#40;</span><span class="kw4">int</span> port<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3AServerSocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">ServerSocket</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3AServerSocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">ServerSocket</span></a> createServerSocket<span class="br0">&#40;</span><span class="kw4">int</span> port, <span class="kw4">int</span> backlog<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3AServerSocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">ServerSocket</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.google.com/search?q=allinurl%3AServerSocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">ServerSocket</span></a> createServerSocket<span class="br0">&#40;</span><span class="kw4">int</span> port, <span class="kw4">int</span> backlog, <a href="http://www.google.com/search?q=allinurl%3AInetAddress+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">InetAddress</span></a> bindAddress<span class="br0">&#41;</span> <span class="kw2">throws</span> <a href="http://www.google.com/search?q=allinurl%3AIOException+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">IOException</span></a><br />
&nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">new</span> <a href="http://www.google.com/search?q=allinurl%3AServerSocket+java.sun.com&amp;bntl=1" onclick="javascript:urchinTracker ('/outbound/article/www.google.com');"><span class="kw3">ServerSocket</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div>
</div>
<p>Tags: <a href="http://technorati.com/tag/java" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">java</a>, <a href="http://technorati.com/tag/apache" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');"> apache</a>, <a href="http://technorati.com/tag/commons" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');"> commons</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/java/132/connection-timeouts-with-the-apache-commons-telnetclient/feed/</wfw:commentRss>
		</item>
		<item>
		<title>10 Tips For Creating Good Looking Diagrams Using Inkscape</title>
		<link>http://www.ioncannon.net/utilities/123/10-tips-for-creating-good-looking-diagrams-using-inkscape/</link>
		<comments>http://www.ioncannon.net/utilities/123/10-tips-for-creating-good-looking-diagrams-using-inkscape/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 13:58:07 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/utilities/123/10-tips-for-creating-good-looking-diagrams-using-inkscape/</guid>
		<description><![CDATA[After multiple attempts to find a good free diagraming application I think I have found a decent solution. I&#039;m not creating enough diagrams to justify buying something expensive and I don&#039;t feel like finding a graphics designer to make Dia diagrams prettier. If you have a Mac you are probably not in as bad a [...]]]></description>
			<content:encoded><![CDATA[<p>After multiple attempts to find a good free diagraming application I think I have found a decent solution. I&#039;m not creating enough diagrams to justify buying something expensive and I don&#039;t feel like finding a graphics designer to make <a href="http://www.gnome.org/projects/dia/" onclick="javascript:urchinTracker ('/outbound/article/www.gnome.org');">Dia</a> diagrams prettier. If you have a Mac you are probably not in as bad a situation since you can buy <a href="http://www.omnigroup.com/applications/omnigraffle/" onclick="javascript:urchinTracker ('/outbound/article/www.omnigroup.com');">OmniGraffle</a> for $79. But for those of us without a Mac or who are just very cheap I think the best solution starts with <a href="http://www.inkscape.org/" onclick="javascript:urchinTracker ('/outbound/article/www.inkscape.org');">Inkscape</a>. I&#039;ve put together a list of 10 tips that will help make better looking diagrams with Inkscape.</p>
<p><span id="more-123"></span></p>
<p>You will want to <a href="http://www.inkscape.org/download/" onclick="javascript:urchinTracker ('/outbound/article/www.inkscape.org');">download Inkscape</a> first. They have binaries for Linux, Windows and Mac OS X so it should be easy enough to get it installed. After installing Inkscape it is a good idea to browse their tutorials via the help->tutorials menu.</p>
<p><strong>1. Find a good color scheme</strong></p>
<p>
This is one of the most important things you need to do. You don&#039;t want the boring black and white diagrams, you want something that has a little color to it. You can use a <a href="http://wellstyled.com/tools/colorscheme2/index-en.html" onclick="javascript:urchinTracker ('/outbound/article/wellstyled.com');">color picker</a> or you can check out <a href="http://www.colourlovers.com/" onclick="javascript:urchinTracker ('/outbound/article/www.colourlovers.com');">colourlovers.com</a> where people vote on different schemes. I like colourlovers.com because they take items like <a href="http://www.colourlovers.com/blog/2007/07/05/fruit-basket-colors/" onclick="javascript:urchinTracker ('/outbound/article/www.colourlovers.com');">fruit baskets</a> and convert those into schemes.</p>
<p>I&#039;m using the following color scheme for the examples here:</p>
<p><center><img src="http://static.ioncannon.net/inkscape-examples/bowl_of_oranges.png"/></center><br/><br/>
</p>
<p><strong>2. Use all of the space</strong></p>
<p>
Don&#039;t be afraid to use the sides of the screen as a scratch pad. This comes in handy when you want to create smaller images to use in the main drawing area. When you are ready to export you can export just the &#034;page&#034; and you won&#039;t see the outside area in the final result.</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/scratch.jpg"/><br/><br/>
</p>
<p><strong>3. Learn the hot keys</strong></p>
<p>
Learning the hot keys will speed up your drawing. The following hot keys are the ones I use the most:</p>
<ul>
<li>group - Ctrl-G</li>
<li>un-group - Ctrl-Shift-G</li>
<li>create square - F4</li>
<li>create circle - F5</li>
<li>create polygons - *</li>
<li>transform - F1</li>
</ul>
<p><strong>4. Use zoom to work close in then zoom out and scale</strong></p>
<p>
I use the zoom function to find a blank area in the &#034;scratch pad&#034; when I want to assemble a shape that may require fine tuning. Since this is a vector drawing it is easy to resize the item later and place it in the correct place after returning to the normal zoom.
</p>
<p><strong>5. Learn how to using masking to make simple shapes</strong></p>
<p>
You can build complex shapes using different simple shapes with path set operations (see the path menu and the advanced tutorial). Here is an example of what a difference operation can create:</p>
<p>First draw a square:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/shape1.jpg"/><br/><br/></p>
<p>Then draw a circle:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/shape2.jpg"/><br/><br/></p>
<p>Then put the circle over the square:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/shape3.jpg"/><br/><br/></p>
<p>Now highlight both the circle and the square:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/shape4.jpg"/><br/><br/></p>
<p>And finally hit Ctrl--:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/shape5.jpg"/><br/><br/>
</p>
<p><strong>6. Don&#039;t use the connectors tool</strong><br/></p>
<p>
I started out trying to use the connectors tool to connect the objects. I found that the tool didn&#039;t work very well because the connections don&#039;t lay themselves out. If you really want any type of bend you are out of luck. They do bend when you click the layout button but they are almost always too close to the objects.</p>
<p>I found that it wasn&#039;t that hard to just use the polygon tool to draw the lines after I finished laying out the objects. When using the polygon tool don&#039;t add the end markers to the lines however because changing the color of the lines doesn&#039;t change the color of the markers (see step #7). I&#039;ve also found that adjusting the transparency of the lines makes for a better look.
</p>
<p><strong>7. Create your own markers</strong></p>
<p>
As I said in step 6 you will want to create your own markers. For one the <a href="http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Attributes-Stroke.html#Attributes-Stroke-Markers" onclick="javascript:urchinTracker ('/outbound/article/tavmjong.free.fr');">attributes of a line don&#039;t carry over to the marker</a> so you need them to be separate objects. After you create your marker zoom to the end of the line to do the alignment. I found that it isn&#039;t<br />
that hard to align the markers once you have them created. Then use the group function to group the markers with the lines.
</p>
<p><strong>8. Overlay text on a color to go over lines.</strong></p>
<p>
The easiest way I have found to overlay the text on the lines is to first create a box the same color as the background of the drawing. After you create the box you will need to force it down using the <img src="http://static.ioncannon.net/inkscape-examples/forcedown.jpg"/> button. Now that you have a box create your text and lay it over the box. Adjust the size of the box so the entire text is inside of it and then group the box and the text together as one unit. Now you can just place the resulting unit over the line.</p>
<p><center><img src="http://static.ioncannon.net/inkscape-examples/textoverlay.jpg"/></center><br/><br/>
</p>
<p><strong>9. Outline your objects</strong></p>
<p>
Outlining your objects seems to make them pop a little more. I also reduce the transparency a little to allow any text on top of the object to stand out. You will want to consult your color scheme to figure out what two colors to use for the fill and outline. </p>
<p><center><img src="http://static.ioncannon.net/inkscape-examples/outlined.jpg"/></center><br/><br/>
</p>
<p><strong>10. Import SVG graphics</strong></p>
<p>
I think if I had a pen tablet I could probably draw some more complicated objects but there is no way I could draw everything I might need. Luckily there are a number of sources you can use to get SVG graphics. A number of places sell their art in SVG format and there are a few open source or free sources of clip art/icons. The source I have been using is <a href="http://openclipart.org" onclick="javascript:urchinTracker ('/outbound/article/openclipart.org');">openclipart.org</a> (one note on this site is that they are moving to new equipment and I had to use archive.org to <a href="">download the latest open source clipart archive</a>). Another option is to convert a raster image into SVG and then import it that way. You can then use free icons like the <a href="http://www.famfamfam.com/" onclick="javascript:urchinTracker ('/outbound/article/www.famfamfam.com');">famfamfam icons</a> in your diagrams. Although converting to SVG this way works it is best to find images that are sourced directly to SVG from their drawing.</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/import.jpg"/><br/><br/>
</p>
<p><strong>Bonus Tip - How to add drop shadows</strong></p>
<p>
Someone asked if you could do drop shadows and it looks like you can by using the <a href="http://wiki.inkscape.org/wiki/index.php/ReleaseNotes045#SVG_filters:_Gaussian_blur" onclick="javascript:urchinTracker ('/outbound/article/wiki.inkscape.org');">Gaussian Blur</a>. This can make things look better too but you can&#039;t use transparent objects when you do this. After redoing the example I decided I liked the drop shadows better so I&#039;ve included it here.</p>
<p>The first thing is to copy the object you want to have the drop shadow for:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/drop1.jpg"/><br/><br/></p>
<p>Next you want to change the color of the copy to black and set the blur to 10 or so:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/drop2.jpg"/><br/><br/></p>
<p>Now you send the object to the background:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/drop3.jpg"/><br/><br/></p>
<p>And last you align the object a little bit offset from the original:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/drop4.jpg"/><br/><br/></p>
<p>Here is the final result:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/example-dropshadow.png"/><br/><br/></p>
<p>And another copy of the SVG: <a href="http://static.ioncannon.net/inkscape-examples/example-dropshadow.svg" >dropshadow example</a>
</p>
<p>I wanted to see if I could use these tips to create a diagram that looks similar to what is on the OmniGraffle page. Here is the result of that:</p>
<p><img src="http://static.ioncannon.net/inkscape-examples/example.png"/><br/><br/></p>
<p>Good luck and I hope this keeps your next diagram from <a href="http://www.presentationzen.com/presentationzen/2005/10/fema_chart_beco.html" onclick="javascript:urchinTracker ('/outbound/article/www.presentationzen.com');">becoming a joke</a>.</p>
<p>Here are a couple links so you can download the <a href="http://static.ioncannon.net/inkscape-examples/example.svg" >example SVG</a> and the <a href="http://static.ioncannon.net/inkscape-examples/cloud.svg" >cloud SVG</a> if you want.</p>
<p>Tags: <a href="http://technorati.com/tag/inkscape" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">inkscape</a>, <a href="http://technorati.com/tag/diagram" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');"> diagram</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/utilities/123/10-tips-for-creating-good-looking-diagrams-using-inkscape/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to create a Fedora 7 Instance for EC2</title>
		<link>http://www.ioncannon.net/linux/128/how-to-create-a-fedora-7-instance-for-ec2/</link>
		<comments>http://www.ioncannon.net/linux/128/how-to-create-a-fedora-7-instance-for-ec2/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 15:38:34 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[ec2]]></category>

		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/128/how-to-create-a-fedora-7-instance-for-ec2/</guid>
		<description><![CDATA[Now that Fedora 7 is out I figured it was time to update the EC2 instance howto. It is almost exactly the same as creating a FC6 instance so if you want to know the details you can reference that article.

Here is an updated script for creating the AMI the only change between this and [...]]]></description>
			<content:encoded><![CDATA[<p>Now that Fedora 7 is out I figured it was time to update the EC2 instance howto. It is almost exactly the same as <a href="http://www.ioncannon.net/system-administration/115/creating-your-own-fc6-instance-for-ec2/" >creating a FC6 instance</a> so if you want to know the details you can reference that article.</p>
<p><span id="more-128"></span></p>
<p>Here is an updated script for creating the AMI the only change between this and the one for FC6 is the yum repo and the image name:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="co1">#!/bin/sh</span></p>
<p>dd <span class="re2">if=</span>/dev/zero <span class="re2">of=</span>fedora7-i386.img <span class="re2">bs=</span>1M <span class="re2">count=</span><span class="nu0">1</span> <span class="re2">seek=</span><span class="nu0">1024</span><br />
/sbin/mke2fs -F -j fedora7-i386.img</p>
<p>mount -o loop fedora7-i386.img /mnt</p>
<p>mkdir /mnt/dev<br />
mkdir /mnt/proc<br />
mkdir /mnt/etc<br />
<span class="kw1">for</span> i <span class="kw1">in</span> console null zero ; <span class="kw1">do</span> /sbin/MAKEDEV -d /mnt/dev -x <span class="re1">$i</span> ; <span class="kw1">done</span></p>
<p>cat &lt;&lt;EOL &gt; /mnt/etc/fstab<br />
/dev/sda1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ext3&nbsp; &nbsp; defaults <span class="nu0">1</span> <span class="nu0">1</span><br />
none&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /dev/pts&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; devpts&nbsp; <span class="re2">gid=</span><span class="nu0">5</span>,<span class="re2">mode=</span><span class="nu0">620</span> <span class="nu0">0</span> <span class="nu0">0</span><br />
none&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /dev/shm&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmpfs&nbsp; &nbsp;defaults <span class="nu0">0</span> <span class="nu0">0</span><br />
none&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /proc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proc&nbsp; &nbsp; defaults <span class="nu0">0</span> <span class="nu0">0</span><br />
none&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /sys&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sysfs&nbsp; &nbsp;defaults <span class="nu0">0</span> <span class="nu0">0</span><br />
/dev/sda2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/mnt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ext3&nbsp; &nbsp; defaults <span class="nu0">1</span> <span class="nu0">2</span><br />
/dev/sda3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;swap&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; swap&nbsp; &nbsp; defaults <span class="nu0">0</span> <span class="nu0">0</span><br />
EOL</p>
<p>mount -t proc none /mnt/proc</p>
<p>cat &lt;&lt;EOL &gt; /tmp/yumec2.conf<br />
<span class="br0">&#91;</span>main<span class="br0">&#93;</span><br />
<span class="re2">cachedir=</span>/var/cache/yum<br />
<span class="re2">debuglevel=</span><span class="nu0">2</span><br />
<span class="re2">logfile=</span>/var/log/yum.log<br />
<span class="re2">exclude=</span>*-debuginfo<br />
<span class="re2">gpgcheck=</span><span class="nu0">0</span><br />
<span class="re2">obsoletes=</span><span class="nu0">1</span><br />
<span class="re2">reposdir=</span>/dev/null</p>
<p><span class="br0">&#91;</span>base<span class="br0">&#93;</span><br />
<span class="re2">name=</span>Fedora Core <span class="nu0">6</span> - i386 - Base<br />
<span class="re2">mirrorlist=</span>http://mirrors.fedoraproject.org/mirrorlist?<span class="re2">repo=</span>fedora-<span class="nu0">7</span>&amp;<span class="re2">arch=</span>i386<br />
<span class="re2">enabled=</span><span class="nu0">1</span></p>
<p><span class="br0">&#91;</span>updates-released<span class="br0">&#93;</span><br />
<span class="re2">name=</span>Fedora Core <span class="nu0">6</span> - i386 - Released Updates<br />
<span class="re2">mirrorlist=</span>http://mirrors.fedoraproject.org/mirrorlist?<span class="re2">repo=</span>updates-released-f7&amp;<span class="re2">arch=</span>i386<br />
<span class="re2">enabled=</span><span class="nu0">1</span><br />
EOL</p>
<p>yum -c /tmp/yumec2.conf --<span class="re2">installroot=</span>/mnt -y groupinstall Base</p>
<p>yum -c /tmp/yumec2.conf --<span class="re2">installroot=</span>/mnt -y clean packages</p>
<p>mv /mnt/lib/tls /mnt/lib/tls-disabled</p>
<p>cat &lt;&lt;EOL &gt;&gt; /mnt/etc/rc.<span class="kw3">local</span><br />
<span class="kw1">if</span> <span class="br0">&#91;</span> ! -d /root/.ssh <span class="br0">&#93;</span> ; <span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; mkdir -p /root/.ssh<br />
&nbsp; &nbsp; &nbsp; &nbsp; chmod <span class="nu0">700</span> /root/.ssh<br />
<span class="kw1">fi</span><br />
<span class="co1"># Fetch public key using HTTP</span><br />
curl http://<span class="nu0">169</span>.<span class="nu0">254</span>.<span class="nu0">169</span>.<span class="nu0">254</span>/<span class="nu0">1</span>.<span class="nu0">0</span>/meta-data/public-keys/<span class="nu0">0</span>/openssl &gt; /tmp/my-key<br />
<span class="kw1">if</span> <span class="br0">&#91;</span> $? -eq <span class="nu0">0</span> <span class="br0">&#93;</span> ; <span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; cat /tmp/my-key &gt;&gt; /root/.ssh/authorized_keys<br />
&nbsp; &nbsp; &nbsp; &nbsp; chmod <span class="nu0">600</span> /root/.ssh/authorized_keys<br />
&nbsp; &nbsp; &nbsp; &nbsp; rm /tmp/my-key<br />
<span class="kw1">fi</span><br />
<span class="co1"># or fetch public key using the file in the ephemeral store:</span><br />
<span class="kw1">if</span> <span class="br0">&#91;</span> -e /mnt/openssh_id.pub <span class="br0">&#93;</span> ; <span class="kw1">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; cat /mnt/openssh_id.pub &gt;&gt; /root/.ssh/authorized_keys<br />
&nbsp; &nbsp; &nbsp; &nbsp; chmod <span class="nu0">600</span> /root/.ssh/authorized_keys<br />
<span class="kw1">fi</span><br />
EOL</p>
<p>cat &lt;&lt;EOL &gt;&gt; /mnt/etc/ssh/sshd_config<br />
UseDNS&nbsp; no<br />
PermitRootLogin without-password<br />
EOL</p>
<p>cat &lt;&lt;EOL &gt; /mnt/etc/sysconfig/network<br />
<span class="re2">NETWORKING=</span>yes<br />
<span class="re2">HOSTNAME=</span>localhost.localdomain<br />
EOL</p>
<p>cat &lt;&lt;EOL &gt; /mnt/etc/sysconfig/network-scripts/ifcfg-eth0<br />
<span class="re2">ONBOOT=</span>yes<br />
<span class="re2">DEVICE=</span>eth0<br />
<span class="re2">BOOTPROTO=</span>dhcp<br />
EOL</p>
<p>sync<br />
umount /mnt/proc<br />
umount /mnt</div>
</div>
<p>Tags: <a href="http://technorati.com/tag/ec2" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">ec2</a>, <a href="http://technorati.com/tag/fedora+7" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');"> fedora 7</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/linux/128/how-to-create-a-fedora-7-instance-for-ec2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgrading from FC6 to Fedora 7 with yum</title>
		<link>http://www.ioncannon.net/linux/68/upgrading-from-fc6-to-fedora7-with-yum/</link>
		<comments>http://www.ioncannon.net/linux/68/upgrading-from-fc6-to-fedora7-with-yum/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 10:32:57 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/linux/68/upgrading-from-fc6-to-fc7-with-yum/</guid>
		<description><![CDATA[Now that Fedora 7 has been release it is time to upgrade from that crusty old Fedora Core 6. Note that they have removed the &#034;Core&#034; from the name so a few things have changed with the paths used in yum. Last year I did a post on how to upgrade from FC5 to FC6 [...]]]></description>
			<content:encoded><![CDATA[<p>Now that Fedora 7 has been release it is time to upgrade from that crusty old Fedora Core 6. Note that they have removed the &#034;Core&#034; from the name so a few things have changed with the paths used in yum. Last year I did a post on how to <a href="http://www.ioncannon.net/system-administration/99/upgrade-fc5-to-fc6-with-yum/" >upgrade from FC5 to FC6</a> and this upgrade happened on the first box I used for that.</p>
<ol>
<li>Before you start see the note after these steps about checking for disk labels</li>
<li>yum update</li>
<li>yum clean all</li>
<li>I repeated update and clean all a second time to make sure everything got updated</li>
<li>I then ran the command:
<div class="codesnip-container" >
<div class="codesnip">rpm -Uhv http://download.fedora.redhat.com/pub/fedora/linux/releases/<span class="nu0">7</span>/Fedora/x86_<span class="nu0">64</span>/os/Fedora/fedora-release-<span class="nu0">7</span>-<span class="nu0">3</span>.noarch.rpm http://download.fedora.redhat.com/pub/fedora/linux/releases/<span class="nu0">7</span>/Fedora/x86_<span class="nu0">64</span>/os/Fedora/fedora-release-notes-<span class="nu0">7</span>.<span class="nu0">0</span>.<span class="nu0">0</span>-<span class="nu0">1</span>.noarch.rpm</div>
</div>
</li>
<li>I then found that I had to move fedora-development.repo and fedora-updates.repo out of /etc/yum.repos.d/ and replace them with fedora-development.repo.rpmnew and fedora-updates.repo.rpmnew. I also needed to remove a custom repo I had but no longer used so I didn&#039;t take time to figure out why it needed to be removed.</li>
<li>I then did a yum -y update and waited</li>
<li>After a good wait another X server was started so you may think about not doing the update while running under X. Luckily it was able to start on another console so all was ok. Now it was time for a reboot.</li>
<li>After the reboot I had to fix up some NVidia issues but overall it looks like it upgraded without a problem</li>
</ol>
<p>Notes on disk labels:</p>
<p>There are a few things listed in the release notes under <a href="http://docs.fedoraproject.org/release-notes/f7/en_US/sn-Installer.html#Upgrade-Related-Issues" onclick="javascript:urchinTracker ('/outbound/article/docs.fedoraproject.org');">Upgrade Related Issues</a>.</p>
<p>The first was to make sure all your drives have labels. You can do this by running the command &#034;/sbin/blkid&#034; and then checking that each line that is not part of the LVM system has a LABEL entry. If you need to add a label to a drive use the &#034;/sbin/e2label&#034; command and then edit your /etc/fstab to use the label on boot instead of the device.</p>
<div class="codesnip-container" >
<div class="codesnip">LABEL=/boot&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/boot&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ext3&nbsp; &nbsp; defaults&nbsp; &nbsp; &nbsp; &nbsp; <span class="nu0">1</span> <span class="nu0">2</span></div>
</div>
<p>You don&#039;t need to label LVM drives since the LVM keeps track of the drives it uses on its own. The only drive I had on a stock install that wasn&#039;t under the LVM was /boot and it had a label already.</p>
<p>After you upgrade they sugest running the following command and then upgrading anything that has a date before the upgrade date:</p>
<div class="codesnip-container" >
<div class="codesnip">rpm -qa --last &gt; RPMS_by_Install_Time.txt</div>
</div>
<p>Tags: <a href="http://technorati.com/tag/linux" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">linux</a>, <a href="http://technorati.com/tag/fedora" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');"> fedora</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/linux/68/upgrading-from-fc6-to-fedora7-with-yum/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lots of new releases this week</title>
		<link>http://www.ioncannon.net/uncategorized/127/lots-of-new-releases-this-week/</link>
		<comments>http://www.ioncannon.net/uncategorized/127/lots-of-new-releases-this-week/#comments</comments>
		<pubDate>Thu, 31 May 2007 15:04:00 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/127/lots-of-new-releases-this-week/</guid>
		<description><![CDATA[It seems like this week has been release week for &#034;web 2.0&#034; stuff. Facebook F8 went live last week. All kinds of apps have followed.
Google released Maplets, a mashup editor, and Google Gears
Mapquest released an updated mapquest API that uses actionscript.
The one thing I note in all of these new releases is the lack of [...]]]></description>
			<content:encoded><![CDATA[<p>It seems like this week has been release week for &#034;web 2.0&#034; stuff. <a href="http://developers.facebook.com/" onclick="javascript:urchinTracker ('/outbound/article/developers.facebook.com');">Facebook F8</a> went <a href="http://mashable.com/2007/05/24/facebook-f8-live/" onclick="javascript:urchinTracker ('/outbound/article/mashable.com');">live last week</a>. <a href="http://www.techcrunch.com/2007/05/27/picasa-style-online-photo-editing-with-f8-picnik/" onclick="javascript:urchinTracker ('/outbound/article/www.techcrunch.com');">All</a> <a href="http://mashable.com/2007/05/30/iqzone-facebook/" onclick="javascript:urchinTracker ('/outbound/article/mashable.com');">kinds</a> of apps have followed.</p>
<p>Google released <a href="http://googlesystem.blogspot.com/2007/05/bring-mashups-to-google-maps.html" onclick="javascript:urchinTracker ('/outbound/article/googlesystem.blogspot.com');">Maplets</a>, a <a href="http://www.googlemashups.com/" onclick="javascript:urchinTracker ('/outbound/article/www.googlemashups.com');">mashup editor</a>, and <a href="http://googlesystem.blogspot.com/2007/05/google-gears-offline-functionality-for.html" onclick="javascript:urchinTracker ('/outbound/article/googlesystem.blogspot.com');">Google Gears</a></p>
<p>Mapquest released an <a href="http://radar.oreilly.com/archives/2007/05/where_20_mapque.html" onclick="javascript:urchinTracker ('/outbound/article/radar.oreilly.com');">updated</a> <a href="http://company.mapquest.com/mqbs/4a.html" onclick="javascript:urchinTracker ('/outbound/article/company.mapquest.com');">mapquest API that uses actionscript</a>.</p>
<p>The one thing I note in all of these new releases is the lack of SOAP or enterprise related. Maybe it is just the current wave but most people seem to be embracing the less complicated API infrastructure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/uncategorized/127/lots-of-new-releases-this-week/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Anonymous functions in PHP</title>
		<link>http://www.ioncannon.net/uncategorized/126/anonymous-functions-in-php/</link>
		<comments>http://www.ioncannon.net/uncategorized/126/anonymous-functions-in-php/#comments</comments>
		<pubDate>Fri, 18 May 2007 14:17:26 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/uncategorized/126/anonymous-functions-in-php/</guid>
		<description><![CDATA[I ran into this and found it interesting. Someone has added support for anonymous functions in PHP.
With the patch you can now do stuff like:

$data = array&#40;&#034;zoo&#034;, &#034;orange&#034;, &#034;car&#034;, &#034;lemon&#034;, &#034;apple&#034;&#41;;
usort&#40;$data, function&#40;$a, $b&#41; &#123; return strcmp&#40;$a, $b&#41;; &#125;&#41;;
var_dump&#40;$data&#41;; # data is sorted alphabetically 
&#160;

Before you had to use a funky function generation call.
Tags: php
]]></description>
			<content:encoded><![CDATA[<p>I ran into this and found it interesting. Someone has added support for <a href="http://devzone.zend.com/node/view/id/2013" onclick="javascript:urchinTracker ('/outbound/article/devzone.zend.com');">anonymous functions in PHP</a>.</p>
<p>With the patch you can now do stuff like:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="re0">$data</span> = <a href="http://www.php.net/array" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">&#034;zoo&#034;</span>, <span class="st0">&#034;orange&#034;</span>, <span class="st0">&#034;car&#034;</span>, <span class="st0">&#034;lemon&#034;</span>, <span class="st0">&#034;apple&#034;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/usort" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span class="kw3">usort</span></a><span class="br0">&#40;</span><span class="re0">$data</span>, <span class="kw2">function</span><span class="br0">&#40;</span><span class="re0">$a</span>, <span class="re0">$b</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="kw1">return</span> <a href="http://www.php.net/strcmp" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span class="kw3">strcmp</span></a><span class="br0">&#40;</span><span class="re0">$a</span>, <span class="re0">$b</span><span class="br0">&#41;</span>; <span class="br0">&#125;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/var_dump" onclick="javascript:urchinTracker ('/outbound/article/www.php.net');"><span class="kw3">var_dump</span></a><span class="br0">&#40;</span><span class="re0">$data</span><span class="br0">&#41;</span>; <span class="co2"># data is sorted alphabetically </span><br />
&nbsp;</div>
</div>
<p>Before you had to use a funky function generation call.</p>
<p>Tags: <a href="http://technorati.com/tag/php" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/uncategorized/126/anonymous-functions-in-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>EC2 and NAT</title>
		<link>http://www.ioncannon.net/s3/125/ec2-and-nat/</link>
		<comments>http://www.ioncannon.net/s3/125/ec2-and-nat/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 12:57:42 +0000</pubDate>
		<dc:creator>carson</dc:creator>
		
		<category><![CDATA[ec2]]></category>

		<category><![CDATA[s3]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/s3/125/ec2-and-nat/</guid>
		<description><![CDATA[Amazon just added NAT to their EC2 service. It also sounds like they will be turning the old direct addressing scheme off soon. This is probably a step towards assigning static IPs to your hosts in EC2. It may even allow you to have EC2 instances with no external IP address at all. It makes [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon just added NAT to their EC2 service. It also sounds like they will be turning the old direct addressing scheme off soon. This is probably a step towards assigning static IPs to your hosts in EC2. It may even allow you to have EC2 instances with no external IP address at all. It makes sense to not use an external IP when all you are doing is processing data from S3 and then sticking it back into S3. You can read more about the NAT change <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=682" onclick="javascript:urchinTracker ('/outbound/article/developer.amazonwebservices.com');">here</a>.</p>
<p>Tags: <a href="http://technorati.com/tag/amazon" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">amazon</a>, <a href="http://technorati.com/tag/ec2" rel="tag" onclick="javascript:urchinTracker ('/outbound/article/technorati.com');">ec2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/s3/125/ec2-and-nat/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
