Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
514 lines (336 sloc) 34.5 KB
<!---
;;
;; This softeware is Copyright (c) 2009 A.F. Haffmans
;;
;; This file is part of cl-bliky.
;;
;; cl-bliky is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; cl-bliky is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with cl-bliky. If not, see <http://www.gnu.org/licenses/>.
;;
;;
--->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset =UTF-8">
<meta name="google-site-verification" content="g1m0Dd6G8xGMgpaP4Zw5S9vpJ_O26BsuNbKZBw8IwaM" />
<title> Mohegan SkunkWorks </title>
<link rel="stylesheet" href="/style.css" type="text/css"/>
</head>
<body>
<div id="blog-title">
<a href="/"> <h1> Mohegan SkunkWorks </h1> </a>
</div>
<div id="mainClm">
<div id="post">
<div id="post-timestamp" >
<p>Sat, 26 Jun 2010 20:00:53 EST </p>
</div>
<h2>
<a href="/finding-things-in-a-mongo-database-.html"> finding things in a mongo database </a>
</h2>
<div id="post-intro">
<p>The generic method <em>dbfind</em> provides the basic query interface in cl-mongo. It's defined as:</p>
<pre><code>(defgeneric db.find (collection kv &key) )
</code></pre>
<p><em>db.find</em> returns documents in the collection which satisfy the query pattern
specified by the bson document kv. If you use the keyword <em>:all</em> db.find will return all documents. If you're looking for all documents with specific (key value) pair you'd specify that those as the query pattern :</p>
<pre><code> (db.find "foo" (kv (kv "k" 3) (kv "l" 4)))
</code></pre>
</div>
<a href="/finding-things-in-a-mongo-database-.html"> <h6> Continue reading "finding things in a mongo database " </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Wed, 23 Jun 2010 16:20:59 EST </p>
</div>
<h2>
<a href="/key-value-pairs-in-cl-mongo.html"> key-value pairs in cl-mongo </a>
</h2>
<div id="post-intro">
In a key-value database like <a href="">mongodb</a> the fundamental data element is the key value pair.
Key-value pairs in languages like javascript or python as have a seperate representation like :</p>
<pre><code>
{ key : value }
</code></pre>
<p>In lisp a natural enough equivalent is the association list or alternatively the dotted list.
Since the javascript expression also creates a key-value object, I wanted to mimick the same semantics in lisp.
In order to stay a close as possible to the java script syntax, and to also create a disticnt type
I could switch on when dispatching generic function calls, I created the two types.</p>
</div>
<a href="/key-value-pairs-in-cl-mongo.html"> <h6> Continue reading "key-value pairs in cl-mongo" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sun, 20 Jun 2010 10:35:02 EST </p>
</div>
<h2>
<a href="/literate-programming-intro-to-cl-mongo.html"> literate programming intro to cl-mongo </a>
</h2>
<div id="post-intro">
<p>After the jump you'll find the source code of the
<a href="http://www.github.com/fons/cl-mongo">cl-mongo</a>
<a href="http://blip.tv/file/3680363">demo</a>
I gave the <a href="http://www.10gen.com/event_mongony_10may21">mongonyc</a> event.
The code is in
<a href="http://en.wikipedia.org/wiki/Literate_programming">literate programming</a>
style and available as <a href="http://gist.github.com/445859">gist</a>.</p>
</div>
<a href="/literate-programming-intro-to-cl-mongo.html"> <h6> Continue reading "literate programming intro to cl-mongo" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Fri, 18 Jun 2010 15:31:29 EST </p>
</div>
<h2>
<a href="/mongonyc-presentation.html"> mongonyc presentation. </a>
</h2>
<div id="post-intro">
On may 21st this year the folks at <a href="http://www.10gen.com/">10gen</a> hosted
<a href="http://www.10gen.com/event_mongony_10may21">mongonyc</a>.
This conference the first mongodb conference
here in New York. I give a brief <a href="http://blip.tv/file/3680363">lightning talk</a>
on <a href="http://www.github.com/fons/cl-mongo">cl-mongo</a> </p>
<p><img src="http://github.com/fons/blog-images/raw/master/20100521/badge-mongonyc-large.png" alt="mongonyc presetber badge" align="right">
The contents of the presentation can be found
<a href="http://github.com/fons/presentations/tree/master/20100521/">here</a>.</p>
<p>It was great to see folks from various start-ups here in the City turn up for this.
I was especially interested in how mongodb was used.
</div>
<a href="/mongonyc-presentation.html"> <h6> Continue reading "mongonyc presentation." </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sat, 13 Mar 2010 17:39:02 EST </p>
</div>
<h2>
<a href="/cl-mongo-now-on-multiple-lisps.html"> cl-mongo now on multiple lisps. </a>
</h2>
<div id="post-intro">
<p><a href="http://github.com/fons/cl-mongo">cl-mongo</a> now runs in the following lisp images : <a href="http://www.sbcl.org/">sbcl</a>, <a href="http://clisp.cons.org/">clisp</a>, <a href="http://www.franz.com/products/allegrocl/">allegro common lisp</a> and <a href="http://trac.clozure.com/ccl">clozure common lisp</a>. I was not able to get it working with <a href="http://common-lisp.net/project/armedbear/">armed bear common lisp</a>.I originally used sbcl to develop cl-mongo, but it is my goal to be able to run it on most lisps. <br> <br> To get <a href="http://github.com/fons/cl-mongo">cl-mongo</a> to run with clisp I needed to make only one fairly minor change in the networking code.<br> <br> When you send an insert to mongodb, it does not respond back. When you send a query request you obviously do get a response back. Since I'm using the same socket connection for writes and reads I need to have some mechanism in place to wait for a response, when one is expected. A blocking read on the socket is out of the question. That would destroy performance. </p>
</div>
<a href="/cl-mongo-now-on-multiple-lisps.html"> <h6> Continue reading "cl-mongo now on multiple lisps." </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Fri, 12 Mar 2010 15:03:57 EST </p>
</div>
<h2>
<a href="/adding-clojure-to-an-existing-slime-setup-in-emacs.html"> Adding clojure to an existing slime setup in emacs </a>
</h2>
<div id="post-intro">
<p>The current <a href="http://github.com/technomancy/swank-clojure">recommended setup of emacs and slime with clojure</a> is to have <a href="http://tromey.com/elpa/">elpa</a> handle all the dependencies. As an alternative, you can start a swank server using either the <a href="http://github.com/technomancy/leiningen/tree/master/lein-swank/">swank plug-in</a> for the <a href="http://github.com/technomancy/leiningen">leiningen</a> build tool, or the <a href="http://github.com/talios/clojure-maven-plugin">swank plug-in</a> for the <a href="http://maven.apache.org/">maven</a> build tool. <br> <br> All of this advice is good, but I've been using slime with sbcl and emacs for years and I don't want to start from scratch just to add clojure. In addition, rather than hand things off to a tool like elpa, I'd like to install things myself, so I get to understand how the various pieces work together.<br> <br> I'm going to show how you too can use use the <a href="http://common-lisp.net/project/slime/">current cvs head for slime</a>, and the current git repos for <a href="http://github.com/richhickey/clojure">clojure</a>, <a href="http://richhickey.github.com/clojure-contrib/">clojure-contrib</a> and <a href="git://github.com/technomancy/swank-clojure.git">swank clojure</a> to run clojure with slime and lisp. I"ll provide a few helpful links to get more information on slime and swank. As it turns out, there 's currently a bit of incompatibility between clojure and the slime package, but it's minor and easy to work around. </p>
</div>
<a href="/adding-clojure-to-an-existing-slime-setup-in-emacs.html"> <h6> Continue reading "Adding clojure to an existing slime setup in emacs" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sun, 28 Feb 2010 19:18:52 EST </p>
</div>
<h2>
<a href="/connections-in-cl-mongo.html"> Connections in CL-MONGO </a>
</h2>
<div id="post-intro">
<p>I revamped the way connections to a mongo database are handled in cl-mongo. In the new implementation each connection is referenced by a unique name. Each connection is stored in a connection registry. Database calls in cl-mongo default to using the :default connection. The connection parameters used by the default connection for host, port and db are accessible through the <em>mongo-default-..</em> special variables. <br> <br><code>defgeneric mongo (&amp;key host port db name)</code> gets the connection referred to by the :name keyword. The default for :name is :default. If no connection with that name exists, a new connection will be created.<br> <br> <code>defun mongo-show ()</code> will show all connections currently in the registry. <br> <br><code>(defgeneric mongo-swap (left right)</code> will swap two connections. This is useful if you want to use a different <em>default</em> connection, or want to change the parameters on an existing named connection. <br> <br><code>defgeneric mongo-close ( name )</code> is used to close a connection. The special keyword :all can be used to close all connections in the registry. <br> <br> </p>
</div>
<a href="/connections-in-cl-mongo.html"> <h6> Continue reading "Connections in CL-MONGO" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Wed, 17 Feb 2010 19:04:03 EST </p>
</div>
<h2>
<a href="/generating-documentation-for-cl-mongo-.html"> Generating Documentation for cl-mongo </a>
</h2>
<div id="post-intro">
<p>I want to be able to keep the documentation of <a href="http://www.github.com/fon/cl-mongo">cl-mongo</a> current when I am adding new features to the package. <br> <br> The original documentation was generated 'by hand'. I went through the code and made sure I documented the exported classes, methods and functions. This is not really satisfactory. Ideally you want the documentation and the code tightly integrated. Javadoc style documentation, which can be generated from source code annotations would be ideal. <br> <br> There are various lisp packages available which will pull out the source code comments for the public interface defined in the packages file.<br> One such package is Edi Weitz's <a href="http://weitz.de/documentation-template/">documentation template</a>. This package generates an HTML file with the API description based on embedded comments, which is exactly what I was looking for. <br> The package does have its quirks/features. It doesn't seem to like embedded HTML or markdown formatting in the lisp code comments, so the API descriptions appear somewhat 'flat'. <br> In addition I can't define an order on the way the API components are presented and consequently things jump around a-bit.<br> It also hard-codes licensing information and URLs which are not appropriate for me. The way I dealt with this was to take the generated HTML file and to search and replace the licensing information and URLs. <br> <br> The next challenge was to integrate the HTML file generated by <em>documentation-template</em> with the <em>README.md</em>. This I accomplished by stripping out the HTML header and appending the resulting HTML file to a <em>markdown</em> formatted file.<br> <br> The result doesn't look bad and more importantly gives me a way to easily keep my documentation up-to-date. </p>
</div>
<a href="/generating-documentation-for-cl-mongo-.html"> <h6> Continue reading "Generating Documentation for cl-mongo " </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sat, 13 Feb 2010 10:29:17 EST </p>
</div>
<h2>
<a href="/submitting-my-blog-to-technoraticom.html"> submitting my blog to technorati.com </a>
</h2>
<div id="post-intro">
<p>The purpose of this post is to claim my blog on <a href="www.technorati.com">technorati</a>. For that to work I need to include the claim code they provided to me in this little email This is an automatically-generated email. </p><pre><code>Thank you for submitting your blog claim on Technorati. Technorati will need to verify that you
are an author of the site http://www.mohegan-skunkworks.com/ by looking for a unique code.
We have just assigned the claim token 2624RGHKBMNQ to this claim.
Please visit http://technorati.com/account/ for more details, including how to use the claim token.
Thank you.
</code></pre><p></quote> <br> <br> Let's see if this works. </p>
</div>
<a href="/submitting-my-blog-to-technoraticom.html"> <h6> Continue reading "submitting my blog to technorati.com" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Tue, 02 Feb 2010 18:59:51 EST </p>
</div>
<h2>
<a href="/cl-mongo.html"> cl-mongo </a>
</h2>
<div id="post-intro">
<P><A HREF="http://www.mongodb.org">mongo</A> is a scalable, high-performance, open source, schema-free, document-oriented database. I was introduced to mongo at the <A HREF="http://www.meetup.com/mysqlnyc/messages/8346727/">new-york mysql meetup</A>. Two things made mongo look attractive: inter-operability and document centric storage. <BR> <BR> I'm familiar with the <A HREF="http://common-lisp.net/project/elephant/">elephant</A> persistence framework in lisp. However elephant objects are not readable (as far as I know) in languages other than lisp.That makes inter-operating with other platforms difficult. A traditional rdms requires some sort of schema if you want to use it effectively. Mongo on the other hand is optimized for the the kind of free form document storage I'm looking for. <BR> <BR> Mongo comes with set of drivers but was missing was a lisp driver. This looked like a good project to get better acquainted with lisp and mongo.<BR> <BR> So I set out to try to write one and the result is <A HREF="http://github.com/fons/cl-mongo">cl-mongo</A>. At this stage it's close to having the capabilities I'm looking for, but <A HREF="http://github.com/fons/cl-mongo">cl-mongo</A> is obviously a work in progress. </P>
</div>
<a href="/cl-mongo.html"> <h6> Continue reading "cl-mongo" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sat, 07 Nov 2009 09:49:51 EST </p>
</div>
<h2>
<a href="/fourth-nysa-machine-learning-seminar.html"> Fourth NYSA Machine Learning Seminar </a>
</h2>
<div id="post-intro">
<P>Friday I attended the 4<SUP> th</SUP> Machine Learning Symposium organized by the New York Academy of Sciences <A HREF="http://www.nyas.org/">(NYSA)</A>. <BR> <BR> The <A HREF="http://www.nyas.org/events/Detail.aspx?cid=533f8dfe-d778-4c52-ba1b-3241bc9c8ca2">Symposium program</A> consisted of four main talks given by local experts in the area of machine learning, interspersed with four graduate student talks, a poster session and a terrific lunch. <BR> <BR> Since I'm not really hindered by any overwhelming expertise in this area I'll confine my self to a few breezy impressions of the main talks. <BR> <BR> The first one was given by Bob Bell, from AT&amp;T Bell Labs and a member of the team which won the <A HREF="http://www.netflixprize.com/">Netflix prize.</A><BR> <BR> </P><P>What made the contest challenging was not only the huge size of the data set but also the fact that 99 % of the data was missing. In addition there were significant differences between training and test data. Regardless of whether a 10 % improvement of a movie rating system should be worthy of a million dollar prize, it provided a great way to test classifiers against real world data.<BR> <BR> One thing that stood out for me was that a relative small amount of users was responsible for 'most' of the ratings. He mentioned that they identified one user responsible for 5400 ratings on one particular day. This <EM>could</EM> an data error on the Netflix side, where the time stamp was somehow misapplied. On the other hand it sounds like someone was trying to deliberately affect a large swath of ratings. <BR> <BR> The final classifier incorporated breakthroughs made by different teams in the earlier stages of this multi-year competition.One such breakthrough was to consider the previous genres of the movies someone has rated to determine future recommendations. That must seem rather obvious in retrospect. The other was a clever way called <A HREF="http://portal.acm.org/citation.cfm?id=1557072">Collaborative Filtering</A> which takes into account the time-dependency of people's movie preferences. <BR> <BR> An ensemble of previously validated classifiers was used to construct the final classifier and the calculation to get the final result submitted to Netflix took almost a month, primarily because a power failure forced a restart of the calculation engine. In fact the use of an ensemble of classifiers of mentioned as one of the main lessons learned from the contest. The other was the power matrix factorization (i.e. treating users and preferences as independent parameters and using matrix to link the two) as a computational tool. </P>
</div>
<a href="/fourth-nysa-machine-learning-seminar.html"> <h6> Continue reading "Fourth NYSA Machine Learning Seminar" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Fri, 06 Nov 2009 06:32:19 EST </p>
</div>
<h2>
<a href="/embedding-equations-in-a-blog-post.html"> Embedding Equations in a Blog Post </a>
</h2>
<div id="post-intro">
<P>I'm using a <A HREF="http://github.com/fons/cl-bliky">home-grown blogging engine</A> which converts pages formatted in <A HREF="http://daringfireball.net/projects/markdown/">markdown</A> to static html pages served from my <A HREF="http://github.com/fons/fons.github.com">github account.</A> If I want to include mathematical equations in my blog post my options are to use inline html code or to use one of the online <A HREF="http://www.latex-project.org/">Latex</A><A HREF="http://www.google.com/search?q=online+latex+equation+editor"> equation editors.</A><BR> <BR> My requirements are simple: I want to be able to use the usual cast of mathematical symbols inlined in my main text as well format large equation blocks. In this post I'll compare and contrast inline html with online editors provided by <A HREF="http://www.sitmo.com/latex/">SITMO</A>, <A HREF="http://www.codecogs.com/components/equationeditor/equationeditor.php">CodeCogs</A> and <A HREF="http://www.texify.com/">Textify</A>. <BR> <BR> To save you the trouble of having to wade through miles of text, I'll start of with my </P><H2>Conclusions</H2><P>Use HTML for inlining symbols and equations. Although those will never look as good in html as in Latex, the overall format of your text will suffer less.<BR> <BR> For equation blocks you have the choice between two online editors : <A HREF="http://www.sitmo.com/latex/">SITMO</A>, <A HREF="http://www.codecogs.com/components/equationeditor/equationeditor.php">CodeCogs</A>. When it comes to embedding latex code into your html both editors are comparable. When you're looking for more variety with regard to fonts or markup languages CodeCogs is your only alternative.<BR> <BR> If you want to use the url link to embed a large code block you probably would want to use a url shortner. <A HREF="" HTTP:="http:" TINY.URL="tiny.url">Tiny url</A> is a good option here.As an alternative both editors can generate a png image for you to embed.<BR> <BR><A HREF="" HTTP:="http:" WWW.TEXIFY.COM="www.texify.com" LINKS.PHP="links.php">Textify</A> has a nice clean interface, but I can't embed the links it generates. My only alternative would appear to be to run my own instance of this service which is obviously not something I need or want to do. Furthermore, although it cleverly provides a shortened url, it uses <A HREF="" HTTP:="http:" BIT.LY="bit.ly">bit.ly</A> which unfortunately doesn't handle complex latex url's well.. <BR> <BR> Read on to find out how I reached these conclusions . </P>
</div>
<a href="/embedding-equations-in-a-blog-post.html"> <h6> Continue reading "Embedding Equations in a Blog Post" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sun, 01 Nov 2009 10:30:37 EST </p>
</div>
<h2>
<a href="/toy-problem-simple-one-dimensional-least-squares-learner.html"> Toy Problem: Simple One Dimensional Least Squares Learner. </a>
</h2>
<div id="post-intro">
<P>In chapter two of Hastie, Tibshirani and Friedman 's <A HREF="http://www-stat.stanford.edu/~tibs/ElemStatLearn/">'The Elements of Statistical Learning'</A> the authors discuss the use of least- squares regression to construct a data classifier for linearly separable data. <BR> <BR> A set of training data together with the least-squares method is used to construct a hyper-plane in the data space. The classification of a data point depends on what side of the hyper-plane you end up on.<BR> <BR> The example in Hastie uses two data classes in a two dimensional parameter space. I didn't grok the the example immediately, and I thought it would be helpful to try to construct my own much simpler example by staying in one dimension and using a simple normal distribution. The rest of this post describes the details. </P>
</div>
<a href="/toy-problem-simple-one-dimensional-least-squares-learner.html"> <h6> Continue reading "Toy Problem: Simple One Dimensional Least Squares Learner." </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sun, 27 Sep 2009 14:52:50 EST </p>
</div>
<h2>
<a href="/processing-the-sieve-in-python.html"> Processing the Sieve in Python </a>
</h2>
<div id="post-intro">
<P>In a <A HREF="http://www.prognotes.com/threading-the-sieve-in-python.html">previous post</A> I discussed four methods to multi-thread the <A HREF="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes">Sieve of Erasthones</A> in Python. I concluded that multi-threading didn't increase performance, and in fact could have a significant adverse effect. The <A HREF="www.dabeaz.com/python/GIL.pdf">global interpretor lock (GIL)</A> prevents threads from running concurrently and thus limits the upside of threading. The use of locks or avoiding the use of shared data can than decrease performance quite a bit. <BR> <BR> In this section I'll be using Python's <A HREF="http://docs.python.org/library/multiprocessing.html">multiprocessing</A> module to 'multi-thread' the <EM>Sieve</EM>. <BR> <BR> The multiprocessing module spawns a number of processes and distributes the calculation amongst them.There is no equivalent to the GIL so I should be able to see some gain in performance as the number of processes increases. On the other hand, spawning processes means that there is startup overhead which may offset any performance gain due to the distribution of its execution across multiple processes. However, I should still be able to investigate how performance scales with the number of processes, and whether the <A HREF="http://docs.python.org/library/multiprocessing.html">multiprocessing module</A> is able to take advantage of multiple cores. In this post I'll discuss four approaches to distributing the <EM>Sieve</EM> algorithm, basically following the approaches I discussed <A HREF="http://www.prognotes.com/threading-the-sieve-in-python.html">earlier</A> when using the multi-threading package.The various approaches differ in the way the load is balanced and whether the state of the sieve is shared.<BR> <BR> The source for the code discussed here and in the <A HREF="http://www.prognotes.com/threading-the-sieve-in-python.html">previous post</A> can be found in <EM>prime_share.py</EM> in the <A HREF="git://github.com/fons/blog-code.git">blog-code package</A> on github. </P>
</div>
<a href="/processing-the-sieve-in-python.html"> <h6> Continue reading "Processing the Sieve in Python" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sat, 12 Sep 2009 17:03:23 EST </p>
</div>
<h2>
<a href="/threading-the-sieve-in-python.html"> Threading the Sieve in Python </a>
</h2>
<div id="post-intro">
<P>This is the first of two posts on threading and multiprocessing in Python. In this post I'll explore the thread module and in the second post I'll look at Python's multiprocessing module. My starting point is the multi-threaded implementation of the <A HREF="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes">Sieve of Erasthones</A> found in this <A HREF="http://heather.cs.ucdavis.edu/~matloff/Python/PyThreads.pdf">tutorial on multi-threading in Python (pdf).</A><BR> <BR> Threading a compute-bound algorithm, like the <EM>Sieve</EM> consists of subdividing of the main task into autonomous sub-tasks which share as little state as possible. Having no shared state eliminates the overhead that inevitably comes with locking. It turns out that Python is not very good at multi-threading compute-bound processes. <A HREF="http://www.dabeaz.com/blog/dablog.html">This </A><A HREF="http://ttimo.vox.com/library/post/python-gil-threading-and-multicore-hardware.html">is </A><A HREF="http://www.grouplens.org/node/244">not a </A><A HREF="http://blog.ianbicking.org/gil-of-doom.html">surprise.</A> CPython has a global interpretor lock <A HREF="http://www.dabeaz.com/python/GIL.pdf">(GIL)</A> which prevents threads from running concurrently. <BR> <BR> Regardless, there are other lessons I learned when multi-threading the <EM>Sieve</EM> algorithm. One is that sharing state between threads may be unavoidable to achieve reasonable performance. In fact, if you <EM>don't</EM> share state, performance can become predictable <EM>worse</EM> as the number of threads of execution increases. <BR> <BR> The other is that locking can have a surprising impact on performance. It's not just the cost of locking per se, but the effect locking has on the distribution of work between the various threads. </P>
</div>
<a href="/threading-the-sieve-in-python.html"> <h6> Continue reading "Threading the Sieve in Python" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sat, 29 Aug 2009 19:15:49 EST </p>
</div>
<h2>
<a href="/simplified-command-line-processing-with-dyn-optionspy.html"> Simplified command line processing with dyn-options.py </a>
</h2>
<div id="post-intro">
<P>Am I the only one in the world who feels that using python's <EM>getopt</EM> is a bit of a struggle ? It involves a lot of boiler plate. Tedious refactoring is required each time you add or change an option. This is not specific to Python, as most languages have a similar facility to parse the command line, which is similarly annoying. <BR> <BR> I decided to create an easier way to process command line options, by transforming the command line into an immutable (read-only) object. The result is <A HREF="http://github.com/fons/dyn_options/tree/master">dyn_options</A>. <BR> <BR> <A HREF="http://github.com/fons/dyn_options/tree/master">dyn_options</A> considers every string on the command line which starts with either - or -- (i.e. a single or double dash) an option flag. The value of the option flag is a concatenation of everything that follows it, until the next flag is encountered. A simple option flag is one without explicit values and is considered a boolean flag, set to <EM>True</EM>. <A HREF="http://github.com/fons/dyn_options/tree/master">dyn_options</A> creates a read-only object, with attributes and values set to the command line option flags and values respectively. <BR> <BR> So, '--opt4 hello world' will be converted to an option flag called <EM>opt4</EM>, with a value of <EM>hello world</EM>. This makes dealing with spaces on the command line a lot easier. </P>
</div>
<a href="/simplified-command-line-processing-with-dyn-optionspy.html"> <h6> Continue reading "Simplified command line processing with dyn-options.py" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sun, 09 Aug 2009 10:27:45 EST </p>
</div>
<h2>
<a href="/factorials-tail-recursion-and-cps--in-c.html"> Factorials, Tail Recursion and CPS ... in C </a>
</h2>
<div id="post-intro">
<P>Recursive algorithms are elegant. However, if the recursion is not a <A HREF="http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-453.pdf">tail call</A> the growth of the stack leads to a stack overflow. </P><P>Tail call recursion is a technique whereby the last call in a recursive function does not depend on the variables pushed on the stack. In other words the function returns the value of its additional (recursive) call. </P><P>Functional languages like Haskell or Lisp are designed to support the use of tail recursive algorithms.The JVM -although now the target platform of a lisp like <A HREF="http://www.clojure.org">clojure</A> or a hybrid functional language like <A HREF="http://www.scala-lang.org">scala</A> - <A HREF="http://blogs.sun.com/jrose/entry/tail_calls_in_the_vm">does not support tail recursion at all</A>. In C/C++ the compiler can in fact replace tail recursive calls with a simple loop, thereby eliminating the allocation for additional stack frames all together. In this post I'll consider various implementations of the humble factorial to illustrate some of these things. </P>
</div>
<a href="/factorials-tail-recursion-and-cps--in-c.html"> <h6> Continue reading "Factorials, Tail Recursion and CPS ... in C" </h6> </a>
</div>
<div id="post">
<div id="post-timestamp" >
<p>Sun, 19 Jul 2009 11:49:05 EST </p>
</div>
<h2>
<a href="/cl-bliky--a-simple-lisp-based-blog-engine.html"> CL-BLIKY : A simple lisp based blog engine </a>
</h2>
<div id="post-intro">
<P>I 'm writing this using a self rolled blog engine called cl-bliky. I'm indebted to an excellent <A HREF="http://roeim.net/vetle/docs/cl-webapp-intro/">tutorial</A> put together by <A HREF="http://roeim.net/vetle/">Vetle Roeim</A>. His goal was obviously to put together a compelling tutorial and he succeeded. My goal was to use lisp in a small programming project, and developing a simple and easily customizable blog engine seemed like a good start. </P>
</div>
<a href="/cl-bliky--a-simple-lisp-based-blog-engine.html"> <h6> Continue reading "CL-BLIKY : A simple lisp based blog engine" </h6> </a>
</div>
<div id="footer">
<p>
Powered by <a href="http://www.github.com/fons/cl-bliky"> cl-bliky </a>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-9319248-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</p>
</div>
</div>
<!-- end of main area -->
<!-- start of the sidebar -->
<div id="sideBar">
<div id="about">
<a href="/about.html"> <h2> About </h2> </a>
</div>
<div id="contact">
<a href="http://kontactr.com/user/prognotes"><img src="http://kontactr.com/pics/small.gif" border="0" width="90px" height="16px" /></a>
</div>
<div id="rss-feed">
<a href="/feed.xml">
<p>
<a href="http://feeds.feedburner.com/MoheganSkunkworks" title="Subscribe to my feed" rel="alternate" type="application/rss+xml"><img src="http://www.feedburner.com/fb/images/pub/feed-icon32x32.png" alt="" style="border:0"/></a><a href="http://feeds.feedburner.com/MoheganSkunkworks" title="Subscribe to my feed" rel="alternate" type="application/rss+xml">Subscribe in a reader</a>
</p>
</a>
</div>
<div id="rss-validator">
<a href="http://beta.feedvalidator.org/check.cgi?url=http%3A//www.mohegan-skunkworks.com/feed.xml"><img src="http://github.com/fons/cl-bliky/raw/master/img/valid-rss.png" alt="[Valid RSS]" title="Validate my RSS feed" /></a>
</div>
<div id="follow-on-twitter">
<a href="http://www.twitter.com/mohegskunkworks"><img src="http://twitter-badges.s3.amazonaws.com/follow_me-a.png" alt="Follow mohegskunkworks on Twitter"/></a>
</div>
<div id="email-subscription">
<form style="border:1px solid #ccc;padding:3px;text-align:center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=MoheganSkunkworks', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"><p>Enter your email address:</p><p><input type="text" style="width:140px" name="email"/></p><input type="hidden" value="MoheganSkunkworks" name="uri"/><input type="hidden" name="loc" value="en_US"/><input type="submit" value="Subscribe" /><p>Delivered by <a href="http://feedburner.google.com" target="_blank">FeedBurner</a></p></form>
</div>
<div id="side-bars">
<h2> Code </h2>
<div>
<UL><LI><A HREF="http://github.com/fons/cl-bliky/tree/master/">c-bliky</A></LI><LI><A HREF="http://github.com/fons/c_fact/tree/master">c_fact</A></LI><LI><A HREF="http://github.com/fons/dyn_options/tree/master">dyn_options</A></LI><LI><A HREF="http://github.com/fons/cl-mongo"> cl-mongo </A></LI></UL>
</div>
<div>
</div>
</div>
<!--end of sidebar-->
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.