Friday, July 29, 2011
LINQ Video Tutorials 'How Do I in C#'
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/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 canSunday, July 3, 2011
32 bit or 64 bit OS
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
{
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
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;
}
Thursday, June 23, 2011
Miscellaneous Notes
To blogged
jQuery does not work when one meta tag is missing for a list item of ddlTechnopark Express
http://www.technoparktoday.com/technopark-guide/technopark-express-timings/Wednesday, June 22, 2011
WCF - Intro
Windows Communication Foundation
New References
http://msdn.microsoft.com/en-us/library/dd456779.aspx
1. A service is a construct that exposes one or more endpoints, each of which exposes one or more service operations.
2. The endpoint of a service specifies an address where the service can be found, a binding that contains the information that a client must communicate with the service, and a contract that defines the functionality provided by the service to its clients
3. The SIX tasks need to create a WCF application
3.1. Define a WCF Service Contract
3.2. Implement a WCF Service Contract
3.3. Host and Run a Basic WCF Service
3.4. Create a WCF Client
3.5. Configure a Basic WCF Client
3.6. Use a WCF Client
1. Define a WCF Service Contract
1. The first task is to define a contract.
2. The contract specifies what operations the service supports
3. An operation can be thought of as a Web service method
4. Contracts are created by defining a C++, C#, or Visual Basic (VB) interface. Each method in the interface corresponds to a specific service operation. Each interface must have the ServiceContractAttribute applied to it and each operation must have the OperationContractAttribute applied to it. If a method within an interface that has the ServiceContractAttribute does not have the OperationContractAttribute, that method is not exposed.
2. Implement WCF Service Contract
1. Implement the created contract.
3. Host and Run the WCF Service
1. Create host and run the service.
3. Host and Run the WCF Service
Create the Proxy and Configuration file using ServiceModel MetaData Utility Tool
References
Tuesday, June 21, 2011
The double question mark operator in C#
It is useful when we need to assign a nullable variable a non-nullable variable. If we do not use it while assigning, we get an error something like
Cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?)
To overcome the error, we can do as follows...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GenConsole
{
class Program
{
static void Main(string[] args)
{
CoalescingOp();
Console.ReadKey();
}
static void CoalescingOp()
{
// A nullable int
int? x = null;
// Assign x to y.
// if x is equal to null, then y = x. Otherwise y = -33(an integer selected by our own choice)
int y = x ?? -33;
Console.WriteLine("When x = null, then y = " + y.ToString());
x = 10;
y = x ?? -33;
Console.WriteLine("When x = 10, then y = " + y.ToString());
}
}
}
Output
-------