| Andrew Cooke | Contents | RSS | Twitter | Previous

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.

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

The Quest for Randomness

From: andrew cooke <andrew@...>

Date: Wed, 23 Apr 2014 08:26:29 -0300

http://www.americanscientist.org/issues/id.16186,y.2014,no.3,content.true,page.1,css.print/issue.aspx

Scott Aaronson can write.

A nice summary of randomness and a closing update on quantum computing.

Andrew

Permalink | Comment on this post

Previous Entries

For comments, see relevant pages (permalinks).

Chat Wars

From: andrew cooke <andrew@...>

Date: Sat, 19 Apr 2014 20:59:56 -0300

http://nplusonemag.com/chat-wars

Personal account of MS Messenger v AIM and the wider MS picture.

Andrew

Permalink

Real-life Financial Co Without ACID Database...

From: andrew cooke <andrew@...>

Date: Thu, 17 Apr 2014 12:10:34 -0300

http://hackingdistributed.com/2014/04/06/another-one-bites-the-dust-flexcoin/

So someone sent lots of requests, got a race condition, and made a profit.

Wow.

Andrew

Permalink

Flexible Muscle-Based Locomotion for Bipedal Creatures

From: andrew cooke <andrew@...>

Date: Wed, 16 Apr 2014 13:47:51 -0300

https://www.youtube.com/watch?v=rBHjx4dYxjA

Andrew

Permalink

SQL Performance Explained

From: andrew cooke <andrew@...>

Date: Sun, 13 Apr 2014 12:02:12 -0300

http://sql-performance-explained.com/

I wish I had read this book a long time ago.

I like SQL - I like having a declarative language available in systems - it's
much more than "a storage mechanism".  But I always worried about performace,
and I always worried that I was mis-understanding something about indices.

This awesome, slim book fixed that.  I *was* missing some details, but I also
had the basic idea right.  It's not black magic - it's a logical, consistent
system and this book explains it clearly.

If you're a moderately experienced programmer, with a basic understanding of
what a database is doing, but are unsure about some of the implementation
details, then this is the perfect book for you.  It's compact, clear, easy to
read, and helpful.

One caveat - well, not really a caveat, but a possible concern I should handle
in a review.  This seems like it may be self-published, and is written by
someone whose first language is not english.  Despite that, the quality of the
binding is good.  There are some mistakes in the text, but the web site has an
errata (and they're generally small details in the examples, not fundamental
errors).  And, finally, the writing is clear and understandable (you can tell,
in places, that it's not written by a native speaker, but they are very small
issues of style and don't affect the book at all).

In short, one of those happy few: a short, clear, useful, technical book.

Andrew

Permalink

The Little Manual of API Design

From: andrew cooke <andrew@...>

Date: Fri, 11 Apr 2014 11:42:17 -0300

http://www4.in.tum.de/~blanchet/api-design.pdf

Andrew

Permalink

CRC - Next Steps

From: andrew cooke <andrew@...>

Date: Fri, 11 Apr 2014 04:14:00 -0300

I recently wrote a CRC library in Julia -
https://github.com/andrewcooke/CRC.jl - which works fine, but is ~2.5x slower
than an optimized C implementation (for CRC32, using zlib).

Looking at the zlib code, they use four lookup tables so that they can process
32 bits at a time.  In case it's not obvious how that works - each table has a
different number of "echoes".  So the final byte (of 4) is processed with a
normal table, but the first byte is taken from a table that "echoes" the
result through three zero bytes, and so gives a contriibution that can be
combined (xored) directly with the result from the final byte.

Now it's not clear to me that this saves much time at all (never mind a factor
of 2.5).  But the only way to be sure is to include it in the code.

Unfortunately, the current code is already quite ungainly.  So what to do?

Much of the complexity of the current code comes from supporting lookup tables
that have an index of a different size from the input data.  This is pretty
esoteric - who really wants to calculate a hash over 64bit words?  If that was
removed then the code would support indices that matched data chunk size.  And
since reasonable indices are 8 or 16bits, we could simply restrict things to
bytes.

So the plan is, at some point, to restrict the API to bytes only and then
support multi[ple tables.

Andrew

Permalink

FizzBuzz

From: andrew cooke <andrew@...>

Date: Wed, 9 Apr 2014 19:12:15 -0300

I cannot find a nice way of writing this.  Either I need to repeat tests or I
need to mutate data.  This i smy best attempt:

  for i in range(1,100):
      msg = ''
      for (n, word) in [(3, 'Fizz'), (5, 'Buzz')]:
	  if i % n == 0:
	      msg += word
      if msg:
	  print(msg)

Although I doubt I would write that in an interview.

Andrew

Permalink

Decent Links / Discussion Community

From: andrew cooke <andrew@...>

Date: Tue, 1 Apr 2014 11:02:17 -0300

https://lobste.rs is like HN used to be.  Ask me for an invite.  Andrew

Permalink

Automated Reasoning About LLVM Optimizations and Undefined Behavior

From: andrew cooke <andrew@...>

Date: Mon, 31 Mar 2014 15:44:20 -0300

http://blog.regehr.org/archives/1122

I agree with the final comment: "One idea that I quite like is using a solver
to improve LLVM's peephole optimizations by automatically figuring out when
qualifiers like nsw, nuw, and exact can be used correctly"

Andrew

Permalink

A Painless Guide To CRC Error Detection Algorithms

From: andrew cooke <andrew@...>

Date: Sat, 29 Mar 2014 22:58:19 -0300

http://www.zlib.net/crc_v3.txt

How did I not find this earlier.  It's like the holy grail of CRC
calculations.  The mother lode.  The dead sea scrolls.  It has everything
important and it's beautofully clear.

Andrew

Permalink

Tests in Julia

From: andrew cooke <andrew@...>

Date: Fri, 28 Mar 2014 19:20:50 -0300

If you're writing code in Julia you may have been wondering exactly how to do
testing.

For a while now there has been basic support for tests with @test, and this is
now (maybe it has been for a while and I missed it) documented at
http://julia.readthedocs.org/en/latest/stdlib/test/

But also, in the last week or so, Pkg,test() was merged -
https://github.com/JuliaLang/julia/pull/6191 - which means:

  julia> help(Pkg.test)
  INFO: Loading help data...
  Base.Pkg.test()

     Run the tests for all installed packages ensuring that each
     package's test dependencies are installed for the duration of the
     test. A package is tested by running its "test/runtests.jl" file
     and test dependencies are specified in "test/REQUIRE".

And if you create a new package with Pkg.generate() you get:
 (1) an example tests/runtests.jl
 (2) all the right configuration in .travis.yml

This is great news.  It means that there's a single, standard way to structure
tests.  And it makes it really easy to get things working on Travis.

Andrew

Permalink