<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>1001hacks's Weblog</title>
	<atom:link href="http://1001hacks.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://1001hacks.wordpress.com</link>
	<description>hacks that never end..</description>
	<lastBuildDate>Sat, 08 Mar 2008 15:47:15 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='1001hacks.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/14d1f5c38f27f5720ba900a7150cd197?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>1001hacks's Weblog</title>
		<link>http://1001hacks.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://1001hacks.wordpress.com/osd.xml" title="1001hacks&#8217;s Weblog" />
		<item>
		<title>Dilaogs with timed self destruct</title>
		<link>http://1001hacks.wordpress.com/2008/02/28/dilaogs-with-timed-self-destruct/</link>
		<comments>http://1001hacks.wordpress.com/2008/02/28/dilaogs-with-timed-self-destruct/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 13:06:46 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[csharp]]></category>

		<guid isPermaLink="false">http://1001hacks.wordpress.com/?p=13</guid>
		<description><![CDATA[My colleague came to me today with the following question: &#8220;How can I inform the user using a MessageBox in a separate thread while the main thread continues working ?&#8221;
Since I did not found a direct answer hidden in some corner in my brain, we took  a dive in internet together, found some golden [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=13&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>My colleague came to me today with the following question: <i>&#8220;How can I inform the user using a MessageBox in a separate thread while the main thread continues working ?&#8221;</i></p>
<p>Since I did not found a direct answer hidden in some corner in my brain, we took  a dive in internet together, found some golden fish, and cooked the following recipe:</p>
<p>First we create a minimalistic Form with the needed functionality for timed self  destruct :</p>
<pre class="brush: csharp;">
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;

namespace hacks.wordpress.com
{
    public class TimedDialog : System.Windows.Forms.Form
    {
        public TimedDialog()
        {
            this.InitializeComponent();
        }

        private void InitializeComponent()
        {
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = &quot;I am a mission impossible message&quot;;
        }

        public void ShowTimedDialog(int time)
        {
            //{{ Setup and start the timer
            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = time;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Enabled = true;
            //}}

            base.ShowDialog();
        }

        void timer_Tick(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}</pre>
<p>Now we use the new created dialog in our main application</p>
<pre class="brush: csharp;">
public class MainApplication
{
    public static void Main(string[] args)
    {
       Console.WriteLine(&quot;1&quot;);
       Thread mainThread = new Thread(new ThreadStart(MainApplication.startTimedDialog));
       mainThread.Start();
       Console.WriteLine(&quot;2&quot;);
       Console.WriteLine(&quot;3&quot;);

    }
    private static startTimedDialog()
    {
        TimedDialog timedDialog = new TimedDialog();
        timedDialog.ShowTimedDialog(5000);
    }
}</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=13&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/02/28/dilaogs-with-timed-self-destruct/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
		<item>
		<title>Notepad++ Demo : Regular Expressions</title>
		<link>http://1001hacks.wordpress.com/2008/02/27/notepad-demo-regular-expressions/</link>
		<comments>http://1001hacks.wordpress.com/2008/02/27/notepad-demo-regular-expressions/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 09:38:16 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[Notepad++]]></category>

		<guid isPermaLink="false">http://1001hacks.wordpress.com/?p=12</guid>
		<description><![CDATA[I have started today a series of demos to show waht Notepad++ hides under the hood. My first demo is an image slideshow that demonstrates the usage of regular expressions.
Slideshow on Picassa 
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=12&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have started today a series of demos to show waht Notepad++ hides under the hood. My first demo is an image slideshow that demonstrates the usage of regular expressions.</p>
<p><a href="http://picasaweb.google.com/1001hacks/NotepadRegularExpressions/photo#s5171585653351736546">Slideshow on Picassa </a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=12&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/02/27/notepad-demo-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
		<item>
		<title>Use any font for LaTeX..</title>
		<link>http://1001hacks.wordpress.com/2008/02/20/use-any-font-for-latex/</link>
		<comments>http://1001hacks.wordpress.com/2008/02/20/use-any-font-for-latex/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 15:00:23 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Pdf]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1001hacks.wordpress.com/?p=9</guid>
		<description><![CDATA[LaTeX is  a fantastic  publishing system. I use it as often as I can. However, when you use it for a long time, the few beautiful fonts available with a standard installation are getting boring. I tried in the past hacks like converting TTF fonts into a LaTeX understandable format, but I was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=9&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>LaTeX is  a fantastic  publishing system. I use it as often as I can. However, when you use it for a long time, the few beautiful fonts available with a standard installation are getting boring. I tried in the past hacks like converting TTF fonts into a LaTeX understandable format, but I was not really successful at that.</p>
<p>Well, today I discovered XeTeX: A LaTeX compiler that generates pdf documents  with support to any font installed on windows machine <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ! I checked that and it was as simple as promissed:</p>
<ul>
<li> download and install <a href="http://miktex.org/2.7/Setup.aspx">MikTeX 2.7</a></li>
<li>download the <a href="http://1001hacks.googlepages.com/xetex-demo.zip">example</a> I created</li>
<li>run run.cmd</li>
<li>enjoy <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=9&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/02/20/use-any-font-for-latex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
		<item>
		<title>The most useful short keys for VisualStudio C#</title>
		<link>http://1001hacks.wordpress.com/2008/02/18/the-most-useful-short-keys-for-visualstudio-c/</link>
		<comments>http://1001hacks.wordpress.com/2008/02/18/the-most-useful-short-keys-for-visualstudio-c/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 10:34:13 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[csharp]]></category>

		<guid isPermaLink="false">http://1001hacks.wordpress.com/?p=7</guid>
		<description><![CDATA[This list is sticked right on my monitor. It contains the most useful short keys I really use frequently to increase productivity  in VisualStudio C#


Code Generation
&#160;


Ctrl + R + E
generates getters and setters for a property


Shift + Alt + F10
adds a using statement


Code Navigation
&#160;


Ctrl + M + M
toggles any tag :method, region, class etc. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=7&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This list is sticked right on my monitor. It contains the most useful short keys I really use frequently to increase productivity  in VisualStudio C#</p>
<table border="0">
<tr bgcolor="#990099">
<td><font color="white"><b>Code Generation</b></font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><code><b><font color="#3300bb">Ctrl + R + E</font></b></code></td>
<td>generates getters and setters for a property</td>
</tr>
<tr>
<td><code><b><font color="#3300bb">Shift + Alt + F10</font></b></code></td>
<td>adds a using statement</td>
</tr>
<tr bgcolor="#990099">
<td><font color="white"><b>Code Navigation</b></font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><code><b><font color="#3300bb">Ctrl + M + M</font></b></code></td>
<td>toggles any tag :method, region, class etc. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  (my favourite)</td>
</tr>
<tr>
<td><code><b><font color="#3300bb">Shift + F12</font></b></code></td>
<td>finds all references to a avariable</td>
</tr>
<tr>
<td><code><b><font color="#3300bb">F12</font></b></code></td>
<td>goes to variable definition</td>
</tr>
<tr bgcolor="#990099">
<td><font color="white"><b>Text Editing</b></font></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><code><b><font color="#3300bb">Ctrl + L</font></b></code></td>
<td>cuts a line</td>
</tr>
</table>
<p>Those short keys are in available in my newly created the reference card : <a href="http://1001hacks.files.wordpress.com/2008/02/visual-studio-refcard.pdf" title="MS Visual Studio C# Reference Card">MS Visual Studio C# Reference Card</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=7&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/02/18/the-most-useful-short-keys-for-visualstudio-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
		<item>
		<title>LockImage project added to google code</title>
		<link>http://1001hacks.wordpress.com/2008/02/05/lockimage-project-added-to-google-code/</link>
		<comments>http://1001hacks.wordpress.com/2008/02/05/lockimage-project-added-to-google-code/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 13:09:33 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[csharp]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://1001hacks.wordpress.com/?p=5</guid>
		<description><![CDATA[Finally I got my open source project LockImage started on google code. Read more and download it form  LockImage
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=5&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Finally I got my open source project LockImage started on google code. Read more and download it form  <a href="http://code.google.com/p/lockimage">LockImage</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=5&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/02/05/lockimage-project-added-to-google-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
		<item>
		<title>Master c# enum with System.Enum.Parse</title>
		<link>http://1001hacks.wordpress.com/2008/01/09/master-c-enum-with-systemenumparse/</link>
		<comments>http://1001hacks.wordpress.com/2008/01/09/master-c-enum-with-systemenumparse/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 16:37:04 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[csharp]]></category>

		<guid isPermaLink="false">http://1001hacks.wordpress.com/2008/01/09/master-c-enum-with-systemenumparse/</guid>
		<description><![CDATA[[This post has been updated! please go to the end of it to check the update]
We start with a typical enum in C#:

public enum WEEK_DAY : byte
{
 MONDAY    = 0x01,
 TUESDAY   = 0x02,
 WEDNESDAY = 0x03,
 THURSDAY  = 0x04,
 FRIDAY    = 0x05,
 SATURDAY  = 0x06,
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=4&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>[<i>This post has been updated! please go to the end of it to check the update</i>]</p>
<p>We start with a typical enum in C#:</p>
<pre class="brush: csharp;">
public enum WEEK_DAY : byte
{
 MONDAY    = 0x01,
 TUESDAY   = 0x02,
 WEDNESDAY = 0x03,
 THURSDAY  = 0x04,
 FRIDAY    = 0x05,
 SATURDAY  = 0x06,
 SUNDAY    = 0x07
}</pre>
<p>With <code>System.Enum.Parse</code> you can do the following:</p>
<pre class="brush: csharp;">
/*
 * Converting a numeric value to an enum name
 */
byte numericValue = 0x04;
WEEK_DAY dayOfTheWeek = (WEEK_DAY)
							(
								System.Enum.Parse
								(
								typeof(WEEK_DAY),
								numericValue.ToString()
								)
							);

/*
 * Freindly printing of enum names
 */
// this will print &quot;THURSDAY&quot;
Console.WriteLine(dayOfTheWeek.ToString());</pre>
<p>Update:I found today in this <a href="http://blogs.msdn.com/abhinaba/archive/2005/10/20/483000.aspx">post</a> a  simpler way to format and print out an enumeration entry:</p>
<pre class="brush: csharp;">
            Console.WriteLine(WEEK_DAY.FRIDAY.ToString(&quot;G&quot;)); // Friday  (String)
            Console.WriteLine(WEEK_DAY.FRIDAY.ToString(&quot;F&quot;)); // Friday  (String)
            Console.WriteLine(WEEK_DAY.FRIDAY.ToString(&quot;X&quot;)); // 05      (Hex)
            Console.WriteLine(WEEK_DAY.FRIDAY.ToString(&quot;D&quot;)); // 5       (Decimal)</pre>
<pre>I found it in this</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=4&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/01/09/master-c-enum-with-systemenumparse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
		<item>
		<title>Work easly with bit masks in c#</title>
		<link>http://1001hacks.wordpress.com/2008/01/03/work-easly-with-bit-masks-in-c/</link>
		<comments>http://1001hacks.wordpress.com/2008/01/03/work-easly-with-bit-masks-in-c/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 15:05:34 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[csharp]]></category>

		<guid isPermaLink="false">http://1001hacks.wordpress.com/2008/01/03/work-easly-with-bit-masks-in-c/</guid>
		<description><![CDATA[Lately I got confronted with inserting and reading selections from a byte value using bit masks. I wrote the following class that makes it  easier to deal with such operations for bytes. It can be extended for other types (short, int,..)

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

namespace Sandbox
{
    public class ByteBitVector
    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=3&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Lately I got confronted with inserting and reading selections from a byte value using bit masks. I wrote the following class that makes it  easier to deal with such operations for bytes. It can be extended for other types (short, int,..)</p>
<pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Text;

namespace Sandbox
{
    public class ByteBitVector
    {
        private byte value;

        public byte Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

        public ByteBitVector(byte value)
        {
            this.value = value;
        }

        public ByteBitVector()
        {
            this.value = 0x0000;
        }

        public void InsertSection(byte section, String mask)
        {
            this.checkMask(mask);
            Console.WriteLine(&quot;mask= &quot; + mask);

            Console.WriteLine(&quot;this.getShift(mask)= &quot; + this.getShift(mask));
            Console.WriteLine(&quot;section= &quot; + Convert.ToString(section,2));

            this.value += (byte)(section &lt;&lt; this.getShift(mask));
        }

        public byte GetSection(String mask)
        {
            this.checkMask(mask);
            /*
 		 * String mask         = &quot;-xx----&quot;
 		 * String maskAsBitStr = &quot;0110000&quot;
 		*  Byte   maskAsByte   = (byte) 0110000 = 0x30
 		*/ 

            String maskAsBitStr = String.Empty;
            maskAsBitStr = mask.Replace('-', '0');
            maskAsBitStr = maskAsBitStr.Replace('x', '1');
            byte maskAsByte = Convert.ToByte(maskAsBitStr, 2);

            return (byte)(((this.value) &amp; maskAsByte) &gt;&gt; this.getShift(mask));
        }

        private void checkMask(String mask)
        {
            if (8 != mask.Length)
            {
                throw new Exception(&quot;The mask length must be exactly 8!&quot;);
            }
            foreach (char c  in mask)
         {
                if ((c != '-') &amp;&amp; (c != 'x'))
                {
                    throw new Exception(&quot;Wrong format for mask! Accepted format: ---xx---&quot;);
                }
         }
        }

        private byte getShift(String mask)
        {
            return (byte)((8-1) - mask.LastIndexOf('x'));
        }

        public void Main(String arg[])
 	{

             ByteBitVector v = new ByteBitVector();
 	     String a_mask = &quot;xx------&quot;;
 	     String b_mask = &quot;--xxxx--&quot;;
 	     String c_mask = &quot;------x-&quot;;
 	     String d_mask = &quot;-------x&quot;;

             /* sections to insert and read */
	     byte a = 0x3; //00000011
 	     byte b = 0XB; //00001011
 	     byte c = 0x1; //00000001
 	     byte d = 0x1; //00000001

             /*  inserting sections  */
 	    			         // v.Value = 0000 0000
 	     v.InsertSection(a, a_mask); // v.Value = 1100 0000
 	     v.InsertSection(b, b_mask); // v.Value = 1110 1100
 	     v.InsertSection(c, c_mask); // v.Value = 1110 1110
 	     v.InsertSection(d, d_mask); // v.Value = 1110 1111

            /*  reading sections  */
 	     Console.WriteLine(&quot;v.GetSection(a_mask) = &quot; + Convert.ToString(v.GetSection(a_mask), 2)); //00000011 = a
 	     Console.WriteLine(&quot;v.GetSection(b_mask) = &quot; + Convert.ToString(v.GetSection(b_mask), 2)); //00001011 = b
 	     Console.WriteLine(&quot;v.GetSection(c_mask) = &quot; + Convert.ToString(v.GetSection(c_mask), 2)); //00000001 = c
 	     Console.WriteLine(&quot;v.GetSection(d_mask) = &quot; + Convert.ToString(v.GetSection(d_mask), 2)); //00000001 = d

	}
    }
}</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=3&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/01/03/work-easly-with-bit-masks-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://1001hacks.wordpress.com/2008/01/03/hello-world/</link>
		<comments>http://1001hacks.wordpress.com/2008/01/03/hello-world/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 14:21:10 +0000</pubDate>
		<dc:creator>1001hacks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=1&subd=1001hacks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/1001hacks.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/1001hacks.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1001hacks.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1001hacks.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1001hacks.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1001hacks.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1001hacks.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1001hacks.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1001hacks.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1001hacks.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1001hacks.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1001hacks.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1001hacks.wordpress.com&blog=2438830&post=1&subd=1001hacks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://1001hacks.wordpress.com/2008/01/03/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25c74d5548b08e8f7fe5042e88f2bbe3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1001hacks</media:title>
		</media:content>
	</item>
	</channel>
</rss>