<?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>lstierneyltd &#187; quick tips</title>
	<atom:link href="http://lstierneyltd.com/blog/category/development/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://lstierneyltd.com/blog</link>
	<description>Yet another development blog</description>
	<lastBuildDate>Thu, 02 Sep 2010 18:04:38 +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>Selenium Tests Randomly Failing</title>
		<link>http://lstierneyltd.com/blog/development/tips/selenium-tests-randomly-failing/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/selenium-tests-randomly-failing/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 09:10:43 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[quick tips]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=178</guid>
		<description><![CDATA[The Problem
The project I&#8217;m currently working on uses a lot of selenium tests to verify the behaviour of the web front end and, I must say, I&#8217;ve been quite impressed with it.
Yesterday however after updating my local machine with the latest copy of the project from Clearcase I noticed a lot of failing tests; the [...]]]></description>
			<content:encoded><![CDATA[<h4>The Problem</h4>
<p>The project I&#8217;m currently working on uses a lot of <a href="http://seleniumhq.org/" target="_blank">selenium tests</a> to verify the behaviour of the web front end and, I must say, I&#8217;ve been quite impressed with it.</p>
<p>Yesterday however after updating my local machine with the latest copy of the project from Clearcase I noticed a lot of failing tests; the worrying (interesting?) thing though was that the failures appeared to be &#8220;random&#8221;. Tests were passing one run and failing the next, with no changes having being made in the source code and no changes in the initial starting conditions. I was starting to pull my hair out. Curiously the tests ran fine on my colleagues&#8217; and the build machine. My workmate had a look (remember the tests ran fine for him) but he too was getting the random failures on my machine &#8211; we were both stumped.<br />
<code><span id="more-178"></span></code></p>
<p>He did unknowingly hit on the problem when he said &#8220;Your machine is a lot zippier than mine&#8221;. After another hour or so the problem and solution became obvious.</p>
<h4>Cause</h4>
<p>The Selenium remote control was executing the steps of the test faster than my local app server and Firefox could keep up. In other words it was trying to verify elements on the page before they had rendered.</p>
<h4>Solution</h4>
<p>To quickly check my hypothesis I ran the Selenium Tests in &#8220;slow mode&#8221; &#8211; all the tests passed!</p>
<p>Now, going forward, I will need to check the test source for all snippets like</p>
<pre class="brush: plain;">
browser.click(&quot;someButton&quot;); // causes page to load
verifyTrue(browser.isTextPresent(&quot;someText&quot;));
</pre>
<p>and change them to</p>
<pre class="brush: plain;">
browser.click(&quot;someButton&quot;);
browser.waitForPageToLoad(&quot;30000&quot;);
verifyTrue(browser.isTextPresent(&quot;someText&quot;));
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/selenium-tests-randomly-failing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dos to Unix (Dos2Unix) with Eclipse</title>
		<link>http://lstierneyltd.com/blog/development/tips/dos-to-unix-dos2unix-with-eclipse/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/dos-to-unix-dos2unix-with-eclipse/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 08:49:20 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[quick tips]]></category>
		<category><![CDATA[dos2unix]]></category>
		<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=175</guid>
		<description><![CDATA[1. Open the file in Eclipse that you wish to &#8220;Dos2Unix&#8221;
2. File -> Convert Line Delimiters To -> Unix
Profit!
]]></description>
			<content:encoded><![CDATA[<p>1. Open the file in Eclipse that you wish to &#8220;Dos2Unix&#8221;<br />
2. File -> Convert Line Delimiters To -> Unix</p>
<p>Profit!</p>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/dos-to-unix-dos2unix-with-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAXB @XmlAnyElement example</title>
		<link>http://lstierneyltd.com/blog/development/tips/jaxb-xmlanyelement-example/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/jaxb-xmlanyelement-example/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 15:06:52 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[quick tips]]></category>
		<category><![CDATA[annotations]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jaxb]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=134</guid>
		<description><![CDATA[The problem
I was recently working on a JAXB centric app which was required to capture &#8220;arbitary&#8221; xml. e.g.

&#60;a&#62;
   &#60;b&#62;&#60;/b&#62;
   &#60;c&#62;&#60;/c&#62;
   &#60;d&#62;
       &#60;!-- &#34;Unknown&#34; XML here --&#62;
       &#60;maybeE&#62;&#60;/maybeE&#62;
       &#60;maybeF&#62;&#60;/maybeF&#62;
    [...]]]></description>
			<content:encoded><![CDATA[<h4>The problem</h4>
<p>I was recently working on a JAXB centric app which was required to capture &#8220;arbitary&#8221; xml. e.g.</p>
<pre class="brush: plain;">
&lt;a&gt;
   &lt;b&gt;&lt;/b&gt;
   &lt;c&gt;&lt;/c&gt;
   &lt;d&gt;
       &lt;!-- &quot;Unknown&quot; XML here --&gt;
       &lt;maybeE&gt;&lt;/maybeE&gt;
       &lt;maybeF&gt;&lt;/maybeF&gt;
       &lt;!-- etc etc --&gt;
   &lt;d/&gt;
&lt;/a&gt;
</pre>
<p>How could I ever capture the contents of <d> if they could be &#8220;anything&#8221;?<br />
<code><span id="more-134"></span></code></p>
<h4>The solution</h4>
<pre class="brush: plain;">
@XmlRootElement(name=&quot;a&quot;)
public class A { 

   @XmlElement
   private String b; 

   @XmlElement
   private String c; 

   @XmlAnyElement
   private List&lt;Element&gt; content;
}
</pre>
<h4>What&#8217;s going on?</h4>
<p>The <strong>@XmlAnyElement </strong> annotation instructs JAXB to hoover up any elements which aren&#8217;t already annotated/associated with a field and store their DOM representation in:</p>
<pre>
private List<Element> content;
</pre>
<p>You could then do something like:</p>
<pre class="brush: plain;">
public String getContentAsString() throws Exception{
    StringBuilder builder = new StringBuilder();
    for (Node node: operations) {
        StringWriter writer = new StringWriter();
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, &quot;yes&quot;);
        transformer.transform(new DOMSource(node), new StreamResult(writer));
        builder.append(writer.toString());
    }
    return builder.toString();
}
</pre>
<p>To get the nested XML as String.</p>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/jaxb-xmlanyelement-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to convert a CLOB to an XMLType in Oracle</title>
		<link>http://lstierneyltd.com/blog/development/tips/how-to-convert-a-clob-to-an-xmltype-in-oracle/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/how-to-convert-a-clob-to-an-xmltype-in-oracle/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 13:17:23 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[quick tips]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[plsql]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=125</guid>
		<description><![CDATA[Not much comment to add here; code says it all

PROCEDURE clobToXMLType(myClob IN CLOB)

IS
    l_xmlType XMLTYPE;
    -- do something
BEGIN
    l_xmltype := XMLTYPE.createXML(myClob);

EXCEPTION

    WHEN OTHERS THEN
    	RAISE;

END clobToXMLType;

]]></description>
			<content:encoded><![CDATA[<p>Not much comment to add here; code says it all</p>
<pre>
PROCEDURE clobToXMLType(myClob IN CLOB)

IS
    l_xmlType XMLTYPE;
    -- do something
BEGIN
    l_xmltype := XMLTYPE.createXML(myClob);

EXCEPTION

    WHEN OTHERS THEN
    	RAISE;

END clobToXMLType;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/how-to-convert-a-clob-to-an-xmltype-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset Gnome desktop the easy way</title>
		<link>http://lstierneyltd.com/blog/development/tips/reset-gnome-desktop-the-easy-way/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/reset-gnome-desktop-the-easy-way/#comments</comments>
		<pubDate>Sun, 16 May 2010 10:17:04 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[quick tips]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=109</guid>
		<description><![CDATA[I recently upgraded Ubuntu on one of machines from 9.10 (Karmic Koala) to 10.04 (Lucid Lynx). In the old version I had installed a lot of widgets, messed up the fonts, buttons &#8211; loads of things. I needed an easy way to restore/reset the Gnome desktop back to the default look and feel.
I could of [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded Ubuntu on one of machines from 9.10 (Karmic Koala) to 10.04 (Lucid Lynx). In the old version I had installed a lot of widgets, messed up the fonts, buttons &#8211; loads of things. I needed an easy way to restore/reset the Gnome desktop back to the default look and feel.</p>
<p>I could of course have used the gui&#8217;s to undo all the changes I made but why bother? This is Linux after all!</p>
<pre>
# cd
# [sudo] rm -rf .gnome .gnome2 .gconf .gconfd .metacity
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/reset-gnome-desktop-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show and search list of installed packages (Ubuntu)</title>
		<link>http://lstierneyltd.com/blog/development/tips/show-and-search-list-of-installed-packages-ubuntu/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/show-and-search-list-of-installed-packages-ubuntu/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 12:39:56 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[quick tips]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=45</guid>
		<description><![CDATA[To show the complete list:

dpkg --get-selections

To filter the list

dpkg --get-selections &#124; grep XXX

]]></description>
			<content:encoded><![CDATA[<p>To show the complete list:</p>
<pre>
dpkg --get-selections
</pre>
<p>To filter the list</p>
<pre>
dpkg --get-selections | grep XXX
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/show-and-search-list-of-installed-packages-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Eclipse PDT or Webtools missing perspectives on Linux (Ubuntu)</title>
		<link>http://lstierneyltd.com/blog/development/tips/eclipse-pdt-or-webtools-missing-perspectives-on-linux-ubuntu/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/eclipse-pdt-or-webtools-missing-perspectives-on-linux-ubuntu/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 11:38:07 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[quick tips]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=22</guid>
		<description><![CDATA[This post is an aide-mémoire and hopefully helps anyone who has the same issue I had; namely that Eclipse PDT or Eclipse Webtools Project running on Linux (in this case Ubuntu) was not making all installed perspectives available.
The symptoms were that Eclipse would start but only in &#8220;vanilla&#8221; mode: only three basic perspectives showing. If [...]]]></description>
			<content:encoded><![CDATA[<p>This post is an aide-mémoire and hopefully helps anyone who has the same issue I had; namely that Eclipse PDT or Eclipse Webtools Project running on Linux (in this case Ubuntu) was not making all installed perspectives available.<code><span id="more-22"></span></code></p>
<p>The symptoms were that Eclipse would start but only in &#8220;vanilla&#8221; mode: only three basic perspectives showing. If like me you installed the Eclipse binary as root into some directory then that&#8217;s your problem right there. In order for the other perspectives to become available, when running Eclipse as a non-root user, you need to ensure that the user you are trying to run Eclipse as has read/write/exe permission on the Eclipse directory. I&#8217;m sure they don&#8217;t need all permissions on all the sub-directories but I wasn&#8217;t about to start messing around to find out exactly what was required.</p>
<p>In short &#8211; check the permissions on the Eclipse directory!</p>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/eclipse-pdt-or-webtools-missing-perspectives-on-linux-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get latitude, longitude of location using google maps</title>
		<link>http://lstierneyltd.com/blog/development/tips/get-latitude-longitude-of-location-using-google-maps/</link>
		<comments>http://lstierneyltd.com/blog/development/tips/get-latitude-longitude-of-location-using-google-maps/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 11:08:43 +0000</pubDate>
		<dc:creator>lawrence</dc:creator>
				<category><![CDATA[quick tips]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://lstierneyltd.com/blog/?p=15</guid>
		<description><![CDATA[1. Right click map and &#8220;center on location&#8221;.
2. Execute this JS in browser address bar:

javascript:void(prompt('',gApplication.getMap().getCenter()));

]]></description>
			<content:encoded><![CDATA[<p>1. Right click map and &#8220;center on location&#8221;.<br />
2. Execute this JS in browser address bar:</p>
<pre>
javascript:void(prompt('',gApplication.getMap().getCenter()));
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lstierneyltd.com/blog/development/tips/get-latitude-longitude-of-location-using-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
