Skip to main content

Posts

Showing posts from June, 2011

Create table runtime using c sharp code

Create table runtime using c sharp code try { if (RadioButton1.Checked == true) { string first = TextBox1.Text.ToString(); string last = TextBox3.Text.ToString(); string user = TextBox4.Text.ToString(); string ps = TextBox6.Text.ToString(); string quest = DropDownList1.Text.ToString(); string answ = TextBox7.Text.ToString(); string source = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\dfd.mdf;Integrated Security=True; User Instance=True"; SqlConnection conn = new SqlConnection(source); conn.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO users(fname, lname, uid, pswd, ques, ans) VALUES ('" + first + "', '" + last + "', '" + user + "', '" + ps + "', '" + quest + "', '" + answ + "')", conn); int i = cmd.ExecuteNonQuery(); String sql = "CREATE TABLE " + user + "" +"(Stu

Example of abstract and interface class using c sharp

Example of abstract and interface class using c sharp namespace abstractClassDemo { class Program { static void Main(string[] args) { Car mycar = new Car("Skoda", "Fabia2CX"); mycar.ModelName(); mycar.BodyColor(); mycar.CubicCapacity(); mycar.Mileage(); Console.ReadKey(); } } abstract class Vehicle { string _model = ""; string _type = ""; public Vehicle(string company,string type) { _model = company; _type = type; } public abstract void CubicCapacity(); public abstract void BodyColor(); public abstract void Mileage(); public void ModelName() { Console.WriteLine("Vehicle is " + _type + " and Company is " + _model); } } class Car: Vehicle { public Car(string companyName, string modelName) : base(companyName, modelName) { } public override void BodyColor() { Console.Write("Color is Red."); } pub

Data Decryption using C# Code

Data Decryption using C# Code public static byte[] Decryptor(string secrpcnm, string key) { byte[] b = Convert.FromBase64String(secrpcnm); TripleDES des = CreateDES(key); ICryptoTransform ct = des.CreateDecryptor(); byte[] output = ct.TransformFinalBlock(b, 0, b.Length); return Convert.FromBase64String(Encoding.Unicode.GetString(output)); } static TripleDES CreateDES(string key) { MD5 md5 = new MD5CryptoServiceProvider(); TripleDES des = new TripleDESCryptoServiceProvider(); des.Key=md5.ComputeHash(Encoding.Unicode.GetBytes(key)); des.IV = new byte[des.BlockSize / 8]; return des; } //And to call the functions on the click event of a button:: private void button4_Click(object sender, EventArgs e) { label6.Text = (EncrypCls.Decryptor(label5.Text, "sksdege")).ToString(); }

Re size image in ASP.NET while uploading an image

Re size image in ASP.NET while uploading an image public bool SaveThumbnailImage(System.Web.UI.WebControls.FileUpload fu, string FullSavePath, int HeightMax, int WidthMax) { try { if (fu.HasFile){string tmpSaveDir = pg.Server.MapPath("~/TempUploads/"); if (System.IO.Directory.Exists(tmpSaveDir) == false) { System.IO.Directory.CreateDirectory(tmpSaveDir); } string tmpSavePath = pg.Server.MapPath("~/TempUploads/" + fu.FileName); if (System.IO.File.Exists(tmpSavePath)) { try { System.IO.File.Delete(tmpSavePath); } catch { } } fu.SaveAs(tmpSavePath); System.Drawing.Image img = System.Drawing.Image.FromFile(tmpSavePath); double ratioWidth = (double)img.Width / (double)WidthMax; double ratioHeight = (double)img.Height / (double)HeightMax; double ratio = Math.Max(ratioHeight, ratioWidth); int newWidth = (int)(img.Width / ratio); int newHeight = (int)(img.Height / ratio); System.Drawing.Ima

Encapsulate some code module in the code behind file of c#

Add a new project to you solution as class library. You can find class library under C# windows section. Name it as per your convenience. after adding, you will get a class file, with the name of you supplied. make this class public. Now you can write you logic in this class file, build it. it will create a dll file. add reference by right clicking on you main application project file select "Add reference", path of dll file. in your application, add the namespace of your class file and then call class and its methods. below is a sample class file using System; using System.Data; namespace myEncapsulatedNameSpace { public class myEncapsulatedClass { //property declaration //properties are used for passing values between application layers private string _myName = string.empty; public string myName { get { return _myName; } set { _myName = value; } public string myMethod() { return myName = "sk";

How Tsunami occurs?

How Tsunami occurs? As one plate subducts below another, pressure builds after many years, resulting in a section of the megathrust giving away. As this section gives way. 1 ruptures the ocean floor, resulting in a massive displacement of water, causing a Tsunami. Tsunamis are barely fell as a ripple on the ocean surface, but as the wave reaches land, they increases in size as the water becomes shallower.    World’s worst Tsunamis In Chile, Japan and Russia on February27, 2011, thousands died after an 8.8-magnitude earthquake. Many who survived the quake were killed hours later by a massive tsunami. Waves of up to 1.5 meters [5feet] went on to hit far – flung Pacific regions from the Russian far east and Japan to New Zealand’s Chatham islands. The biggest Tsunami  occurred on July 9, 1958 in Lituya bay, Alaska by a magnitude of 8 earthquake causing massive landslides. Waves reached an unbelievable heights of 1,720 feet, killing more than 36,000 people. We shall pray to god for

Micro organisms

Micro-organisms There are some organisms around us which we cannot see through naked eyes. These organisms are called Micro-organisms.  There are five types of Micro-organisms bacteria, fungi, protozoa, algae and virus. Where do micro-organisms live? Micro-organisms can survive under all types of environment, ranging from ice cold climate to hot springs and deserts to marshy lands. They are also found inside the bodies of animals including humans. fungi   Fungi is a type of micro-organism. There are three types of fungi Bread mould, penicillium, aspergillus. Protozoa There are two types of protozoa Amoeba and paramecium. Diseases like dysentery and malaria are caused by protozoa.  Algae There are two types of algae chlamydomonas and spirogyra. Viruses Virus are microscopic. Diseases caused by viruses are cold, influenza, coughs, polio and chicken pox. 

install xp and windows 7 and run both os once

install xp and windows 7 and run both os once To do this task you should have a software called EasyBCD , you can download it from internet its a free software.After installing your XP into d : install this software then double click on that software add the windows 7 from c : then insert the dvd of win 7 and run start up repair Now you can run both win xp an win 7 at once.

Basic requirements of LAN creation

 Basic requirements of LAN creation 1)  computers  with NIC cards (On board or Add on). 2)  cables and RJ 45 connectors. 3) A Hub or Switch. (Switch is recommended). Connectivity between PC & Switch There are some other things which you have to do to connect PC.s in LAN. 1) Straight cable crimping. color codes are as below. Orange-white, Orange, Green-white, Blue, Blue-white, Green, Brown-white brown. 2).Give IP Address to all PC,s in a single network ID. i.e, 192.168.1.1, 192.168.1.2 etc & Sub net mask is same to all PC. i.e 255.255.255.0. 3) Give any Work group Name to all PC, But it should be same to all PC's. 4) Try to ping the IP with each Other & Then access PC.

Show Hidden files in pendrive on windows XP

Show Hidden files in pendrive on windows XP Open explorer or My computer. Click on Tools -> Folder Options. Now a dialog box opens, In that Click on 'View' tab. Now under advanced setting panel, you can see the following thing: -> Hidden files and folders. -> Don't show hidden files, folders.. -> Show hidden files, folders... Now select the option "Show hidden files,folders and click on OK. Now open your pen drive. Now you will be able to see all the hidden files and folders. If you still can't find anything then it means there are no hidden files in that location.

NTLDR is missing press any key to restart,Check for computer screen blue problem

NTLDR is missing press any key to restart Insert the Window XP Professional CD in the CD-ROM and first boot may be CD-ROM. When write ‘Press any key to boot from CD…’ press ‘Enter’. Than start Window XP Professional setup Window XP Professional Setup Welcome to the setup 1. To set up Window XP now, press ‘ENTER’. 2. To repair a Window XP installation using Recovery Console, press ‘R’. 3. To quit Setup without installing Window XP, press ‘F3’. Microsoft Windows XP(TM) Recovery Console. 1: C:\WINDOWS Which Windows installation would you like to log onto ? (Press ‘1’) Enter Type the Administrator password. (If any) C:\WINDOWS> At C:\WINDOWS> prompt type the following commands: 1. C:\WINDOWS>fixmbr Are you sure you want to write a new MBR? ‘Y’ Enter 2. C:\WINDOWS>fixboot Are you sure you want to write a new bootsector to the partition C:? ‘Y’ Enter 3. C:\WINDOWS>bootcfgΦ/rebuild Add installation to boot list? (Yes/No/All) ‘Y’ Enter Enter

How to format a partition into NTFS -Disk formatting

To format a partition into NTFS you can try below points. There can be two possibilities of bad sectors (1) Your "FAT" or "bootsector" has developed "bad sectors" and it has locked it .There fore it is not allowing system to write partition info it it.Please note that it does not matter for a computer wehter it is last or first.it writes data "randomly". (2) There would be some kinda lock to your in your hdd which is preenting write to it.In NTFS you can lock the parition. Go to Administration Tools and Click Computer Management and select disk management, now you will see the partitions in your system and delete the partition you dont want and create a new partion in free space area.Now format the partition in NTFS. if you'r not able to format that partiton into ntfs you can try converting that with the help of a command go command promt a type the command "convert d: /fs:ntfs" (here d:=drive letter you wana convert)

Disk error press any key to restart

Disk error press any key to restart To resolve this issue on PC you can try this There is some delay coming in to the picture called Hard Disk Pre-Initialization Time. In simple words Hard Disk and it's own BIOS is not capable to cope-up with your motherboard speed/ booting speed. It happens with fewer boards and Seagate Medalist Family disks combination. When you are resetting your system, your HDD is already in "Ready to Boot" state hence the error message is not seen. This is nothing special... there is no magic. I would suggest to rewrite your boot sector. If you have dual boot kind of Operating System then this kind of HDD pre-ini delay strongly comes in to the play. Check your motherboard BIOS/ CMOS settings. Try to see if you can introduce some kind of delay in the Booting Procedure. Something like Disabling Quick Booting, Enabling HDD Pre Delay, etc. It is also advisable to clean format and re-install the OS. Just do simple take the hard disk tool (or

Privilege Levels in processor and Virtual Memory

Privilege Levels in processor and Virtual Memory Privilege Levels: The processor has Ring Levels 0-3, 0 being most privileged, 3 being least privileged. All processes in user land, be it root or non-root, execute in Ring 3. (Ring 1,2 are unused in Linux) A process in Privilege level 3 cannot read/write/execute segments which belong to supervisor (the kernel). So a write to memory locations higher than PAGE_OFFSET (3GB on i386) causes segmentation fault. Same goes for hardware access through in/out or mapped i/o (exceptions are iopl etc). Virtual Memory: Virtual Memory ensures no access to physical RAM pages by processes. Hence you *cannot* under any circumstances write a physical address, Hence there is ZERO chance of even reading kernel data, let alone messing them up.

Where to find the source file of the header netdevice.h

Where to find the source file of the header netdevice.h "cscope" is a very simple to use command line tool. you will have to install it and then use it on the kernel source tree locally. (it will index) However, if you are comfortable with the web version, that's also fine. I find cscope a faster way, so suggested that to you. :) the mechanism hardly matters. Just as an e.g. (I used cscope) Look at the file: drivers/net/82596.c line: 1125 static const struct net_device_ops i596_netdev_ops = { .ndo_open = i596_open, .ndo_stop = i596_close, .ndo_start_xmit = i596_start_xmit, .ndo_set_multicast_list = set_multicast_list, .ndo_tx_timeout = i596_tx_timeout, .ndo_change_mtu = eth_change_mtu, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, }; These are the driver routines for the particular device. Now search for these function definitions in the kernel source tree

how to handle file descriptor on linux and file handler on windows platform

Open files in Linux are represented by struct files_struct (process view) struct file (kernel view)(file descriptor).when a file is opened.links between file descriptor, inode,address pace etc are created(i.e struct file is filled properly ) This is the work of virtual file system.. if code from windows has to be accessed in Linux..(possible because..it support NTFS file system). actually the file system(The NTFS file system is converted into ext form by virtual file system) so it is possible in Linux to access window stuff. On the other hand windows does not support any other file system .so accessing Linux files on windows in not possible.(i mean without any external tool).

print the source and destination address using kernel-2.6.32.9

main() { int pack_socket,n; int len,datasize; char src_addr[20],dst_addr[20],*data; struct sockaddr_ll sa; socklen_t sl; struct iphdr *ip_hdr; char buf[2000]; struct in_addr addr; pack_socket = socket(PF_PACKET,SOCK_DGRAM,htons(ETH_P_ALL)); while(1){ sl = sizeof(struct sockaddr_ll); n = recvfrom(pack_socket,buf,2000,0,(struct sockaddr *)&sa,&sl); //check whether the packet is ip or not. if(ntohs(sa.sll_protocol) == 0x0800){ printf(" IP packet received \n"); ip_hdr = (struct iphdr *) buf; addr.s_addr = ntohl(ip_hdr->saddr); printf("\n Source Addr = %s", inet_ntoa(addr)); addr.s_addr = ntohl(ip_hdr->daddr); } } }

What is Virtual Memory and How it works?

What is Virtual Memory and How it works? Virtual Memory allows multi-user as well as multi-programming computing environment that too for very less RAM. RAM use to be very costly earlier compare to present day. CPU has PC register from where next instruction can be fetched or data can be load/store. Assuming PC being 32 bit register, it can address 4G locations. But practically we put very less RAM, say 128MB only. Assuming Virtual Memory exists, compiler generates code for an application, where compiler is also aware of OS+Architecture. Now code generated by compiler assumes entire 4G location (so large extent) is available for it and it is the only application running on the CPU. So PC register shall always issue address which is one among 4G locations. So this 4G which is in fact physical capacity of PC register of CPU, is used as Virtual Address, as actual RAM is much less (0-128MB only) Now OS uses a table call Page Table along with MMU unit of CPU. Using this it loa

What is WTK

Using WTK you can develop applications that will reside on mobile phone. That means the SMS/MMS application is for the mobile phone. What I want is to develop an application that will reside on the PC and should be able to send and receive MMS/SMS to the cellphones. I had used SMSLib earlier for sending and receiving SMS by connecting my cellphone as a GSM modem to my PC. The only problem with SMSLib is that it doesn't provide the capability to send MMS  and I am not sure if performance wise it is that good.

Example of trigger using procedure language

Example of trigger using procedure language CREATE OR REPLACE TRIGGER Trig_test AFTER INSERT ON EMP1 FOR EACH ROW DECLARE PRAGMA AUTONOMOUS_TRANSACTION; BEGIN test_T; -- Test_T is a Procedure commit; END Trig_test create or replace procedure test_T AS declare v_empno emp.EMPNO%type; cursor c1 is select empno from emp1 where empno is null; BEGIN open c1;loop fetch c1 into v_empno; exit when c1%notfound; update emp1 set empno = empno_seq.nextval where empno is null; end loop; close c1; Exception when others then null; end;

skip a record in a cursor and continue with the next record in oracle

To skip a record in a cursor and continue with the next record you can try below code in oracle or sql. declare cursor cur1 is select * from emp; rec cur1%rowtype; begin open cur1; loop fetch cur1 into rec; dbms_output.put_line(rec.ename||' '||rec.sal); fetch cur1 into rec; exit when cur1%notfound; end loop; close cur1; end;

Sql query to get second maximum salary of employee

Sql query to get second maximum salary of employee 1st Solution:- select min(sal) from emp e where 1 = (select count(*) from emp where e.sal<sal)  In this query duplicate values are not considered hence we may not get 3rd maximum salary because there are two employees with the same salary. to avoid the duplication strictly the query needs some changes 2nd  Solution  :- select min(sal) from emp e where 1 = (select count(distinct sal) from emp where e.sal<sal)  The following query displays the total repeating salaries . to get the complete details of the records just replace "sal" with "*" in the following query 3rd  Solution :- select sal from emp e where 1 = (select count(distinct sal) from emp where  e.sal<sal) This is example of select query to get top 3 maximum from table. select * from (select salaries from SalaryTrans order by salaries desc) where rownum <= 3; or select salary from (select distinct salary from SalaryTrans orde

Pl/Sql program to check for department of employee,Replace string with your column name

Replace string with your column name  Replace '2011-06-20T00:00-04:00' with your column name. SELECT SUBSTR('2011-06-20T00:00-04:00',1,INSTR('2011-06-20T00:00-04:00','T')-1)||' '||SUBSTR('2011-06-20T00:00-04:00',INSTR('2011-06-20T00:00-04:00','T')+1,LENGTH('2011-06-20T00:00-04:00')); Pl/Sql program to check for department of employee create or Replace Function valid_deptid (tmp_deptid departments.Department_id%type) Return Number IS Rtn_Deptno number; begin dbms_output.put_line('Inside Function'); select department_id into rtn_deptno from departments where department_id=tmp_deptid; if sql%FOUND then dbms_output.put_line('Valid Deptno'); end if ; return rtn_deptno; exception when no_data_found then dbms_output.put_line ( ' sorry incorrect departmentno' ) ; return -- it will return the null. it's a good programming pratice ---

call an oracle SQL script from EXCEL

 call an oracle SQL script from EXCEL For example, I'll execute SELECT query. Step 1: Learn name OLEDB provider of data for Oracle. If you established Oracle Client, this provider will be present. To learn a name of the provider, for example, create an empty file with extension *.udl (in Windows, certainly ). Then open its properties. On a page "Provider" you can see the list of providers. Step 2: Open VBA in Excel (Tools - Macro - Visual Basic Editors) and write this Script (Insert - New Module): Sub Macro1() ' Macro1 Macro Dim MyConn As ADODB.Connection Dim MyRst As ADODB.Recordset Dim MyPr As String Dim Ct As Long Set MyConn = New ADODB.Connection MyPr = "Provider=your_OLEDB_provider_name;Password=your_password;Persist Security Info=True;User ID=your_user;Data Source=your_Oracle_server_name" MyConn.Open MyPr Set MyRst = New ADODB.Recordset MyRst.Open "Select * from table_name", MyConn, adOpenStatic

Function and procedure with arguments out

A very simple difference between these two is A Procedure is used to perform an action! A function is used to compute something and then return it to the calling environment. The question is about the out argument. Both have certain usages: Like if you want that the returned value should be returned in an expression: a := b * tax(c); Tax must be a function with a value returning , you cannot use out parameter in such context, moreover when u want your function to return single value in your select statement you cannot use out parameter. On the other hand if you want to return multiple values the function returning value will not be sufficient because a function can return one and only one value.

Maximum parameters in a procedure in PERL

#!/usr/bin/perl open(FOO,">c:/prod_test.sql"); $create = "Create or replace procedure "; $body = "\nbegin\n null;\n"; $statement = $create."foo("; for ($x=0;$x<8188;$x++){ $statement .= "a$x in varchar2,\n "; } $statement .= "done in varchar2)\n as"; print FOO $statement.$body."end;"; close FOO; at 8187 parameters it compiled. at 8188 it gave a program to large error. its  tested body length by adding "null;" to the body 10,000 times and it didn't mind. One other thing is the 2499 character limit per line.

what is the difference between spfile or pfile

what is the difference between spfile or pfile An spfile and a pfile are both init parameter files. The pfile is a readable text file which you can edit directly in Notepad (Windows) or vi (Unix). The pfile's name is initSID.ora. The spfile is a binary file, which means it can't be edited directly (if you try to edit it directly, it'll corrupt the file). The spfile can only be modified by using the "alter system" command. The spfile's name is spfileSID.ora. The spfile is useful to have because it lets you dynamically make changes to some parameters, whereas the pfile does not - you will need to shutdown and start up the instance for any changes you make in the pfile to be applied.

finding null values columns in the table using sql

finding null values columns in the table using sql  declare L_STMT VARCHAR2(32767) := 'SELECT COUNT(1) FROM #1 WHERE #2 IS NULL'; NULL_CNT NUMBER; TBL_NAME VARCHAR2(30) := 'XYZ'; begin FOR I IN (SELECT COLUMN_NAME FROM USER_TABLES WHERE TABLE_NAME = TBL_NAME ORDER BY COLUMN_ID) LOOP L_STMT := REPLACE(L_STMT, '#1',TBL_NAME); L_STMT := REPLACE(L_STMT,'#2',I.COLUMN_NAME); EXECUTE IMMEDIATE L_STMT INTO NULL_CNT; DBMS_OUTPUT.PUT_LINE ('COLUMN OF ' || TBL_NAME ||' : ' ||' NULL COUNT FOR COLUMN '|| I.COLUMN_NAME ||' IS : ' || NULL_CNT; END LOOP; end;

difference between view and materialized view

difference  between view & materialized view  View never come until you call them, but once you created materialized view you needn't call that view if the records are equivalent to the records of your select statements/original table.optimiser never contacts to the basetable, if you have created a materialized view equivalent to basetable.In the view you can write "Create or Replace" but in materialized view u can't.If you want to change materialized view, you have to drop that materialized view and create that again. view is a logical or virtual table it doesn't have data on its own, but materialized view has a physical structure it stores data in local machine or on its own.materialized view can be refreshed automatically or manually. but in view, if any changes happened in the base tables, we want to reflect the same in the view means view has to issue the select statement again to the database.

Example of PL/Sql for monthly sales

declare start_date date; end_date date; begin select min(sales_date),max(sales_date) into start_date, end_date from t1; for start_date <= end_date loop Insert Into t1 (ShopName , sales_Date, Sales) Select t2.ShopName , nvl(t1.sales_Date,start_date), nvl(t1.Sales,0) From t1, t2 Where t1.sales_Date=start_date; start_date:=start_date+1; end loop; end;

Difference Normal INDEX And BITMAP INDEX

Difference Normal INDEX And BITMAP INDEX Normal index is cannot give indexes for Duplicate values in column values But BITMAP INDEX is gives Indexes for duplicate values also depend on Their ROWID. So BITMAP INDEX created on columns containing less distinct values means duplicates contain column for better performance BITMAP INDEX. WE can use B-Tree index where data cardinality is high and many DML operations are performed and have many distinct values. while Bitmap will use when have low cardinality and less distinct value like gender column(M/F) or value does not update frequently

Difference between alias and synonym in sql

Difference between  alias and synonym in sql Both are different in all manner not only syntactically Synonym is 1. It is a database object 2. It may be Public or private 3. It is permanent until dropped 4. create [public] synonyms syn_name for [Existed database object]; like create synonym emp1  for hr.employees; Alias is 1. It is not a database object. 2. It will alway private to query 3. It temporary to that query.It to used to provide a name It is generally used to provide a meaning-full heading or column name or table name that is long or inconvenient to type in Query 4. take a example select rownum as rank,e.* from emp1 e; here rank and e is alias where as emp1 is synonym

procedure to Insert image using sql by using LOB ,BLOB,CLOB data types

Insert image using sql create or replace procedure load(filename varchar2) as f_lob bfile; b_lob blob; begin insert into images values(filename,substr(filename,instr(filename,'.')+1),empty_blob()) return content into b_lob; f_lob:=BFILENAME('PAVAN',filename); dbms_lob.fileopen(f_lob,dbms_lob.file_readonly); dbms_lob.loadfromfile(b_lob,f_lob,dbms_lob.getlength(f_lob)); dbms_lob.fileclose(f_lob); commit; end;

Steps to install AdventureWorks database in sql server

Following are Steps to install AdventureWorks database in sql server. 1. Open Object Explorer, if necessary, in SQL Server Management Studio by choosing View ->Object Explorer. 2. Expand the node for the relevant SQL Server 2005 instance and then expand the Databases node. 3. Right-click the AdventureWorks node and choose Tasks➪Copy Database. The Copy Database Wizard runs. 4. Click Next. 5. On the Select a Source Server screen, specify the location of the server and the authentication method to use. Click Next. 6. Select a destination server and click Next. 7. On the Select a Transfer Method screen, select a method to use to copy the database. (Because this is only sample data, you can use the faster detach and attach method.) Click Next. 8. On the Select Databases screen, enable the check box for the AdventureWorks database. Click Next. 9. On the Configure Destination Database screen, name the copy AdventureWorks_new. Click Next, click Next, and click Finish.

SQL Server Data Types

SQL Server Data Types Numeric data types: Can be anything from very small to extremely large numbers. Also included are specific formats such as monetary amounts, float point numbers, numbers with a known number of decimal points, whole numbers, and so on. Date and time data types: Allows the direct input of date and time values. This is usually in a default format, such as mm/dd/yyyy hh:mm, or something similar. String data types: Can be fixed length strings, variable length strings, or even very large text objects. Text objects may or may not be stored in binary format. Strings normally accept alphanumeric data. Alphanumeric characters are letters, numbers, and special characters (anything on your keyboard that is not a letter or a number). Binary data types: Typically used to store large objects, including images, sound files, video, even very large textual values like documents. SQL Server 2005 allows storage of similarly related Microsoft product types, such as directl

Default system database description of sql server

Master The master database contains system tables that define the behavior of your SQL Server 2005 system. For example, each database that you add is recorded in a system table, and you can access information about those databases by executing a SELECT statement on the sys.databases catalog view. Similarly, information about all system stored procedures is stored in the master database. model Each time you create a new database, the model database is used as the template for the database you’re creating. It’s possible, if you’re planning to create multiple databases with the same customizations, to make those customizations once in the model database. msdb SQL Agent uses the msdb database to store information about tasks. tempdb The tempdb database is the scratch pad for the SQL Server system. A new tempdb database is created each time you start SQL Server 2005. Similarly, the tempdb database is discarded when you shut SQL Server down, so if you use the tempdb database to sto

Compiling and Delivering ASP.NET Pages stages

Compiling and Delivering ASP.NET Pages stages The process of compiling and delivering ASP.NET pages goes through the following stages: 1. IIS matches the URL in the request against a file on the physical file system (hard disk) by translating the virtual path (for example, /site/index.aspx) into a path relative to the site’s Web root (for example,d:\domains\thisSite\wwwroot\site\index.aspx). 2. Once the file is found, the file extension (.aspx) is matched against a list of known file types for either sending on to the visitor or for processing. 3. If this is first visit to the page since the file was last changed, the ASP code is compiled into an assembly using the Common Language Run time compiler, into MSIL, and then into machine-specific binary code for execution. 4. The binary code is a .NET class .dll and is stored in a temporary location. 5. Next time the page is requested the server will check to see if the code has changed. If the code is the same, then the compilat

Example of SQL script injection

SQL script injection collectionstring sql= “SELECT COUNT(EmailName) FROM Users WHERE “ + “EmailName=@Username AND Password=@Password”; sqlCommandcmd= new SqlCommand(sql, connection); cmd.Parameters.Add(“@Username”, txtUsername); cmd.Parameters.Add(“@Password”, txtPassword); connection.Open(); intcount = (int)command.ExecuteScalar(); connection.Close()

ASP.NET validation controls

ASP.NET validation controls RequiredFieldValidator CompareValidator RangeValidator RegularExpressionValidator CustomValidator E.g. <asp:TextBoxid=“pwd” runat=“server”/><asp:RequiredFieldValidatorControlToValidate=“pwd”ErrorMessage=“Password required.”EnableClientScript=“true”id=“pwdRequired”runat=“server”/>