NinethSense oWnZ mE!: Praveen’s drawing book

Choose a Topic:

Fri
27
Jul '07

My Latest article ‘DataTable filter demonstation’

My latest article ‘DataTable filter demonstation’ is available at codeproject.com.


Link: http://www.codeproject.com/useritems/DatasetFilter.asp
Wed
18
Jul '07

MSN Bots for MSDN and Encarta

Add MSDNBuddy [at] hotmail.com to your MSN to use your messenter as fast MSDN search.

Also, add encarta [at] botmetro.net to get answers from Encarta.

Here are reference links:
http://blogs.sqlxml.org/vinodkumar/archive/2007/06/07/msdn-bot.aspx http://vasudevg.blogspot.com/2007/06/encarta-instant-answers.html
Thu
12
Jul '07

MD5 with t-sql

You can use HashBytes to achieve.
Check this for reference: http://msdn2.microsoft.com/en-us/library/ms174415.aspx

SELECT 
	HashBytes(‘MD5′, ‘Praveen’),
	HashBytes(‘MD5′, ‘PraveeN’),
	‘0xD09C2ECC3DFCDC8C8D921B589097FCB1′,
 
	CASE WHEN convert(int,HashBytes(‘MD5′, ‘PraveeN’)) = 0xD09C2ECC3DFCDC8C8D921B589097FCB1 
	THEN 
		‘Success’ 
	ELSE
		‘Failed’
	END


Note: for MySQL you have MD5() function
'

MD5 encryption with c#

This code shows how to encrypt a string with MD5 algorithm:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Text;
 
namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            Text = getMD5(“test”);   
        }
        private string getMD5(String str)
        {
            MD5CryptoServiceProvider mdcsp = new MD5CryptoServiceProvider();
            byte[] b = System.Text.Encoding.UTF8.GetBytes(str);
            b = mdcsp.ComputeHash(b);
            StringBuilder s = new StringBuilder();
            foreach (byte by in b)
            {
                s.Append(by.ToString(“x2″).ToLower());
            }
            return s.ToString();
        }
    }
}
Mon
9
Jul '07

Get Environment Variables

This code will show list of Environment Variables in Windows:

 
foreach (DictionaryEntry de in Environment.GetEnvironmentVariables())
{
     listBox1.Items.Add(de.Key + ” = “ + de.Value);
}
Do not forget to include this:
 
using System.Collections; // for DictionaryEntry
'

Send keystrokes to an application

You can send key stokes virtually to other applications with this:


This code will send F11 key press to Mozilla Firefox, which will make it ‘fullscreen’.
 
    int iHandle = FindWindow(null, “Mozilla Firefox”);
    SetForegroundWindow(iHandle);
  SendKeys.Send(“{F11}”);


FindWindow and SetForegroundWindow are APIs, which you can access with

 
 [DllImport(“user32.dll”)]
        public static extern int FindWindow(
            string lpClassName, // class name 
            string lpWindowName // window name 
        );
        [DllImport(“user32.dll”)]
        public static extern int SetForegroundWindow(
            int hWnd // handle to window
            );



Full cs code:
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
 
 
namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        [DllImport(“user32.dll”)]
        public static extern int FindWindow(
            string lpClassName, // class name 
            string lpWindowName // window name 
        );
        [DllImport(“user32.dll”)]
        public static extern int SetForegroundWindow(
            int hWnd // handle to window
            );
        public Form1()
        {
            InitializeComponent();
        }
 
       
 
        private void button1_Click(object sender, EventArgs e)
        {
            int iHandle = FindWindow(null, “Mozilla Firefox”);SetForegroundWindow(iHandle);SendKeys.Send(“A”);
 
        }
    }
}
Tue
3
Jul '07

Restore missing show desktop icon

just execute this in the Start -> Run
regsvr32 /n /i:U shell32
Reference: http://support.microsoft.com/?kbid=190355
The CodeProject Microsoft Developer Network Official ASP.NET Forums Microsoft .NET Framework Community Microsoft Most Valuable Professional Kidoos forums Microsoft Visual Studio Developer Home Professional Information Technology Solutions Microsoft Research Home Trivandrum Microsoft Users Group Community Website