<?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>Smartkey - Java Software Consultancy &#187; Development</title>
	<atom:link href="http://blog.smartkey.co.uk/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartkey.co.uk</link>
	<description></description>
	<lastBuildDate>Tue, 13 Dec 2011 15:03:46 +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>Adding the application name to links in a Web application</title>
		<link>http://blog.smartkey.co.uk/2011/12/adding-the-application-name-to-links-in-a-web-application/</link>
		<comments>http://blog.smartkey.co.uk/2011/12/adding-the-application-name-to-links-in-a-web-application/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 15:03:46 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=958</guid>
		<description><![CDATA[Application servers can run a number of applications. A single Tomcat instance, for example, will create a separate web application for each WAR file it finds in its webapps directory. 
The applications will be named the same as their WAR files and can be accessed using URLs that start with that name. For example, to [...]]]></description>
			<content:encoded><![CDATA[<p>Application servers can run a number of applications. A single Tomcat instance, for example, will create a separate web application for each WAR file it finds in its webapps directory. </p>
<p>The applications will be named the same as their WAR files and can be accessed using URLs that start with that name. For example, to access index.jsp in the root directory of a WAR file called <code><strong>myapp.war</strong></code> running on Tomcat on the localhost you will need the following URL:</p>
<p><code>http://localhost:8080/<strong>myapp</strong>/index.jsp</code></p>
<p>When there are multiple applications running in the same Tomcat server, they must all have different names. </p>
<p>Any absolute URLs that you need to include in your application must include the applictions name at the start. For example, if in index.jsp we want to reference an image in &#8216;/images/banner.png&#8217; the absolute URL will be: &#8216;/myapp/images/banner.png&#8217;.</p>
<p>It is bad practice to hard code the application&#8217;s name in the URL as this may change for different deployments of the application. Instead, it may be added dynamically using the following scriptlet:</p>
<pre class="brush: php">
${pageContext.request.contextPath}
</pre>
<p>So, to add an img tag that refers to the banner image use:</p>
<pre class="brush: php">
&lt;img src=&quot;${pageContext.request.contextPath}/images/banner.png&quot;/&gt;
</pre>
<p>Alternatively, there are a number of custom tag libraries that will automatically do this for you. Spring MVC ships with such a tag:</p>
<pre class="brush: php">
&lt;spring:url value=&#039;/images/banner.png&#039;&gt;
</pre>
<p>this will achieve the same results as the scriptlet shown above but is simpler to remember when adding a number of links in your JSPs.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2011/12/adding-the-application-name-to-links-in-a-web-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Identifying number of account logins on Sybase</title>
		<link>http://blog.smartkey.co.uk/2011/11/identifying-number-of-account-logins-on-sybase/</link>
		<comments>http://blog.smartkey.co.uk/2011/11/identifying-number-of-account-logins-on-sybase/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 09:17:57 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[sybase]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=955</guid>
		<description><![CDATA[If you quickly need to see how many logins there are for each account in sybase, you can use this query:

select dbname=db_name(dbid),login=suser_name(suid), #connections=count(suid)
from master..sysprocesses
--where  suser_name(suid) like &#039;%dblogin%&#039;
group by dbid, suid
order by count(suid)

]]></description>
			<content:encoded><![CDATA[<p>If you quickly need to see how many logins there are for each account in sybase, you can use this query:</p>
<pre class="brush: php">
select dbname=db_name(dbid),login=suser_name(suid), #connections=count(suid)
from master..sysprocesses
--where  suser_name(suid) like &#039;%dblogin%&#039;
group by dbid, suid
order by count(suid)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2011/11/identifying-number-of-account-logins-on-sybase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick formatting of Date using a Java String format expression</title>
		<link>http://blog.smartkey.co.uk/2011/10/quick-formatting-of-date-using-a-java-string-format-expression/</link>
		<comments>http://blog.smartkey.co.uk/2011/10/quick-formatting-of-date-using-a-java-string-format-expression/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 12:00:59 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java Date Format]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=950</guid>
		<description><![CDATA[For quick reference, this is how you can format a date as:
dd/mm/yyyy at hh:mm:ss
System.out.printf(&#34;Date: %1$te/%1$tm/%1$tY at %1$tH:%1$tM:%1$tS%n&#34;, new Date());
The % characters mark a placeholders for String content, the 1$ indicates that the first vararg should be used for each placeholder (there is only one varag value supplied), the letter &#8216;t&#8217; in each placeholder indicates a [...]]]></description>
			<content:encoded><![CDATA[<p>For quick reference, this is how you can format a date as:</p>
<p>dd/mm/yyyy at hh:mm:ss</p>
<pre class="brush: php">System.out.printf(&quot;Date: %1$te/%1$tm/%1$tY at %1$tH:%1$tM:%1$tS%n&quot;, new Date());</pre>
<p>The % characters mark a placeholders for String content, the 1$ indicates that the first vararg should be used for each placeholder (there is only one varag value supplied), the letter &#8216;t&#8217; in each placeholder indicates a time conversion and the e, m, Y, H, M, S characters indicate what value should be taken from the new Date object for that time conversion.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2011/10/quick-formatting-of-date-using-a-java-string-format-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Searching for files in an Ant script</title>
		<link>http://blog.smartkey.co.uk/2011/09/searching-for-files-in-an-ant-script/</link>
		<comments>http://blog.smartkey.co.uk/2011/09/searching-for-files-in-an-ant-script/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 11:17:19 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tool support]]></category>
		<category><![CDATA[Ant]]></category>
		<category><![CDATA[Ivy]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=934</guid>
		<description><![CDATA[This is a simple technique for determining whether or not files matching a given pattern exist within your project. Unlike the available task, this does not require that you need to know the exact name of the file when creating the build file. It is therefore very useful for checking existence of generated/downloaded artefacts.
I&#8217;ll demonstrate [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple technique for determining whether or not files matching a given pattern exist within your project. Unlike the <code>available</code> task, this does not require that you need to know the exact name of the file when creating the build file. It is therefore very useful for checking existence of generated/downloaded artefacts.</p>
<p>I&#8217;ll demonstrate the technique with an Ant target that I wrote to check whether Ivy had downloaded any jars that had the pattern SNAPSHOT in their name:</p>
<pre class="brush: php">
&lt;target name=&quot;ivy-count-snapshot-jars&quot; depends=&quot;init&quot; if=&quot;ivy.present&quot;&gt;
    &lt;resourcecount property=&quot;ivy.snapshot.count&quot;&gt;
        &lt;fileset dir=&quot;${ivylib.dir}&quot; includes=&quot;**/*SNAPSHOT*.jar&quot;/&gt;
    &lt;/resourcecount&gt;
    &lt;condition property=&quot;ivy.snapshot.present&quot;&gt;
        &lt;not&gt;
            &lt;equals arg1=&quot;${ivy.snapshot.count}&quot; arg2=&quot;0&quot;/&gt;
        &lt;/not&gt;
    &lt;/condition&gt;
&lt;/target&gt;

&lt;target name=&quot;ivy-check-snapshot-jars&quot;
        depends=&quot;ivy-count-snapshot-jars&quot;
        if=&quot;ivy.snapshot.present&quot;&gt;
     &lt;echo&gt;WARNING: Project uses ${ivy.snapshot.count} SNAPSHOT jar(s).&lt;/echo&gt;
&lt;/target&gt;
</pre>
<p>The first target does most of the work and is used to count the number of jar files with &#8216;SNAPSHOT&#8217; in their name; it also sets a property if the count is not zero.</p>
<p>The second target is the main one that should be used to perform the check. It depends on the first target (ensuring that the count is done first) and will only then run if the first target sets the &#8216;ivy.snapshot.present&#8217; property. Thus the warning message will only get echoed if there are snapshot jars in the project.    </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2011/09/searching-for-files-in-an-ant-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a thread timeout to methods in Java</title>
		<link>http://blog.smartkey.co.uk/2011/09/adding-a-thread-timeout-to-methods-in-java/</link>
		<comments>http://blog.smartkey.co.uk/2011/09/adding-a-thread-timeout-to-methods-in-java/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 13:19:55 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java Programming]]></category>
		<category><![CDATA[Concurrency]]></category>
		<category><![CDATA[Concurrent]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thread]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=924</guid>
		<description><![CDATA[When calling a method that could potentially take longer that you&#8217;d like to complete, it is possible to write code that will back out after a given time period. 
This can happen in numerous circumstances where you&#8217;d like an application to maintain a degree of liveness. I&#8217;ve used it recently in an application that needed [...]]]></description>
			<content:encoded><![CDATA[<p>When calling a method that could potentially take longer that you&#8217;d like to complete, it is possible to write code that will back out after a given time period. </p>
<p>This can happen in numerous circumstances where you&#8217;d like an application to maintain a degree of liveness. I&#8217;ve used it recently in an application that needed to run a number of external scripts; if the script does not complete, for whatever reason, the timeout ensures the the calling thread does not get blocked and the remaining scripts can be launched.</p>
<p>Here&#8217;s the basic idea:</p>
<pre class="brush: php">
public class TimeoutDemo {

    //maintains a thread for executing the doWork method
    private ExecutorService executor = Executors.newFixedThreadPool(1);

    public void doWork() {
        //perform some long running task here...
    }

    public void doWorkWithTimeout(int timeoutSecs) {

        //set the executor thread working
        final Future&lt;?&gt; future = executor.submit(new Runnable() {
            public void run() {
                try {
                    doWork();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        });

        //check the outcome of the executor thread and limit the time allowed for it to complete
        try {
            future.get(timeoutSecs, TimeUnit.SECONDS);
        } catch (Exception e) {
            //ExecutionException: deliverer threw exception
            //TimeoutException: didn&#039;t complete within downloadTimeoutSecs
            //InterruptedException: the executor thread was interrupted

            //interrupts the worker thread if necessary
            future.cancel(true);

            log.warn(&quot;encountered problem while doing some work&quot;, e);
        }
    }
}
</pre>
<p>The doWork method is the one that will actually do some potentially long running work. The doWorkWithTimeout illustrates how the java.util.concurrent classes can be used to prevent the method from taking too long to complete. When calling the latter method, just specify the timeout period in minutes.</p>
<p>The trick here is that the actual work will be done by a dedicated worker thread. The calling thread will handle the timeout management and also handle any exceptions thrown by the worker.</p>
<p>Variations of this pattern can be used for methods that accept parameters (just make them final) and for ones that return values too (just return the value from the future.get(&#8230;) call).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2011/09/adding-a-thread-timeout-to-methods-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What info can you get from an HttpServletRequest?</title>
		<link>http://blog.smartkey.co.uk/2011/02/httpservletrequestmethods/</link>
		<comments>http://blog.smartkey.co.uk/2011/02/httpservletrequestmethods/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 13:17:44 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java Programming]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[servlet]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=883</guid>
		<description><![CDATA[There are many methods on an HttpServletRequest, and if you&#8217;re anything like me, you&#8217;ll forget exactly what each of them returns. Rather than a long winded investigation into them all, here&#8217;s a sample URL:

https://localhost:8443/test/welcome?a=1&#038;b=2

The &#8216;/test&#8217; in the URL will map to a servlet called test. The servlet will dispatch the request to a JSP for [...]]]></description>
			<content:encoded><![CDATA[<p>There are many methods on an HttpServletRequest, and if you&#8217;re anything like me, you&#8217;ll forget exactly what each of them returns. Rather than a long winded investigation into them all, here&#8217;s a sample URL:<br />
<code><br />
https://localhost:8443/test/welcome?a=1&#038;b=2<br />
</code></p>
<p>The &#8216;/test&#8217; in the URL will map to a servlet called test. The servlet will dispatch the request to a JSP for rendering that has the following scriplet code in it:</p>
<pre class="brush: php">
RequestURL: &lt;%= request.getRequestURL() %&gt; &lt;br&gt;
RequestURI: &lt;%= request.getRequestURI() %&gt; &lt;br&gt;
QueryString: &lt;%= request.getQueryString() %&gt; &lt;br&gt;
ServletPath: &lt;%= request.getServletPath() %&gt; &lt;br&gt;
PathInfo: &lt;%= request.getPathInfo() %&gt; &lt;br&gt;
PathTranslated: &lt;%= request.getPathTranslated() %&gt;&lt;br&gt;
AuthType: &lt;%= request.getAuthType() %&gt; &lt;br&gt;
LocalAddress: &lt;%= request.getLocalAddr() %&gt; &lt;br&gt;
Method: &lt;%= request.getMethod() %&gt; &lt;br&gt;
RemoteUser: &lt;%= request.getRemoteUser() %&gt; &lt;br&gt;
</pre>
<p>this is the output generated:</p>
<pre class="brush: php">
RequestURL: https://localhost:8443/test/welcome
RequestURI: /test/welcome
QueryString: a=1&amp;b=2
ServletPath: /test
PathInfo: /welcome
PathTranslated: C:\projects\testproj\out\artifacts\testapp_war_exploded\welcome
AuthType: CLIENT_CERT
LocalAddress: 127.0.0.1
Method: GET
RemoteUser: Steve
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2011/02/httpservletrequestmethods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementing Flash Scope in Java Web Applications</title>
		<link>http://blog.smartkey.co.uk/2011/01/implementing-flash-scope-in-java-web-applications/</link>
		<comments>http://blog.smartkey.co.uk/2011/01/implementing-flash-scope-in-java-web-applications/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 19:20:29 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java Programming]]></category>
		<category><![CDATA[Flash scope]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[Request]]></category>
		<category><![CDATA[Session]]></category>
		<category><![CDATA[Spring MVC]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=828</guid>
		<description><![CDATA[While working recently on a Spring MVC project I found myself wishing it supported flash scope. I hunted around for a simple solution but couldn&#8217;t find anything that didn&#8217;t rely on having to import large framework libraries. After a little thought I came up with the following simple and lightweight solution that has worked really [...]]]></description>
			<content:encoded><![CDATA[<p>While working recently on a Spring MVC project I found myself wishing it supported flash scope. I hunted around for a simple solution but couldn&#8217;t find anything that didn&#8217;t rely on having to import large framework libraries. After a little thought I came up with the following simple and lightweight solution that has worked really well for me. I&#8217;ve included the code for this below so feel free to try it out.</p>
<h3>What is Flash Scope</h3>
<p>Flash scope is a useful part of many web frameworks. It allows the use of the <a href="http://en.wikipedia.org/wiki/Post/Redirect/Get">post/redirect/get</a> design pattern to alleviate many of the problems associated with handling multiple submits or resubmission of data in browser requests to the server.</p>
<p>Flash scope is an additional scope to those provided in a standard Java Web application (page, request, session and application). Any attributes held in flash scope will be available for the duration of the current request, and the subsequent request too.</p>
<h3>My Implementation</h3>
<p>To implement flash scope in my application, I added a servlet filter that checks for request attribute names starting with &#8216;<strong>flash.</strong>&#8216;. When it finds such an attribute, it ensures that it is made available in the subsequent request by temporarily storing it in the user&#8217;s session, and then reinstating it when the next request is received.</p>
<p>For example, to add a message to flash scope, just use the regular syntax for adding a request scoped attribute and let the fiter take care of it:</p>
<pre class="brush: php">
request.setAttribute(&quot;flash.message&quot;, &quot;Here is the news...&quot;);
</pre>
<p>The above attribute can then be accessed in the redirect target JSP using EL or scriptlet syntax (omitting the &#8216;<strong>flash.</strong>&#8216; prefix):</p>
<pre class="brush: php">
${message}
or
&lt;%= request.getAttribute(&quot;message&quot;)  %&gt;
</pre>
<p>Here&#8217;s the code for the filter:</p>
<pre class="brush: php">
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

/**
 * Ensures that any request parameters whose names start
 * with &#039;flash.&#039; are available for the next request too.
 */
public class FlashScopeFilter implements Filter {

    private static final String FLASH_SESSION_KEY = &quot;FLASH_SESSION_KEY&quot;;

    @SuppressWarnings(&quot;unchecked&quot;)
    public void doFilter(ServletRequest request, ServletResponse response,
					FilterChain chain) throws IOException, ServletException {

        //reinstate any flash scoped params from the users session
		//and clear the session
        if (request instanceof HttpServletRequest) {
            HttpServletRequest httpRequest = (HttpServletRequest) request;
            HttpSession session = httpRequest.getSession(false);
            if (session != null) {
                Map&lt;String, Object&gt; flashParams = (Map&lt;String, Object&gt;)
									session.getAttribute(FLASH_SESSION_KEY);
                if (flashParams != null) {
                    for (Map.Entry&lt;String, Object&gt; flashEntry : flashParams.entrySet()) {
                        request.setAttribute(flashEntry.getKey(), flashEntry.getValue());
                    }
                    session.removeAttribute(FLASH_SESSION_KEY);
                }
            }
        }

        //process the chain
        chain.doFilter(request, response);

        //store any flash scoped params in the user&#039;s session for the
		//next request
        if (request instanceof HttpServletRequest) {
            HttpServletRequest httpRequest = (HttpServletRequest) request;
            Map&lt;String, Object&gt; flashParams = new HashMap();
			Enumeration e = httpRequest.getAttributeNames();
            while (e.hasMoreElements()) {
                String paramName = (String) e.nextElement();
                if (paramName.startsWith(&quot;flash.&quot;)) {
                    Object value = request.getAttribute(paramName);
                    paramName = paramName.substring(6, paramName.length());
                    flashParams.put(paramName, value);
                }
            }
            if (flashParams.size() &gt; 0) {
                HttpSession session = httpRequest.getSession(false);
                session.setAttribute(FLASH_SESSION_KEY, flashParams);
            }
        }
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        //no-op
    }

    public void destroy() {
        //no-op
    }
}
</pre>
<p>You can see from the listing, that the filter stores the flash scoped parameters in a session scoped  map called FLASH_SESSION_KEY. Before the request is processed by the filter chain, the flash attributes are retrieved from the session and added to request scope; after the chain has finished, any new flash scoped parameters are stored in a new session scoped map.</p>
<p>Note that the attributes have the &#8216;<strong>flash.</strong>&#8216; prefix removed when added to the session scoped map &#8211; this not only ensures that they can be accessed using their &#8217;short name&#8217;, but that they are only kept in the session for one extra request.</p>
<p>This approach is not Spring specific and should work with and Java Web framework. I&#8217;ve omitted the configuration for the filter as there are loads of examples of how to do this on the Internet already.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2011/01/implementing-flash-scope-in-java-web-applications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Finding tables and columns by name in a large Sybase database</title>
		<link>http://blog.smartkey.co.uk/2010/12/finding-tables-and-columns-in-sybase/</link>
		<comments>http://blog.smartkey.co.uk/2010/12/finding-tables-and-columns-in-sybase/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 16:08:27 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[sybase]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=822</guid>
		<description><![CDATA[When working with a large Sybase database, especially one that you are not too farmiliar with, the following SQL snippets can be really useful for finding your way around. 

select name,type from sysobjects where (name like &#039;%Sales%&#039;) and type = &#039;U&#039;

The sysobjects table stores data about various items in the database including tables (note that [...]]]></description>
			<content:encoded><![CDATA[<p>When working with a large Sybase database, especially one that you are not too farmiliar with, the following SQL snippets can be really useful for finding your way around. </p>
<pre class="brush: php">
select name,type from sysobjects where (name like &#039;%Sales%&#039;) and type = &#039;U&#039;
</pre>
<p>The sysobjects table stores data about various items in the database including tables (note that the type column is set to &#8216;U&#8217; for <strong>u</strong>ser tables).</p>
<p>To search for columns, you can use a similar query:</p>
<pre class="brush: php">
select name,object_name(id) from syscolumns where name like &#039;%currency%&#039;
</pre>
<p>This time, we&#8217;re querying a similar table specifically for columns. The ID column in this table is a foreigh key that refers to the primary key in the sysobjects table; thus allowing us to discover which table the column belongs to (done in this example using the object_name function).</p>
<p>This query will therefore return a list of all columns with the text &#8216;currency&#8217; in their name, and the tables to which they belong.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2010/12/finding-tables-and-columns-in-sybase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using recursion to program in JSP</title>
		<link>http://blog.smartkey.co.uk/2010/11/using-recursion-to-program-in-jsp/</link>
		<comments>http://blog.smartkey.co.uk/2010/11/using-recursion-to-program-in-jsp/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 11:27:16 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=803</guid>
		<description><![CDATA[I needed to render a tree structure in a JSP and wanted to use a recursive solution like this:


&#60;jsp:include page=&#34;renderTree.jsp&#34;&#62;
    &#60;jsp:param name=&#34;nodes&#34; value=&#34;${node.children}&#34;/&#62;
&#60;/jsp:include&#62;

After a while of not getting very far with this and trying to figure out why I was getting stack overflow errors, I figured out that the jsp:param tag was [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to render a tree structure in a JSP and wanted to use a recursive solution like this:<code></code></p>
<p><code>
<pre class="brush: php">
&lt;jsp:include page=&quot;renderTree.jsp&quot;&gt;
    &lt;jsp:param name=&quot;nodes&quot; value=&quot;${node.children}&quot;/&gt;
&lt;/jsp:include&gt;
</pre>
<p></code>After a while of not getting very far with this and trying to figure out why I was getting stack overflow errors, I figured out that the jsp:param tag was not passing the state across as I&#8217;d expected in the recursive call.</p>
<p>The solution was to explicily place the parameter on the request before making the call, like so:<code></p>
<pre class="brush: php">
&lt;c:set var=&quot;nodes&quot; value=&quot;${node.children}&quot; scope=&quot;request&quot;/&gt;
&lt;jsp:include page=&quot;renderTree.jsp&quot;/&gt;
</pre>
<p></code><br />
This resulted in the correct recursive behaviour that I was expecting.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2010/11/using-recursion-to-program-in-jsp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Address in Use Error using Tomcat on Windows XP</title>
		<link>http://blog.smartkey.co.uk/2010/09/bindexception-when-starting-tomcat/</link>
		<comments>http://blog.smartkey.co.uk/2010/09/bindexception-when-starting-tomcat/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 12:21:07 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=783</guid>
		<description><![CDATA[Occasionally you might get an error like this when launching Tomcat:
java.net.BindException: Address already in use: JVM_Bind &#60;null&#62;:8080
This can be caused if you already have Tomcat running as it will hold onto a network port for handling HTTP requests. In the above example the port shown is 8080.
However, this error is sometimes apparent even when Tomcat [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally you might get an error like this when launching Tomcat:</p>
<pre>java.net.BindException: Address already in use: JVM_Bind &lt;null&gt;:8080</pre>
<p>This can be caused if you already have Tomcat running as it will hold onto a network port for handling HTTP requests. In the above example the port shown is 8080.</p>
<p>However, this error is sometimes apparent even when Tomcat has already been shut down, expecially if you&#8217;ve shut it down abruptly. The problem here is that the Tomcat process may not have completely ended and that Windows is holding onto the network port for it.</p>
<p>To resolve this do the following:</p>
<ol>
<li>find the process ID that has the port reserved,</li>
<li>kill the process, releasing the port.</li>
</ol>
<h4>Step 1 &#8211; Find the process thats holding onto the port</h4>
<p>Start a command prompt and enter the command:</p>
<pre>netstat -ano</pre>
<p>The flags for this cause (a)  all connections and ports to be listed, (n) port numbers to be shown numerically, and importantly (o) which causes the process ID to be included in the output. The results of running this should look something like this:</p>
<pre class="brush: php">
Active Connections

Proto  Local Address          Foreign Address        State           PID
TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       496
TCP    0.0.0.0:445            0.0.0.0:0              LISTENING       4
TCP    0.0.0.0:1776           0.0.0.0:0              LISTENING       1128
TCP    0.0.0.0:2864           0.0.0.0:0              LISTENING       2524
TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       1708
TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING       424
TCP    0.0.0.0:6942           0.0.0.0:0              LISTENING       2524
TCP    0.0.0.0:8008           0.0.0.0:0              LISTENING       1292
TCP    0.0.0.0:8009           0.0.0.0:0              LISTENING       2904
TCP    0.0.0.0:8012           0.0.0.0:0              LISTENING       1456
TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       2904
TCP    0.0.0.0:8443           0.0.0.0:0              LISTENING       2904
TCP    0.0.0.0:15000          0.0.0.0:0              LISTENING       1864
TCP    0.0.0.0:33115          0.0.0.0:0              LISTENING       704
TCP    0.0.0.0:63342          0.0.0.0:0              LISTENING       2524
TCP    10.136.38.94:139       0.0.0.0:0              LISTENING       4
</pre>
<p>In the output, port 8080 (under Local Address, on line 14) can be seen to belong to process ID (PID) 2904.</p>
<h4>Step 2 &#8211; Kill the process</h4>
<p>Press &lt;CTRL&gt;&lt;ALT&gt;&lt;DEL&gt; and then select Task Manager, then from the Task Manager choose the menus: View | Select Columns. In the dialog that appears check the PID checkbox to display the process ID and then dismiss it by pressing OK.</p>
<p>With the Processes tab selected you should be able to idenify the process with the PID that we found in step 1. In this example the value would be 2904.</p>
<p>Select this process and click End Process. Confirm that you want to kill the process and you should find that once it has been killed off, the network port it was holding has been released.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2010/09/bindexception-when-starting-tomcat/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

