Category: Uncategorized

Oracle to Ingres migrations

http://www.it-director.com/article.php?id=12729

I’m a bit curious about what the PL/SQL is being migrated to: you didn’t say. If it’s another proprietry format (albeit Ingres’ and therefore “free”) then who cares? Ok, less licence money but still not that good. I beleive the two proprietry languages aren’t that far apart anyway.

If it’s into Java or something else that is the lowest common denominator (albeit boring) I can see the point. I did once look at such a tool myself but had no time. You could also put it back into Oracle if you wanted to, which might be interesting if the app moved on and you needed to go back there; making the server-side app database agnostic is a very useful thing not just limited to Ingres.

Of course, MySQL has only just got database procedures and they are still beta (and pretty tame). Again a neutral language would be more use here.

Have you come across the Oracle wrap utility that can be used to pre-compile your PL/SQL and make it impossible to read? There are a lot of people out there who’d pay serious cash for a converter that could turn that output back into anything human-readable.

Increasing demand for open-source developers?

Letter to the Register in response to this
“There is an increasing demand for high-value, high-paying jobs that require skills in open standards technologies like Linux,…” – what does she base this on? Where is the research?

Nope, I’m still working on the old Oracle technologies (not even Java) on windows, despite the fact that I know the new stuff quite well and am a Unix hacker from way back. The Unix stuff has always been faster and easier to work with, but not many people were using it.

A casual perusal on skillsite and gisajob of the jobs using stuff like PHP, Python etc. shows that the salaries are 2-5k lower than mainstream products, usually for small companies, and there aren’t that many of them.

It’s the big corporations that can afford the big salaries and they buy Oracle, IBM etc.. Java has become popular but its popularlity is a function of how it is the lowest common denominator, rather than how powerful it is. Java development is what C development used to be; although it’s slightly quicker because there is so much out there that others have done but at the end of the day it is very slow going to do anything new.

Scare your users, Python

Hmmm

Just got asked to remove a feature I demoed over 6 months ago because it “scares” users. Relatively sophisticated way of refining a data set with a pop-up that allows you to refine the what you can see in a column on the web page, then add in other columns and restrict the query down a bit. Needed some work to make the displayed name of the column less technical but the principle was sound, in my opinion.

Suddenly is scares users and I have to scope it out.

I’m not fed up or anything. Honest. Just why did I bother?

Still having some problems with using onkeyup event on a field with Internet Exploding Trousers. Works fine with Firefox, can’t get to the bottom of it. Past caring to give an opinion.

Having fun learning Python. Also found a great book on Safari:

Oracle & Open Source
By Andy Duncan, Sean Hull
………………………………………..
Publisher: O’Reilly
Pub Date: April 2001
ISBN: 0-596-00018-9

Have worked through some of the examples for Python. It’s too easy to develop a client using Python. I’m beginning to understand the object model better.

Have fun, children

PLS-00307: too many declarations of ” match this call

I was getting this when I did the following:

l_session_info.set_attribute( render_context_portlet.g_roi_code_preference, null ) ;

This is because the procedure is overriden with multiple data types. When you give it a null it doesn’t know which of the overriden procedures you are calling and can’t resolve it.

Instead I put

l_session_info.set_attribute( render_context_portlet.g_roi_code_preference, ‘’ ) ;

and all was well. If you want it to go to a date type then you need to_date(’‘)… you get the idea.

The really strange thing is that ’’ is null for all other intents and purposes. You can’t get its length – all you get is null. But it seems to be a null with a varchar type.

You can’t say

if x = ‘’
then …

either. It always returns false because ’’ is null.

MySQL, Python, etc.

MySQL

Decided to move my project to MySQL because it seems to be more of a standard compared with Postgres. This is a pity because I like Postgres a lot, but you have to go with the flow and if I’m going to work on some non-Oracle skills I should at least go with the market leader.

So, got it installed on XP (which was a breeze). Read the manual through a couple of times (you can download a compressed HTM help file). Persuaded PHP to talk to it, which mainly consisted of placing the MySQL bin directory in the path and rebooting.

Worked out that I needed the INNODB table types so that foreign keys would work (you can default this using the excellent configuration utlility). Also discovered that (assume table jim exists for the sake of this discussion):

create table fred
( x varchar(2) references jim(x) ) ;

Does not work:- it accepts the syntax but does not create the foreign key. I had to hack my SQL generator to get rid of the Oracle shorthand and to not use domains (as I was using with Postgres) but translate them into raw types. Now it’s:

create table fred
( x varchar(2) ) ;
alter table fred add constraint fred_jim_fk (x) references jim(x) ;

Which should work in Oracle and Postgres anyway. I’ve decided to eschew using domains (although my software lets you define them) so that it can be portable around many SQL engines. Need to also drop the Oracle-ism varchar2, as it is now a synonym for varchar anyway. I believe that when Oracle first created the type it wasn’t done right so they had another go; hence the 2 on the end for compatibility reasons and then it stuck. I wonder how many petabytes of storage are taken up with all of those 2’s? Someone pointed out to me that a single-character field should be char(1), because you’re storing extra space for the length, which is pointless when you only have one character …

All in all fairly painless.

If you’re an Oracle supporter, read this:

I found it interesting that the Census Bureau had an Oracle site licence and chose not to use it. One of my buddies uses MySQL a lot and is looking at using the text extensions to replace Oracle’s context (or whatever they are calling it now) becuase Oracle want loads of cash and context is a pain in the proverbial. MySQL is also a bit quicker for complex queries and doesn’t have so many common(ish) words that are used as keywords that you have to pre-process into a form that isn’t interpreted as one, how lovely and user-friendly- those context guys really put some thought into it, didn’t they? Apparently every term added to an Oracle query increases the time taken for the query, where MySQL has what seems to be a fairly fixed cost. Don’t quote me on this I haven’t validated this for myself (but it doesn’t surprise me). Don’t say the words “memory leak” or “restart your database every morning” either. (I think this is 8i – maybe fixed?)

I’m quite curious about how their spatial database stacks up against Oracle’s but don’t have the time to look into it. The beauty of it is, of course, that you could add things in if you wanted to, with it being open source. Hmm … who the has the time, though?

Every database vendor other than Oracle allow you to define auto increment columns and then programatically get back the last autoincrement created in that session. Oracle sequence thing is a poor cludge. I suspect you could simulate the autoincrement with a packaged procedure (caching the last sequence number and messing with the insert statements or some horrible trigger), but why don’t Oracle do this?

MySQL doesn’t let you create views with subqueries in them. Not sure why, I’d have thought it fairly easy to implement. Views are just strings you run together with whatever you’re joining them to; or am I being naive?

MySQL 5 (which isn’t stable yet according to the website) has procedures and triggers. Postgres already has them. I just wish there was a standard for these languages so I don’t have to learn them all. I think MySQL’s look Postgresy but don’t want to do in-database stuff at the moment because it isn’t portable so don’t care about this. But I do like triggers for policing complex relationships and auditing.

Python

Sort of keeping a watching brief here. Was going to look at using Ruby as my scripting language of choice but it’s not mainstream enough to want on a CV. I like Python’s clean syntax. I like Ruby’s power and the syntax is OK. They have a lot in common as well (PHP has too). I suspect that when the Open Source guys see a good idea in another language they nick it, starting with variants of a lot of the good things in PERL. On first inspection I think Python’s object model is poor, but maybe what I’m seeing is flexibility. PHP 5 has a very strong one, as does Ruby (everything is an object in Ruby). It does have lambda functions (see http://diveintopython.org/power_of_introspection/lambda_functions.html). Lambda functions are very useful and give you a lot less clutter and overhead, if you use them carefully. Sharp tools, sharp tools. Love ‘em.

Professional Development

Have decided to spend 3 months on my PHP project and then go back to the Java Certification route. Java may be a boring thing to work with but at least it gives me options. Options are where it’s at. I think that Python or PHP or Ruby are probably a lot faster than Java in terms of bangs per developer buck and getting the job done with less fuss (I haven’t the space here to critique Java) but Java’s what the IT manager types want because it’s safe. Probably not as safe as .Net, but pretty safe.

Sheds and bookcases

Finally got my bike shed built in the back yard. Annoyingly it will only take 3 bikes and we have 4. Ho hum. I bought a new bookcase on Friday to replace one that fell to pieces one day. Guess what? I thought I’d got a wide but low one and in fact got a narrow low one that is about a quarter of the capacity I needed. Ah well back to IKEA and get another. Ho hum …

Onward … blessings all. I need some sleep.

Open Source

Lots of competent people, who think carefully about the problem, making small contributions is how it works. Don’t knock it. I’m a bit jealous of people who have made a contribution, which I know is weird of me. At times I feel like I’m trying to do a Michelangelo on the ubiquitous slab of marble, and not being allowed to find David, more like a badly-executed urinal without a drain hole.

(ClamAV) I need to get some up to date AV on my home machines. Was going to look at the OS stuff partly ‘cos I’m a tight wad and mostly ‘cos I want to support the OS movement.

I intend to make the Pharmarketeer stuff OS (collaborative evidence-based marketing – something like that). I’m trying to keep myself under control at the moment and do all of the work on pencil and paper until I’ve really thought through what’s required. Then I could make it into a book and get some residual from the book and consultancy work, just a thought. The move to MySQL is going slowly because I can’t connect to the database. Should have that cracked soon.

Ah well, back to me slab…

Software Patents

In response to http://www.it-director.com/article.php?articleid=12700

This seems a very bad caricature of the open source view. The way I understand it is that the ideas behind the software can be patented rather than just the software itself. So, for example, you come up with a means for managing some resource that is very efficient and write some software to do it, no-one else can use that idea without paying you, even if they implement it completely differently and do a much better job.

There are a whole ruck of ideas (linked lists, relational databases, hashed indexes for example) that are fundamental to working in a modern IT infrastructure. Where would Oracle (or MySQL) be if IBM had fought a patent over SQL – it could never have become the standard it is. How would this make the world a better place?

We cannot identify what ideas around today are as fundamental for the next wave of technology. It is totally naive to support patenting things like algorithms and good ideas. Profit comes from being better and quicker than your competitors. Profit is at the edge of things, where you are ahead of your competition, where you use sharper and better tools than they do.

Javascript and Radio Groups

Say you are trying to validate that at least one element in a radio group has been selected.

This hacking is because if a radio group only has one element you can’t treat it as an array so if the length is === (points to the the same object) as an undefined variable, numRowSelects, then there must only be one of them otherwise we use numRowSelects to walk the array of radio buttons, total nonsense.

Assume that theForm is the form with the radio group.
Assume that there is at least one element in the array or it all goes pear shaped.
When you get to the end of this oneSelected will be true if one has been picked or false otherwise.
As a side effect, if there is only one, it will be automatically selected.
This was developed using Firefox and also works with IE.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var oneSelected = false ;
var numRowSelects;
if ( theForm.pi_row_select.length === numRowSelects ) numRowSelects = 1 ; // numRowSelects was undefined - hack
else numRowSelects = theForm.pi_row_select.length;
if ( numRowSelects == 1 )
{
  oneSelected = true
  theForm.pi_row_select.checked = true;
  theForm.pi_row_select.onclick();
}
else
{
 for( var i = 0; i < numRowSelects ; i ++ )
 {
    oneSelected = theForm.pi_row_select[i].checked
//  alert("loop " + oneSelected);
    if( oneSelected ) break
 }
}

Diary

What’s the matter with people

Today I remembered why I hate driving.

Incident 1:

Coming up to a set of lights just before a 30 zone. I’m in the outside lane, doing about 40. Car on inside wobbles part-way into the outside lane, sees me and wobbles back. I carry on. I’m about a foot from him (or her) and they start coming again. No indicators, nothing. Fortunately I’m able to use a right-turn lane to go round him. We then stop at the lights.

Horn beeping at me. I look in the mirror and shake my head. Then the abuse and shouting starts.

Let’s get this straight: I managed to avoid an accident, I manage to stop this person spreading me and my son all over the road, and somehow it’s my fault.

I indicated right (as in look, this is what indicators look like) and waved at the indicators. More beeping and abuse.

The lights change and we move off.

For some reason this is still winding me up at 1 o’clock in the morning and I bet the idiot concerned is sleeping soundly. There ain’t no justice.

Incidents 2, 3 and 4

All at roundabouts, people pulling out at me. I’m not speeding, I’m obeying the rules about signalling properly. I just don’t get it. If you’re going to take a risk because the traffic’s heavy you should get out of the oncoming person’s way, not make them have to brake to miss you.

Incident 5

I’m coasting to a stop at the lights and someone swaps lanes when I’m maybe six inches from them. Fortunatly they’re moving and can get away from me before I hit them. I just wave hello, completely speechless.

All this for the two or three seconds you save at 2 o’clock on a Saturday. Not even in a busy part of town. Why risk your neck for this? I don’t get it, not at all. All of these incidents happened in the same hour or so.

Sad thing is, this happens to me all the time when I drive to work. No wonder I love going there so much. I wish people would chill and calm down a little, just think through how little life we all have left, before they start taking dumb risks in cars made of kitchen foil.

Family stuff

Took Jon to the kid’s club at Awesome Walls. He manged to get his first award. We’re going there tomorrow (today, actually) so we can all climb. I then went and got him a new controller for is PS/1, because the old one’s broken. This was a reward for getting something called a silver book award at school for having a good attitude.

Programming Projects & books

Just finishing reading Advanced PHP Programming by George Schlossnagle (0-672-32561-6). Very good book, even if you’re not interested in PHP he has a lot to say about cookies, caches, security, reverse proxies, using design patterns (as in getting some value from the academic view), as well as a host of other useful stuff. PHP differs from Java in that it doesn’t use threads: the persistent thing is in fact the interpreter. This makes it hard to crash but perhaps slower because it’s difficult to share things across sessions. Not an issue for my project but worth remembering.

I also really like the __get() and __put() object methods, where you can add arbitrary fields to objects that you can access using standard syntax rather than a method call. I think this is going to be a very useful facility for my database abstraction layer.

Motivational books

If you’re struggling with motivating people or yourself I think you should read Whale Done by Ken Blanchard (I think of One Minute Manager fame). Essentially:

  1. Catch people doing things right and sincerely thank them for it.
  2. If they are doing things wrong, take the blame and then redirect their energy where you want it to go.
  3. Praise improvement, however small.
  4. Don’t forget to catch yourself doing things right.

It revolves around positive feedback. The metaphor is based on how they train the killer whales at the Sea Life Center in Florida. You can’t use coercion on an animal that is a top predator and weighs 1000 pounds. You have to become its friend and find out what it wants as a reward. People are even harder than this and yet we all persist in saying GOTcha.

I think this is why I’ve been so fed up recently. I have no idea what the value is of anything I do, and I get no feedback; either positive or negative. How can I improve or fix things without a benchmark? Also being told that your work is good when you know you are demotivated and underperforming calls your integrity into question and adds to the stress. Brains are weird.

Ah well, just finished some camomile tea.

Oracle Ingress and Postgres

In response to this:

http://www.theregister.co.uk/2005/03/24/ingres_and_open_source/

Hi Philip,

Speaking as someone who has jumped from Oracle to Postgres, mostly for cost reasons, I’m curious about what the relationship is between Ingres and Postgres. I thought Postres was Ingres. I obviously haven’t been following it too well.

The other thing about this database is that it is a much better implementation of the relational model. I can create proper domains that describe what a thing is instead of some techie crap like varchar(27) maybe or maybe not being a soundex code (or whatever). I like this because you can see what a table is supposed to do when you look at its description. Oracle still haven’t understood this.

Apropos Oracle, a lot of my friends say that they’d be very happy with an open-source (or just virtually free) version of the old Oracle 7.3.4, perhaps with the 8.1.5 PL/SQL engine. I would say that most of us just want a reliable data store and don’t give a stuff about all of the high-end stuff. 9i RAC and 10g – who gives a toss, really, apart from the half-dozen big corps (mostly telcos) that need big databases. I don’t care about Java in the database either, quite happy running it in the middle tier where it belongs, or just using PHP because it takes a tenth of the time to do something useful without fity squnitillion XML files that are sometimes ignored in some middle-tier framework that’s too hard to use.

Don’t get me started on their Applicaton Server – was a nice usable thing and is now a pregnant elephant in a temper with more layers than an alpine climber. In the light of which I’d like to see an article looking at the relative merits of JBOSS, OAS and WebSphere in the real world. Are there any plans to do anything like that?

Somewhat off the point but never mind.

Regards