<?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>Zero Intellect &#187; range</title>
	<atom:link href="http://www.zerointellect.com/tag/range/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zerointellect.com</link>
	<description>Technology Blog requiring Zero Intellect to follow !!!</description>
	<lastBuildDate>Mon, 28 Jun 2010 14:09:18 +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>Information gathering from your own network</title>
		<link>http://www.zerointellect.com/networking/information-gathering-from-your-own-network/</link>
		<comments>http://www.zerointellect.com/networking/information-gathering-from-your-own-network/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 07:18:27 +0000</pubDate>
		<dc:creator>zrydento</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[cpe]]></category>
		<category><![CDATA[dial up]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[ip address]]></category>
		<category><![CDATA[ip address class]]></category>
		<category><![CDATA[isp]]></category>
		<category><![CDATA[modem]]></category>
		<category><![CDATA[network mask]]></category>
		<category><![CDATA[range]]></category>
		<category><![CDATA[subnet mask]]></category>
		<category><![CDATA[winipcfg]]></category>
		<category><![CDATA[wntipcfg]]></category>

		<guid isPermaLink="false">http://www.zerointellect.com/?p=186</guid>
		<description><![CDATA[<p> </p>
<p>Whenever we connect to the Internet or any other network for that matter, the IP address and its accessability from the outside world differ depending on the type of connection we use. We will take an example of a scenario where we are connected to the internet using a dial up modem and gather useful information about the local <p>Continue reading <a href="http://www.zerointellect.com/networking/information-gathering-from-your-own-network/">Information gathering from your own network</a></p>]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>Whenever we connect to the Internet or any other network for that matter, the IP address and its accessability from the outside world differ depending on the type of connection we use. We will take an example of a scenario where we are connected to the internet using a dial up modem and gather useful information about the local host</p>
<p>Most of the time, when you connect to your ISP, you are assigned a dynamic IP address by the DHCP server of the Internet Service Provider (or ISP) which (normally) changes every time your reconnect. In a dial up network, the CPE (consumer premises equipment) at the end user side is a dial up modem and the user directly connects a phone line into his modem (which is a small piece of hardware). The modem might be external (connected via a serial port to the PC), internal (PCI card on the PCI slot of the motherboard) or might also be directly on the motherboard.</p>
<p>The user then users a dial up networking connection and dials a pre defined local number belonging to the ISP to connect to a host machine or point of presence owned by an ISP in the local area. This host acts as an interface between telephone lines connected to end users and the Internet, and is capable of handling hundreds or even thousands of simultaneous connections.</p>
<p>Let us take an example of some IP address parameters that we receive while connected to the ISP, running an <strong>ipconfig</strong> at the command prompt we get the output below</p>
<p> </p>
<blockquote><p><strong>C:\&gt;ipconfig</strong></p>
<p><strong>Windows IP Configuration</strong><br />
<strong>Ethernet adapter Local Area Connection:</strong></p>
<p><strong>        IP Address. . . . . . . . . . . . : 103.236.4.17<br />
        Subnet Mask . . . . . . . . . . . : 255.255.254.0<br />
        Default Gateway . . . . . . . . . : 103.236.4.1</strong></p></blockquote>
<p> </p>
<p>Calculating the Class, IP Address, Subnet Mask, Network Mask is very simple and straight forward. The IP address and subnet mask is specified in the output clearly</p>
<p>To find out the class that it belongs to, we need to find out that the range that the IP address belongs to from the table below</p>
<p> </p>
<blockquote><p><strong>Class   Range</strong><br />
A          0.0.0.0   to   127.255.255.255<br />
B          128.0.0.0   to   191.255.255.255<br />
C         192.0.0.0   to   223.255.255.255<br />
D          224.0.0.0   to   239.255.255.255<br />
E          240.0.0.0   to   247.255.255.255</p></blockquote>
<p> </p>
<p>We can easily see that the IP address 103.236.4.17 belongs to class A. The default Network Mask is 255.0.0.0 and we know the subnet mask is 255.255.254.0. According to the netmask value, the first octet is reserved for usage by the Network ID, while the last octet is reserved for the host ID, we can break down the third octet based on the subnet mask of 254 for the 3rd octet</p>
<p> </p>
<blockquote><p>103.236.4.17 (IP address)</p>
<p>255.255.254.0 (subnet mask)</p>
<p><strong>11111111.11111111.1111111</strong> 0.00000000 (subnet mask in binary)</p>
<p> </p></blockquote>
<p> </p>
<p>The range of the hosts in the network can be generated from the IP address 103.236.00000100.0 where the first host would be 103.236.4.1 and the last host would be 103.236.5.254. The formula below can also be used,</p>
<p> </p>
<blockquote><p><strong>2^n &#8211; 2 where n is the number of host bits</strong></p>
<p><strong>In our case the number of host bits are 9,</strong></p>
<p><strong>2^9 &#8211; 2 = 512 &#8211; 2 = 510 (the -2 is required because the IP addresses 103.236.4.255 and 103.236.5.255 are excluded which represent broadcast addresses)</strong></p></blockquote>
<p> </p>
<p>We can get the same information from a useful utility [Windows NT IPConfig Utility (<strong>wntipcfg.exe</strong>)]. In earlier versions of Windows, Windows 95/98/ME, etc the same utility is <strong>winipcfg</strong></p>
<p>The information that we can gather about our hosts when connected to private or public networks helps us in understanding where we are with respect to the rest of the network and also gives us a blueprint of how the network diagram evolves which helps in consulting assignments and security audits.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zerointellect.com/networking/information-gathering-from-your-own-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exceeding the range of data types in C++</title>
		<link>http://www.zerointellect.com/programming/exceeding-the-range-of-data-types-in-c/</link>
		<comments>http://www.zerointellect.com/programming/exceeding-the-range-of-data-types-in-c/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 10:20:37 +0000</pubDate>
		<dc:creator>zrydento</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[borland]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[data types]]></category>
		<category><![CDATA[exceed]]></category>
		<category><![CDATA[int]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[range]]></category>
		<category><![CDATA[Turbo C++]]></category>
		<category><![CDATA[variable]]></category>

		<guid isPermaLink="false">http://www.zerointellect.com/?p=33</guid>
		<description><![CDATA[<p> </p>
<p>My friend recently gave his C++ oral examination and one of the questions asked by the invigilators was regarding incrementing a variable after it has been set to the maximum value in its range</p>
<p>To be specific, in his case the invigilator asked him the output of a variable of type int if initialized to 32765 and <p>Continue reading <a href="http://www.zerointellect.com/programming/exceeding-the-range-of-data-types-in-c/">Exceeding the range of data types in C++</a></p>]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>My friend recently gave his C++ oral examination and one of the questions asked by the invigilators was regarding incrementing a variable after it has been set to the maximum value in its range</p>
<p>To be specific, in his case the invigilator asked him the output of a variable of type int if initialized to 32765 and then incremented by 1</p>
<p> </p>
<p><strong>Sample Code</strong></p>
<p> </p>
<blockquote><p><strong>int i = 32765;</strong></p>
<p><strong>i++;</strong></p>
<p><strong>cout&lt;&lt;i;</strong></p></blockquote>
<p> </p>
<p><strong>Question:</strong> What is the output value of i ?</p>
<p> </p>
<p>Now as we know the range for an integer in C++ is from -32,768 to 32,767 or from 0 to 65535</p>
<p> </p>
<p>As per the official documentation in the Turbo C++ compiler</p>
<p> </p>
<blockquote><p><strong>Integer data type</strong></p>
<p><strong>Variables of type int are one word in length. They can be signed (default) or unsigned, which means they have a range of -32,768 to 32,767 and 0 to 65,535, respectively</strong></p></blockquote>
<p> </p>
<p>To demonstrate and verify the actual output, I quickly coded the program below</p>
<p> </p>
<blockquote><p><strong># include &lt;iostream.h&gt;</strong></p>
<p><strong># include &lt;conio.h&gt;</strong></p>
<p><strong> </strong></p>
<p><strong>void main()</strong></p>
<p><strong>{</strong></p>
<p><strong>   clrscr();</strong></p>
<p><strong> </strong></p>
<p><strong>   int i = 32765;</strong></p>
<p><strong> </strong></p>
<p><strong>   for(int j=5;j&lt;10;i++)</strong></p>
<p><strong>   {</strong></p>
<p><strong>         j++;</strong></p>
<p><strong>         cout&lt;&lt;i&lt;&lt;&#8221;\n&#8221;;</strong></p>
<p><strong>   }</strong></p>
<p><strong>   getch();</strong></p>
<p><strong>}</strong></p></blockquote>
<p> </p>
<p>A screenshot of the output of the sample above is as under</p>
<p> </p>
<p style="text-align: center"> <img class="aligncenter" src="http://www.zerointellect.com/uploads/0000001-output.png" alt="" width="500" height="258" /> </p>
<p> </p>
<p>This brings us to the conclusion that the variable is incremented until the maximum value of its range (32,767) and is then reinitialized back (-32,768) to the beginning of the range automatically in a circular fashion</p>
<p> </p>
<p style="text-align: center"><img class=" aligncenter" src="http://www.zerointellect.com/uploads/0000001-diagram.png" alt="Incrementing Integer Flow" width="450" height="150" /></p>
<p> </p>
<p>The diagram above gives a graphical representation of what happens when an integer is incremented after being set to the maximum value in its range</p>
<p> </p>
<p>Happy Coding</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zerointellect.com/programming/exceeding-the-range-of-data-types-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

