Thursday, April 18, 2013


I always find myself putting an asterisk (if only mentally) next to certain statements. I shall now put all those statements here and link back.
  1. I don't know everything
  2. I'm not the best developer in the world, but I constantly work at getting better...
  3. If I make a statement about something, that's been my experience. Your results may vary.
  4. I am not a salesman.
  5. I do not work for <insert company name which I just pitched here>
That's it...for now.

Saturday, April 6, 2013

Ubuntu 12.10 + nvidia

I updated my host OS a few months back after getting repeated notifications (yes, I know, I can shut them off) that 10.04 (I think) was moving out of support.

Since then, I've had an issue with my Nvidia drivers. Basically, I get video on a single monitor (dual set up) and that single monitor resolution is like 200 x 400 (no, it's not really that, but it is gigantic). Thank goodness for The Google Machine™. That originally led me here on StackOverflow. (Another reason to do things from the command line, you can remember things with   history | grep nvidia).

I'm on the 4th time of going through this exercise. Each time the kernel is updated, nvidia breaks. Fortunately for me, that guy on StackOverflow gave me all the information I needed. This time after reboot and the gigantic screen, I removed the nvidia drivers and then reinstalled them. No go. uname -r gave me the following: 3.5.0-26-generic and dpkg -l|grep headers showed an older version of the kernel headers. So I updated those, reinstalled nvidia-current and rebooted. Yay.

Many "small" issues like this recently have me pondering a move back to, gasp, Windows or perhaps even a Mac. The Mac ecosystem scares me because it is expensive...but it's difficult to square when so many of my friends (technical and otherwise) swear by Macs. Something for another day I guess...

Thursday, April 4, 2013

Fun with CHAR

I'm busy deriving file layouts from PL/SQL. Probably close to 100 file definitions...each of them slightly different, each of them defined in the code. Fun!

There are a mixture of types too, fixed width, csv, etc. Thankfully, I've read enough of the code now that it's relatively easy to figure out. The fixed width variety is what this is about though.

In much of the code, there's a type that's defined, something like this:
type my_record is record
  column_01 CHAR(10),
  column_02 CHAR(10),
  column_03 CHAR(10)
That's then used to receive assignments from incoming variables. I'll hardcode my variables for this exercise.
  type my_record is record
    column_01 CHAR(10),
    column_02 CHAR(10),
    column_03 CHAR(10)
  l_rec my_record;
  l_rec.column_01 := '1';
  l_rec.column_02 := '3';
  l_rec.column_03 := '6';
Littered throughout those assignments though, are things like LPAD and RPAD. You're going to say, "well, yeah, if it's a number, you may want it right aligned or something." Fair enough. But I'm not talking about those, I'm talking about this:
  l_rec.column_01 := rpad( ' ', 10 );
  l_rec.column_02 := '3';
  l_rec.column_03 := RPAD( ' ', 10 );
Ostensibly, these columns once held data. Instead of forcing the client (application, business, whatever) to change their processing bit, the file was left the same. Makes sense.

Then I started to think about's a CHAR. CHAR is already fixed width. To wit:
drop table t purge;

create table t
  x CHAR(10)

insert into t ( x ) values ( ' ' );
insert into t ( x ) values ( null );

  length( x ), 
from t;

    ROWNUM  LENGTH(X) X        
---------- ---------- ----------
         1         10            
I inserted a single space in the first record. It has a length of 10 despite only inserting a single character there.

So what's the purpose of those RPAD( ' ', 10 ) calls? I'm not sure.

The only reason I even began to think about it was that I ran across one type set up with VARCHAR data types. There it makes sense, using RPAD I mean. With the CHAR field, it's a waste of typing IMO. Perhaps it was just for readability...who knows?