<?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; linux</title>
	<atom:link href="http://www.crazymcphee.net/x/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crazymcphee.net/x</link>
	<description>programming idiom and methodology</description>
	<lastBuildDate>Tue, 13 Jul 2010 21:56:44 +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>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>
