Tuesday, November 13, 2007

G-Phone

Monday, September 24, 2007

Thursday, September 13, 2007

Var Keyword in C# - .Net 3.5 Orcas Feature

In .Net 3.5 Orcas consist of a keyword called var. This keyword can be used to reference any type in c#. For example,


var name = "raja";
var age = 26;
var single = true;


The compiler will infer the type of the "name", "age" and "single" variables based on the type of their initial assignment value

string name = "raja";
int age = 26;
bool single = true;

What are Extension Methods?

Extension methods allow developers to add new methods to the public contract of an existing CLR type, without having to sub-class it or recompile the original type. Extension Methods help blend the flexibility of "duck typing" support popular within dynamic languages today with the performance and compile-time validation of strongly-typed languages.

Extension Methods enable a variety of useful scenarios, and help make possible the really powerful LINQ query framework that is being introduced with .NET as part of the "Orcas" release.


Simple Email validation class in .Net 3.5 - Orcas Feature

There is a class named EmailValidator in .Net 3.5 to validate email address. This class contain a static method called "IsValid" to validate email string. Sample code given below.

string email = "raja@test.com";

if
( EmailValidator.IsValid(email) ) {

}

There is another way to validate email string.

string email = "raja@test.com";

if
( email.IsValidEmailAddress() ) {

}

Monday, July 30, 2007

VS.PHP



VS.Php is a Php integrated development environment based on Visual Studio. With VS.Php you can design, develop, debug and deploy Php applications within the Visual Studio IDE. VS.Php key features are around providing rich Php and Smarty editing capabilities as well as its ability to debug Php scripts locally as well as remotely.

More.....

Wednesday, July 25, 2007

XmlTextWriter Class Sample

XmlTextWriter xmlWriter = new XmlTextWriter("c:\\menus.xml", null);
xmlWriter.Formatting = Formatting.Indented;

xmlWriter.WriteStartElement("menus");
for (int i = 0; i < 10; i++)
{
xmlWriter.WriteStartElement("menu");
xmlWriter.WriteAttributeString("id", "000000-00000-00000-0000");
xmlWriter.WriteAttributeString("name", "coffee");
xmlWriter.WriteFullEndElement();
}
xmlWriter.Close();

Monday, July 16, 2007

Thursday, July 12, 2007

Tuesday, July 10, 2007

Tuesday, July 03, 2007

Convert CString to LPBYTE

CString str = "la-la-la";
LPBYTE pByte = new BYTE[str.GetLength() + 1];
memcpy(pByte, (VOID*)LPCTSTR(str), str.GetLength());

Monday, July 02, 2007

Saturday, June 30, 2007

Convert LRESULT to LPARAM vc++ win32

LRESULT tt =12;
wchar_t buf[20];
_itow_s(tt,buf,20,10);
LPARAM lp = (LPARAM) buf;

Read key string from registry c++ win32

LPTSTR DStudioRegistry::GetStringValue(HKEY hKey, LPCWSTR key, LPCWSTR string)
{
DWORD dwType, dwSize;
HKEY hSubKey;
KString temp;
LPTSTR result;
BYTE buff[512];
if (RegOpenKeyEx(hKey, key, NULL, KEY_ALL_ACCESS ,&hSubKey)== ERROR_SUCCESS)
{
if (RegQueryValueExW(hSubKey, string , NULL, &dwType, buff, &dwSize) == ERROR_SUCCESS)
{
KString str( (LPCTSTR)buff);

result = str.m_sString;
}
}
RegCloseKey(hKey);
return result;
}

Read DWORD from registry c++ win32

DWORD DStudioRegistry::GetDWORDValue(HKEY hKey1, LPCWSTR key, LPCWSTR string)
{
DWORD dwSavePageSettings = 0;
HKEY hKey = NULL;
REGSAM sam = KEY_READ;
char* pszKey = "Software\\Microsoft\\Raja";

if ( ERROR_SUCCESS != RegOpenKeyEx ( hKey1, key, 0, sam, &hKey)) {

return dwSavePageSettings;

} else {

DWORD dwType = REG_DWORD;
DWORD dwSize = sizeof ( DWORD);
if ( ERROR_SUCCESS != RegQueryValueEx ( hKey, string, NULL, &dwType, ( LPBYTE) &dwSavePageSettings, &dwSize))
{
// error
}
}

RegCloseKey ( hKey);

return dwSavePageSettings;
}

How to convert BYTE array to CString

BYTE x[5];
x[0] = 'A';
x[1] = 0;
x[2] = 'B';
x[3] = 'C';
x[4] = 0;
CString str( (LPCSTR) &x, sizeof(x) );

Tuesday, June 12, 2007

Registry Key Creation using RegCreateKey

HKEY hKey;
LONG iSuccess = RegCreateKeyEx( HKEY_CURRENT_USER, L"SOFTWARE\\Raja", 0L,NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey,0);

Wednesday, June 06, 2007

Windows Mobile 5.0 Tweaks

Make WM5 keep CAB files around after installing (2)

An alternative method of making WM5 keep the original .CAB file around after installing the application is by adding the "/nodelete" option to the Windows CE loader:

HKCR\cabfile\Shell\open\command = 'wceload.exe "%1" /nodelete' (REGSZ string, no quotes)

An alternative method of making WM5 ask where to install a program is by adding the "/askdest" option to the Windows CE loader:

HKCR\cabfile\Shell\open\command = 'wceload.exe "%1" /askdest' (REG_SZ string, no quotes)

Brigthness

[HKEY_CURRENT_USER\ControlPanel\BackLight] - ACBrigthness [Dword] 1-6

[HKEY_CURRENT_USER\ControlPanel\BackLight] - BatteryBrigthness [Dword] 1-6

Show clock in task bar

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shell\TaskBar] LimitedClock [Dword] 0

To hide

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shell\TaskBar] LimitedClock [Dword] 1

Remove operator skin from Phone app to remove

[HKEY_LOCAL_MACHINE\Security\Phone\Skin] Enabled [DWord] 0

To show

[HKEY_LOCAL_MACHINE\Security\Phone\Skin] Enabled [DWord] 1