<?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>Paul Chilton</title>
	<atom:link href="http://www.pchilton.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pchilton.co.uk</link>
	<description>electronics, programming, server administration</description>
	<lastBuildDate>Sun, 13 Nov 2011 21:05:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>VPN Setup With LT2P &amp; IPSEC</title>
		<link>http://www.pchilton.co.uk/2011/11/13/vpn-setup-with-lt2p-ipsec/</link>
		<comments>http://www.pchilton.co.uk/2011/11/13/vpn-setup-with-lt2p-ipsec/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 21:05:19 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Server Admin]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=224</guid>
		<description><![CDATA[For anyone who's tried to setup VPN it is without a doubt a "black art". The information given by most sites on the net is incomplete, incorrect and sometimes just plain stupid. We setup VPN a while back at work with PPTP and after an initial learning curve managed it relatively easily. We quickly learnt [...]]]></description>
			<content:encoded><![CDATA[<p>For anyone who's tried to setup VPN it is without a doubt a "black art". The information given by most sites on the net is incomplete, incorrect and sometimes just plain stupid. We setup VPN a while back at work with PPTP and after an initial learning curve managed it relatively easily. We quickly learnt that PPTP is not a very secure method to use and started to setup a L2TP/IPSec connection, this is where the fun really started!<br />
<span id="more-224"></span><br />
Here I will explain the difficulties and solutions we found for setting up PPTP and L2TP/IPsec VPN on Windows 2003 Server. We have a Windows 2003 server setup with two network adapters, one connected to a local private network, the other connected to a firewall and an ADSL internet connection. The server has NAT setup to translate packets for the internal network.</p>
<h2>PPTP</h2>
<p>First of all there was PPTP...</p>
<p>PPTP was fairly easy to setup but not without its own difficulties!</p>
<h3>The first step was to setup the server:</h3>
<ul>
<li>Add the Routing and Remote Access Role with VPN.</li>
<li> In RAS (Routing and Remote Access), add a Policy to allow VPN access by adding a rule for Virtual (VPN) Port and granting the policy access. We also added a condition that limited the users able to logon to a specific "VPN Users" group.</li>
<li> Set the authentication methods you wish to use, we selected only MS-CHAP v2. Do this both in the VPN policy you just created and in the properties of the server in RAS (security tab).</li>
<li> In ports, select PPTP. Enable and enter a number of ports to allow at any one time.</li>
</ul>
<h3>Next setup the firewall/router to allow VPN traffic trough:</h3>
<p>Open the following ports on the firewall:</p>
<ul>
<li>TCP 1701 (PPTP)</li>
<li> IP Protocol 47 (GRE) - Note: Protocol NOT UDP or TCP</li>
</ul>
<h3>Setup the client PC to connect:</h3>
<ul>
<li>Create a VPN connection.</li>
<li> Enter the IP to connect to.</li>
<li> In TCP/IP properties within the VPN properties, go to Advanced and UN-check "Use default gateway on remote network", otherwise all your internet traffic will be routed through the VPN connection and there is no need for it (normally).</li>
<li> Enter the domain user credentials of someone with access to connect to VPN.</li>
<li> Windows XP users may need to start off with the Windows firewall disabled.</li>
</ul>
<p>Connect... Done! (maybe...)</p>
<p>This is where we came across our major head-scratcher with PPTP... It didn't work externally! Our first thought... the firewall! It had to be the firewall! After days and days of playing with different combinations and configurations we decided to swap to a different ADSL modem. Straight away, connected! The moral: don't eliminate anything; don't presume the modem will allow VPN traffic!</p>
<p>Tip: Always test the VPN connection from an internal connection (i.e. not through the router/modem) where possible before testing externally. If it doesn't work locally then you stand no chance from the outside world!</p>
<h2>L2TP</h2>
<p>Next there way L2TP...</p>
<p>L2TP with IPSec is much more secure than PPTP and is a better choice, however there is more to go wrong!</p>
<h3>Setup the server (presuming you already have PPTP working):</h3>
<ul>
<li> In the security tab (RAS, Server Properties) check the 'Allow custom IPSEC policy for L2TP connection' box and enter a passkey.</li>
<li> In ports select L2TP, enable it and enter the number of ports you would like to use.</li>
</ul>
<h3>Setup the firewall:</h3>
<p>Open the following ports on the firewall:</p>
<ul>
<li>IP Protocol 50</li>
<li> IP Protocol 51</li>
<li> UDP 4500 (NAT-T traffic)</li>
<li> UDP 500</li>
<li> UDP 1701 (L2TP)</li>
</ul>
<h3>Setup the client:</h3>
<ul>
<li>Copy your existing (working I hope) PPTP connection and edit it.</li>
<li> In the networking tab, select L2TP.</li>
<li> In IPSec setting, enter the pre-shared key you chose on the server.</li>
</ul>
<p>Connect... Does it work? Yes - Great, go home and take a break! No - Read on...</p>
<h3>Microsoft Windows Registry Fix</h3>
<p>Firstly there is the thing that Microsoft forgot to explain properly that you might have come across but weren't sure whether you needed to do it. In XP and Vista you need to add a key to the registry! Yes it's strange but true! This is where we wasted hours not getting things up and running.</p>
<ul>
<li> Open the registry editor (ask for help if you are not sure at this point!)</li>
<li> Navigate down to \Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\IPSec\ (on XP)</li>
<li> Navigate down to \Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent\ (on Vista)</li>
<li> Enter the following as a new DWORD value
<ul>
<li> AssumeUDPEncapsulationContextOnSendRule</li>
<li> Set the value to 2</li>
</ul>
</li>
<li> Reboot the computer (you must reboot for the change to take affect)</li>
</ul>
<p>Try connecting again, it may just work.</p>
<h2>Debugging</h2>
<p>If not then there are a few debugging tips that may help you figure out where the problem is. First you need to establish where the problem is.</p>
<h3>VPN Connection Stages</h3>
<p>Although the following isn't a complete list of stages that are performed when VPN connects it outlines the basic stages of connecting for these purposes:</p>
<ul>
<li>Host is looked up (DNS).</li>
<li> Client connects to server to establish an IPSec security association (SA) through Internet Key Exchange (IKE) on port 500.</li>
<li> IPSec Phase 1 (Main Mode) is established with IKE.</li>
<li> IPSec Phase 2 (Quick Mode) is established with IKE</li>
<li> Establish Encapsulating Security Payload (ESP) on protocol 50.</li>
<li> L2TP tunnel is established on UDP port 1701 between the SA endpoints.</li>
</ul>
<p>The first check is that the server IP address is correct, confirm by connecting via PPTP again (if this is working). Ping the server (if ping is let through the firewall). Confirm manually the IP address of the server.<br />
Next, evidence of the VPN connection (if it is reaching the server) can be seen in the system security event log. On the server open up the windows event log and clear the security log. Try connecting from the client and then refresh the log and look for a RemoteAccess entry. Check the details, this might be your connection.</p>
<p>If the connection is not seen in the eventlog check the firewall settings (at both ends). Check the RAS VPN policy and settings are correct.</p>
<p>If the connection is in the event log then it is reaching the server at least. There are now a few things that can be checked: Enable IKE logging, Check client SA is being established and debug packets being sent/received on the client and server.</p>
<h3>Enable IKE Logging</h3>
<p>On the Windows 2003 server, run the following to disable logging and free access to the log file:<br />
netsh ipsec dynamic set config ikelogging 0</p>
<p>Navigate to C:\WINDOWS\Debug\ and delete the Oakley.log file</p>
<p>Run:<br />
netsh ipsec dynamic set config ikelogging 1</p>
<p>Attempt to connect from the client.</p>
<p>Run:<br />
netsh ipsec dynamic set config ikelogging 0</p>
<p>Open the Oakley.log file in the C:\WINDOWS\Debug\ directory.</p>
<p>If there is no entries in the file (or it does not exist) then an IPSec connection request hasn't even started. If there is log entries then read through carefully and look for the two phases of IPSec (Main Mode and Quick Mode). If all is working, there should be entries stating that Phase 1 SA is accepted and Phase 2 SA is accepted. If there are errors in the log then these need to be looked up and fixed.</p>
<h3>Check client is establishing IPSec over IKE</h3>
<p>On the client open up MMC (run: mmc.exe). Add a snap-in and add the IP Security Monitor. Expand the Main mode and Quick mode tree to see the two SA folders. Open the properties for the client in the MMC console and set the auto-refresh to every 1 second. Now start to connect via VPN, watch to see if an entry appears in the Main Mode SA, if it does, check the Quick Mode SA. If an entry appears in here then IPSec is being established and probably isn't the problem. If not then check those IKE logs on the server again, something is not working here.</p>
<h3>Packet debugging</h3>
<p>Packet debugging can give a good indication of what is and what isn't happening during the VPN connection sequence. There are a few good packet analysis applications about but I use &lt;a href='http://www.wireshark.org/' target='_blank'&gt;Wireshark&lt;/a&gt;.</p>
<p>Install on one or both machines and start off listening on the network adapater that VPN is connecting out of on that machine. I also recomend filtering the packets based on the destination of the VPN server otherwise you'll get loads of extra packets and things get confusing fast!<br />
Enter: (ip.src == 1.2.3.4) || (ip.dst == 1.2.3.4) into the filter box (where 1.2.3.4 is the IP of the VPN server. If running Wireshark on the server, enter the IP of the host trying to connect (public IP if connecting across WAN).<br />
Then attempt to connect VPN... there should be at least some packets showing up, if not check the filter entered is correct.</p>
<p>What you should see may vary slightly with each setup but the general flow is as follows:</p>
<ul>
<li>ISAKMP - Identity Protection (Main Mode)  =  There should be 5 or 6 of these as 'Main Mode' (phase 1) is established.</li>
<li> ISAKMP - Quick Mode  =  There should be about 4 of these as 'Quick Mode' (phase 2) is established.</li>
<li> ESP packets  =  If connected, plenty of these should come flooding in.</li>
<li> UDPENCAP  =  UDP Encapsulation packets - these are UDP packets that are encapsulated for passing through NAT.</li>
</ul>
<p>Note: Look out for packets only showing in one direction, each stage there should be packets back and forth from/to the server.<br />
If you see all of the above but it is still not connecting, check your security settings - username/password, pre-shared key, turn off any firewalls (including Windows firewall) and check the &lt;a href="vpn.html#registryfix"&gt;Windows registry hack&lt;/a&gt; has been performed and the PC rebooted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2011/11/13/vpn-setup-with-lt2p-ipsec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unipolar Stepper Motor Driver</title>
		<link>http://www.pchilton.co.uk/2011/11/13/unipolar-stepper-motor-driver/</link>
		<comments>http://www.pchilton.co.uk/2011/11/13/unipolar-stepper-motor-driver/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 21:04:45 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=221</guid>
		<description><![CDATA[Synopsis The purpose of this project was to develop a stepper motor driver for 2-phase unipolar stepper motors that has built in current control. The eventual target project for this driver is for my CNC milling machine that I am currently planning out. This needs a few elements that are combined to provide a full [...]]]></description>
			<content:encoded><![CDATA[<div id="maincontent">
<h2 id="synopsis">Synopsis</h2>
<p>The purpose of this project was to develop a stepper motor driver for  2-phase unipolar stepper motors that has built in current control. The  eventual target project for this driver is for my CNC milling machine  that I am currently planning out. This needs a few elements that are  combined to provide a full driver.<br />
<span id="more-221"></span></p>
<ul>
<li>Firstly a method of providing the required coil sequencing to step  the motor backwards and forwards.</li>
<li>Once this is established the current being supplied to the  motor coils needs to be limitted in some way to stop melting anything...  The obvious option here is to use a chopper circuit.</li>
<li>Once the driver is up and running a power supply needs to be  built to cope with the current the motors require.</li>
<li>Finally an intelligent controller is required to provide the  correct number of steps for a required distance of travel. Many simply  use a PC parallel port for this on CNC projects but I want this to be  more of a stand-alone driver that can be used for other things. Ideally I  will include ethernet control so that I can run the CNC machine  remotely from the comfort of my living room instead of the cold garage  and negates the need for a dedicated control PC.</li>
</ul>
<h2 id="device">The device</h2>
<p>The device is based around an L297 driver IC that performs the  translation step (ie takes clock and direction input and generates the  correct output sequence for driving the stepper) and has current  limitting abilities. Additional logic and driver circuitry is then added  to drive the motor coils. Each motor driver is fully independant of the  other drives and is controlled with its own clock and direction  signals, has a seperate current limitter setting and should not  interfere with each other.</p>
<ul>
<li>Circuit diagram <a href="http://www.pchilton.co.uk/wp-content/uploads/2010/04/stepperdriver.jpg"><img src="http://www.pchilton.co.uk/wp-content/uploads/2010/04/stepperdriver-296x300.jpg" alt="" title="stepperdriver" width="296" height="300" class="alignnone size-medium wp-image-124" /></a><br />
C7, C8 and C10 provide PSU filtering.<br />
R1 and R2 set the output voltage of the LM317 regulator.<br />
R6 (variable) and C1 set the chopper frequency.<br />
R11 is a pull-up for the direction line to ensure it stays  'stable'.<br />
R4 and C6 provide a filter for the direction line.<br />
R10 and C2 provide a filter for the pulse line.<br />
R12 is a pull-down to disable the outputs until set high.<br />
R3 pulls H/F up so it can be toggled on or off easily by JP1.<br />
R14 and R8 (variable) set the VRef reference voltage that  determines the motor current.<br />
C3 gives some voltage stability to the reference voltage.<br />
C4 and C5 provide filters for the current sense lines.<br />
R9 and R10 reduce current flowing from the sense resistors to the  L297.<br />
R7 and R13 are the sense resistors used to measure the current  flowing through the motor coils.</li>
<li>The finished product photos will be added soon</li>
</ul>
<h2 id="development">Development choices, tips and debugging</h2>
<p>In reaching this final solution I went through many designs, some of  my own, some through various searches on the net. The final design is a  combination of a few of the most common designs that can be found on the  internet. One useful site I used is <a href="http://www.pminmo.com/" target="_blank">http://www.pminmo.com/</a> there are some good designs  of stepper drivers and also a bulletin board where people share  experiences and the owner gives great help. A good resource for  describing stepper motors is <a href="http://www.cs.uiowa.edu/%7Ejones/step/index.html" target="_blank">Jones  on Stepping Motors</a></p>
<h2 id="fetchoice">FET choice</h2>
<p>The FETs must be chosen to allow the switching of each coil in the  motor at full current. They must also be able to cope with the inductive  EMF spike generated by the motor that could otherwise destroy the FET.  Some circuits show diodes being used to help control this spike and  protect the FET, however in my experiments they caused more problems  than they solved and generated a lot of heat. My circuit solution is  simply to use FETs that are rated high enough to cope with this spike  without the diode. Approximetly I have spec'd this as around 4 times the  supply voltage, however there may be a better calculation to work out  the exact requirement.<br />
The next thing to consider is the logic level that will be used to  turn the FETs on/off, referred to as Vgs (voltage across the gate-source  junction). In practice Vgs = Vcc - Vsense. ie The voltage across the  FET gate is the supply voltage less the voltage across the sense  resistor. The voltage across the sense resistor must therefore be  controlled/limitted and the FET spec'd to work with 'what is left'. The  sense resistor voltage is limitted by the L297 device by means of the  current limitting circuitry. When Vsense (voltage across the sense  resistor) reaches the reference voltage into the L297 Vref pin the  inhibit output lines drop, in turn switching off the FETs and dropping  Vsense. This sequence repeats giving an oscillating voltage across the  sense resistor, this is known as the chopper action. In practise when  measuring this 'chopped' voltage the reading is approx 2/3 of Vref, but  for our calculations (giving us some VAT) it is best to use Vref itself  in the calculations. So re-writing the previous formula: <code>Vgs = Vcc  - Vref</code>.<br />
We set Vref between 0-1V and use a supply voltage of 5V for the  logic.    		<code>So Vgs = 5 - 1 = 4V.</code> Now we need to refer to the datasheet of our FET and look at the Vgs  vs Ids graph and ensure that when Vgs=4V the graph is not in its linear  section (ie it has levelled out) and is therefore fully switched on.  This will give us the best possible performance out of the FET. Note  that some FETs do not switch on fully until Vgs &gt;= 5/6/7 volts. Be  careful in choosing different FETs paying attention to this  specification.</p>
<p>After trying a few different models I eventually chose to use the  IRL640 FETs as they performed the best and matched all of my required  specifications. They have a Vds of 200V, meaning they should cope well  with the inductive motor spike without needing diodes and a Ids of 17A,  which is more than enough for the steppers motors I will ever use. These  come in a TO220 package so are easy to mount and heatsink.</p>
<h2 id="circuitinfo">Misc circuit choices and information</h2>
<p>The clock and direction pins use RC filters to help to stop  interference giving invalid clocks to the L297. Although the exact  resistor and capacitor values are not critically important they must not  limit the step rate required for our maximum clock speed. The max  allowed frequency to pass through the filter is <code>t=RC</code>. The  L297 needs a step width of 500nS to operate, therefore we do not want to  stop pulses greater than this. Choosing to allow steps of 200nS (ie  0.0002 seconds) through will give us a maximum clock speed of 5kHz. This  will allow most steppers to reach top speed. Therefore R*C (R in KOhm, C  in pF) will give us the actual pulse width allowed (in nS). Therefore a  2.2K resistor and a 100pF capacitor provides a reasonable filter.</p>
<p>The sense resistors should be metal film type and not wirewound, as  the inductive properties of the wirewound resistors add additional  complication and do not work as well as non-inductive types.</p>
<p>The ideal chopper frequency for the driver needs to be set for the  motor being used, too high or too low a frequency can cause audible  noises/buzzes and/or run the motors hot.</p>
<p>Always ensure the FETs are heatsinked, even if they don't get hot it  is not worth risking. Be aware though that most FETs (including the  IRL640's) have the tab as the drain and need to be isolated from the  other FETs tabs. This means that they either need seperate heatsinks  that do not touch each other, or a common heatsink with isolating  mounts.</p>
<h2 id="currentcalcs">Current calculations</h2>
<p>Setting the values for the sense resistors is perhaps the only main  change to the circuit design that will be needed based on the motor  being used. The calculation we will use is Motor current <code>Imax =  Vref / Rsense</code>. We ideally want to limit the current for the motor  to its maximum when Vref is at its maximum, therefore we cannot (in  theory) damage the motor by turning Vref up too high. We have already  stated that Vref should not exceed 1.0V, so we can simplify the  calculation to <code>Imax = 1 / Rsense  or  Rsense = 1 / Imax</code>. So  with a motor with a maximum current of 2A per coil, <code>Rsense = 1 / 2  = 0.5 Ohms</code>. The power then disapated through the resistor is <code>Psense  = Isense * Vsense</code>. Vsense should not be greater than 1.0V, so  taking this as a worst case maximum, <code>Psense = Isense * 1 = Isense</code>,  so the power disapated is equal to the motor current value (in this  case 2Watts). At this rating, ensure the resistors used are rated to  this value, and expect them to get nice and warm! In practice you may  find that a lower power rating is ok to use as you won't run the motor  at <em>full</em> current and the voltage across the sense resistor doesn't  actually reach Vref, but feel free to have a play. Cooling the  resistors with a fan is not such a bad idea, and with some thought the  same fan can cool the FET heatsink also.</p>
<h2 id="faultfinding">Fault finding</h2>
<p>The first thing to check in the event the motor is not behaving  correctly is that the wiring is correct, check and double check each pin  on the L297, 74AC08 and FETs. Once you are sure everything is correct,  check for shorts across the board. Next switch on the power and check  the supply voltage to each IC. Once this is done ensure the four LED's  are switching as the clock line is pulsed, if not then there is  something wrong with the L297/AND gate circuit side, to confirm remove  the motor and if possible the motor supply voltage (leaving the logic  level voltage on). These should follow this sequence:<br />
1001<br />
1010<br />
0110<br />
0101<br />
If this sequence is correct then check the FETs. Switch off the  power and check the following using a multimeter:<br />
Resistance measure:<br />
Pin 1-2: should be nothing <span style="color: red;">*(nothing)</span><br />
Pin 2-3: should be approx 3 MegOhms <span style="color: red;">*(2.5MOhms)</span><br />
Pin 1-3: should be nothing <span style="color: red;">*(100 Ohms)</span><br />
Diode measurement setting:<br />
Pin 1-2: should be nothing <span style="color: red;">*(nothing)</span><br />
Pin 2-3: should be 0.5V <span style="color: red;">*(0.5V)</span><br />
Pin 1-3: should be nothing <span style="color: red;">*(0.1V)</span><br />
<span style="color: red;">*The values shown in brackets were measured from  a blown (dead) device, although a blown device will not always show  these values this is just one case.</span></p>
<h2 id="limitations">Limitations</h2>
<ul>
<li>The supply voltage should be no higher than approx 50V - I need to  confirm the exact maximum voltage.</li>
</ul>
<h2 id="expansion">Future expansion and development</h2>
<ul>
<li>The next stage of development is to include this design into an  ethernet based 3-axis stepper motor controller. This then will be used  to control my CNC miller.</li>
<li>Once the 3-axis controller is complete and the CNC miller  running I will produce some 'final' PCB boards for the drivers.</li>
<li>Also a high current PSU needs to be built to drive all 3  motors (2A/phase 2-phase ON = 4A per motor. 4A * 3 = 12A).</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2011/11/13/unipolar-stepper-motor-driver/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Electronics Testing</title>
		<link>http://www.pchilton.co.uk/2011/11/13/electronics-testing/</link>
		<comments>http://www.pchilton.co.uk/2011/11/13/electronics-testing/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 21:04:10 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=219</guid>
		<description><![CDATA[fet testing ... To test N channel MOSFETs for basic functionality, follow these steps: 1: Ensure the MOSFET is out of circuit, then place the DVM into the Diode test position. Attach the positive lead (Red) to the Drain terminal, and the negative lead (Black) to the Source terminal. Confirm an Open circuit condition. 2: [...]]]></description>
			<content:encoded><![CDATA[<h1>fet testing ...</h1>
<p><span id="more-219"></span></p>
<p>To test N channel MOSFETs for basic functionality, follow these steps:</p>
<ul>
<li>1: Ensure the MOSFET is out of circuit, then place the DVM into the Diode test position. Attach the positive lead (Red) to the Drain terminal, and the negative lead (Black) to the Source terminal. Confirm an Open circuit condition.</li>
<li>2: Leaving the negative lead (Black) attached to the Source Terminal, remove the positive lead (Red) and briefly attach it to the Gate terminal. This applies a voltage to the gate of the MOSFET through the DVM's internal battery.</li>
<li>3: Repeat Step 1. This time, confirm device conduction.</li>
<li>4: Attach the negative lead (Black) to the Gate Terminal, and the positive lead (Red) to the Source terminal. This turns the device off by reversing the Gating voltage (making it more negative). Repeat Step 1, and confirm an Open circuit condition.</li>
<li>5: If the MOSFET has a built in Protection Diode (this is connected across the Drain and Source Terminals), attach the negative lead (Black) to the Drain terminal, and the positive lead (Red) to the Source terminal. Confirm a forward voltage drop of between 0.2 to 0.8V DC.</li>
</ul>
<p>For P channel MOSFETs reverse the multimeter probe polarity.</p>
<hr />
<h1>transistor testing ...</h1>
<p>NPN transistors can be tested by using the diode test on a digital volt meter. A working transistor should test correctly between the base and collector and between the base and emitter (Negative probe on base). There should be no continuity between the collector and the emitter.<br />
For PNP transistors reverse the multimeter probe polarity.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2011/11/13/electronics-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache &amp; PHP Setup in Windows</title>
		<link>http://www.pchilton.co.uk/2011/11/13/apache-php-setup-in-windows/</link>
		<comments>http://www.pchilton.co.uk/2011/11/13/apache-php-setup-in-windows/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 21:03:11 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=215</guid>
		<description><![CDATA[Installing Apache, PHP, MySQL Install Apache then MySQL with default options. Download and unzip PHP to C:\PHP\ (or other suitable directory). Apache Config Edit the httpd.conf file and add the following lines: LoadModule php5_module C:\php\php5apache2_2.dll AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps (Modify the php dll version according to the PHP version - these files can [...]]]></description>
			<content:encoded><![CDATA[<h2 id="installingapache">Installing Apache, PHP, MySQL</h2>
<p>Install Apache then MySQL with default options. Download and unzip PHP to C:\PHP\ (or other suitable directory).</p>
<p><span id="more-215"></span></p>
<h2 id="apacheconfig">Apache Config</h2>
<p>Edit the httpd.conf file and add the following lines:</p>
<p>LoadModule php5_module C:\php\php5apache2_2.dll</p>
<p>AddType application/x-httpd-php .php</p>
<p>AddType application/x-httpd-php-source .phps</p>
<p>(Modify the php dll version according to the PHP version - these files can be seen in the php directory. Pick the one that is most appropriate).</p>
<p>Find the line containing DirectoryIndex, append index.php to the list of default files. E.g:<br />
#<br />
# DirectoryIndex: sets the file that Apache will serve if a directory<br />
# is requested.<br />
#</p>
<p>DirectoryIndex index.html index.php</p>
<h2 id="testapache">Test Apache</h2>
<p>Restart apache from the server monitor.</p>
<p>Navigate to http://localhost/index.html</p>
<p>If Apache is working, a test page should be being displayed.</p>
<h2 id="testphp">Test PHP</h2>
<p>Create a new file in the docroot, index.php.<br />
Enter the following line:</p>
<p>Navigate to http://localhost/index.php</p>
<p>If PHP is working, a full page of PHP information will be displayed.</p>
<h2 id="phpconfig">PHP Config</h2>
<p>From the PHP directory, copy the "php.ini-recommended" file into the windows folder (default: C:\WINDOWS\). Open the INI file and make the following modifications:</p>
<ul>
<li>short_open_tag = on</li>
<li>doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ (set to actual apache docroot)</li>
<li>extension_dir = "c:/php/ext/"</li>
</ul>
<p>Save and close the php.ini file.</p>
<h2 id="mysql">MySQL for PHP</h2>
<ul>
<li>Uncomment the extension=php_mysql.dll line in the c:\windows\php.ini file.</li>
<li>Copy the "libmysql.dll" file from the PHP directory into the c:\windows\system32\ directory. (this is one thing that is often forgotten about in other setup guides).</li>
<li>Restart apache</li>
<li>Refresh the phpinfo file we created. If the MySQL module is working it will be shown in the list of available modules on the page.</li>
</ul>
<h2 id="resetrootpwd">Resetting the MySQL server root password</h2>
<ul>
<li>Create a new text file "c:\mysql.txt" and place in the text:</li>
</ul>
<p>UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';</p>
<p>FLUSH PRIVILEGES;</p>
<ul>
<li>
<ul>
<li>Stop the MySQL service</li>
<li>From the command prompt, navigate to the MySQL bin directory</li>
<li>Run the following command:
<ul>
<li>mysqld.exe --init-file=c:\mysql.txt --console</li>
</ul>
</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2011/11/13/apache-php-setup-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET Move ListViewItems Up and Down</title>
		<link>http://www.pchilton.co.uk/2011/04/16/vb-net-move-listviewitems-up-and-down/</link>
		<comments>http://www.pchilton.co.uk/2011/04/16/vb-net-move-listviewitems-up-and-down/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 08:54:01 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Code Sample]]></category>
		<category><![CDATA[ListView]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=195</guid>
		<description><![CDATA[I recently wrote an application where I needed to move items up and down (order them) in ListView in VB.NET and discovered that there isn't a built in method to do so. I decided to share my solution which is shown below. This method can be used to move one or multiple selected items up [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wrote an application where I needed to move items up and down (order them) in ListView in VB.NET and discovered that there isn't a built in method to do so. I decided to share my solution which is shown below. This method can be used to move one or multiple selected items up or down in the list. All tag information and formatting should 'follow' the items moved. This method is easily ported to C#.<br />
<span id="more-195"></span></p>
<div class="Section1">
<p class="MsoNormal" style="text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">''' </span><span style="color: gray;">&lt;summary&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">''' Move selected items up or down in the specified listview</span></span></p>
<p class="MsoNormal" style="text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">''' </span><span style="color: gray;">&lt;/summary&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">''' </span><span style="color: gray;">&lt;param name="lvwListView"&gt;</span><span style="color: green;">The listview to manipulate</span><span style="color: gray;">&lt;/param&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">''' </span><span style="color: gray;">&lt;param name="blnMoveUp"&gt;</span><span style="color: green;">True to move items up, False to move them down</span><span style="color: gray;">&lt;/param&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Private</span> <span style="color: blue;">Sub</span> MoveItemsInListView(<span style="color: blue;">ByRef </span>lvwListView <span style="color: blue;">As</span> <span style="color: #2b91af;">ListView</span>, <span style="color: blue;">ByVal</span> blnMoveUp <span style="color: blue;">As</span><span style="color: blue;"> </span><span style="color: blue;">Boolean</span>)</span></p>
<p class="MsoNormal" style="padding-left: 30px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Try</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">'Set the listview index to limit to depending on whether we are moving things up or down in the list</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Dim </span>intLimittedIndex <span style="color: blue;">As</span> <span style="color: blue;">Integer </span>= (lvwListView.Items.Count - 1)</span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">If</span> blnMoveUp <span style="color: blue;">Then</span> intLimittedIndex = 0</span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"><br />
</span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> </span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">'Define a new collection of the listview indexes to move</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Dim </span>colIndexesToMove <span style="color: blue;">As</span> <span style="color: blue;">New</span><span style="color: blue;"> </span><span style="color: #2b91af;">List</span>(<span style="color: blue;">Of</span> <span style="color: blue;">Integer</span>)()</span></p>
<p class="MsoNormal" style="padding-left: 60px;">&nbsp;</p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Loop through each selected item in the listview (multiple select support)</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">For</span> <span style="color: blue;">Each</span> lviSelectedItem <span style="color: blue;">As</span><span style="color: blue;"> </span><span style="color: #2b91af;">ListViewItem</span> <span style="color: blue;">In </span>lvwListView.SelectedItems</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="color: #008000; font-family: Consolas;">'Add the item's index to the collection</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> colIndexesToMove.Add(lviSelectedItem.Index)</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> </span></p>
<p class="MsoNormal" style="padding-left: 90px;">&nbsp;</p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'If this item is at the limit we defined</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">If </span>lviSelectedItem.Index = intLimittedIndex <span style="color: blue;">Then</span></span></p>
<p class="MsoNormal" style="padding-left: 120px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Do not attempt to move item(s) as we are at the top or bottom of the list</span></span></p>
<p class="MsoNormal" style="padding-left: 120px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Exit Try</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">End</span> <span style="color: blue;">If</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Next</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> </span></p>
<p class="MsoNormal" style="padding-left: 60px;">&nbsp;</p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'If we are moving items down</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">If</span> <span style="color: blue;">Not</span> blnMoveUp <span style="color: blue;">Then</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Reverse the index list so that we move items from the bottom of the selection first</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> colIndexesToMove.Reverse()</span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">End</span> <span style="color: blue;">If</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> </span></p>
<p class="MsoNormal" style="padding-left: 60px;">&nbsp;</p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Loop through each index we want to move</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">For</span> <span style="color: blue;">Each</span> intIndex <span style="color: blue;">As</span> <span style="color: blue;">Integer</span> <span style="color: blue;">In </span>colIndexesToMove</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Define a new listviewitem</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Dim </span>lviNewItem <span style="color: blue;">As</span> <span style="color: #2b91af;">ListViewItem </span>= <span style="color: blue;">CType</span>(lvwListView.Items(intIndex).Clone(), <span style="color: #2b91af;">ListViewItem</span>)</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> </span></p>
<p class="MsoNormal" style="padding-left: 90px;">&nbsp;</p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Remove the currently selected item from the list</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> lvwListView.Items(intIndex).Remove()</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> </span></p>
<p class="MsoNormal" style="padding-left: 90px;">&nbsp;</p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Insert the new item in it's new place</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">If </span>blnMoveUp <span style="color: blue;">Then</span></span></p>
<p class="MsoNormal" style="padding-left: 120px;"><span style="font-size: 9.5pt; font-family: Consolas;"> lvwListView.Items.Insert(intIndex - 1, lviNewItem)</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Else</span></span></p>
<p class="MsoNormal" style="padding-left: 120px;"><span style="font-size: 9.5pt; font-family: Consolas;"> lvwListView.Items.Insert(intIndex + 1, lviNewItem)</span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">End</span> <span style="color: blue;">If</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> </span></p>
<p class="MsoNormal" style="padding-left: 90px;">&nbsp;</p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"><span style="color: green;">'Set the new item to be selected</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> lviNewItem.Selected = <span style="color: blue;">True</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Next</span></span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Catch</span> ex <span style="color: blue;">As</span> <span style="color: #2b91af;">Exception</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: #2b91af;">Trace</span>.WriteLine(<span style="color: #a31515;">"MoveItemsInListView() has thrown an exception: "</span> &amp; ex.Message)</span></p>
<p class="MsoNormal" style="padding-left: 60px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">Finally</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: green;">'Set the focus on the listview</span></span></p>
<p class="MsoNormal" style="padding-left: 90px;"><span style="font-size: 9.5pt; font-family: Consolas;"> lvwListView.Focus()</span></p>
<p class="MsoNormal" style="padding-left: 30px;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">End</span> <span style="color: blue;">Try</span></span></p>
<p class="MsoNormal" style="text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">End</span> <span style="color: blue;">Sub</span></span></p>
<p class="MsoNormal">&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2011/04/16/vb-net-move-listviewitems-up-and-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advent VEGA Tablet PC</title>
		<link>http://www.pchilton.co.uk/2011/03/12/advent-vega-tablet-pc/</link>
		<comments>http://www.pchilton.co.uk/2011/03/12/advent-vega-tablet-pc/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 16:46:34 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[advent vega]]></category>
		<category><![CDATA[reviews]]></category>
		<category><![CDATA[tablet]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=181</guid>
		<description><![CDATA[I have just received an Advent VEGA tablet that I am trialing for work. The idea is to use it as an electronic clipboard for tasks and as a checklist device for reviewing systems. This will primarily be used via an intranet page on our server so special appliiains are not a priority. We wanted [...]]]></description>
			<content:encoded><![CDATA[<p>I have just received an Advent VEGA tablet that I am trialing for work. The idea is to use it as an electronic clipboard for tasks and as a checklist device for reviewing systems. This will primarily be used via an intranet page on our server so special appliiains are not a priority.</p>
<p>We wanted a cheaper alternative to an ipad but with similar features, and I think this could be the solution!</p>
<p>Initial testing is positive, it is easy to use, relitively fast (ok not quite so  much  as an ipad but certainly faster than some others I have tried) and it seems robust.</p>
<p><span id="more-181"></span></p>
<p><a href="http://www.pchilton.co.uk/wp-content/uploads/2011/03/it_photo_156793_52-e1299957872152.jpg"><img class="aligncenter" title="VEGA Main View" src="http://www.pchilton.co.uk/wp-content/uploads/2011/03/it_photo_156793_52-e1299957872152-300x246.jpg" alt="" width="300" height="246" /></a></p>
<p>One main disappointment is the lack of google market place out of the box but there are ways round this for installing apps so its not a show-stopper.</p>
<p>Typing is quick and responsive (i'm typing this post on it now) although occassionally you will have  to be a bit more 'positive' pressing the likes of the home button for it to respond.</p>
<p>Wireless LAN setup without any issues and internet access is very useable. I think it may get borrowed for some weekends for living room browsing......</p>
<p><a href="http://www.pchilton.co.uk/wp-content/uploads/2011/03/it_photo_156796_52.jpg"><img class="aligncenter size-medium wp-image-188" title="VEGA Side" src="http://www.pchilton.co.uk/wp-content/uploads/2011/03/it_photo_156796_52-300x100.jpg" alt="" width="300" height="100" /></a></p>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2011/03/12/advent-vega-tablet-pc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CrashPlan Online Backup on QNAP TS-210 NAS</title>
		<link>http://www.pchilton.co.uk/2011/01/29/crashplan-online-backup-on-qnap-ts-210-nas/</link>
		<comments>http://www.pchilton.co.uk/2011/01/29/crashplan-online-backup-on-qnap-ts-210-nas/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 21:54:25 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Server Admin]]></category>
		<category><![CDATA[Crashplan]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[Online Backup]]></category>
		<category><![CDATA[QNAP]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=143</guid>
		<description><![CDATA[Installing CrashPlan on my QNAP TS-210 NAS in headless mode means that I have an instant online backup of all of my archive data stored on my NAS drive. CrashPlan keeps revision history of all my files, allowing me to recover my NAS to a state at any date should I lose data or overwrite something.  ]]></description>
			<content:encoded><![CDATA[<p>Installing CrashPlan on my QNAP TS-210 NAS in headless mode means that I have an instant online backup of all of my archive data stored on my NAS drive. CrashPlan keeps revision history of all my files, allowing me to recover my NAS to a state at any date should I lose data or overwrite something.<br />
<span id="more-143"></span></p>
<blockquote><p>I have for a while now been looking for a solution for backing up my important files and photos online. After much research and testing various backup providers I found that <a href="http://www.crashplan.com" target="_blank">CrashPlan </a> offered the best value vs quality of service.</p></blockquote>
<p>Crashplan provides both a Windows and a Linux service that can be used to backup files, in particular interest is that the service can be run in a 'headless' mode whereby the service can be run on a linux box and administered from a windows desktop client.</p>
<p>I currently use a QNAP TS-210 NAS box to backup all of my data and my ideal setup is to keep this in place and automatically backup everything on it to the internet.</p>
<p>On a standard Linux box this setup is simple and straight-forward, unfortunately things on the QNAP are not so straight forward because it uses a Kirkwood Marvel Atom processor that the java jre that crashplan uses does not directly support.<br />
<!--more--><br />
I have used a number of resources in order to achieve my working setup, these acknowledgements are given at the bottom of this post.</p>
<p><strong>The problem</strong><br />
The main problem in running the CrashPlan engine on the QNAP is that the java runtime that it installs fails to start the service correctly, reporting an error in the engine_error.log file. To try and rectify this I removed and reinstalled CrashPlan without installing the bundled java environment. I chose to manually install the java sdk using ipkg. This enabled the service to start but it immediately stopped with an invalid jtux error in the engine_output.log file. Google searching revealed that this meant that the java jtux library needs to be recompiled on the QNAP itself in order to generate a working jtux library file. After multiple attempts I found that I could not re-build this library on the QNAP firmware as the required packages could not be installed (or I simply couldn't find the correct combination of packages to install).</p>
<p><strong>Debian Squeeze on the QNAP</strong><br />
I came across an interesting article that detailed how to install Debian on the QNAP and decided I would give this route a try in order to achieve what I wanted. This proved the correct choice. I followed <a href="http://www.cyrius.com/debian/kirkwood/qnap/ts-219/install.html" target="_blank">this</a> article in order to install Debain which went quite smoothly. The main steps for this were:</p>
<p>First create backups of the QNAP flash blocks:<br />
<code>cat /dev/mtdblock0 > mtd0<br />
cat /dev/mtdblock1 > mtd1<br />
cat /dev/mtdblock2 > mtd2<br />
cat /dev/mtdblock3 > mtd3<br />
cat /dev/mtdblock4 > mtd4<br />
cat /dev/mtdblock5 > mtd5</code></p>
<p>Download the flash installer:<br />
<code>cd /tmp<br />
busybox wget ftp://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/initrd.gz<br />
busybox wget ftp://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/kernel<br />
busybox wget ftp://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/flash-debian<br />
busybox wget ftp://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/kirkwood/network-console/qnap/ts-219/model<br />
</code></p>
<p>Run the flash installer, this will load the installer into flash so that upon the next reboot it will load the Debian installer:<br />
<code><br />
sh flash-debian<br />
</code></p>
<p>This will display something similar to:<br />
<code><br />
Updating MAC address...<br />
Your MAC address is XX:XX:XX:XX:XX:XX<br />
Writing debian-installer to flash... done.<br />
Please reboot your QNAP device.<br />
</code></p>
<p>Reboot your NAS box. The NAS will start to boot and the status led will flash red/green for a short while before turning solid green and then it will give a short beep to indicate it is ready.</p>
<p><b>Debian Installer Setup</b><br />
As the NAS doesn't have a display you need to SSH into the installer. If the NAS was setup before with a static IP it is likely this IP will still be used, if not it may have booted from DHCP. Login to SSH with the username: installer and the password: install.</p>
<p>Follow the installer GUI to setup the NAS box as required. The <a href="http://www.debian.org/releases/lenny/arm/" target="_blank">Installer Guide</a> may help with the options available. I setup RAID0 to maximise my available disk space and otherwise used quite standard setup options. If I re-install the box again I will further detail these setup pages. For disk partitioning I used the 'Guided Partitioning' option and chose to use the entire disk (without LVM) and to basic partition split. After this I setup RAID0 choosing the two large partitions to RAID.</p>
<p><strong>Setup Debian</strong><br />
Setup your Debian installation as required, I setup Apache, MySQL, and Samba to start with. Format your RAID partition using mke2fs and mount it by adding it to /etc/fstab.</p>
<p><strong>Install Packages</strong><br />
Installed required packages in order to get crashplan working.<br />
apt-get install openjdk-6-jdk<br />
apt-get install make<br />
apt-get install gcc<br />
apt-get install libjna-java</p>
<p><b>Install CrashPlan</b><br />
cd /usr/<br />
wget http://download.crashplan.com/installs/linux/install/CrashPlan/CrashPlan_3.0.1_Linux.tgz<br />
tar xfz CrashPlan_3.0.1_Linux.tgz<br />
cd CrashPlan-install<br />
./install.sh</p>
<p>Choose default paths for installation but choose NOT to install the embedded java runtime.</p>
<p><b>Patch jtux</b><br />
Download the jtux patch file from <a href="https://crashplan.zendesk.com/entries/390250-crashplan-on-sheevaplug" target="_blank">this</a> discussion post.<br />
<code><br />
cd /usr/<br />
wget http://basepath.com/aup/jtux/jtux.tar.gz<br />
tar zxfv jtux.tar.gz<br />
Copy jtux.PS3-YDL6.1.patch.txt into jtux path<br />
patch &lt;jtux.PS3-YDL6.1.patch.txt<br />
nano Makefile<br />
Set JAVA_INCLUDE = /usr/lib/jvm/java-6-openjdk/include<br />
make<br />
</code><br />
I have now attached my compiled version of the jtux library: <a href='http://www.pchilton.co.uk/wp-content/uploads/2011/01/libjtux.so_.gz'>libjtux.so</a></p>
<p>Backup existing crashplan jtux library:<br />
cp /usr/local/crashplan/libjtux.so /usr/local/crashplan/libjtux.so.bak</p>
<p>Copy new file in:<br />
cp libjtux.so /usr/local/crashplan/</p>
<p>Patch CrashPlanEngine:<br />
cd /usr/local/crashplan/bin/<br />
nano CrashPlanEngine<br />
Replace line starting with FULL_CP:<br />
FULL_CP="/usr/share/java/jna.jar:$TARGETDIR/lib/com.backup42.desktop.jar:$TARGETDIR/lang"</p>
<p>Start CrashPlan Engine:<br />
./CrashPlanEngine start</p>
<p>At this point your CrashPlan engine should be starting, check its status with ./CrashPlanEngine status<br />
Be patient though, it may take a few minutes for the service to come up fully. Check whether it is listening with: netstat -na | grep 4243 and see if any ports are open, once they are you should be able to connect using the CrashPlan desktop client.</p>
<p><b>CrashPlan Client</b><br />
Configure your desktop client as per the guide on the CrashPlan support site: <a href="http://support.crashplan.com/doku.php/how_to/configure_a_headless_client" target="_blank">Configuring a Headless Client</a>. I used Putty to SSH into the box, creating a tunnel and then connected using the client software.</p>
<p>You should now be able to login and setup backups as normal.</p>
<p>I selected my raid disk directory for backup and left it to upload my entire backup storage to the cloud!</p>
<blockquote><p>If I have time I want to perform some further tests in order to see if I could have re-compiled the jtux library on the QNAP firmware without installing Debian and also I would like to provide some more detail (for my own reference as much as anything) on how the RAID partitions were setup.</p></blockquote>
<p>Although not tested, I believe this method will work for any Marvel cpu device, including the QNAP TS-110, QNAP TS-119, QNAP TS-119P+, QNAP TS-210, QNAP TS-219, QNAP TS-219P QNAP TS-219P+, Sheevaplug and ReadyNAS equivalents. Please let me know if you have installed on any of these or any other devices.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2011/01/29/crashplan-online-backup-on-qnap-ts-210-nas/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Dropbox</title>
		<link>http://www.pchilton.co.uk/2010/12/25/dropbox/</link>
		<comments>http://www.pchilton.co.uk/2010/12/25/dropbox/#comments</comments>
		<pubDate>Sat, 25 Dec 2010 20:39:35 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Online Backup]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=137</guid>
		<description><![CDATA[Use Dropbox Dropbox to get free cloud space to store important files, documents, photos, etc and be confident that they are automatically backed up on both your computer and securely on the internet. Install Dropbox on multiple PC's and have the files automatically sync'd between the two. I use Dropbox to automatically sync my documents [...]]]></description>
			<content:encoded><![CDATA[<p>Use Dropbox <a href="http://www.dropbox.com">Dropbox</a> to get free cloud space to store important files, documents, photos, etc and be confident that they are automatically backed up on both your computer and securely on the internet. Install Dropbox on multiple PC's and have the files automatically sync'd between the two.</p>
<p>I use Dropbox to automatically sync my documents between my two computers. This works seamlessly and no sooner have I saved a document on one computer is it ready and updated on the other. Dropbox works faultlessly in all tests I have put it through, simply Excellent.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2010/12/25/dropbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delete all Picasa Web Albums</title>
		<link>http://www.pchilton.co.uk/2010/09/20/delete-all-picasa-web-albums/</link>
		<comments>http://www.pchilton.co.uk/2010/09/20/delete-all-picasa-web-albums/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 17:13:08 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Picasa]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=129</guid>
		<description><![CDATA[I started to import all of my photos into Picasa but then wanted to rearrange how they were organised and needed to delete all of my albums that had been created (some 200+ folders). The only way to do this normally is to go into each album, drop down the menu, select delete and confirm [...]]]></description>
			<content:encoded><![CDATA[<p>I started to import all of my photos into Picasa but then wanted to rearrange how they were organised and needed to delete all of my albums that had been created (some 200+ folders). The only way to do this normally is to go into each album, drop down the menu, select delete and confirm the deletion. This was going to take a long time! I searched about and found that this can be done using the Google CL tool. </p>
<li>Download the CL Tool from Google: <a href="http://code.google.com/p/googlecl/">Google CL Tool</a></li>
<li>Extract the zip file to a suitable location</li>
<li>Open up the command prompt</li>
<li>Navigate to where the CL tool was downloaded to</li>
<li>Run 'google.exe' to display the cl promt '>'</li>
<li>Run the following command (this will delete any albums starting with these characters):</li>
<p><code>picasa delete --title a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|0|1|2|3|4|5|6|7|8|9</code></p>
<li>Enter your email address for picasa, this will open up a browser window to enable you to auth with google. Login using your email address / password.</li>
<li>If Google tries to get you to login using a Google Apps for Domains account, then manually type in the link shown in the command prompt into your browser, excluding everything after (and including) the '&#038;hc=' towards the end of the link</li>
<li>You can setup cl tool to not prompt for deleting an album by altering the config file found in 'C:\Users\yourusername\.googlecl\'</li>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2010/09/20/delete-all-picasa-web-albums/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Converting CVSNT to Linux CVS</title>
		<link>http://www.pchilton.co.uk/2010/05/06/converting-cvsnt-to-linux-cvs/</link>
		<comments>http://www.pchilton.co.uk/2010/05/06/converting-cvsnt-to-linux-cvs/#comments</comments>
		<pubDate>Thu, 06 May 2010 17:49:45 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Server Admin]]></category>
		<category><![CDATA[CVS]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://www.pchilton.co.uk/?p=111</guid>
		<description><![CDATA[Today at work we swapped from using CVSNT on a Windows server machine to using CVS for linux on a QNAP NAS storage box. All appeared to be working fine until I checked out a file that was committed as a binary file. I quickly realised that half of the repository was corrupt (i.e. all [...]]]></description>
			<content:encoded><![CDATA[<p>Today at work we swapped from using CVSNT on a Windows server machine to using CVS for linux on a QNAP NAS storage box. All appeared to be working fine until I checked out a file that was committed as a binary file. I quickly realised that half of the repository was corrupt (i.e. all binary files). After a little bit of research it was clear that CVSNT and CVS for linux are not directly compatible any more as they store the fact that a file is binary in a different format.</p>
<p>In each repository file there are entries that specify file formats, cvs comments, versions, etc. In amongst these is a flag that specifies the file type. </p>
<p>A file specified as binary in CVSNT has a line reading (where the space is actually a tab):<br />
<code>kopt b;</code></p>
<p>A file specified as binary in CVS has a line reading (where the space is actually a tab):<br />
<code>expand @b@;</code><br />
<span id="more-111"></span><br />
Once I realised this was the case it was a fairly simple matter of converting these line in all files in the repository. To do this I used a usefull little application I have used before called 'TextCrawler'. This is a free download and is useful for performing find/replace actions on multiple files in a directory.</p>
<p>Before I performed the correction I ensured that all files were marked as writable (ie unchecked read-only flag for this directory and applied to all sub files and folders).</p>
<p>Download text crawler and set the options shown in the image below:<br />
<a href="http://www.pchilton.co.uk/wp-content/uploads/2010/05/cvs-conversion.jpg"><img src="http://www.pchilton.co.uk/wp-content/uploads/2010/05/cvs-conversion-300x278.jpg" alt="" title="CVS Conversion TextCrawler Caption" width="300" height="278" class="alignnone size-medium wp-image-112" /></a></p>
<p>Clicking 'Replace' will now search through all files in your repository (my test location here is c:\CVSDATA\).</p>
<p>Once the operation is complete the files are ready to be used in the linux CVS repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pchilton.co.uk/2010/05/06/converting-cvsnt-to-linux-cvs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
