| Andrew Cooke | Contents | Latest | RSS | Twitter | Previous | Next


Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

Personal Projects

Lepl parser for Python.

Colorless Green.

Photography around Santiago.

SVG experiment.

Professional Portfolio

Calibration of seismometers.

Data access via web services.

Cache rewrite.

Extending OpenSSH.

C-ORM: docs, API.

Last 100 entries

Small Success With Go!; Re: Quick message - This link is broken; Adding Reverb To The Echo Chamber; Sox Audio Tools; Would This Have Been OK?; Honesty only important economically before institutions develop; Stegangraphy via PS4; OpenCL Mess; More Book Recommendations; Good Explanation of Difference Between Majority + Minority; Musical Chairs - Who's The Privileged White Guy; I can see straight men watching this conversation and laffing; When it's Actually a Source of Indignation and Disgust; Meta Thread Defending POC Causes POC To Close Account; Indigenous People Of Chile; Curry Recipe; Interesting Link On Marginality; A Nuclear Launch Ordered, 1962; More Book Recs (Better Person); It's Nuanced, And I Tried, So Back Off; Marx; The Negative Of Positive; Jenny Holzer Rocks; Huge Article on Cultural Evolution and More; "Ignoring language theory"; Negative Finger Counting; Week 12; Communication Via Telecomm Bids; Finding Suspects Via Relatives' DNA From Non-Crime Databases; Statistics and Information Theory; Ice OK in USA; On The Other Hand; (Current Understanding Of) Chilean Taxes / Contributions; M John Harrison; Playing Games on a Cloud GPU; China Gamifies Real Life; Can't Help Thinking It's Thoughtcrime; Mefi Quotes; Spray Painting Bike Frame; Weeks 10 + 11; Change: No Longer Possible To Merge Metadata; Books on Old Age; Health Tree Maps; MRA - Men's Rights Activists; Writing Good C++14; Risk Assessment - Fukushima; The Future of Advertising and Surveillance; Travelling With Betaferon; I think I know what I dislike so much about Metafilter; Weeks 8 + 9; More; Pastamore - Bad Italian in Vitacura; History Books; Iraq + The (UK) Governing Elite; Answering Some Hard Questions; Pinochet: The Dictator's Shadow; An Outsider's Guide To Julia Packages; Nobody gives a shit; Lepton Decay Irregularity; An Easier Way; Julia's BinDeps (aka How To Install Cairo); Good Example Of Good Police Work (And Anonymity Being Hard); Best Santiago Burgers; Also; Michael Emmerich (Vibrator Translator) Interview (Japanese Books); Clarice Lispector (Brazillian Writer); Books On Evolution; Looks like Ara (Modular Phone) is dead; Index - Translations From Chile; More Emotion in Chilean Wines; Week 7; Aeon Magazine (Science-ish); QM, Deutsch, Constructor Theory; Interesting Talk Transcripts; Interesting Suggestion Of Election Fraud; "Hard" Books; Articles or Papers on depolarizing the US; Textbook for "QM as complex probabilities"; SFO Get Libor Trader (14 years); Why Are There Still So Many Jobs?; Navier Stokes Incomplete; More on Benford; FBI Claimed Vandalism; Architectural Tessellation; Also: Go, Blake's 7; Delusions of Gender (book); Crypto AG DID work with NSA / GCHQ; UNUMS (Universal Number Format); MOOCs (Massive Open Online Courses); Interesting Looking Game; Euler's Theorem for Polynomials; Weeks 3-6; Reddit Comment; Differential Cryptanalysis For Dummies; Japanese Graphic Design; Books To Be Re-Read; And Today I Learned Bugs Need Clear Examples; Factoring a 67 bit prime in your head; Islamic Geometric Art; Useful Julia Backtraces from Tasks; Nothing, however, is lost with less discomfort than that which, when lost, cannot be missed

© 2006-2015 Andrew Cooke (site) / post authors (content).

Using Mercurial on OpenSuse 11.1

From: "andrew cooke" <andrew@...>

Date: Sun, 26 Apr 2009 19:52:48 -0400 (CLT)

Two separate pieces of information here - how to use Mercurial in a
"centralised" way, and how to get things working nicely in OpenSuse.

First, the "centralised" part.  It wasn't clear to me at first how I would
actually use Hg.  I am used to having a central svn repo that is backed
up, and that I use as a reference from various computers.  I still wanted
that with Hg, but it wasn't clear how to arrange things.

What I ended up doing (and I am still not sure this is correct, although
it seems OK) is the following:

 - create a system group "hg"
 - create a system user "hg" whose empty home directory is /srv/hg
   and whose default group is "hg"
 - create a directory under /srv/hg called repos
 - in that directory, as the hg user, import code from svn
   (I had everything in a single svn repo but am separating things
   out with hg, so there's a single repo for lepl at the moment).
   (this uses "hg convert" - the command I ran was
   hg convert svn:// \
     --config convert.svn.trunk=lepl/trunk \
     --config convert.svn.branches=lepl
   which let me import versions at the same level as trunk)

That places a lepl repo (I had to rename it from whatever it was called by
default) in /srv/hg/repos

Next I wanted to be able to look at it via the web.  There's a fairly
detailed explanation at
http://www.selenic.com/mercurial/wiki/index.cgi/HgWebDirStepByStep but it
places the repo in srv/www for some reason.  That's not necessary (as far
as I can tell so far - I'll post again to this thread if I find out

So I adapted the instructions at that link and did the following:

 - downloaded the entire hg codebase (I think) into a temp directory
   using the command
   hg clone http://www.selenic.com/repo/hg-stable
 - that was the only way I could get hold of hgwebdir.cgi (is it
   just me or do the links in the instructions not work for everyone?)
 - create the directory /srv/www/htdocs/hg
 - put the hgwebdir.cgi in that directory
 - add hgweb.config with contents:

/srv/hg/repos = /srv/hg/repos

style = gitweb

 - make sure permissions, ownership etc were OK (ie same as other
   projects in /srv/www - use wwwrun/www)
 - create the file hg.conf in /etc/apache2/conf.d as in the
   instructions above
 - restart apache

That gave me a very ugly site at http://localhost/hg

I should also have mentioned that I installed mercurial from Yast before
all this.

I spent some time trying to fathom why my site was so much uglier than
others on the web before realising that opensuse's defauly mercurial
install is rather old (1.0.2).  You can install a much more recent version
from the build service at http://software.opensuse.org/search - just type
"mercurial" in the box and click away.

Once that was done, I got the nice web site with trainline graphs that
showed the different release versions.  Nice :o)


Writing to Mercurial

From: "andrew cooke" <andrew@...>

Date: Mon, 27 Apr 2009 18:21:31 -0400 (CLT)

The above all seems OK.  Today I looked at writing (pushing) back to the
main repo.

Locally (and I assume via ssh) you can do this by writing to the
repository directly (ie the directory /srv/hg/repos/lepl).  All that was
necessary (as far as I can remember) to do this was to make sure that I
was a member of the hg group (log out and in again) and that the group has
write permissions.

Getting things working by HTTP was a little more tricky.  I added/modified
the following files:

/srv/hg/repos/lepl/.hg/hgrc contains:

allow_push = andrew

/etc/apache2/conf.d/hg.conf contains:

ScriptAliasMatch        ^/hg(.*)        /srv/www/htdocs/hg/hgwebdir.cgi$1
<Directory /srv/www/htdocs/hg>
  Options ExecCGI FollowSymLinks
  AllowOverride None

  AuthType Digest
  AuthName "svn"
  AuthUserFile "/srv/www/htdocs/hg/.htdigest"
  <Limit POST PUT>
    Require valid-user


The file /srv/www/htdocs/hg/.htdigest was generated with htdigest2 (see
man pages - the "realm" is "svn" as AuthName above).


groups = hg

Some tips: to resolve problems start with the simplest first, so get local
push to a file working.  Then add "GET" to the Limit above and set things
up so that you can read the web page in a browser after entering the
correct password.  Next try push to a http url (add push_ssl = false to
the appropriate hgrc) and use ngrep to sniff the response (which contains
a more detailed error message than appears elsewhere!).  Finally, test
writing to https.  This helps avoid mis-attributing errors (for a long
time I thought apache was complaining about trusted users, but it was
mercurial, and the groups=hg in the global hgrc fixed that).

With the above I now have network (except that the firewall blocks
external access) read access while network write is limited to myself.

I've also done several merges without breaking anything, as far as I can
tell.  In the process I've come to the conclusion that named branches
aren't that great.  Instead, branches are best treated more like temporary
things that you create when needed.  For releases, tagging is enough (if I
ever need to do major development on an old release I think I will clone a
new repository instead of using branches).


PS And don't forget to enable mod_auth (which is easiest to do through Yast)

Add wwwrun to hg group

From: "andrew cooke" <andrew@...>

Date: Mon, 27 Apr 2009 18:46:22 -0400 (CLT)

Forgot to mention this, but pushing via http means that wwwrun must be a
member of the hg group too.


With Eclipse

From: "andrew cooke" <andrew@...>

Date: Mon, 27 Apr 2009 21:41:00 -0400 (CLT)

Using Eclipse works fine too - I used the standard(?) extension
(MercurialEclipse) and it works just fine.  From my laptop I can clone a
version from the HTTP server, modify and commit locally, then push back to
the server later.

So I can duplicate my old svn-based workflow, but I also have the entire
repo locally on the laptop when travelling, and can commit in small chunks
(this is more important in Mercurial than Subversion, because merges are
hard to do in smaller-than-a-commit pieces; you cannot pick changes for a
particular file, but instead deal with "changesets").

Anyway, must rush - burning a CDROM to try out Mandriva :o)


Trying to Explain why Mercurial is Good

From: "andrew cooke" <andrew@...>

Date: Wed, 29 Apr 2009 08:57:15 -0400 (CLT)

I am really enjoying (well, in relative terms - I can't honestly say that
it is one of the great pleasures of my life) using Mercurial.  And since a
month ago I couldn't see the point of DVCS I think I should explain why.

Unfortunately, that's not so easy.  Just as svn was generally more solid
and useful than cvs, so hg is similarly incremental.  For me, all three
will do the job - being distributed is not a critical part of my
development.  So there's no huge argument in favour of Mercurial, but if
you've switched from cvs to svn and been pleasantly surprised, then I
think you'll find the same experience moving from svn to hg.

So, if there are no big wins, what are the small wins?

First, it *is* distributed.  So if I had been using it three weeks ago,
when I was visiting my parents in the UK, patching a bug in LEPL would
have been much easier.  You always have the full revision tree (well,
graph) available, locally.

Second, because it's local and fast, you can commit more often.  Actually
this is also a negative - you really *have* to commit more often, because
you can't go back and cherry-pick changes later.  With svn you can select
changes to individual files and merge them across to another branch.  With
hg you have to take the whole commit (there are hacks around this, but
that's the general idea).

Third, because it's local and fast and supports distribution, you can
trivially copy the whole repository just to do an experiment.  I imagine
I'll do this less as I get used to it, but for learning it's great - I can
try to do something several times and, once I get it right, "push" it back
to my main repository.

Fourth, I can still work the way I used to.  Apart from the commit v file
granularity issue, there's nothing stopping me from still having a single,
central server that I back up automatically.

Fifth, it's easy to divide work up into separate chunks by cloning.  This
is nicer than using a branch because you're not immediately making big
changes to the central repo.  You get more leeway to experiment.

Looking at that list, I guess the basic idea is that it gets in the way
less, so you use it more.  It's more flexible, and you can use it more
without making the main repo a confusing mess of branches and tags.  So it
becomes more of a useful tool than a burden.  Which I think is why the
move feels similar to the change from cvs to svn, which also made progress
in that direction.


Comment on this post