<?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>Microbits &#187; c#</title>
	<atom:link href="http://microbits.info/index.php/tag/c-sharp/feed" rel="self" type="application/rss+xml" />
	<link>http://microbits.info</link>
	<description>Random thoughts about programming, gaming, and the world.</description>
	<lastBuildDate>Mon, 31 Oct 2011 04:43:14 +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>Python for Windows applications</title>
		<link>http://microbits.info/index.php/2010/06/python-for-windows-applications</link>
		<comments>http://microbits.info/index.php/2010/06/python-for-windows-applications#comments</comments>
		<pubDate>Wed, 30 Jun 2010 23:56:25 +0000</pubDate>
		<dc:creator>recon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[gtk]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://microbits.info/?p=632</guid>
		<description><![CDATA[From what I&#8217;ve seen of Python, I relegated it to CUI and backend type tasks, since C# and .NET offer a powerful GUI platform out of the box, and Python seemingly didn&#8217;t have anything similar. After looking into the OpenERP/OpenObject project (which looks pretty neat), I realized their complex GUI was written in Python. After [...]]]></description>
			<content:encoded><![CDATA[<p>From what I&#8217;ve seen of Python, I relegated it to CUI and backend type tasks, since C# and .NET offer a powerful GUI platform out of the box, and Python seemingly didn&#8217;t have anything similar.</p>
<p>After looking into the <a href="http://openerp.com/" target="_blank">OpenERP</a>/<a href="http://openobject.com/" target="_blank">OpenObject</a> project (which looks pretty neat), I realized their complex GUI was written in Python. After a little investigation, I figured out they were using <a href="http://www.pygtk.org/" target="_blank">PyGTK</a> (Python bindings for the GTK widget toolkit) and <a href="http://glade.gnome.org/" target="_blank">Glade</a> (a GUI builder).</p>
<p>Combining Python, PyGTK and Glade seems to lead to a workable solution for creating GUIs for Python applications. There&#8217;s a nice tutorial on how all these pieces fit together <a href="http://tadeboro.blogspot.com/2009/04/gtkdialog-tutorial-part-1.html" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://microbits.info/index.php/2010/06/python-for-windows-applications/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TCP server security &#8211; LINQ and C#</title>
		<link>http://microbits.info/index.php/2010/01/tcp-server-security-linq-and-c</link>
		<comments>http://microbits.info/index.php/2010/01/tcp-server-security-linq-and-c#comments</comments>
		<pubDate>Thu, 21 Jan 2010 21:59:01 +0000</pubDate>
		<dc:creator>recon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[linq]]></category>

		<guid isPermaLink="false">http://microbits.info/?p=449</guid>
		<description><![CDATA[I&#8217;m currently working on a TCP client/server system, and I wanted to prevent clients from DoSing the server. One way to do that is by restricting clients to a certain number of connections in a given time period. Since the code is designed to prevent a DoS condition, it must be extremely fast and efficient [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently working on a TCP client/server system, and I wanted to prevent clients from DoSing the server.</p>
<p>One way to do that is by restricting clients to a certain number of connections in a given time period. Since the code is designed to prevent a DoS condition, it must be extremely fast and efficient because it may be run thousands of times per minute (during a DoS attack for example).</p>
<p>I designed the connection limit system around a collection of connection records, a prune timer, and a test when the server accepts a client connection.</p>
<p>Since I needed to check two variables (timestamp and ip) in each connection record to determine the connection count for a given IP address in a given time period, I decided to use LINQ, which worked nicely:</p>
<pre class="brush:c-sharp">// Get this client's connection count
int connCount = (from conn in _connectionList
                 where conn.Ip == clientIp &amp;&amp;
                 conn.Timestamp &gt;
                   DateTime.Now.AddMinutes(-howFarBackInMinutesToCheck)
                 select conn.Ip).Count();
</pre>
<p>The other query I needed was for pruning the connection list:</p>
<pre class="brush:c-sharp"> // Get the connections to prune
var connQuery = from conn in _connections
                where conn.Timestamp &lt;
                  DateTime.Now.AddMinutes(-howFarBackInMinutesToCheck)
                select conn;
</pre>
<p>After checking the number of records to prune was greater than zero (connQuery.Count()), I pruned them by iterating through the query (LINQ queries implement IEnumerable).</p>
]]></content:encoded>
			<wfw:commentRss>http://microbits.info/index.php/2010/01/tcp-server-security-linq-and-c/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.818 seconds -->

