Thursday, June 07, 2007

Reading a file using PL/SQL

Alright if the title sounds too infant to match your level I would suggest you skip going ahead because it is indeed not something fantastic. I am into converting some data and storing it as CLOB and the amateur that I am it needed me to do a lot of things before I could get it right. And to begin I had to first write a procedure to read data from a file. And that is what this blog contains.
Its got nothing fancy and a simple google would yield the needed info. Then the use of this blog? If thats what you were thinking....Folks googling , you will faind the info distributed. I have tried my best to put everything at one place.

I am assuming an oracle database on a windows machine;

The compact algorithm is -

Step1: Entry in your init.ora file -> utl_file_dir = dirPath

Step2: Create virtual directory mapping for oracle which points to the actual physical directory where the files are stored

Step3: Grant appropriate permissions on the virtual directory.

Step4: Create the file you would like to read thru PL/SQL, on the physical location

Step5: Write a procedure which would use the “utl_file” package of Oracle to read/write to a file

To get the details of this algo please click here

Sunday, March 25, 2007

Generics

Java 1.5 introduced this thing and its nice. Something that helps you to get rid of all ClassCastExceptions. Also it allows you to create better and elegant systems. I have just started off with this and liked it....The negative aspect of generics (if any) havent yet been spotted and i would really like ur comments if u know of anything.
Everything about genrics is here

Wednesday, March 21, 2007

YUI

All web developers would be glad for this to Yahoo. Distributed under the BSD Yahoo User Interface(YUI) library is a set of controls and utilities to develop rich web applications. The scoring point apart from the fact that we need not reinvent the wheel is its rich documentation which is generally the bane of most shared projects. So next time, you want a calendar control first go to YUI and check if they have already done your work. It's easy and really good. Click here to know more

Tuesday, February 20, 2007

An interesting problem

An interesting problem that someone had asked me -

You have a set of 300 pages that are numbered with you. The pages are in any random order. Suddenly the window opens and a single page flies out(don’t ask me why only a single page :P). Now the rule says that you can go thru the numbered pages exactly once and you can’t jot down the page numbers anywhere. How would you find the missing page number?

Solution: Let’s generalize the problem to ‘n’ pages. Find the sum of 1 to n. Call this x. Now as you can go thru the pages exactly once calculate the total of the page numbers as you go thru them. Call this total y. The missing page is obviously x – y;

Wednesday, January 17, 2007

Event Delegation Model explained

Event delegation model for Java was a good design as against the previous 1.0 model that SUN had come up with.But as is the case with all design models/patterns we need to understand it properly to utilize the model/pattern as it was intended by the creator. My attempt to explain to a junior why the event-delegation model is better over its counterpart. Takes a very simple example to understand the model.

Click here for the document.

For detailed info on the same plzz visit the SUN link here.

Wednesday, January 10, 2007

First step towards JDBC

A junior asked me a few doubts about JDBC and while clearing his doubts i realized that there were many things that i had overlooked while learning about JDBC myself. So the reasearch that went behind why-somethings-are-done-the-way-they-are saw me uploading a new document that specifies the first step towarsd JDBC.

The document is in an algorithmic form and just tells u the reasons behind the order of calls of the JDBC API's. It stops when u have created a Statement and can fire queries, essentially the point where SQL queries take over JAVA. How to fire queries, ect would soon be appended to the document.

The document can be viewed here

Everytime i upload a document I dont forget to say thanx to google. Its made sharing of docs/ideas so much easier

Thursday, January 04, 2007

Using Eclipse to create a web-based project

A little curiousity and self study saw me installing eclipse 3.1 and executing my web-pages thru it. To execute just a normal html page I had to do a lot of settings and that was a reason enough to write a doc to help out the newbies.

The doc has been uploaded on net and can be accessed here

Incase you want me to add/modify anything do lemme know.