<?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>API Programming &#187; XP</title>
	<atom:link href="http://www.brangle.com/wordpress/tag/xp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brangle.com/wordpress</link>
	<description>Just another computer weblog</description>
	<lastBuildDate>Wed, 14 Dec 2011 07:35:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Make Your Computer Talk with VB.NET Application (and Source Code)</title>
		<link>http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-application-and-source-code/</link>
		<comments>http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-application-and-source-code/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 02:57:25 +0000</pubDate>
		<dc:creator>lopezg</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.brangle.com/wordpress/?p=502</guid>
		<description><![CDATA[I was playing around with COM objects in Windows and discovered that I could access the SAPI.SpVoice interface and make Microsoft Windows talk to me. Well needless to say I had to rush and develop and application to do just that. I uploaded a simple applicaton which will just say whatever you type in as an argument. For example <i>SpeakToMeConsole.exe Hello World</i> will make your computer speak the words "Hello World." The part that really amazes me is that the guts of this program is only 2 lines long, and it can even that can reduced down to 1 line if we create an anonymous instance of SAPI.SpVoice object. [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing around with COM objects in Windows and discovered that I could access the SAPI.SpVoice interface and make Microsoft Windows talk to me.  Well needless to say I had to rush and develop and application to do just that.  I uploaded a simple applicaton which will just say whatever you type in as an argument.  For example <i>SpeakToMeConsole.exe Hello World</i> will make your computer speak the words &#8220;Hello World.&#8221;  The part that really amazes me is that the guts of this program is only 2 lines long, and it can even that can reduced down to 1 line if we create an anonymous instance of SAPI.SpVoice object.<span id="more-502"></span></p>
<p>The reason I created it as a console application and not a windows app is because I envisioned this program only really only having a valid function when it&#8217;s called from another application. Or even better, you want to spook your girlfriend or parents by making their laptop talk to them when it turns on!  Whatever your reasons are, enjoy! Oh and let me know how you use this program in the comments.</p>
<div id="attachment_506" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.brangle.com/downloads/SpeakToMe/v1.0/SpeakToMeConsole.exe"><img src="http://www.brangle.com/wordpress/wp-content/uploads/2009/08/download-button.jpg" alt="Download SpeakToMe App" title="Download SpeakToMe App" width="150" height="144" class="size-full wp-image-506" /></a><p class="wp-caption-text">Download SpeakToMe App</p></div>
<p>Here is the complete source code to the above application. Let me know what you think in the comments!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">'This application was developed by Gerardo Lopez and was downloaded from www.brangle.com</span>
<span style="color: #008080; font-style: italic;">'Complete source code is available at:</span>
<span style="color: #008080; font-style: italic;">'http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-app-source-code/</span>
&nbsp;
&nbsp;
Module Module1
    <span style="color: #008080; font-style: italic;">'We want to make sure we grab any arguments as args so that we speak them    </span>
    <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> args <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #008080; font-style: italic;">'If there are no arguments UBound will return -1</span>
        <span style="color: #008080; font-style: italic;">'Therefore we want to make sure to let the user know how to run the app if </span>
        <span style="color: #008080; font-style: italic;">'they don't enter any arguments</span>
        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">UBound</span><span style="color: #000000;">&#40;</span>args<span style="color: #000000;">&#41;</span> &gt; <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span> <span style="color: #FF8000;">Then</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">'Generate an empty string, we'll use this to concatenate all of our arguments </span>
            <span style="color: #008080; font-style: italic;">'together so we can pass it to the narrator</span>
            <span style="color: #0600FF;">Dim</span> <span style="color: #FF8000;">input</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">'Concat all of our arguments together and make sure to put a space in </span>
            <span style="color: #008080; font-style: italic;">'between them so the words don't run together</span>
            <span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> arg <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> In args
                <span style="color: #FF8000;">input</span> <span style="color: #008000;">=</span> <span style="color: #FF8000;">input</span> <span style="color: #008000;">+</span> arg <span style="color: #008000;">+</span> <span style="color: #808080;">&quot; &quot;</span>
            <span style="color: #FF8000;">Next</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">'Create an object and gain access to the narrator</span>
            <span style="color: #0600FF;">Dim</span> voice <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;SAPI.SpVoice&quot;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #008080; font-style: italic;">'Tells the narrator what to say</span>
            voice.<span style="color: #0000FF;">Speak</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">input</span><span style="color: #000000;">&#41;</span>
        <span style="color: #FF8000;">Else</span>
            <span style="color: #008080; font-style: italic;">'The is where we tell the user what to say if they didn't enter any arguments</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;No arguments specified&quot;</span><span style="color: #000000;">&#41;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Try this instead: SpeakToMe.exe Hello World&quot;</span><span style="color: #000000;">&#41;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>vbCrLf <span style="color: #008000;">+</span> vbCrLf <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;Visit www.brangle.com for other apps&quot;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
<span style="color: #0600FF;">End</span> Module
<span style="color: #008080; font-style: italic;">'The End</span></pre></td></tr></table></div>

<p>To run this program from the command line, you can type in something like the following:</p>
<pre>SpeakToMeConsole.exe Hello World</pre>
<p>And here is the beautiful one-liner!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;SAPI.SpVoice&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Speak</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;hello from brangle.com&quot;</span><span style="color: #000000;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-application-and-source-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Shutdown, Restart, Log off your computer with VB.NET or C#</title>
		<link>http://www.brangle.com/wordpress/2009/08/how-to-shutdown-restart-log-off-your-computer-with-vb-net-or-c/</link>
		<comments>http://www.brangle.com/wordpress/2009/08/how-to-shutdown-restart-log-off-your-computer-with-vb-net-or-c/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 08:27:06 +0000</pubDate>
		<dc:creator>lopezg</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sever 2003]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.brangle.com/wordpress/?p=458</guid>
		<description><![CDATA[This is extremely easy using VB.NET or C# (pronounced C sharp) and using the built in windows EXE file <i>shutdown.exe</i>. To shutdown, restart, or log off your computer is as simple as entering 1 line into your program, it just so happens that the 1 line is identical whether you're using VB.NET or C#. [...]]]></description>
			<content:encoded><![CDATA[<p>This is extremely easy using VB.NET or C# (pronounced C sharp) and the built in windows EXE file <i>shutdown.exe</i>.  To shutdown, restart, or log off your computer is as simple as entering 1 line into your program, it just so happens that the 1 line is identical whether you&#8217;re using VB.NET or C#.<span id="more-458"></span></p>
<p>To shutdown/turn off your computer, just execute the following line of code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">System.Diagnostics.Process.Start(<span style="color: #800000;">&quot;shutdown.exe&quot;</span>, <span style="color: #800000;">&quot;-s -t 0&quot;</span>)</pre></td></tr></table></div>

<p>To restart/reboot your computer, just execute the following line of code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">System.Diagnostics.Process.Start(<span style="color: #800000;">&quot;shutdown.exe&quot;</span>, <span style="color: #800000;">&quot;-r -t 0&quot;</span>)</pre></td></tr></table></div>

<p>To log off your computer, just execute the following line of code (and yes, that&#8217;s a lowercase L, not the number 1):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">System.Diagnostics.Process.Start(<span style="color: #800000;">&quot;shutdown.exe&quot;</span>, <span style="color: #800000;">&quot;-l -t 0&quot;</span>)</pre></td></tr></table></div>

<p>The number zero at the end of each of those examples is how long the computer should wait in seconds before shutting down/restarting/etc&#8230; In this example, I&#8217;m going to shutdown the computer in 5 minutes (5 minutes * 60 seconds = 300 seconds)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">System.Diagnostics.Process.Start(<span style="color: #800000;">&quot;shutdown.exe&quot;</span>, <span style="color: #800000;">&quot;-s -t 300&quot;</span>)</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.brangle.com/wordpress/2009/08/how-to-shutdown-restart-log-off-your-computer-with-vb-net-or-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Add or Map a Custom Hostnames to IP Address without a DNS Server</title>
		<link>http://www.brangle.com/wordpress/2009/08/add-or-map-custom-hostnames-to-ip-address-without-dns-server/</link>
		<comments>http://www.brangle.com/wordpress/2009/08/add-or-map-custom-hostnames-to-ip-address-without-dns-server/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 07:32:14 +0000</pubDate>
		<dc:creator>lopezg</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iTouch]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Registry]]></category>
		<category><![CDATA[Sever 2003]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.brangle.com/wordpress/?p=400</guid>
		<description><![CDATA[There's been several times where I had an Apache server running locally on my computer as a development (or dev) server. Now if this is on my home network, or if your system administrator won't give you your own custom host name then you have to go the DIY (do it yourself) route. But, often times, I have to hard code host names, or I need several different websites hosted on my personal machine. Well that's where the <i>hosts</i> file comes into play. [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been several times where I had an Apache server running locally on my computer as a development (or dev) server.  Now if this is on my home network, or if your system administrator won&#8217;t give you your own custom host name then you have to go the DIY (do it yourself) route.  But, often times, I have to hard code host names, or I need several different websites hosted on my personal machine.  Well that&#8217;s where the <i>hosts</i> file comes into play.<span id="more-400"></span></p>
<p>Another example of needing a custom ip address is at my company, I&#8217;ve needed to check the status of a printer and if I want to try the access it via its hostname <i>http://printername</i> it wont work because the SysAdmin has shared the printer on the network without adding a custom dns host name, even though it has a static IP address on the network. So I added the name of each printer to my <i>hosts</i> file so now I have no problem accessing any printer via its name, without having to first look up its IP address.<!--more--></p>
<p>Also, if you intend to <b>block a website by its hostname</b> then this is also the solution for you.</p>
<p>You can find the <i>hosts</i> file in the following folder&#8230;<br />
Windows 95, 98, and ME in the %WinDir%\ directory<br />
NT, 2000, XP, 2003, Vista, 7 in the %SystemRoot%\system32\drivers\etc\ directory (%SystemRoot% is almost always C:\Windows)<br />
iPhone and iTouch in the /private/etc/hosts directory<br />
Linux in the /etc/hosts directory</p>
<p>Also, a note for 0.1% of Windows NT, 2000, XP, 2003, Vista, and Windows 7 users, the actual location may differ, to find the real location you&#8217;ll need to dig into the registry key, give the following a look up</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="regedit" style="font-family:monospace;">HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters</pre></td></tr></table></div>

<p> and look for the following string key <i>DataBasePath</i>.  On my computer it was declared as <i>%SystemRoot%\System32\drivers\etc</i>  I know that&#8217;s what I said it would be above, I just want all you SysAdmins to be aware of that 0.1% chance.</p>
<p>Lastly once, you finish making any modifications you&#8217;ll need to flush your locally cached DNS on your computer. </p>
<p>In WinXP you can edit the <i>c:\windows\system32\drivers\etc\hosts</i> file by opening it in notepad or any ascii text editor. By default the last line you&#8217;ll see is
<pre>127.0.0.1       localhost</pre>
<p> but other programs can change this.  The IP address 127.0.0.1 is always the ip address of the local computer.  It doesn&#8217;t matter if the computer has a different IP address on the network, 127.0.0.1 is considered a loop back address, in other words, it always points to your computer.</p>
<p>you can add a new hostname followed by the ip address in the text file that&#8217;s it, it&#8217;s just that simple!  Let&#8217;s add example.com to our local host names, now if we had apache installed, this ip address would always map to our computer just by adding the following line to the end of your <i>hosts</i> file&#8230; </p>
<pre>127.0.0.1    example.com</pre>
<p>Now what if you want to block a website like MySpace? Add the following line </p>
<pre>0.0.0.0       myspace.com</pre>
<p>The problem with this approach is it only blocks the hostname myspace.com, it leaves www.myspace.com and login.myspace.com completely accessible, and other hostname that I don&#8217;t know about (or worse yet, any future host names that they decide to add).  So let&#8217;s block all we we can by pointing them to a null IP address</p>
<pre>0.0.0.0       myspace.com
0.0.0.0       www.myspace.com
0.0.0.0       login.myspace.com</pre>
<p>Ok great, I added my login.myspace.com to the <i>hosts</i> file, but I can still access it, what gives?!? There is two possible fixes for this solution. First close all of your browsers, for example, if you can still access the domain in Internet Explorer or FireFox it&#8217;s because the IP address has been cached, close the browser so that the browser can &quot;forget&quot; the IP address.  Now before you reopen the application we also need to clear the DNS entry from Windows.  We can clear a DNS entry from windows by clicking <i>Start</i>, <i>Run</i> typing <i>ipconfig /flushdns</i> then clicking ok.  This will flush the ip address address stored by the operating system.  You should now by able to open FireFox and Internet Explorer and verify that they no longer have the IP address cached.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brangle.com/wordpress/2009/08/add-or-map-custom-hostnames-to-ip-address-without-dns-server/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

