<?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>nick has a blog! &#187; Uncategorized</title>
	<atom:link href="http://www.nickpeters.net/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nickpeters.net</link>
	<description></description>
	<lastBuildDate>Fri, 05 Mar 2010 04:29:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Starting out with Nmap</title>
		<link>http://www.nickpeters.net/2010/03/04/starting-out-with-nmap/</link>
		<comments>http://www.nickpeters.net/2010/03/04/starting-out-with-nmap/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 04:29:24 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/?p=164</guid>
		<description><![CDATA[Nmap is one of those programs that I can&#8217;t live without.  Whether I&#8217;m using it to learn more about my own network, or somebody else&#8217;s network, it really gives me a better picture of what other devices are on the network without actually having to actually physically see the device.
Scanning your network
One of the basic [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://nmap.org/" target="_blank">Nmap</a> is one of those programs that I can&#8217;t live without.  Whether I&#8217;m using it to learn more about my own network, or somebody else&#8217;s network, it really gives me a better picture of what other devices are on the network without actually having to actually physically see the device.</p>
<h3>Scanning your network</h3>
<p>One of the basic ways to discover devices is to use a ping sweep with Nmap.  This sends out a ping to a single device or a range of devices. It used to be that hosts that dropped <a href="http://en.wikipedia.org/wiki/Ping">ICMP echo requests (ping)</a> would up show as being down in Nmap.  It seems that newer versions of Nmap are able to detect if a host is up if it doesn&#8217;t respond to a ping. (Try ping microsoft.com and see what it responds with.)</p>
<h3>Pinging a single device</h3>
<p></p>
<p>
<pre>nmap -sP 192.168.0.1</pre>
</p>
<p><strong>Results</strong></p>
<p>
<pre>Nmap scan report for 192.168.0.1
Host is up (0.055s latency).</pre>
</p>
<p><h3>Pinging a range of IP addresses</h3>
</p>
<p>
<pre>nmap -sP 192.168.0.1-5</pre>
</p>
<p><strong>Results</strong></p>
<p>
<pre>Nmap scan report for 192.168.0.1
Host is up (0.0046s latency).
Nmap scan report for 192.168.0.3
Host is up (0.016s latency).
Nmap scan report for 192.168.0.5
Host is up (0.000098s latency).</pre>
</p>
<p><h3>Pinging the entire network</h3>
</p>
<p>
<pre>nmap -sP 192.168.0.0/24</pre>
</p>
<p>
<strong>Results</strong>
</p>
<p>
<pre>Nmap scan report for 192.168.0.1
Host is up (0.055s latency).
Nmap scan report for 192.168.0.3
Host is up (0.014s latency).
Nmap scan report for 192.168.0.5
Host is up (0.00029s latency).
Nmap scan report for 192.168.0.100
Host is up (0.0090s latency).</pre>
</p>
<p>The last command will send a ping out to any device that has their IP address starting with 192.168.0.x.  (The /24 is short-hand for the subnet mask of 255.255.255.0.)</p>
<h3>Device Enumeration</h3>
<p>Once we have a list of devices on our network we may want to know some information about it.  Simply typing the command nmap along with the IP address or name of the device, will return what ports are open on the device and guess what service is running on the device.  For example, when I run nmap on my own machine I get the following:</p>
<p>
<pre>nmap 192.168.0.5</pre>
</p>
<div><strong>Results</strong></div>
<p>
<pre>PORT     STATE SERVICE
22/tcp   open  ssh
88/tcp   open  kerberos-sec
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
515/tcp  open  printer
631/tcp  open  ipp
3689/tcp open  rendezvous</pre>
</p>
<p>What if I want some more information like what version of ssh am I running?  Use the -sV flag.</p>
<p>
<pre>nmap -sV 192.16.0.5</pre>
</p>
<p><strong>Results</strong></p>
<p>
<pre>PORT     STATE SERVICE      VERSION
22/tcp   open  ssh          OpenSSH 5.2 (protocol 2.0)
88/tcp   open  kerberos-sec Mac OS X kerberos-sec
139/tcp  open  netbios-ssn  Samba smbd 3.X (workgroup: WORKGROUP)
445/tcp  open  netbios-ssn  Samba smbd 3.X (workgroup: WORKGROUP)
515/tcp  open  printer
631/tcp  open  ipp          CUPS 1.4
3689/tcp open  daap         Apple iTunes DAAP 9.0.3
Service Info: OS: Mac OS X</pre>
</p>
<p>
Also notice we get some extra information such as the OS I&#8217;m running and the workgroup my samba shares are on.</p>
<p>Now let&#8217;s take what we learned and put them together.  How would I get information on all devices on my network?
</p>
<p>
<pre>nmap -sV 192.168.0.0/24</pre>
</p>
<p>The output of this is too long for here, but I think you get the idea; it&#8217;ll display all the service information (along with service versions) for all hosts on the network.</p>
<p>That&#8217;s the basics of using nmap.  With the ideas presented here, you should be able to find out most information about about devices on the network you are currently connected to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2010/03/04/starting-out-with-nmap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find the Largest Prime Factor</title>
		<link>http://www.nickpeters.net/2009/08/02/find-the-largest-prime-factor/</link>
		<comments>http://www.nickpeters.net/2009/08/02/find-the-largest-prime-factor/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 21:54:09 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/?p=145</guid>
		<description><![CDATA[I love programming competitions.  In the past two years I&#8217;ve participated in both my school&#8217;s programming competition and the ACM Southern California regional competition.  Recently I&#8217;ve been turned onto http://projecteuler.net which is a competition-like site that gives you a series of math questions which you need to solve by writing a program.  I saw this [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-style: normal;">I love programming competitions.  In the past two years I&#8217;ve participated in both my school&#8217;s programming competition and the ACM Southern California regional competition.  Recently I&#8217;ve been turned onto <a title="Project Euler" href="http://projecteuler.net" target="_blank">http://projecteuler.net</a> which is a competition-like site that gives you a series of math questions which you need to solve by writing a program.  I saw this as a good opportunity to brush up on python, so today I&#8217;ve been trying my hand at a few of these problems.</span></p>
<p>Question #3 asks you to find the largest prime factor of a very large number.  My first instinct was to start at Sqrt(n) and work my way back until I find the first factor.  The problem here is that the first factor you find may not be the first PRIME factor.  Instead, my approach to this problem was to find all factors of the number between 2 and Sqrt(n) and put them in in a list.</p>
<p>Of all the numbers in the list, one of them is the largest prime factor, but which one?  To find out, I made an assumption that turned out to be right:  The composite factors have at least one prime factor that is already in the list.  If I can show that a given number has no factors in the list, then it is a prime factor.  Further, if I have a sorted list and start at the end, I can show that the number is the largest prime factor.</p>
<p>Anyway, here&#8217;s the code I used:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">n = 600851475143 # Find the largest prime factor of this</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">div = [x for x in range(2,int(math.sqrt(n))) if n % x == 0] # Get all factors</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">i, j = 0, len(div) &#8211; 1</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">while j &gt; i: # Determine which one of the factors is the largest prime</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span># This number is composite, go to the next largest factor</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>if div[j] % div[i] == 0: i,j = 0,j-1</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span># See if the next number at the beginning of the list divides the current number</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>else: i += 1</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 216px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">print div[j] # Print out the largest prime factor</div>
<pre>n = 600851475143 # Find the largest prime factor of this
div = [x for x in range(2,int(math.sqrt(n))) if n % x == 0] # Get all factors
i, j = 0, len(div) - 1
while j &gt; i: # Determine which one of the factors is the largest prime</pre>
<pre style="padding-left: 30px;"># This number is composite, go to the next largest factor
if div[j] % div[i] == 0: i,j = 0,j-1
# See if the next number at the beginning of the list divides the current number
else: i += 1</pre>
<pre>print div[j] # Print out the largest prime factor</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2009/08/02/find-the-largest-prime-factor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fix for CodeIgniter White Screen on Bluehost</title>
		<link>http://www.nickpeters.net/2009/02/24/fix-for-codeigniter-white-screen-on-bluehost/</link>
		<comments>http://www.nickpeters.net/2009/02/24/fix-for-codeigniter-white-screen-on-bluehost/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 04:54:35 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/?p=127</guid>
		<description><![CDATA[This past weekend I spent writing an application using the CodeIgniter framework for my programming languages class.  Sunday night I finally got it working and it was time to move it to production on bluehost.  After I made created the database and made some configuration changes I checked it out and I got nothing.  It [...]]]></description>
			<content:encoded><![CDATA[<p>This past weekend I spent writing an application using the <a href="http://codeigniter.com/" target="_blank">CodeIgniter</a> framework for my programming languages class.  Sunday night I finally got it working and it was time to move it to production on bluehost.  After I made created the database and made some configuration changes I checked it out and I got nothing.  It was a white page of nothing.  I checked my logs and found nothing.  Normally this wouldn&#8217;t be such an issue, but when you have nothing in your logs, then you don&#8217;t have much to work with.  I looked at the source of the blank page and found this: &#8220;&lt;!&#8211; SHTML Wrapper &#8211; 500 Server Error &#8211;&gt;.&#8221;  Still not a lot to work with.</p>
<p>Today I spent some time investing the issue and found out that a lot of people were having the issue, but I didn&#8217;t find any fixes.  Long story short the fix was to enable FastCGI PHP5 on Bluehost.  When I did that an error finally appeared on the screen! Apparently I misspelled my database name &gt;_&lt;.</p>
<p>Anyway, if you&#8217;re having the same issue, let me know if this fix worked for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2009/02/24/fix-for-codeigniter-white-screen-on-bluehost/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Selecting Options in Select Drop-Downs using jQuery</title>
		<link>http://www.nickpeters.net/2008/06/10/selecting-options-in-select-drop-downs-using-jquery/</link>
		<comments>http://www.nickpeters.net/2008/06/10/selecting-options-in-select-drop-downs-using-jquery/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 15:56:44 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/2008/06/10/selecting-options-in-select-drop-downs-using-jquery/</guid>
		<description><![CDATA[Say we want to pre-fill out a form with data retrieved from an XML file.Â  Once we parse the XML, we need to update the form.Â  If you know the jQuery library, using the val() and attr() methods are trivial for most inputs.Â  What about select drop-downs?Â  There&#8217;s no easy way to add the &#8220;selected&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Say we want to pre-fill out a form with data retrieved from an XML file.Â  Once we parse the XML, we need to update the form.Â  If you know the jQuery library, using the val() and attr() methods are trivial for most inputs.Â  What about select drop-downs?Â  There&#8217;s no easy way to add the &#8220;selected&#8221; attribute to a drop-down.</p>
<p>As an example let&#8217;s say I have a drop-down of names.Â  I want to have the name &#8220;Nick&#8221; selected as the default value.Â  Using jQuery and XPATH, we can do this in a clean way:</p>
<p><code>$('select#name').find("option[@value=" + name + "]").attr("selected","selected");</code></p>
<p>The first part <code>$('select#name')</code> simply locates the select drop-down that we want (This is done in a fashion similar to CSS selectors).Â  The next part will find a child that is an option node and has the value of the name specified.Â  It will then assign the value &#8220;selected&#8221; to the attribute &#8220;selected.&#8221;Â  Simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2008/06/10/selecting-options-in-select-drop-downs-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ToDo This Summer</title>
		<link>http://www.nickpeters.net/2008/05/09/todo-this-summer/</link>
		<comments>http://www.nickpeters.net/2008/05/09/todo-this-summer/#comments</comments>
		<pubDate>Sat, 10 May 2008 06:00:21 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/2008/05/09/todo-this-summer/</guid>
		<description><![CDATA[So I pretty much have not updated whatsoever this semester. Â Between school, work, homework and trying to maintain a social life, I haven&#8217;t had time for anything else. Â With school over with in a week I&#8217;ll have free time again! Â What will I be doing with this time? Â This is what I got so far:

Â Learn [...]]]></description>
			<content:encoded><![CDATA[<p>So I pretty much have not updated whatsoever this semester. Â Between school, work, homework and trying to maintain a social life, I haven&#8217;t had time for anything else. Â With school over with in a week I&#8217;ll have free time again! Â What will I be doing with this time? Â This is what I got so far:
<ul>
<li>Â Learn Python &#8211; I feel I should&#8217;ve avoided the whole Ruby craze and stuck with Python. Â I started the O&#8217;Reilly book last summer, but never got around to finishing it. Â  I hope I have better luck this summer.</li>
<li>Learn C# &#8211; At work I&#8217;m pretty much forced to use .NET for some projects. Â Since the only .NET language I remember is VB.NET I&#8217;ve been using that. Â Instead I would prefer something that feels more like Java, thus the desire to want to learn C#.</li>
<li>Learn iPhone SDK &#8211; This is a &#8220;if I&#8217;m bored enough&#8221; idea. Â I think it would be cool to write iPhone apps, but this doesn&#8217;t have any practical purpose.</li>
<li>Read &#8211; There are a few books I have in mind. Â Here are a few that come to mind:
<ul>
<li>GTD &#8211; There&#8217;s so much information in this book, thus my desire to read it again.</li>
<li>The Pragmatic Programmer &#8211; Saw it at my school&#8217;s library</li>
<li>Books on System Theory -Â <a href="http://progrium.com/" target="_blank" title="Jeff Lindsay">Jeff Lindsay</a>Â started aÂ <a href="http://groups.google.com/group/groksystems?hl=en" target="_blank" title="Grok Systems Group">google group</a>Â forÂ <a href="http://groksystems.com/" target="_blank" title="Grok Systems">groksystems</a>. Â Of course this got me interested in Systems again. Â I plan on finishing Ackoff&#8217;s Best and even found a couple books at the school library.</li>
<li>Chess books &#8211; I admit it: I like chess.</li>
</ul>
</li>
<li><a href="http://www.owasp.org/index.php/Category:OWASP_WebGoat_Project" title="webgoat">WeBGoat</a>Â - This is a neat web security practice app. Â It&#8217;s essentially a Tomcat server with insecure web pages (written in JSP) that teach you about a certain exploit and how to protect against it. Â Sounds neat to me.</li>
<li>PBWiki QuickEdit &#8211; In myÂ <a href="http://www.nickpeters.net/2008/01/31/idea-for-quick-editing/" target="_blank">last post</a>Â I had an idea for a notepad-like program that would instead edit wiki pages. Â I actually want to make this program this summer. Â The first thing I would have to do is make a library that does the communication and then write the application itself. Â I&#8217;m kind of excited about this one!</li>
</ul>
<p>So that&#8217;s the plan for this summer. Â Writing down a list is one thing and doing it is another; we&#8217;ll see how it goes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2008/05/09/todo-this-summer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Blogging and school</title>
		<link>http://www.nickpeters.net/2007/02/05/blogging-and-school/</link>
		<comments>http://www.nickpeters.net/2007/02/05/blogging-and-school/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 03:22:29 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[school]]></category>

		<guid isPermaLink="false">http://www.nickpeters.net/2007/02/05/blogging-and-school/</guid>
		<description><![CDATA[I have started the third week of school and already I feel like I need to do homework every day to catch up. Taking Calculus and Physics at Cuesta and two online classes at Cal State Channel Islands has taken its toll on my available free time.Â  There are some things I&#8217;ve given up during [...]]]></description>
			<content:encoded><![CDATA[<p>I have started the third week of school and already I feel like I need to do homework every day to catch up. Taking Calculus and Physics at Cuesta and two online classes at Cal State Channel Islands has taken its toll on my available free time.Â  There are some things I&#8217;ve given up during the weekdays such as reading non-school related books and of course blog posts.</p>
<p>However, for one of my classes I am writing on various topics of societal issues in computing.Â  Since most of these papers are based on opinion and research, I figured these would make for great blog posts.Â  In the future I would like to start posting some of these papers that I write for the sake of sharing with the community.Â  So get your RSS feeds ready for future posts!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickpeters.net/2007/02/05/blogging-and-school/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
