<?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>Source Allies Blog &#187; Unix</title>
	<atom:link href="http://blogs.sourceallies.com/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.sourceallies.com</link>
	<description>Technical and process thinking from Source Allies employees</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:40:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing Ubuntu: A Trial and Error Account</title>
		<link>http://blogs.sourceallies.com/2010/05/installing-ubuntu-a-trial-and-error-account/</link>
		<comments>http://blogs.sourceallies.com/2010/05/installing-ubuntu-a-trial-and-error-account/#comments</comments>
		<pubDate>Fri, 07 May 2010 18:04:12 +0000</pubDate>
		<dc:creator>Ryan  Day</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=1509</guid>
		<description><![CDATA[Recently I decided it was time to grab up a spare computer that I could use for tinkering as well as back up files from my other machine in the event that it goes down. The one big thing I wanted to do was to install a Linux OS and experience everything that comes with [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I decided it was time to grab up a spare computer that I could use for tinkering as well as back up files from my other machine in the event that it goes down. The one big thing I wanted to do was to install a Linux OS and experience everything that comes with it. This would be my first time installing a Linux OS. I chose to install <a href="http://www.ubuntu.com/" target="_blank">Ubuntu</a> since it is the most widely used and has the most extensive documentation and help available.</p>
<p><strong>The Download</strong><br />
When I bought this machine it had a fresh install of Windows XP and came with the recovery disk which was excellent because I had to use it multiple times before I got things just the way I wanted them. Since this computer didn’t have any files I didn’t have to worry about backing anything up but it would be a must if considering putting Ubuntu on an everyday machine. To install Ubuntu you need the install CD. Ubuntu community can mail you one if you so request online, but why not be a DIYer and burn it yourself? I downloaded the Ubuntu 9.10 Desktop version for a graphical install and then went straight to burning it onto a CD. This was a mistake. I didn’t figure that the piece of the installation instructions regarding running the checksum was all that important, but it absolutely is. If the download is the least bit wrong the installation will not work. I burned several CDs of a bad image. Eventually I followed the installation documentation more closely and actually downloaded winMd5Sum. With this free tool I was able to compare the checksum of the downloaded image with the correct checksum from the <a href="https://help.ubuntu.com/community/UbuntuHashes" target="_blank">Ubuntu site</a>. It took several attempts and switching to a Canadian mirror before getting a successful download. Finally I could burn it to a disc.</p>
<p><span id="more-1509"></span></p>
<p><strong>Burning the Disc</strong><br />
The download comes as an image with an “.iso” extension. I had never burned an image before so I followed the Ubuntu advice to download the free Infra Recorder. The actual burning of the image to the disc couldn’t have been easier. Following the Ubuntu instructions I quickly had an Ubuntu install disc. I inserted it into my computer and restarted it so it could boot from the disc and headed straight to the install options. Here is where I went wrong for the second time by skipping a small part of the install instructions. Instead of using the “Install” option on the disc I should have first chose, “Check the disc for defects.”  After a few failed installs and a bunch of wasted time, choosing the “Check for defects” option finally revealed that while my download was successful, my burn did not translate to the disc just right. Burning another disc or two finally yielded some successful results.</p>
<p><strong>Installing</strong><br />
There are many ways to install Ubuntu. It can be installed as the sole operating system on the computer, as a virtual OS inside of Windows, or even as a side-by-side dual boot with Windows. I was attempting the latter. When trying to achieve a dual boot installation the hard drive must be partitioned so that each OS can reside in its own territory. With Windows on the machine I first dabbled in the computer management menu to try to clear space for Ubuntu, but then while installing it was difficult to interpret the partitioning. My solution was to reformat the hard drive so that Windows again occupied the whole hard drive and then use the installer disc to set up the partitions. I think this is the best option because you get a very good visual of how your hard drive is split up and you’ll have to go through the setup menu anyway so it saves you time from toiling in a Windows configuration. Other items in the installation process are very easy such as choosing language, naming the computer and setting up a user account. With the install completed, the next time the computer starts there will be a choice to start Ubuntu or Windows which is the whole idea of a dual-booting system.</p>
<p>In Conclusion<br />
Installing Ubuntu, especially in a dual-boot situation, can be a daunting task. Although my experience exemplified Murphy’s Law it is a very do-able process. Looking back, I could have saved a ton of time had I followed the online instructions more carefully and verified the download and burn of the image. Bottom line though is that the instructions and documentation are great resources and there are plenty of forums and YouTube <a href="http://www.youtube.com/results?search_query=how+to+install+ubuntu&amp;aq=f" target="_blank">videos</a> also documenting the process. With the volume of help out there I wouldn’t worry about lacking experience like myself, just jump in, read up and take your time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/05/installing-ubuntu-a-trial-and-error-account/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ubuntu Live Network Boot using PXE</title>
		<link>http://blogs.sourceallies.com/2010/02/ubuntu-live-network-boot-using-pxe/</link>
		<comments>http://blogs.sourceallies.com/2010/02/ubuntu-live-network-boot-using-pxe/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 16:00:06 +0000</pubDate>
		<dc:creator>Erik  Hill</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=945</guid>
		<description><![CDATA[Requirements

Linux server with NFS (or compatible)
TFTP server
DHCP server
syslinux / pxelinux files

To simplify these instructions we are going to make the following assumptions.

DHCP server is 10.0.0.2
TFTP server is 10.0.0.3
NFS is a Ubuntu server at 10.0.0.4

In reality it&#8217;s likely your TFTP and NFS server are going to be the same server, however because we go by IP [...]]]></description>
			<content:encoded><![CDATA[<h2>Requirements</h2>
<ul>
<li>Linux server with NFS (or compatible)</li>
<li>TFTP server</li>
<li>DHCP server</li>
<li>syslinux / pxelinux files</li>
</ul>
<p>To simplify these instructions we are going to make the following assumptions.</p>
<ul>
<li>DHCP server is 10.0.0.2</li>
<li>TFTP server is 10.0.0.3</li>
<li>NFS is a Ubuntu server at 10.0.0.4</li>
</ul>
<p>In reality it&#8217;s likely your TFTP and NFS server are going to be the same server, however because we go by IP in this, it is hopefully easier to understand.<br />
<span id="more-945"></span></p>
<h2>Basic working of PXE</h2>
<p>When a client attempts to boot by PXE, it makes a DHCP request. The DHCP server responds with an IP address and the IP of the TFTP server as well as a file to request.</p>
<p>The PXE client connects to the given IP and requests the file (pxelinux)</p>
<p>The system then looks for a configuration file.</p>
<h2>Setting up NFS</h2>
<p>Installing NFS</p>
<pre> sudo apt-get install nfs-kernel-server nfs-common portmap</pre>
<h3>Setting up NFS for Ubuntu Live Network Boot</h3>
<p>In this we will assume that we are going to mount the NFS at /srv/nfs/ubuntu.<br />
Download Ubuntu ISO<br />
Mount the ISO:</p>
<pre> sudo mount -o loop ubuntu-x,xx-desktop.iso /mnt</pre>
<p>Copy the contents of the CD:</p>
<pre> sudo cp -a /mnt /srv/nfs/ubuntu</pre>
<p>Edit /etc/exports:</p>
<pre> /srv/nfs/ubuntu 10.0.0.0/255.255.255.0(async,no_root_squash,no_subtree_check,ro)</pre>
<p>Restart NFS</p>
<pre> sudo /etc/init.d/nfs-kernel-server restart</pre>
<h2>Setting up TFTP</h2>
<p>There are windows TFTP servers, but for this we are going to use the Ubuntu box.</p>
<p>To Install:</p>
<pre> sudo apt-get install xinetd tftpd tftp</pre>
<p>Configuration:<br />
Edit/Create /etc/xinetd.d/tftp to:</p>
<pre>service tftp{
 protocol = udp
 port = 69
 socket_type = dgram
 wait = yes
 user = nobody
 server = /usr/sbin/in.tftpd
 server_args = /tftpboot
 disable = no
}</pre>
<p>Start TFTP</p>
<pre> sudo /etc/init.d/xinetd start</pre>
<h3>Setting up TFTP for PXE</h3>
<p>Download PXELinux (preferably) or SysLinux.<br />
Extract the contents into the /tftpboot boot directory<br />
Copy Ubuntu&#8217;s Kernel &amp; initrd.gz</p>
<pre>mkdir /tftpboot/casper
sudo mount 10.0.0.4:/srv/nfs/ubuntu /mnt
sudo cp /mnt/casper/initrd.gz /tftpboot/casper
sudo cp /mnt/casper/vmlinuz /tftpboot/casper</pre>
<p>Create the config directory:</p>
<pre>mkdir /tftpboot/pxelinux.cfg</pre>
<p>Create the default config for PXE</p>
<pre>vi /tftpboot/pxelinux.cfg/default</pre>
<p>with the contents:</p>
<pre>default menu.c32
prompt 0
LABEL ^Boot Live Ubuntu
kernel casper/vmlinuz
append root=/dev/nfs boot=casper netboot=nfs nfsroot=10.0.0.4:/srv/nfs/ubuntu initrd=casper/initrd.gz quiet splash --</pre>
<h2>Setting up DHCP</h2>
<h3>Windows Server</h3>
<p>Open the DHCP Manager, edit expand your scope<br />
Select Scope Options<br />
Add the following options:</p>
<pre>067   Boot File Name                            pxelinux.0
066    Boot Server Hostname             10.0.0.3</pre>
<h3>Linux</h3>
<p>Edit dhcpd.conf to include:</p>
<pre>allow booting;
allow bootp;</pre>
<p>Add the dhcp.conf group:</p>
<pre>next-server 10.0.0.3;
filename "pxelinux.0";</pre>
<p>Boot Ubuntu</p>
<p>With a bit of luck you can now boot any PXE compatable PC on the network into a network booted Ubuntu Live CD.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/02/ubuntu-live-network-boot-using-pxe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Services using SMF in OpenSolaris</title>
		<link>http://blogs.sourceallies.com/2010/01/creating-services-using-smf-in-opensolaris/</link>
		<comments>http://blogs.sourceallies.com/2010/01/creating-services-using-smf-in-opensolaris/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 14:00:30 +0000</pubDate>
		<dc:creator>Paris Holley</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[OpenSolaris]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=997</guid>
		<description><![CDATA[OpenSolaris has by far, one of the best service management interfaces that I have used. Below I am going to go over a simple way to turn in shell script into a service managed by the OS.

Step 1: Create the Service Manifest

&#60;?xml version='1.0'?&#62;;
&#60;!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'&#62;
&#60;service_bundle type='manifest' name='mynewservices'&#62;
        [...]]]></description>
			<content:encoded><![CDATA[<p>OpenSolaris has by far, one of the best service management interfaces that I have used. Below I am going to go over a simple way to turn in shell script into a service managed by the OS.<br />
<span id="more-997"></span></p>
<h1>Step 1: Create the Service Manifest</h1>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1.0'</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>;
<span style="color: #00bbdd;">&lt;!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_bundle</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'manifest'</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'mynewservices'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'application/service1'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'service'</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;method_context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;method_credential</span> <span style="color: #000066;">user</span>=<span style="color: #ff0000;">'root'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;method_environment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>;
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;envvar</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;MY_VAR&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;--flag1 --flag2&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/method_environment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/method_context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'start'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span> <span style="color: #000066;">exec</span>=<span style="color: #ff0000;">'/opt/myscript.sh start'</span> <span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'0'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'stop'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span> <span style="color: #000066;">exec</span>=<span style="color: #ff0000;">'/opt/myscript.sh stop'</span> <span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'120'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service_bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>Service Bundle</h2>
<p>A service bundle is just a collection of services which can be very useful if you have a suite of applications that you wish to manage within on manifest.xml file.</p>
<h2>Service</h2>
<p>The attributes you define on your service can be anything and are only useful for when you invoke administrative commands on them ( start, stop, etc ).</p>
<h2>Method Context</h2>
<p>The method context allows you to define the environment in which the executed methods will be called within. The example above shows the ability to define what user will be used to execute the method and the environment variables available to the script. This can be very handy when you want to leave an installation directory&#8217;s bin alone, and configure everything through the service. Keep in mind that what you see is a global method context and will apply to all executed methods. You may also customize the context per method by moving the tags out of <strong>service</strong> and into the <strong>exec_method</strong> tags.</p>
<h2>Executable Method</h2>
<p>Its purpose is self explanatory. Note that in one entry, the timeout is 0 and the other is 120 seconds. A timeout with a value of 0 will wait indefinitely for the script to start-up, however the service manager will always assume that it is online when in fact it could be hanging.</p>
<p>Also, there are three common commands used when invoking the service manager; enable, disable, and restart.</p>
<ul>
<li>When enabled, the start method will be executed.</li>
<li>When disabled, the stop method will be executed.</li>
<li>When restarted/refreshed, both the stop and the start method will be executed unless there is a method named restart/refresh.</li>
</ul>
<h1>Step 2: Import the Manifest</h1>
<p>Once you have your manifest xml file completed and ready to import, all you need to do is run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svccfg validate manifest.xml</pre></div></div>

<p>That will run the configuration through validation and make sure you didn&#8217;t make any typo&#8217;s.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcfg import manifest.xml</pre></div></div>

<h1>Step 3: Enable the Service</h1>
<p>Now that your manifest has been imported, it is available to be enabled within the service admin.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcadm enable service1</pre></div></div>

<h1>Step 4: Testing the Service</h1>
<p>After the service has started the run, you need to make sure it is executing properly and can handle a machine restart and/or service restart.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcs -x</pre></div></div>

<p>That command will tell you which services are currently broken and the log files to view the errors. Make sure that your service is not in that list. You may also do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcs service1
svcs -x service1</pre></div></div>

<p>to determine the state of that particular service. If it isn&#8217;t working, I suggest taking a look at the log files and fix it <img src='http://blogs.sourceallies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h1>Step 5: Updating the Service</h1>
<p>Say that while testing, you noticed that you passed the wrong parameter to your shell script or maybe in the future you need to add additional environment variables to your service, its the same process. Even if you no longer have the manifest xml file, SMF will give you a copy when you ask for it so that you can modify it and re-import.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svccfg export myservices &gt; manifest.xml</pre></div></div>

<p>After you have made your changes, validate and import the xml file and restart your service.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/01/creating-services-using-smf-in-opensolaris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Perl modules on OpenSolaris</title>
		<link>http://blogs.sourceallies.com/2010/01/building-perl-modules-on-opensolaris/</link>
		<comments>http://blogs.sourceallies.com/2010/01/building-perl-modules-on-opensolaris/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 14:00:02 +0000</pubDate>
		<dc:creator>Scott Peshak</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[OpenSolaris]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=846</guid>
		<description><![CDATA[Anyone that&#8217;s worked with Perl is probably familiar with CPAN.pm.  CPAN.pm is the bundled module that handles downloading and installing modules from the CPAN repository.  It usually works flawlessly but I&#8217;ve noticed that on OpenSolaris the process can be a bit more spotty.

Let&#8217;s try installing Mason as an example:

perl -MCPAN -e &#34;install HTML::Mason&#34;

Generally [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone that&#8217;s worked with Perl is probably familiar with CPAN.pm.  CPAN.pm is the bundled module that handles downloading and installing modules from the CPAN repository.  It usually works flawlessly but I&#8217;ve noticed that on OpenSolaris the process can be a bit more spotty.<br />
<span id="more-846"></span><br />
Let&#8217;s try installing <a href="http://www.masonhq.com">Mason</a> as an example:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">perl -MCPAN -e &quot;install HTML::Mason&quot;</pre></div></div>

<p>Generally the first thing I notice is that all (or a large number) of the tests are failing.  For example here is the output of one of the tests:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">t/20-plugins.......................Can't locate HTML/Entities.pm in @INC (@INC
 contains: /root/.cpan/build/HTML-Mason-1.42/blib/lib /root/.cpan/build/H
TML-Mason-1.42/blib/arch t/lib inc /usr/perl5/5.8.4/lib/i86pc-solaris-64int
 /usr/perl5/5.8.4/lib/i86pc-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_
perl/5.8.4/i86pc-solaris-64int /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int
 /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int /u
sr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/i8
6pc-solaris-64int /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int /usr/per
l5/vendor_perl/5.8.4 /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int /usr
/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl . /usr/perl5/5.8.4/lib/i86pc
-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/i86pc-solaris-6
4int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.
8.4/i86pc-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl 
.) at /root/.cpan/build/HTML-Mason-1.42/blib/lib/HTML/Mason/Escapes.pm
 line 14.</pre></div></div>

<p>Hmm, because we&#8217;re not installing HTML::Entities this means that it should have been brought in when CPAN.pm was building the dependencies.  I trust CPAN.pm got this right, if for no other reason than that I remember it prompting to install that module.  After digging around in the sea of output eventually I find that installing Digest::SHA1 failed because of this error:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">cc -c   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -xO3 -xspace -xildoff   -DVERSION=\&quot;2.12\&quot; -DXS_VERSION=\&quot;2.12\&quot; -KPIC &quot;-I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE&quot;   SHA1.c
cc: unrecognized option `-KPIC'
cc: language ildoff not recognized
cc: SHA1.c: linker input file unused because linking not done</pre></div></div>

<p>Our C compiler isn&#8217;t happy with how it&#8217;s being called.  Now we need to find out which compiler we&#8217;re using:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;"> bash-3.2$ which cc
/usr/gnu/bin/cc</pre></div></div>

<p>While the GCC compiler is a fine fine compiler, the way CPAN.pm tries to build things on OpenSolaris involves params that only SunStudio understands.  At this point there are two options. We can either patch the generated Makefile so that it doesn&#8217;t include stuff GCC can&#8217;t understand or we can switch the compiler to SunStudio.  I prefer the latter because it is easiest:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">pkg install sunstudio  # Install it if not already done
export PATH=&quot;/opt/SUNWspro/bin:$PATH&quot; # Put it first on the path</pre></div></div>

<p>Now that we&#8217;re using the correct compiler the build goes slightly less awful.  We get a new error.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">/usr/bin/perl &quot;-Iblib/arch&quot; &quot;-Iblib/lib&quot; Build.PL Build
Too early to specify a build action 'Build'.  Do 'Build Build' instead.</pre></div></div>

<p>This is caused by the ExtUtils::MakeMaker module not being installed.  I don&#8217;t know how my system got into such a state, but it is easy enough to fix:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">perl -MCPAN -e &quot;install 'ExtUtils::MakeMaker' &quot;</pre></div></div>

<p>Let&#8217;s try one more time:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">perl -MCPAN -e &quot;install HTML::Mason&quot;
...Huge Snip...
 /usr/gnu/bin/make install  -- OK</pre></div></div>

<p>Success!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/01/building-perl-modules-on-opensolaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unplugging an LVM partitioned USB drive</title>
		<link>http://blogs.sourceallies.com/2009/12/unplugging-an-lvm-partitioned-usb-drive/</link>
		<comments>http://blogs.sourceallies.com/2009/12/unplugging-an-lvm-partitioned-usb-drive/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 14:00:57 +0000</pubDate>
		<dc:creator>Sudhakar Ramasamy</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[usb drive]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=829</guid>
		<description><![CDATA[Recently I had the heartbreaking experience of having to reboot a Linux server. Normal usage should almost never require you to reboot the OS like you have to so frequently in Windows. In this case I had an external USB drive partitioned with LVM humming along on a Linux server. I needed to pull the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had the heartbreaking experience of having to reboot a Linux server. Normal usage should almost never require you to reboot the OS like you have to so frequently in Windows. In this case I had an external USB drive partitioned with <a href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)">LVM</a> humming along on a Linux server. I needed to pull the drive, so like I&#8217;ve done with other drives I unmounted all partitions on the drive. Then proceeded to unplug it from the USB port. All well and good. But when I plugged it back in, the <a href="http://linux.die.net/man/8/lvs">lvs</a> command was showing error messages on the partitions and I was unable to mount them.</p>
<p>Some Google searches later I found that when it comes to LVM partitions the OS keeps references to it unless you explicitly tell it to unhook them. Only then can you tell the OS to hook the LVM partitions back up when you&#8217;ve plugged the drive back in. In my case I had to resort to rebooting the server in order for the OS to hook all the pieces together for the LVM partitions. Short of this I would have to manually delete certain files and move things around to get the LVM partitions to work again. So here are the magic incantations that will save you the headache.</p>
<p>Before you unplug an LVM partitioned USB drive, you must run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
lvchange <span style="color: #660033;">-an</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>your_volume_group_name
vgexport <span style="color: #660033;">-a</span></pre></div></div>

<p>Use the man command to explore what these commands do.</p>
<p>Now you should be able to unplug the drive. When you are ready to plug it back in, stick it back in the USB port and run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
vgimport <span style="color: #660033;">-a</span>
lvchange <span style="color: #660033;">-ay</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>your_volume_group_name</pre></div></div>

<p>You should now be able to run lvs and see you LVM partitions on the USB drive without any errors and proceed to mount the partitions.</p>
<p>Hope you found this useful. Are there other or different ways of doing this? Please add your comments below and Happy Holidays! </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/12/unplugging-an-lvm-partitioned-usb-drive/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>GlusterFS Replication for Clustering</title>
		<link>http://blogs.sourceallies.com/2009/12/glusterfs-replication-for-clustering/</link>
		<comments>http://blogs.sourceallies.com/2009/12/glusterfs-replication-for-clustering/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 14:00:08 +0000</pubDate>
		<dc:creator>Shawn Siefkas</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=624</guid>
		<description><![CDATA[I recently was searching for a way to simulate shared physical storage in a VPS environment for clustering purposes.  In an enterprise data center we can expect some type of SAN available to provide shared physical storage.  GFS is a simple solution in this case to create a shared file system that can be used [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was searching for a way to simulate shared physical storage in a <a title="Virtual Private Server" href="http://en.wikipedia.org/wiki/Virtual_private_server">VPS</a> environment for clustering purposes.  In an enterprise data center we can expect some type of SAN available to provide shared physical storage.  GFS is a simple solution in this case to create a shared file system that can be used as a resource in a cluster.  GlusterFS allows us to provide this type of functionality to multiple nodes when we have no means of providing access to the same physical storage.</p>
<p>The gluster community site will be a great resource for anyone wanting to implement the file system and is located at <a title="Gluster Community" href="http://www.gluster.org">http://www.gluster.org</a>.</p>
<p>For the remainder of this post I will be referring to an environment consisting of two CentOS <a title="Virtual Private Server" href="http://en.wikipedia.org/wiki/Virtual_private_server">VPS</a> nodes.</p>
<h3>Preparing Ext3 File System for Sharing</h3>
<p>Gluster will not share raw devices but instead will use an already mounted file system.  I will be assuming the use of a complete ext3 file system on the mount point /replicator.  If you can&#8217;t provide a unique storage device for this purpose you can just use a directory on the root file system for testing.</p>
<h3>Installing GlusterFS Server and Client</h3>
<p>The following commands need to be executed on each node to grab and install the necessary RPMs.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">wget -r -l 1 http://ftp.gluster.com/pub/gluster/glusterfs/3.0/3.0.0/CentOS/
cd ftp.gluster.com/pub/gluster/glusterfs/3.0/3.0.0/CentOS/
rpm -Uvh glusterfs-*-3.0.0-1.x86_64.rpm</pre></div></div>

<p>Execute the following on either node to generate the necessary configuration files in the current working directory.  This will create a client configuration along the lines of replicator-tcp.vol.  A server configuration file will be created for each node and begin with the appropriate node hostname.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">glusterfs-volgen --name replicator --raid 1 node1:/replicator node2:/replicator</pre></div></div>

<p>Move the client file to /etc/glusterfs/glusterfs.vol on each node.  Also move the appropriate server file to /etc/glusterfs/glusterfsd.vol for each node.</p>
<h3>Mounting GlusterFS Volumes</h3>
<p>The simplest way to configure mounting of the volumes is via /etc/fstab.  Place a line in fstab on each node.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">/etc/glusterfs/glusterfs.vol    /data   glusterfs   defaults  0 0</pre></div></div>

<p>This will mount the shared volumes to /data.  Try writing a file to one node and watch it appear on the other!</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">cd /data
dd if=/dev/zero of=/data/test bs=1M count=32</pre></div></div>

<h3>High Availability Implications</h3>
<p>At this point I am still vetting gluster&#8217;s reliability as a HA solution.  It will most definitely keep data intact during planned maintenance.  If we properly stop the client/server on any node then changes can continue to occur on the other.  Also we can join a node to active shared storage and synchronization is automatic.</p>
<p>The real test is whether gluster will hold up in the not so routine situations.  Some crude tests involving yanking network connectivity from a node that is replicating changes seems to cause some issues.  For example, if I start the dd operation above on node1 and kill the connection to node2, one way or another, before it finishes then node1 still completes the operation fine.  When I reattach node2 even the active mount on /data seems to synchronize with node1 just fine.  Where some differences start to appear is in the /replicator directory on node2.  It seems that this does get out of whack and neither client pays attention to this server any longer.</p>
<p>If gluster can hold up to software and hardware failures without data corruption it can certainly be used as shared storage for clustering.  I&#8217;ll continue to explore these options and report back later.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/12/glusterfs-replication-for-clustering/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spring Roo Sample App Tutorial &#8211; Part 1</title>
		<link>http://blogs.sourceallies.com/2009/12/spring-roo-sample-app-tutorial-part-1/</link>
		<comments>http://blogs.sourceallies.com/2009/12/spring-roo-sample-app-tutorial-part-1/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 17:44:56 +0000</pubDate>
		<dc:creator>Matt Vincent</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Java 1.5]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[OpenLDAP]]></category>
		<category><![CDATA[Roo 1.0.0.RC3]]></category>
		<category><![CDATA[Spring LDAP]]></category>
		<category><![CDATA[Spring Security 3.0]]></category>
		<category><![CDATA[Spring Security Tags]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=691</guid>
		<description><![CDATA[In this blog, I will start creating a web application used to organize bookmarks.  Because only certain bookmarks are of interest to specific groups of people, I will use groups in our LDAP server to control which users see which groups of bookmarks.
The entire blog will be released in posts staggered over time.  [...]]]></description>
			<content:encoded><![CDATA[<p>In this blog, I will start creating a web application used to organize bookmarks.  Because only certain bookmarks are of interest to specific groups of people, I will use groups in our LDAP server to control which users see which groups of bookmarks.</p>
<p>The entire blog will be released in posts staggered over time.  Part 1 will focus on initial setup of Roo, the core web application and authentication with a directory server.  Subsequent posts will refine the Spring Roo application.</p>
<p><strong>What is Roo?</strong></p>
<p>It&#8217;s a great rapid prototyping tool because prototypes don&#8217;t need to be scrapped to proceed with fleshing out the application if a prototype proves itself.</p>
<p>Roo gives you Spring best practices, Rails-like scaffolding, an interactive shell, no additional run-time dependencies, and a big productivity boost while not locking you into yet another framework.  You can re-use your existing Spring/JPA/Hibernate knowledge, while getting the productivity gains from Roo.</p>
<p><strong>Setting up Roo</strong></p>
<ul>
<li>wget http://s3.amazonaws.com/dist.springframework.org/milestone/ROO/spring-roo-1.0.0.RC3.zip</li>
<li>unzip spring-roo-1.0.0.RC3.zip</li>
<li>sudo ln -s ~/Frameworks/spring-roo-1.0.0.RC3/bin/roo.sh /usr/bin/roo</li>
<li>mkdir ~/Workspaces/intranetlinks; cd ~/Workspaces/intranetlinks</li>
</ul>
<p><strong>Starting our Project</strong></p>
<p>Once in your new project directory, type &#8216;roo&#8217;.  Then once in the Roo shell, execute these commands.  See <a href="http://blog.springsource.com/2009/05/27/roo-part-2/">this guide</a> for an explanation of what these commands do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">project <span style="color: #660033;">--topLevelPackage</span> com.sourceallies.links
persistence setup <span style="color: #660033;">--provider</span> HIBERNATE <span style="color: #660033;">--database</span> MYSQL
database properties <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">--key</span> database.password <span style="color: #660033;">--value</span> password
database properties <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">--key</span> database.username <span style="color: #660033;">--value</span> username
database properties <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">--key</span> database.url <span style="color: #660033;">--value</span> jdbc:mysql:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">3306</span><span style="color: #000000; font-weight: bold;">/</span>intranetlinks
&nbsp;
entity <span style="color: #660033;">--name</span> ~.domain.LinkCategory
field string name <span style="color: #660033;">--notNull</span> <span style="color: #660033;">--sizeMin</span> <span style="color: #000000;">1</span> <span style="color: #660033;">--sizeMax</span> <span style="color: #000000;">255</span>
&nbsp;
entity <span style="color: #660033;">--name</span> ~.domain.Link
field string name <span style="color: #660033;">--notNull</span> <span style="color: #660033;">--sizeMin</span> <span style="color: #000000;">1</span> <span style="color: #660033;">--sizeMax</span> <span style="color: #000000;">60</span>
field string url <span style="color: #660033;">--notNull</span> <span style="color: #660033;">--sizeMin</span> <span style="color: #000000;">1</span> <span style="color: #660033;">--sizeMax</span> <span style="color: #000000;">255</span>
field string ldapSecurityGroup <span style="color: #660033;">--notNull</span> <span style="color: #660033;">--sizeMin</span> <span style="color: #000000;">1</span> <span style="color: #660033;">--sizeMax</span> <span style="color: #000000;">60</span>
field reference <span style="color: #660033;">--class</span> ~.domain.Link <span style="color: #660033;">--fieldName</span> category <span style="color: #660033;">--type</span> ~.domain.LinkCategory
&nbsp;
logging setup <span style="color: #660033;">--level</span> DEBUG
&nbsp;
controller scaffold <span style="color: #660033;">--name</span> ~.web.LinkCategoryController <span style="color: #660033;">--entity</span> ~.domain.LinkCategory
controller scaffold <span style="color: #660033;">--name</span> ~.web.LinkController <span style="color: #660033;">--entity</span> ~.domain.Link
&nbsp;
finder list <span style="color: #660033;">--class</span> com.sourceallies.links.domain.Link
finder add <span style="color: #660033;">--finderName</span> findLinksByCategory <span style="color: #660033;">--class</span> ~.domain.Link
&nbsp;
security setup
<span style="color: #7a0874; font-weight: bold;">test</span> integration
perform <span style="color: #7a0874; font-weight: bold;">test</span>
perform eclipse</pre></div></div>

<p>Then of course, create your local database inside the MySQL shell:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">create database intranetlinks;
create user <span style="color: #ff0000;">'username'</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #ff0000;">'localhost'</span> IDENTIFIED BY <span style="color: #ff0000;">'password'</span>;
grant all privileges on intranetlinks.<span style="color: #000000; font-weight: bold;">*</span> to <span style="color: #ff0000;">'username'</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #ff0000;">'localhost'</span> with grant option;</pre></div></div>

<p>Next, unless you&#8217;re using Roo 1.0.0.RC4 (not available at the time of this blog post), you&#8217;ll need to add the following config to near the bottom of your pom.xml (<a href="https://jira.springsource.org/browse/ROO-224">to fix this bug</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jaxb<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jdk<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jdk<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activation<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>javax.xml.bind<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jaxb-api<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.sun.xml.bind<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jaxb-impl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.1.3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependencies<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/profiles<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Then pull the JAXB JAR into your build by executing this maven command (outside of the Roo shell):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mvn package clean</pre></div></div>

<p>Finally, <a href="http://blogs.sourceallies.com/2009/10/spring-ldap-group-authorization-tip/">per a prior blog</a>, replace the body of your src/main/resources/META-INF/spring/applicationContext-security.xml with this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;http<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form-login</span> <span style="color: #000066;">login-processing-url</span>=<span style="color: #ff0000;">&quot;/static/j_spring_security_check&quot;</span> <span style="color: #000066;">login-page</span>=<span style="color: #ff0000;">&quot;/login&quot;</span> <span style="color: #000066;">authentication-failure-url</span>=<span style="color: #ff0000;">&quot;/login?login_error=t&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;logout</span> <span style="color: #000066;">logout-url</span>=<span style="color: #ff0000;">&quot;/static/j_spring_security_logout&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/admin/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;ROLE_ADMIN&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/member/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;IS_AUTHENTICATED_REMEMBERED&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/resources/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;IS_AUTHENTICATED_ANONYMOUSLY&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/static/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;IS_AUTHENTICATED_ANONYMOUSLY&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/images/**&quot;</span> <span style="color: #000066;">filters</span>=<span style="color: #ff0000;">&quot;none&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/styles/**&quot;</span> <span style="color: #000066;">filters</span>=<span style="color: #ff0000;">&quot;none&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/link/form&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;ROLE_INTRANETLINKS-ADMINS&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- We're doing REST, only allow GETs to normal users --&gt;</span>
    	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/link/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;ROLE_INTRANETLINKS-ADMINS&quot;</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;DELETE&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/link/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;ROLE_INTRANETLINKS-ADMINS&quot;</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;POST&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/link/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;ROLE_INTRANETLINKS-ADMINS&quot;</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;PUT&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/link/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;IS_AUTHENTICATED_REMEMBERED&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/login/**&quot;</span> <span style="color: #000066;">filters</span>=<span style="color: #ff0000;">&quot;none&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;ROLE_USERS&quot;</span>  <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;anonymous</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/http<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ldap-server</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;ldapServer&quot;</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;ldap://yourdirectoryserver:338899/&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;authentication-manager<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ldap-authentication-provider</span> <span style="color: #000066;">server-ref</span>=<span style="color: #ff0000;">&quot;ldapServer&quot;</span>  </span>
<span style="color: #009900;">       <span style="color: #000066;">user-search-base</span>=<span style="color: #ff0000;">&quot;ou=people,dc=sourceallies,dc=com&quot;</span> </span>
<span style="color: #009900;">       <span style="color: #000066;">user-search-filter</span>=<span style="color: #ff0000;">&quot;(uid={0})&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">group-role-attribute</span>=<span style="color: #ff0000;">&quot;cn&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">group-search-base</span>=<span style="color: #ff0000;">&quot;ou=groups,dc=sourceallies,dc=com&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">group-search-filter</span>=<span style="color: #ff0000;">&quot;(memberUid={1})&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">role-prefix</span>=<span style="color: #ff0000;">&quot;ROLE_&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/authentication-manager<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Note that in Spring Security 3.0, Authentication Providers must now be declared from within the authentication-manager element (<a href="http://static.springsource.org/spring-security/site/docs/3.0.x/reference/appendix-namespace.html">more information here</a>).</p>
<p>Then add a few more dependencies to your pom.xml</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.security<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.security.ldap<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3.0.0.RC1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.ldap<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>spring-ldap-core<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.3.0.RELEASE<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.ldap<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>spring-ldap-core-tiger<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.3.0.RELEASE<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>This will allow you to use Spring LDAP and also conditionally render pieces of your application like this:</p>

<div class="wp_syntax"><div class="code"><pre class="jsp" style="font-family:monospace;">&lt;security:authorize ifAllGranted=&quot;ROLE_SUPERVISOR&quot;&gt;
    &lt;li id=&quot;finder_findlinksbycategory_menu_item&quot;&gt;
        &lt;c:url value=&quot;/link/find/ByCategory/form&quot; var=&quot;finder_findlinksbycategory_menu_item_url&quot;/&gt;
        &lt;a href=&quot;${finder_findlinksbycategory_menu_item_url}&quot;&gt;
            &lt;spring:message arguments=&quot;Category&quot; code=&quot;global.menu.find&quot;/&gt;
        &lt;/a&gt;
    &lt;/li&gt;
&lt;/security:authorize&gt;</pre></div></div>

<p>Finally, run the following command to startup Tomcat and start refining your UI.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mvn tomcat:run</pre></div></div>

<p>Stay tuned for Part 2 of this series!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/12/spring-roo-sample-app-tutorial-part-1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Vim splits, an introduction.</title>
		<link>http://blogs.sourceallies.com/2009/11/vim-splits-an-introduction/</link>
		<comments>http://blogs.sourceallies.com/2009/11/vim-splits-an-introduction/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 18:00:42 +0000</pubDate>
		<dc:creator>Scott Peshak</dc:creator>
				<category><![CDATA[File Wrangling]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=452</guid>
		<description><![CDATA[First off, lets get some test files:
for i in foo bar cat dog ; do echo $i &#62; $i ; done;
This creates 4 files named  foo, bar, cat and dog. Each file has a single line that contains the file&#8217;s own name.
Let&#8217;s open the first file:
vim foo

This would be the familiar vim with one file [...]]]></description>
			<content:encoded><![CDATA[<p>First off, lets get some test files:</p>
<p><code>for i in foo bar cat dog ; do echo $i &gt; $i ; done;</code></p>
<p>This creates 4 files named  foo, bar, cat and dog. Each file has a single line that contains the file&#8217;s own name.</p>
<p>Let&#8217;s open the first file:</p>
<p><code>vim foo</code></p>
<p><img class="alignnone size-full wp-image-462" title="vim with single file" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-4.22.38-PM.png" alt="vim with single file" width="639" height="558" /></p>
<p>This would be the familiar vim with one file open view.  Now to open a new split and open the bar file inside it:</p>
<p><code>:sp bar</code><br />
<img class="alignnone size-full wp-image-465" title="vim with two splits" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-4.23.49-PM.png" alt="vim with two splits" width="639" height="558" /></p>
<p>Focus is in the new split initially.  To move between splits first press Ctrl-w (I remember this by Control Window, I&#8217;m not sure what the official mnemonic is) Then press a directional key to move the cursor to the split you&#8217;re interested in.  Directional key could be the arrows or my preferred home row method.</p>
<p>We can split again and open the cat file:</p>
<p><code>:sp cat</code><br />
<img class="alignnone size-full wp-image-467" title="vim with three splits" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-4.25.13-PM.png" alt="vim with three splits" width="639" height="558" /></p>
<p>By now you may have noticed the every time you open new split all splits get an equal amount of screen real estate.  The size of the current split can be adjusted by using Ctrl-w + and Ctl-w &#8211; (+ increases the split size by one line, &#8211; reduces the split size by one line)  If the idea of bumping the size of the split one line at a time doesn&#8217;t sit well with you, prefix +/- with a multiplier.  For example to increase our current split (which is the cat split) by 5 lines run the following:</p>
<p><code>Ctrl-w 5+</code><br />
<img class="alignnone size-full wp-image-473" title="vim with adjusted split size" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-4.35.11-PM.png" alt="vim with adjusted split size" width="639" height="558" /></p>
<p>To quickly &#8220;maximize&#8221; the current split:</p>
<p><code>Ctrl-w _</code><br />
<img class="alignnone size-full wp-image-475" title="vim with 3rd split maximized" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-4.36.43-PM.png" alt="vim with 3rd split maximized" width="639" height="558" /></p>
<p>And to return to equalized splits:</p>
<p><code>Ctrl-w =</code><br />
<img class="alignnone size-full wp-image-467" title="vim with three splits" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-4.25.13-PM.png" alt="vim with three splits" width="639" height="558" /></p>
<p>So far we have only been working with horizontal splits.  Vim also supports vertical splits.  To split the current split again, only vertically (and at the same time open the file named &#8220;dog&#8221;) run:</p>
<p><code>:vsp dog</code><br />
<img class="alignnone size-full wp-image-478" title="vim with vertical split" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-4.40.31-PM.png" alt="vim with vertical split" width="639" height="558" /></p>
<p>Of course you can keep splitting until your head hurts.  Vim even allows you to split the same file multiple times and it will automatically keep the contents in sync.  This is very handy for referencing one section of a file while editing another.</p>
<p><img class="alignnone size-full wp-image-487" title="Crazy vim splits" src="http://blogs.sourceallies.com/wp-content/uploads/2009/11/Screen-shot-2009-11-13-at-5.11.54-PM.png" alt="Crazy vim splits" width="639" height="558" /></p>
<p>Split related commands:</p>
<table border="0">
<thead>
<tr>
<th>Command</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>:sp <em>filename</em></td>
<td>Open <em>filename</em> in horizontal split</td>
</tr>
<tr>
<td>:vsp <em>filename</em></td>
<td>Open <em>filename</em> in vertical split</td>
</tr>
<tr>
<td>Ctrl-w h<br />
Ctrl-w ←</td>
<td>Shift focus to split on left of current</td>
</tr>
<tr>
<td>Ctrl-w l<br />
Ctrl-w →</td>
<td>Shift focus to split on right of current</td>
</tr>
<tr>
<td>Ctrl-w j<br />
Ctrl-w ↓</td>
<td>Shift focus to split below the current</td>
</tr>
<tr>
<td>Ctrl-w k<br />
Ctrl-w ↑</td>
<td>Shift focus to split above the current</td>
</tr>
<tr>
<td>Ctrl-w <em>n</em>+</td>
<td>Increase size of current split by <em>n</em> lines</td>
</tr>
<tr>
<td>Ctrl-w <em>n</em>-</td>
<td>Decrease size of current split by <em>n</em> lines</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/11/vim-splits-an-introduction/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

