<?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>KingAnt.net &#187; Computers</title>
	<atom:link href="http://kingant.net/tag/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://kingant.net</link>
	<description>the personal nook of Mark Doliner</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:02:03 +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>Google Summer of Code Mentor Summit 2009</title>
		<link>http://kingant.net/2009/10/google-summer-of-code-mentor-summit-2009/</link>
		<comments>http://kingant.net/2009/10/google-summer-of-code-mentor-summit-2009/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 09:37:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Pidgin]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=373</guid>
		<description><![CDATA[Last weekend Google hosted their 3rd annual mentor summit, following the end of their 4th annual summer of code. The mentor summit is when a few hundred mentors gather together and participate in an unconference style conference. I went for &#8230; <a href="http://kingant.net/2009/10/google-summer-of-code-mentor-summit-2009/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
Last weekend Google hosted their 3<sup>rd</sup> annual mentor summit, following the end of their 4<sup>th</sup> annual <a href="http://code.google.com/soc/">summer of code</a>.  The mentor summit is when a few hundred mentors gather together and participate in an <a href="http://en.wikipedia.org/wiki/Unconference">unconference</a> style conference.  I went for the Pidgin project, along with Gary Kramlich and Ethan Blanton.
</p>
<ul>
<li><a href="http://developer.pidgin.im/wiki/SummerOfCode2009">List of Pidgin projects for 2009</a></li>
<li><a href="http://www.flickr.com/photos/tags/mentorsummit09/">Pictures from the weekend</a></li>
<li><a href="http://gsoc-wiki.osuosl.org/index.php/Session_Notes_2009">Notes from the sessions</a></li>
<li>A few kind people arrived to the area early and spent a few days in a documentation &#8220;sprint.&#8221;  They created a <a href="http://en.flossmanuals.net/GSoCMentoringGuide">summer of code mentoring guide</a></li>
</ul>
<p>
The conference was super cool.  I got to be humbled by talking to a whole bunch of really smart open source people.  Here are my notes:
</p>
<h2>On One Laptop Per Child (&#8220;OLPC&#8221;)</h2>
<p>
I&#8217;ve been wondering for a while whether the OLPC program could actually make a difference.  One session, led by Bryan Berry of <a href="http://www.sugarlabs.org/">Sugar Labs</a>, makes me think that it can and already has.  Bryan is the co-founder and CTO of <a href="http://www.olenepal.org/">OLE Nepal</a>, an organization helping deploy OLPC in Nepal, and creator of <a href="http://karmaeducation.org/">Karma</a>, a framework for creating interactive activities for the Sugar environment using javascript and html5.
</p>
<p>
Seeing demos of the exercises they&#8217;ve created and hearing his first hand stories was pretty incredible.  At least some schools in Nepal teach by having the teacher recite something (e.g. &#8220;one plus two is three&#8221;), and all the students repeat it and memorize.  But this often fails to teach the students <i>why</i> one plus two is three.  In one example a student was asked &#8220;what is one plus two&#8221; and they replied with &#8220;three.&#8221;  But the same student was not able to answer &#8220;what is two plus one.&#8221;
</p>
<p>
Children in third world countries generally want to learn&#8211;more so than children in the US.  They realize that education can help them achieve something greater in life.  And computers are interesting to them.  Combine students, computers, and engaging lesson plans about math, geography, etc. and the students will have a more varied education and will learn better.
</p>
<h2>On Forking Open Source Projects</h2>
<ul>
<li>Forking helps keep people motivated.  It increases competition, keeps developers on their toes.</li>
<li>A fork could be like a &#8220;research and development&#8221; branch.  People work on crazy fun new features in the forked project, and the good stuff gets merged back into the original.</li>
<li>The smaller the project, the more willing the maintainer should be to give people access.  There is a natural inclination to be protective of your project&#8211;it&#8217;s your code, your baby.  But you must be willing to give up control for there to be forward progress.  This reminds me of dictator governments like Cuba/Fidel Castro and North Korea/Kim Jong-Il.  The dictator is afraid to relinquish control for fear of what might happen.</li>
<li>Benefits of a fork?  Developers have more freedom to do what they want, which allows for innovation.  The best project will survive&#8211;if developers want their project to survive then they must make decisions that benefit the community at large.</li>
<li>Downsides of a fork?  Development effort is divided.  Users might not know which project to use.  Distributors may not know which package to distribute; distributing both means more work.</li>
</ul>
<h2>Miscellaneous</h2>
<ul>
<li>STUN &#8211; A protocol used to determine your public IP by asking a server on the &#8220;outside&#8221; Internet</li>
<li>TURN &#8211; A protocol used to proxy traffic through an intermediate server.  Written with SIP in mind.  Increases the likelihood of being able to establish a connection to another party, but it also introduces an additional hop, which leads to lagginess, which is bad for voice/video communication.</li>
<li>ICE &#8211; A protocol that describes a method for establishing a direct connection with another peer.  Written with SIP in mind.  It uses an exhaustive algorithm to try every possible IP address for yourself in the hopes that one will work.  You construct a list of your host&#8217;s IP addresses plus your public IP address determined by using STUN.  This information, along with a fallback TURN server, is sent to the other party, who begins attempting to connect.</li>
<li>OpenAFS is under active development, and is used by some very large organizations</li>
<li>I should change my alias for grep to enable the color option</li>
<li>I should read <a href="http://en.wikipedia.org/wiki/Zen_and_the_Art_of_Motorcycle_Maintenance">Zen and the Art of Motorcycle Maintenance</a></li>
</ul>
<h2>On Trolling (this session was half intended as a joke)</h2>
<ul>
<li>I should read the <a href="http://en.wikipedia.org/wiki/The_UNIX-HATERS_Handbook">UNIX-HATERS Handbook</a></li>
<li>I should read the <a href="http://en.wikipedia.org/wiki/Sokal_affair">Sokal paper</a></li>
<li>&#8220;Linus==troll&#8221;</li>
<li>&#8220;Version con-trolling&#8221;</li>
<li>&#8220;We had this problem where people had to download our software and type &#8216;make&#8217;&#8221; &#8211;Marty Connor</li>
<li>Adding support for the old school Unix talk command to Pidgin could be a fun April Fools joke</li>
</ul>
<div style='display:none' id="post-refEl-373"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2009/10/google-summer-of-code-mentor-summit-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yahoo&#8217;s IM formatting</title>
		<link>http://kingant.net/2009/08/yahoos-im-formatting/</link>
		<comments>http://kingant.net/2009/08/yahoos-im-formatting/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 09:45:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=368</guid>
		<description><![CDATA[I&#8217;ve been working on instant messaging software for seven years, so I&#8217;ve been exposed to a lot of IM protocols. The &#8220;protocol&#8221; is the structure of bytes that gets sent back and forth between your computer and the IM service. &#8230; <a href="http://kingant.net/2009/08/yahoos-im-formatting/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on instant messaging software for seven years, so I&#8217;ve been exposed to a lot of IM protocols.  The &#8220;protocol&#8221; is the structure of bytes that gets sent back and forth between your computer and the IM service.</p>
<p>The major IM protocols (AIM, MSN, Yahoo, etc) are fairly well thought out and logical.  But sometimes things go horribly wrong.  An example that I recently learned about, and the impetus for this post, is the format used for Yahoo IMs.  Here&#8217;s a handy pocket reference:</p>
<ol>
<li>
<p><b>Mixture of ANSI escape sequences and HTML</b><br />Bold, italic, underline and font color are specified using <a href="http://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape sequences</a>, but font size and font face are specified using the &lt;font&gt; HTML tag.</p>
</li>
<li>
<p><b>HTML tags aren&#8217;t closed</b><br />Subsequent tags just override the value of the previous tags.  Message formatting is more linear than hierarchical.  For example, &#8220;&lt;font face=&#8217;Georgia&#8217;&gt;test1&lt;font face=&#8217;Courier&#8217;&gt;test2.&#8221;</p>
</li>
<li>
<p><b>HTML font tag size attribute is in points</b><br />For example, &#8220;&lt;font size=&#8217;14&#8242;&gt;test.&#8221;  Normally the size given in the font tag is a relative value between 1 and 7, with 1 being &#8220;small&#8221; and 7 being &#8220;large.&#8221;</p>
</li>
<li>
<p><b>Special HTML entities aren&#8217;t escaped</b><br />For example, if an IM contains a less than sign it is sent as &#8220;alien &lt; predator.&#8221;  Normally &lt; &gt; and &amp; are written as &amp;lt; &amp;gt; &amp;amp; in HTML documents so that programs can accurately determine if a &lt; is the start of an HTML tag or is a literal less than sign.</p>
<p>Why does this matter?  It means the user cannot send this IM, because it is interpreted as a font tag instead of plain text: &#8220;&lt;font size=&#8217;32&#8242;&gt;Huge text.&#8221;  This generally isn&#8217;t a problem for normal users, but can be a nuisance for web developers, who may want to IM that text to a friend and have it appear the way they typed it.</p>
</li>
</ol>
<div style='display:none' id="post-refEl-368"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2009/08/yahoos-im-formatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I work on open source</title>
		<link>http://kingant.net/2009/07/why-i-work-on-open-source/</link>
		<comments>http://kingant.net/2009/07/why-i-work-on-open-source/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 05:52:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Pidgin]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=362</guid>
		<description><![CDATA[I haven&#8217;t written about this before, have I? I think the world is better off with free software. I don&#8217;t have anything against closed source or non-free software, I just think typical development processes for free software produce better products &#8230; <a href="http://kingant.net/2009/07/why-i-work-on-open-source/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t written about this before, have I?</p>
<p>I think the world is better off with free software.  I don&#8217;t have anything against closed source or non-free software, I just think typical development processes for free software produce better products in the long run.  They produce something that meets the needs of users better, with less fluff.</p>
<p>And I guess I feel like I can have a positive impact on open source software.  Working on Pidgin is like my way of giving back to the authors of all the other free software that I use.</p>
<p>And I take a lot of pride in the code that I write.  It is a reflection of who I am.  If I write something that&#8217;s buggy then it makes me look bad.  So you don&#8217;t need to try to talk me into fixing something that I wrote, because I care regardless.  I care a lot more than you do, believe me.  And it pains me when I don&#8217;t have time to fix my bugs.</p>
<div style='display:none' id="post-refEl-362"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2009/07/why-i-work-on-open-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scrobble Scrobble</title>
		<link>http://kingant.net/2009/06/scrobble-scrobble/</link>
		<comments>http://kingant.net/2009/06/scrobble-scrobble/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 07:02:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=358</guid>
		<description><![CDATA[Last.fm&#8217;s audio scrobbler has an option that &#8220;scrobbles&#8221; a track after to listening to anywhere between 50% to 100% of the song. So the song is considered listened to if you only listen to 4:30 of a 5 minute song. &#8230; <a href="http://kingant.net/2009/06/scrobble-scrobble/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last.fm&#8217;s audio scrobbler has an option that &#8220;scrobbles&#8221; a track after to listening to anywhere between 50% to 100% of the song.  So the song is considered listened to if you only listen to 4:30 of a 5 minute song.  I LOVE THIS OPTION.  I wish every music player did this.  It doesn&#8217;t even need to be an option&#8211;just hardcode it to MAX(30 seconds, 0.8 * tracklength)</p>
<div style='display:none' id="post-refEl-358"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2009/06/scrobble-scrobble/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Best Practice: Rembember Application State</title>
		<link>http://kingant.net/2009/06/best-practice-rembember-application-state/</link>
		<comments>http://kingant.net/2009/06/best-practice-rembember-application-state/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 06:54:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=357</guid>
		<description><![CDATA[From Firefox I learned that applications should always save their state. When you close and restart an application is should restore its state to what it was previously. Open windows, open documents, which text was highlighted, how far down you&#8217;ve &#8230; <a href="http://kingant.net/2009/06/best-practice-rembember-application-state/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
From Firefox I learned that applications should always save their state.  When you close and restart an application is should restore its state to what it was previously.  Open windows, open documents, which text was highlighted, how far down you&#8217;ve scrolled, the undo and redo buffers, etc.
</p>
<p>
Let&#8217;s use a text editor as an example.  Say you have a grocery list saved on your computer.  You open the grocery list and add three lines to it, but before you can save it a rabbit gnaws through your computer&#8217;s power cable and it turns off!  You replace the power cable, boot your computer and start the text editor.  It should:
</p>
<ol>
<li>Open your grocery list automatically</li>
<li>Restore the three lines you added before you lost power</li>
<li>Realize that the three lines have not been saved to the file yet</li>
<li>Let you &#8220;undo&#8221; repeatedly until the grocery list is back to what it was originally</li>
</ol>
<div style='display:none' id="post-refEl-357"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2009/06/best-practice-rembember-application-state/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Changes in Gmail</title>
		<link>http://kingant.net/2009/02/changes-in-gmail/</link>
		<comments>http://kingant.net/2009/02/changes-in-gmail/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 08:32:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=352</guid>
		<description><![CDATA[Google recently made a few changes to the buttons in Gmail. Here&#8217;s a before and after comparison: But they got two things wrong: The mouse cursor doesn&#8217;t change when hovering over the new buttons. With the old buttons the cursor &#8230; <a href="http://kingant.net/2009/02/changes-in-gmail/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
Google recently made a few changes to the buttons in Gmail.  Here&#8217;s a before and after comparison:<br />
<a href="http://www.flickr.com/photos/markdoliner/3254565391/" title="Changes in Gmail by MarkDoliner, on Flickr"><img src="//farm4.static.flickr.com/3507/3254565391_3fd9401b79_o.png" width="984" height="325" alt="Changes in Gmail" /></a>
</p>
<p>
But they got two things wrong:
</p>
<ol>
<li>The mouse cursor doesn&#8217;t change when hovering over the new buttons.  With the old buttons the cursor changed to a little clicky hand thing, and you knew the thing was a button and you could click on it.  The new buttons don&#8217;t seem clickable.</li>
<li>The new buttons look the same as the new drop-down menus (other than the little black triangle on the right side).  Buttons and menus should look different.</li>
</ol>
<div style='display:none' id="post-refEl-352"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2009/02/changes-in-gmail/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Web browser SSL warnings</title>
		<link>http://kingant.net/2009/01/web-browser-ssl-warnings/</link>
		<comments>http://kingant.net/2009/01/web-browser-ssl-warnings/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 10:46:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=351</guid>
		<description><![CDATA[These are the warnings that Firefox 3.0.5 is capable of showing: I once heard someone lament that as soon as a user does a web search and the browser asks &#8220;you&#8217;re submitting information that&#8217;s not encrypted, do you want us &#8230; <a href="http://kingant.net/2009/01/web-browser-ssl-warnings/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>These are the warnings that Firefox 3.0.5 is capable of showing:<br />
<a href="http://www.flickr.com/photos/markdoliner/3254590881/" title="Firefox Warnings by MarkDoliner, on Flickr"><img src="//farm4.static.flickr.com/3307/3254590881_5a37b43d0d_o.png" width="597" height="218" alt="Firefox Warnings" /></a></p>
<p>I once heard someone lament that as soon as a user does a web search and the browser asks &#8220;you&#8217;re submitting information that&#8217;s not encrypted, do you want us to warn you about this in the future?&#8221; the user invariably says, &#8220;no, I don&#8217;t care.&#8221;</p>
<p>And that&#8217;s unfortunately because it means that if the user happens upon a web site that doesn&#8217;t force them to use https, then that user might accidentally submit their username and password over an insecure connection and the web browser isn&#8217;t able to warn them about it.</p>
<p>My question is, why couldn&#8217;t browsers add this additional check: &#8220;Show a warning dialog when I submit passwords that are not encrypted?&#8221;  It&#8217;s as simple as checking if the HTML form performing the HTTP POST contains an &lt;input type=&#8221;password&#8221;/&gt; input box.  In fact, you could just modify the current check for submitting unencrypted information to only warn if there is a password field, because that check is pretty useless as-is.</p>
<p>Can anyone think of any reason NOT to do this?  I&#8217;ll file a feature request in Firefox Bugzilla if people think it&#8217;s a good idea.</p>
<p><b>Edit:</b><br />
Done: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=476797">https://bugzilla.mozilla.org/show_bug.cgi?id=476797</a></p>
<div style='display:none' id="post-refEl-351"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2009/01/web-browser-ssl-warnings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Startup Ambience</title>
		<link>http://kingant.net/2008/09/the-startup-ambience/</link>
		<comments>http://kingant.net/2008/09/the-startup-ambience/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 08:33:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=307</guid>
		<description><![CDATA[This whole &#8220;computer startup company&#8221; thing really is different than what I was used to on the east coast. I mean, I had heard about Google and Yahoo! and PayPal and eBay and Amazon and Netscape, but it&#8217;s hard to &#8230; <a href="http://kingant.net/2008/09/the-startup-ambience/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
This whole &#8220;computer startup company&#8221; thing really is different than what I was used to on the east coast.  I mean, I had heard about Google and Yahoo! and PayPal and eBay and Amazon and Netscape, but it&#8217;s hard to get a feel for them until you&#8217;ve worked at a computer startup in the San Francisco Bay Area.
</p>
<p>
First of all, Stanford.  At the school I went to, NC State, most people have the mindset that they&#8217;ll graduate, get a job at a normal, low profile, stable company for a while.  Maybe get promoted.  Maybe switch to a different company, etc.
</p>
<p>
But Stanford is different.  For some reason it seems like most computer science graduates from Stanford have a hunger to come up with a crazy new idea and start their own company, get funded by a venture capital firm and build the company into something big or sell it for a lot of money.  It&#8217;s like Stanford <i>breeds</i> computer startups.
</p>
<p>
Just living in the bay area is crazy.  I swear half the people in my local climbing gym work at tech companies.  It&#8217;s like everyone living in this area exists to support the software created here.
</p>
<p>
There are a few popular websites that cover startup companies.  You should check these out if you want to get a feel for the crazy ideas people come up with:
</p>
<ul>
<li><a href="http://www.techcrunch.com/">TechCrunch</a></li>
<li><a href="http://venturebeat.com/">VentureBeat</a></li>
<li><a href="http://valleywag.com/">Valleywag</a></li>
<li><a href="http://mashable.com/">Mashable</a></li>
<li><a href=""></a></li>
<li><a href="http://allthingsd.com/">AllThingsD</a></li>
</ul>
<div style='display:none' id="post-refEl-307"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2008/09/the-startup-ambience/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Asynchronous MySQL client library</title>
		<link>http://kingant.net/2008/09/asynchronous-mysql-client-library/</link>
		<comments>http://kingant.net/2008/09/asynchronous-mysql-client-library/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 07:49:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=306</guid>
		<description><![CDATA[Our de facto method for asynchronous programming at Meebo is to use a single thread with non-blocking sockets and some sort of socket watching/readiness notification (poll, select, epoll, libevent, glib&#8217;s mainloop, etc). This is what Pidgin does, too. It is &#8230; <a href="http://kingant.net/2008/09/asynchronous-mysql-client-library/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
Our de facto method for asynchronous programming at Meebo is to use a single thread with non-blocking sockets and some sort of socket watching/readiness notification (poll, select, epoll, libevent, glib&#8217;s mainloop, etc).  This is what Pidgin does, too.  It is by far my favorite approach to asynchronous programming.  (There are some other approaches listed in Dan Kegel&#8217;s article <a href="http://www.kegel.com/c10k.html"><i>The C10K problem</i></a>.)
</p>
<p>
It works especially well for clients.  For servers, if you want to take advantage of multiple processors or multiple cores then you either have to spawn threads or use multiple processes.
</p>
<p>
We use MySQL a lot at work.  And we use C a lot.  Unfortunately the C API for MySQL is synchronous.  This means if you perform a query then the entire application sits idle until the database server responds.  This is extremely inconvenient.  There are various hacks and 3rd party libraries you can use to perform asynchronous queries, but they&#8217;re a bit ugly and don&#8217;t work that well.  We ended up writing a proxy server that runs on the local machine and proxies queries to the database.  So the client connects to the proxy and submits a query, control is returned to the client immediately, the client&#8217;s event loop watches the socket connected to the proxy server and calls a callback function once the proxy has returned the result from the database.
</p>
<p>
It works well enough, but I feel like the world would benefit from a solid asynchronous MySQL C API.  Or maybe we should just switch to PostgreSQL.
</p>
<p>
P.S. epoll is ridiculously sweet.  If you&#8217;re concerned about the performance of a network-heavy application then use epoll (or kqueue if you&#8217;re on BSD)!  The difference is night and day.
</p>
<p>
<strong>Update 2010-02-26:</strong><br />
People suggested some projects in the comments.  Also see:<br />
<a href="https://launchpad.net/myconnpy">https://launchpad.net/myconnpy</a><br />
<a href="http://cv.arpalert.org/mysac.html">http://cv.arpalert.org/mysac.html</a></p>
<div style='display:none' id="post-refEl-306"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2008/09/asynchronous-mysql-client-library/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>readdir(), strtol(), errno and you!</title>
		<link>http://kingant.net/2008/09/readdir-strtol-errno-and-you/</link>
		<comments>http://kingant.net/2008/09/readdir-strtol-errno-and-you/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 07:14:00 +0000</pubDate>
		<dc:creator>Mark Doliner</dc:creator>
				<category><![CDATA[All]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://kingant.net/blog/?p=305</guid>
		<description><![CDATA[Usually when you call a function you can determine if there was an error based solely on the return code. But the functions readdir() strtol() and strtoll() are different. For these functions, if you want to know if there was &#8230; <a href="http://kingant.net/2008/09/readdir-strtol-errno-and-you/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Usually when you call a function you can determine if there was an error based solely on the return code.  But the functions readdir() strtol() and strtoll() are different.  For these functions, if you want to know if there was an error then you <b>must</b> set errno to 0 before calling them.  Then you can check whether errno is still 0 afterward.</p>
<p>Anyone know of any other common functions with the same behavior?</p>
<div style='display:none' id="post-refEl-305"></div>]]></content:encoded>
			<wfw:commentRss>http://kingant.net/2008/09/readdir-strtol-errno-and-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

