Author: francis

The story so far

Birthdays

I was 44 yesterday. Crap. Not that good a birthday either, as these things go. Bought myself a personal CD player with a car kit so I can listen to my CD collection in the car. Really miss the multichanger in the old car. Ho fkn hum. Spent the day working and driving and trying to sleep. I’m convinced Burger King put caffeine in their Fanta. It’s the only explanation I can find for not being able to sleep. Couldn’t get meditating together today either.

Got a call from an old friend yesterday whom I haven’t seen for at least 12 years. She’s coming to the UK on the 25th so hopefully we can link up.

Catching up

I’m working for a utility company based in Nottingham which is about 100 miles from home. I’ve got a six month contract here and the work is really interesting. The people are good as well. The downside is being away from home 5 nights a week. I’d trade the excellent contract rate for being able to see Rosie and the kids like a shot. I have a blog entry on my laptop but no way of putting it here just yet.

Holme Pierpoint

For those who don’t know this is the National White Water centre and it’s based in Nottingham. I had a paddle there on Tuesday and copped a bad swim. Backrest loose and being cocky. It’s funny how nature humbles you back to the insignificant nothing you really are.

The mind

Was watching the BBC programme about the mind yesterday. Very interesting, all these things starting scientists have discovered that … you can change your personality, you can choose your behaviour, you can learn to be gentle, things are fixed in your childhood but can be altered. Buddhists have known this stuff for two and a half thousand years, without the benefits of MRI scans. Even the bit about the mind being like an orchestra.

Anyway, blessings all, even the dyed geeks.

1st october

So what’s been happening for these last few weeks?

First off, I found a contract job in Nottingham working for a utility company, this is 2 hours from where I live. So I’m back on the road, staying in hotels and not getting enough exercise.

It’s quite odd; I went for a walk today and it all looked very unreal. I’m staying on the edge of town in the Travelodge and there’re all of these buildings lit up from below; proxy country houses built in 1997. It’s like a movie set, underneath, behind it there’s nothing substantial. I wonder if my studying and meditiation practice are having an effect, allowing me to see that there’s nothing there really. It’s not a bad feeling at all, I’m almost getting a sense of completion.

Nottingham has the national white water centre, they’re open until 9 during the week so I’m thinking that I will probably spend a lot of time there.

I went to buy a laptop from my friends at savastore using Rosie’s credit card (it’s new and got a long interest free period). Cocked up the delivery address and couldn’t change it on the web so cancelled. It took 24 hrs to cancel and the card has almost run out of cash so I can’t order again until tomorrow when the credit goes back onto the card.

Unlike the days when I was contracting before there are now umbrella companies that allow you to reclaim your expenses and mitigate (but not avoid) some of the effects of the nasty IR35. I am using a company called prosperity4. The only downside is that I won’t get paid until November and my expenses are pretty extreme, like about £400 a week. Think I’ll have to have a word with my bank manager.

The work at here is very interestng but obviously for reasons of confidentiality I can’t discuss it here. Aggressive deadlines and a large IT infrastructure, oh, how I have missed them in the backwater I was travelling in. My one worry is that I sometimes go a bit passive under pressure and just do what’s fun, so I’m going to have to watch myself.

I met one of my old Oracle colleagues here, Michel, whom I knew from the Halifax project.

I’m having fun and will be able to pay my bills so fuck it, just have to get on with life and make sure it’s worth living. I just wish I could get home at night but that will have to wait until the market picks up.

Teensy bugettes

I discovered that the doReplace function in my utilities library had a small bug, where if the to string contained the from string it would loop forever. I also put in a guard variable to stop it doing more than a certain number of replacements, not sure about this when you’re not debugging. Definitely thinking moving to 1.4 and using the replace functions provided might have helped, but on the other hand this works with most current VMs. The changed version of the function is below, the whole utilities package (which has been debugged some more) is here:

  /**
   * Does replace in source string of all occurrences of <i>from</i> with <i>to</i>,
   * Used by the {@link #replaceStrings replaceStrings} function to do the work
   * @param source string to do substitution on
   * @param from string to replace
   * @param to string to insert
   * @param replaceAll replace all occurrences
   * @return source string with all or one occurences of from replaced with to
   */
  public static String doReplace
    ( final String source
    , final String from
    , final String to
    , final boolean replaceAll
    )
  {
    String retString = source ;
    int start = -1 ;
    final int MAX_REPLACES = 50 ;
    int iteration = 0 ;
    int offset = 0;
    while ( ( start = retString.indexOf(from, start + offset) )  != -1 )
    {
      retString = retString.substring(0,start) + to + retString.substring(start+from.length()) ;
      System.out.println(retString);
      iteration ++ ;
      offset = to.length() ;
      if ( (! replaceAll ) || iteration > MAX_REPLACES) break ;
    }
    return retString ;
  }

Progress

Using the utilities package given below I’ve now managed to generate all of the implementation beans for my data model. I created a template that creates the guts of the code and then iterates through the columns using a different template to put in the getter/setter methods. The next job is to set up the many:many relationships and my own tagging system (that allows you to tag rows with extra data). Once this is done the rest should be easy, just change the template and the output target and leave the rest of the code alone.

Bean Managed vs Container Managed Persistence

I’m beginning to think I made a mistake here, going for BMP, because I can’t see how you can have a transaction across more than one bean method call with BMP. The only way I can conceive it is that you get some kind of transaction ID, which reserves you a database connection, and then pass that through to the beans. Then you’ll have to set up a getConnection() method that you pass the transaction ID to so you have the same one throughout. This would allow you to rollback the whole transaction if you had to. How then do you manage fail over between machines? I need to do some more reading I think. My system is low volume so it should be OK. I think I’ll need to implement some kind of optimistic locking strategy (cue Bee Gees Stradegy, when things go wrong and you can’t go on, Stradegy – sorry, that always happens to me whenever someone says that word, I think it’s all the years working for big corp IT, raddles the brain).

BT Voyager modem

Yes it’s still for sale. Someone left a message here but no email address. Contact me direct on francis (d0t) fish (aT) macmail (d0t)com if you want to buy it.

Regards all.

Writing code properly – good programmers are lazy

Currently generating out my ejb-jar.xml file and I’ve got code that looks like this:

    currentTable = initCap (att.getValue(“name”));
    os.println(“tt<entity>”);
    os.println(“ttt<descriptio>Entity Bean ( BMP )</descriptio>”);
    os.println(“ttt<display-name>” + currentTable + “</display-name>”);
    os.println(“ttt<ejb-name>” + currentTable + “</ejb-name>”);
    os.println(“ttt<home>com.pharmarketeer.ejb.entity.” + currentTable + “Home</home>”);
    os.println(“ttt<remote>com.pharmarketeer.ejb.entity.” + currentTable + “</remote>”);
    os.println(“ttt<local-home>com.pharmarketeer.ejb.entity.” + currentTable + “LocalHome</local-home>”);
    os.println(“ttt<local>com.pharmarketeer.ejb.entity.” + currentTable + “Local</local>”);
    os.println(“ttt<ejb-class>com.pharmarketeer.ejb.entity.impl.” + currentTable + “Bea</ejb-class>”);
    os.println(“ttt<persistence-type>Bea</persistence-type>”);
    os.println(“ttt<prim-key-class>” + currentTable + “PK</prim-key-class>”);
    os.println(“ttt<reentrant>False</reentrant>”);
    os.println(“tt</entity>”);

Ugly, isn’t it? It’s the naive way of doing it. I’m going to write a little utility that allows me to specify a template and then put tags in it (a la Bentley’s little languages bit in Programming Pearls). What I’d really like is a Java Stream search and replace like PHP has, where I could use regular expressions and useful stuff like that, as far as I can make out the Java RegExp stuff just gives you some kind of true/false reading. Will post it here when I’m done, use or abuse but no warranty!

Hogs and Quiches compadres.

The Bardo, Pain and Renunciation

The Bardo

Well, the Bardo is just a place or state where things change. A lot of westerners mistakenly think that it only relates to death, because of the Tibetan Book of the Dead (Bardo Thodol). In fact we are always in a state of change throughout or lives and death is just another one. I’ve been thinking about this a lot because my irritable bowel thing flared up again in the night and I don’t feel like I’ve had much sleep. Pain is interesting, we feel it as a warning, but it can also be transformative. The IBS flared up because I am upset, no job, no interviews on the horizon. I also realised that at least partly it came because I was feeling for the people where I used to work because they are really up against it and I am helpless to help them.

Pain

I have discovered that I can meditate away pain at least some of the time. First you acknowledges that the pain reminds you of how others suffer, then you try to draw their pain into your own as well to reduce their suffering, then take the medicine – no point in being a fool about it! I wrote a poem about this (see The Macro and the Micro), where I tried to show that we can only feel compassion by relating what happens to others to what happens in our own little world. If you don’t have insight into how your own struggles make you the same as everybody else you can’t rise above it and help others the way they need to be helped.

Renunciation

I’ve just been reading The Marvellous Companion, which is a series of stories about the Buddha’s lives before he became the Buddha. You can treat them as metaphor or the literal truth, it doesn’t matter. One of the themes is giving to others, as in everything, including your own body if that’s all you have to give. Finding others’ suffering so unbearable that you will do anything to ameliorate it, giving everything you have even if you starve. I aspire to this, but am bound by the ties that bind and cannot abandon my family, nor do I want to. I know too well what it’s like to grow up without a father and I will not do that to anyone else. The interesting thing I have discovered is that now I have acknowledged the ties and seen them for what they are, temporary but enduring, I love them all even more than I ever have, and their presence in my life is even more precious and I couldn’t resent them at all (well when I’m being perfect anyway).

Buddha said that the end of all meeting is parting, which is another way of expressing the ineluctable truth of impermanence of all things, but this makes the time during the meeting even more important and beautiful because of its transience. The important thing is to not be caught up in the past when things are gone and only look to the moment. This is the hardest thing of all, renouncing your clinging to the stupid past and its tiny comforts.

(The full quote is the end of all gathering is dispersion; the end of all building is ruin; the end of all meeting is parting; the end of all birth is death.)

Blessings to you all.

JBOSS driving me nuts

  1. Download JBOSS, get latest version, why not? (not knowing that DR on the end means Developer Release, so stay away if you aren’t testing it or coding to new features).
  2. Download quick start, only for version 3, download v 3.2, Find webpage that gives all of the missing bits from the supplied quick start PDF at http://jmvanel.free.fr/jboss3-howto.html (thanks Jean-Marc).
  3. Template example will not deploy, gives a bs error about names in the ejb-xml file.
  4. Google leads me to the JBOSS forum page where I find out that the examples are for 3.0, but that you can get them going if you edit the generated files (erm, and lose the changes every time you rebuild). 3.2 is apparently more EJB compliant so it’s more pedantic about stuff generated by xdoclet. I could probably fix this if I knew enough about Xdoclet (or whatever Ant is feeding it) but don’t have the time.
  5. In the mean time I discover that the CMP2 project (which doesn’t use xdoclet to generate the ejb home and remote interfaces or the deploy file, it’s been hand coded) does work.
  6. Fine says I, let’s use this project. Let’s see if the 4.0 DR will work so that I won’t have to migrate to 4 when it becomes production.
  7. It won’t deploy.
  8. OK OK, I give up, I will stick to the 3.2 release, not use xdoclet (I’m writing my own XML generation stuff from a description of my schema, so I can do the interfaces myself anyway).

All I can say is that the supplied stuff does use JUnit and I think JUnit looks OK (but don’t get me started on testing for testing’s sake or you’ll have to kill me). 2 days down the toilet. Lesson : if stuck go to google straight away, do not pass go, just do it. Now adding to my generation code, got the schema, got the drop schema, now to do the bit that generates the ejb-jar.xml.

Next question : do I want to used Container or Bean managed persistence? Container might insulate me even more from the datbase, but bean will give me far more control.

Investigating struts, discovering Velocity

Looking at the website I think I want to use struts for my project. There’s also a template-based technology, which is new to me, called Velocity, which looks good too. My ideal is to start from a description of the data model, with some tags for actions, in my XML document and then generate out the data entry subsystem complete. In order to do this I think I need to take a typical entity and then build the whole thing by hand.

So next tasks:

Generate DM and run script in Postgres (ironing the bugs out on the way).

Take an entity and “do” it, tagging subsystem, lookups and all.

Turn this into a template.

Write some code to take the XML and apply (via script or somesuch) the template across the whole DM.

It dosen’t matter if it’s rough around the edges, just as long as I don’t have to repeat code myself. Remember a good programmer is lazy. If you are doing something repetetive and can’t get the machine to do it then start again. I will spend a lot of time on editor macros because then you can repeat the boring shit over and over once you’ve done it once. That’s why I like bash and awk.

Still haven’t decided about EJB’s tho’, but they are a marketable skill.

Dev environements, XML, Postgres etc.

Postgres worked straight away with the JDBC driver you get off the net. In no time at all I was browsing my schema in JDeveloper.

I have been reading the docs for postgres and I like it. I like being able to define domains (whereas in Oracle you can define them in Designer but not in the DB, except as types (which maybe Designer supports now?), which aren’t quite the same conceptually). I also like the way the documentation clearly gives the differences between the implementation and the SQL standard, which is not something I have ever seen in the Oracle documentation (although Oracle is in fact a standard of sorts because of the wide use). I don’t like having so many scalar types (like int4 and int8), but I think I was spoiled by Oracle’s Number type (42 digits of precision, but it did encourage messy thinking, where columns where just declared Number). I like the way that the variable character type is just called varchar, rumour has it that Oracle’s original implementation was messed up so they tried again and put a 2 on the end. Something that has always annoyed me, although I believe that the two have been synonymous in Oracle for a long time now but habit stops you changing. And types in Postgres are proper types with operations on them with a reasonably clean syntax for conversion etc. Never had to play with types in Oracle so I’m probably not being fair. I like postgres date/interval/timestamp thing because you had to do a lot of odd stuff with Dates in Oracle to get these things which are there already.

I have decided to save the description of the schema into an xml document and then use this to generate scripts. I haven’t used SAX, only the DOM, and so I thought it time to learn it. To be honest, SAX is much easier and the amount of code I had to write is minimal. Of course, I’m only parsing well-formed documents with no schema but it was easy. If I was going to go the whole hog I suppose I’d write an XSL sheet, but that would only slow me up.

Thanks to Stefan Ram http://userpage.fu-berlin.de/~ram/pub/pub_detics8/java_sax_parser_en, although the bit that opens the XML source file isn’t quite correct and I changed it to      

reader.parse( new org.xml.sax.InputSource( new FileReader(“public_html\data-model.xml” )));

The API docs say that if you give a string it is some kind of system ID, so I changed it to use the FileReader as shown. Note the MS file name if you are a Linux kid.

So the plan is:

  1. Define schema in XML
  2. Tag main entities in XML so that I can generate out some generic data entry screens.
  3. Write parser to create schema script
  4. Write parser to create data entry engine
  5. Bag the whole thing up and give it to Source Forge as a project.

I’ve already done 1, 2 and 3 in less than a day (with some shortcuts in the XML). I need to think about 4, and have a look at what struts can give me, whether I want to use beans etc. etc. etc. Will probably move back to doing my marketing screens while I investigate.

All I need to do now is find a job! Interestingly I discovered through the grapevine that the top developer in NZ (who I disagreed with but had a lot of respect for) has left. Tee hee. The price of everything and the value of nothing. Good luck Steve, I learned a lot from you.

(Note : Stefan moved his URL so I have changed it to the new one : 17-Oct-03)

Grindstones beckon

Tryweryn

Spent a day at the Tryweryn trying to master the Elbow Wave. Very fast and off course you get blown down the river if you screw up too badly. Managed to stay on it for more than a few seconds and try some turns. Still a way to go but maybe my experience on the Tees will help next time (see later).

Oasis

Just spent a week at Oasis in Penrith. Already paid for so what the hell? Very good chill-out time, but we did fall out with Jon a bit because he likes to be awkward some times. The days consisted of doing an activity and then chilling out at the sub-tropical pool for the rest of the time. We also went to see Jonny English which was OK, kind of Carry on up the Secret Service. Jon watched a lot of Fox kids and it is absolute crap, wall to wall low-quality cartoons and power rangers reruns, you can tell it’s owned by tabloid kings preparing the rest of us for a life of consuming their predigested bollocks.

Slalom in Fairnilee (nr. Selkirk)

Competed in a Div 4 slalom at Fairnilee on a bit of the river Tweed. Quite an interesting course, the first time I had ever competed at slalom. Much harder than it looks and on day 2 they had made the course more difficult and I managed to miss a gate (well more crash into one side of it and not get head and shoulders through). The kids from the club did well, Hannah got promoted to Div 2 and we think that Gareth may have done (needs confirmation). Hannah is now trying to amass enough points to get to Div 1 before the season ends. Going to the event at Marple in a couple of weeks. I’d like to get to Div 3 just for the hell of it but there’s not a lot of the season left and my slalom boat sucks.

The Tees

Paddled for 2 days at the Tees whitewater centre. Finally mastered the Happy Eater wave, was getting spins just throwing weight and lifting my legs. It’s taken me years to learn this because I had to unlearn the old way of doing things first. At last I seem to be making progress with playboating.

Saw one of the GB juniors training at slalom. It was like watching ballet as he whipped round the gates at speed without touching them, he’d just come back from training on the big water in Europe. Luckily his mum can afford to take him round but she’s saying that they will need some sponsorship soon. Interestingly they get his kayaks made in Bratislava (I think) and then pay the import duty because it’s cheaper than ordering them from Double Dutch in the UK.

(Hmmm big water in Europe … must save up and take summer off paddling – maybe see if I can get job as pursuit kayak … hmmm).

Job Search

Nothing doing at the moment, about to make a couple of calls to an agency for some jobs I saw on Skillsite http://www.skillsite.co.uk.

Adis

Received a letter minuting the meeting I had with der managemint a couple of weeks ago which of course missed out the bit that said if they employ a temp to cover for the work I used to do I will sue them. Not sure if I can be bothered replying to this dross. They were unable to put my street name and number on the letter and the Post Office had to wait for another letter for me to match the name up with the post code, this didn’t actually affect my impression of their competence one whit, I have to say, but I was impressed with the Post Office’s persistence. Need to get my P45 so that I can sort out my mortgage insurance and sign on (yada).