What’s In That Book?

I haven’t participated in a meme for a long time but Zac posted one I thought was kind of cool, so I’ll give it a lash.

  1. Grab the nearest book. (Don’t you dare dig for that cool or intellectual book in your closet) Or anything with words and enough pages to complete this task. You remember books, those thin strips of dead trees that have lots of words printed on them bound together down 1 side. People used to have them before eBooks and digital paper.
  2. Open the book to page 123.
  3. Find the fifth sentence.
  4. Post the text of the next 3 sentences on your blog along with these instructions.

Constraints
There are legal constraints, regulatory constraints and constraints imposed by distribution systems. There may be constraints of time and constraints of price. The constraints may be constant or they may be changing.

The above came out of an Edward de Bono book named Thinking Course.

Blogging Is Meant To Be Personal

Like most people, I read a lot of web sites and the majority of them I read because of their insight and personal opinion on any given topic. Of late, there have been a flurry of web sites that are automatically generating posts based of content on other web sites; such as del.icio.us.

I’m all for aggregation of content, its a really useful utility – however I don’t come to someone’s site to see a list of links to other web sites. I come to someones web site to read about a topic and if it happens to link out, well that is fine and dandy.

If you want to aggregate content, put the aggregated content into your side bar or in any location other than your primary content space. You should reserve your main content space for your own content or personal opinion on something – not for an aggregation.

Generating primary content automatically based on another web site, feed or service is just impersonal; don’t do it.

Akismet, Friends Forever

Akismet Spam Filter, Caught & Nailed 80,010 Spam Messages In Five MonthsIn the last five months, I have posted twice about the wonders of the free spam filtering service Akismet.

Since the last installment, another ten weeks have pasted. In the last ten weeks, approximately 30,000 new spam messages have been received and all of them have been blocked in one way or another. Since installing Akismet back towards the middle of last year, it has now dropped a whopping 80,000 spam messages at the door and it feels great!

You know what I’d like, I’d like it if the spammers were a little more intelligent. Clearly I’m running something on my site that is blocking their spam from ever reaching the public. If I were a spammer, I’d be keeping a close eye on what web sites my spam bots submit to and what sites it is getting through on. Essentially, if they are just brute forcing thousands of web sites – they are not being efficient spammers. At the moment, they could be spending the majority of their time spamming sites that the spam will never reach; instead of focusing their energies on the sites that spam is actually being registered on.

This can’t be a new idea but it sure seems as though the spam is relentless, even though it never makes it onto my live site.

ORA-06502: PL/SQL: numeric or value error

Today I came up against a very frustrating problem when writing some Oracle PL/SQL stored procedures and functions:

  1. ORA-06502: PL/SQL: numeric or value error

When I first wrote the stored function in question, I was using VARCHAR2 types for storage since it was the data type returned by an Oracle provided package. The function signature looked something like the following example:

  1. FUNCTION MyFunction
  2. (pData IN VARCHAR2)
  3. RETURN VARCHAR2;

The stored procedures and functions in question were being used with a lot of character information. Whilst running small sets of test data through the functions, everything was acting as expected. Unfortunately, as the test data sets increased in size I began to receive the ORA-06502 error.

As you may or may not be aware, within PL/SQL a VARCHAR2 type can store a maximum of 32767 bytes of information. When the ORA-06502 exceptions where taking place, this limit was being exceeded.

The thing that was so frustrating about the error, was that it wasn’t helping me identify the problem. In this particular instance, I had refactored a significant amount of PL/SQL and during that process changed some variables from VARCHAR2 into CLOB data types.

Oracle will allow you to pass a CLOB variable into a function that accepts a VARCHAR2, so long as the length of the CLOB is less than the maximum byte limit of the VARCHAR2. Since that wasn’t throwing a type conversion error in normal circumstances, it wasn’t something that I went looking into immediately as a possible problem when the Oracle ORA-06502 errors were thrown.

The solution to this particular problem is what you would expect, change the data types of all associated functions and procedures to use the CLOB data type:

  1. FUNCTION MyFunction
  2. (pData IN CLOB)
  3. RETURN CLOB;

After looking into the error in more depth, it can be thrown for virtually any generic constraint violation. The following simple examples would produce this error code:

  • assign a NULL value to a variable defined as NOT NULL
  • assign a value greater than 99 to a variable defined as NUMBER(2)
  • assign a CLOB with a length greater than 32767 bytes to a VARCHAR2 variable

I think it would have been a little more useful to a developer for Oracle to throw some sort of a type conversion error in this instance.