<?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>int main()</title>
	<atom:link href="http://intmain.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://intmain.net</link>
	<description>a blog by CS students</description>
	<lastBuildDate>Wed, 21 Jul 2010 04:46:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Protecting passwords from statistical-guessing attacks</title>
		<link>http://intmain.net/2010/07/protecting-passwords-from-statistical-guessing-attacks/</link>
		<comments>http://intmain.net/2010/07/protecting-passwords-from-statistical-guessing-attacks/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 04:46:08 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[CS]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=232</guid>
		<description><![CDATA[A new paper by Stuart Schechter from Microsoft Research, Cormac Herley from Microsoft Research, and Michael Mitzenmacher from Harvard University titled &#8220;Popularity is everything&#8221; discusses a new method for protecting passwords from statistical-guessing attacks. The main concept behind the paper is that the most common type of attack against a password-protected system is a brute-force [...]]]></description>
			<content:encoded><![CDATA[<p>A new paper by Stuart Schechter from Microsoft Research, Cormac Herley from Microsoft Research, and Michael Mitzenmacher from Harvard University titled &#8220;<a href="http://www.eecs.harvard.edu/~michaelm/postscripts/hotsec2010.pdf">Popularity <em>is</em> everything</a>&#8221; discusses a new method for protecting passwords from statistical-guessing attacks.</p>
<p>The main concept behind the paper is that the most common type of attack against a password-protected system is a brute-force attack which relies on a popularity-sorted dictionary.  The proposed protection is to prevent any password from becoming popular enough that a statistical attack is likely to succeed.</p>
<p>There are a number of problems with this idea, however.  First, a goal would likely be to prevent any password similar to a popular password from being used.  However, if passwords are stored as hash-values (or salted hash-values) there would be no way to compare and find similarity.  Storing the passwords as plain-text would solve this problem but introduce a vulnerability if the attacker obtained the password-database.  Second, if the popularity is stored as a numeric value an attacker who obtains the database can determine that N users have the same password and use that information to pick a likely passwords.  Similarly, an attacker can attempt to create a new password and determine if that password is popular by consulting the database, which would allow the attacker to concentrate on only the most popular passwords.</p>
<p>Herley, <em>et al</em> address these issues by proposing that popularity be stored as a <a href="http://www.eecs.harvard.edu/~michaelm/CS222/countmin.pdf">count-min sketch</a> and ensuring false-positives in the data.  The count-min sketch is a data structure which relies on the results of multiple hash functions.  An array is kept for each hash function recording the number of times that particular hash-value is used.  When checking if a password is popular, the lowest number of times reported for the hash-value determines the number of times the password has been used.  Collisions in the hash functions allow protection against similar passwords (see Figure 2).  This number can be compared against a threshold to determine if it is too popular.  False positives in the data help insure that an attacker who gains access to the sketch will not be too greatly aided (section 3.3).  False positives are contributed by the collision in hash functions as well as restricting the counters in the sketch to have a maximum increment.  Passwords which use these counters will all appear equally popular, forcing an attacker to waste time trying all of them.</p>
<p>A problem with this approach is that the number of organizations which can create an effective popularity count-min sketch is limited to organizations with a large number of users.  A possible solution would be to have a shared count-min sketch among organizations, but that would make it easier for an attacker to obtain.</p>
<p>A proof-of-concept implementation of a count-min sketch will follow soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2010/07/protecting-passwords-from-statistical-guessing-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures With VPython &#8211; Pong</title>
		<link>http://intmain.net/2010/03/adventures-with-vpython-pong/</link>
		<comments>http://intmain.net/2010/03/adventures-with-vpython-pong/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 21:47:30 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[int main()]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[eric]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=220</guid>
		<description><![CDATA[So, it&#8217;s been a crazy quarter here at UCLA &#8211; general education really is a giant time sink. Thankfully, that&#8217;ll be done after this quarter and I&#8217;ll hopefully have more time to do inane side projects like the one I&#8217;m going to talk about today. Everyone knows about Pong &#8211; the little game that you [...]]]></description>
			<content:encoded><![CDATA[<p>So, it&#8217;s been a crazy quarter here at UCLA &#8211; general education really is a giant time sink. Thankfully, that&#8217;ll be done after this quarter and I&#8217;ll hopefully have more time to do inane side projects like the one I&#8217;m going to talk about today.</p>
<p>Everyone knows about Pong &#8211; the little game that you all played on your TI-83 in high school when you were supposed to be paying attention in math class. Along with all the other games you played on your calculator &#8211; I&#8217;m hoping to play with those later. Anyway. I&#8217;ve always had an interest in 3D graphics and how they relate to games. I did some dabbling in OpenGL last summer and it was painful to say the least. I&#8217;ve also been dabbling with Python lately, so the next obvious step was to figure out how to do graphics in Python. There a lot of libraries to do this (pygame comes to mind), but I decided to use VPython. It provides all sorts of nice little things &#8211; namely the code to construct a shape.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> visual <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
square = box<span style="color: black;">&#40;</span> pos = <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>, size = <span style="color: black;">&#40;</span><span style="color: #ff4500;">3</span>, <span style="color: #ff4500;">3</span>, <span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>, color = color.<span style="color: black;">green</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Nice. You can give the box a velocity by doing something like:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">box.<span style="color: black;">velocity</span> = vector<span style="color: black;">&#40;</span> <span style="color: #ff4500;">5</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">0</span> <span style="color: black;">&#41;</span></pre></div></div>

<p>Then you can update the position of the box accordingly using your basic physical relationships. You know, Vf = Vi + at, and all the other stuff you learned in physics. Unless you took Physics 1A with Professor Corbin at UCLA, in which case you learned all sorts of other cool stuff and aren&#8217;t sure how you passed the class. But I digress.</p>
<p>I started this project just trying to learn how VPython works, and I ended up implementing a version of Pong that is playable, but slightly boring. There is no score display, end-of-game info is displayed in the console, and there is no vector math implemented. Therefore, the ball always bounces at a 45 degree angle from the wall or the paddle. This is both unrealistic and boring. I&#8217;m no mathematician, and I don&#8217;t currently have the time to implement the vector math. I&#8217;ll leave that as an exercise to the reader. If you do end up implementing it, please let me know. I&#8217;m sure I&#8217;ll get around to it eventually, I just have finals coming up in the next week so it&#8217;s low on the priority list.</p>
<p>Anyway. That&#8217;s what I&#8217;ve been up to lately. I&#8217;m working off and on on doing a Tetris clone, and I&#8217;ll probably eventually get to Space Invaders. Maybe not with this library though. I&#8217;ll probably pick up something else (maybe a new language). Maybe I&#8217;ll go back to OpenGL or DirectX if I&#8217;m bored enough (and in a slightly masochistic mood). For those who are interested, the code is uploaded <a href="http://github.com/emhertz/VPython---Pong">here</a>. Comments and edits appreciated. Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2010/03/adventures-with-vpython-pong/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy Holidays!</title>
		<link>http://intmain.net/2009/12/happy-holidays/</link>
		<comments>http://intmain.net/2009/12/happy-holidays/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 19:30:49 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[int main()]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=210</guid>
		<description><![CDATA[Merry Christmas and Happy Holidays from those of us at int main()!]]></description>
			<content:encoded><![CDATA[<p>Merry Christmas and Happy Holidays from those of us at int main()! </p>
]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/12/happy-holidays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Google Public DNS</title>
		<link>http://intmain.net/2009/12/testing-google-public-dns/</link>
		<comments>http://intmain.net/2009/12/testing-google-public-dns/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 05:49:28 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[int main()]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=176</guid>
		<description><![CDATA[In the spirit of testing things before concluding anything, I decided to test Google&#8217;s new Public DNS service against OpenDNS, 4.2.2.2 (a DNS server owned by Level 3), and the DNS servers on my network. To test the service, I modified the excellent script created by Manu J. #!/bin/sh &#160; cur_dns=`cat /etc/resolv.conf &#124; grep &#34;nameserver&#34; [...]]]></description>
			<content:encoded><![CDATA[<p> In the spirit of testing things before concluding anything, I decided to test Google&#8217;s new <a href="http://code.google.com/speed/public-dns/docs/intro.html">Public DNS</a> service against <a href="http://www.opendns.com/">OpenDNS</a>, 4.2.2.2 (a DNS server owned by Level 3), and the DNS servers on my network.</p>
<p>To test the service, I modified the excellent script created by <a href="http://www.manu-j.com/blog/opendns-alternative-google-dns-rocks/403/">Manu J</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">cur_dns</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;nameserver&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #660033;">-cs</span> <span style="color: #ff0000;">'0-9.'</span> <span style="color: #ff0000;">'[\n*]'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;lifehacker.com&quot;</span> <span style="color: #ff0000;">&quot;facebook.com&quot;</span> <span style="color: #ff0000;">&quot;manu-j.com&quot;</span>  <span style="color: #ff0000;">&quot;reddit.com&quot;</span> <span style="color: #ff0000;">&quot;tb4.fr&quot;</span> <span style="color: #ff0000;">&quot;bbc.co.uk&quot;</span> <span style="color: #ff0000;">&quot;intmain.net&quot;</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #000000; font-weight: bold;">for</span> j <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;4.2.2.2&quot;</span> <span style="color: #ff0000;">&quot;8.8.8.8&quot;</span> <span style="color: #ff0000;">&quot;208.67.222.222&quot;</span> <span style="color: #007800;">$cur_dns</span>
  <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">$i</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">$j</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">for</span> k <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">1</span> <span style="color: #000000;">100</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">do</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dig</span> <span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$j</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> Query <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #ff0000;">':'</span> <span style="color: #ff0000;">'{print $2}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #660033;">-cs</span> <span style="color: #ff0000;">'0-9'</span> <span style="color: #ff0000;">'[\n*]'</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">done</span>
  <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>My two changes were to grab the DNS servers defined in /etc/resolv.conf and to query each service 100 times.  Of course, the only downside to this test is that it does not account for the DNS server caching the result of repeated queries.  This effect shows up in a few of the graphs (included below).</p>
<p>Google&#8217;s DNS service is very consistent in speed, but is also consistently slower than any of the other servers tested.  Google&#8217;s DNS service also shows very little difference with repeated requests, except for the lookup of intmain.net, where the first request took significantly longer than the others.  Similarly, Google&#8217;s DNS took over 2 seconds to respond to a request of reddit.com.  The final ordering is as such: the fastest in most cases was the DNS servers local to the network (except for uncommon sites, which took between 100ms and 150ms for the first request), followed by 4.2.2.2, followed by OpenDNS, and trailed by Google Public DNS.</p>
<p>I encourage you to perform the same (or similar) tests on your own computers and share the results.  It&#8217;s very hard to tell if the differences in response times are caused by latency or lookup time, but it is clear that the best DNS servers for me to use are the ones local to my network at UCLA.</p>
<p><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-lifehacker.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-lifehacker.jpg" alt="dnstest lifehacker Testing Google Public DNS" title="dnstest-lifehacker" class="alignnone size-full wp-image-180" /></a><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-facebook.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-facebook.jpg" alt="dnstest facebook Testing Google Public DNS" title="dnstest-facebook" class="alignnone size-full wp-image-178" /></a><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-manu-j.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-manu-j.jpg" alt="dnstest manu j Testing Google Public DNS" title="dnstest-manu-j" class="alignnone size-full wp-image-181" /></a><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-intmain.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-intmain.jpg" alt="dnstest intmain Testing Google Public DNS" title="dnstest-intmain" class="alignnone size-full wp-image-179" /></a><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-reddit-outlier.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-reddit-outlier.jpg" alt="dnstest reddit outlier Testing Google Public DNS" title="dnstest-reddit-outlier" class="alignnone size-full wp-image-183" /></a><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-reddit.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-reddit.jpg" alt="dnstest reddit Testing Google Public DNS" title="dnstest-reddit" class="alignnone size-full wp-image-182" /></a><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-tb4fr.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-tb4fr.jpg" alt="dnstest tb4fr Testing Google Public DNS" title="dnstest-tb4fr" class="alignnone size-full wp-image-184" /></a><a href="http://intmain.net/wp-content/uploads/2009/12/dnstest-bbccouk.jpg"><img src="http://intmain.net/wp-content/uploads/2009/12/dnstest-bbccouk.jpg" alt="dnstest bbccouk Testing Google Public DNS" title="dnstest-bbccouk" class="alignnone size-full wp-image-177" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/12/testing-google-public-dns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paul Eggert speaks at UCLALUG</title>
		<link>http://intmain.net/2009/10/paul-eggert-speaks-at-uclalug/</link>
		<comments>http://intmain.net/2009/10/paul-eggert-speaks-at-uclalug/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 23:47:22 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[int main()]]></category>
		<category><![CDATA[UCLA]]></category>
		<category><![CDATA[FSF]]></category>
		<category><![CDATA[Paul Eggert]]></category>
		<category><![CDATA[UCLALUG]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=162</guid>
		<description><![CDATA[Sorry for this being a little late, but Paul Eggert came and spoke to the UCLA LUG and interested parties this past Wednesday. Eggert spoke about several things, including how he became involved with free software, his take on the free software community, how to get involved in free software, and projects he thinks would [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry for this being a little late, but Paul Eggert came and spoke to the UCLA LUG and interested parties this past Wednesday.</p>
<p>Eggert spoke about several things, including how he became involved with free software, his take on the free software community, how to get involved in free software, and projects he thinks would be great to have done.</p>
<p>Eggert mostly became involved with free software as a result of what he calls laziness.  Essentially, he got tired of re-patching emacs to work on his (unusual) architecture, so he started submitting patches to Stallman.  From there, he just continued submitting patches.</p>
<p>Similarly, Eggert thinks that the best way to get involved in free software is to just start contributing.  In order to get noticed, he recommends that people pick &#8220;medium-sized&#8221; patches; not something small enough that another person could do in 15 minutes, but also not large enough that it makes any major changes.  An example of a &#8220;medium-sized&#8221; project would be patching to take advantage of multi-core systems.  Since most programs currently are designed with a single-core architecture in mind, some significant improvements in speed could be obtained by moving it to multi-core.  Doing something like this would help to build one&#8217;s reputation in the meritocracy of the free software community.</p>
<p>In terms of the future, Eggert thinks that we need new languages to properly take advantage of multi-core.  In particular, he mentioned projects like Hadoop are steps in the right direction.  Additionally, he thinks that the current shell is too complicated for non-trivial tasks.</p>
<p>Anyway, happy halloween!</p>
]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/10/paul-eggert-speaks-at-uclalug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paul Eggert is coming to UCLALUG!</title>
		<link>http://intmain.net/2009/10/paul-eggert-is-coming-to-uclalug/</link>
		<comments>http://intmain.net/2009/10/paul-eggert-is-coming-to-uclalug/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 21:16:39 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[int main()]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=157</guid>
		<description><![CDATA[The below information is from the UCLA Linux Users Group. All Engineering students &#8212; particularly those in CS &#8212; are invited to hear Professor Paul Eggert speak on Open Source software, how he got involved over his career, how he has contributed. The GNU Core Utilities project includes such all-important programs as &#8220;ls&#8221;, &#8220;cp&#8221;, &#8220;sort&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p>The below information is from the UCLA Linux Users Group.</p>
<blockquote><p>All Engineering students &#8212; particularly those in CS &#8212; are invited to hear<br />
Professor Paul Eggert speak on Open Source software, how he got involved over<br />
his career, how he has contributed.  The GNU Core Utilities project includes<br />
such all-important programs as &#8220;ls&#8221;, &#8220;cp&#8221;, &#8220;sort&#8221;, &#8220;echo&#8221;, &#8220;cat&#8221;, and many more.</p>
<p>Wednesday, October 28, 2009<br />
6 PM<br />
Boelter Hall 4760<br />
Details:  <a href="http://linux.ucla.edu/sean/eggertflyer.pdf">http://linux.ucla.edu/sean/eggertflyer.pdf</a></p>
<p>Paul Eggert is a lecturer in the Computer Science department here at UCLA.  He<br />
teaches operating systems, programming languages, software development, and<br />
more.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/10/paul-eggert-is-coming-to-uclalug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A .vimrc Discussion</title>
		<link>http://intmain.net/2009/10/a-vimrc-discussion/</link>
		<comments>http://intmain.net/2009/10/a-vimrc-discussion/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 00:54:44 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[CS]]></category>
		<category><![CDATA[int main()]]></category>
		<category><![CDATA[.vimrc]]></category>
		<category><![CDATA[eric]]></category>
		<category><![CDATA[VIm]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=147</guid>
		<description><![CDATA[So, I&#8217;ve recently converted to using VIm. Textedit irritates me to no end, and I don&#8217;t want to pay money for Textmate. I decided I would post my .vimrc file up here and talk about it a little bit. For those who just want to read the file, it&#8217;s attached at the bottom of the [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve recently converted to using VIm. Textedit irritates me to no end, and I don&#8217;t want to pay money for Textmate. I decided I would post my .vimrc file up here and talk about it a little bit. For those who just want to read the file, it&#8217;s attached at the bottom of the post. Snippets of code follow, however.</p>

<div class="wp_syntax"><div class="code"><pre class="vimscript" style="font-family:monospace;">map &lt;space&gt; /</pre></div></div>

<p>All you VIm users out there know how to search for text &#8211; this enables me to search with the space bar, which feels more natural and quicker than having to type a special character.</p>

<div class="wp_syntax"><div class="code"><pre class="vimscript" style="font-family:monospace;">set nocompatible
set number
set columns=80
set ruler
set background=light
set wrap!
syntax enable</pre></div></div>

<p>This turns off emulation of bugs from Vi, enables line numbers, restricts my window to 80 columns, displays some basic information about where I am on a line, tells VIm to use fonts optimized for a light background (corresponds with my terminal colors), turns off word wrap, and turns on syntax highlighting. These options are all configured for programming.</p>

<div class="wp_syntax"><div class="code"><pre class="vimscript" style="font-family:monospace;">set showmatch
set ignorecase
set hlsearch
set incsearch</pre></div></div>

<p>This is extremely useful for searching in a file. The first line highlights matching braces, which is very nice for nested statements and complex conditionals. It also makes searching case-insensitive, highlights search matches, and starts searching with the first letter that you type. If you pay close attention when searching you only ever have to type the minimum amount of letters to find what you want. I find this greatly speeds up moving through a document.</p>

<div class="wp_syntax"><div class="code"><pre class="vimscript" style="font-family:monospace;">set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab</pre></div></div>

<p>These settings tell VIm what to do with tabs and indents. The first two lines tell the program to format indents according to the file type. As long as you&#8217;re using a C type language, this works extremely well. The second two lines tell VIm to use 4 spaces when the tab key is pressed, and the final line expands all tabs into spaces. This helps remove compatibility problems between tabs and spaces.</p>

<div class="wp_syntax"><div class="code"><pre class="vimscript" style="font-family:monospace;">set vb t_vb=</pre></div></div>

<p>This just turns off those pesky beeps when you enter an invalid command. Instead, the screen flashes for an instant. Much nicer in my opinion.</p>

<div class="wp_syntax"><div class="code"><pre class="vimscript" style="font-family:monospace;">set gfn=BitStream\ Vera\ Sans\ Mono:h14</pre></div></div>

<p>This sets the default font for the editor &#8211; Monaco Size 10. My current favorite programming font on OS X. Anyway, that&#8217;s a bit of a discussion about my .vimrc. The full file is below for anyone who wants to read the whole thing or copy/paste it for their own use.</p>

<div class="wp_syntax"><div class="code"><pre class="vimscript" style="font-family:monospace;">&quot;.vimrc
&quot;Author: Eric Hertz
&quot;Date: 10.14.2009
&quot;
&quot;This is a configuration file for VIm, the terminal text editor. Feel free
&quot;to use this however you wish.
&nbsp;
&quot;Key mappings
map &lt;space&gt;  /
&nbsp;
&quot;Interface settings
set nocompatible
set number
set columns=80
set ruler
set background=light
set wrap!
syntax enable
&nbsp;
&quot;Search settings
set showmatch
set ignorecase
set hlsearch
set incsearch
&nbsp;
&quot;Indent settings
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
&nbsp;
&quot;Audio settings
set vb t_vb=
&nbsp;
&quot;Font settings
set gfn=BitStream\ Vera\ Sans\ Mono:h14</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/10/a-vimrc-discussion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AudioGuardian</title>
		<link>http://intmain.net/2009/10/audioguardian/</link>
		<comments>http://intmain.net/2009/10/audioguardian/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 18:15:05 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[CS]]></category>
		<category><![CDATA[UCLA]]></category>
		<category><![CDATA[AudioGuardian]]></category>
		<category><![CDATA[eric]]></category>
		<category><![CDATA[J2ME]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[SS12]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=120</guid>
		<description><![CDATA[Hey all, My name is Eric, and I&#8217;ll be one of your regular authors here on int main(). You&#8217;ve probably already read a little bit about me from the post that my friend Sam put up earlier, but I&#8217;ll start with a quick introduction and background . I&#8217;m a second year Computer Science student at [...]]]></description>
			<content:encoded><![CDATA[<p>Hey all,</p>
<p>My name is Eric, and I&#8217;ll be one of your regular authors here on <strong>int main()</strong>. You&#8217;ve probably already read a little bit about me from the post that my friend Sam put up earlier, but I&#8217;ll start with a quick introduction and background <img src='http://intmain.net/wp-includes/images/smilies/icon_smile.gif' alt="icon smile AudioGuardian" class='wp-smiley' title="AudioGuardian" /> . I&#8217;m a second year Computer Science student at the University of California, Los Angeles. I consider myself well-versed in C, C++, and Java, primarily. I also enjoy (if that&#8217;s the word) working with assembly on occasion (I&#8217;ll post a discussion of some assembly topics later on). Anyway. That&#8217;s a little bit about myself. I&#8217;d also like to state here that if any of our readers have side projects that they are working on and would like an extra set of eyes or hands, feel free to <a href="mailto:contact@intmain.net">email</a>. Now that I&#8217;ve dispensed with the introductory remarks, let&#8217;s dive right into today&#8217;s topic.</p>
<p>I feel that as a reader, I would be hesitant to read and trust someone&#8217;s opinion on things unless I knew that they actually had some experience with the things that they write about. To that end, I&#8217;d like to start this blog by talking about a program that I was a developer on &#8211; AudioGuardian. This begs a bit of background information, I&#8217;m sure. This project started as part of a competition back in February 2009. I participated in SS12 put on by ProjectPossibility, an organization aiming to make technology more accessible to the disabled community. AudioGuardian was originally named MobileSoundNotifier, and its purpose was to alert hearing-impaired users of hazards in their environment. I will append links to the project&#8217;s webpage, the project wiki, and the SVN if any of our readers would like to see some of my &#8220;production&#8221; code. I quote that because it&#8217;s definitely hacked code &#8211; this project was completed over the span of approximately 30 hours. From scratch. With that said, here&#8217;s the links to the project information:</p>
<p><a href="http://projectpossibility.org/viewProject.php?id=16">Project Webpage</a><br />
<a href="http://projectpossibility.org/wiki/index.php?title=Mobile_Sound_Notifier">Project Wiki</a></p>
<p>The SVN is linked from the webpage in the bottom right hand corner, if any of you enterprising developers would like to take the project and work on it yourself. It is licensed under the GPL, so keep that in mind. <img src='http://intmain.net/wp-includes/images/smilies/icon_smile.gif' alt="icon smile AudioGuardian" class='wp-smiley' title="AudioGuardian" /> .</p>
<p>I guess you can&#8217;t really fork this project without knowing a bit about how we actually designed and developed the program. Coupled with the fact that this is a CS blog and not a self-promotion blog, I will now move into a technical discussion of the program. I&#8217;m going to keep this as high-level as possible so it will appeal to all audiences. Let&#8217;s get to it.</p>
<p>This application is built using J2ME, which is the Java 2 Mobile Edition. It has most of the capabilities of the full Java language, but it&#8217;s missing some key features. It does not support the Swing environment, so we used the built-in J2ME graphics library to build a primitive GUI. The programming paradigm is event-driven, like the majority of Java programs. A control loop listens for commands and acts appropriately. The basic application logic should be simple to follow. But that&#8217;s all academic and really not what you&#8217;re here for. Let&#8217;s get into the problems with working with audio.</p>
<p>The heart of this program is an audio analyzer. It listens to the surrounding environment and throws alerts when it detects sounds deemed dangerous by either us (the programmers) or the user. Those of you with a physics background may have heard of a discrete Fourier transform before. If so, you will know that this is a complex wave analysis algorithm used to translate a signal from the time domain to the frequency domain. This was important for our application because we cannot use the time domain to perform sound matching. The only correlating factors between sound waves are amplitude and frequency, which we have to use a DFT to extract from the data stream. Sounds simple, right? Without looking at any code (you can download the code yourself and look at it, it&#8217;s too long to post here), let&#8217;s discuss the issues here.</p>
<p>All microphones are not created equal. Every mic has a different sensitivity and different DC offset applied to the raw data stream. This was a problem for us, since we were doing development across different laptops with different microphones. To that end, we decided to build a calibration function that listens to the ambient environment and basically filters the offset and all the outside noise. This also had the unintended side effect of increasing the accuracy of the matching function. It also built cross-compatibility, so our application will work with any microphone out there. The program also had some problems processing data streams in byte array form. The Recorder class in J2ME had a nice little habit of including the file header when it passed the data to a byte array. This then caused garbage to be passed to the graphing function, which caused some serious inaccuracy and lag time in sound recognition. To fix this, we had to strip the file header ourselves. I&#8217;ll leave it to the reader to read the code and see exactly what we did.</p>
<p>Other problems we encountered:</p>
<p>The DFT itself was not easy to write. It didn&#8217;t help that J2ME was very poorly documented and as such we could not find a standard library. We ended up borrowing an implementation of quicksort from an outside source. It was optimized for use on pairs of data, which was what we were using for matching. Writing this alone took us almost an entire day of work, and then the rest of the time was spent building a GUI and other small features into the program.</p>
<p>One final problem was the issue of data persistence. We wanted to be able to store settings and data across instances of the program. Sounds simple, right? Write the data to a file and restore it when you open the program? Easy enough&#8230;.until you look at how mobile phones and the J2ME stores data. We ended up using something called a RecordStore, which is actually an object in Java. It has to be opened before it can be used. It is indexed in a very counterintuitive manner &#8211; not like a normal array or vector of objects. We essentially ended up taking this RecordStore object and building our own suite of methods to store and access data, because the built-in functionality was not doing what we needed it to do. This took a large amount of time as well, and took brains away from cracking the DFT. All in all, however, we managed to get everything working.</p>
<p>Well, that was long. Hopefully I gave you all a bit of insight into that project, and a bit of perspective on what goes on in developing a mobile phone application when you&#8217;ve never done it before. If any of you have questions or would like me to cover something more in-depth, please post a comment or drop us an <a href="mailto:contact@intmain.net">email</a>. We also appreciate email if there is any topic you&#8217;d like us to talk about in general <img src='http://intmain.net/wp-includes/images/smilies/icon_smile.gif' alt="icon smile AudioGuardian" class='wp-smiley' title="AudioGuardian" /> . See you next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/10/audioguardian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating Calculations in Physics 4AL</title>
		<link>http://intmain.net/2009/10/automating-calculations-in-physics-4al/</link>
		<comments>http://intmain.net/2009/10/automating-calculations-in-physics-4al/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 19:00:30 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[int main()]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[TI]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=135</guid>
		<description><![CDATA[This isn&#8217;t really related directly to anything of importance in terms of CS, but it does relate a fundamental difference in those who program versus those who do not. My suitemate and I are both taking Physics 4AL this quarter, a lab which requires a large amount of calculation. However, it is the same calculation [...]]]></description>
			<content:encoded><![CDATA[<p>This isn&#8217;t really related directly to anything of importance in terms of CS, but it does relate a fundamental difference in those who program versus those who do not.  My suitemate and I are both taking Physics 4AL this quarter, a lab which requires a large amount of calculation.  However, it is the same calculation with different masses over and over.  Last night, I was fed up with putting it in my calculator over and over again, so I wrote a little program.  Presented below is this little program, which calculates the error &sigma; = &radic;( ((mg/(M+m)&sup2;)&sup2;*&#038;sigma&sup2;) + ((M/(M+m)&sup2;)&sup2;*&sigma;&sup2;) ).</p>

<div class="wp_syntax"><div class="code"><pre class="basic4gl" style="font-family:monospace;"><span style="color: #0000FF;">:</span>Prompt M
<span style="color: #0000FF;">:</span>Prompt W
<span style="color: #0000FF;">:</span><span style="color: #000080; font-weight: bold;">0.0001</span>→S
<span style="color: #0000FF;">:</span><span style="color: #000080; font-weight: bold;">9.8</span>→G
<span style="color: #0000FF;">:</span>√<span style="color: #000080;">&#40;</span><span style="color: #000080;">&#40;</span><span style="color: #000080;">&#40;</span><span style="color: #000080;">&#40;</span>W<span style="color: #0000FF;">*</span>G<span style="color: #000080;">&#41;</span><span style="color: #0000FF;">/</span><span style="color: #000080;">&#40;</span>M<span style="color: #0000FF;">+</span>W<span style="color: #000080;">&#41;</span>
²<span style="color: #000080;">&#41;</span>²<span style="color: #0000FF;">*</span>S²<span style="color: #000080;">&#41;</span><span style="color: #0000FF;">+</span><span style="color: #000080;">&#40;</span><span style="color: #000080;">&#40;</span><span style="color: #000080;">&#40;</span><span style="color: #000080;">&#40;</span><span style="color: #000080;">&#40;</span>M<span style="color: #0000FF;">+</span>W
<span style="color: #000080;">&#41;</span><span style="color: #0000FF;">*</span>G<span style="color: #000080;">&#41;</span><span style="color: #0000FF;">-</span><span style="color: #000080;">&#40;</span>W<span style="color: #0000FF;">*</span>G<span style="color: #000080;">&#41;</span><span style="color: #000080;">&#41;</span><span style="color: #0000FF;">/</span><span style="color: #000080;">&#40;</span>M<span style="color: #0000FF;">+</span>W
<span style="color: #000080;">&#41;</span>²<span style="color: #000080;">&#41;</span>²<span style="color: #0000FF;">*</span>S²<span style="color: #000080;">&#41;</span><span style="color: #000080;">&#41;</span>→X
<span style="color: #0000FF;">:</span>Disp <span style="color: #008000;">&quot;SIGMA&quot;</span>,X</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/10/automating-calculations-in-physics-4al/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CS32 Project 4: Intrusion Prevention System (Part 1)</title>
		<link>http://intmain.net/2009/09/cs32-project-4-intrusion-prevention-system-part-1/</link>
		<comments>http://intmain.net/2009/09/cs32-project-4-intrusion-prevention-system-part-1/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:01:36 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[CS]]></category>
		<category><![CDATA[UCLA]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[CS32]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://intmain.net/?p=20</guid>
		<description><![CDATA[Project 4 of the Winter 2009 CS32 class was an Intrusion Prevention System.  In this case, however, the Intrusion Prevention System was only a model: the streams and signatures were all plain text. The entire spec is still available. From the spec: What’s an Intrusion Prevention System? Well, it’s a software module that scans internet [...]]]></description>
			<content:encoded><![CDATA[<p>Project 4 of the Winter 2009 CS32 class was an Intrusion Prevention System.  In this case, however, the Intrusion Prevention System was only a model: the streams and signatures were all plain text.  The entire <a href="http://www.cs.ucla.edu/classes/winter09/cs32/P4/spec.pdf">spec</a> is still available.<br />
From the spec:</p>
<blockquote><p>What’s an Intrusion Prevention System? Well, it’s a software module that scans internet packets for malicious attacks and then blocks attacks. Modern security programs, like Norton Internet Security1, scan the contents of all incoming (from the Internet to your computer) and outgoing (visa versa) network packets for attacks that may harm your computer or originate from your computer and harm other computers. If an attack is found in any packet, that packet can be dropped and prevented from reaching/leaving your computer.</p></blockquote>
<p>This was a very limited simulation.  Packets all arrived in order, signatures were guaranteed to start with 6 constant characters and have a maximum length, and the use of a buffer was limited to 4500 characters.  The hardest parts were making sure that offsets from the beginning of the stream were reported correctly and trying to minimize the number of times the same characters are re-scanned.  One difficulty with the spec was that the implementation would never know that it was the last packet.  Thus you had to maintain all characters relating to a partial match until you either matched a signature or were able to rule out a match, creating much repeated scanning of the same characters.  I was not able to solve this problem elegantly in the assignment timeframe (although the professor was).  Below is a class-diagram of my solution.</p>
<p><a href="http://intmain.net/wp-content/uploads/2009/09/cs32p4-UML.gif"><img class="size-full wp-image-26 aligncenter" title="cs32p4-UML" src="http://intmain.net/wp-content/uploads/2009/09/cs32p4-UML.gif" alt="cs32p4 UML CS32 Project 4: Intrusion Prevention System (Part 1)" width="530" height="367" /></a></p>
<p>For my solution, I wrote an implementation of the Set (similar to STL Set) to store my detected Incidents and I created a Hash table for the signatures.  I chose a set to store the Incidents so that I was guaranteed no duplicates, whereas I chose a Hash Table for the signatures for the O(1) performance.  My set was unfortunately implemented as a circular linked list (with O(n) performance); it would have been much faster had I had the time to implement it as a Binary Search Tree.  Packets were read into the buffer until there were at least 6 characters in the buffer.  Once the buffer had sufficient characters, it was scanned against the hash table.  My algorithm kept track of any partial matches—where the first part of a signature matched but the buffer did not contain enough characters to verify that the match was complete.  If the algorithm was able to match a complete signature, it created an Incident marking the signature ID and the location in the stream.  Once the entire buffer was scanned, the first part of the buffer was discarded up to the point of a partial match or the last 5 characters.  Then a new packet is read into the buffer and we repeat!  Since packets had a maximum length of 1500, and I discarded after each scan, the buffer was guaranteed to never reach beyond 3000 characters in size.</p>
<p>My solution was not very efficient.  If the packet had included some parameter that described it as the last packet, it would have been quite simple to cut redundant scanning; just stop scanning as soon as you have reached a partial match in order to read in a new packet.  However, this would create a bug in that incidents in the very last packet would not be caught if a partial match preceded that incident.  Therefore, my solution had a bunch of redundant scanning and much more copying than would be warranted otherwise.  This made my execution time rocket to about 10 times the Professor&#8217;s solution.</p>
<p>For those interested, my matching function is included below.  It&#8217;s recursive, and probably like every other matching function, but here it is.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;">MatchType IPSImpl<span style="color: #008080;">::</span><span style="color: #007788;">match</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> sig, <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> text<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
&nbsp;
  <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">size_t</span> k <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> sig<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008080;">;</span> k<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>text<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>sig<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">'*'</span> <span style="color: #000040;">&amp;&amp;</span> sig<span style="color: #008000;">&#91;</span>k<span style="color: #000040;">+</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008000;">&#41;</span>
        <span style="color: #0000ff;">return</span> MATCH<span style="color: #008080;">;</span>
      <span style="color: #0000ff;">return</span> PARTIAL_MATCH<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>sig<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">'*'</span><span style="color: #008000;">&#41;</span> <span style="color: #666666;">//if the signature has a wildcard</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">size_t</span> j <span style="color: #000080;">=</span> k<span style="color: #008080;">;</span> j<span style="color: #000040;">-</span>k <span style="color: #000080;">&lt;=</span> WILDCARD_LENGTH<span style="color: #008080;">;</span> j<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>text<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> sig<span style="color: #008000;">&#91;</span>k <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
	  MatchType temp <span style="color: #000080;">=</span> match<span style="color: #008000;">&#40;</span>sig <span style="color: #000040;">+</span> k <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span>, text <span style="color: #000040;">+</span> j<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//recur</span>
	  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>temp <span style="color: #000040;">!</span><span style="color: #000080;">=</span> NO_MATCH<span style="color: #008000;">&#41;</span>
	    <span style="color: #0000ff;">return</span> temp<span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>text<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008000;">&#41;</span> <span style="color: #666666;">//could be a match in next packet</span>
          <span style="color: #0000ff;">return</span> PARTIAL_MATCH<span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
	<span style="color: #0000ff;">return</span> NO_MATCH<span style="color: #008080;">;</span>
      <span style="color: #008000;">&#125;</span>
      <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>sig<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> text<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span>  <span style="color: #000040;">&amp;&amp;</span>  sig<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #FF0000;">'?'</span><span style="color: #008000;">&#41;</span>
        <span style="color: #0000ff;">return</span> NO_MATCH<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #0000ff;">return</span> MATCH<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://intmain.net/2009/09/cs32-project-4-intrusion-prevention-system-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

