Something
Emporium

Archived News for May 2009

PCBs!

I've been working on my GSSL Control project lately. I've designed a PCB for it, and got it back from fabrication. I managed to solder all the SMD stuff without incident so far. I've got a debug LED flashing, which is a good start. I'm using an AT90USB1287, and was planning on just using the DFU bootloader from Atmel, but it turns out that the USB bootloader can't program the fuse bytes. I had to dig out my USBasp and do some dodgy wiring to program the fuse bits to turn of the CLK/8 bit. Now I've done that though, the USB bootloader should be fine. I'll try and update the project page when I get some time.

The Kember Identity May Not Exist

I used to work with Elliot Kember at Eventfinder. He recently proposed a search for the MD5 "Kember identity", a string which, when hashed, returns itself.

Something I've been thinking about: it's entirely possible such an identity doesn't exist.

Imagine a hashing algorithm that takes a two bit input and returns a two bit output. That is, the domain and range is {0, 1, 2, 3}. If the algorithm perfectly distributes its hashes over the range then, for each input value, there's a 0.25 probability of it being an identity. So, the probability of no identity being produced by the hash function over any of its domain is (0.75 ^ 4) = 0.32; about a one in three chance.

MD5 has a range of 2 ^ 128. For finding the identity, the domain must be the same as a range. So, there's a 1 in 2 ^ 128 chance of a random input being the identity. The probability of an input not being an identity is ((2 ^ 128) - 1 / (2 ^ 128)). And the probability of there not being any Kember Identity at all is ((2 ^ 128) - 1 / (2 ^ 128)) ^ (2 ^ 128).

Which, according to some quick mpmath, is:

0.367879441171442321595523770161
46086744527058077566697138371152
93233486842268612093790091730736
201865…

So, there's a decent chance that there is no Kember identity. Good to know if you're considering starting to churn away on the problem.

Using WolframAlpha as a Firefox keyword search

Up until recently, if I needed to do a quick unit conversion or sum, I'd have used Google Calculator. It has pretty basic features, but it's very convenient (on most browsers thesedays, Google Search is just up there ↗)

Now I have a new tool: WolframAlpha. You might have heard of it. During its recent release, a lot of journalists portrayed it as a search engine and said it was competing with Google. That's not quite true: it's a computation knowledge engine, and I'd say it competes with Google Calculator, not Google Search proper.

If you haven't already given it a try, definately check it out. Their list of sample inputs is pretty impressive, but here's one to get you started: x ^ 2 sin(x)

A sample WolframAlpha result

However, WolframAlpha isn't quite as handy as Google Calculator: you'd have to visit their site to use it. So, I created a Firefox keyword search from their main input field. The bookmark looked like this:

WolframAlpha Firefox keyword search bookmark properties

But that didn't let me use "+" in my search. That's pretty vital if you're going to use it as a calculator. The solution is to use a spot of Javascript to escape your search first. Change the bookmark URL to:

javascript:document.location="http://www.wolframalpha.com/input/?i="+encodeURIComponent("%s");

Ahh. Much better. I can now do searches for things like $17 + 10%.

News Editors

SE now supports submitting news in Markdown and XHTML along with the existing WYSIWYG editor.

That means you should theoretically be able to get MathML going in news items. However, I haven't been able to myself. I really don't want to, and shouldn't have to, change the doctype of the entire page to insert a MathML fragment, especially given that's what namespaces are for, no?

Bibliography/Footnotes with LaTeX and BibLaTeX

Here's how I do referencing in LaTeX:

Set up

  1. If you're using something like MiKTeX, the BibLaTeX package should be downloaded for you when you first use it. If not, you'll need to install it yourself. There's a biblatex package for Ubuntu, if you're using that.
  2. In my document's preamble, I include the BibLaTeX package, with some nice options for traditional style "ibidem" references:
    \usepackage[style=verbose-trad2,natbib=true]{biblatex}
  3. I don't like my endnotes being called "References" or the like, and I don't like the section being numbered, so I make sure I set the heading text in the preamble:
    \defbibheading{bibliography}{\section*{Bibliography}}
  4. I use the open-source JabRef reference manager to produce a .bib file. Most of the time, I call it "main.bib" and include it like this (again, in the preamble):
    \bibliography{main}

Footnotes

  1. Footnotes are done with \autocite[prenote][page]{bibtex key}:
    \autocite{Popper1963}
    \autocite[163]{Popper1963}
    \autocite[Related to][163]{Popper1963}
    It doesn't seem to matter which side of the punctuation you put your \autocite.
  2. Footnotes will then automatically appear at the bottom of the page.

Bibliography

  1. I like my bibliography on a seperate page at the end. I include it like this:
    \pagebreak
    \printbibliography
  2. By default, the bibliography includes all the references you've already cited using other commands, like \autocite. But I often have a number of books that I want in the bibliography, but don't want to use as a footnote somewhere. So, I make sure my entire bibliography of references is included by citing them all with \nocite, which doesn't print anything:
    \nocite{Chalmers1999,Chalmers1990,Popper1982,Popper1963,Hempel1945,Schick1999}
    That line can go anywhere in the document.

Building it all

  1. First, build your document with LaTeX once. LaTeX should warn you about empty biblography files.
  2. Then, run BibTeX (note: BibTeX != BibLaTeX) on the .aux file LaTeX should have generated. This will usually generate a few further files (.bbl, .blg, -blx.bib).
  3. Then build your document with LaTeX twice. LaTeX should warn you when it needs to be run again.
  4. After that third run, you should have a clean build, and a beautiful bibliography.
  5. If you add extra references, you might need to repeat this process by deleting all the extra files (.aux, .bbl, .blg, -blx.bib) and doing a clean build. I've also found this necessary when doing some weird stuff in my IDE (TeXlipse).

CTAN has more information about the BibLaTeX package, along with the nicely formatted documentation. If you use Lyx, there's some BibLaTex help.

Newest Posts