<?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>let x=x &#187; unix</title>
	<atom:link href="http://www.crazymcphee.net/x/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crazymcphee.net/x</link>
	<description>programming idiom and methodology</description>
	<lastBuildDate>Wed, 11 Aug 2010 01:13:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Running Oracle XE on Mac OSX using virtualised JeOS</title>
		<link>http://www.crazymcphee.net/x/2009/08/27/oracle-xe-on-mac-osx/</link>
		<comments>http://www.crazymcphee.net/x/2009/08/27/oracle-xe-on-mac-osx/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 06:30:20 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[oracle-xe]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[virtualisation]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=462</guid>
		<description><![CDATA[So Oracle in its wisdom doesn&#8217;t have Mac OSX version of its free database. This is of course really annoying to Mac users who need to develop systems that use Oracle databases &#8211; Oracle XE is a great little database especially for development environments. Recently I found myself in a situation where I would be [...]]]></description>
			<content:encoded><![CDATA[<p>So Oracle in its wisdom doesn&#8217;t have Mac OSX version of its free database. This is of course really annoying to Mac users who need to develop systems that use Oracle databases &#8211; Oracle XE is a great little database especially for development environments. Recently I found myself in a situation where I would be needing to bind a Hibernate object to a PL/SQL function in the target Oracle database rather than a table or view per se. As the function call is database specific, when developing the application I needed to use an Oracle database and could use e.g. HSQL or MySql as a substitute Oracle DB for development purposes. Oracle XE is a great way out here because it fully supports PL/SQL packages and functions and procedures.</p>
<p>I was off the client site so I couldn&#8217;t rely on a fast connection to their development databases. I just wrote a dummy function that was called the same as the real function with the same input and output parameters and instead of the complex function body it just wrapped a simple mock table of test data. Problem solved, Oracle XE to the rescue. But first you have get Oracle XE running on your Mac, this is what the rest of this article is about, because you can&#8217;t just download an Oracle XE edition for the Macintosh.</p>
<h3>Virtualisation is great &#8211; use a Linux VM</h3>
<p>However modern Virtualisation is your saviour. Put simply, you can use a virtualisation tool like Parallels, or my choice, VMWare Fusion, to run a virtualised version of Linux that contains the Oracle XE instance.</p>
<p>Because VMs can waste a bit of your local resources, luckily there is a specialised version of Ubuntu designed for running as a virtualised machine of this type. Its called JeOS (pron. <em>Juice</em>, apparently). It doesn&#8217;t have an X-window environment, just the shell, so it&#8217;s pretty lightweight and can run, with Oracle XE, in less than 512MB of memory. Perfect for getting a copy of Oracle XE onto your Macbook Pro.</p>
<p>It will however, eat up a couple of gigabytes of disk space, up to the maximum limit you choose for your disk size in the VMWare configuration. However it will only use the current amount of disk needed, as VMWare will expand the size of the image as needed (I&#8217;ll just assume that Parallels does something similar).</p>
<h3>Setting it up &#8211; basic instructions</h3>
<p><a href="http://tedwise.com/2008/10/03/running-oracle-for-development-on-the-mac/">This page here</a> &#8211; has a great set of instructions for getting JeOS installed and configured with Oracle XE on it. Follow the instructions there <em>exactly</em> &#8211; but only to the point where you install and configure Oracle XE &#8211; don&#8217;t go further than that.</p>
<p>Make sure you configure plenty of swap space as outlined in the instructions.</p>
<blockquote>
<h3>Setting it up on standard Ubuntu/Debian</h3>
<p>If you are running a full Ubuntu or other Debian based instance, the instructions are somewhat simpler. Install it as per normal in your VM. But make sure your swap space is twice the memory you have assigned to the VM! Oracle XE demands things to be like that.</p>
<p>Add</p>
<pre>deb http://oss.oracle.com/debian unstable main non-free</pre>
<p>to /etc/apt/sources.list and then:</p>
<pre>$ wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install oracle-xe</pre>
<p>These instructions were cribbed from <a href="http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html">here</a>.</p></blockquote>
<h3>After installing and configuring Oracle XE</h3>
<p>After you run the XE configuration (&#8216;$&#8217; represents the Unix shell prompt and should not be typed);</p>
<pre>$ sudo /etc/init.d/oracle-xe configure</pre>
<p>If you&#8217;re running on JeOS don&#8217;t yet make the machine &#8220;headless&#8221;! Or you might find there are issues with the &#8220;Apex&#8221; application. The problem is that the Apex application, which is a useful web-based administration program for Oracle XE (especially for developers who don&#8217;t want to be forced to use sqlplus for all their database administration), will only allow connections from localhost &#8211; and you don&#8217;t have X-window, or a browser, to access it (I don&#8217;t know if lynx will work with Apex and I wasn&#8217;t going to try).</p>
<h3>Get SSH installed</h3>
<p>First get SSH installed in JeOS so you can get to the command prompt remotely:</p>
<pre>$ sudo apt-get install ssh</pre>
<h3>Find out the VM&#8217;s IP address</h3>
<p>Now, if you type <em>ifconfig</em> (<em>/sbin/ifconfig</em> if that&#8217;s not found on your path) you will be able to determine the IP address of your VM running on your Macintosh. At this point you can connect to the VM using ssh from a Macintosh terminal window:</p>
<pre>$ ssh username@ip_address</pre>
<p>Actually, at this point you can go ahead and make the machine headless, if you want. I would recommend not to do that until you&#8217;re sure of everything you&#8217;ve configured.</p>
<h3>Configure environment to run sqlplus</h3>
<p>After you&#8217;ve logged back into the running Linux VM using ssh from the Mac Terminal, the next thing is you&#8217;ve got to get sqlplus access working to the XE instance you installed. Funnily enough, although the .deb file that is installed off the Oracle site creates an oracle user, it doesn&#8217;t in any way set that user up so you can use the command line tools. SO you can&#8217;t just su &#8211; oracle and get a functional environment.</p>
<p>Anyway, you will need to do two things to your environment; add the <em>ORACLE_HOME</em> environment variable and set up your <em>PATH</em> so it can find <em>sqlplus</em>.</p>
<pre>$ export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
$ export PATH=${PATH}:${ORACLE_HOME}/bin</pre>
<p>You should add these two lines to your <em>.profile</em> or <em>.bash_profile</em> file &#8211; probably best for the &#8216;oracle&#8217; user that the installation will have created. But you can actually set this up for any regular user that you configure in this VM. You can also just type them at the command line to get them in your current environment, if you have to.</p>
<h3>Configure Apex to accept non-localhost connections</h3>
<p>The web-based administration software for XE, called &#8220;APEX&#8221;, only binds to <em>localhost</em>. This is a big hassle if your VM copy of Linux (like JeOS) doesn&#8217;t have a GUI, because you don&#8217;t have a browser (lynx/links excluded, I did not try those!).  However, you can make Apex bind to the &#8220;external&#8221; IP address for your VM, but you&#8217;ll need to use <em>sqlplus</em>.</p>
<p>To run <em>sqlplus</em>, do the following:</p>
<pre>$ sqlplus system@XE
  Enter password:</pre>
<p>Enter the password you specified at the &#8216;oracle-xe configure&#8217; step above.</p>
<p>At the SQL prompt, enter the following command:</p>
<pre>SQL&gt; EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);</pre>
<p>Now you&#8217;ll have to stop and start Oracle to make the configuration active:</p>
<pre>$ sudo /etc/init.d/oracle-xe restart</pre>
<p>After which, if you type</p>
<pre>$ netstat -tna</pre>
<p>You should find a line</p>
<pre>tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN</pre>
<p>This indicates a process is listening to the port 8080 on all IP addresses for connections coming from any other IP address. Assuming you specified port 8080 at the &#8216;oracle-xe configure&#8217; step. Sometimes I use 8888 especially if I have a Tomcat instance in the same VM, as Tomcat will also like to run on 8080 and I&#8217;d prefer it if it did.</p>
<h3>Test and use Apex</h3>
<p>Test this connection in your browser, in my case, the address was 10.1.2.17, but you will have to substitute your own VM&#8217;s IP address &#8211; <em>http://10.1.2.17:8080/apex</em>. I like to make an /etc/hosts entry that points to this address as &#8216;oracleXE&#8217;. That way I can use a symbolic name in my jdbc connection strings and actually switch which instance of XE I am using depending which VM I&#8217;ve fired up without editing the jdbc configuration of the application under development &#8211; I just change the /etc/hosts entry instead.</p>
<p>Anyway once you connect to apex you can login using the user name and password you set up during your XE install and configuration process (same as you used for <em>sqlplus</em>). The users will be sys and system, you can use them to create new users to contain your databases for development.</p>
<p>The same IP address as above will be used to connect to your Oracle database from the programs you are developing. The default port should be 1521 and the SID should be XE.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/08/27/oracle-xe-on-mac-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hosts and subdomains and infrastructure deployment</title>
		<link>http://www.crazymcphee.net/x/2009/04/07/hosts-and-subdomains/</link>
		<comments>http://www.crazymcphee.net/x/2009/04/07/hosts-and-subdomains/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 02:35:54 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[infrastructure and frameworks]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[infrastructure]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=308</guid>
		<description><![CDATA[It always amazes me how many IT infrastructure managers apparently fail to understand just what a &#8216;subdomain&#8217; is. How many of the developers reading this blog entry have ever been confronted with the situation of deploying their applications onto infrastructure that&#8217;s named like the following? Local development: localhost, localhost, localhost, joes-dev-box Development / Integration: tomcatdev-svr1, [...]]]></description>
			<content:encoded><![CDATA[<p>It always amazes me how many IT infrastructure managers apparently fail to understand just what a &#8216;subdomain&#8217; is. How many of the developers reading this blog entry have ever been confronted with the situation of deploying their applications onto infrastructure that&#8217;s named like the following?</p>
<ol>
<li>Local development: localhost, localhost, localhost, joes-dev-box</li>
<li>Development / Integration: tomcatdev-svr1, orcldb0, mq-dev, joes-dev-box</li>
<li>Testing / UAT: uat-redhat3, uat-rhas7, messageQ-uat1, security-ldap12-DEV</li>
<li>Production: appserver-weblogic-PROD0, orclRAQ-1, mq0, fw0-sec-ldap-bldg6</li>
</ol>
<p>This of course, necessitates a number of custom configurations for every environment, and depending on your technology, your deployment strategy, and your configuration management , it can quickly and rapidly get either unmanageable, or worse, configuration can be lost, or at least not backed up or documented adequately to enable reconsititution in case of catastrophic failure. What we as developers, often yearn for is a simple scheme like the following:</p>
<ol>
<li>app-server, database, message-queue, ldap-server</li>
</ol>
<p>Of course, we sometimes try to map those sorts of schema into the chaotic environment listed above. Then we have custom host-file entries to manage the IP address resolution for us. of course, is this /etc/host file in any sort of configuration management scheme? Usually not. The trick is course, to use the schema as above but /etc/resolv.conf file to force resolution to a default sub-domain, which in the four cases above, are;</p>
<ol>
<li>developer</li>
<li>integration</li>
<li>uat</li>
<li>prod</li>
</ol>
<p>Then using either network-based split-segment DNS resolution, or simply a private dns server only visible to resources inside the firewall, to resolve to the relevant sub-domain and thence to the correct IP. But then, there&#8217;s the inertia from the infrastructure management, who want to identify machines according to the operating system and the major software brand that&#8217;s installed into them, rather than the functional description. Quite apart from the fact that those two schemes can live side by side anyway in a split-segment DNS.</p>
<p>I&#8217;m sorry that I don&#8217;t have a full solution, I just wish it was easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/04/07/hosts-and-subdomains/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upgrading to Maven 2.1.0 on Macintosh OS X</title>
		<link>http://www.crazymcphee.net/x/2009/03/23/upgrading-to-maven-210-on-macintosh-os-x/</link>
		<comments>http://www.crazymcphee.net/x/2009/03/23/upgrading-to-maven-210-on-macintosh-os-x/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 02:43:30 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[tools and techniques]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[macintosh]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=265</guid>
		<description><![CDATA[Recently I found a Maven plugin that wouldn&#8217;t run under Maven version 2.0.6, and I had to upgrade it on my Macintosh. I quickly discovered the usual *nix upgrade (unpack, then update ${PATH}) didn&#8217;t seem to work, as the Macintosh OS X 10.5 comes with Maven pre-installed in /usr/share/ directory. Tip &#8211; I found where [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I found a Maven plugin that wouldn&#8217;t run under Maven version 2.0.6, and I had to upgrade it on my Macintosh. I quickly discovered the usual *nix upgrade (unpack, then update ${PATH}) didn&#8217;t seem to work, as the Macintosh OS X 10.5 comes with Maven pre-installed in /usr/share/ directory.</p>
<blockquote><p><strong><em>Tip</em></strong> &#8211; I found where it was installed with this simple series of *nix commands that should work on most Unix variants such as Linux, for anything on your ${PATH}, using the &#8216;which&#8217; command:</p>
<pre>CrazyMcphee:systems smcphee$ which mvn
/usr/bin/mvn
CrazyMcphee:systems smcphee$ ls -lrta /usr/bin/mvn
lrwxr-xr-x  1 root  wheel  24  9 Mar 22:50 /usr/bin/mvn -&gt; \
  /usr/share/maven/bin/mvn</pre>
</blockquote>
<p>Following the information on <a href="http://www.gridshore.nl/2008/01/28/upgrading-maven-on-the-mac/">this page</a> as a template, here&#8217;s the procedure I used to upgrade to the latest version at time of writing, Maven 2.1.0:</p>
<pre>CrazyMcphee:~ smcphee$ sudo su -
Password:
CrazyMcphee:~ root# cd /usr/share/
CrazyMcphee:share root# mv maven maven-2.0.6
CrazyMcphee:share root# cp -R \
/Users/smcphee/Development/systems/apache-maven-2.1.0/ \
maven-2.1.0
CrazyMcphee:share root# ln -s maven-2.1.0/ maven
CrazyMcphee:share root# exit
logout
CrazyMcphee:~ smcphee$ mvn -version
Apache Maven 2.1.0 (r755702; 2009-03-19 05:10:27+1000)
Java version: 1.5.0_16
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
Default locale: en_AU, platform encoding: MacRoman
OS name: "mac os x" version: "10.5.6" arch: "i386" Family: "unix"</pre>
<p>You&#8217;ll note I used a symlink for the &#8216;maven&#8217; directory to the &#8216;maven-2.1.0&#8242; directory (the command &#8216;ln -s maven-2.1.0/ maven&#8217; &#8230;). This is to allow me to quickly switch back to version 2.0.6 if I find any incompatibilities in my old POM files with the new version of Maven, by simply changing which directory the symlink points to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/03/23/upgrading-to-maven-210-on-macintosh-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>UNIX simplicity and agility</title>
		<link>http://www.crazymcphee.net/x/2009/02/15/unix-simplicity-and-agility/</link>
		<comments>http://www.crazymcphee.net/x/2009/02/15/unix-simplicity-and-agility/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 09:14:17 +0000</pubDate>
		<dc:creator>Scot Mcphee</dc:creator>
				<category><![CDATA[professional practice]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[methodology]]></category>
		<category><![CDATA[profession]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.crazymcphee.net/x/?p=184</guid>
		<description><![CDATA[In the course of a series of comments around my post about Oracle&#8217;s ADF, I started to think about &#8220;vendors&#8221; and their technology stacks.  Of all the big vendors whose technology comes closest to playing nice with Agile development and (especially) agile engineering practise and discipline (e.g. test-driven design, pair programming, fearless refactoring, etc), I [...]]]></description>
			<content:encoded><![CDATA[<p>In the course of a series of comments around <a href="http://www.crazymcphee.net/x/2009/02/14/gui-builders-modern-development-practices-and-vendor-lock-in/">my post about Oracle&#8217;s ADF</a>, I started to think about &#8220;vendors&#8221; and their technology stacks.  Of all the big vendors whose technology comes closest to playing nice with Agile development and (especially) agile engineering practise and discipline (e.g. test-driven design, pair programming, fearless refactoring, etc), I have found the most in-tune with this, is Sun. I have absolutely no scientific data for this opinion, mind.</p>
<p>I think that maybe this is because they are a &#8216;UNIX&#8217; company with an excellent &#8216;UNIX&#8217; pedigree and a generally &#8216;UNIX&#8217; mentality through and through. Unlike Oracle, which is pretty agnostic about operating systems, and IBM, which only caught the UNIX fervor in the last decade (although it&#8217;s always had a UNIX implementation, i.e. AIX, it&#8217;s not like the whole company has been orientated around this operating system, unlike Sun and SunOS/Solaris). But what does UNIX have to do with agility?</p>
<p>I am of the firm view that MS Windows is just not a development platform. The reason is that I think it just doesn&#8217;t have the right command-line interface. There&#8217;s no <em>find, </em><em>diff, ps, </em><em>awk, </em><em>sed</em>, and the other multitude of small tools that make a developer&#8217;s life much easier. It almost embodies the big-tool-does-it-all thinking that I think is terribly inelegant &#8211; and unagile.</p>
<p>Now I have been using UNIX since 1989. In those days it was a Amdahl UNIX as well as a version of SunOS. Some point after that &#8211; early 1990s I guess &#8211; I had a version of Linux installed on a personal computer of mine. In those days you had to boot off floppy with a super-basic kernel and a 25&#215;80 terminal, recompile the kernel to suit the exact hardware setup of your computer. Just to get a serial port and modem functioning to run PPP over. It was pretty dire, hands-on, stuff &#8211; but I was young and had time to do it. This doesn&#8217;t sound very simple does it?</p>
<p>But there <em>is</em> a simplicity to UNIX, it&#8217;s the <em>entire UNIX philosophy</em>. And it is this:</p>
<blockquote><p>Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. (<a href="http://en.wikipedia.org/wiki/Unix_philosophy" target="_blank">wikipedia</a>)</p></blockquote>
<p>And from the same Wikipedia page as above, here&#8217;s an extension of the UNIX philosophy by <span class="new">Mike Gancarz, the &#8220;9 Paramount Precepts&#8221;:</span></p>
<blockquote>
<ol>
<li>Small is beautiful.</li>
<li>Make each program do one thing well.</li>
<li>Build a prototype as soon as possible.</li>
<li>Choose portability over efficiency.</li>
<li>Store data in flat text files.</li>
<li>Use software leverage to your advantage.</li>
<li>Use shell scripts to increase leverage and portability.</li>
<li>Avoid captive user interfaces.</li>
<li>Make every program a filter.</li>
</ol>
</blockquote>
<p>I reckon that points 1, 2, 3 and 6 are definitely Agile in nature (point 8, I think, goes to the point I was trying to make about IDE-to-Server integration in the ADF post).</p>
<p>None of this is exactly the Agile Manifesto, of course. However Agile is a similar philosophy that values simplicity in order to manage complexity. And this simplicity takes some considerable effort to achieve, as it does in Unix. But its benefits in the end are enormous.</p>
<blockquote class="templatequote">
<div></div>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.crazymcphee.net/x/2009/02/15/unix-simplicity-and-agility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
