Friday, July 29, 2011

LINQ Video Tutorials 'How Do I in C#'

http://download.microsoft.com/download/0/E/4/0E450D3C-D709-4113-AC74-43A27257E77E/WinVideo-stanfield-linq-to-sql-part1-cs.wmv

http://download.microsoft.com/download/F/D/F/FDFACB01-8315-47BE-BED9-BA04B74EB6FF/WinVideo-stanfield-linq-to-sql-part2.wmv

http://download.microsoft.com/download/3/7/7/37799B79-6F8E-4C52-8B20-AC34A49851E6/WinVideo-stanfield-linq-to-sql-part3-cs.wmv

http://download.microsoft.com/download/F/6/B/F6BD1528-550A-494C-B0B2-B92B20424DCE/WinVideo-stanfield-linq-to-sql-part4-cs.wmv

http://download.microsoft.com/download/9/6/b/96b82db2-5cb5-45d1-b90e-9f2cd45f044a/WinVideo-stanfield-linq-to-sql-part5-cs.wmv

http://download.microsoft.com/download/2/4/6/246d0c13-7236-4054-993e-d4ee0df8c33f/WinVideo-stanfield-linq-to-sql-part6-cs.wmv

http://download.microsoft.com/download/5/b/3/5b3fb889-6baf-48e6-be6a-c5d827604caa/WinVideo-stanfield-linq-to-sql-part7-cs.wmv

http://download.microsoft.com/download/b/a/2/ba27fc07-239d-4f67-b47b-543378ae0016/WinVideo-stanfield-linq-to-sql-part8.wmv

http://download.microsoft.com/download/d/1/9/d19b229b-a267-4c30-9b51-8095ecd9c9b2/WinVideo-stanfield-linq-to-sql-part9-vb.wmv

LINQ Video Tutorials VB

http://download.microsoft.com/download/a/4/c/a4c98be0-30cb-44a4-880d-53a5025cd7b0/1firstlinqqueries.wmv

http://download.microsoft.com/download/a/4/c/a4c98be0-30cb-44a4-880d-53a5025cd7b0/2linqgroupandaggregate.wmv

http://download.microsoft.com/download/a/4/c/a4c98be0-30cb-44a4-880d-53a5025cd7b0/convertvs2005to2008.wmv

http://download.microsoft.com/download/a/4/c/a4c98be0-30cb-44a4-880d-53a5025cd7b0/7startinglinqtoxml.wmv

http://download.microsoft.com/download/a/4/c/a4c98be0-30cb-44a4-880d-53a5025cd7b0/8xmlintellisense.wmv

http://download.microsoft.com/download/a/4/c/a4c98be0-30cb-44a4-880d-53a5025cd7b0/9createlinqtoxml.wmv

http://download.microsoft.com/download/a/4/c/a4c98be0-30cb-44a4-880d-53a5025cd7b0/10excellinqtoxml.wmv

Wednesday, July 13, 2011

Thursday, July 7, 2011

iPod Shuffle

When you formatted it, you may have deleted its internal software. Never format iPods from Windows Explorer, Disk Utility, or anything that's not iTunes.

To fix this, launch iTunes, plug in the iPod, and restore its software from there. As this will format the disk, you should back up anything you have put on the iPod in the meantime.

Also remember that you have to use iTunes to put music on the iPod - you can

Sunday, July 3, 2011

32 bit or 64 bit OS

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;

namespace OSEdition
{
public partial class Form1 : Form
{
public enum OSEdition
{
Bit32,
Bit64
};

public OSEdition GetOSEdition
{
get
{
if (System.IntPtr.Size == 8)
{
return OSEdition.Bit64;
}
else
{
return OSEdition.Bit32;
}
}
}

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
if (GetOSEdition == OSEdition.Bit64)
{
label1.Text = "Its a 64 bit edition of Windows";
}
else
{
label1.Text = "Its a 32 bit edition of Windows";
}
}
}
}

Registry in C#

///
/// Author : Muhammed Rauf K
/// Date : 03/07/2011
/// A Simple console application to create and display registry sub keys
///


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// it's required for reading/writing into the registry:
using Microsoft.Win32;


namespace InstallationInfoConsole
{
class Program
{
static void Main(string[] args)
{

Console.WriteLine("Registry Information ver 1.0");
Console.WriteLine("----------------------------");

Console.Write("Input application name to get the version info. (for example 'Nokia PC Suite'): ");
string nameToSearch = Console.ReadLine();

GetVersion(nameToSearch);

Console.WriteLine("----------------------------");

Console.ReadKey();


}

///
/// Author : Muhammed Rauf K
/// Date : 03/07/2011
/// Create registry items
///

static void Create()
{
try
{
Console.WriteLine("Creating registry...");
// Create a subkey named Test9999 under HKEY_CURRENT_USER.
string subKey;
Console.Write("Input registry sub key :");
subKey = Console.ReadLine();
RegistryKey testKey = Registry.CurrentUser.CreateSubKey(subKey);
Console.WriteLine("Created sub key {0}", subKey);
Console.WriteLine();

// Create two subkeys under HKEY_CURRENT_USER\Test9999. The
// keys are disposed when execution exits the using statement.
Console.Write("Input registry sub key 1:");
subKey = Console.ReadLine();
using (RegistryKey testKey1 = testKey.CreateSubKey(subKey))
{
testKey1.SetValue("name", "Justin");
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
static void GetVersion(string nameToSearch)
{
// Get HKEY_LOCAL_MACHINE
RegistryKey baseRegistryKey = Registry.LocalMachine;

// If 32-bit OS
string subKey
//= "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
// If 64-bit OS
= "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
RegistryKey unistallKey = baseRegistryKey.OpenSubKey(subKey);

string[] allApplications = unistallKey.GetSubKeyNames();
foreach (string s in allApplications)
{
RegistryKey appKey = baseRegistryKey.OpenSubKey(subKey + "\\" + s);
string appName = (string)appKey.GetValue("DisplayName");
if(appName==nameToSearch)
{
string appVersion = (string)appKey.GetValue("DisplayVersion");
Console.WriteLine("Name:{0}, Version{1}", appName, appVersion);
break;
}


}

}

static void ListAll()
{
// Get HKEY_LOCAL_MACHINE
RegistryKey baseRegistryKey = Registry.LocalMachine;

// If 32-bit OS
string subKey
//= "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
// If 64-bit OS
= "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
RegistryKey unistallKey = baseRegistryKey.OpenSubKey(subKey);

string[] allApplications = unistallKey.GetSubKeyNames();
foreach (string s in allApplications)
{
RegistryKey appKey = baseRegistryKey.OpenSubKey(subKey + "\\" + s);
string appName = (string)appKey.GetValue("DisplayName");
string appVersion = (string)appKey.GetValue("DisplayVersion");
Console.WriteLine("Name:{0}, Version{1}", appName, appVersion);

}

}
}
}

Friday, July 1, 2011

Test Code

public string GetInstalledVersion()
{
string version = string.Empty;
//System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
//oPvM.IsForTFSetup = true;
string fileName = "TeachingFilesPlugin.msi";
string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
{
List lst = new List();
List lstregkey = new List();
foreach (string subkey_name in key.GetSubKeyNames())
{
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
{
lst.Add(subkey_name);
lstregkey.Add(subkey);
//Console.WriteLine(subkey.GetValue(fileName));
}
}

string[] keylst = lst.ToArray();
}
return version;
}