There were days when computers had 16-bit registers and 20-bit addressable memory. That is a total of 1MB memory - some claimed that it ought to be enough for anybody. Memory address space was flat and not protected by anything, now it’s known as the real mode. How was it possible to address 20-bit memory with only 16-bit registers?
(more…)
A worker pool is a very common pattern, and they exist in the standard libraries for many languages. The idea is simple: submit some sort of closure to a service which commits to running the closure in the future in some thread. Normally the work is shared out among many different threads and in the absence of anything fancier, one assumes a first-come-first-served queue of closures.
Erlang, with its light-weight process model is not a language which you would expect would require such an approach: processes are dirt cheap, and the scheduler maps processes onto threads when they are ready to be run — in many ways, the ErlangVM is a glorified implementation of a worker pool, only one that does pre-emption and other fancy features, in a very similar way to an OS kernel. However, we recently found in RabbitMQ a need for a worker pool. (more…)
People tend to like certain software packages to be scalable. This can have a number of different meanings but mostly it means that as you throw more work at the program, it may require some more resources, in terms of memory or CPU, but it nevertheless just keeps on working. Strangely enough, it’s fairly difficult to achieve this with finite resources. With things like memory, the classical hierarchy applies: as you use up more and more faster memory, you start to spill to slower memory — i.e. spilling to disk. The assumption tends to be that one always has enough disk space.
Other resources are even more limited, and are harder to manage. One of these is file descriptors. (more…)
I got a couple of queries recently on how to make your mercurial-server repositories publically readable over HTTP. Happily this isn’t hard to do, and doesn’t really touch on mercurial-server itself. Here’s how we do it on our Debian systems; in what follows I assume that you have installed mercurial-server on hg.example.com, and that you’re not already using that machine as a web server for anything else. First install these packages; note that they tend to have a lot of stuff you don’t need marked as recommended, so don’t install those things:
apt-get --no-install-recommends install apache2 libapache2-mod-fcgid python-flup
Create the following four files:
/etc/mercurial-server/hgweb.config:
[collections] /var/lib/mercurial-server/repos = /var/lib/mercurial-server/repos
/etc/mercurial-server/hgweb.hgrc:
[web] style = gitweb allow_archive = bz2 gz zip baseurl = http://hg.example.com/ maxchanges = 200
/etc/mercurial-server/hgwebdir.fcgi:
#!/usr/bin/env python
from mercurial import demandimport; demandimport.enable()
import os
os.environ["HGENCODING"] = “UTF-8″
os.environ["HGRCPATH"] = “/etc/mercurial-server/hgweb.hgrc”
from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication
from flup.server.fcgi import WSGIServer
def make_web_app():
return hgwebdir(”/etc/mercurial-server/hgweb.config”)
WSGIServer(wsgiapplication(make_web_app)).run()
/etc/apache2/sites-available/hg:
<VirtualHost *>
ServerName hg.example.com
AddHandler fcgid-script .fcgi
ScriptAlias / /etc/mercurial-server/hgwebdir.fcgi/
ErrorLog /var/log/apache2/hg/error.log
LogLevel warn
CustomLog /var/log/apache2/hg/access.log combined
</VirtualHost>
Finally run these commands as root:
chmod +x /etc/mercurial-server/hgwebdir.fcgi mkdir -p /var/log/apache2/hg cd /etc/apache2/sites-enabled rm 000-default ln -s ../sites-available/hg /etc/init.d/apache2 reload
Your files should now be served at http://hg.example.com/ . Sadly because of a design flaw in hgwebdir, there’s no easy way to get Apache to handle the static files it needs, but these are pretty small so there’s no harm in letting hgwebdir handle them. The “rm 000-default” thing seems pretty undesirable, but without it I can’t seem to get this recipe to work.
I’ve chosen FastCGI as the connector. This has the advantage that
As soon as a version of lighttpd with this bug fixed makes it into Debian, I’ll add my recipe for that.
Whilst writing the installer for WebGAC, I was faced with some challenges trying to make the Add-In install for all users on the system. The MSDN documentation for Add-In registration generally recommends placing the files into the user’s My Documents directory. It’s All Users solution is to place it into the Shared Documents directory. The problem I faced was that that directory has moved drastically on Windows 7 - to the point where as far as I can tell, Visual Studio (2008 at least) is no longer searching there by default.
It turns out, though, that there is an easy solution.
You are currently browsing the LShift Ltd. blog archives for March, 2010.