All posts by Alistair Lattimore

About Alistair Lattimore

My name is Alistair Lattimore, I'm in my very early 30's and live on the sunny Gold Coast in Australia. I married my high school sweet heart & we've been together for longer than I can remember. Claire and I started our family in September 2008 when Hugo was born and added a gorgeous little girl named Evie in May 2010. You can find me online in the typical hangouts, Google+, Twitter & facebook. .

Shopping Trolley Etiquette

It would seem that the greater population needs a refresher course in the fine art of shopping trolley etiquette. When you’re at the supermarket and pushing a trolley around, from now on please consider yourself like a 4WD on the road. Just like driving a 4WD, you need to be aware of your surrounding space and show a little consideration to other drivers.
Following is a short list of things to consider when you’re next pushing around a shopping trolley.

  • Walk with the flow of other shoppers. You wouldn’t drive into oncoming traffic in your car – so don’t do it in the supermarket.
  • If you need to stop for something in an aisle, take notice of where your trolley is. Most supermarket aisles aren’t very wide, so when you leave your trolley on a 45° angle – it is a hassle for other shoppers to get past.
  • Don’t take your trolley into an area where you can see it is congested. Contrary to popular belief, you are allowed to separate yourself from your trolley. No one is going to steal a trolley full of food which you haven’t paid for yet, in a supermarket full of that same food.
  • Don’t let your child steer the shopping trolley, I know you think it is cute but my heels don’t.
  • When exiting an aisle, you really need to give way to the other shoppers on that aisle already.

While we’re in the shopping environment, you might as well take notice of these other gems:

  • Organise yourself, make a list of things you need before you get to the supermarket. Honest, it’ll save you time and save everyone else thinking you’re an unorganised twat.
  • Where appropriate, take a number and patiently wait to be served.
  • I know it surprises you, but you’re fully loaded shopping trolley doesn’t fulfill the requirements of ‘express‘.

You are now equipped to piss off your fellow shoppers less.

Candid Kitty

Ragdoll Kitten: Playing In Clothes BasketSince you’ve all been introduced to Princess, I thought it time to post a few more pictures we’ve managed to snap of her over the last fortnight. No surprise, Princess loves to play – often at inopportune times. One of her favourties toys has been a little blue mouse made of rope, she can really dig her claws into it!

This evening whilst researching on the internet, Princess jumped onto the table like normal. This time, it was different; this time she saw the mouse cursor on the screen and thought it was the best thing since sliced bread. As I moved the mouse, she followed it intently over the screens. When I started to wiggle it a little in front of her, she started trying to touch and bite the screen – so cute!

As it turns out, our Princess isn’t very lady like – she flops and sprawls over everything and anything, makes for great little cuddles though. She is also an intrepid explorer, if there is anything in the house she can climb under, over, through or into – she had already been there.

Oracle RETURNING Clause

The Oracle RETURNING clause was implemented as part of the Oracle 10g release and is used to return information about the effected rows after issuing Data Manipulation Language (DML) statements. Prior to Oracle 10g, you would have needed to work around not having this feature, most likely by issuing additional statements to the database.

The RETURNING clause has a few restrictions:

  • it is only available for use on tables, materialised views, normal views based on a single table or an expression based on the previous three items
  • it is only valid on a single-set aggregate. A single set aggregate is DML which only effects a single row or using an aggregate function in the RETURNING statement (such as SUM).

The general syntax for the RETURNING clause is:

INSERT INTO <table> (c1, c2, .., cn) VALUES (v1, v2, .., vn) RETURNING <expression> INTO <variables>
UPDATE <table> SET (c1) = (v1), (c2) = (v2), (cn) = (vn) WHERE <condition> RETURNING <expression> INTO <variables>
DELETE FROM <table> WHERE <condition> RETURNING <expression> INTO <variables>

This feature is particularly useful when INSERTing into a table, where the Primary Key is sourced from a sequence and fetched via a TRIGGER. In the below example, the ID of the newly inserted row is assigned to pContactID using the RETURNING clause. This is an elegant solution as it means you don’t have to SELECT the NEXTVAL from the sequence and assign that value to the ContactID during INSERT simply so you can return the new primary key value.

PROCEDURE Ins
(pContactID     OUT Contacts.ContactID%TYPE,
 pFirstname     IN Contacts.Firstname%TYPE,
 pSurname       IN Contacts.Surname%TYPE)
IS
BEGIN
 INSERT INTO Contacts
 (fname, sname)
 VALUES
 (pFirstname, pSurname)
 RETURNING ContactID INTO pContactID;
END;

You could just as easily use it to return the information about a row deleted, such as:

PROCEDURE Del
(pContactID     IN Contacts.ContactID%TYPE,,
 pFirstname     OUT Contacts.Firstname%TYPE,
 pSurname       OUT Contacts.Surname%TYPE)
IS
BEGIN
 DELETE FROM Contacts
 WHERE ContactID = pContactID
 RETURNING fname, sname INTO pFirstname, pSurname;
END;

Since the RETURNING clause is for use with aggregates, an example illustrating its use is in order. The below example modifies pContactID salary by pPercentageChange and subsequently returns the updated total company salary expenditure.

PROCEDURE UpdateSalary
(pContactID        IN Contacts.ContactID%TYPE,
 pPercentageChange IN NUMBER,
 pGrossSalary      OUT NUMBER)
IS
BEGIN
 UPDATE Contacts
 SET salary = salary * pPercentageChange
 WHERE ContactID = pContactID
 RETURNING SUM(salary) INTO pGrossSalary;
END;

The Oracle RETURNING clause provides the PL/SQL developer with a lot of flexibility. The real benefits however, come from the simplified PL/SQL and clarity gained in the code. If you’ve got a lot of application code or PL/SQL which isn’t utilising the power available to you – it might be time to undertake a clean up in your project.

Poo Fairies

Today while joking around with my work colleagues, I mentioned what I thought was a well known phenomenon known as the poo fairies. I was taken aback when they burst out in laughter and asked me what it was all about.

A formal definition for the uninitiated:

Poo fairy (n):
The little fairy that enters your room at night, while you are sleeping and takes a shit in your mouth. This then causes you to wake up with what is commonly referred to as poo breath.

Usage:
“Gee, I think the poo fairies visited me last night.”
“My breath smells like poo fairies have had a party in my mouth.”

Now that you have the official definition, it is your mission to spread to good word of the poo fairies as far and wide as possible!