Vamsi Pavan’s Place

When curiousity outbursts …..

Entries Tagged as 'Programming'

Insertion Sort

April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code

Source code for Insertion sort in C language.

#include
#define NUM 6

main() {

int arr[NUM],i,j;

// start reading nums
for(i=0;i

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Selection Sort

April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code

The code for the selection sort in C lang is provided below.

#include
#define NUM 6

void swap(int arr[], int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}

main() {

int arr[NUM],i,j;

// start reading nums
for(i=0;i arr[j])
swap(arr,i,j);

// print sorted arr
for(i=0;i
Please point your web link to this page if you are using this code for any purposes.

Bookmark it!
These icons […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

File upload code in Jsp : using apache’s commons-upload.jar

April 13th, 2007 · 6 Comments · Jsp/servlets, Source Code

Please follow the below steps before coding the upload script in jsp.
1. Download the commons-upload.jar from Apache’s website.
2. Put that jar file into the classpath, i.e in WEB-INF/lib/ directory.
3. Then create a jsp file with the following code and any static HTML page for initial page.
The code here goes:

<%@ page import=”org.apache.commons.fileupload.*,
org.apache.commons.fileupload.servlet.ServletFileUpload,
org.apache.commons.fileupload.disk.DiskFileItemFactory,
org.apache.commons.io.FilenameUtils,
java.util.*,
java.io.File,
java.lang.Exception,
java.io.*,
java.net.*,
org.apache.poi.hssf.usermodel.*” %>
<h1>Data Received at the […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

File upload code in Jsp : other methods ….

April 11th, 2007 · No Comments · Jsp/servlets

On the client side, the client’s browser must support form-based upload. Most modern browsers do, but there’s no guarantee. For example,

<FORM ENCTYPE=’multipart/form-data’
method=’POST’ action=’/myservlet’>
<INPUT TYPE=’file’ NAME=’mptest’>
<INPUT TYPE=’submit’ VALUE=’upload’>
</FORM>

The input type “file” brings up a button for a file select box on the browser together with a text field that takes the file […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Reading and Writing Excel Files with POI

April 11th, 2007 · 3 Comments · Java

In this article we’ll show you how to read and write Excel files and how to read any Microsoft file’s document properties.
Conventions
The POI project is nearing a 2.0 release and is in a stage of rapid development, with new features and changes integrating nightly. In order to keep this article relevant, we’ll refer to […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

When itz come to Programming…!

April 5th, 2007 · No Comments · Programming

Start to refer the books ….
1. Knuth’s all the volumes (three) on programming/Algorithms.
2. Programming Perls
3. How to solve it by Computer by Dromey
4. Algorithms and DataStructures by Alen Wiss (standard datastructures)

Bookmark it!
These icons link to social bookmarking sites where readers can share and discover new web pages.

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

How to pass a list of values or array to SQL Server stored procedure?

April 4th, 2007 · No Comments · Pl/SQL

Note: Information & code samples from this article are tested on SQL Server 2005 RTM (Yukon) and found to be working. Will update the article in case of any compatibility issues.
unfortunately, there is no built-in support for arrays in SQL Server’s T-SQL. SQL Server 2000 did add some new datatypes like sql_variant, bigint etc, but […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Java Common Utils: Creating a stored procedure or function in an Oracle Database

February 6th, 2007 · No Comments · Java, Pl/SQL

A stored procedure or function can be created with no parameters, IN parameters, OUT parameters, or IN/OUT parameters. There can be many parameters per stored procedure or function.
An IN parameter is a parameter whose value is passed into a stored procedure/function module. The value of an IN parameter is a constant; it can’t be changed […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Java Common Utils: Calling a Stored Procedure in a Database (Oracle)

February 6th, 2007 · No Comments · Java, Pl/SQL

This example demonstrates how to call stored procedures with IN, OUT, and IN/OUT parameters.

CallableStatement cs;
try {
// Call a procedure with no parameters
cs = connection.prepareCall(”{call myproc}”);
cs.execute();

[…]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Java Common Utils: Reading and writing text files

February 5th, 2007 · No Comments · Java

When reading and writing text files :

it is almost always a good idea to use buffering (default size is 8K)
it is often possible to use references to abstract base classes, instead of references to specific concrete classes
there is always a need to pay attention to exceptions (in particular, IOException and FileNotFoundException)

The close method :

always needs […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags: