Wednesday, February 27, 2008

Oracle History

Oracle Database, the relational database management system from Oracle Corporation, is arguably the most powerful and feature rich database on the market.

Larry Ellison founded Software Development Laboratories in 1977. In 1979 SDL changed its company name to Relational Software, Inc. (RSI) and introduced its product Oracle V2 as an early commercially-available relational database system. The version did not support transactions, but implemented the basic SQL functionality of queries and joins. There was no version 1, instead the first version was called version 2 as a marketing strategy.

In 1983, RSI was renamed Oracle Corporation to more closely align itself with its flagship product. Oracle version 3 was released which had been re-written in the C Programming Language and supported commit and rollback transaction functionalities. Platform support was extended to UNIX with this version, which until then had run on Digital VAX/VMS systems.

In 1984, Oracle version 4 was released which supported read consistency.

Starting 1985, Oracle began supporting the Client-Server model, with networks becoming available in the mid 80s. Oracle version 5.0 supported distributed querying.

In 1988, Oracle entered the products market and developed its ERP product - Oracle Financials based on the Oracle Relational Database. Oracle version 6 was released with support for PL/SQL, row-level locking and hot backups.

In 1992, Oracle version 7 was released with support for integrity constraints, stored procedures and triggers.

In 1997, Oracle version 8 was released with support for object-oriented development and multimedia applications.

In 1999, Oracle 8i was released which is more in tune with the needs of the Internet (The i in the name stands for "Internet"). The database has a native Java Virtual Machine.

In 2001, Oracle 9i was released with 400 new features including the facilty to read and write XML documents. 9i also provided an option for Oracle RAC, or Real Application Clusters, a computer cluster database, as replacement for the Oracle Parallel Server (OPS) option.

In 2003, Oracle 10g was released. The g stands for "Grid"; one of the sales points of 10g is that it's "grid computing ready".

Saturday, February 16, 2008

Opening and Closing a New Window With JavaScript

Syntax:

window.open('url to open','window name','attribute1,attribute2')

This is the function that allows you to open a new browser window for the viewer to use. Note that all the names and attributes are separated with a comma rather than spaces. Here is what all the stuff inside is:
  1. 'url to open' - This is the web address of the page you wish to appear in the new window.
  2. 'window name' - You can name your window whatever you like, in case you need to make a reference to the window later.
  3. 'attribute1,attribute2' - As with alot of other things, you have a choice of attributes you can adjust.
Window Attributes

Below is a list of the attributes you can use:
  1. width=300 - Use this to define the width of the new window.
  2. height=200 - Use this to define the height of the new window.
  3. resizable=yes or no - Use this to control whether or not you want the user to be able to resize the window.
  4. scrollbars=yes or no - This lets you decide whether or not to have scrollbars on the window.
  5. toolbar=yes or no - Whether or not the new window should have the browser navigation bar at the top (The back, foward, stop buttons..etc.).
  6. location=yes or no - Whether or not you wish to show the location box with the current url (The place to type http://address).
  7. directories=yes or no - Whether or not the window should show the extra buttons. (what's cool, personal buttons, etc...).
  8. status=yes or no - Whether or not to show the window status bar at the bottom of the window.
  9. menubar=yes or no - Whether or not to show the menus at the top of the window (File, Edit, etc...).
  10. copyhistory=yes or no - Whether or not to copy the old browser window's history list to the new window.
Set the Window Position

There is another set of options you can use to set the position of the new window on the viewers, but it only works with NS4+ and IE4+:
  1. screenX=number in pixels - Sets the position of the window in pixels from the left of the screen in Netscape 4+.
  2. screenY=number in pixels - Sets the position of the window in pixels from the top of the screen in Netscape 4+.
  3. left=number in pixels - Sets the position of the window in pixels from the left of the screen in IE 4+.
  4. top=number in pixels - Sets the position of the window in pixels from the top of the screen in IE 4+.
Example:

window.open('BuildingAdd.aspx?AccountID='+qsv1+'','','width=400,height=350,left=350,top=350,menubar=no,location=no,
toolbar=no,directories=no,scrollbars=no,status=no,copyhistory=no,resizable=no');


Closing a New Window

use the window.close() function in the HTML of the new window.
window.close()

Creating a Stored Procedure or Function in an Oracle Database

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 or reassigned within the module.

An OUT parameter is a parameter whose value is passed out of the stored procedure/function module, back to the calling PL/SQL block. An OUT parameter must be a variable, not a constant. It can be found only on the left-hand side of an assignment in the module. You cannot assign a default value to an OUT parameter outside of the module's body. In other words, an OUT parameter behaves like an uninitialized variable.

An IN/OUT parameter is a parameter that functions as an IN or an OUT parameter or both. The value of the IN/OUT parameter is passed into the stored procedure/function and a new value can be assigned to the parameter and passed out of the module. An IN/OUT parameter must be a variable, not a constant. However, it can be found on both sides of an assignment. In other words, an IN/OUT parameter behaves like an initialized variable.

Note: IN is the default mode for parameter

syntax:

// Create procedure myproc with no parameters
CREATE OR REPLACE PROCEDURE myproc
AS
BEGIN
INSERT INTO oracle_table VALUES('string 1');
END;

// Create procedure myprocin with an IN parameter named x.
CREATE OR REPLACE PROCEDURE myprocin(
x VARCHAR,
y IN OUT VARCHAR
)
AS
BEGIN
INSERT INTO oracle_table VALUES(x, y);
y := 'outvalue';
END;


// Create a function named myfunc which returns a VARCHAR value;
// the function has no parameter
CREATE OR REPLACE FUNCTION myfunc
RETURN VARCHAR
AS
BEGIN
RETURN 'a returned string'
END;

// Create a function named myfuncinout that returns a VARCHAR value;
// the function has an IN/OUT parameter named x. As an IN parameter, the value of x is defined in the calling PL/SQL block before it is passed in myfuncinout function. As an OUT parameter, the new value of x, ‘x value||outvalue', is also returned to the calling PL/SQL block when the execution of the function ends.

CREATE OR REPLACE FUNCTION myfuncinout
(x IN OUT VARCHAR)
RETURN VARCHAR
AS
BEGIN
x:= x||'outvalue';
RETURN 'a returned string'
END;

Thursday, February 14, 2008

Asp.Net Custom Error Pages based on Error Code

From the moment you request a page in your browser to the moment you see a response on your screen a complex process takes place on the server. Your request travels through the ASP.NET pipeline.

When any exception is thrown now—be it a general exception or a 404—it will end up in Application_Error. We can trap errors and display friendly meaningful messages to users by following method..

void Application_Error(object sender, EventArgs e)
{
// At this point we have information about the error
HttpContext ctx = HttpContext.Current;

Exception exception = ctx.Server.GetLastError();

string errorInfo = "Offending URL: " + ctx.Request.Url.ToString() +" Source: " + exception.Source +
" Message: " + exception.Message +" TARGETSITE: " + exception.TargetSite +" Stack trace: " + exception.StackTrace;

ctx.Response.Write(errorInfo);

if (exception is HttpException && ((HttpException)exception).GetHttpCode() == 404)
{
string strurl = ctx.Request.Url.ToString();
strurl = strurl.Substring(strurl.ToLower().IndexOf("account"));
strurl = strurl.Substring(0, strurl.IndexOf("/"));
if (strurl.ToLower() == "account")
{
// To let the page finish running we clear the error
ctx.Server.ClearError();

ctx.Response.Redirect("a.html");
}
else
{
// To let the page finish running we clear the error
ctx.Server.ClearError();

ctx.Response.Redirect("b.html");
}
}
else
{
// To let the page finish running we clear the error
ctx.Server.ClearError();

ctx.Response.Redirect("c.html");
}
}

Saturday, February 9, 2008

Data Access Tutorials

Tutorials this will explore techniques for implementing these common data access patterns in ASP.NET 2.0. These tutorials are geared to be concise and provide step-by-step instructions with plenty of screen shots to walk you through the process visually. Each tutorial is available in Visual Basic and Visual C# versions and includes a download of the complete code used.

Click here to get started.....

Friday, February 8, 2008

How to Make Your Cell Phone Battery Last Longer

  1. Turn the phone off. This is probably the most effective and simplest way of conserving your battery’s power. If you don't plan on answering the phone while you're sleeping or after business hours, just turn it off. Do the same if you are in an area with no reception (such as a subway or remote area) or in a roaming area, since constantly searching for service depletes the battery fairly quickly. Some phones have an automatic power save feature, but it takes about 30 minutes with no service to kick in. By then, much battery power has been used.
  2. Stop searching for a signal. When you are in an area with poor or no signal, your phone will constantly look for a better connection, and will use up all your power doing so. This is easily understood if you have ever forgotten to turn off your phone on a flight. The best way to ensure longer battery life is to make sure you have a great signal where you use your phone. If you don't have a perfect signal, get a cell phone repeater which will amplify the signal to provide near perfect reception anywhere.
  3. Switch off the vibrate function on your phone, and use just the ring tone instead. The vibrate function uses up a lot of battery power. Keep the ring tone volume as low as possible.
  4. Turn off your phone's back light. The back light is what makes the phone easier to read in bright light or outside. However, the light also uses battery power. If you can get by without it, your battery will last longer. If you have to use the back light, many phones will let you set the amount of time to leave the back light on. Shorten that amount of time. Usually, one or two seconds will be sufficient. Some phones have an ambient light sensor, which can turn off the back light in bright conditions and enable it in darker ones.
  5. Avoid using unnecessary features. If you know it will be a while before your phone’s next charge, don’t use the camera or connect to the Internet. Flash photography can drain your battery especially quickly. If your phone has Bluetooth capability, disable it when not in use.
  6. Keep calls short. This is obvious, but how many times have you heard someone on their cell phone say, "I think my battery’s dying," and then continue their conversation for several minutes? Sometimes, the dying battery is just an excuse to get off the phone (and a good one, at that), but if you really need to conserve the battery, limit your talk time.

Saturday, February 2, 2008

Random Number Generation

int count = 0;
int zero = Convert.ToInt16('0');
int nine = Convert.ToInt16('9');
int A = Convert.ToInt16('A');
int Z = Convert.ToInt16('Z');
//int a = Convert.ToInt16("a");
//int z = Convert.ToInt16("b");
Random ran = new Random();
while (count < random =" ran.Next(zero,">= zero) && (random <= nine)) || ((random >= A) && (random <= Z)))
{
str_no = str_no + Convert.ToChar(random);
count++;
}
}
randomnumber = str_no.ToString();

Posting Information through https post method

Using this code u can post information to the secure site through http post method.

using System.Net;
using System.IO;
using System.Text;
using System.Security.Cryptography;

string strinput="sample Data" // According to your requirement
string strresult = "";

string strurl ="https://sitename.com";
Uri url = new Uri(strurl);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = strinput.Length;
Stream writeStream = req.GetRequestStream();
UTF8Encoding encoding = new UTF8Encoding();
byte[] bytes = encoding.GetBytes(strinput);
writeStream.Write(bytes, 0, bytes.Length);
writeStream.Close();
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8);
strresult = readStream.ReadToEnd();
return strresult; //Result in Success or Not Success