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

C[omp]ute

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.

Last 100 entries

Santiago 30m Bike Route; Mapa de Ciclovias en Santiago; How Unreliable is UDP?; SE Santiago 20m Bike Route; Cameron's Rap; Configuring libxml with Eclipse; Reducing Combinatorial Complexity With Occam - AI; Sentidos Comunes (Chilean Online Magazine); Hilary Mantel: The Assassination of Margaret Thatcher - August 6th 1983; NSA Interceptng Gmail During Delivery; General IIR Filters; What's happening with Scala?; Interesting (But Largely Illegible) Typeface; Retiring Essentialism; Poorest in UK, Poorest in N Europe; I Want To Be A Redneck!; Reverse Racism; The Lost Art Of Nomography; IBM Data Center (Photo); Interesting Account Of Gamma Hack; The Most Interesting Audiophile In The World; How did the first world war actually end?; Ky - Restaurant Santiago; The Black Dork Lives!; The UN Requires Unaninmous Decisions; LPIR - Steganography in Practice; How I Am 6; Clear Explanation of Verizon / Level 3 / Netflix; Teenage Girls; Formalising NSA Attacks; Switching Brakes (Tektro Hydraulic); Naim NAP 100 (Power Amp); AKG 550 First Impressions; Facebook manipulates emotions (no really); Map Reduce "No Longer Used" At Google; Removing RAID metadata; New Bike (Good Bike Shop, Santiago Chile); Removing APE Tags in Linux; Compiling Python 3.0 With GCC 4.8; Maven is Amazing; Generating Docs from a GitHub Wiki; Modular Shelves; Bash Best Practices; Good Emergency Gasfiter (Santiago, Chile); Readings in Recent Architecture; Roger Casement; Integrated Information Theory (Or Not); Possibly undefined macro AC_ENABLE_SHARED; Update on Charges; Sunburst Visualisation; Spectral Embeddings (Distances -> Coordinates); Introduction to Causality; Filtering To Help Colour-Blindness; ASUS 1015E-DS02 Too; Ready Player One; Writing Clear, Fast Julia Code; List of LatAm Novels; Running (for women); Building a Jenkins Plugin and a Jar (for Command Line use); Headphone Test Recordings; Causal Consistency; The Quest for Randomness; Chat Wars; Real-life Financial Co Without ACID Database...; Flexible Muscle-Based Locomotion for Bipedal Creatures; SQL Performance Explained; The Little Manual of API Design; Multiple Word Sizes; CRC - Next Steps; FizzBuzz; Update on CRCs; Decent Links / Discussion Community; Automated Reasoning About LLVM Optimizations and Undefined Behavior; A Painless Guide To CRC Error Detection Algorithms; Tests in Julia; Dave Eggers: what's so funny about peace, love and Starship?; Cello - High Level C Programming; autoreconf needs tar; Will Self Goes To Heathrow; Top 5 BioInformatics Papers; Vasovagal Response; Good Food in Vina; Chilean Drug Criminals Use Subsitution Cipher; Adrenaline; Stiglitz on the Impact of Technology; Why Not; How I Am 5; Lenovo X240 OpenSuse 13.1; NSA and GCHQ - Psychological Trolls; Finite Fields in Julia (Defining Your Own Number Type); Julian Assange; Starting Qemu on OpenSuse; Noisy GAs/TMs; Venezuela; Reinstalling GRUB with EFI; Instructions For Disabling KDE Indexing; Evolving Speakers; Changing Salt Size in Simple Crypt 3.0.0; Logarithmic Map (Moved); More Info; Words Found in Voynich Manuscript

© 2006-2013 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://10.2.0.1/default/src/python \
     --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
otherwise).

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:

[collections]
/srv/hg/repos = /srv/hg/repos

[web]
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)

Andrew

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:

[web]
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
  </Limit>

</Directory>


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


/etc/mercurial/hgrc

[trusted]
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).

Andrew

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.

Andrew

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)

Andrew

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.

Andrew

Comment on this post