How to check is your PC/ Server is connected to the internet.... there are more than one ways to do that - using wininet.dll, calling for DNS resolution, pinging a internet server, calling a web page and checking for response status and as I wanted to be sure that client is able to reach my server so put them all together.
Showing posts with label Microsoft. Show all posts
Showing posts with label Microsoft. Show all posts
Thursday, July 8, 2010
Friday, July 2, 2010
Multithreaded Singleton in C#
Many a times you run into scenario where only one instance of a class should be created in your application. If you need to know more about Singleton pattern, this article "Singleton pattern" provides good reading. There are quite a few ways to implement this (singleton) but after doing some search on the net found this one to be best for my case.
Tuesday, June 29, 2010
Get Unix Time/ POSIX Time in c#
Recently needed to convert the time into Unix format in C#. Since the Unix time format is basically a count of the seconds passed since 1/1/1970 (Unix epoch), this can be easily done using the DateTime object.
If you are trying to convert some other DateTime value to POSIX time, make sure that it is first converted to UTC.
int unixTime = (int) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
If you are trying to convert some other DateTime value to POSIX time, make sure that it is first converted to UTC.
Labels:
.Net,
C#,
csharp,
Microsoft,
POSIX time,
unix epoch,
utc
Casting int or string to Enum
Quick note to myself :D
From a string:
From an int:
From a string:
MyEnum foo = (MyEnum) Enum.Parse(typeof(MyEnum), yourString);
From an int:
MyEnum foo = (MyEnum) yourInt;
Monday, June 28, 2010
Windows 7 - "New txt file" missing from right click menu
Few days back realized that somehow I managed to loose the "New txt file" option in the context menu 8O . To fix this
1. Download the fix file given below. (Use Right-click – Save as option in your browser to download the file.)
1. Download the fix file given below. (Use Right-click – Save as option in your browser to download the file.)
Labels:
context menu,
Microsoft,
missing,
new text file,
notepad,
windows,
Windows 7,
windows7
Wednesday, January 28, 2009
Problem Installing Windows CE 6 Platform Builder SP1
While installing Windows CE 6 Platform Builder, I ran into a problem. When I tried to install the SP1, it gave an error saying that I need to have CS 2005, VS 2005 SP1 and Windows CE6 installed. This seemed kind of funny as I had already all three installed. Googling led me to a thread where someone mentioned that installing Windows CE 6, breaks something in the VS 2005 SP1 and reinstalling SP1 should fix it. Tried that and after an agonizing 30 minutes, when I ran the PB SP1 again, no more error message.
Labels:
CE PB6,
Embedded,
installation,
Microsoft,
PB6,
Windows CE,
Windows CE6
Subscribe to:
Posts (Atom)