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

May 08, 2010

 

I recently sat and passed the Sun Certified Java Programmer 1.6 exam (310-065). Throughout my life I have found exams unusually difficult so I wanted to share some tips which I found invaluable in case they are of help to others.

The exam:

Before explaining my revision tactics it might be useful to give a bit of background on the exam itself. The exam is a multiple choice test which consists of 60 questions, has a pass mark of 58% and a duration of 180 minutes. This gives approximately 3 minutes to answer each question. Questions with more than one correct answer will state how many answers should be picked, but exactly the right answers must be selected for each question to get the mark. Most of the questions involve reading a code excerpt and detailing the outcome of the execution of the code, some questions involve dragging code snippits in to the appropriate place in a code excerpt. The exam is not negatively marked.

So without further ado, here are my revision tactics:

  • Read the official book(s) - There are several books on the market which exist specifically to teach the exam subject content, reading at least one of these in detail is one of the most important things you can do. I chose the study guide by Kath Sierra and Bert Bates and found it to be excellent; the book covers all the official certification objectives in detail and also provides a useful section on how to prepare for the exam. As an added bonus the book comes with a free CD which contains the book content as a PDF plus an exam simulator containing 2 full length mock exams. Note that there are many other SCJP 1.6 books available which are definitely worth checking out before you decide which to buy as you never know which will suit you most.
  • Learn the chapters and objectives - The SCJP exam will only test you on the official objectives, the exam questions are notorious for being deliberately ambiguous about what they are testing (by including red herrings) and for often referencing at least one objective even when the answer refers only to a sigle objective. Thus knowing the objectives can give you a distinct advantage in helping to quickly identify what a question is really testing you on, it also makes it quickly to spot and eliminate red herrings allowing you to answer questions more accurately.
  • Do mock exams - Mock exams are important since they allow you to test your skills, identify strong/weak areas and determine your question answering speed. Having worried that I would run out of time in the real exam I found this really beneficial as I determined early on that I generally took about 90 seconds to answer each question. This was comforting to know and made me much more relaxed in the real exam as I knew I would have time to complete all questions and review my marked questions. There are several sites which offer free mock exams, I used www.certpal.com which contains full mock exams for both the SCJP 1.5 and 1.6 certifications. Don't be put off by the slightly basic design of the site, or by the occasionally badly worded question explanations as the quality of the questions outweighs both these things. With retrospect, having now taken the exam, I can see that the certpal questions were consistently harder than the real exam questions, so if you can consistently get a good pass mark on certpal that's a good indicator of being ready for the exam. However if you don't like certpal then JavaRanch maintain a useful list of SCJP mock tests.
  • Code! - Seems obvious doesn't it but you'd be suprised how many people apparently don't sit down and learn through coding. I found that writing small pieces of code, specifically targeted in testing an individual objective or API, to be hugely beneficial in enhancing my understanding of my weaker areas. Coding also helped me  in learning a new objective/API that I hadn't previously used much before (java.util.NavigableSet and java.util.Scanner were pretty new to me). I also found coding really useful in a couple of instances where I didn't understand the answers to certain mock exam questions, being able to code the question and then debug through the code line by line caused me to unlearn a couple of my own mis-understandings which would have otherwise tripped me up in the exam.
  • Use forums - Again when reviewing my mock exam question failures there were a few instances when, even after coding and debugging a question, I failed to understand WHY the JVM would demonstrate a certain behaviour. I found JavaRanch to be an invaluable resource here, particularly the Big Moose Saloon forums which have friendly and dedicated boards for SCJP questions and answers.
  • Make revision a regular practise - Revise regularly and often, in a consistent manner each time. I gave myself 8 weeks to revise for the exam and changed my daily routine by doing the following:
    • I stopped cycling to work and instead took the train.
    • Each morning and evening on the train I revised by reading new material or re-covering old material or by reading flashcards
    • During lunch each day I took 15-30 minutes to make detailed revision notes on what I had read that morning.
    • Each evening I varied my revision by either coding, condensing my detailed notes to concise revision flashcards or doing mock questions (not whole exams though).
    • On each of the last 3 weekends I sat a full length mock exam and went through my question failures and flash cards.
  • The above is what worked for me and what suits each person is going to be highly subjective. My point here is that you should try and find something that works for you, whatever that may be.
  • Make flash cards - Flash cards are a brilliant and very portable means of concisely documenting  information. Keep them brief, use bullet points and mnemonics where possible, carry them with you and test yourself (or get others to test you) as often as possible.

I think that's about it, ultimately the SCJP does take a small chunk of time out of your life so it's worth making sure you can dedicate that time before you commit to booking the exam. However I think it's a useful certification to have and as someone who has been developing Java for several years I am pleased that taught me some new things that I didn't know and helped me un-learn a couple of things I thought I knew! Hopefully this will serve to make me a better software engineer!

I hope this is helpful to anyone considering/ already studying for the SCJP exam - good luck!

Cheers,

EdD.



Posted at 02:10PM May 08, 2010 by EdD in Java
Comments[1]
Link to this post: Add this to delicious etc.
Trackback URL for this entry

Mar 30, 2010

 

It always seems to be when I'm preparing software releases that certain tunes flutter in to my mind; today it's Joy Orbison's remix of Love Cry by Four Tet. The original is good but there's something about this remix which I adore. So without further interruption get your lugs around this one and wang it up nice and loud:

Four Tet - Love Cry (Joy Orbison Remix)

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

Mar 12, 2010

 

Checking and double checking everything for tonight's production release. All the prep looks good so far, fingers crossed everything goes smoothly.

So while I have a minute here's today's song for the day:  Deep bass, beautiful vocals, beats to die for and in a weird time signature to boot.

Lamb - Lusty

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

Mar 11, 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 12:00AM Mar 11, 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 10: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 03:29PM 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 07: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 07: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 03:47PM 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 07: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 09: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 07: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 04: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 12:52PM 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 04:58PM Jun 07, 2009 by EdD in Biking
Comments[0]
Link to this post: Add this to delicious etc.
Trackback URL for this entry