<?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>nextCoder</title>
	<atom:link href="http://nextcoder.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://nextcoder.com</link>
	<description>helping developers one problem at a time</description>
	<lastBuildDate>Fri, 03 Sep 2010 23:46:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SSO With Pentaho Community Edition</title>
		<link>http://nextcoder.com/?p=172</link>
		<comments>http://nextcoder.com/?p=172#comments</comments>
		<pubDate>Fri, 03 Sep 2010 20:52:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[BI and Data Warehousing]]></category>
		<category><![CDATA[bi]]></category>
		<category><![CDATA[business intelligence]]></category>
		<category><![CDATA[community edition]]></category>
		<category><![CDATA[data warehouse]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[microsoft active directory]]></category>
		<category><![CDATA[msad]]></category>
		<category><![CDATA[pentaho]]></category>
		<category><![CDATA[spring framework]]></category>
		<category><![CDATA[sso]]></category>

		<guid isPermaLink="false">http://nextcoder.com/?p=172</guid>
		<description><![CDATA[Introduction
Pentaho is an amazing system. Built upon countless hours of man hours from all over the world, it is one of the testament to the effectiveness of the open-source SDLC paradigm.
But here&#8217;s the rub, for those of us Community Edition users who can&#8217;t afford the Enterprise Edition, we are left on our own when it [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Pentaho is an amazing system. Built upon countless hours of man hours from all over the world, it is one of the testament to the effectiveness of the open-source SDLC paradigm.</p>
<p>But here&#8217;s the rub, for those of us Community Edition users who can&#8217;t afford the Enterprise Edition, we are left on our own when it comes to the more &#8220;advanced&#8221; features &#8230; such as SSO integration.</p>
<p>After messing with this for the last week, with a lot of help from my colleague and probably one of the most fun (yes, fun!) online user community that I&#8217;ve dealt with (#pentaho irc channel), I finally cracked the proverbial nut.</p>
<p>So I decided to write up what I have found with my boss&#8217; blessing.  Also with the rising awareness of the benefits of BI even for small to medium corporations, I have no doubt that this information would be useful for someone somewhere.</p>
<p>Due to variance in SSO setup, I am not implying that the way I set it up will work for yours.  That&#8217;s all for the obligatory mini-DISCLAIMER.</p>
<p><strong>The Need</strong></p>
<p>If your organization does not have a Single-Sign-On implemented for your enterprise applications, then this writeup is irrelevant. The fact is, SSO is a useful feature for users (and developers too) that, while almost always a major pain to setup, the payback is usually worth the hassle.</p>
<p>In this writeup, my scenario revolves around trying to fit Pentaho (Community Edition), which I&#8217;ll refer to as PCE from here on, into an existing SSO implementation.</p>
<p>Now, for those who are familiar with setting up an SSO system, the next question will be a basic one:</p>
<p>Which SSO implementation did you use?</p>
<p><strong>The SSO Setup</strong></p>
<p>The one that we setup at work utilizes Microsoft Active Directory to authenticate users coming from the website.</p>
<p>While there are some documentation on the Pentaho Wiki on plugging in Pentaho into SiteMinder or CAS, less can be found when you search for Microsoft Active Directory. Which is a shame, because despite being a Linux guy myself, I have to admit that when configured correctly, their implementation of SSO, from the users&#8217; perspective, works fairly well.</p>
<p>NOTE: You should see how my fellow programmer and sysadmin and my Kerberos teacher (that you, Earl) excel in this area of configuration.</p>
<p>With MSAD, once it authenticated you via the usual login screen, it will push information through AJP protocol (1.3) to the Tomcat server that hosts the Pentaho biserver-ce.</p>
<p>For the sake of brevity and clarity, we won&#8217;t be discussing how to setup AJP to work with IIS.  Suffice to say that it uses one of the<strong> ISAPI Filter </strong>extensions called: <strong>isapi_redirect.dll</strong> to accomplish this.</p>
<p>The first thing to do is to modify the conf/workers.properties and conf/uriworkermap.properties.  The way these works is routing by URL pattern.  It should be self-explanatory to modify, contact me if you need more info.</p>
<p style="padding-left: 30px;"><strong>Gotcha(TM) #1:</strong> On my Ubuntu development server, somehow Tomcat AJP listener isn&#8217;t really listening to requests coming via tcp (that&#8217;s TCP for IP4 clients), rather it waits on tcp6.  And this is not obvious either, especially when you use netstat.  Netstat will show tcp6 whether Tomcat is listening to tpc *and* tcp6 OR just on tcp6.</p>
<p style="padding-left: 30px;">So now what to do? After searching for answers online, I came onto a tip to specify the actual address where the server is listening on.   Somehow this forces Tomcat to listen to both tcp and tcp6 on 8009 (AJP protocol).  <strong>To be specific:</strong> add an attribute address=&#8221;your.server.ip.address&#8221; to the &lt;Connector&gt; tag that configures the 8009 port in the Tomcat&#8217;s server.xml</p>
<p>After that roundabout sidetrack, I finally was able to receive AJP requests  from IIS to Tomcat which in turn dutifully re-routes them to /pentaho where the PCE lives.</p>
<p><strong>The Switch</strong></p>
<p>At this point, all the PCE can do is to throw a fit because it does not know what to do with the AJP request coming from IIS (i.e the user) plus it has no idea that there is an authenticated user information within the request.</p>
<p>So we need to initiate the switch from the pre-installed JDBC-based authentication/authorization to the one based on LDAP, of which the MS Active Directory is an implementation.</p>
<p>To do this, you can follow the information in the link that I&#8217;m about to give you. But, come back here after you read it because while it listed the steps, it does not give you a clue on what those modifications are really for.  Well, unless you are an LDAP and Spring Security -expert.</p>
<p>Here&#8217;s <a href="http://wiki.pentaho.com/display/ServerDoc2x/Active+Directory+configuration+example+%28CE+3.0RC1%29+2.x-3.0.x" target="_blank">the link</a>.</p>
<p>In summary, here are the list of files you need to touch and modify:</p>
<p>Under <em>biserver-ce/pentaho-solution/system</em> directory:</p>
<ul>
<li><em>pentaho-spring-beans.xml</em> &#8211; the big switch, this is where you tell Pentaho to use LDAP instead of JDBC authentication/authorization system.</li>
<li><em>applicationContext-security-ldap.properties</em> &#8211; this file basically is the center of the modification, we will talk about this file in depth on the next section.</li>
<li><em>applicationContext-spring-security.xml</em> &#8211; this is where ACL (Access Control Level) is setup at URL level.  Search for &lt;property name=&#8221;objectDefinitionSource&#8221;&gt;.  Scarily, the actual URL patterns and permitted roles are defined within a hardcoded CDATA block (!!).  What&#8217;s wrong with another .properties file guys?  All you need to do here is to substitute the default Pentaho roles such as Admin, Authenticated, etc. with the new ones from LDAP.</li>
<li><em>applicationContext-spring-security-ldap.xml</em> &#8211; this is where the majority of the values in the above .properties file are being used.  As far as I recall, I didn&#8217;t change this file at all, which is always a good thing.</li>
<li><em>applicationContext-pentaho-security-ldap.xml</em> &#8211; this file contains the two queries that populates the Pentaho UI when we select assign permissions to Users or Roles.</li>
<li><em>pentaho.xml</em> &#8211; this file governs who can do what to the solutions in the repositories.  All you need to modify in this file is replacing the default roles with the ones you define in LDAP.</li>
</ul>
<p>Under <em>biserver-ce/pentaho-solution/system/data-access-plugin</em> directory:</p>
<ul>
<li><em>settings.xml</em> &#8211; this file governs who can do what to the defined data sources (y&#8217;know, the all important source of  data for your ad-hoc reports and cubes).  All you need to modify in this file is replacing the default roles with the ones you define in LDAP.  <strong>A #pentaho irc channel community member (pstoellberger) helped me out on this one.  Without his quick source sleuthing, there&#8217;s no telling how many more hours I&#8217;d spend figuring this out.</strong></li>
</ul>
<p>Under <em>biserver-ce/tomcat/webapps/pentaho/WEB-INF</em> directory:</p>
<ul>
<li> <em>web.xml</em> &#8211; this file configures the pentaho web application.  Since we are plugging Pentaho into an existing enterprise application, we need to configure it to reflect this.  All you need to do is to make sure that this section of the file is properly defined (see highlighted part below):
<ul>
<li>&lt;context-param&gt;&lt;param-name&gt;base-url&lt;/param-name&gt;</li>
<li>&lt;param-value&gt;<strong>http://www.yourwebsite.entry.point.com/pentaho</strong>&lt;/param-value&gt;</li>
<li>&lt;/context-param&gt;</li>
</ul>
</li>
</ul>
<p>Now let&#8217;s talk about some of these modifications in more depth.</p>
<p><strong>The Property File</strong></p>
<p><em>applicationContext-security-ldap.properties</em> to be exact.  This is the only property file that you need to modify for this purpose.</p>
<p>The values in this file are being used in three Spring-Security bean definition files.  To clarify, Pentaho uses Spring-Security to implement their authentication/authorization layer.  A wise decision that pays rather handsomely as you can see later in this article.</p>
<p>Let&#8217;s walk through these values:</p>
<ul>
<li><em>contextSource.providerUrl</em> &#8211; this should contain your ldap: URL, between you and your sysadmin, this shouldn&#8217;t be a piece of cake to get.  Example: ldap://ldapsrv.acme.com:389</li>
<li><em>contextSource.userDn</em> &#8211; set the value to the distinguishedName (DN) of the read-only user that you use for accessing LDAP tree.  Example: CN=LDAP Searchdog,CN=Users,DC=acme,DC=com</li>
<li><em>contextSource.password</em> &#8211; the password of the read-only user above</li>
</ul>
<p>This section takes care of the basic connecting to LDAP server.  This is used in various places as expected.</p>
<p>Next, we&#8217;ll fill out info for single user search (for authentication):</p>
<ul>
<li><em>userSearch.searchBase</em> &#8211; this value points to the root of the LDAP tree where you want the search to commence from. Example: DC=acme,DC=com</li>
<li><em>userSearch.searchFilter</em> &#8211; this is the LDAP attribute that will be matched against the supplied parameter (typically the user name).  Example: (sAMAccountName={0})  &lt;&#8211; the {0} is where the parameter would be substituted.</li>
</ul>
<p>Next, we&#8217;ll specify how to fetch the roles of a given user (setup on LDAP):</p>
<ul>
<li><em>populator.convertToUpperCase</em> &#8211; when this value is &#8216;true&#8217; the roles coming from LDAP will be converted into all upper case.  Not sure what this buys us, but it&#8217;s important to be consistent.  Don&#8217;t set this to true and then forgot to capitalize the roles wherever it&#8217;s defined.</li>
<li><em>populator.groupRoleAttribute</em> &#8211; which LDAP attribute held the roles. Example: cn</li>
<li><em>populator.groupSearchBase</em> &#8211; same as the userSearch.searchBase above</li>
<li><em>populator.groupSearchFilter</em> &#8211; specifies the condition for the search, that is using the username  to get the roles he/she is associated with</li>
<li><em>populator.rolePrefix</em> &#8211; if you need a prefix, I haven&#8217;t found out why would I need one.</li>
<li><em>populator.searchSubtree</em> &#8211; another boolean value that indicates whether to search into the LDAP subtrees or not.</li>
</ul>
<p>Lastly, we give the proper info for searching available roles in LDAP.  This is an important query that will actually populate the Pentaho UI where we select Roles to assign permissions to certain Reports or Cubes (or &#8216;Solutions&#8217; if we use Pentaho&#8217;s lingo.</p>
<ul>
<li><em>allAuthoritiesSearch.roleAttribute</em> &#8211; which LDAP attribute held the value for the roles.  Example: cn</li>
<li><em>allAuthoritiesSearch.searchBase</em> &#8211; where you&#8217;d want to search to begin.  IMPORTANT: the way my LDAP server is organized, when this property is set to the root of the tree (DC=acme,DC=com), the subsequent pentaho code failed to populate the UI control that allows us to select these roles.  Only when I specify a subtree that has only the roles, would this work.  Example: OU=Some Subgroup,DC=acme,DC=com</li>
<li><em>allAuthoritiesSearch.searchFilter</em> &#8211; this is the criteria that is shared by all the roles we want to pull from the LDAP server.  Example: (objectClass=group)</li>
</ul>
<p><strong>The Usage</strong></p>
<p>Consistency is the keyword here, once you have defined a set of new roles in MS Active Directory to be used with Pentaho, then you *must* substitute default Pentaho roles (Admin, Authenticated, etc.) in the aforementioned configuration files with the appropriate new roles.</p>
<p>I don&#8217;t see the point of belaboring on this as the application would be unique to your own authentication/authorization needs.  Just be aware that a single typo will bring the system to a halt.  Involving some kind of version control is highly recommended when modifying these files.</p>
<p>The most unexpected and quite amazing fact in this whole thing is that Spring-Security automatically handles the authenticated user information that was sent from IIS to Tomcat without any intervention on my side.</p>
<p>Lesser security libraries would probably require some property tweaking or custom-written filters to do this seemingly trivial but important step.   This to me has proven one of the reasons for the maturity of Spring as one of the few Java frameworks that is truly enterprise -worthy.</p>
<p><strong>The Loose Ends</strong></p>
<p>Some miscellaneous random bit of info that may save you some time.  These would save me some had I known about it when I started on this task:</p>
<ul>
<li>The log file for Pentaho is located in: <em>biserver-ce/tomcat/bin/pentaho.log</em></li>
<li>To find out about problems with your ISAPI Filters, view the log files located where the extension .dll file is.  In my case it&#8217;s called isapi_redirect.log</li>
<li>Turn the log4j.xml logging level for spring-security to INFO or even DEBUG to follow what&#8217;s happening if the modifications do not seem to take effect.  This is quiet obvious, but when you&#8217;re busy pulling your hair out, it&#8217;s easy to forget.</li>
<li>Don&#8217;t forget to turn it back to WARN or ERROR when your modifications *do* work.</li>
<li>Oh, and Pentaho Administrator Console is useless once you switched to LDAP, it is only configured to work with the JDBC user/role management.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=172</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lost Windows 7 password</title>
		<link>http://nextcoder.com/?p=156</link>
		<comments>http://nextcoder.com/?p=156#comments</comments>
		<pubDate>Fri, 16 Jul 2010 04:48:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[7]]></category>
		<category><![CDATA[kit]]></category>
		<category><![CDATA[lost]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[recover]]></category>
		<category><![CDATA[rescue]]></category>
		<category><![CDATA[trinity]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[winpass]]></category>

		<guid isPermaLink="false">http://nextcoder.com/?p=156</guid>
		<description><![CDATA[Ever feel the anguish of having something your need or want so close yet you can&#8217;t get to it?
Today I did.  I forgot the password to the only user on my three-weeks old laptop.  Forgot as in no way to remember it, and the hint didn&#8217;t help either.  I am sure it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Ever feel the anguish of having something your need or want so close yet you can&#8217;t get to it?</p>
<p>Today I did.  I forgot the password to the only user on my three-weeks old laptop.  Forgot as in no way to remember it, and the hint didn&#8217;t help either.  I am sure it&#8217;s not one of my regular ones because I was trying to be cute and came up with a new word.</p>
<p>And it so happen that in MS-Windows world, if you don&#8217;t have administrator account enabled, and you forgot your user password, you&#8217;re toast.  I guess its the same thing with UNIX as well, except in UNIX, you will always have a root (same as administrator) user account.</p>
<p>Now what?</p>
<p>My help came from a rather weird source. Youtube.  Where a lot of people apparently had solved the same problem.   Most of them are .iso files which can be burned into a CD-RW and you boot into the CD instead of the hard drive. Ironically almost all of them are built around some kind of Linux distribution.</p>
<p>I tried one called Ophcrack which attempted to actually decode the Windows password hash.  Of course after cranking the CPU to 100% for 15 minutes, it failed to retrieve my password.  I didn&#8217;t say I came up with weak passwords :)</p>
<p>Finally I tried what&#8217;s called the Trinity Rescue Kit (just google it, it&#8217;s better than my linking to a website that may not be there when you needed it).  A 149MB .iso files which I burned into a CD-RW disc.  It gave me a command prompt after booting on my laptop.</p>
<p>I proceeded to type:<br />
<strong>winpass -u [my_username]</strong> and I was presented with a couple of options, one of which is to clear the password.  I selected it and less than one second later it announced that my password has been cleared.  Holding my breath, I issued <strong>shutdown -r now</strong> and waited.</p>
<p>And Voila! my laptop booted right into the account without asking for the password.  Whew! that was a relief.</p>
<p style="padding-left: 30px;">NOTE: Had I been able to enable the administrator account, I may have been spared from this exercise, but as I found out later, my version of Windows 7 that came with the laptop does not provide a way to enable the administrator account.  Strange!</p>
<p>So  my thanks to those white-hackers who wrote the winpass utility and to those distro-jockeys who made it available in the .iso format.</p>
<p>And this time I remembered to create a password reset usb-keychain drive.  Without it, I&#8217;d be repeating this story all over again.</p>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=156</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing Intranet Sites Remotely</title>
		<link>http://nextcoder.com/?p=109</link>
		<comments>http://nextcoder.com/?p=109#comments</comments>
		<pubDate>Mon, 21 Jun 2010 16:56:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Dev Best Practices]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nextcoder.com/?p=109</guid>
		<description><![CDATA[If you are like me, maintaining a server at home is like a hobby.  There is a certain satisfaction to be able to install whatever we like without having to ask for anybody&#8217;s permission.
And sometimes thanks to our tinkering, we discover good solutions that are applicable to the task given to us at work.  Think [...]]]></description>
			<content:encoded><![CDATA[<p>If you are like me, maintaining a server at home is like a hobby.  There is a certain satisfaction to be able to install whatever we like without having to ask for anybody&#8217;s permission.</p>
<p>And sometimes thanks to our tinkering, we discover good solutions that are applicable to the task given to us at work.  Think about it as giving our employers a bonus.</p>
<p>One of the most important rules in running a server is to never expose unnecessary information publicly.  Want an example? how about an obvious one, your router&#8217;s administration application.  This should never be accessible from outside of your home network for an obvious reason, obviously.</p>
<p>But the benefit of this approach is also its own downside.  Consider the following (highly likely) case:</p>
<p><strong>You need to urgently change a setting on your router, while you are not at home.</strong></p>
<p>Yep, you can&#8217;t.  Not without doing something extra anyways.</p>
<p>And that something extra is <em>SSH tunneling</em>.  Now, there are at least two ways that I know of on how to accomplish this.  For simplicity&#8217;s sake, let&#8217;s talk about one now:</p>
<p>If you are on a Windows machine, get yourself Putty and follow the steps on this website while replacing the forwarded port numbers with the one that you are trying to use.</p>
<pre>http://www.cs.uu.nl/technical/services/ssh/putty/puttyfw.html</pre>
<p>Basically, you are telling Putty to tunnel port number x from a machine within your home network to port number y on the machine where you are working on.</p>
<p>So in the above example, to access your router&#8217;s admin  application, you can setup  the tunnel from port 80 on your router&#8217;s ip-address, to let&#8217;s say port 8080 on the local machine (where you are working from).</p>
<p>In the UNIX world, that translates into the following:</p>
<pre>ssh -L 8080:your_router_ip:80 <em>your_username</em>@your_home_server.net
</pre>
<p>After successfully loggin into your home serve remotely, you can start a browser (on the machine where you&#8217;re working on currently), then go to localhost:8080 and voila! you&#8217;ll see your router&#8217;s administration application as though you are at home.</p>
<p>Pretty handy, eh?</p>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=109</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running GUI Linux programs in Windows</title>
		<link>http://nextcoder.com/?p=100</link>
		<comments>http://nextcoder.com/?p=100#comments</comments>
		<pubDate>Thu, 03 Jun 2010 16:16:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Dev Best Practices]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xming]]></category>

		<guid isPermaLink="false">http://nextcoder.com/?p=100</guid>
		<description><![CDATA[Now why on earth would you want to run GUI Linux programs on Windows?
If you were to ask me that a week ago, I would not be able to come up with a good business scenario.  Other than the fact that I did it at home, because my main computer is a Windows box and [...]]]></description>
			<content:encoded><![CDATA[<p>Now why on earth would you want to run GUI Linux programs on Windows?</p>
<p>If you were to ask me that a week ago, I would not be able to come up with a good business scenario.  Other than the fact that I did it at home, because my main computer is a Windows box and my development stuff is on my Linux server.</p>
<p>But at the moment I am stuck with an old laptop at work &#8212; which, being a good corporate laptop, of course is running Windows XP &#8212; because the giant four-letter computer company has messed up the shipment for my new computer.</p>
<p>So to make lemonade out of a lemon, I have enlisted two powerful free software that can get me out of this jam: PuTTY and Xming.</p>
<p><strong>The idea is to use a powerful Linux machine to host and run the GUI programs that I need to work with from my very resource-limited old laptop (Pentium 4 Mobile with 512 MB, anyone?). </strong></p>
<p>What applications? you say&#8230;</p>
<p>Let&#8217;s pick a big one, how about the Eclipse IDE.</p>
<p>Step one:</p>
<p>You install Xming and fire up XLaunch.  Out of the three modes that Xming offered: 1) multiple apps in one window, 2) each app running in a separate window, 3) fullscreen mode, mode 2 is one that works the best in this scenario.</p>
<p>So I went ahead and created an .xlaunch file that basically fired up Xming in the background, ready to accept X-window connections on the old laptop. NOTE: Don&#8217;t forget to check a box that says &#8220;No Access Control&#8221; otherwise your Linux application will be rejected when it tried to connect to Xming.</p>
<p style="padding-left: 30px;"><strong>NOTE</strong>: Xming has a file called <strong>X0.hosts</strong> (that&#8217;s X and zero, not the letter &#8216;o&#8217;) which is usually located in the Xming install directory.  This file may need to be modified to include the IP address of the linux box.  But only if it connects to Xming via another network domain (other than the primary one).</p>
<p style="padding-left: 30px;">For example, I setup a virtual linux guest on my windows 7 machine, the local network subdomain looks like 192.168.56.x unlike the default network domain which is 192.168.1.x.  The latter is where Xming waits for connections from.  Therefore I need to add 192.168.1.101 (the IP address of the linux machine) to the end of X0.hosts file (a line by itself), then Xming will work as expected.</p>
<p style="padding-left: 30px;">A subnote, on my machine, windows 7 forces me to become administrator user to edit this file.  Although not as elegant as UNIX&#8217;s sudo command, the Switch User facility in windows makes this not as painful as it could have been.</p>
<p>Next, I fired up PuTTy.  I followed the steps to configure a PuTTy session that will allow X-forwarding and all that good stuff on <a href="http://www.straightrunning.com/XmingNotes/trouble.php" target="_blank">this website</a>.</p>
<p>Once you are connected to the Linux server, in which I already have downloaded the appropriate Eclipse distribution, ready to go.</p>
<p>All I need to do once I connected via PuTTy is:</p>
<ol>
<li>Set the DISPLAY environment variable to point to the laptop&#8217;s Xming instance: <strong>export DISPLAY=192.168.x.x:10.0 </strong>(the 192.168.x.x being the laptop&#8217;s internal IP address, of course).</li>
<li>Run Eclipse IDE: <strong>./eclipse &amp;</strong></li>
</ol>
<p>And voila! Eclipse is running on the Linux server with every bit of its UI tunneled via X onto the old laptop.  Of course the performance depends on the network connection, but it is surprisingly snappy on a typical 100Mbps Gigabit Ethernet.  And I am talking about Eclipse loaded with a large project.</p>
<p>Now if this article does not make you run to the storerooms in the back and pull out those old laptops and give those out to your developers, I don&#8217;t know what else will :)</p>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=100</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Good IDE</title>
		<link>http://nextcoder.com/?p=82</link>
		<comments>http://nextcoder.com/?p=82#comments</comments>
		<pubDate>Mon, 10 May 2010 06:11:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Dev Best Practices]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nextcoder.com/?p=82</guid>
		<description><![CDATA[An IDE is a good idea.  If you as much as having the need to organize a couple of text files that you often write and change, you need one.
An Integrated Development Environment (IDE) is basically a multi-document text editor that assist you in managing a project.
Assist me how? you might ask.
Beyond reliably allowing you [...]]]></description>
			<content:encoded><![CDATA[<p>An IDE is a good idea.  If you as much as having the need to organize a couple of text files that you often write and change, you need one.</p>
<p>An Integrated Development Environment (IDE) is basically a multi-document text editor that assist you in managing a project.</p>
<p>Assist me how? you might ask.</p>
<p>Beyond reliably allowing you to edit your text files &#8212; be it your collection of barbecue recipes, love-letters, or your latest Cake PHP project &#8212; a good IDE should have the following features:</p>
<ul>
<li>File-type recognition.  The IDE should be somewhat aware of what type of file you are editing.  The most popular file formats are a must, in my book, such as .html, .php, .java, .c, .py, .xml, .css, et cetera.</li>
<li>Syntax highlighting.  As part of the above feature, an IDE should highlight the common components of the said file type.   This is helpful especially when you are dealing with more than one type of files (typical if you are a software developer/web designer).</li>
<li>Auto-completion.  Another form of file-type recognition is to provide suggestions when we write a couple of letters.  For example, if I type &#8220;clearT&#8221;, the IDE should do a lookup for functions visible from the current code context and present it to me.  In this case, &#8220;clearThroat()&#8221; and &#8220;clearTupperware()&#8221; should be selectable.</li>
<li>Pair matching.  Pairs of what? Well, brackets, braces, HTML tags, multi-line comments, you name it.  Along with <em>folding</em>, this feature really makes figuring out your colleague&#8217;s code much easier.  Or your own code written six-months ago, for that matter.  Some IDEs out there go as far as auto-completing your brackets.  I find this annoying fifty-percent of the time, though.</li>
<li>Refined indentation control.  Try highlighting a few lines of code in a basic text editor like Gedit or Notepad and then hit the &#8216;Tab&#8217; key.  If you are a developer, unconsciously you&#8217;d expect the highlighted lines to be indented.  Instead, you are rewarded with a blank space.  A good IDE also allows you to select between tabs and spaces.  I like spaces, four of them per indentation level.  No, not Fortran, Python.</li>
<li>Multiple-file Text Search. For you UNIX users, think of a built-in &#8216;grep&#8217; command within the IDE.</li>
<li>Terminal/Console facility.  At the very least, a good IDE should have a way to execute compilers or other command-line tools that you may need to run your text file through.  At the most, an IDE can act as a GUI for your favorite application/web server.</li>
<li>Shortcut-keystrokes.  Preferably intuitive ones. As far as developer goes, I am an old-school, hands on keyboard, only reach for the mouse when needed -kinda guy.  I love shortcuts using key combinations.  They make tedious coding sessions a breeze.</li>
<li>Scriptable Macro Engine.  If you know even what this means, you have been coding long enough.  One of the &#8220;badges&#8221; of an veteran programmer is to be able to brag about how they wire their text editors to jump through hoops and play dead at their whim.  Yeah, nerdy; but in a good way.</li>
</ul>
<p>Also, some features that are &#8220;nice-to-haves&#8221; like built-in graphical debugger, version control integration, or library-dependency manager.</p>
<p>In short, if an IDE does not do enough to relieve you from the most mundane editing tasks, then it&#8217;s useless.  On the other hand, if the IDE is so complicated to use that you&#8217;re losing hair trying to figure it out, it&#8217;s worse than useless.</p>
<p>A good IDE should be intuitive.  If I issued an Open file command from an active document, then I should be presented with the contents of that same directory.  Some editors I use always show me what&#8217;s on my home directory.</p>
<p><strong>A Few Good IDEs</strong></p>
<p>Now let&#8217;s take a look at some good IDEs out there.</p>
<ul>
<li><strong>Geany</strong></li>
</ul>
<p>This lightweight IDE runs on Linux and Windows. OS X and BSD users should be able to compile and run, in fact, I&#8217;d be surprised if there are not port install for it.</p>
<p>The lightweight-ness of this particular IDE cannot be stressed enough.  I am running it remotely inside Xming (an X-windows server for Windows) and I never noticed any performance hit at all.</p>
<p>Two things impressed me right of the bat:</p>
<p>1) it recognizes any file types I&#8217;ve thrown at it so far, and when I need to map a new file extension to an existing file format, I went to Tools &gt; Configurations &gt; filetype_extensions.conf.</p>
<p><a href="http://nextcoder.net/nextcoder/wp-content/uploads/2010/05/geany_file_ext-e1273498912482.jpg"><img class="aligncenter size-full wp-image-91" title="geany_file_ext" src="http://nextcoder.net/nextcoder/wp-content/uploads/2010/05/geany_file_ext-e1273498912482.jpg" alt="" width="402" height="240" /></a></p>
<p>It opened up the configuration file (formatted intuitively), add the new file extension, save and close, then Tools &gt; Reload Configuration.  Done!</p>
<p>2) configurable shortcut-keystroke system, with defaults that make sense.  For instance, I can use Ctrl-PgDn to go to the next document on the right, Ctrl-PgUp to the left.  Just like how I navigate the tabs on Firefox. Very intuitive.</p>
<p>Most of the information that separates an IDE from an ordinary text editor is displayed on the lower panels.  Geany does not skimp on the  features.  As you can see below, the lower part of the IDE sports application status messages, compiler outputs, search outputs, a scribbling space, and a full blown terminal (or &#8216;console&#8217; for you modern UNIX users):</p>
<p><a href="http://nextcoder.net/nextcoder/wp-content/uploads/2010/05/geany_lower_panels.jpg"><img class="aligncenter size-full wp-image-96" title="geany_lower_panels" src="http://nextcoder.net/nextcoder/wp-content/uploads/2010/05/geany_lower_panels.jpg" alt="" width="335" height="207" /></a></p>
<p>A few features that I am missing: 1) a file browser/manager, 2) integration with souce-code version control systems such as SVN, 3) a scriptable macro engine.</p>
<p>Which, brings me to the last feature that I want to highlight.  Although billing itself as a lightweight IDE, the Geany developers are forward-thinking enough to embed a plugin infrastructure.  Perfect for implementing the &#8216;missing&#8217; features I mentioned above.</p>
<p>It is my hope that as this IDE gets more popular, people would start writing plugins for it to make it even more powerful.  For now, I&#8217;m going to enjoy using it.</p>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=82</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It&#8217;s the same thing!</title>
		<link>http://nextcoder.com/?p=58</link>
		<comments>http://nextcoder.com/?p=58#comments</comments>
		<pubDate>Thu, 29 Apr 2010 14:54:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://nextcoder.com/?p=58</guid>
		<description><![CDATA[After spending an hour to come up with this:

function mapName($th_name, $th_order)
{
	return(array($th_name => $th_order));
}
$order = array_map("mapName", $_POST['thFilename'], $_POST['raw_orders']);
$order_collapsed = array();
foreach ($order as $k => $v) {
    foreach ($v as $k2 => $v2) {
        $order_collapsed[$k2] = $v2;
    }
}

&#8230; I found out that I can [...]]]></description>
			<content:encoded><![CDATA[<p>After spending an hour to come up with this:</p>
<p><code><br />
function mapName($th_name, $th_order)<br />
{<br />
	return(array($th_name => $th_order));<br />
}<br />
$order = array_map("mapName", $_POST['thFilename'], $_POST['raw_orders']);<br />
$order_collapsed = array();<br />
foreach ($order as $k => $v) {<br />
    foreach ($v as $k2 => $v2) {<br />
        $order_collapsed[$k2] = $v2;<br />
    }<br />
}<br />
</code></p>
<p>&#8230; I found out that I can achieve the same goal by doing this:</p>
<p><code><br />
$order_collapsed = array_combine($_POST['thFilename'], $_POST['raw_orders']);<br />
</code></p>
<p>To make a lemonade out of lemons, I did learn quite a bit about Array handling in PHP.</p>
<p>Got to hand it to the PHP community,due to their maturity (I&#8217;m using PHP 5, not even the latest 6), they have quite a collection of some nifty stuff that you often need to do with arrays.  It&#8217;s just a matter of knowing what&#8217;s in the API before reinventing the wheel.</p>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=58</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A good Spring book</title>
		<link>http://nextcoder.com/?p=47</link>
		<comments>http://nextcoder.com/?p=47#comments</comments>
		<pubDate>Wed, 28 Apr 2010 04:34:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://nextcoder.com/?p=47</guid>
		<description><![CDATA[Book review: Pro Spring 2.5
Click here to go to the Publisher&#8217;s link.

I had the pleasure of reading through this book &#8212; yes all 1,000,000 pages in it &#8212; at my favorite Barnes &#038; Nobles bookstore while preparing for a session. One and a half hour later, I find myself strangely educated.
Despite the bad reviews that [...]]]></description>
			<content:encoded><![CDATA[<p>Book review: <strong>Pro Spring 2.5</strong><br />
Click here to go to the <a href="http://apress.com/book/view/9781590599211" target="_blank">Publisher&#8217;s link</a>.</p>
<p><img src="http://apress.com/resource/bookcover/9781590599211?size=medium" alt="Spring 2.5" /></p>
<p>I had the pleasure of reading through this book &#8212; yes all 1,000,000 pages in it &#8212; at my favorite Barnes &#038; Nobles bookstore while preparing for a session. One and a half hour later, I find myself strangely educated.</p>
<p>Despite the bad reviews that I read about this book, I think it strikes just the right level of complexity and I appreciate the realistic problems that is tackled throughout the book.  Such as how to measure the performance of your Hibernate layer via JMX.</p>
<p>This book is perfect for those who would like to have it as a reference that you can flip back and forth depending on which section of Spring Framework you&#8217;re tackling at the moment.</p>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=47</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lightweight GUI on Linux servers</title>
		<link>http://nextcoder.com/?p=1</link>
		<comments>http://nextcoder.com/?p=1#comments</comments>
		<pubDate>Tue, 27 Apr 2010 18:39:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://nextcoder.net/nextcoder/?p=1</guid>
		<description><![CDATA[Background
By definition, a Linux server is designed to host long-running processes unattended.  It is the opposite of a Linux-based desktop environment.
Yet a lot of time you do need or miss the convenience of GUI tools when working on your Linux servers.  Or sometimes you use your Linux server as your development platform; and development tools, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Background</strong></p>
<p>By definition, a Linux server is designed to host long-running processes unattended.  It is the opposite of a Linux-based desktop environment.</p>
<p>Yet a lot of time you do need or miss the convenience of GUI tools when working on your Linux servers.  Or sometimes you use your Linux server as your development platform; and development tools, unless you&#8217;re a masochist, are typically GUI-based.</p>
<p>A relevant example would be in a setting where you and your co-workers need to connect to a cloud-computing instance.  Obviously you want the minimal GUI without having to clog the network with unnecessary eye-candy and &#8220;smooth-rounded edges&#8221; of the mainstream GUI, or maybe you just prefer minimalistic and quick-response over polish.   Either way, you can use this article as a stepping stone to join the fun.</p>
<p>NOTE: You can apply this to any modern UNIX system as long as you can  get to the programs that we are discussing below.</p>
<p>As the world&#8217;s most flexible and (arguably) powerful OS, UNIX and its derivatives do not disappoint in this regard.  Discovering the right combination of so many good programs out there is a big part of the thrill of putting together an environment.</p>
<p>In this article, I&#8217;m using Ubuntu 9.10 (Karmic).  You can substitute almost 90% of apt-get command with yum if you&#8217;re using Fedora, or emerge for those of you Gentoo wizards.</p>
<p><strong>First Part: Server-side setup</strong></p>
<p>The reason I came across this exercise is a few months ago, I was upgrading my server to the latest Ubuntu release.  A power outage shutdown the server when it&#8217;s in limbo-mode, rather than trying to recover from the unknown state, I decided to went ahead and re-install Ubuntu from scratch and rebuild the server.</p>
<p>TIP: I was able to &#8220;wing-it&#8221; because I have done the due diligence of backing up my data, otherwise, I&#8217;d have way less hair to worry about when combing.</p>
<p>Anyways, on to the history lesson (a practice of using UNIX history command to learn a great deal about how to setup a server):<br />
<code> 3  apt-get update<br />
4  apt-get upgrade<br />
5  apt-get install apache2<br />
10  apt-get install mysql-server-5.0<br />
11  apt-get install libapache2-mod-auth-mysql phpmyadmin<br />
19  apt-get install lamp-server^<br />
20  apt-get update<br />
21  apt-get install openbox<br />
22  apt-get install obconf<br />
23  obconf<br />
30  vi /etc/xdg/openbox/menu.xml<br />
</code></p>
<p>Here we start by a pristine Ubuntu server install, nothing on it, and we add to it the LAMP stack, which gives us Apache 2.x, MySQL, and PHP.</p>
<p>Next here&#8217;s the lightweight window manager: Openbox.  It&#8217;s not only a window manager that can run on top of Gnome or KDE, it&#8217;s can also run as a stand alone session.  And this is the path we&#8217;re going in this article, since our goal is to go lean.</p>
<p>Two words: 1) ~/.xinitrc and 2) openbox-session.  Put the second one inside the first one; and the next time you start Xwindows you&#8217;ll be running Openbox.  Like this:</p>
<p><a href="http://nextcoder.net/nextcoder/wp-content/uploads/2010/04/openbox_screenshot1.jpg"><img class="alignnone size-full wp-image-69" title="openbox_screenshot1" src="http://nextcoder.net/nextcoder/wp-content/uploads/2010/04/openbox_screenshot1.jpg" alt="" width="400" height="219" /></a></p>
<p>Follow this <a href="http://ubuntuforums.org/showthread.php?t=75471" target="_blank">thread</a> for much more details and interesting aspects of Openbox.</p>
<p>Next, what file manager?&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://nextcoder.com/?feed=rss2&amp;p=1</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
