<?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/"
	>

<channel>
	<title>Samuel Haddad &#187; C#</title>
	<atom:link href="http://samuelhaddad.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://samuelhaddad.com</link>
	<description></description>
	<lastBuildDate>Thu, 09 Sep 2010 06:17:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Find Dell Service Tag with C#.NET</title>
		<link>http://samuelhaddad.com/2009/08/15/find-dell-service-tag-with-c-net/</link>
		<comments>http://samuelhaddad.com/2009/08/15/find-dell-service-tag-with-c-net/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 03:13:04 +0000</pubDate>
		<dc:creator>Samuel Haddad</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Dell]]></category>
		<category><![CDATA[Express Service Code]]></category>
		<category><![CDATA[Serial Number]]></category>
		<category><![CDATA[Service Tag]]></category>
		<category><![CDATA[Tech Support]]></category>
		<category><![CDATA[Win32 Bios]]></category>
		<category><![CDATA[Windows  Managment Instrumentation]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://samuelhaddad.com/?p=418</guid>
		<description><![CDATA[In my line of work, I deal with a lot of Dell computers. I decided to write a little program that I could carry on my flash drive with me and all my other technical applications. What I like most about this application is the ability to quickly get to the Dell Warranty and driver [...]]]></description>
			<content:encoded><![CDATA[<p>In my line of work, I deal with a lot of Dell computers. I decided to write a little program that I could carry on my flash drive with me and all my other technical applications. What I like most about this application is the ability to quickly get to the Dell Warranty and driver information. I hope that someone else find this useful as well, if you do let me know.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-433" title="DellServiceTagFinder" src="http://samuelhaddad.com/wp-content/uploads/2009/08/DellServiceTagFinder.png" alt="DellServiceTagFinder" width="238" height="120" /></p>
<p style="text-align: center;">Download Dell Service Tag Finder: <a href="http://samuelhaddad.com/wp-content/uploads/2009/08/DellServiceTag.zip">Source</a> | <a href="http://samuelhaddad.com/wp-content/uploads/2009/08/DellServiceTag.exe">Executable</a></p>
<p style="TEXT-ALIGN: left">This is was possible using <a href="http://msdn.microsoft.com/en-us/library/aa394582(VS.85).aspx" target="_blank">Windows Management Instrumentation </a>and if you are interested in pulling other information from your computer I recommend you read up on it. For this example I used the <a href="http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx" target="_blank">Win32_BIOS Class</a>, but you can find all the <a href="http://msdn.microsoft.com/en-us/library/aa394554(VS.85).aspx" target="_self">WMI Classes here</a>.</p>
<h2 style="text-align: left;">Preview of Source:</h2>
<pre class="brush: csharp;">
        String dellServiceTag;

        private void Form1_Load(object sender, EventArgs e)
        {
            //Load Service Tag
            ManagementClass wmi = new ManagementClass(&quot;Win32_Bios&quot;);
            foreach (ManagementObject bios in wmi.GetInstances())
            {
                dellServiceTag = bios.Properties[&quot;Serialnumber&quot;].Value.ToString().Trim();
            }
            Display.Text = dellServiceTag;
        }
</pre>
<h3>Notes:</h3>
<p>This application requires the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&amp;displaylang=en" target="_blank">.NET Framework </a>or you may receive application errors.</p>
<p>The service tag is pulled from the BIOS so if you ever had your motherboard replaced and the service tag was not reset it will be blank.</p>
]]></content:encoded>
			<wfw:commentRss>http://samuelhaddad.com/2009/08/15/find-dell-service-tag-with-c-net/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Creating a Single Instance C# Application</title>
		<link>http://samuelhaddad.com/2009/05/19/creating-a-single-instance-c-application/</link>
		<comments>http://samuelhaddad.com/2009/05/19/creating-a-single-instance-c-application/#comments</comments>
		<pubDate>Wed, 20 May 2009 00:51:13 +0000</pubDate>
		<dc:creator>Samuel Haddad</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Mutex]]></category>
		<category><![CDATA[Single Instance]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://samuelhaddad.com/?p=385</guid>
		<description><![CDATA[This is something I find myself looking up alot so I decided to put it into a post for easy access, and for anyone else who might be looking for a solution. using System.Threading;     static class Program     {         /// &#60;summary&#62;         /// The main entry point for the application.         /// &#60;/summary&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This is something I find myself looking up alot so I decided to put it into a post for easy access, and for anyone else who might be looking for a solution. </p>
<pre class="brush: csharp;">using System.Threading;</pre>
<pre class="brush: csharp;">
    static class Program
    {
        /// &lt;summary&gt;
        /// The main entry point for the application.
        /// &lt;/summary&gt;
        [STAThread]
        static void Main()
        { 

            bool createdNew = true;
            using (Mutex mutex = new Mutex(true, &quot;SignleInstance&quot;, out createdNew))
            {
                if (createdNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new Form1());
                }
            }

        }
    }
</pre>
<p><a href='http://samuelhaddad.com/wp-content/uploads/2009/05/singleinstance.zip'>Download Single Instance Application Source Code</a></p>
<p>I still don&#8217;t get why in Visual Studio in VB.NET one could click make single instance application, but that same feature doesn&#8217;t exist in C#? Don&#8217;t all .NET languages just get compiled to the CIL in the end?</p>
]]></content:encoded>
			<wfw:commentRss>http://samuelhaddad.com/2009/05/19/creating-a-single-instance-c-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# .NET and LyricWiki to lookup lyrics</title>
		<link>http://samuelhaddad.com/2009/03/22/c-net-and-lyricwiki-to-lookup-lyrics/</link>
		<comments>http://samuelhaddad.com/2009/03/22/c-net-and-lyricwiki-to-lookup-lyrics/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 03:03:32 +0000</pubDate>
		<dc:creator>Samuel Haddad</dc:creator>
				<category><![CDATA[Desktop Enginnering]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[LyricsWiki]]></category>
		<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://samuelhaddad.com/?p=204</guid>
		<description><![CDATA[Music is everywhere with today&#8217;s high speed internet is most home it is no wonder that music is even moving to the World Wide Web. Many radio stations allow you to stream their stations over the internet. Many websites have been developed around music, like www.jango.com, www.pandora.com, and www.last.fm. I recently released my second version [...]]]></description>
			<content:encoded><![CDATA[<p>Music is everywhere with today&#8217;s high speed internet is most home it is no wonder that music is even moving to the World Wide Web. Many radio stations allow you to stream their stations over the internet. Many websites have been developed around music, like <a href="http://www.jango.com/">www.jango.com</a>, <a href="http://www.pandora.com/">www.pandora.com</a>, and <a href="http://www.last.fm/">www.last.fm</a>. I recently released my second version of <a href="../../../../../software-projects/jango-desktop/">Jango Desktop</a> and one of the features I implemented was the ability to look up lyrics. Before I started I was thinking about all the ways I could parse the lyrics out of an existing lyric&#8217;s websites database. During my searching I stumbled upon <a href="http://lyricwiki.org/">http://lyricwiki.org/</a>. Here is a small description of LyricWiki from the website:</p>
<p>LyricWiki is a free site which is a source where anyone can go to get reliable lyrics for any song, from any artist, without being hammered by invasive ads.</p>
<p>At this point you are probably thinking to yourself the same thing I did &#8220;Great, but where do I start?&#8221; So today I am writing a step by step tutorial on how to use Lyric wiki in your .NET program.</p>
<h2>Creating a simple lyric demo program:</h2>
<div id="attachment_249" class="wp-caption alignnone" style="width: 666px"><img class="size-full wp-image-249" title="Step 1 Create the Form" src="http://samuelhaddad.com/wp-content/uploads/2009/03/step11.jpg" alt="Step 1 Create the Form" width="656" height="370" /><p class="wp-caption-text">Step 1: Create the Form</p></div>
<p>Open visual studio and setup your form to look similar to mine.</p>
<h3>Adding the web service:</h3>
<p>Because LyricWiki offers a web service, you will want to add it to your program as a web reference.   Right click on your solution and select add a web reference, or in .net 3.5 add a service reference -&gt; then go to advance and add a web reference. The service&#8217;s URL is <a href="http://lyricwiki.org/server.php?wsdl">http://lyricwiki.org/server.php?wsdl</a> you will want to add it like below if you press go you should see the available methods.</p>
<div id="attachment_251" class="wp-caption alignnone" style="width: 835px"><img class="size-full wp-image-251" title="Adding a Web Reference" src="http://samuelhaddad.com/wp-content/uploads/2009/03/step21.jpg" alt="Adding a Web Reference" width="825" height="572" /><p class="wp-caption-text">Adding a Web Reference</p></div>
<h3>Writing the code:</h3>
<p>Double click on your button on the form and let&#8217;s right some code to handle the lookup.</p>
<p>Add this to the top of your code:</p>
<pre class="brush: csharp;">

using LyricsLookup.org.lyricwiki;
</pre>
<p>Then add this to the button clicked method:</p>
<pre class="brush: csharp;">

private void LyricsButton_Click(object sender, EventArgs e)

{

LyricWiki wiki = new LyricWiki();

LyricsResult result;

string artist = artistTextBox.Text;

string song =   SongTextBox.Text;

if(wiki.checkSongExists(artist,song))

{

result = wiki.getSong(artist, song);

Encoding iso8859 = Encoding.GetEncoding(&quot;ISO-8859-1&quot;);

LyricsRichTextBox.Text = Encoding.UTF8.GetString(iso8859.GetBytes(result.lyrics));

}else{

StatusLabel.Text = &quot;Lyrics not found in database&quot;;

}

}
</pre>
<p>Then run and test.</p>
<p><a href="http://samuelhaddad.com/wp-content/uploads/2009/03/LyricsLookup.zip">Download the full solution of LyricsLookup</a></p>
]]></content:encoded>
			<wfw:commentRss>http://samuelhaddad.com/2009/03/22/c-net-and-lyricwiki-to-lookup-lyrics/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
