Getting my S.H.I.T. together

Only 4 types of stuff

Share: Should be on social media a wiki or a blog somewhere.

Hold: Store until I know where it fits with my life goals – or because it is for personal reference at some point in the future (like receipts, guarantees, statements, insurance papers and the like). Have a filing system and file it regularly in a way that can be found.

In Progress: Artifacts from an ongoing project, should be filed with the project in a way that can’t get lost. Includes any goals that need broken down.

Tasks: Has a size and an action and needs attention, should be scheduled or stacked ready to work on. There may be time or other resources needed. Find a slot for it and if it isn’t now come back to it.

Anything else should be recycled reused or passed on to someone else.

 

Posted in Uncategorized

Idle thoughts on approaching life (5 S’s)

At any moment in time I should be doing one or more of 5 things that starts with S. The trick is figuring out which and doing it consistently.

Split: If a problem can’t be solved, or seems hard it is because Ii isn’t understood properly. Split it up into chunks, until there is one that looks less scary or fits the time space and energy available.

Store: Have a system simple enough to keep track of what needs to be solved, lessons learnt, and most importantly lets stuff be parked reliably at any time that it can’t be solved right now. Get the focus to where it is needed at that moment.

Solve: Always have something to hand to be working on, or thinking about. Have clear dreams and goals to refer to when stuck for what need to do next. Be willing to ‘Store’ to be able to focus on that thing.

The clearer it is and the less distraction the easier it is to find an answer. When  can’t put distractions aside it is because this is the wrong time, something else needs the focus right now – so Store,  or trying to avoid something scary because it hasn’t been split enough – so Split. Figure out which and do it.

Share: There is nothing wrong with asking for help and advise, share successes and lessons learnt, triumphs and failures. It helps understand them better and it may help someone else. Work hard at listening and understanding before trying to explain anything.

Smile: People before things and positive before grumpy. Getting frustrated with what is going on seldom helps. Enjoy the moment. Help others to smile. Find the best in other people and every situation.

Posted in Uncategorized

Happier – there is a better way to write to work with Oracle

Happier because I found a better way to call oracle stored procs through Hibernate – at least one that works with the code rather than having to work round it.

From searching around I found this link by Len (Marilen Aretius Corciovei)

http://www.len.ro/work/call-oracle-procedure-from-hibernate/

Len’s solution is to use  the dummy DUAL table in Oracle to create a single return value in the form of a reference cursor.

(As an aside because I hadn’t seen it used before so other people might not know about it either – DUAL is a handy table that exists in all Oracle DBs especially for when you need some type of pseudo column to use in a FROM statement. It gets its name because it was originally created to allow an easy way to join a table to itself to get two rows for every row on the original table as part of one of the views in the Oracle Data Dictionary.)

At the top you declare a reference cursor

CREATE OR REPLACE FUNCTION checkLastNPass
   ( params ...)
   RETURN SYS_REFCURSOR

Then further down when you are ready to set a return value – you then create the ‘cursor’  for a single value using DUAL as your table source to return the value.

    
OPEN st_cursor FOR SELECT 0 AS retVal FROM DUAL;
    RETURN st_cursor;
END;
/

And then in the hibernate file you need to tell it to expect a scalar value and tie up the column name (in this case retVal)

<sql-query name="CheckLastNPass" callable="true">
    	<return-scalar column="retVal" type="java.lang.Integer"/>
    	    { ? = call checklastnpass(:userId, ...) }
</sql-query>

Which means you can write much more Hibernate like Java  than sing the connection straight

Query query = hsession.getNamedQuery("CheckLastNPass");
query.setParameter("userId", user.getId());
...
result = (Integer)query.uniqueResult();
Posted in Uncategorized

Oracle and Hibernate = annoyances

Spent most of the day working on what should have been an easy problem. From my current Java applaication I needed to call an Oracle Stored Procedure.

After a bit of digging I found that under Hibernate things aren’t as simple as they might seem – because you can’t just call any stored procedure – it has to be one that returns a result set.

Frome the Hibernate docs:

“For Oracle the following rules apply: A function must return a result set. The first parameter of a procedure must be an OUT that returns a result set. This is done by using a SYS_REFCURSOR type in Oracle 9 or 10. In Oracle you need to define a REF CURSOR type. See Oracle literature for further information.”

Spent rather longer than I wanted to trying to shoehorn the SP into a structure that would return a result set, but in the end went back and rewrote the Java to use the underlying session via:

CallableStatement statement = session.connection().prepareCall(…);

The code to pick up the SP definition from the hibernate XML still seems clunky, in that at present I have to retrieve it as a query extract the SQL and then create a callable statement.

For the moment I’ll ignore the fact that connection is deprecated in Hibernate until they provide me something better.

Now that I know what the problem is there are some more elegant looking routes to the same point on Stack Overflow. Another item for the polishing list once I get all the core functionality working and tested.

Another further annoyance was down to my own stupiditiy – because my Stored Proc returned a value it had been written in Oracle as a Function rather than a Procedure. Much head scratching – Oracle was telling me it didn’t exist but in SQL Plus DESCRIBE was showing it as plain as day. I could call it through TOAD from my workspace but not directly or from J2EE

A salutory lesson in reading the info in front of me – Doh!

Posted in Uncategorized

Ouch – Groundhog Day again

Brings it home that it has been two years since I last posted – need to do something about that

Posted in Uncategorized

Groundhog Day

It would seem churlish to let Groundhog Day pass without writing something.

It doesn’t feel much like the first day of spring. Personally I feel sorry for any small furry creatures emerging today looking vainly for their shadow. It brings to mind the punchline of the old Flanders & Swan routine about Stonehenge:

“…then we shall know it is Summer.
Well I’d better help you brush the snow off it then”

For some reason my reflections of winter are all about the real and metaphorical snow brushing. The fundamental decency of people who’ve rallied round when things were tough. Lots of little acts of kindness given and received. A time of reestablishing contact with lots of good people.

Friends, colleagues, neighbours and relations. The sort of people willing to have chat about rubbish, lend you a car, like your random musing and help you working out the meaning of the archaic words your daughter gets given in her spelling test.

Yesterdays corker was ‘friendlihood’ which seems somehow apt.

As our friend Nick was able to inform us after consulting his full OED:

“… friendlihood dates from at least 1390 when it was spelt frendelehyde and citations go right up to 1481, when it was frendlyhode (according to the Earl of Wessex). Nothing since then.”

It seems a shame its died out of use. We could do with a word for people being friendly to others – not as exclusive as community or neghbourhood, or as intimate as frendship. Perhaps Groundhog Day is as good a day as any to clear some snow and not be scared to be friendly  – to cast a shadow that touches others.

For as another helpful and clever person once put it so well ‘gnomon is an island’.

Posted in Uncategorized

The goddess of small things

Various important reminders – mostly from groundhogmum this week that perspective matters and small does not mean unimportant.

Her day is often built of small things – and each one of those things matter.  Moving a hairbrush, forgetting to leave a door open, not putting something away, mis-matching socks,  may seem like a small thing to me, but it doesn’t take many of these for say a whole getting kids to school routine to be completely derailed.

Her day is like a tower of kids blocks. Move just one and the planned out day can come crashing ‘hey ho rumble oh’ to the ground.

This counts as a small apology – and a commitment to do better in the future at watching the small things, and helping to maintain that precarious balance.

Posted in Uncategorized

Sometimes 1% is enough

Very brief post today as time is short.

I was inspired by an article “We Will Embrace the Reality of Progress” written by Kevin Kelly the editor of Wired.

In it he quotes Rabbi Zalman Schater-Shalomi ‘There is more good than evil in the world – but not by much”.

Kevin goes on to point out that by the laws of compund interest that is enough.

Communities and cultures where everyone manages to make things better by 1% or even one tenth of 1% will have rapid positive progress.

I find that thought fantastically empowering. I no longer need to worry about how I can  make a huge and significant contribution. I don’t even need to worry that sometimes I’ll make things worse by my actions. As long as, on balance I can make things slightly better every day then I’ll be playing my part.

There is really nothing more that needs to be said.

Posted in Uncategorized

Reflection is a conversation

I like the ideas explored in “The Reflective Practitioner” that reflection is like a conversation with the situation. Here are some thoughts and notes for the future:

  • What is the problem and how have I framed it?
  • Can I solve the problem I have set?
  • Do I like what I get when I solve this problem?
  • In solving this problem in this way made the situation coherent?
  • have I made it congruent with my fundamental theories and values?
  • Have I kept my enquiry moving?

Experienced practitioners work by setting problems in a way they think they can solve.

I’ll qualify that ‘solve’. I mean setting a problem that helps them understand and change the situation. Practitioners don’t necessarily need to know if the new problem will find a final result when they start.

The key point is  the way they set it out and frame the question. Their approach sets a pattern to the enquiry. A pattern in which they have confidence they’ll get to some type of answer.

Once the shape can be seen, questioning how much I like what is emerging is a very powerful idea.  It makes me acknowledge that many answers may be possible. That there is always going to be a judgement call based on my theories and values.

Previously I’d seen unintentional consequences as a failure. Its really  powerful to see them as a way of listening to the situation. A new starting point.  A way to evaluate some assumptions. Even a way to stay curious about the investigation.

Each  try I learn more. In working through to a workable answer I learn more about what my own values are. I gain a better understanding of what matters to me, and to others I’m working with along the way.

Checking at the end if I kept enquiry moving is such a good idea.  I want to be able to give back something that can be used as a new starting point. If I can’t do that it may be a sign that the answer is too fragile  or just hasn’t been explored enough.

Posted in Uncategorized

Running shoes

I didn’t get round to empathy yesterday.  A lot of empathy feels intuitively right. The part I find tough is the listening. When I pause shut up and really listen life is far easier.

It is very easy for me to hear every conversation as either a request for action or a criticisim or both. My mind races and I am into full scale flight fight or solution mode before the sentence is finished.

Groundhogmum complains that if she mentioned there was a paint in B&Q she liked I’d be at the store before she had chance to tell me the colour.

If empathy is about trying on someone else’s shoes.  I should at lest wait to get them on my feet. To feel where they pinch before I start trying to run. If I don’t do this the results can be painful and embarrassing.

Posted in Uncategorized