Edd Grant (EdD) :: Code, Compose, Bike, Brew etc ... though not necessarily in that order
 

Mar 10, 2010

 

Today's song for the day, and a rather calming video to accompany it:

The Cinematic Orchestra - All Things to All Men (Feat. Roots Manuva)

Posted at 07:00PM Mar 10, 2010 by EdD in Music
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jan 20, 2010

 

I meant to post this ages ago but forgot until I came across the issue again today.

When developing a system which runs against an Oracle Database, Oracle XE can be very useful. XE is a cut down version of Oracle's standard edition Database and is available completely free for development purposes. It is built from the same code base as the standard edition Database, albeit with a very restricted configuration to stop people deploying it in production in lieu of a paid for version.

One of the restrictions in XE is that the number of concurrent sessions and processes that the Database will allow is set to a very low figure, again presumably to deter from production use. This can result in issues during development, whereby seemingly innocuous tasks such as running automated test suites will cause the database to hit the default limits and fail.

The errors that are raised when these limits are reached are often apparently unrelated to the task being performed. Once learned however these errors are easy to spot, this is one reason why it's useful to know about this default limitation of XE. Below are some of the errors which can manifest from Oracle running out of sessions/ processes:

  • ORA-00018: maximum number of sessions exceeded
  • ORA-00020: maximum number of processes (%s)
  • TNS Name Not Found - yep this really can be raised when the Database runs out of  sessions or processes!
Thankfully the solution to this problem is simple: Increase the number of sessions and processes that the Database instance allows. Here's how you do it:

 1: Log on to the Database with a sysdba account.

sqlplus system@XE as sysdba

2: Check the current session and processes limits

SQL> show parameter session

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size           integer     0
java_soft_sessionspace_limit         integer     0
license_max_sessions                 integer     0
license_sessions_warning             integer     0
logmnr_max_persistent_sessions       integer     1
session_cached_cursors               integer     20
session_max_open_files               integer     10
sessions                             integer     20
shared_server_sessions               integer

SQL> show parameter processes

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
job_queue_processes                  integer     4
log_archive_max_processes            integer     2
processes                            integer     20

3: Increase the session and processes limits to something sensible, the important thing here is to choose values which solve your particular issue. I tend to find that anything around 250 is fine for most development projects, but remember that the higher the values the more resources Oracle will try and consume when it needs to maintain those extra sessions and processes.

SQL> alter system set sessions=300 scope=spfile;

System altered.

SQL> alter system set processes=300 scope=spfile;

System altered.

4: Shutdown the Database instance.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

5: Restart the Database instance.

I don't know why but issuing the 'startup' command doesn't work for me when using XE. I think this may have something to do with the Oracle Listener not being able to identify the instance once it has stopped but I haven't yet figured it out. Instead I have to restart the Oracle service/ daemon using the following command:

C:\>net start OracleServiceXE
The OracleServiceXE service is starting.....
The OracleServiceXE service was started successfully.

Note: The above is obviously a windows example, I believe that there is usually an /etc/init.d script which has the same effect under a Linux installation.

6: Close the SQLPLUS session and open a new one (otherwise you will receive an error when entering commands as the session cannot persist across the Database restart).

SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

C:\development\stsworkspace\compliance>sqlplus system@XE as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 20 17:13:49 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL>

7: Check that the new values have been persisted across the restart and are now in effect. 

SQL> show parameter session

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
java_max_sessionspace_size           integer     0
java_soft_sessionspace_limit         integer     0
license_max_sessions                 integer     0
license_sessions_warning             integer     0
logmnr_max_persistent_sessions       integer     1
session_cached_cursors               integer     20
session_max_open_files               integer     10
sessions                             integer     335
shared_server_sessions               integer
SQL> show parameter processes

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0
db_writer_processes                  integer     1
gcs_server_processes                 integer     0
job_queue_processes                  integer     4
log_archive_max_processes            integer     2
processes                            integer     300

Note: I'm not yet sure why but my 'sessions' value always seems to be higher than the value I set. Regardless the value should be different from the initial value and close to the one you set (in my case it is usually above by a value of 15 or 35!)

et voila! That should do it.

Hope that helps someone,

EdD

Posted at 05:33PM Jan 20, 2010 by EdD in Databases
Comments[3]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jan 06, 2010

 

Today is a sad day for Tash and I as one of our Chickens, Ethel, died in the night.

In September 2009 we re-homed Ethel, along with 2 other Chickens, Mabel and Maud through the Battery Hen Welfare Trust. Ethel was the smallest of the 3 Chooks, despite her small size she was an absolute expert of the 'run around the garden very quickly so they can't put me back in the coop' game.

Although she was only with us for a short while we hope that she enjoyed a better quality of life than she would have otherwise done as a battery hen.

RIP Ethel, we will miss you.

Edd and Tash

A picture of Ethel eating some food in the snow while her coop was being cleaned out
Posted at 10:29AM Jan 06, 2010 by EdD in General
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Nov 20, 2009

 

I recently inherited an application which has a few issues with referential integrity, unfortunately the existing constraints were not named when they were created so I see lots of this:

ORA-02291: integrity constraint (CCRS_OWNR2.SYS_C00293422) violated - parent key not found

At this point I usually end up yelling something along the lines of ' What the badgering folly is SYS_C00293422?!?! Why didn't you name your constraints you massive uberbastards!!!' at the closest unsuspecting random in the office - I fear this practice is making me unpopular.

So to lessen the damage to my office popularity I set about figuring out how to trace the table from which a constraint originates, based on the constraint name. Turns out it's pretty easy as Oracle (I'm using 10g) provides a table (or maybe a view?)  called 'all_constraints' which describes constraint definitions on tables accessible to the current user.

describe all_constraints;
Name                           Null     Type
------------------------------ -------- ------------
OWNER                          NOT NULL VARCHAR2(30)
CONSTRAINT_NAME                NOT NULL VARCHAR2(30)
CONSTRAINT_TYPE                         VARCHAR2(1)
TABLE_NAME                     NOT NULL VARCHAR2(30)
SEARCH_CONDITION                        LONG()
R_OWNER                                 VARCHAR2(30)
R_CONSTRAINT_NAME                       VARCHAR2(30)
DELETE_RULE                             VARCHAR2(9)
STATUS                                  VARCHAR2(8)
DEFERRABLE                              VARCHAR2(14)
DEFERRED                                VARCHAR2(9)
VALIDATED                               VARCHAR2(13)
GENERATED                               VARCHAR2(14)
BAD                                     VARCHAR2(3)
RELY                                    VARCHAR2(4)
LAST_CHANGE                             DATE
INDEX_OWNER                             VARCHAR2(30)
INDEX_NAME                              VARCHAR2(30)
INVALID                                 VARCHAR2(7)
VIEW_RELATED                            VARCHAR2(14)

20 rows selected

We can use this table to identify various properties of a given constraing, based on the constraint name, like in the following example:

select * from all_constraints where owner = '&&schemaName' and constraint_name = '&&constraintName';

One great thing about this method is that it does not require sysdba privileges, this is a major benefit for developers working on locked down schemas as it allows for cracking straight on rather than having to borrow the time of a neighbouring DBA.

This approach is useful in identifying constraint origins however it is frustrating to have to do in the first place, instead I would advocate coming up with a simple naming convention as demonstrated here and using that throughout the Database, this is something that will save the development team time and energy, particularly when your Database grows to tens or hundreds of tables each with several constraints.

Cheers,

EdD



Posted at 02:21PM Nov 20, 2009 by EdD in Databases
Comments[2]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Nov 18, 2009

 

It may be the case that I'm not looking hard enough but I can't find this anywhere in the documentation:

To achieve a cascade type of 'none' using Hibernate annotations you'll need to do the following:

@OneToMany(cascade = {})

Exactly why they couldn't have provided CascadeType.NONE enum I don't know.

EdD

Posted at 02:34PM Nov 18, 2009 by EdD in Java
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Nov 05, 2009

 

Just a quick post to say that the London Java Community (LJC) now has its own website. Barry Cranford has set the site up to publicise the group, which is rapidly growing in size, and its activities and events. Barry has done a great job with the community so far and continues to provide great events for Java technologists.

If you're interested in the LJC's activities or want to get involved you can find the site at http://www.londonjavacommunity.co.uk.

Cheers,

EdD

Posted at 10:47AM Nov 05, 2009 by EdD in Java
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Oct 05, 2009

 
Having recently started using Eclipse an initial gripe of mine was that there didn't seem to be any way to tell the IDE how to identify different types of files, specifically there appeared to be no mechanism of identifying and excluding 'non-source' files such as derived or distributable files. This causes several annoyances one of which appears in the 'Open Resource' search function (CTRL + SHIFT + R); when executed this function searches the entire Workspace for files matching a given pattern, this causes any files which are duplicated during distribution to appear multiple times in search results, once in the source folder and once in the duplicated location.

This is annoying since it then becomes possible for a tired or hurried developer to accidentally select and subsequently modify the wrong (i.e. distributable) file, upon rebuilding of the project distributable this can lead to lost changes since this file will most likely be overwritten.

If, like me, you've been through the annoyance of editing your distributable files and then losing the changes you may be pleased to know that there's a simple solution to this which is as follows:
  • In the 'Project Explorer' view select a folder that you wish to exclude from search results.
  • Right click the folder and select 'properties'.
  • Select the 'Derived' checkbox.
  • Click 'OK'.
The contents of the indicated folder will no longer be included in subsequent 'Open Resource' searches.

Cheers,

EdD
Posted at 03:44PM Oct 05, 2009 by EdD in Java
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jul 24, 2009

 

Last night I attended the 'Android for Java Developers' event which was put on by the London Java Community. Reto Meier, an Android advocate from Google took us through the basics of the platform and covered topics including IDE support, some of the libraries available, how applications are assembled and signed and also provided some information on the Dalvik virtual machine.

A couple of Android devices were passed around for us to play with during the talk, having never used Android before I had somehow arrived at the conclusion that the OS was a bit clunky compared to the iPhone/ Palm Pre, this illusion was quickly dispatched when I got to play with the devices and I was in-fact impressed at how responsive and feature laden both devices were. (Note to self I will definitely be getting an Android phone as soon as the contract on my horriffic self rebooting N95 runs out!)

The event was really interesting, as a developer it was pitched at just the right level giving an insight in to both technical and commercial aspects of the platform and also providing useful feature comparisons with other platforms. I was also pleased to hear about the inclusion of proper threading support: Android/ Dalvik has a multi-threading model analogous on a basic level to standard Java whereas the iPhone OS is inherently single threaded. I see this as a serious plus point for Android since phone apps are already getting more complex and often need to be able to run as background services without locking the rest of the phone up.

So there you have it, many thanks to the LJC for putting on the event, Google for hosting us and to Reto and his colleague (whose name I have forgotten - sorry!) for an entertaining and enlightening talk! I'm now off to write a best selling Android app, make my millions and retire early!

EdD


Posted at 05:37AM Jul 24, 2009 by EdD in Java
Comments[2]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jul 13, 2009

 

It's time for a tidy up - I have decided to stop using the mredd.co.uk domain, which was bought for me as a birthday present many years ago. Instead I'm going to move everything over to eddgrant.com, so this blog will be moving from http://blog.mredd.co.uk to http://www.eddgrant.com/blog.

I've added the necessary apache gubbins so that the transition should be pretty much invisible to web users however anyone who subscribes to the Atom or RSS feeds will need to update their subscription URLs at some point. The new subscription URLs are:

Atom: http://www.eddgrant.com/blog/EdD/feed/entries/atom

RSS: http://www.eddgrant.com/blog/EdD/feed/entries/rss

I will leave the redirects up until the mredd.co.uk domain elapses. Any problems please shout.

Cheers,

EdD


 

Posted at 03:08PM Jul 13, 2009 by EdD in General
Comments[2]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jun 21, 2009

 

The ECMT manager which forms part of the S60 MIDP SDK doesn't work out of the box with Java 1.6 (6.0). In this situation the error 'Cannot start ECMT Manager' is displayed when attempting to open the manager.

To fix this do the following:

  •  Navigate to <S60 MIDP SDK Install Path>\bin\epoc32\tools\ecmt\config
  • Backup (via copy) config.properties to config.properties.original
  • Open config.properties in a text editor
  • Locate the property epdt.java.version.start and append the String ',1.6,6.0' (excluding the quotes) to it's value
    e.g. epdt.java.version.start=1.4.1,1.4.2,1.5,5.0,1.6,6.0
  • Save the file.

Now try and open the ECMT manager again, if the fix has worked then the manager should open without any errors occuring.

Hope that helps,

EdD

Posted at 12:56PM Jun 21, 2009 by EdD in Java
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jun 09, 2009

 

Since my Mp3 player was thieved by some scummer I listen to more and more music on We7, one of the things I've always missed on We7 is the ability to automatically scrobble the tunes I listen to. Well that is no longer a problem thanks to a splendid little GreaseMonkey script called 'We7 Scrobbler'.

The script is very simple and uses https to transmit your username and password to minimise any security worries. Simply install, restart your browser and start playing tracks on We7, the script will ask for your last.fm credentials the first time it is invoked and will then scrobble everything you listen to. Scrobbling can even be switched off if you don't everyone to know that you've been listening to Shitney Spears again!

Check it out: We7 Scrobbler can be downloaded here.

EdD

Posted at 08:52AM Jun 09, 2009 by EdD in GeneralTechnology
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jun 07, 2009

 

Despite the rather brash thunderstorm which rocked up in the small hours of last night the SE raggers met up for a quick ride and build session this morning. Den, Rod and Srdj made an amusing vid of the track for the CGCC guys and I spent most of the morning building more ladders with Ed, who was on building duty due to having some freshly damaged ribs from the list riding session.

The main ladder area is looking pretty nice now, the leftmost ladder seems to be the one which catches most people out as it is not always on-camber and becomes a little lively when wet. The central ladder section is flowing nicely though, my favourite bit being the little kick at the end of the bottom which sends you off nicely on to the bottom section.

Today we worked mostly on a couple of new ladders which, when complete, will form a path along the rightmost edge of the tree-trunk. I think these are going to be nice when finished but will require good skills since there's a vertical drop of a good few feet if you come off the right hand side. I took a couple of pictures with my phone for posterity in case the whole thing gets wrecked by the local woodland dwelling 'community' like some of the other stuff we've built.

1: Upwards view of the main ladder section:

A view of the main ladder area from below. 

2: Downwards of the same section:

Middle of the ladder section. 

3: Downwards view from the top ladder:

View from the top of the ladders section 

Oh, and I managed to make the ultimate trail building mistake of mistaking my Thumb for a nail

An excellent example of why you should never mistake your thumb for a nail!

So a good morning's work I think, although there's lots more to do to make sure the track is up to scratch before the upcoming CGCC visit!

EdD


Posted at 12:58PM Jun 07, 2009 by EdD in Biking
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Jun 05, 2009

 

Hello all,

The lovely Straylings have been put forward to play the Green Man Festival, the organisers of the festival are holding a competition where by the band who gets the most votes gets to open the festival.

This would be a great opportunity for dem Straylings so they need as many votes as we can muster. If you can spare just 1 minute to register (only 4 boxes!) at the link below they would really appreciate it (the answer you'll need is Jarvis Cocker!).

http://www.thegreenmanfestival.co.uk/greenpoll/user/register?r=1

After you're done just search for Straylings and click on the vote button (votes can be made every day by the way!).

Cheers people!

EdD

Posted at 04:59PM Jun 05, 2009 by EdD in Music
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

May 31, 2009

 

I honestly don't know what to say other than thankyou to Cassetteboy for this brilliant video edit which sums up the utter fail cock that is 'the apprentice'. It is clear that there was a lot more talent coming from the making of this video than can be found in the abysmal contestants who all seem to think that doing well in business requires the ceremonial fucking over of ones colleagues.

EdD

Posted at 02:05PM May 31, 2009 by EdD in General
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry
 

Heard this for the first time today on the Radio whilst driving back from St Pancras, I'm absolutely captivated by it. The track gently pulses away building and again dimishing as it goes, the production is top notch too and gives the tune a subdued but purposeful feeling. Stick the smooth and slightly chilling vocal in to the mix and the result is an absolute beauty.

I just wish I knew what the synth they used was, it sounds incredible and clearly has a great filter in it.

Top video too:

EdD

Posted at 10:46AM May 31, 2009 by EdD in Music
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry