englishteeth.co.uk

… the weblog of Ian “English Teeth” Robinson
  • rss
  • Home

XSL “Is Numeric” too

February 27, 2008 | 12:14 pm

Building on a previous post Oracle “Is Numeric” a similar thing is possible using XSLT (or more accurately, XPATH) too…

<xsl:if test="string-length(translate(node(),' +-.1234567890', ' ')) > 0">
  <xsl:text&gt;not numeric&lt;/xsl:text>
</xsl:if>

Not exactly ground breaking stuff, but something similar did turn out useful for extracting the non numerical area component of a post code (i.e. the SO bit of SO53 3RY).

substring-before(translate($postcode,'1234567890', '----------'),'-')

Which I thought was close enough to the oracle is numeric implementation to make comment.

Comments
No Comments »
Categories
development, software
Tags
xml, xpath, xslt
Comments rss Comments rss
Trackback Trackback

Setting up eclipse

February 25, 2008 | 2:55 pm

The default amount of memory Eclipse runs with is small and “Out Of Memory” errors are common. It is advisable to specify values on the command line by creating a new shortcut to the eclipse executable. These values can also be specified within the eclipse.ini file, but I have found changes here tend to be ignored (this may be an eclipse version issue that may have been fixed, but worth being aware of, just in case).

-vmargs -Xms512M -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=256M

The -Xms and -Xmx options specify the minimum and maximum heap size. The “Heap” being where all your objects live.

The -XX:PermSize and -XX:MaxPermSize options specify the minimum and maximum “Permanent Generation” memory and this is where objects which are not going to be garbage collected reside.

A shortcut to the eclipse executable is also useful for specifying other things, such as the workspace to use. Handy if you need to use multiple workspaces (e.g. HEAD and BRANCH scenarios).

Comments
No Comments »
Categories
development, software
Tags
eclipse, java
Comments rss Comments rss
Trackback Trackback

Development Environment

February 21, 2008 | 12:53 pm

A new job and it’s time to set up a development environment again. Unusually, this time there is little definition as to what that environment should consist of.

Being a Java development role that includes some support of existing applications, it’s not exactly a clean sheet; Java, Spring, Struts, Hibernate, JBoss, Oracle ect. all the usual suspects are present… looks like another job for eclipse et al.

And since it’s eclipse and there’s no point in duplicating the information, here is a useful link to 10 Eclipse Navigation Shortcuts Every Java Programmer Should Know.

Eclipse Plugins
jadclipse for class decompilation
findbugs

Tools
XML Marker

Firefox Plugins
Firebug
XPather
IE Tab

Comments
No Comments »
Categories
development, software
Tags
java, tools, web, xml
Comments rss Comments rss
Trackback Trackback

Oracle “Is Numeric”

February 20, 2008 | 1:09 pm

Currently Oracle (10g and earlier) does not provide a function to test if a value is numeric. However, it is relatively simple to implement.

The following clause will return the number of non numeric characters found in a string:

LENGTH(TRANSLATE(TRIM(string1), ' +-.0123456789', ' '))

A non zero result means the string is not numeric.

SELECT string_column AS Numbers
FROM table_of_strings
WHERE
LENGTH(TRANSLATE(TRIM(string_column), ' +-.0123456789', ' ')) = 0

Depending on environmental constraints, it may be preferrable to implement a function:

create or replace function getNumberFromString(inputString in varchar2)
  return number
is
  numberValue number;
begin
  numberValue := to_number(inputString);
  return numberValue ;
exception
  when VALUE_ERROR then return null;
end;

This could have been implemented as an “isNumeric” function returning a boolean result. However, this currently would not be supported in SQL that could otherwise benefit.

SELECT string_column AS Numbers
FROM table_of_strings
WHERE getNumberFromString(string_column) IS NOT NULL
Comments
No Comments »
Categories
development, software
Tags
oracle, pl/sql, sql
Comments rss Comments rss
Trackback Trackback

Author

Ian Robinson is a relatively agile software engineer interested in things both sides of the object relational divide and beyond.

Categories

  • development (35)
  • miscellaneous (20)
  • music (7)
  • software (13)

Blogroll

  • Dan North
  • Dave Astels
  • Dave Wood
  • eirikso.com
  • Matt Raible
  • Object Mentor Blog
  • The Ancient Art of Programming
  • The Wisdom of Ganesh

Tags

active-mq architecture bauhaus blu-ray css db eclipse esb festivals freesat gorm grails groovy hd hd-dvd hibernate java jboss jms junit links mce media center mini music oracle osgi patterns pirsig plugins satellite soa software spring sql struts2 testing themes tools tv web wordpress xml xpath xslt
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox