<?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>the BSD box</title>
	<atom:link href="http://thebsdbox.co.uk/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://thebsdbox.co.uk</link>
	<description>.. on Linux</description>
	<lastBuildDate>Tue, 17 Aug 2010 17:21:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ESXi v4.1 SFTP access</title>
		<link>http://thebsdbox.co.uk/?p=224</link>
		<comments>http://thebsdbox.co.uk/?p=224#comments</comments>
		<pubDate>Tue, 17 Aug 2010 17:20:54 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[esxi 4.1]]></category>
		<category><![CDATA[sftp]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=224</guid>
		<description><![CDATA[I came across something interesting while fiddling earlier, after spending about 2 hours building a static release of openssh server that was going to replace dropbear. I&#8217;d gotten to a point where I could build a i386 release of the binaries with no random library requirements and sshd would start and listen on a port]]></description>
			<content:encoded><![CDATA[<p>I came across something interesting while fiddling earlier, after spending about 2 hours building a static release of openssh server that was going to replace dropbear. I&#8217;d gotten to a point where I could build a i386 release of the binaries with no random library requirements and sshd would start and listen on a port defined in /etc/ssh/sshd_config. unfortunately starting ssh in debug mode allowed me to see numerous glibc errors during connections and explain why I couldn&#8217;t connect. At this point I don&#8217;t think there is any real way of replacing dropbear with a complete openssh solution even statically linking. Even testing the openssh sftp binary that had been compiled showed that it wasn&#8217;t coping with a system call not returning UIDs correctly meaning that it would report a FATAL error and close continually.</p>
<p>Given openssh wasn&#8217;t going to be replaced I researched about dropbear and if there was a newer version perhaps with sftp, unfortunately not. Eventually I came across notes on a blog mentioning that dropbear &#8220;supports&#8221; openssh sftp. After restoring ESXi back to its default filesystem settings (ssh enabled) it appears the attempting to sftp to esxi returns the following error.</p>
<div id="_mcePaste">ash: /sbin/sftp-server: not found</div>
<div id="_mcePaste">Connection closed</div>
<p>After compiling a slightly older version of openssh (static) I found a release of sftp-server that will once placed in /sbin on ESXi allows full usage of sftp (including sshfs mounting) binary below.</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/08/sftp-server.tar.gz">sftp-server.tar.gz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=224</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>File access in ESXi 4.1 (nfs and tcp)</title>
		<link>http://thebsdbox.co.uk/?p=219</link>
		<comments>http://thebsdbox.co.uk/?p=219#comments</comments>
		<pubDate>Sat, 14 Aug 2010 18:49:57 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[esxi 4.1]]></category>
		<category><![CDATA[nfs]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=219</guid>
		<description><![CDATA[I&#8217;ve had numerous occasions were i&#8217;ve needed to upload files to the actual file systems on an esxi system, the only &#8216;proper&#8217; method is using the abysmal virtual infrastructure client and working mainly on a mac means I need to use VMware Fusion for windows to run the client to connect to the server (overkill). So it&#8217;s]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had numerous occasions were i&#8217;ve needed to upload files to the actual file systems on an esxi system, the only &#8216;proper&#8217; method is using the abysmal virtual infrastructure client and working mainly on a mac means I need to use VMware Fusion for windows to run the client to connect to the server (overkill). So it&#8217;s possible to enable ssh access to the server using the tech support menu, which allows access to the underlying hypervisor and it&#8217;s file systems and therefore it&#8217;s possible to scp files to the filesystems again this is quite slow and overkill due to the encryption being used. Also due to dropbear being used for the ssh it doesn&#8217;t use sftp, which means that you can&#8217;t mount the filesystems ala. FUSE and sshfs.</p>
<p>I should say at this point, the goal of all this was to allow me to keep all my ISOs on one server and be able to access them from everywhere also, I wanted a PXE server to be able to access the ISOs and loopback mount them and then present the contents via NFS to the installers started by PXE.</p>
<p>So looking around I found some ftp binaries that should work on ESXi, given that the console access for ESXi is done with busybox there is no file command to determine what binary type the files are so I was unaware of what binaries I could run inside ESXi. This all worked fine following the instructions located on the vm-help.com website <a title="vm-help website" href="http://www.vm-help.com/esx/esx3i/ESXi_enable_FTP.php" target="_blank">here</a> however a few of the instructions are a little bit incorrect such as the path to tcpd is incorrect in inetd, however i&#8217;ll leave you to fix that. So on the PXE server using FUSE again and curlftpfs to mount the filesystem and this revealed a glaring bug as soon as I loop back mounted the first ISO. Unfortunately the problem lies in the fact that curlftpfs will use memory to store the file as it downloads it for access by FUSE, so trying to open a 4GB DVD ISO quickly exhausted my PXE servers memory and then it became unresponsive, great.</p>
<p>Further research turned up a blog post about some guy trying to use <a href="http://unfs3.sourceforge.net/" target="_blank">unfs</a> to enable nfs sharing between two ESXi boxes, more specifically it was mentioned that linux binaries would work fine in the ESXi service console. One thing that was slightly confusing was that ESXi is x86_64 (64bit) however binaries that you need for the service console have to be 32bit otherwise you&#8217;ll get a confusing error that the binaries can&#8217;t be found when you try and run them due to busybox&#8217;s odd handling of errors. I present below the binaries required for nfs in ESXi :-</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/08/nfs.tar.gz">nfs binaries for x86</a></p>
<p>These are pretty easy to use, scp the file over to ESXi and untar it in /tmp al that&#8217;s left is to place the files in /tmp/sbin into /sbin and the files in /tmp/etc into /etc. The /etc/exports contains one entry to give access to /vmfs/volumes, which means that accessing the nfs share will give you the UUID paths for the disks containing VM&#8217;s and ISOs. To start the nfs server, start portmap first and then start unfsd which should be started the following way (unfsd -d &amp;), this is due to unfsd not being able to disconnect from console on start up (something to do with busybox I assume).</p>
<p>One final note, is that once another machine connect to the nfs share portmap will go start using 50%-70% cpu and will need stopping and starting for other nfs clients. I&#8217;m still looking into this, however having a cron job to restart the process every few minutes should do the job.</p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=219</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ESX 4.1 USB install and Password complexity changes</title>
		<link>http://thebsdbox.co.uk/?p=215</link>
		<comments>http://thebsdbox.co.uk/?p=215#comments</comments>
		<pubDate>Fri, 23 Jul 2010 12:41:56 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=215</guid>
		<description><![CDATA[As a point release i&#8217;m not sure why VMware decided to completely change the layout of files on the CD ISO along with change various system files, however they have. I suppose one change is beneficial as it improves the method for creating a USB stick which for previous versions of ESXi is documented here.]]></description>
			<content:encoded><![CDATA[<p>As a point release i&#8217;m not sure why VMware decided to completely change the layout of files on the CD ISO along with change various system files, however they have. I suppose one change is beneficial as it improves the method for creating a USB stick which for previous versions of ESXi is documented <a title="ESXi 4 on USB stick" href="http://thebsdbox.co.uk/?p=209" target="_blank">here</a>. They have also changed console access and ssh access to the hypervisor, which now can be enabled from the orange console screen under TSM (technical support mode) settings.</p>
<p><strong>Writing to a USB stick:</strong></p>
<p>Now the iso contains a simple file called imagedd.bz2 that is found in the root of the iso, which just need bunzip to decompress it and the dd&#8217;ing to a USB stick as documented before.</p>
<p><strong>Password complexity:</strong></p>
<p>At the moment there is nothing about this on the internet so it was a case of going through a few files to find it, but previously /etc/pam.d/common-password contained all of the password complexity requirements as documented on the <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1012033">VMware KB</a>. However now all of the password requirements are located in the file /etc/pam.d/system-auth, so this file will need editing if you don&#8217;t want insane password requirements for all users.</p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=215</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Further Xcode &#8211; HelloWorld</title>
		<link>http://thebsdbox.co.uk/?p=192</link>
		<comments>http://thebsdbox.co.uk/?p=192#comments</comments>
		<pubDate>Wed, 14 Apr 2010 10:15:35 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[HelloWorld]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=192</guid>
		<description><![CDATA[The inevitable HelloWorld application is a staple in learning a programming language, and provides the learner with the feeling of accomplishment as their first program speaks back to them… or something. Either way, this example will present us with a basic framework which we can use to build upon. To break it down this example]]></description>
			<content:encoded><![CDATA[<p>The inevitable HelloWorld application is a staple in learning a programming language, and provides the learner with the feeling of accomplishment as their first program speaks back to them… or something. Either way, this example will present us with a basic framework which we can use to build upon.</p>
<p>To break it down this example consists of,</p>
<p>- Creating a blank project in Xcode</p>
<p>- Using the default Delegate class and adding our own method (interface)</p>
<p>- Linking the GUI to our class</p>
<p>- Adding code to our method (implementation)</p>
<p>- Drinking tea</p>
<p><span id="more-192"></span></p>
<h2>Creating a project in Xcode</h2>
<p>This is pretty straight forward, open Xcode and Select Cocoa Application as the template to your new project. I&#8217;d recommend having a folder to contain all of your development projects in, however file management is your own business. To keep within the naming used by this example I would recommend calling your project <span class="error">HelloWorld</span> though.</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Xcode.jpg"><br />
<img class="aligncenter size-medium wp-image-193" title="Xcode" src="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Xcode-300x265.jpg" alt="" width="300" height="265" /></a></p>
<p>Once the project and it&#8217;s associated files have been created you&#8217;ll be presented with Xcodes main interface, which will have references to numerous frameworks and contain the files that we are really interested in (MainMenu.xib, HelloWorldAppDelegate .h/.m)</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Xcode1.jpg"><img class="aligncenter size-medium wp-image-194" title="Xcode1" src="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Xcode1-300x212.jpg" alt="" width="300" height="212" /></a></p>
<h2>Using the default delegate class</h2>
<p>It is possible to either create your own class or use the one that is now created by Xcode, given there is one created it makes it easier just to use it. In the main Xcode if we open the tree under HelloWorld and open the &#8216;Classes&#8217; folder we&#8217;ll see two files that are the HelloWorldAppDelegate files. If we open the header we&#8217;ll be presented with the interface, which contains the declaration of the class HelloWorldAppDelegate. We can see that this object inherits from the NSObject class and comes with one variable declared, along with the @property declaration (can be ignored for now).</p>
<p>We will modify this class declaration by adding a method to it, this method will be called ButtonPressed (it will be called, when a button is pressed&#8230;.) and should be written as followed:</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ButtonPressed<span class="sy0">:</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>sender<span class="sy0">;</span></div>
</div>
<p>This needs to be written after your variables have been declared but before your @end declaration, otherwise it will be out of scope for your class. The next step is to write the code that will be run (implemented?) when this method is called. As mentioned previously code that is to be run needs to be part of the @implementation declaration, which is in the other file that makes up your class. In this file you should find a method that is inherited from the parent class NSObject and we can ignore this method as we&#8217;ve no code to add to this being called. Under this method we&#8217;ll be adding our own method, which for the time being will look as followed:</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;"><span class="sy0">-</span><span class="br0">&#40;</span>IBAction<span class="br0">&#41;</span>ButtonPressed<span class="sy0">:</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>sender <span class="br0">&#123;</span></p>
<p><span class="co1">// Code to be run</span></p>
<p><span class="br0">&#125;</span></div>
</div>
<p>I would recommend compiling your modified source code, just to ensure that you&#8217;ve not made any syntax errors and also as it will save your changes that we&#8217;ve made so far. Should everything compile fine, it&#8217;s time to add a button on our blank GUI and link it to the class allowing it to call our method ButtonPressed.</p>
<h2>Linking the GUI to our class</h2>
<p>To link our code and our interface we&#8217;ll need to open the MainMenu.xib in interface builder and set up the various links between the GUI and the code. In Xcode clicking on the HelloWorld project tree object (above the Classes tree object) will again present us with all of the files that are part of our project and in here you&#8217;ll fine the .xib file. Double clicking on this file will start up the Interface Builder application and present us with the default window and menu bar that make up the GUI, along with the Interface project window containing the elements that make up the interface.</p>
<p>You should see that a class has been added to the interface builders window (presented as a blue cube), the class Hello Wold App Delegate is added automatically by the Xcode project creator(in future posts we&#8217;ll be adding our own classes). From the library window find the Push Button Object and drag that onto the blank window and then control+click on the button and drag down to the Hello World App Delegate Class.</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Interface-Builder.png"><img class="aligncenter size-medium wp-image-201" title="Interface Builder" src="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Interface-Builder-300x234.png" alt="" width="300" height="234" /></a>This will present you with a little drop down showing all methods available to the button and here you will see ButtonPressed, which you should select. This button is now linked to the Method ButtonPressed and we can now save our changes and quit from the Interface builder.</p>
<h2>Adding code to our method (implementation)</h2>
<p>At this point everything is linked up and declared, so compiling this code will actually call the method in our code when the button is pressed however at present there is no code in the method and therefore nothing will actually happen. So for our example we will use the NSLog function which allows us to print out messages to the system log (usually for debug purposes) however we will be printing out &#8220;Hello World&#8221;. The implementation of the ButtonPressed method will need the following adding:</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;">NSLog<span class="br0">&#40;</span>@<span class="st0">&quot;Hello Wold&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>Once this code is added open the Debugger console in Xcode by going to the Run menu item and finding Console (also by pressing Shift+Apple Key+R), and then selecting the &#8216;Build and Run&#8217; option.</p>
<h2>Drinking tea</h2>
<p>Enjoy a nice cup of tea whilst repeatedly pressing the Button and watching &#8220;Hello Wold&#8221; appear in the debug log.</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Hello-World.jpg"><img class="aligncenter size-medium wp-image-202" title="Hello World" src="http://thebsdbox.co.uk/wp-content/uploads/2010/04/Hello-World-300x181.jpg" alt="" width="300" height="181" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=192</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ESXi on USB</title>
		<link>http://thebsdbox.co.uk/?p=209</link>
		<comments>http://thebsdbox.co.uk/?p=209#comments</comments>
		<pubDate>Tue, 13 Apr 2010 20:22:35 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=209</guid>
		<description><![CDATA[As previously mentioned i&#8217;ve always been a XEN advocate for the hypervisor sitting on the physical machine, given the ready availability of a paravirtualised kernel for my Linux VMs. However a requirement to get to grips with VMware has led me to deploy ESXi on my systems so that I can have a proper look]]></description>
			<content:encoded><![CDATA[<p>As previously mentioned i&#8217;ve always been a XEN advocate for the hypervisor sitting on the physical machine, given the ready availability of a paravirtualised kernel for my Linux VMs. However a requirement to get to grips with VMware has led me to deploy ESXi on my systems so that I can have a proper look around at the OS and how it manages virtual machines. I&#8217;ve got disks all over the place, however my server I use for all my testing has a set up (and has reached capacity) meaning that i can&#8217;t use those disks. I found an old IDE disk that I installed in there, however the fiddling around with the oem.tgz(explained another time) never seemed to work for me at this point. So I picked up a USB key for €8 and decided to do a USB boot with the hypervisor on there.</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/04/ESX-on-USB.jpg"><img class="aligncenter size-medium wp-image-208" title="ESX-on-USB" src="http://thebsdbox.co.uk/wp-content/uploads/2010/04/ESX-on-USB-218x300.jpg" alt="" width="218" height="300" /></a>This is pretty straightforward task to do and can be accomplished in two methods of either botching the install halfway through or pulling the image from the install CD and doing a raw write to the USB device. I opted for pulling the image from the CD and dd&#8217;ing this image onto my USB key by doing the following methods:</p>
<p>1. Acquire VMware ESXi 4.0 from vmware</p>
<p>2. Mount the CD (in linux by mount -o loop &lt;path to ISO&gt; &lt;mount point&gt;, or double clicking in OSX <img src='http://thebsdbox.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p>3. Copy install.tgz from the CD and extract in a working location, which should eventually give you a directory structure.</p>
<p>4. bunzip /usr/lib/Vmware/install/VMware-VMvisor-big-164009-x86_64.dd.bz2 (or equivalent file)</p>
<p>5. dd if=&lt;path to .dd file&gt; of=&lt;path to USB device&gt;</p>
<p>6. Change BIOS settings to boot from USB and boot up.</p>
<p>7. Set IP address, download VSphere client and off you go.</p>
<p>Refer to <a href="http://www.vm-help.com">http://www.vm-help.com</a> for any issues</p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=209</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Xcode Primer/Tutorial/How-to</title>
		<link>http://thebsdbox.co.uk/?p=177</link>
		<comments>http://thebsdbox.co.uk/?p=177#comments</comments>
		<pubDate>Tue, 13 Apr 2010 14:17:07 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=177</guid>
		<description><![CDATA[A Google search for Xcode examples and how-to&#8217;s etc.. returns a lot of results, however after following a few steps it becomes clear that the older tutorials simply can&#8217;t be followed. The newer Xcode (3.2.1 is current) has had it&#8217;s UI changed so much, especially the interface builder and the majority of instructions no longer]]></description>
			<content:encoded><![CDATA[<p>A Google search for Xcode examples and how-to&#8217;s etc.. returns a lot of results, however after following a few steps it becomes clear that the older tutorials simply can&#8217;t be followed. The newer Xcode (3.2.1 is current) has had it&#8217;s UI changed so much, especially the interface builder and the majority of instructions no longer apply.</p>
<p>I&#8217;m writing up the steps i&#8217;m following to learn, so that I can follow them when I have forgotten something (which I frequently do) and so that anyone else can follow them if they wish. I don&#8217;t intend to ever go too far with Xcode development, so don&#8217;t expect to find a how-to to developing a game or a photoshop alternative.</p>
<h1><span id="more-177"></span>Introduction</h1>
<p>Before we start writing any code it&#8217;s probably best to go over some of the basics of Xcode and in particular Objective-C that is used to build cocoa apps and iPhone apps. It&#8217;s possible to develop your application without using Xcode and compiling with the gcc compiler but thats well beyond what I have the inclination to do and the Xcode UI comes with numerous benefits (along with some problems).</p>
<h2>Xcode</h2>
<p>Xcode consists of numerous peices:</p>
<p>- Xcode.app: the IDE used for coding, and a wrapper for the debugger and compiler for your applications.</p>
<p>- Interface Builder.app: The UI used to craft the GUI for your application and tie the actions of GUI to your code and receive it&#8217;s outcomes.</p>
<p>- Developer Tools Library: This has to be subscribed to and downloaded(free), and is the source code documentation.</p>
<p>The Xcode.app, works pretty well and will attempt to autocomplete your function names or class names, and points out build errors pretty well. The Interface Builder.app on the other hand is terribly buggy and will often leave you frustrated it can lose class information leaving you without the correct actions when you try and link your GUI to the code. The other problem that is common is it&#8217;s lack of getting focus when switching back from another application. If you&#8217;re in safari reading something and switch back to the Interface builder you&#8217;ll be interacting with it, however the app in focus is still safari meaning functionality doesn&#8217;t work (minimize safari and then try using Interface builder).</p>
<h2>Objective-C</h2>
<p>I&#8217;m not going to go into too much detail here as this isn&#8217;t a University training course, and if you&#8217;ve got no real programming experience (Java/C/C++) then you&#8217;ll possibly struggle here. I&#8217;d suggest getting your head around the basics of C++ before working with Objective-C as there is overlap, it&#8217;s just that the syntax is noticeably different.</p>
<h3>Declaring a class in objective-C</h3>
<p>An Objective-C class depends on two pieces, which are the &#8216;interface&#8217; and the &#8216;implementation&#8217;.</p>
<p>The interface consists of the declaration or &#8216;design&#8217; of a class, ranging from:</p>
<p>- it&#8217;s name</p>
<p>- classes it inherits from</p>
<p>- and it&#8217;s instance variables and methods that it has.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;">@interface DeclaredClassName <span class="sy0">:</span> ParentClassToInheritFrom<br />
<span class="br0">&#123;</span></p>
<p><span class="kw4">int</span>    ClassVariable<span class="sy0">;</span>   <span class="co1">// Variables for Class being declared</span></p>
<p><span class="br0">&#125;</span><br />
<span class="sy0">-</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>ClassMethod<span class="sy0">:</span><span class="br0">&#40;</span>NSString<span class="sy0">*</span><span class="br0">&#41;</span>aString<span class="sy0">;</span></p>
<p>@end</p></div>
</div>
<p>The implementation the consists of &#8216;fleshing out&#8217; the class, such as providing the code for the methods declared in the interface.</p>
<div class="codesnip-container" >
<div class="c codesnip" style="font-family:monospace;">@implementation DeclaredClassName<br />
<span class="sy0">-</span><span class="br0">&#40;</span>id<span class="br0">&#41;</span>ClassMethod<span class="sy0">:</span><span class="br0">&#40;</span>NSString<span class="sy0">*</span><span class="br0">&#41;</span>aString<br />
<span class="br0">&#123;</span></p>
<p>NSLog<span class="br0">&#40;</span>aString<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">//place the string in the system log</span></p>
<p><span class="br0">&#125;</span><br />
@end</div>
</div>
<h3>Linking it all together</h3>
<p>The next step is linking together a GUI to your classes and enabling your buttons and various other elements access to the methods and variables declared in the code. This sadly has to be done using the Interface Builder and can lead to a bit of confusion as &#8216;bugs&#8217; can appear, however the concept is as follows.</p>
<p>1. Open your default interface created by the project builder in Xcode (default it will be MainMenu.xib)</p>
<p>2. Numerous windows will be open, however the one to focus on is the main project window containing the elements that make up the GUI not the GUI designer itself (more detail and screenshots will be shown in the next post)</p>
<p>3. From the library you&#8217;ll want to drag the parent class to this window (usually we will inherit from NSObject), and then from the inspector window we can find the identity tab, and change the class to the ours (DeclaredClassName, from our example).</p>
<p>4. GUI elements can now use the methods that are declared in this class, so for example a button would have access to the method ClassMethod.</p>
<h2>Next Step will have to be hello world.</h2>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=177</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Castle Frankenstein</title>
		<link>http://thebsdbox.co.uk/?p=169</link>
		<comments>http://thebsdbox.co.uk/?p=169#comments</comments>
		<pubDate>Mon, 12 Apr 2010 15:53:17 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Germany]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=169</guid>
		<description><![CDATA[On Saturday we broke the cycle of spending the day aimlessly wandering around the centre of Darmstadt window shopping, eating junk food and ending up in the Ratskeller. Instead we went to visit Castle Frankenstein which is located a few kilometres away from Pfungstadt. I had been informed that the only way to this castle]]></description>
			<content:encoded><![CDATA[<p>On Saturday we broke the cycle of spending the day aimlessly wandering around the centre of Darmstadt window shopping, eating junk food and ending up in the Ratskeller. Instead we went to visit Castle Frankenstein which is located a few kilometres away from Pfungstadt. I had been informed that the only way to this castle was a long <span class="error">walk</span> uphill through a forest, however it appears there is a windy road all the way up to the castle that i&#8217;m sure <a href="http://dischord.org">Nick</a> and his car would definitely appreciate.</p>
<p>Getting the tram to the bottom of the path was pretty straight forward, however that pretty much was the limit of the planning for the walk. So after a broken German conversation with a nearby gentleman we were pointed in a direction and told the walk would take 2 to 3 hours (I nearly went straight home at this point). We pressed on walking following random numbers painted on trees and trying to keep sense of direction that our German tour guide had pointed us in.</p>
<p style="text-align: center;"><a style="text-decoration: none;" href="http://thebsdbox.co.uk/photos/main.php/v/Castle_Frankenstein/DSC_0278.jpg.html"><img class="aligncenter" src="http://thebsdbox.co.uk/photos/main.php?g2_view=core.DownloadItem&amp;g2_itemId=9063&amp;g2_serialNumber=2" alt="" width="150" height="100" /></a></p>
<p style="text-align: center;"><a href="http://thebsdbox.co.uk/photos/main.php/v/Castle_Frankenstein/DSC_0274.jpg.html"><img class="alignnone" src="http://thebsdbox.co.uk/photos/main.php?g2_view=core.DownloadItem&amp;g2_itemId=9051&amp;g2_serialNumber=2" alt="" width="150" height="100" /></a></p>
<p style="text-align: center;"><a href="http://thebsdbox.co.uk/photos/main.php/v/Castle_Frankenstein/DSC_0271.jpg.html"><img class="aligncenter" src="http://thebsdbox.co.uk/photos/main.php?g2_view=core.DownloadItem&amp;g2_itemId=9045&amp;g2_serialNumber=2" alt="" width="150" height="100" /></a></p>
<p>After walking aimlessly in the direction we assumed was correct we spotted what appeared to be the top of a castle, which still appeared quite away in the distance. After stumbling through a stables and being attacked by numerous crazy dogs, we started the ascent up the hill again vaguely in the direction of the castle. We managed the walk in one hour and twenty minutes, which beats the time given to us early quite respectably and includes fifteen minutes walking in the wrong direction at the top of one of the hills. I enabled the GPS application I have on my iPhone to give us an idea of what we were dealing with ascending/speed/distance etc.. This spat out a Google maps file that overlays the over the top route we took, which can be viewed <a href="http://thebsdbox.co.uk/misc/kmz/Walk%20to%20Frankensteins%20castle.kmz">here</a>.</p>
<p style="text-align: center;"><a href="http://thebsdbox.co.uk/photos/main.php/v/Castle_Frankenstein/DSC_0232.jpg.html"><img class="aligncenter" src="http://thebsdbox.co.uk/photos/main.php?g2_view=core.DownloadItem&amp;g2_itemId=8964&amp;g2_serialNumber=2" alt="" width="100" height="150" /></a> <a href="http://thebsdbox.co.uk/photos/main.php/v/Castle_Frankenstein/DSC_0235.jpg.html"><img class="aligncenter" src="http://thebsdbox.co.uk/photos/main.php?g2_view=core.DownloadItem&amp;g2_itemId=8973&amp;g2_serialNumber=2" alt="" width="100" height="150" /></a> <a href="http://thebsdbox.co.uk/photos/main.php/v/Castle_Frankenstein/DSC_0244.jpg.html"><img class="aligncenter" src="http://thebsdbox.co.uk/photos/main.php?g2_view=core.DownloadItem&amp;g2_itemId=8985&amp;g2_serialNumber=2" alt="" width="100" height="150" /></a></p>
<p>The full Gallery can be found <a href="http://thebsdbox.co.uk/photos/main.php/v/Castle_Frankenstein/">here</a> and if you are bored there is a wikipedia <a href="http://en.wikipedia.org/wiki/Castle_Frankenstein">page</a> too.</p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=169</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMware ESXi 3.5 /4.0 on Xen (How-to)</title>
		<link>http://thebsdbox.co.uk/?p=166</link>
		<comments>http://thebsdbox.co.uk/?p=166#comments</comments>
		<pubDate>Sun, 11 Apr 2010 18:41:12 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=166</guid>
		<description><![CDATA[This may seem a truly useless idea to a lot of people, however I&#8217;ve always found having a &#8216;lab&#8217; at home capable of building pretty much every system scenario very useful. Dealing daily with VMware ESX servers and VMs in a production environment means that I can never &#8220;fiddle&#8221; around and get to grips with]]></description>
			<content:encoded><![CDATA[<p>This may seem a truly useless idea to a lot of people, however I&#8217;ve always found having a &#8216;lab&#8217; at home capable of building pretty much every system scenario very useful. Dealing daily with VMware ESX servers and VMs in a production environment means that I can never &#8220;fiddle&#8221; around and get to grips with whats under the hood or deal with the unsupported or hidden functionality. My Xen server has allowed me to create pretty much every scenario I may need Oracle RAC clusters, interoperability between various operating systems and various development environments. When I first received the server that I use for my environments my first choice of setup was going to be a VMware ESX setup, however the hardware requirements restrict most installations to a subset of hardware configurations meaning I couldn&#8217;t install it. Originally it would have been impossible to install it under a xen HVM on the basis that the virtualised network adapters are unsupported by ESX, however luckily from 3.4.0 onwards the xen-tools have been updated and allow the use of the e1000/e100 network.</p>
<p><span id="more-166"></span></p>
<p>Step 1.</p>
<p>Create a basic hvm scenario:</p>
<p>1.5Gb LVM or disk image for the ESX install, other disks can be added for use as a datastore.</p>
<p>You&#8217;ll need an esx cd image, which can be downloaded along with a licence from vmware.com</p>
<p>I allocated about 80% of the memory of my server, along with 3 of the 4 cpus.</p>
<p>Set it up to output to a VNC session.</p>
<p>Add a nic and ensure it has the following set:</p>
<pre>model=e1000</pre>
<p>Step 2.</p>
<p>Start the domU up and ensure it&#8217;s booting from CD, connect to the VNC session and watch it load up the VMkernel and e1000 module etc.. Eventually you&#8217;ll get to the install steps which you can quickly go through until it errors with the issue of no devices to deploy the install to. Once at this point it&#8217;s a simple <span class="error">alt-F1</span> to the console prompt to access the &#8216;support&#8217; features. At the console log in with the username root and a &lt;blank&gt; password, check your IDE disk is shown using <span class="error">fdisk -l</span> and then <span class="error">cd</span> to <span class="error">/usr/lib/vmware/installer/Core/</span> and edit with <span class="error">vi</span> the file <span class="error">TargetFilter.py</span>. This file is used to determine whether there is a device that can be used to deploy the ESX system to, and contains the line that we can change to allow our IDE device to be used.</p>
<p>Change</p>
<pre>return interface.GetInterfaceType() == ScsiInterface.SCSI_IFACE_TYPE_IDE</pre>
<p>to</p>
<pre>return interface.GetInterfaceType() == ScsiInterface.SCSI_IFACE_TYPE_ISCSI</pre>
<p>Once this change has been made, the installer will be given an iSCSI device in place of in IDE device and the install will proceed to use it, this should then be kicked off by starting <span class="error">install</span> from the command line. You&#8217;ll need to change back to the correct console prompt as the installer will move the terminal back, so pressing <span class="error">alt-F1</span> will return you to the correct terminal. The installer will not list your disks and the installation can begin, once completed the system will want to reboot and will come up with a DHCP address for it&#8217;s first e1000 adapter.</p>
<p><strong>Regular ESX service can continue from here</strong> (i.e. get the Infrastructure Client / set [credentials,network address]  / build some VMs).</p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=166</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH tunnels</title>
		<link>http://thebsdbox.co.uk/?p=164</link>
		<comments>http://thebsdbox.co.uk/?p=164#comments</comments>
		<pubDate>Tue, 23 Mar 2010 16:57:50 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=164</guid>
		<description><![CDATA[Sometimes getting to various servers especially virtualised systems, can be a nightmare due to various firewall rules restricting the physical machine or just down to the network architecture itself. For this example we&#8217;ll use two virtual machines which are located behind nat&#8217;d firewalls on two different physical hosts the firewalls permit SSH access out that]]></description>
			<content:encoded><![CDATA[<p>Sometimes getting to various servers especially virtualised systems, can be a nightmare due to various firewall rules restricting the physical machine or just down to the network architecture itself. For this example we&#8217;ll use two virtual machines which are located behind nat&#8217;d firewalls on two different physical hosts the firewalls permit SSH access out that is it.</p>
<p style="text-align: center;">[PHYS_A [VM_A:5901]]  &lt;&#8211;/&#8211;&gt;  [PHYS_B [VM_B]]</p>
<p style="text-align: left;">VM_A needs to run a VNC Server that will bind to VM_A:5901, however will no access to the firewall etc.. there is no way that there can be any port forwarding to this internal VM. We could use IPtables on the VM_A and then again use IPtables on PHYS_A to bind 5901 from VM_A&#8217;s IP to PHYS_A, however we are still behind a firewall.</p>
<p style="text-align: left;">To accomplish this sharing a server running SSH is required, the location of this server is completely irrelevant as long as it&#8217;s accessible with a standard user account. This server will be called SSH and both machines can access it through the firewall.</p>
<p style="text-align: center;">[PHYS_A [VM_A:5901]]  &lt;&#8212;&gt; [SSH] &lt;&#8212;&gt;  [PHYS_B [VM_B]]</p>
<p style="text-align: left;">The next step is to push the port on VM_A to the SSH server using the following command:</p>
<pre>[user@VM_A]$ ssh -R5901:127.0.0.1:5901 -C user@SSH</pre>
<p style="text-align: left;">This will open a session that will create the port 5901 on the server SSH, this can be confirmed by running a netstat -a on the server SSH and seeing that 5901 is now listed as a TCP4 listening port.</p>
<p style="text-align: center;">[PHYS_A [VM_A:5901]]  &lt;&#8212;&gt; [SSH:5901] &lt;&#8212;&gt;  [PHYS_B [VM_B]]</p>
<p style="text-align: left;">The next step is to pull the port on SSH to VM_B where we have the client software (vncviwer). The following command is used to pull the port from an IP address and bind it to a local port in VM_B.</p>
<pre>[user@VM_B]$ ssh -L5901:127.0.0.1:5901 -C user@SSH</pre>
<p style="text-align: left;">There will now be the port created on VM_B that tunnels through SSH to VM_A.</p>
<p style="text-align: center;">[PHYS_A [VM_A:5901]]  &lt;&#8212;&gt; [SSH:5901] &lt;&#8212;&gt;  [PHYS_B [VM_B:5901]]</p>
<p style="text-align: left;">The user on VM_B can now use the service as if it was actually running on the host itself.</p>
<pre>[user@VM_B] vncviewer localhost:5901</pre>
<p>Notes for SSH flags:</p>
<p>-R   [port to bind to on remote host] : [local host IP] : [localhost port]</p>
<p>-L   [local port to use] : [remote IP] : [remote port]</p>
<p>-C (adds compression)</p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=164</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOW-TO: Sun Cluster in VMware Fusion</title>
		<link>http://thebsdbox.co.uk/?p=160</link>
		<comments>http://thebsdbox.co.uk/?p=160#comments</comments>
		<pubDate>Fri, 19 Mar 2010 10:38:48 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://thebsdbox.co.uk/?p=160</guid>
		<description><![CDATA[VMWare fusion cluster… For all those people that need a sun cluster on their macbook. This is a small how-to of sorts, I&#8217;ll not go into full detail regarding everything as if you can&#8217;t manage the simpler steps then I find it unlikely you&#8217;ll manage to handle the later tasks of configuring sun cluster. So..]]></description>
			<content:encoded><![CDATA[<p><strong>VMWare fusion cluster…</strong></p>
<p>For all those people that need a sun cluster on their macbook. This is a small how-to of sorts, I&#8217;ll not go into full detail regarding everything as if you can&#8217;t manage the simpler steps then I find it unlikely you&#8217;ll manage to handle the later tasks of configuring sun cluster.</p>
<p><span id="more-160"></span></p>
<p>So..</p>
<p><strong>Step #1.</strong></p>
<p>Create a Virtual Machine and install Solaris 10. (Basic configuration, it will want one disk, and one network interface) For the Filesystem layout, the default set up will be an 8Gb disk this needs to be split something like</p>
<pre>512 swap</pre>
<pre>512 /globaldevices</pre>
<pre>7gb /</pre>
<p>In the installation provide a hostname along the lines of node-a and give the network interface a useable IP address, VMware uses 172.16.190.X so use this range for your IP address. Install the default packages and complete the installation. Once rebooted:</p>
<pre>#svcadm disable sendmail</pre>
<pre>#svcadm disable cde-login</pre>
<p>Once these services are disabled create a user and shut the vm down.</p>
<p><strong>Step #2</strong></p>
<p>Open finder and locate the virtual machine on your mac, right click and select duplicate. Rename the Virtual Machine to node-b or at least make it match up to your naming system. Boot up the duplicate system (node-b) and once logged in edit the following files:</p>
<pre>/etc/nodename</pre>
<pre>/etc/hostname.e1000g0</pre>
<pre>/etc/hosts</pre>
<p>Give the system a different IP address and alter the naming so that it follows on from the previous virtual machine. Also ensure that in the hosts file you keep the record for the other system otherwise this will need adding later on. Reboot the system and ensure that it&#8217;s networking information is correct, you can try pinging between the two machines and ensure the hosts file entries are correct otherwise the Sun Cluster will fail later. Once tested ensure that both machines are switched off.</p>
<p><strong>Step #3</strong></p>
<p>Open Terminal from /Applications/Utilites on the mac and change directory to where the Virtual machines are located. Change directory to the first node and locate the .vmx file that is in there, this will need opening in vim and the following line will need adding to it:</p>
<pre>disk.locking = "FALSE"</pre>
<p>In VMware fusion open the settings of the second node and rename it to node-b to make it easier to differentiate between the nodes in VMware. Open the settings of the first node, and go to the hard disks setting. Add 3 or more hard disks to the first node, and apply the changes, these disks will be used as our shared storage for the cluster. Open the hard disk settings for the second node and add a disk to the virtual machine, under the filename drop down menu select Choose existing disk… and add the disks from node-a, whilst ensuring that &#8216;Share this virtual disk …&#8217; is selected. Also add another two network adapters to each virtual machine, these will be used for the cluster interconnects.</p>
<p><a href="http://thebsdbox.co.uk/wp-content/uploads/2010/03/Untitled_9.jpg"><img class="aligncenter size-medium wp-image-161" title="Untitled_9" src="http://thebsdbox.co.uk/wp-content/uploads/2010/03/Untitled_9-300x187.jpg" alt="VMWare disk select" width="300" height="187" /></a></p>
<p><strong>Step #4</strong></p>
<p>Start the nodes up that are part of the cluster, you should test the disks are visible by using the format command. Copy the sun cluster installer over to both nodes and either using X forwarding or just use the console start the installer. Once the installer starts ensure that the following components are installed:</p>
<pre>Sun Cluster</pre>
<pre>Sun Cluster Agentts</pre>
<pre>Quorum Server</pre>
<p>The installer will patch a few packages and then confirm that the system requirements are met. Select &#8216;Configure Now&#8217; and ensure that Support for Remote configuration is enabled, then start the installer.</p>
<p><strong>Step #5</strong></p>
<p>Once the installer has finished, you&#8217;ll be returned to the prompt and its not the point to actually &#8216;install&#8217; the cluster. On the first node (node-a), change to the cluster binaries directory /usr/cluster/bin and start scinstall. Select the Create a new cluster node and follow the actions below, ensure that you select Custom cluster install.</p>
<pre>What is the name of the cluster you want to establish?  vmcluster</pre>
<pre></pre>
<pre>Node name (Control-D to finish):  node-a</pre>
<pre>Node name (Control-D to finish):  node-b</pre>
<pre>Node name (Control-D to finish):  ^D</pre>
<pre></pre>
<pre>Do you need to use DES authentication (yes/no) [no]?  no</pre>
<pre></pre>
<pre>Should this cluster use at least two private networks (yes/no) [yes]?  yes</pre>
<pre></pre>
<pre>Does this two-node cluster use switches (yes/no) [yes]?  no<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></pre>
<p><em>Then for the cluster interconnects ensure that e1000g1 connects to e1000g1 and e1000g2 connects to e1000g2. </em></p>
<pre>Is it okay to accept the default network address (yes/no) [yes]?  yes</pre>
<pre></pre>
<pre>Is it okay to accept the default netmask (yes/no) [yes]?  yes</pre>
<pre></pre>
<pre>Do you want to turn off global fencing (yes/no) [no]?  no</pre>
<pre></pre>
<pre>Do you want to disable automatic quorum device selection (yes/no) [no]?  no</pre>
<p><em>The Globaldevices set up should use /globaldevices by default, it will check the existence on both nodes.</em></p>
<pre>Is it okay to create the new cluster (yes/no) [yes]?  yes</pre>
<pre></pre>
<pre>Interrupt cluster creation for cluster check errors (yes/no) [no]?  no</pre>
<p>{cluster installs and nodes reboot}</p>
<p>Step #6</p>
<p>If you wish to use the Solaris webconsole plugin for Sun Cluster, it helps to bind the console listening port to an external IP as it&#8217;s bound to localhost by default:</p>
<pre># smcwebserver stop
 # svccfg -s svc:/system/webconsole setprop options/tcp_listen = true
 # svcadm refresh svc:/system/webconsole
 # /usr/share/webconsole/private/bin/wcremove -i console
 # svcadm clear system/webconsole:console
 # smcwebserver start</pre>
<pre></pre>
<p>This can then be accessed on http://VM_IP:6789/ .</p>
<p>Job done.</p>
]]></content:encoded>
			<wfw:commentRss>http://thebsdbox.co.uk/?feed=rss2&amp;p=160</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
