Andrew Channels Dexter Pinion

Wherein I write some stuff that you may like to read. Or not, its up to you really.

May 27, 2005

Oracle Applications Session Set Up

Just a quick note to myself, as I'm always forgetting how to establish my application credentials in SQL sessions. Running this script sets the appropriate (database) session variables for you to use the translated and organisation specific objects;

  l_application_id NUMBER := 0;
  l_responsibility_id NUMBER := 0;
  l_user_id NUMBER := 0;

  l_org_id NUMBER := <Your ORG Id>;
  l_sob_id NUMBER := <Your Set of Books Id>;


  SELECT user_id
  INTO   l_user_id
  FROM   fnd_user aa
  WHERE  user_name = <Your applications user name>;

  SELECT application_id, responsibility_id
  INTO   l_application_id, l_responsibility_id
  FROM   fnd_responsibility_tl
  WHERE  responsibility_name= <Your applications responsibility name>;

  fnd_global.APPS_INITIALIZE( l_user_id,
     0,-1 );
  fnd_profile.put('ORG_ID', l_org_id);
  fnd_profile.put('SET_OF_BOOKS', l_sob_id);

Posted by Andy Todd at 10:28 AM | Comments (0)

May 20, 2005


Sorry, can't blog, too busy scratching my head at the Python Challenge. It's the best web site of the year so far.

Posted by Andy Todd at 11:42 AM | Comments (1)

May 16, 2005

It's The Web Stupid

A technology company of my acquaintance has an internal web site called, unoriginally, the <insert company name here> portal. It is rubbish. Here's why;

It's got a fairly standard, straight out of the text book, portal look. The middle pane
contains a list of news items. They are all links to Word documents.

That's right, Word documents, actual files that end in .doc and which you can edit. Which would be fine if they were actual documents. But they aren't. One of the items currently in the news pane on this site is a link to Word document with a single line of text and a hyperlink to a gallery of photographs on another, internal, web page.

The mind boggles. You would think that a web site alive and running here in 2005 would use HTML, but apparently not.

I said they're all Word documents, well they are except the one whose URL ends in .msg. Clicking on this tries to open Microsoft Outlook which isn't installed on the machine I'm using. So I can't read that message.

Needless to say, the whole portal looks horrible in any browser other than Internet Explorer.

Finally, and this one is a killer - please bear in mind that this is a technology consulting company - is the message about email storage. Naturally it's delivered in a Word document, although this one has no hyperlinks. Apparently I can only read email using company approved email software that has been configured by a qualified support team member. If further notes that employees are banned from editing or changing this configuration. Nice to know that I'm not qualified to configure my own software.

Aside from the horror that is this technology implementation it's probably a good life lesson. When applying for jobs with technology companies look at how they use it internally. Because, in my view at least, your own internal systems should be your first reference when convincing customers of your know how and experience.

Posted by Andy Todd at 12:21 PM | Comments (4)

May 13, 2005

May Sydney Python Meetup

Last night's meetup was another cracker, thanks for organising it Alan.

We started with a discussion of how to replace, as no one was keen to pay the subscription fee. We settled on announcing the meetings on, establishing our own mailing list and an intention to set up a web presence. Sorted.

Then Alan gave a demonstration of how to develop web applications using CherryPy, SQLObject and Cheetah. As per previous meetings the room was split between those who said "but you could do all of this in Zope and Plone with APE" and those who said "we could, but we don't want to".

There was also a little discussion of the Python Challenge and I managed to successfully solve a problem during the meeting. I'm now only about five steps behind everyone else. I shall apply myself diligently to the task over the weekend though. By the time of the next meeting in July I may even have solved one or two more.

Posted by Andy Todd at 12:32 PM | Comments (2)

May 12, 2005

Oh Me, Oh My

This podcasting thing sounds like an interesting idea. Until you listen to this.

I'm not one for excessively negative remarks but - blimey that stinks. Normal words can't get close to desribing the experience that is listening to that, err, audio snippet. I dare you to put up with listening to it for more than three minutes.

I can say that I persisted slightly longer in the interests of research. But I have to say that I would rather burn my headphones than listen to it ever again. Luckily I don't have to, but it has scarred me for life. It's my own fault. I should have been alerted by the intriguing description "Today's podcast includes lots of singing, one idea, not much more. A Windows reboot. A bunch of philosophy. Thirty minutes. Amazing." Amazing pile of shite more like.

You, dear reader, are of course free to listen to whichever podcasts you like, even that one. Just remember what the Romans said - "caveat listener".

Posted by Andy Todd at 04:22 PM | Comments (1)

May 04, 2005

Returning Rows as Dicts in MySQLdb

Do you want to return a row of data from your database as a dict rather than a tuple? Using MySQLdb? Then here's how you do it. The traditional way to retrieve a row from a table is;

>>> import MySQLdb
>>> myDb = MySQLdb.connect(user='andy47', passwd='password', db='db_name')
>>> myCurs = myDb.cursor()
>>> myCurs.execute("SELECT columna, columnb FROM tablea")
>>> firstRow = myCurs.fetchone()
>>> firstRow
('first value', 'second value')

But using the DictCursor cursorclass we get;

>>> import MySQLdb
>>> import MySQLdb.cursors
>>> myDb = MySQLdb.connect(user='andy47', passwd='password', db='db_name', cursorclass=MySQLdb.cursors.DictCursor)
>>> myCurs = myDb.cursor()
>>> myCurs.execute("SELECT columna, columnb FROM tablea")
>>> firstRow = myCurs.fetchone()
{'columna':'first value', 'columnb':'second value'}

Note the extra import at the beginning, without it Python doesn't know about MySQLdb's cursors module. You should also be wary of guessing the order that the items in each row of the DictCursor are returned in. There is no guarantee, for instance, that "columna" will always be the first key and "columnb" the second. When using the DictCursor you should always access values directly by their key. When using the normal cursor class you can access the returned values in sequence (make sure never to use "SELECT *") as that's the only way you can associate a value with the column it has come from.

Posted by Andy Todd at 10:45 AM | Comments (5)

May 02, 2005

Better Search

It's time for to get a better search function. Why? Because the current one is, to put it politely, rubbish. Repeat after me;

  1. Go to
  2. In the search box at the top of the page type our search term - "Warehouse builder"
  3. Be amazed, as I was, that the first item on the results page isn't the product home page but a link to some kind of multimedia presentation about OWB and OLAP integration. An interesting topic but surely not the most relevant page on the site for my search terms.
  4. In fact, the Warehouse builder home page doesn't appear to be in the result set. Although I will confess to only clicking through the first eight pages of results before giving up.

Contrast this with the results from some randomly selected search engines; Google, Yahoo! (woops, not quite as good but better than the original), Ask Jeeves and AltaVista.

To save you having to suffer my pain, the Oracle Warehouse Builder home page is here, and no, the eagerly awaited "Paris" version still hasn't been released for public consumption.

Posted by Andy Todd at 03:43 PM | Comments (0)