<?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>Vegard Hammerseth &#187; Computer</title>
	<atom:link href="http://vegard.hammerseth.com/category/computer/feed/" rel="self" type="application/rss+xml" />
	<link>http://vegard.hammerseth.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 26 May 2010 22:31:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ALL IN 1 HDD Docking (Unitek) in Linux</title>
		<link>http://vegard.hammerseth.com/2010/05/all-in-1-hdd-docking-unitek-in-linux/</link>
		<comments>http://vegard.hammerseth.com/2010/05/all-in-1-hdd-docking-unitek-in-linux/#comments</comments>
		<pubDate>Wed, 26 May 2010 22:31:37 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[adapter]]></category>
		<category><![CDATA[double]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[HDD]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[SATA]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[western digital]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=692</guid>
		<description><![CDATA[Since my external HDD`s adapter died and I found out that these Western Digital`s adapters are bad all over through Google. I threw the contoller away and bought a new instead of another faulty adapter. There were little information about this controller, but it has tons of features at a low cost. My main concern was support [...]]]></description>
			<content:encoded><![CDATA[<p>Since my external HDD`s adapter died and I found out that these Western Digital`s adapters are bad all over through Google. I threw the contoller away and bought a new instead of another faulty adapter. There were little information about this controller, but it has tons of features at a low cost. My main concern was support in Ubuntu, but I found some defuse info about Linux support after some heavy Googling. I gave it a shoot and this post is my blessing for it`s plug`n`play comparability with Linux. I can now use the WD SATA disk and an old IDE disk laying around!</p>
<p><a href="http://lh6.ggpht.com/_kHz6hsl_gy8/S_mzWgiCJKI/AAAAAAAAFaE/KSDX4iIoejc/all%20in%201%20hdd%20docking%20front.jpg"><img class="alignnone" title="Front" src="http://lh6.ggpht.com/_kHz6hsl_gy8/S_mzWgiCJKI/AAAAAAAAFaE/KSDX4iIoejc/all%20in%201%20hdd%20docking%20front.jpg" alt="" width="390" height="323" /></a> <a href="http://lh3.ggpht.com/_kHz6hsl_gy8/S_mzWGx1zWI/AAAAAAAAFaA/XMcDbWpyeTk/all%20in%201%20hdd%20docking%20top.jpg"><img class="alignnone" title="Front" src="http://lh3.ggpht.com/_kHz6hsl_gy8/S_mzWGx1zWI/AAAAAAAAFaA/XMcDbWpyeTk/all%20in%201%20hdd%20docking%20top.jpg" alt="" width="390" height="293" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2010/05/all-in-1-hdd-docking-unitek-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tech and photographing</title>
		<link>http://vegard.hammerseth.com/2010/03/this-weekends-links/</link>
		<comments>http://vegard.hammerseth.com/2010/03/this-weekends-links/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 19:42:23 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[metal]]></category>
		<category><![CDATA[RC]]></category>
		<category><![CDATA[rube goldberg machine]]></category>
		<category><![CDATA[sound]]></category>
		<category><![CDATA[su27]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=637</guid>
		<description><![CDATA[Rube Goldberg Machine version Unbelievable plane build and it`s movie Sound technology, listen to nearby planes pretty cool idea Snowplow youtube speed Photographing cotton Miniature New York Food landscape Make it smaller and become bigger Marion on Arduino Laser scissors Analog and Digital TV Signal Generation]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.youtube.com/watch?v=qybUFnY7Y8w">Rube Goldberg Machine version</a></p>
<p><a href="http://www.su27.de/seite1.htm">Unbelievable plane build</a> and it`s <a href="http://www.youtube.com/watch?v=6IKnZ_tkecU">movie</a></p>
<p><a href="http://www.scientificamerican.com/article.cfm?id=acoustic-vector-sensing">Sound technology, listen to nearby planes</a> pretty cool idea</p>
<p><a href="http://www.youtube.com/watch?v=tPg1ZMiC9pA">Snowplow</a></p>
<p><a href="http://www.youtube.com/my_speed">youtube speed</a></p>
<p><a href="http://weburbanist.com/2010/03/13/strange-miniature-worlds-of-cotton-sugar-and-spice/">Photographing cotton</a></p>
<p><a href="http://vimeo.com/9679622">Miniature New York</a></p>
<p><a href="http://www.moillusions.com/2008/06/carl-warners-food-landscapes-or.html">Food landscape</a></p>
<p><a href="http://www.willard-wigan.com/video.aspx">Make it smaller and become bigger</a></p>
<p><a href="http://www.pcmag.com/article2/0,2817,2361357,00.asp">Marion on Arduino</a></p>
<p><a href="http://www.dealextreme.com/details.dx/sku.1584">Laser scissors</a></p>
<p><a href="http:/bellard.org/dvbt/">Analog and Digital TV Signal Generation</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2010/03/this-weekends-links/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Computer and Arduino controlled car (1:18)</title>
		<link>http://vegard.hammerseth.com/2010/02/computer-and-arduino-controlled-car-118/</link>
		<comments>http://vegard.hammerseth.com/2010/02/computer-and-arduino-controlled-car-118/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 20:02:47 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[RC]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[/dev/ttyUSB0]]></category>
		<category><![CDATA[1:18]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[c++ish]]></category>
		<category><![CDATA[car]]></category>
		<category><![CDATA[controlled]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=613</guid>
		<description><![CDATA[So I decided to make something with RC-servos using the Arduino board and the sensor shield which I recently purchased. I went ahead figuring out how to send arrow signals from my computer to Arduino using USB interface. Using void setup() { Serial.begin(9600); } on Arduino and screen /dev/ttyUSB0 9600 on my computer, I managed [...]]]></description>
			<content:encoded><![CDATA[<p>So I decided to make something with RC-servos using the Arduino board and the sensor shield which I recently purchased.</p>
<p>I went ahead figuring out how to send arrow signals from my computer to Arduino using USB interface.</p>
<p>Using <code>void setup() { Serial.begin(9600); }</code> on Arduino and <code>screen /dev/ttyUSB0 9600</code> on my computer, I managed to send commands back and forth. I hooked up the standard servo library and write some code before I mounted the Arduino board on my <a href="http://vegard.hammerseth.com/2009/05/team-losi-mini-rock-crawler-modifications/">mini rock crawler</a>. I now had a computer controlled car. Because of Arduino`s simple interface I had it all up and running around an hour. Check the small video and code below.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/BOP4Nkqgku8&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/BOP4Nkqgku8&amp;hl=en_US&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>You can view and or use the code as you like below. (Sorry about the indention, WordPress messes it up).</p>
<div style="background-color:#bfbfbf;">
//<br />
// LIBRARY<br />
//<br />
#include &lt;Servo.h&gt;</p>
<p>//<br />
// OBJ<br />
//<br />
Servo servo1;<br />
Servo servo2;</p>
<p>// VARS<br />
int readByte;<br />
int servo1Angle = 90;	  //default servo angle<br />
int servo2Angle = 90;</p>
<p>int minPulse     =  700;  // minimum servo position<br />
int maxPulse     =  2300; // maximum servo position </p>
<p>void setup()<br />
{<br />
  servo1.attach(2, minPulse, maxPulse);  //connect servo<br />
  servo2.attach(3, minPulse, maxPulse);</p>
<p>  Serial.begin(9600); // start serial<br />
  Serial.println(&#8220;Ready\n&#8221;);<br />
} </p>
<p>void loop()<br />
{<br />
  if (Serial.available() > 1) // procced when two bytes is avaiable<br />
  {<br />
    readByte; = Serial.read();  //read first byte<br />
    if (readByte; == 91)<br />
    {<br />
      readByte; = Serial.read(); //read second byte to determine arrow type<br />
      if (readByte; == 65 &#038;&#038; servo1Angle <= 180)      //UP<br />
      {<br />
        servo1Angle += 5;<br />
      }<br />
      else if(readByte; == 66 &#038;&#038; servo1Angle >= 0)  //DOWN<br />
      {<br />
        servo1Angle -= 5;<br />
      }<br />
      else if(readByte; == 67 &#038;&#038; servo2Angle <= 180)  //RIGHT<br />
      {<br />
        servo2Angle += 5;<br />
      }<br />
      else if(readByte; == 68 &#038;&#038; servo2Angle >= 0) //LEFT<br />
      {<br />
        servo2Angle -= 5;<br />
      }</p>
<p>    }<br />
  }<br />
  // set servo positions<br />
  servo1.write(servo1Angle);<br />
  servo2.write(servo2Angle);<br />
  delay(15);<br />
}
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2010/02/computer-and-arduino-controlled-car-118/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Re wounding a brush less mini motor</title>
		<link>http://vegard.hammerseth.com/2009/11/re-wounding-a-brush-less-mini-motor/</link>
		<comments>http://vegard.hammerseth.com/2009/11/re-wounding-a-brush-less-mini-motor/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 00:02:32 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Hobby]]></category>
		<category><![CDATA[RC]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[brush less]]></category>
		<category><![CDATA[copper]]></category>
		<category><![CDATA[hyperion]]></category>
		<category><![CDATA[micro]]></category>
		<category><![CDATA[mini]]></category>
		<category><![CDATA[motor]]></category>
		<category><![CDATA[small]]></category>
		<category><![CDATA[wire]]></category>
		<category><![CDATA[wound]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=595</guid>
		<description><![CDATA[After running this motor to hard outside, I managed to burn the motor. You can see pictures of the &#8220;burnt&#8221; motor in the gallery below. First of all I opened the motor to take a look noticing protective isolation layer on the copper were melted. Not so strange, because when I approaced the motor after [...]]]></description>
			<content:encoded><![CDATA[<p>After running this motor to hard outside, I managed to burn the motor. You can see pictures of the &#8220;burnt&#8221; motor in the gallery below.</p>
<p>First of all I opened the motor to take a look noticing protective isolation layer on the copper were melted. Not so strange, because when I approaced the motor after the plane fell from the sky, it was insane hot.</p>
<p>Before removing all wire I measured the wire diameter to 0,30mm. I found this king of wire inside very small tranformators in a computer power supply.</p>
<p>By using this picutre, found on <a href="http://www.southernsoaringclub.org.za/a-BM-motors-2.html">this pa</a>ge. I was able to re wound the motor.<br />
<img class="alignnone" title="9 polar" src="http://lh5.ggpht.com/_kHz6hsl_gy8/SwxIZsIKVGI/AAAAAAAAFFU/L8J5s1GbvWk/s576/3-9%20fase%20motor%20wire.JPG" alt="" width="346" height="331" /> <a href="http://lh5.ggpht.com/_kHz6hsl_gy8/SwxIX_w1zJI/AAAAAAAAFFM/ke0V3_ARHCM/s1024/re-wonded%20four%20poles.JPG"><img class="alignnone" title="Four" src="http://lh5.ggpht.com/_kHz6hsl_gy8/SwxIX_w1zJI/AAAAAAAAFFM/ke0V3_ARHCM/s1024/re-wonded%20four%20poles.JPG" alt="" width="410" height="231" /></a></p>
<p>I actually did wound all the poles at the same time, well, one by one, but all three wires were in use, if you follow.</p>
<p>After finish wounding I had to connect wires together to make only three wires, brush less motor has three out wires.</p>
<p>Since it`s a pretty fast motor I made a delta hookup, but I did a mistake at first. This motor should have around 195mOhm per 14-turn, maybe I did not mention it is a 14-turn motor. Which means each pole (there are nine here) needs 14 turns of isolated copper wire and in a small motor like this one, it`s not that easy. Anyway, by hooking up wrong end`s I broke a ESC of mine ($10) so I had to buy another one.</p>
<p>The motor works just great now and I might add a video later.</p>
<p><strong>Gallery</strong></p>
<table style="width:194px;">
<tr>
<td align="center" style="height:194px;background:url(http://picasaweb.google.no/s/c/transparent_album_background.gif) no-repeat left"><a href="http://picasaweb.google.no/v.hammerseth/FixingBrushlessMotor?feat=embedwebsite"><img src="http://lh3.ggpht.com/_kHz6hsl_gy8/SwxIOlxZa7E/AAAAAAAAFFY/15Ao78VtcuI/s160-c/FixingBrushlessMotor.jpg" width="160" height="160" style="margin:1px 0 0 4px;"></a></td>
</tr>
<tr>
<td style="text-align:center;font-family:arial,sans-serif;font-size:11px"><a href="http://picasaweb.google.no/v.hammerseth/FixingBrushlessMotor?feat=embedwebsite" style="color:#4D4D4D;font-weight:bold;text-decoration:none;">Fixing brushless motor</a></td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2009/11/re-wounding-a-brush-less-mini-motor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Frets On Fire on Ubuntu by making .deb package</title>
		<link>http://vegard.hammerseth.com/2009/11/installing-frets-on-fire-on-ubuntu-by-making-deb-package/</link>
		<comments>http://vegard.hammerseth.com/2009/11/installing-frets-on-fire-on-ubuntu-by-making-deb-package/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 18:47:06 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=589</guid>
		<description><![CDATA[sudo apt-get install dh-make mkdir fretsonfire-1.3.110 cd fretsonfire-1.3.110 dh_make -s -n cd debian rm *.ex *.EX mkdir fretsonfire mkdir fretsonfire/usr mkdir fretsonfire/usr/share Now download the game wget http://downloads.sourceforge.net/fretsonfire/FretsOnFire-1.3.110.tar.gz?use_mirror=osdn tar zxf FretsOnFire-1.3.110.tar.gz mv Frets\ on\ Fire-1.3.110/ fretsonfire/usr/share/fretsonfire rm -rf Frets\ on\ Fire-1.3.110/ FretsOnFire-1.3.110.tar.gz mkdir fretsonfire/DEBIAN pico control Make sure it look something like this Source: fretsonfire [...]]]></description>
			<content:encoded><![CDATA[<p><code>sudo apt-get install dh-make<br />
mkdir fretsonfire-1.3.110<br />
cd fretsonfire-1.3.110<br />
dh_make -s -n<br />
cd debian<br />
rm *.ex *.EX<br />
mkdir fretsonfire<br />
mkdir fretsonfire/usr<br />
mkdir fretsonfire/usr/share</code></p>
<p>Now download the game<br />
<code>wget http://downloads.sourceforge.net/fretsonfire/FretsOnFire-1.3.110.tar.gz?use_mirror=osdn<br />
tar zxf FretsOnFire-1.3.110.tar.gz<br />
mv Frets\ on\ Fire-1.3.110/ fretsonfire/usr/share/fretsonfire<br />
rm -rf Frets\ on\ Fire-1.3.110/ FretsOnFire-1.3.110.tar.gz</code></p>
<p><code>mkdir fretsonfire/DEBIAN<br />
pico control</code><br />
Make sure it look something like this<br />
<code>Source: fretsonfire<br />
Priority: optional<br />
Section: universe/games<br />
Maintainer: yourname <your@email><br />
Homepage: http://fretsonfire.sourceforge.net/<br />
Package: fretsonfire<br />
Architecture: all<br />
Version: 1.3.110<br />
Depends: python-pygame, python-opengl, python-numpy<br />
Description: Open source guitar game</code></p>
<p><code>cp control fretsonfire/DEBIAN/<br />
mkdir fretsonfire/usr/bin<br />
echo -e "#\!/bin/dash\ncd /usr/share/fretsonfire/src/\npython FretsOnFire.py" > fretsonfire/usr/bin/fretsonfire<br />
chmod +x fretsonfire/usr/bin/fretsonfire<br />
mkdir fretsonfire/usr/share/pixmaps</code></p>
<p># if the following image does not exist, find another one through google<br />
<code>wget http://www.freedownloadsplace.com/photo/Frets-on-Fire-1.png -O fretsonfire/usr/share/pixmaps/fretsonfire.png<br />
mkdir fretsonfire/usr/share/applications<br />
pico fretsonfire/usr/share/applications/fretsonfire.desktop</code><br />
Overwrite with this text<br />
<code>[Desktop Entry]<br />
Version=1.3.110<br />
Type=Application<br />
Name=Frets On Fire<br />
Comment=A opensourced guitar game<br />
Icon=fretsonfire<br />
Exec=fretsonfire<br />
Terminal=false<br />
Categories=Game;ArcadeGame;</code></p>
<p><code>cd ..<br />
dh_builddeb<br />
cd ..<br />
dpkg -i fretsonfire_1.3.110_all.deb</code></p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2009/11/installing-frets-on-fire-on-ubuntu-by-making-deb-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu network install (PXE)</title>
		<link>http://vegard.hammerseth.com/2009/10/ubuntu-network-install-pxe/</link>
		<comments>http://vegard.hammerseth.com/2009/10/ubuntu-network-install-pxe/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 23:11:03 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[netboot]]></category>
		<category><![CDATA[network install]]></category>
		<category><![CDATA[pxe]]></category>
		<category><![CDATA[tftp]]></category>
		<category><![CDATA[tftpd]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[xinitd]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=581</guid>
		<description><![CDATA[sudo apt-get install tftpd-hpa tftp-hpa xinetd dhcp3-server sudo pico /etc/xinetd.d/tftp Then write following service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = root server = /usr/sbin/in.tftpd server_args = /var/lib/tftpboot disable = no } Edit TFTP config sudo pico /etc/default/tftpd-hpa Make it look something like #Defaults for tftpd-hpa [...]]]></description>
			<content:encoded><![CDATA[<p><code>sudo apt-get install tftpd-hpa tftp-hpa xinetd dhcp3-server<br />
sudo pico /etc/xinetd.d/tftp</code></p>
<p>Then write following<br />
<code><br />
service tftp<br />
{<br />
protocol        = udp<br />
port            = 69<br />
socket_type     = dgram<br />
wait            = yes<br />
user            = root<br />
server          = /usr/sbin/in.tftpd<br />
server_args     = /var/lib/tftpboot<br />
disable         = no<br />
}<br />
</code></p>
<p>Edit TFTP config<br />
<code>sudo pico /etc/default/tftpd-hpa</code></p>
<p>Make it look something like<br />
<code><br />
#Defaults for tftpd-hpa<br />
RUN_DAEMON="yes"<br />
OPTIONS="-l -s /var/lib/tftpboot"<br />
</code></p>
<p>Create TFTP directory and get latest netboot image<br />
<code><br />
sudo mkdir /var/lib/tftpboot<br />
cd /var/lib/tftpboot<br />
sudo wget -np -r http://archive.ubuntu.com/ubuntu/dists/karmic/main/installer-i386/current/images/netboot/<br />
sudo mv archive.ubuntu.com/ubuntu/dists/karmic/main/installer-i386/current/images/netboot/* .<br />
sudo rm -rf archive.ubuntu.com<br />
</code></p>
<p>Now restart TFTPD<br />
<code>sudo /etc/init.d/tftpd-hpa restart</code></p>
<p>To check if running@<br />
<code>netstat -uap</code></p>
<p>For DHCP, make sure you have a fixed ip for your device<br />
<code>pico /etc/dhcp3/dhcpd.conf</code></p>
<p>I did use firestarter as a DHCP generator since I used my desktop as PXE-server.</p>
<p><code><br />
# DHCP configuration generated by Firestarter<br />
ddns-update-style interim;<br />
ignore client-updates;<br />
authoritative;</p>
<p>subnet 192.168.66.0 netmask 255.255.255.0 {<br />
        option routers 192.168.66.9;<br />
        option subnet-mask 255.255.255.0;<br />
        option domain-name-servers 130.67.60.68, 193.213.112.4;<br />
        option ip-forwarding off;<br />
        range dynamic-bootp 192.168.66.10 192.168.66.20;<br />
        default-lease-time 21600;<br />
        max-lease-time 43200;<br />
        next-server 192.168.66.9; # important for PXE<br />
        filename "pxelinux.0"; # important for PXE<br />
}<br />
</code></p>
<p>After the DHCP change we must restart DHCP<br />
<code>sudo /etc/init.d/dhcp3 restart</code></p>
<p>You should now be able to boot PXE of this machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2009/10/ubuntu-network-install-pxe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NES emulator written JavaScript!</title>
		<link>http://vegard.hammerseth.com/2009/10/nes-emulator-written-javascript/</link>
		<comments>http://vegard.hammerseth.com/2009/10/nes-emulator-written-javascript/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 15:51:39 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=567</guid>
		<description><![CDATA[http://benfirshman.com/projects/jsnes/ Speaks for itself.]]></description>
			<content:encoded><![CDATA[<p><a href="http://benfirshman.com/projects/jsnes/">http://benfirshman.com/projects/jsnes/</a></p>
<p>Speaks for itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2009/10/nes-emulator-written-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semilog graph render</title>
		<link>http://vegard.hammerseth.com/2009/09/semilog-graph-render/</link>
		<comments>http://vegard.hammerseth.com/2009/09/semilog-graph-render/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 21:16:46 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[high-pass]]></category>
		<category><![CDATA[low-pass]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[semilog]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=560</guid>
		<description><![CDATA[Ever since we had this laboratory task were we had to figure out which degree of filter (electronic), I couldn`t find a online semilog graph render for this task. It ended by doing it the old way. Print a sheet of semilog paper and manually plot values. I started writing a program for this myself, [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since we had this laboratory task were we had to figure out which degree of filter (electronic), I couldn`t find a online semilog graph render for this task. It ended by doing it the old way. Print a sheet of semilog paper and manually plot values. I started writing a program for this myself, but I didn`t finish it before now.</p>
<p>It`s still beta, but you can try it out at <a href="http://vegard.hammerseth.com/semilogrender/">http://vegard.hammerseth.com/semilogrender/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2009/09/semilog-graph-render/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.04 on MacBookPro5,3</title>
		<link>http://vegard.hammerseth.com/2009/08/ubuntu-904-on-macbookpro53/</link>
		<comments>http://vegard.hammerseth.com/2009/08/ubuntu-904-on-macbookpro53/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 20:56:30 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[5.3]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[jackalope]]></category>
		<category><![CDATA[januty]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[macbookpro]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[mbp]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=521</guid>
		<description><![CDATA[How I installed Ubuntu Jaunty Jackalope 9.04 on my MacBook Pro 5,3. After you have installed Ubuntu on your MBP and connected to internet. We need to add some lines in sources.list to be able to get special packages developed for apple products. WARNING: be carefull with all the &#8221; when pasting, they tend to [...]]]></description>
			<content:encoded><![CDATA[<p>How I installed Ubuntu Jaunty Jackalope 9.04 on my MacBook Pro 5,3.</p>
<p>After you have installed Ubuntu on your MBP and connected to internet. We need to add some lines in sources.list to be able to get special packages developed for apple products.</p>
<p><strong>WARNING: be carefull with all the &#8221; when pasting, they tend to change into a similar sign!</strong></p>
<p><strong>Update</strong><br />
<code>echo deb http://ppa.launchpad.net/mactel-support/ubuntu jaunty main | sudo tee -a /etc/apt/sources.list<br />
echo deb-src http://ppa.launchpad.net/mactel-support/ubuntu jaunty main | sudo tee -a /etc/apt/sources.list<br />
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 7A6BC20C4FE04DADD10837608DB7F87A2B97B7B8 (DONT WORK)</code></p>
<p><code>sudo apt-get update<br />
sudo apt-get upgrade<br />
</code></p>
<p>REBOOT (recommended)</p>
<p><strong>Get hardware packages</strong><br />
<code>sudo apt-get install mbp-nvidia-bl-dkms applesmc-dkms hal-applesmc bcm5974-dkms lm-sensors</code></p>
<p>Reboot if you want it to work right away or just continue below.</p>
<p><strong>Keyboard</strong><br />
<a href="https://help.ubuntu.com/community/AppleKeyboard">Apple keyboard</a> backlight and Fn-keys should now work.<br />
If you want to change the fn-usage buttons.</p>
<p><code>echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf<br />
sudo update-initramfs -u </code></p>
<p>I like to use gnome-do and usually use the Menu key for this. You will be prompted for next login, make sure you load the file.te<br />
<code>keycode 252 = Super_R<br />
echo keysym Super_R = Menu | tee -a .xmodmaprc</code></p>
<p>If you`re having problems getting the $ or brackets (and more) we need to do edit your keyboard layout. Go to Gnome menu -&gt; preferences -&gt; keyboard -&gt; layout and change keyboard model to apple and make sure you have the right layout selected.</p>
<p><strong>Sensors</strong><br />
For using sensors and fans we need to load apple modules:</p>
<p><code>echo coretemp | sudo tee -a /etc/modules<br />
echo applesmc | sudo tee -a /etc/modules</code></p>
<p>Reboot (optional).</p>
<p><strong>Caps lock</strong><br />
By default the green caps-lock does not work. ItÂ´s a easy fix.</p>
<p><code>sudo apt-get remove mouseemu</code></p>
<p><strong>Monitor</strong><br />
If you don`t like the way your MBP auto dim your screen, you can disable it.</p>
<p><code>gconftool -s /apps/gnome-power-manager/ambient/enable -t bool false</code></p>
<p><strong>Touchpad</strong><br />
To get multitouch we need to do a little trick.</p>
<p><code>echo bcm5974 | sudo tee -a /etc/modules<br />
echo usbhid | sudo tee -a /etc/modules<br />
echo blacklist usbhid | sudo tee -a /etc/modprobe.d/blacklist.conf</code></p>
<p>Open /etc/hal/fdi/policy/x11-synaptics-bcm5974.fdi and paste.<br />
<code>sudo gedit /etc/hal/fdi/policy/x11-synaptics-bcm5974.fdi</code></p>
<pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
&lt;deviceinfo version="0.2"&gt;
 &lt;device&gt;
  &lt;match key="info.capabilities" contains="input.touchpad"&gt;
   &lt;match key="info.product" contains="bcm5974"&gt;
   &lt;merge key="appledevice" type="bool"&gt;true&lt;/merge&gt;
   &lt;/match&gt;

   &lt;match key="appledevice" bool="true"&gt;
        &lt;merge key="input.x11_driver" type="string"&gt;synaptics&lt;/merge&gt;
        &lt;merge key="input.x11_options.SHMConfig" type="string"&gt;1&lt;/merge&gt;

        &lt;merge key="input.x11_options.FingerLow" type="string"&gt;40&lt;/merge&gt;
        &lt;merge key="input.x11_options.FingerHigh" type="string"&gt;70&lt;/merge&gt;
        &lt;merge key="input.x11_options.ClickFinger1" type="string"&gt;1&lt;/merge&gt;
        &lt;merge key="input.x11_options.ClickFinger2" type="string"&gt;3&lt;/merge&gt;
        &lt;merge key="input.x11_options.ClickFinger3" type="string"&gt;2&lt;/merge&gt;
        &lt;merge key="input.x11_options.TapButton1" type="string"&gt;1&lt;/merge&gt;
        &lt;merge key="input.x11_options.TapButton2" type="string"&gt;3&lt;/merge&gt;
        &lt;merge key="input.x11_options.TapButton3" type="string"&gt;2&lt;/merge&gt;

        &lt;merge key="input.x11_options.VertEdgeScroll" type="string"&gt;false&lt;/merge&gt;
        &lt;merge key="input.x11_options.HorizEdgeScroll" type="string"&gt;false&lt;/merge&gt;
        &lt;merge key="input.x11_options.VertTwoFingerScroll" type="string"&gt;1&lt;/merge&gt;
        &lt;merge key="input.x11_options.HorizTwoFingerScroll" type="string"&gt;1&lt;/merge&gt;

        &lt;merge key="input.x11_options.MinSpeed" type="string"&gt;0.5&lt;/merge&gt;
        &lt;merge key="input.x11_options.MaxSpeed" type="string"&gt;2.5&lt;/merge&gt;
        &lt;merge key="input.x11_options.AccelFactor" type="string"&gt;0.15&lt;/merge&gt;

        &lt;merge key="input.x11_options.PalmDetect" type="string"&gt;0&lt;/merge&gt;
        &lt;merge key="input.x11_options.PalmMinWidth" type="string"&gt;25&lt;/merge&gt;
        &lt;merge key="input.x11_options.PalmMinZ" type="string"&gt;250&lt;/merge&gt;
   &lt;/match&gt;
  &lt;/match&gt;
 &lt;/device&gt;
&lt;/deviceinfo&gt;</code></pre>
<p>Reboot (optional).</p>
<p><strong>Sound</strong><br />
Follow this recipe and your sound should work.</p>
<p><code><br />
sudo apt-get install linux-headers-generic linux-image-generic linux-restricted-modules-generic<br />
wget ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-unstable-snapshot.tar.gz<br />
tar xf alsa-driver-unstable-snapshot.tar.gz<br />
cd alsa-driver-unstable<br />
sudo ./configure --enable-dynamic-minors --with-cards="hda-intel" --with-oss<br />
sudo make<br />
sudo make install<br />
cd ..<br />
sudo rm -rf alsa-driver-unstable alsa-driver-unstable-snapshot.tar.gz</code></p>
<p>REBOOT (recommended)</p>
<p>Now, donÂ´t forget to unmute sound channels.</p>
<p>If youÂ´d want a automatic fan program, I wrote one in bash. It requires lm-sensors (installed above) to work. I will write it in C some day.<br />
<code>#!/bin/bash</code></p>
<p><code># we don`t want to go all the way up to critiacal temp, safe_temp is substracted from critical temp<br />
SAFE_TEMP=10</p>
<p># AUTOMATIC VALUES BELOW, DON`T EDIT</p>
<p># CPU critical temp<br />
CPU_CRIT=`cat /sys/devices/platform/coretemp.0/temp1_crit`</p>
<p># FAN SPEED<br />
FAN1_SPEED_MIN=`cat /sys/devices/platform/applesmc.768/fan1_min`<br />
FAN1_SPEED_MAX=`cat /sys/devices/platform/applesmc.768/fan1_max`<br />
FAN2_SPEED_MIN=`cat /sys/devices/platform/applesmc.768/fan2_min`<br />
FAN2_SPEED_MAX=`cat /sys/devices/platform/applesmc.768/fan2_max`<br />
CPU_CRIT=`expr "(" "$CPU_CRIT" "/" 1000 ")" "-" "$SAFE_TEMP"`</p>
<p>echo 1 &gt; /sys/devices/platform/applesmc.768/fan1_manual<br />
echo 1 &gt; /sys/devices/platform/applesmc.768/fan2_manual</p>
<p># dynamic values<br />
while [ 1 ]; do</p>
<p># CPU TEMPS<br />
CPU_TEMP0=`cat /sys/devices/platform/coretemp.0/temp1_input`<br />
CPU_TEMP1=`cat /sys/devices/platform/coretemp.1/temp1_input`<br />
CPU_TEMP=`expr "(" $CPU_TEMP0 + $CPU_TEMP1 ")" "/" 2000`</p>
<p># calculate<br />
FAN_SPEED=`expr "(" $CPU_TEMP "-" 34 ")" "*" 200`</p>
<p># if CPU reaches critical - SAFE_TEMP, shut off<br />
if [ "$CPU_TEMP" -gt "$CPU_CRIT" ]; then<br />
shutdown -h now<br />
fi</p>
<p># don`t go below min limit<br />
if [ "$FAN_SPEED" -le "$FAN1_SPEED_MIN" ]; then<br />
FAN_SPEED=$FAN1_SPEED_MIN;<br />
fi</p>
<p># don`t go above max limit<br />
if [ "$FAN_SPEED" -gt "$FAN1_SPEED_MAX" ]; then<br />
FAN_SPEED=$FAN1_SPEED_MAX;<br />
fi</p>
<p># only write if speed has changed<br />
if [ "$FAN_SPEED" != "$FAN_SPEED_OLD" ]; then<br />
#echo $CPU_TEMP $FAN_SPEED<br />
echo $FAN_SPEED &gt; /sys/devices/platform/applesmc.768/fan1_output<br />
echo $FAN_SPEED &gt; /sys/devices/platform/applesmc.768/fan2_output<br />
fi</p>
<p># store old speed<br />
FAN_SPEED_OLD=$FAN_SPEED;</p>
<p></code></p>
<p><code>sleep 5<br />
done<br />
</code></p>
<p><strong>Pommed</strong><br />
If you would like to install pommed on this machine at this time we have to modify pommed. I have notified creator of pommed about macbook5,3 support. If you have version above 1.27 you can skip this how to.</p>
<p><code>wget https://alioth.debian.org/frs/download.php/3084/pommed-1.27.tar.gz<br />
tar zxf pommed-1.27.tar.gz<br />
cd pommed-1.27/pommed/<br />
pico pommed-mpb5,3.patch</code></p>
<p>Then paste following.<br />
<code>--- pommed.c-old	2009-08-22 20:23:21.796989322 +0200<br />
+++ pommed.c	2009-08-22 20:22:42.270020918 +0200<br />
@@ -677,6 +677,7 @@<br />
* MacBook Pro 13" (June 2009) */<br />
else if ((strcmp(buf, "MacBookPro5,1") == 0)<br />
|| (strcmp(buf, "MacBookPro5,2") == 0)<br />
+           || (strcmp(buf, "MacBookPro5,3") == 0)<br />
|| (strcmp(buf, "MacBookPro5,5") == 0))<br />
ret = MACHINE_MACBOOKPRO_5;<br />
/* Core Duo MacBook (May 2006) */<br />
</code></p>
<p>Now apply the patch<br />
<code>patch -p0 &lt; pommed-mpb5,3.patch</code></p>
<p>Install required packages<br />
<code>sudo apt-get install pommed libdbus-1-dev libalsa-ocaml-dev libaudiofile-dev libconfuse-dev libpci-dev</code></p>
<p>Compile<br />
<code>cd ..<br />
make pommed<br />
sudo cp pommed/pommed /usr/sbin/pommed<br />
</code></p>
<p>Reboot.</p>
<p>Read additional info <a href="https://help.ubuntu.com/community/MacBookPro5-1_5-2/Jaunty">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2009/08/ubuntu-904-on-macbookpro53/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recruiting more people to IRC</title>
		<link>http://vegard.hammerseth.com/2009/07/recruiting-more-people-to-irc/</link>
		<comments>http://vegard.hammerseth.com/2009/07/recruiting-more-people-to-irc/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 16:12:58 +0000</pubDate>
		<dc:creator>Vegard</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Hobby]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[RC]]></category>
		<category><![CDATA[cgiirc]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[develop]]></category>
		<category><![CDATA[eggdrop]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tcl]]></category>

		<guid isPermaLink="false">http://vegard.hammerseth.com/?p=496</guid>
		<description><![CDATA[We are a few people on our IRC channel(s), talking and helping eachother about RC related stuff. The problem with IRC or should I say people, is their ability to turn on everything out of their knowledge. IRC can be tricky at first, but it gives you a nice playroom. To recruite people I had [...]]]></description>
			<content:encoded><![CDATA[<p>We are a few people on our IRC channel(s), talking and helping eachother about RC related stuff.</p>
<p>The problem with IRC or should I say people, is their ability to turn on everything out of their knowledge. IRC can be tricky at first, but it gives you a nice playroom.</p>
<p>To recruite people I had to find a simple way to connect people to IRC and join our channel. A quick google search found <a href="http://www.web-irc.org/">web-irc</a> linking to antoher site running <a href="http://www.google.no/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fcgiirc.org%2F&amp;ei=MbZpSuLQA5OF-Qbsn5SMCw&amp;usg=AFQjCNHTEUdsDOsoGmbNOgPxpreFH5UI_w&amp;sig2=ncyFMiK5SXZmg0QHifrACQ">CGIIRC.</a> It&#8217;s a client which runs on a webserver through your browser and can connect you directly to desired channel. When people get used and addicted to IRC, they will install a decent client locally.</p>
<p>My next step was to get people interested. A way of doing this is by giving them some of our conversations and not just a few, but the latest conversations. By doing this, people will (or should) get interested in connecting.</p>
<p>So, how will I give them our conversations? through a image. Because it&#8217;s the only way I can update anything on remote sites such as forums and not letting any one just copy our conversations.</p>
<p>I will now explain how I did it. I will assume you areÂ  a fellow geek and know what I&#8217;m talking about, if not, just google the unknown words.</p>
<p>To get latest conversations on our network I ran a eggdrop on our channel on logging modus. The eggdrop is running on the same server as my web server, making it easy to get the required text.</p>
<div style="background-color:#bfbfbf">$file = &#8220;../../../eggdrop/logs/#rchobby.log&#8221;; // this is where my conversations are<br />
$r = $g = $b = 255;<br />
$lines = 8;<br />
$width = 600;<br />
$size = 10;<br />
$text = array();</p>
<p>/* read file and get number of wanted lines */<br />
foreach (array_slice(file($file),-$lines) as $x)<br />
{<br />
$x = str_replace(&#8220;&lt;motor&gt; (EFnet) &#8220;,&#8221;",$x); // have to remove some crap since we have linked networks<br />
$x = preg_replace(&#8220;/^\[(\d{2})\:(\d{2})\] &lt;(.*)&gt;/&#8221;,&#8221;[\\1:\\2] (\\3)&#8221;,$x); // custom display format<br />
$x = utf8_encode($x); // to support norwegian characters such as Ã¸ Ã¦ Ã¥<br />
/* split up long sentences to fit width*/<br />
$x = wordwrap($x,$width*0.15); // text can go utside the image, therefore we split it<br />
foreach (explode(&#8220;\n&#8221;,$x) as $y)<br />
{<br />
if (!empty($y))<br />
{<br />
$text[] = $y;<br />
}<br />
}<br />
}<br />
/* define image and background color */<br />
$image = imagecreate($width,count($text)*11); // create image object<br />
$bgColor = imagecolorallocate($image,$r,$g,$b); // set background color<br />
/* print text with desired font */<br />
$x = $size;<br />
foreach ($text as $line)<br />
{<br />
imagettftext($image,$size,0,0,$x,imagecolorallocate($image,0,0,0),&#8221;./ProFontWindows.ttf&#8221;,$line); // custom font<br />
$x += $size;<br />
}</p>
<p>imagettftext($image,25,-10,30,30,imagecolorallocatealpha($image,255,0,0,60),&#8221;./ProFontWindows.ttf&#8221;,&#8221;CLICK TO CHAT RC!&#8221;); // making it more professional, like a stamp</p>
<p>/* tell browser not to cache, conversation updates */<br />
header(&#8220;Cache-Control: no-store, no-cache, must-revalidate&#8221;);<br />
header(&#8220;Pragma: no-cache&#8221;);</p>
<p>/* send png image to browser */<br />
header(&#8220;Content-type: image/png&#8221;);<br />
imagepng($image);</p>
<p>?&gt;</p></div>
<p>Now we have a file that displays a image with a given number of lines, but what about customizing colours and number of lines? to match designs on different forums. The solution is simple.</p>
<p>If we add following after variable defining we should be set.</p>
<div style="background-color:#bfbfbf">/* custom color */<br />
if (isset($_GET['r']) &amp;&amp; is_numeric($_GET['r']) &amp;&amp; $_GET['r'] &gt;= 0 &amp;&amp; $_GET['r'] &lt;= 255)<br />
{<br />
$r = $_GET['r'];<br />
}<br />
if (isset($_GET['g']) &amp;&amp; is_numeric($_GET['g']) &amp;&amp; $_GET['g'] &gt;= 0 &amp;&amp; $_GET['g'] &lt;= 255)<br />
{<br />
$g = $_GET['g'];<br />
}<br />
if (isset($_GET['b']) &amp;&amp; is_numeric($_GET['b']) &amp;&amp; $_GET['b'] &gt;= 0 &amp;&amp; $_GET['b'] &lt;= 255)<br />
{<br />
$b = $_GET['r'];<br />
}</p>
<p>/* number of lines to display */<br />
if (isset($_GET['lines']) &amp;&amp; is_numeric($_GET['lines']) &amp;&amp; $_GET['lines'] &gt; 0 &amp;&amp; $_GET['lines'] &lt;= 100)<br />
{<br />
$lines = $_GET['lines'];<br />
}</p>
<p>/* image width */<br />
if (isset($_GET['width']) &amp;&amp; is_numeric($_GET['width']) &amp;&amp; $_GET['width'] &gt; 0 &amp;&amp; $_GET['width'] &lt;= 1280)<br />
{<br />
$width = $_GET['width'];<br />
}</p>
<p>/* font size */<br />
if (isset($_GET['size']) &amp;&amp; is_numeric($_GET['size']) &amp;&amp; $_GET['size'] &gt; 0)<br />
{<br />
$size = $_GET['size'];<br />
}</p></div>
<p>We&#8217;d want to make the image click able, linking it to our web based IRC client. We can also put it in the same file to make it simple and easy to maintain.</p>
<p>My complete program ended looking like this.</p>
<div style="background-color:#bfbfbf">&lt;?php<br />
/* we want to display image */<br />
if (isset($_GET['img']))<br />
{<br />
/* define vars */<br />
$file = &#8220;../../../eggdrop/logs/#rchobby.log&#8221;;<br />
if (!file_exists($file))<br />
{<br />
$file .= &#8220;.yesterday&#8221;;<br />
}<br />
$r = $g = $b = 255;<br />
$lines = 8;<br />
$width = 600;<br />
$size = 10;</p>
<p>/* custom color */<br />
if (isset($_GET['r']) &amp;&amp; is_numeric($_GET['r']) &amp;&amp; $_GET['r'] &gt;= 0 &amp;&amp; $_GET['r'] &lt;= 255)<br />
{<br />
$r = $_GET['r'];<br />
}<br />
if (isset($_GET['g']) &amp;&amp; is_numeric($_GET['g']) &amp;&amp; $_GET['g'] &gt;= 0 &amp;&amp; $_GET['g'] &lt;= 255)<br />
{<br />
$g = $_GET['g'];<br />
}<br />
if (isset($_GET['b']) &amp;&amp; is_numeric($_GET['b']) &amp;&amp; $_GET['b'] &gt;= 0 &amp;&amp; $_GET['b'] &lt;= 255)<br />
{<br />
$b = $_GET['r'];<br />
}</p>
<p>/* number of lines to display */<br />
if (isset($_GET['lines']) &amp;&amp; is_numeric($_GET['lines']) &amp;&amp; $_GET['lines'] &gt; 0 &amp;&amp; $_GET['lines'] &lt;= 100)<br />
{<br />
$lines = $_GET['lines'];<br />
}</p>
<p>/* image width */<br />
if (isset($_GET['width']) &amp;&amp; is_numeric($_GET['width']) &amp;&amp; $_GET['width'] &gt; 0 &amp;&amp; $_GET['width'] &lt;= 1280)<br />
{<br />
$width = $_GET['width'];<br />
}</p>
<p>/* font size */<br />
if (isset($_GET['size']) &amp;&amp; is_numeric($_GET['size']) &amp;&amp; $_GET['size'] &gt; 0)<br />
{<br />
$size = $_GET['size'];<br />
}<br />
$text = array();</p>
<p>/* read file and get number of wanted lines */<br />
foreach (array_slice(file($file),-$lines) as $x)<br />
{<br />
$x = str_replace(&#8220;&lt;motor&gt; (EFnet) &#8220;,&#8221;",$x);<br />
$x = preg_replace(&#8220;/^\[(\d{2})\:(\d{2})\] &lt;(.*)&gt;/&#8221;,&#8221;[\\1:\\2] (\\3)&#8221;,$x);<br />
$x = utf8_encode($x);</p>
<p>/* split up long sentences to fit width*/<br />
$x = wordwrap($x,$width*0.15);<br />
foreach (explode(&#8220;\n&#8221;,$x) as $y)<br />
{<br />
if (!empty($y))<br />
{<br />
$text[] = $y;<br />
}<br />
}<br />
}</p>
<p>/* define image and background color */<br />
$image = imagecreate($width,count($text)*11);<br />
$bgColor = imagecolorallocate($image,$r,$g,$b);</p>
<p>/* print text with desired font */<br />
$x = $size;<br />
foreach ($text as $line)<br />
{<br />
imagettftext($image,$size,0,0,$x,imagecolorallocate($image,0,0,0),&#8221;./ProFontWindows.ttf&#8221;,$line);<br />
$x += $size;<br />
}</p>
<p>imagettftext($image,25,-10,30,30,imagecolorallocatealpha($image,255,0,0,60),&#8221;./ProFontWindows.ttf&#8221;,&#8221;CLICK TO CHAT RC!&#8221;);</p>
<p>/* don&#8217;t cache */<br />
header(&#8220;Cache-Control: no-store, no-cache, must-revalidate&#8221;);<br />
header(&#8220;Pragma: no-cache&#8221;);</p>
<p>/* send image to browser */<br />
header(&#8220;Content-type: image/png&#8221;);<br />
imagepng($image);<br />
return;<br />
}</p>
<p>?&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;#rchobby @ quakenet connecter&lt;/title&gt;<br />
&lt;meta http-equiv=&#8221;content-type&#8221; content=&#8221;text/html; charset=UTF-8&#8243;/&gt;<br />
&lt;meta name=&#8221;description&#8221; content=&#8221;#rchobby on Quakenet.org&#8221;/&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;strong&gt;Want to chat? click and connect!&lt;/strong&gt;&lt;br /&gt;<br />
&lt;form method=&#8221;post&#8221; action=&#8221;http://portalzona.com/cgi-bin/cgiirc/irc.cgi&#8221;&gt;<br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;interface&#8221; value=&#8221;mozilla&#8221;&gt;<br />
Your nickname &lt;input type=&#8221;text&#8221; id=&#8221;nickname&#8221; name=&#8221;Nickname&#8221; value=&#8221;rchobby&lt;?php echo mt_rand(100,999); ?&gt;&#8221; /&gt;<br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;Server&#8221; value=&#8221;irc.quakenet.org&#8221; /&gt;<br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;Port&#8221; value=&#8221;6667&#8243; /&gt;<br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;Channel&#8221; value=&#8221;#rchobby&#8221; /&gt;<br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;Password&#8221; value=&#8221;" /&gt;<br />
&lt;input type=&#8221;submit&#8221; value=&#8221;CLICK TO CONNECT&#8221; /&gt;<br />
&lt;/form&gt;<br />
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;<br />
&lt;strong&gt;If you want to customize the image output, you can use following settings and copy image location.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;<br />
&lt;u&gt;Color settings for background&lt;/u&gt;&lt;br /&gt;<br />
&lt;form method=&#8221;get&#8221; action=&#8221;"&gt;<br />
Red &amp;nbsp; &amp;nbsp; &lt;input type=&#8221;text&#8221; name=&#8221;r&#8221; length=3 value=&#8221;&lt;?php echo (isset($_GET['r'])?$_GET['r']:255); ?&gt;&#8221; size=1 /&gt;&lt;br /&gt;<br />
Green &lt;input type=&#8221;text&#8221; name=&#8221;g&#8221; length=3 value=&#8221;&lt;?php echo (isset($_GET['g'])?$_GET['g']:255); ?&gt;&#8221; size=1 /&gt;&lt;br /&gt;<br />
Blue &amp;nbsp;&amp;nbsp; &lt;input type=&#8221;text&#8221; name=&#8221;b&#8221; length=3 value=&#8221;&lt;?php echo (isset($_GET['b'])?$_GET['b']:255); ?&gt;&#8221; size=1 /&gt;&lt;br /&gt;<br />
&lt;br /&gt;<br />
&lt;u&gt;Text settings&lt;/u&gt;&lt;br /&gt;<br />
Font size &lt;input type=&#8221;text&#8221; name=&#8221;size&#8221; length=2 value=&#8221;&lt;?php echo (isset($_GET['size'])?$_GET['size']:10); ?&gt;&#8221; size=1 /&gt; pixels&lt;br /&gt;<br />
Image width &lt;input type=&#8221;text&#8221; name=&#8221;width&#8221; length=4 value=&#8221;&lt;?php echo (isset($_GET['width'])?$_GET['width']:600); ?&gt;&#8221; size=2 /&gt; pixels&lt;br /&gt;<br />
Numer of lines &lt;input type=&#8221;text&#8221; name=&#8221;lines&#8221; length=3 value=&#8221;&lt;?php echo (isset($_GET['lines'])?$_GET['lines']:8); ?&gt;&#8221;Â  size=1 /&gt;&lt;br /&gt;<br />
&lt;input type=&#8221;submit&#8221; value=&#8221;Display&#8221; /&gt;<br />
&lt;/form&gt;<br />
&lt;img src=&#8221;rchobby.php?img&amp;&lt;?php foreach ($_GET as $key=&gt;$val) { echo &#8220;$key=$val&amp;&#8221;; } ?&gt;&#8221; alt=&#8221;" /&gt;<br />
&lt;script type=&#8221;text/javascript&#8221;&gt;document.getElementById(&#8216;nickname&#8217;).focus();&lt;/script&gt;<br />
&lt;/body&gt;</p></div>
<p>This is the result<br />
<a href="http://vegard.hammerseth.com/etc/radiostyrt.php"><img src="http://vegard.hammerseth.com/etc/radiostyrt.php?img&amp;r=248&amp;g=247&amp;b=246" alt="img" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://vegard.hammerseth.com/2009/07/recruiting-more-people-to-irc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
