Wednesday, February 28, 2007

Fedora Core 6 on the Toshiba Tecra M6

Installation was a fairly uneventful affair. Unfortunately, after the stock install,
  • the wireless card is nowhere to be found (it's an Intel Centrino)
  • the screen uses 1024x768 resolution, because the (detected) 1280x800 native resolution of the widescreen LCD has a HorizSync outside the (detected) range; I'm trying to figure out how to force the HorizSync into the desired range
  • the fingerprint scanner can't be found
Some positives:
  • Beryl works out of the box; a bit gimmicky, and Aqua still looks better
  • it seems that the built-in SD card reader is detected
  • the IEEE1394 connector is detected
  • it seems the Bluetooth adapter is detected
The real deal-killers are that wireless doesn't work out of the box; and the screen resolution doesn't go to native right away.

I found that adding

Option "DDC" "false"

to the Device section of /etc/X11/xorg.conf and adding a Monitor section (system-config-display doesn't create one) with the hard-wired desired modes allowed me to over-ride the flat-panel DDC modes. So I have 1280x800 resolution display now. Next stop.. wireless. Really odd, it's an Intel Centrino machine, one would expect that to work out of the box.

Tuesday, February 27, 2007

Hell in a Handbasket III

Last month, I discussed a simple application that I developed to load text rows into TimesTen. At that time, my performance figures were roughly 13,000 TPS for the Java version, and 20,000 TPS for the C++ version. This was on a Dell Latitude D600 with a 1.6GHz Pentium-M processor and 1GB of RAM (this is a three-year old notebook).

Today I got to run the same Java loader on the telco's test hardware, a 4-CPU (8-core), 1.6GHz POWER5+ processor-based IBM pSeries with an attached EMC storage (irrelevant for TimesTen) and 8GB of RAM. Guess what the transaction rate was..

10,000 to 11,000 TPS.

Gee, I wonder why Apple dumped PowerPC for Intel..

Saturday, February 24, 2007

Smart Broadband Speed Tests

We've been on Smart Broadband for well over a year now, and in spite of all the horror stories I've been hearing about the generally poor quality of Smart Broadband, my experience has been relatively positive.

I must say, there was a multiple-hour downtime last weekend after midnight, I don't know if that was scheduled or not. An annoyance, but nothing more. In my experience, those types of events happen every three or four months. I can tolerate that, it was past my bedtime anyway.

I measured the speed I'm getting (we're on the 384kbps, PHP 988/month plan).










Looks like connectivity to Seattle is the best! convenient, since my virtual private server is there..

Friday, February 23, 2007

RP Firm Offers Group Text Messaging!

This is from the Inquirer Online.

It really boggles my mind how come humbug yesterdays-news like this even makes the papers. Not enough hype and FUD to fill the Infotech section?

My former employer Information Gateway has had this service for years, across all telcos. And with a unified short code to boot. So why is this non-event newsworthy? and the company in the article had to pay some US company for this technology?


RP firm offers group text messaging for Filipinos

By Erwin Oliva
INQUIRER.net
Last updated 08:35pm (Mla time) 02/22/2007

MANILA, PHILIPPINES -- Philippines-based Axis Global Interactive Inc. (AGI) is offering a group text messaging service to local customers. This was after it acquired a license to locally sell a group text messaging service, dubbed Moblabber, developed by San Francisco-based Feedtext Inc.

The company said the service will be available initially to Smart subscribers, under the brand Moblabber Philippines.

In an interview, Axis Global Interactive marketing manager Richelle Chan said the service is currently being tested in other mobile networks.

Moblabber Philippines is dubbed as "a fun and useful social networking service geared for both web and mobile phone interaction made available to the Philippine market."

Smart subscribers can now sign up for free to the service. Upon activation, they can enjoy individual posting of messages and sending of messages to members of their group.

Users can register online or through the text-messaging, the company said.

Moblabber allows subscribers to create user profiles and join interest-centric groups, upload photos, send and receive messages to members of groups -- all using a mobile phone.

Also a mobile social networking service, Moblabber hopes to offer quicker communication system to enable subscribers to broadcast messages to multiple recipients, simultaneously.

After signing up at the Moblabber website, users can start creating groups. They can also start sending email invites to friends .

Smart users can register by typing "BLAB (nickname)/(password)" then send to 2625.

"Service is initially available to SMART subscribers, other carriers to follow in the next few weeks. Once a member, they can now make use of the rest mobile features," the company added.

Axis Global Interactive is a subsidiary of Philippine technology distributor Axis Global Technologies.


Thursday, February 22, 2007

In The Land of Cheap Hosting, Part IV

I found a use for "lighty" after all.

Everything has been nice and frosty with Apache and mod_perl. However, my site has tons of thumbnails on it, and if even two or three people visit the site at the same time, Apache hits its rather low-ish MaxClients setting.

So I rewrote my Perl ASP scripts to put a :81 (port 81) on all img tags, and hung an instance of "lighty" off port 81. So things are nice and dandy. There is a reduction in perceived performance, though, as "lighty" is single-threaded. I wonder if it's possible to have "lighty" fork off a few processes.

In The Land of Cheap Hosting, Part III

I discovered that I couldn't live without MySQL. Nothing like a flat file with an SQL API for some slap-happy data munging.

At this point I already had the nsd lightweight name server running, and Apache with mod_perl. When I tried to start up MySQL (using the "small" configuration in /etc/my.cnf) fork failures galore, due to lack of memory.

I couldn't recover the virtual host because I'd foolishly put MySQL in the startup sequence (/sbin/chkconfig mysqld on is so darn convenient..)

In desperation I upgraded to the VPSLink Link-2 plan. So much for doing things the "challenging" way. Still didn't work. Re-initialized the OS image (virtualization is way cool!) and re-installed everything painfully.

Amazingly even with 128MB of illusory memory, the CPAN module still doesn't work. So I had to "old-school" the necessary Perl modules, as before. This time MySQL started up. But I noticed to my extreme horror that, even though the in-memory size was a mere 10MB, the memory size (including paged-out RAM) was around 100MB! this is a major issue with OpenVZ! since you really don't have any swap at all, that 100MB paged-out area was eating real workspace.

Thankfully people have had this problem before: turn off InnoDB and BerkeleyDB support in MySQL using the

skip-innodb
skip-bdb

lines in /etc/my.cnf, leaving you with what is really a flat-file with SQL access semantics. But that brought down MySQL's memory footprint to 4MB. Now what do I do with the rest of that memory..

Tuesday, February 20, 2007

In the Land of Cheap Hosting, Part II

I managed to get nsd installed on my Link1 (meaning absolute entry level, $7.95 per month) VPSLink account. I compiled the RPM on my PC at home (which, with a 1.4GHz processor and 1GB of RAM, seems impossibly powerful: this is how far I have fallen).

There was something wrong with the tarball and spec file (missing the init script) but eventually I got some form of RPM, and after further trial-and-error got a working configuration. I'm that rusty at DNS stuff, but nsd is far cleaner than BIND ever will be. I've learned a new thing in the UNIX world, and all because of necessity.

Next stop, "lighty" (lighttpd). Back in the bad old days of Solaris 2.3 ten-odd years ago, I used a lightweight web server called thttpd, written by Jef Poskanzer, boa, and mathopd. All of which are still around, and smaller than "lighty." But "lighty" has a pretty good claim to fame: YouTube and Wikipedia use it. Some more compiling later and I had another RPM.

Problem is, my "experiment" will have to become more elaborate. I actually have to create a dynamic web site, and the thought of doing so with FastCGI under "lighty" did not fill me with joy. This experiment is supposed to be a low-effort activity, not another programmer burning-the-midnight-oil session. I'm supposed to have gotten past that!

So, I decided to use the good (or bad, depending on my newfound perspective) old Apache 2.0.52 which comes with CentOS so I could use the memory hog known as mod_perl. I am an old-line Perl programmer and whenever I get squeezed I fall back on Perl.

VPSLink virtual servers come with CentOS version 4.3 but no yum. So I decided to install yum. Unfortunately you need a ton of packages:

libxml2-python-2.6.16-6.i386.rpm
python-elementtree-1.2.6-4.2.1.i386.rpm
python-sqlite-1.1.7-1.2.i386.rpm
python-urlgrabber-2.9.8-2.noarch.rpm
rpm-4.3.3-18_nonptl.i386.rpm
rpm-python-4.3.3-18_nonptl.i386.rpm
sqlite-3.3.3-1.2.i386.rpm
yum-2.4.3-1.c4.noarch.rpm

You can get these from http://mirror.centos.org/centos/4.4/os/i386/CentOS/RPMS/.

There's another problem: yum wants a package called yumconf, but it can't be found for love or money on the net (although I suppose I could dig around my CentOS install CD's but I am lazy). It turns out that yumconf is just the contents of the /etc/yum.repos.d/ directory. So I just scp'ed my local copy to the virtual server.

After getting yum in there, a simple

yum -y install mod_perl
yum -y install mysql-server

brought in my old favorites, which I like a lot but which now seem alarmingly bloated.

Next stop: install Apache::ASP which is my favorite mod_perl module. I must also be reminded that Apache 2.0 uses the ModPerl::Registry module for handling CGI scripts, not Apache::Registry.

Then comes a crashing realization: the VPSLink Link1 hosting plan, with 64MB of memory (but only 58MB once the kernel giveth and taketh away) cannot run the CPAN module, e.g.

perl -MCPAN -e shell
cpan> install Apache::ASP

The CPAN module runs and initializes, but it dies when trying to download and unpack the module list: and the error is out of memory!

In a moment of weakness I considered upgrading my account to the Link2 hosting plan to get another 64MB of nonexistent RAM. After all it's just another $7 a month and I can live without this aggravation.. but paying more money reduces the "fun" of my little experiment, so I decide to download the tarballs from CPAN and compile them one by one: old school!

Apparently Apache::ASP only needs two more modules (aside from those which come with CentOS base and the mod_perl RPM) to compile: MLDBM and MLDBM::Sync.

A quick visit to

http://cpan.org/modules/by-module/MLDBM/
http://cpan.org/modules/by-module/Apache/

nets me the needed modules. Of course, no HTML-cleaning, no compressed HTML, no millisecond-resolution timer.. I've been using Apache::ASP for seven or eight years now and this is the first time I've used such a stripped-down version.

But after un-tarring each of the tarballs (thank God that actually works.. I was afraid gzip would bail out from a lack of memory) and doing the old-school mantra

perl Makefile.PL
make
make install

I have what I need!

One other problem I've encountered is that Red Hat (and CentOS) renamed the mod_perl 2.0 modules from Apache2::something to Apache::something. This wreaks havoc with Apache::ASP (the module won't run, even though it installs correctly).

The solution is, after doing the make / make install routine, is to edit

/usr/lib/perl5/site_perl/5.8.5/Apache/ASP/ApacheCommon.pm

and replace all instances of "use Apache2::something" with "use Apache::something" which fixes things.

And so after all these contortions, I get a working mod_perl install with Apache::ASP. Hurrah! this normally takes only a few minutes, but thanks to the skimpy memory and skimpy CentOS install, it takes me the good part of an hour.

Next step.. actually install my experimental software and watch everything go to hell in a hand basket when mod_perl experiences the memory bloat it's so well-known for.

Sunday, February 18, 2007

In the Land of Cheap Hosting

It's been almost a year and a half since I left Mozcom, Inc. Back when I was there, I could hang my personal web site off one of the servers. I could run fancy scripts to index my photo gallery, or to download the latest weather satellite image of the Philippines.

Anyway, all this time I have been content with getting my email through Gmail, and having no "real" home page. Blogger (this page!) has always done well enough for me, and the Blogger designers have far better graphics pizazz than I ever would.

But I recently wanted to test some little theories of mine. So it was time to hunt around for a web hosting provider.

I'm no fan of typical web hosting plans. A pain in the butt, if you ask me. But I don't want to blow $80 a month for a dedicated server. After all, to test my theories I'm willing to give up a few tall cups of Starbucks, but not $80 a month!

So, having been out of the Linux system administration loop for quite a while (my last and current jobs have mostly removed me from the drudgery of sysad work) I thought, maybe this virtual server hosting thing has improved since I last used it. In 2002 or 2003, all we had was UML (User-Mode Linux), and the performance fell far short of staggering. But now there is OpenVZ (the free version of Virtuozzo), with a claimed 2% performance hit compared to the bare metal. Hey, I can live with this.

So, I go off to look for a decent (read: cheap) domain registrar. I have the time of my life at GoDaddy, they have a fine and engaging interface. Inexplicably, I can't complete my registration. Several attempts (and credit cards) later, I google "GoDaddy Philippines," and belatedly discover that the CRM-constrained folks at GoDaddy have blocked off all Philippine credit cards for fraud. PayPal doesn't work either, even though I have a verified PayPal account. Apparently Philippine PayPal accounts are so limited that the "charging agreement" scheme of GoDaddy won't work.

It really sucks living in a country full of thieves and fraudsters. Next thing I'll know, I've got Mobutu Sese Seko's wife's cousin as my neighbor, writing "Dear Esteemed Friend" emails.

Yahoo Small Business could be OK. More expensive than GoDaddy, and I discover that they don't take Philippine credit cards either. I find a few other registrars which take Google Checkout. Which doesn't accept Philippine credit cards either. Great. And I'll be damned if I go with Network Solutions, they're obscenely rich already and charge too much.

Eventually (through SEO.ph) I stumble on Monicker. Hallelujah, they take Philippine credit cards. $9.95 per domain instead of GoDaddy's more pocket-friendly $6.95 but heck, I'm from a country of fraudsters. I have to swallow the extra cost. It's like all of us paying more money to Meralco because we live in a country of electricity thieves. The honest must subsidize the dishonest.

Next step is to look for a half-decent VPS host. I've done some perfunctory scouring of the Net and came up with VPSLink ("a subsidiary of Spry," they proudly state). I've heard of Spry, and they seem to have a fairly good reputation. It's only $7.95 a month (!) for the 100GB transfer, 64MB memory virtual machine. I can live with that, I think.

A few minutes and another credit card transaction later, I have an SSH window open to my very own virtual machine. This virtualization technology is fantastic! first time I've been on the receiving end of it (back in Mozcom, I was the administrator, and the clients had to suffer my 64MB UML images). OpenVZ is definitely faster. It's almost like the real thing.

But the illusion falls apart pretty quickly. The virtual machine has only 2GB of disk space. There is no compiler. There is no strace, or yum. And it turns out, 64MB is really, really tiny. That's your total memory allocation I believe, you can't page out. So it's not like a "real" 64MB physical machine. More like a 32MB machine or even less. But I'm unwilling to step up to the $14.95, 128MB plan just yet.

I learn some new things right away: bind is evil, eats too much RAM, use nsd. Use lighttpd instead of Apache. There go my fancy mod_perl plans. But the only nsd RPM i can find (an old version) won't run properly on the arcane OpenVZ box. And I can't compile anything because there's no compiler. Not to mention the compiler would probably run out of RAM on anything more complex than "hello, world."

This is really beginning to suck. But such are the things you get with a $7.95 hosting plan. So I'm gonna build everything on my Linux box here at home and upload them (via scp, so I don't need no freakin' FTP server which will eat more of my precious illusionary 64MB).

I might also add - Monicker's DNS management interface completely blows. I have ten years of system administration experience and it took me quite a while to figure everything out. They're really far from GoDaddy levels. But I eventually figured everything out. One thing we're good at is applying lots of time and thought to problems that could far easily be solved with more money.

So now I gotta recompile nsd (which inexplicably doesn't work on the OpenVZ box) and figure out what's wrong with it. And also a smaller HTTP server. Maybe I should've gone for the bigger-memory virtual machine in the first place.

Sunday, February 11, 2007

Retrocomputing 101

The first computer I ever got to use was a Taiwanese (in those days that was a bad word) clone of the Apple II+ which my dad bought in 1982. It looked very much like this one:


This computer was a "V.S.C. 2" (I guess because it displayed "V.S.C. 2" on the screen, but the real Apple II displayed "Apple II" on booting). In many ways it was "superior" to the real Apple II+ because it had lowercase letters built-in. Apparently, the Apple's of the era didn't have lowercase letter capability until the early- to mid-1980's. This computer had a 1.023 MHz processor, 48KB of RAM, and could display text at 40x24, a low-resolution "graphics" mode with 40x40 pixels (!) and a high-resolution graphics mode with 280x192 pixels in 8 colors.

Since we didn't have a monitor at that time, we used our 12" Sony black-and-white TV (made in the Philippines by Solid Corporation, which is now the luckless Destiny Cable). The computer came with a RF modulator, very familiar to the Nintendo Family Computer crowd, which let you view the 40-column text on the TV. Since it was a black-and-white TV, I just had to imagine those 8 colors in high-resolution mode.

Later on we got a Taxan green monitor, with a composite NTSC input. That thing was actually compatible with a VHS machine's output! I even got to use that ancient Taxan (it had about ten little potentiometers at the back to adjust various parameters, what's now done with On-Screen Display or OSD menus) on my first PC, which was an XT clone with a full-length, absolutely enormous CGA video card.

"Mass storage" was via an external, separate 5.25" floppy disk drive. This was a "single-sided" drive meaning it had only one read/write head. So you could actually eject the floppy disk, flip it upside down, and use the other side of the floppy disk as well!

In those days you could buy a "single-sided" or a "double-sided" floppy disk. The double-sided variety was more expensive. So what my dad did was buy the single-sided disks, cut a notch on the left side with a razor blade (the write-enable notch) and voila, double-sided floppy disk. Apparently the double-sided disks got QA'ed for both sides, while the single-sided ones only got QA for one side. But they all had magnetic coatings on both sides.

Write protection was done by putting some opaque tape (black electrical tape worked quite well) over the write-enable notch.

Back then there were a few "popular" brands of floppy disks: the expensive ones were Verbatim and 3M, while the cheap ones were made in Korea (a bad word in the early- to mid-1980's) and were branded SKC. We had lots of SKC disks, but the valuable software (like the System Master diskette, which you needed to format new disks) were on 3M disks.

Side note: the 5.25" disks were called diskettes or "small disks" because there was a larger variety of floppy disk that was popular back then: the 8" floppy disk. These disks were the size of a 45rpm record and held an unimaginably vast amount of data: 400KB per side, I think (this is all from memory).

Our computer had Applesoft BASIC in ROM. This was one of Bill's earlier efforts. It also had a sort-of shell and DOS (the "System Master" disk). You could run a BASIC program off the disk by typing RUN MYPROGRAM at the BASIC prompt. Or, you could run a machine-language program off the disk by typing BRUN MYPROGRAM.

To look at the contents of the disk, you would type CATALOG. It reminds me of another place, in much more recent memory, where I get to use the catalog (SELECT * FROM CAT).


One time, rats got into the computer and used it as a latrine. As a result, one bank of the RAM went out, leaving my brother and me with 32KB of RAM. That wasn't enough to run games like Cannonball Blitz. In fact the only game we had that could run in 32KB was Sabotage (man the gun, shoot at helicopters and parachutists). I got really good at Sabotage. My brother was five or six at the time, he was in charge of the Space Bar (firing button) while I steered the turret with the left- and right-arrow keys.

Needless to say, the "V.S.C. 2" was extremely slow. When I first got to use an IBM PC XT clone at my dad's office in 1985, I was staggered by the differences: the "V.S.C. 2" had 48KB of RAM, versus 640KB for the XT clone. From the BASIC prompt, you could actually output precise frequency tones on the XT, SOUND 8000, 10 for example, whereas the Apple clone was only good for beeps (PRINT CHR(7) to stick out a BEL character) or mysterious clicks, which were invoked using the suitably-arcane BZ = PEEK(-16336).

You could draw circles and stuff with the BASIC interpreter on the XT clone, whereas the Apple clone was limited to lines and polylines. Not to mention that "medium resolution" on the CGA card (320x200 with 4 colors) was better than "high resolution" on the Apple clone (280x192), not even mentioning the 640x200 high resolution mode of the CGA.

And the XT clone had a 4.77MHz processor ("turbo mode" at 10MHz, the chip was a NEC V20, not an Intel 8088) and had 16-bit registers. And a multiply instruction. Did I mention 16-bit registers? lots of 16-bit registers.

At that time, I thought that to get different languages (other than BASIC) you needed special hardware. This was because Apple sold (and their imitators spawned) something called the 16K Language Card, which was an expansion card which added (duh..) 16KB of RAM to the system. That extra 16KB (for a whopping total of 64KB) enabled the machine to run either CP/M or the UCSD p-System, both of which provided wonders such as compilers and the famous word processor, WordStar.

Unfortunately for me, you needed more than the 16K Language Card to run these wonders: you also needed the 80-Column Card (so that you could display 80 columns of text). Since we didn't have the latter, no other languages for me.

You could imagine the delight and wonder engendered by the PC XT clone: with just a disk, you could have all these languages I had only read about in books. I was like a kid in a candy store. Well, I was a kid at the time.

Want Pascal? there was Philippe Kahn's masterpiece, Turbo Pascal 3.0 on a single 360KB disk! want a fast BASIC? Robert Zale's Turbo BASIC 1.0 to the rescue (circa 1987)!

Come to think of it, Turbo BASIC spoiled my programming evolution because it was fast enough for most things, so I didn't feel the need to migrate to C for another two or three years, after a detour into Pascal, whose set functionality seemed ideal for implementing inventories in the adventure games I was so fond of at the time.

Of course, once I had grown past the slowness of BASIC and Pascal, what more could one ask for but Turbo C 2.0 (along with the yellow Reference Manual reprint).


I did get to learn and use Microsoft Multiplan on our Apple clone, which I'm sure very few have heard of. This was Microsoft's first effort in the spreadsheet business, many, many years before Excel.

The Apple II+ and its clones didn't have up- and down-arrows, making cursor navigation in spreadsheet programs (or even line-editing in the BASIC interpreter!) an interesting experience. It didn't have function keys or a numeric keypad, either. Come to think of it, cursor navigation in Multiplan was very much like how we navigate in UNIX vi. On a terminal with no (or non-working) arrow keys, like the Sun console.

Eventually I thought that I needed to learn 6502 assembly language, so I could squeeze some more speed out of the antiquated Apple II clone (this was around 1985 or 1986, I was ten or eleven at the time).

Imagine my surprise and disgust when I discovered that the 6502 has one general purpose register, called the Accumulator, and two semi-general purpose registers, the X and Y registers if I recall correctly. These registers were an amazing 8 bits wide. There was no multiply or divide instruction. So you needed to do repeated addition or shifts. The 6502 assembly language book I had, didn't explain Booth's algorithm, so the explanation of how to do multiplication was haphazard at best.

One of the really neat tricks that I miss about that ancient Apple II clone was the game port. Steve Wozniak implemented the Apple game port's analog inputs using a (gasp) 556 dual-timer circuit. Basically the game port could sense four digital inputs (the firing buttons, I don't think there even was debounce circuitry) and two resistive inputs (the X- and Y-axes of the joystick).

It was quite amusing to wire a variable resistor to the analog input. Two long pieces of #22 solid wire were fine; the game port was a simple 16-pin DIP socket on the motherboard, and you could stick one end of the solid wire right in the appropriate pin socket on the connector.

Then, connect a long rod (one of those wooden rulers with a hole in the end would do) to the shaft of the potentiometer, attach a weight to the other end of the ruler, and voila, you have a pendulum. Some BASIC software to read the game port, and you could graph on the screen, in real time, damped mechanical oscillation.

I can't help but remember how much fun I had on that ancient piece of hardware. I learned the periodic table of the elements on that thing. I programmed adventure games (in BASIC!) on that thing. I tried to make an oscilloscope too, because my understanding of how the game port analog inputs worked was flawed (at the time, I thought there were real A/D converters in there).

And all that with 1 MHz, 48KB of RAM, 40 columns of text, and perhaps 100KB of disk storage on each side of those SKC floppy disks.

Friday, February 09, 2007

Loading Video Files Into Oracle InterMedia

We were doing some characterization (the synonym do jour for benchmarking these days) of Oracle InterMedia performance for storing videos.

InterMedia, for those stuck under a rock, is a once extra cost but now free option for Oracle 10g R2. It allows you to store images, sound, video, and do some nifty tricks, the most nifty of which is a fuzzy image match, e.g. "find all the boobies that look like Anna Nicole Smith's boobies... ooops she's dead."

Anyway, after much Googling and reading of the overly-PL/SQL centric InterMedia User Guide, I present: a function to upload a single video file into a table. The InterMedia data cartridge automatically extracts the video metadata and so forth.


import java.io.*;
import java.util.*;
import java.sql.*;
import java.util.regex.*;

import oracle.jdbc.driver.*;
import oracle.ord.im.*;

class w_upload
{
static String url = "jdbc:oracle:thin:@192.168.1.104:1521:ORCL";
static Connection con;

// insert a video into the table
// create table videos(
// videoid number(20) primary key,
// video ORDSYS.ORDVideo
// );

static void insert_video ( String path) {
// use a incrementing number for the videoid
long millis = System.currentTimeMillis();

try {
PreparedStatement cstmt = con.prepareStatement("INSERT INTO " +
"videos(video, videoid) VALUES(ORDSYS.ORDVideo.init(), ?)");
cstmt.setLong(1, millis);
cstmt.executeUpdate();
cstmt.close();

PreparedStatement st = con.prepareStatement("SELECT video FROM " +
"videos WHERE videoid = ? FOR UPDATE" );
st.setLong(1, millis);
OracleResultSet rs = (OracleResultSet)st.executeQuery();
rs.next();

OrdVideo vidProxy = (OrdVideo)rs.getORAData("video",
OrdVideo.getORADataFactory());

byte[] ctx[] = new byte[1][64];
vidProxy.loadDataFromFile(path);
vidProxy.setProperties(ctx);
st.close();

OraclePreparedStatement ps =
(OraclePreparedStatement)con.prepareStatement(
"UPDATE videos SET video = ? WHERE videoid = ?" );
ps.setORAData(1, vidProxy);
ps.setLong(2, millis);

ps.execute();
ps.close();

con.commit();
}
catch(SQLException sqle)
{
System.out.println("Error " + sqle);
System.exit(1);
}
catch(IOException e) {
System.out.println("Error " + e);
System.exit(1);
}

return;
}
}