Sunday, 9 October 2011

Disable Memory Dump Files & Save HDD Space on Windows 7




If your computer crashes, it will create a dump file. From this dump file you can diagnose the source of the problem. It is unlikely you will need this file; if you do, you can always turn the option back on. This section will show you how to save space by disabling memory dump files in Windows 7.
1. Click Start and click Control Panel.
2. Type Advanced in the search box.
3. Click on View advanced system settings in the search results.
4. Under Startup and Recovery, click Settings.
5. In the Write debugging information drop down, click (none) and click OK.
6. You will now save space and not store (possibly) useless information.

Register Your Windows XP license key (success to check)


Follow these simple step to the success

Step 1

First, go to START, RUN, And write here, REGEDIT




Step 2

And ENTER. Registry window will be open
Here select, HKEY_LOCAL_MACHINE




Step 3

Then Software,


Step 4

Then Microsoft,


Step 5

Then WindowsNT,




Step 6

Then CurrentVersion,



Step 7

And Then WPAEvents,



Step 8

In WPAEvents, Right click on OOBETimer key and click Modify,



Step 9

Change 71 to 72



Step 10

And Then Exit the regitry.
Again go to Start and Run, And write
%systemroot%\system32\oobe\msoobe.exe /a
here.



Step 11

It will be display Activate Windows, don’t worry about that! Please choose: I want to telephone a customer service representative to activate Windows.



Step 12

Next and Click on change product key:
write this product key here,
DHXQ2-WRGCD-WGYJY-HHYDH-KKX9B
And Press update



Step 13

It will be display Activate windows. Don’t care and choose
“Remind me later”.
And Restart Your computer,
Again go to Start and open Run box and write here,
%systemroot%\system32\oobe\msoobe.exe /a
It will alert the Windows activated already!




Monday, 25 July 2011

Pakistani girl turns world’s youngest MCP qualified Proud Of Pakistan


STAFF REPORT-IBD: Umema Adil, 13, has won laurels for Pakistan with her extraordinary achievement of becoming the world’s youngest Microsoft Certified Professional (MCP) in Asp.Net.

She has recently passed the MCTS exam for Windows Applications Development, says a press release issued here last week.

Umema is a shining star who has made herself recognized in different fields through her talent. She is excellent in ‘naat’ recitation and has won a total of 60 certificates and shields including four times the City District’s All Karachi Naat Competition; twice the All Sindh Naat Competition, All Pakistan Naat Competition and recently Sindh Hamd-o-Naat Award.

A student of grade eight in Mama Parsi Girls’ School, Karachi, Umema has also won the Best Talent Award for her accomplishments as well as various singing competitions.

Saturday, 23 July 2011

createting calculator on JAVA using awt classes


import java.awt.*;
import java.awt.event.*;
import java.awt.Graphics;
import ETextField;

public class AwtCalc extends java.applet.Applet implements ActionListener
{

private Button[] buttons = new Button[19];
private String[] buttonText = { " 1 ", " 2 ", " 3 ", " + ", " - ",
" 4 ", " 5 ", " 6 ", " x ", " / ",
" 7 ", " 8 ", " 9 ", "^ ", "sqrt",
" C ", " 0 ", " . ", " = "};

private ETextField result; // Calculator display screen
private String input = ""; // stores user input
private Label label;
private Color forecolor, // Calculator foreground color
backcolor, // Calculator background color
fieldcolor; // the display screen's color
private Font font,
buttonfont;
private int oper = 0, // stores the integer constants representing
oldoper = 0, // the operators
newoper = 0;
private double answer,
num1 = 0.0,
num2 = 0.0,
num3 = 0.0;
private final int ADD=1, // integer constants representing operators
SUB = 2,
MULT = 3,
DIVI = 4,
POW = 5,
SQRT = 6;
private boolean firstpress = true, //determines first button press
morenums = false, //"" if more numbers are being pressed
equals = false, //"" if equal button has been pressed
clearscreen = false, //clears screen
decnumber = false, //"" if a user entered a float
doubleclick = false; //"" if mouse was doubleclicked

public void init() {

font = new Font( "Courier", Font.ITALIC, 10 );
buttonfont = new Font( "Courier", Font.PLAIN, 12 );
setBackground( Color.lightGray );

//initialize colors

result = new ETextField( 125, 18 );
label = new Label( "AWT Calculator" );
setLayout( new FlowLayout() );

add( result );
add( label );

//initialize and add buttons
for ( int i = 0; i < 19; i++ ) {
buttons[i] = new Button( buttonText[i] );
buttons[i].setFont( buttonfont );
buttons[i].addActionListener( this );

if ( i <= 2 )
add( buttons[i] );
else if ( i >= 3 && i <= 7)
add( buttons[i] );
else if ( i >=8 && i <= 12 )
add( buttons[i] );
else if ( i >= 13 && i <= 17 )
add( buttons[i] );
else
add( buttons[i] );

if ( i == 2 )
add( new Label( " " ) );
else if ( i == 7 )
add( new Label( " " ) );
else if ( i == 12 )
add( new Label( " " ) );
else if ( i == 17 )
add( new Label( " " ) );

}
buttons[15].setForeground( Color.red );
result.setBackground( Color.white );
label.setFont( font );


}

//==============================================================================
// Interface method that determines which button was pressed then determines
// the appropriate action.
//==============================================================================
public void actionPerformed( ActionEvent e )
{

// "if" block is not entered if the button is an operator
if ( e.getSource() != buttons[3] && e.getSource() != buttons[4]
&& e.getSource() != buttons[8] && e.getSource() != buttons[9]
&& e.getSource() != buttons[13] && e.getSource() != buttons[14]
&& e.getSource() != buttons[15] && e.getSource() != buttons[18] ) {

if ( clearscreen ) { // clears screen if user enters number before an
clearScreen(); // operator after pressing equals
clearscreen = false;
}

if ( e.getSource() == buttons[0] ) {
input += "1"; // concoctenate "1" to input
result.setText( input );
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[1] ) {
input += "2"; // concoctenate "2" to input
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[2] ) {
input += "3"; // concoctenate "3" to input
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[5] ) {
input += "4"; // concoctenate "4" to input
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[6] ) {
input += "5"; // concoctenate "5" to input
showAnswer( input );
} // end if

else if ( e.getSource() == buttons[7] ) {
input += "6"; // concoctenate "6" to input
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[10] ) {
input += "7"; // concoctenate "7" to input
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[11] ) {
input += "8"; // concoctenate "8" to input
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[12] ) {
input += "9"; // concoctenate "9" to input
showAnswer( input );
} // end else if

else if ( e.getSource() == buttons[16] ) {
input += "0"; // concoctenate "0" to input
showAnswer( input );
} // end else if
else if ( e.getSource() == buttons[17] ) {
if ( decnumber == false ) {
decnumber = true;
input += ".0"; // concoctenate "." to input
showAnswer( input );
}
}
} // end if

// check if user entered the addition operator
if ( e.getSource() == buttons[3] ) {
clearscreen = false;
decnumber = false;
oper = ADD; // oper is set to addition
clickCheck( input ); // checks if user doubleclicked
if ( doubleclick == false )
processNumbers(); // if no double click continue to process
input = ""; // clear variable to store new input
} // end if

// check if user entered the subtraction operator
else if (e.getSource() == buttons[4] ) {
clearscreen = false;
decnumber = false;
oper = SUB; // oper is set to subtraction
clickCheck( input ); // check if user doubleclicked
if ( doubleclick == false )
processNumbers(); // if no double click continue to process
input = ""; // clear variable to store new input
} // end else if

// check if user entered the multiplication operator
else if (e.getSource() == buttons[8] ) {
clearscreen = false;
decnumber = false;
oper = MULT; // oper is set to multiplication
clickCheck( input ); // check if user doubleclicked
if ( doubleclick == false )
processNumbers(); // if no double click continue to process
input = ""; // clear variable to store new input
} //end else if

// check if user entered the divide operator
else if (e.getSource() == buttons[9] ) {
clearscreen = false;
decnumber = false;
oper = DIVI; // oper is set to divide
clickCheck( input ); // check if user doubleclicked
if ( doubleclick == false )
processNumbers(); // if no double click continue to process
input = ""; // clear variable to store new input
} // end else if

// check if user entered the exponential operator
else if ( e.getSource() == buttons[13] ) {
clearscreen = false;
decnumber = false;
oper = POW; // oper is set to exponential
clickCheck( input ); // check if user doubleclicked
if ( doubleclick == false )
processNumbers(); // if no double click continue to process
input = ""; // clear variable to store new input
} // end else if

// check if user entered the square root operator
else if ( e.getSource() == buttons[14] ) {
clearscreen = false;
oper = SQRT; // oper is set to square root
clickCheck( input ); // check if user doubleclicked
if ( doubleclick == false )
processNumbers(); // if no double click continue to process
input = ""; // clear variable to store new input
} // end else if

// check if user entered the clear operator
if (e.getSource() == buttons[15] ) {
clearScreen();
} // end if

// check if user entered the equal operator
if (e.getSource() == buttons[18] ) {
equals = true;
clearscreen = true;
clickCheck( input ); //check if user double-clicked
if ( doubleclick == false )
processNumbers(); //continue to process numbers if
input = Double.toString( answer ); //if no double-click
} // end if

} // end actionPerformed()

//==============================================================================
//Method processNumbers is where processes the numbers inputed by the user
//==============================================================================
public void processNumbers() {

// the program enters this "if" block when an operator is pressed for the
// first time
if ( firstpress ) {

if ( equals ) {
num1 = answer; //answer is stored in num1 if user enters equal operator
equals = false; // equals is set to false to allow additional input
} // end if
else
num1 = Double.valueOf( input ).doubleValue(); // converts a string number to double

oldoper = oper; // store current operator to oldoper

// if operator is square root, calculation and output is done immediately
if ( oper == SQRT ) {
answer = calculate( oldoper, num1, 0.0 );
showAnswer( Double.toString( answer ) );
morenums = true;
}
firstpress = false; // no longer the first operator
} // end if

// "if" block is entered if now more than two numbers are being entered to
// be calculated
else if ( !morenums ) {

num2 = Double.valueOf( input ).doubleValue(); //converts second num to double
answer = calculate( oldoper, num1, num2 ); //calculate num1 and num2 with
showAnswer( Double.toString( answer) ); //the past operator
newoper = oper; //store current operator to
//new oper
if ( !equals )
morenums = true; //tells program that more than two numbers have
else { //entered
morenums = false; //if equal operator is pressed, firstpress
firstpress = true; //returns to true
} // end else
} // end if

// if more than two numbers are being inputted to calculate, this "if" block
// is accessed
else if (morenums) {

if ( equals ) {

newoper = oper;
morenums = false;
firstpress = true; // if equals is pressed set firstpress to false
} // end if

num3 = Double.valueOf( input ).doubleValue();
answer = calculate( newoper, answer, num3 );
showAnswer( Double.toString(answer) );

newoper = oper;
} // end else if
} // end processNumbers()

//==============================================================================
//Method calculate determines which operator was entered and calculates
//two numbers depending on the operator pressed
//==============================================================================
public double calculate( int oper, double number1, double number2 )
{
double answer = 0.0;

switch( oper ) {
case ADD:
answer = number1 + number2;
break;
case SUB:
answer = number1 - number2;
break;
case MULT:
answer = number1 * number2;
break;
case DIVI:
answer = number1 / number2;
break;
case POW:
answer = Math.pow( number1, number2 );
break;
case SQRT:
answer = Math.sqrt( number1 );
break;
} // end switch

return answer;
} // end calculate()

//==============================================================================
//Method showAnswer outputs the results in the calculators displays screen
//==============================================================================
public void showAnswer( String s )
{
double answer;

answer = Double.valueOf(s).doubleValue();
if ( decnumber )
result.setText( Double.toString(answer) );
else
result.setText( s ); //all output are displayed as integers at start

} // end showAnswer

//==============================================================================
//Method clickCheck determines if the user double clicked and returns a boolean
//value. If doubleclick is true, the program ignores the input
//==============================================================================
public boolean clickCheck( String s ) {
if ( s == "" )
doubleclick = true;
else
doubleclick = false;

return doubleclick;
}

//==============================================================================
//Method clearScreen clears calculator display screen and sets variables to
//default.
//==============================================================================
public void clearScreen()
{
oper = 0; // reinitialize variables to default
input = "";
answer = 0;
decnumber = false;
morenums = false;
firstpress = true;
equals = false;
showAnswer( Integer.toString( (int)answer) );
}

public void paint( Graphics g )
{
//draw border
g.drawRect( 0, 0, size().width - 1, size().height - 1 );
g.drawLine( 0, 0, 0, size().height );
}
} // end program

checking data on sql through win form weather entry is added or failed or no double entry


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication8
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int flag = 0;
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnection conn = new SqlConnection("server=WEBNET;database=scott;user=sa;password=aptech");
                conn.Open();
                string select = "select * from reg";
                SqlCommand comm = new SqlCommand(select, conn);
                SqlDataReader dr = comm.ExecuteReader();
                while (dr.Read())
                {
                    if (dr["rollno"].ToString() == textBox1.Text)
                    {
                        MessageBox.Show("Record already exists");
                        flag = 1;
                    }
                }
                if (textBox1.Text.Equals("") || textBox2.Text.Equals("") || textBox3.Text.Equals("") || textBox4.Text.Equals(""))
                {
                    MessageBox.Show("values cannot be empty");
                }
                else if(flag==0)
                {
                    string insert;
                    insert = "insert into reg values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')";
                    SqlCommand comm1 = new SqlCommand(insert, conn);
                    flag = 0;
                    dr.Close();
                    comm1.ExecuteNonQuery();
               
               
               
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Occured");
            }
        }
       
    }
}

C# Sharp WinForm , SqlServer Adding Data Through Textbox, Radio button,Massage box


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string gender;
           
            if (radioButton1.Checked)
            {
                gender = radioButton1.Text.ToString();
            }
            else
            {
                gender = radioButton2.Text.ToString();
            }
            SqlConnection cn = new SqlConnection("server=LAB2-86;database=studentsdb;user=sa;password=aptech");
       
            string insert;
            insert = "insert into db values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + gender + "')";
            SqlCommand sc = new SqlCommand(insert, cn);
            cn.Open();
            if (MessageBox.Show("Do want to insert record? ", "Winform", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
            {
                sc.ExecuteNonQuery();
            }
            string select = "select * from db";
            SqlDataAdapter da = new SqlDataAdapter(select, cn);
            DataTable dt = new DataTable();
            da.Fill(dt);
            dataGridView1.DataSource = dt;
            cn.Close();
        }
    }
}

data grid view export data to exel


private void Excel_Click(object sender, EventArgs e)
>         {
>             if (dataGridView1.Rows.Count != 0)
>             {
>                 SaveFileDialog sfd = new SaveFileDialog();
>                 sfd.Filter = "Microsoft Excel 97/2000/XP(*.xls)|
> *.xls";
>                 sfd.FileName = "Report.xls";
>                 if (sfd.ShowDialog() == DialogResult.OK)
>                 {
>                     StreamWriter wr = new StreamWriter(sfd.FileName);
>
>                     int cols = dataGridView1.Columns.Count;
>                     for (int i = 0; i < cols; i++)
>                     {
>
> wr.Write(dataGridView1.Columns[i].Name.ToUpper() + "\t");
>                     }
>
>                     wr.WriteLine();
>
>                     for (int i = 0; i < (dataGridView1.Rows.Count -
> 1); i++)
>                     {
>                         for (int j = 0; j < cols; j++)
>                         {
>
> wr.Write(dataGridView1.Rows[i].Cells[j].Value + "\t");
>                         }
>                         wr.WriteLine();
>                     }
>                     wr.Close();
>                     label9.Text = "Your file has been successfully
> saved !";
>                 }
>             }
>             else
>             {
>                 MessageBox.Show("Error");
>             }
>         }