<?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>Reality Bytes &#187; Programming</title>
	<atom:link href="http://jreflores.net/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://jreflores.net</link>
	<description>Stepping into reality...</description>
	<lastBuildDate>Tue, 07 Sep 2010 08:58:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>C# Prank Program: Making use of PC Speaker and CD ROM Drive</title>
		<link>http://jreflores.net/2009/guides/c-prank-program-making-use-of-pc-speaker-and-rom-drive/</link>
		<comments>http://jreflores.net/2009/guides/c-prank-program-making-use-of-pc-speaker-and-rom-drive/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 06:42:11 +0000</pubDate>
		<dc:creator>jesh</dc:creator>
				<category><![CDATA[Guides]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C# .NET]]></category>
		<category><![CDATA[cd rom]]></category>
		<category><![CDATA[pc speaker]]></category>
		<category><![CDATA[prank]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://jreflores.wordpress.com/?p=112</guid>
		<description><![CDATA[I created this prank program (just for fun) and also at the same time, learn controlling hardware devices, through C#.NET. This program is quite simple; as soon as the program starts, your disc tray ejects and closes and the PC speaker beeps for a second, and this entire routine is executed endlessly. Of course, it [...]


Related posts:<ol><li><a href='http://jreflores.net/2008/guides/a-simple-checklist-guide-in-web-and-application-development/' rel='bookmark' title='Permanent Link: A Simple Checklist Guide in Web and Application Development'>A Simple Checklist Guide in Web and Application Development</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I created this prank program (just for fun) and also at the same time, learn controlling hardware devices, through <a href="http://msdn.microsoft.com/en-us/vcsharp/default.aspx">C#.NET</a>. This program is quite simple; as soon as the program starts, your disc tray ejects and closes and the PC speaker beeps for a second, and this entire routine is executed endlessly. Of course, it ends if the application closes/exits.</p>
<p>For this program, you will need to import the following:</p>
<pre class="brush: csharp;">
    using System.Runtime.InteropServices;
    using System.Text;
</pre>
<p>Next, insert this block of code inside your C# class and outside any method:</p>
<pre class="brush: csharp;">
[DllImport(&quot;winmm.dll&quot;, EntryPoint = &quot;mciSendStringA&quot;, CharSet = CharSet.Ansi)]
protected static extern int mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, IntPtr hwndCallback);

[DllImport(&quot;KERNEL32.DLL&quot;, EntryPoint = &quot;Beep&quot;)]
public static extern bool Beep(int tone, int length);
</pre>
<p>Lastly, key in this code in your Main() or any method that you wish to call to trigger the opening and closing of cd tray and beeping of the speaker:</p>
<pre class="brush: csharp;">
while (true)
{
    int ret = mciSendString(&quot;set cdaudio door open&quot;, null, 0, IntPtr.Zero);
    Beep(1000, 1000);
    ret = mciSendString(&quot;set cdaudio door closed&quot;, null, 0, IntPtr.Zero);
    Beep(1000, 1000);
}
</pre>
<p>There you have it. Basically, the important part of this program is when you make the CD ROM drive open and close and the PC Speaker beep. You can use this minor code block in the second and last blockquotes to any program that you wish to make. I just made this tutorial fun and enjoying. Learning is best when it is fun. :)</p>


<p>Related posts:<ol><li><a href='http://jreflores.net/2008/guides/a-simple-checklist-guide-in-web-and-application-development/' rel='bookmark' title='Permanent Link: A Simple Checklist Guide in Web and Application Development'>A Simple Checklist Guide in Web and Application Development</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://jreflores.net/2009/guides/c-prank-program-making-use-of-pc-speaker-and-rom-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The World of &#8220;Hello World&#8221;.</title>
		<link>http://jreflores.net/2007/programming/the-world-of-hello-world/</link>
		<comments>http://jreflores.net/2007/programming/the-world-of-hello-world/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 04:26:00 +0000</pubDate>
		<dc:creator>jesh</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[hello world]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://jreflores.wordpress.com/2007/12/07/the-world-of-hello-world/</guid>
		<description><![CDATA[They say that conquering the world of the &#8220;Hello World&#8221; problem brings you to the edge of learning new programming languages. A-B-C steps of learning programming languages always starts with the question &#8220;How do i produce an output?&#8221; Most programming tutorials always start with the simple exercise of producing the &#8220;Hello World&#8221; output. In this [...]


Related posts:<ol><li><a href='http://jreflores.net/2009/guides/c-prank-program-making-use-of-pc-speaker-and-rom-drive/' rel='bookmark' title='Permanent Link: C# Prank Program: Making use of PC Speaker and CD ROM Drive'>C# Prank Program: Making use of PC Speaker and CD ROM Drive</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>They say that conquering the world of the &#8220;Hello World&#8221; problem brings  you to the edge of learning new programming languages. A-B-C steps of learning programming languages always starts with the  question &#8220;How do i produce an output?&#8221; Most programming tutorials always start with the simple exercise of producing the &#8220;Hello World&#8221;  output. In this entry, I am to teach and share to you how to output the  most basic &#8220;Hello World&#8221; string in some of the commonly used applications for console and for web.</p>
<p><span style="font-weight:bold;">JAVA:</span>
<p style="font-family:courier new;"><span style="font-size:85%;">import java.io.*;<br />public class MyProgram{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public static void main(String[] args) throws IOException{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&#8220;Hello World!&#8221;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</span></p>
<p><span style="font-weight:bold;">C#:</span>
<p><span style="font-size:85%;"><span style="font-family:courier new;">using System ;</span><br /><span style="font-family:courier new;">class MyProgram{</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public static void main(String[] args){</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.Write(&#8220;Hello World!&#8221;);</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br /><span style="font-family:courier new;">}</span></span> </p>
<p><span style="font-weight:bold;">C:</span>
<p><span style="font-size:85%;"><span style="font-family:courier new;">#include &lt;stdio.h&gt;</span><br /><span style="font-family:courier new;">int main (){</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(&#8220;Hello World!&#8221;);</span></p>
<p><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return 0;</span><br /><span style="font-family:courier new;">}</span></span></p>
<p><span style="font-weight:bold;">C++:</span>
<p style="font-family:courier new;"><span style="font-size:85%;">#include &lt;iostream&gt;<br />using namespace std;<br />int main (){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;&#8221;Hello World!&#8221;&lt;&lt;endl;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />}</span> </p>
<p><span style="font-weight:bold;">VB:</span>
<p><span style="font-size:85%;"><span style="font-family:courier new;">Imports System</span><br /><span style="font-family:courier new;">Public Sub Main ()</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(&#8220;Hello World!&#8221;)</span><br /><span style="font-family:courier new;">End Sub</span></span></p>
<p><span style="font-weight:bold;">JSP/ASP:</span>
<p><span style="font-size:85%;"><span style="font-family:courier new;">&lt;html&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;head&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;My WebPage&lt;/title&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/head&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;body&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;%= Hello World! %&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/body&gt;</span><span style="font-family:courier new;">&lt;/html&gt;</span></span> </p>
<p><span style="font-weight:bold;">PHP:</span>
<p><span style="font-size:85%;"><span style="font-family:courier new;">&lt;html&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;head&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;My WebPage&lt;/title&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/head&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;body&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php echo &#8220;Hello World!&#8221;; ?&gt;</span><br /><span style="font-family:courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/body&gt;</span><br /><span style="font-family:courier new;">&lt;/html&gt;</span></span> </p>
<p></p>


<p>Related posts:<ol><li><a href='http://jreflores.net/2009/guides/c-prank-program-making-use-of-pc-speaker-and-rom-drive/' rel='bookmark' title='Permanent Link: C# Prank Program: Making use of PC Speaker and CD ROM Drive'>C# Prank Program: Making use of PC Speaker and CD ROM Drive</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://jreflores.net/2007/programming/the-world-of-hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
