Anzac biscuits Sunday, October 25, 2009

Had my first attempt at making ANZAC biscuits a week ago. Google search, top recipe was the BBC recipe, though they are all about the same: rolled oats, flour, coconut, sugar, butter, golden syrup, bicarbonate of soda, water; combine into a doughy substance, place onto baking tray, bake.

The BBC recipe works fine, except I found I needed to cook the biscuits for 15-20 minutes rather than 8-10. Then again, I didn't quite realise the little tidbit others such as Jamie Oliver quote:
When these are removed from the oven they will still be soft, but they do harden up a bit on the tray. They are cooked if they are golden.
Right on, with that little bit of advice they really did turn out to be easy:

A bug tracker survey Tuesday, October 13, 2009

Starting to think about bug/issue tracking.

Open source / free bug trackers
  • Bugzilla - maybe the most popular open source bug tracker? It's a bit ugly, functional, not particularly easy to administer, or use, or anything much. But it works well and is fairly solid. Uses Perl / mod_perl.
  • Mantis - fairly straight forward bug tracker. Haven't really used this one to any degree. Implemented in PHP.
  • Flyspray - used to use this years ago. Simple bug tracker, lacks support for more advanced things like LDAP authentication other software listed here has. Worked well for a smaller project.
  • Roundup - receives fame for being the bug tracker used by the Python project. Seems to be aimed to be more of a general framework that can easily be hacked rather than a specific bug tracker. By default looks like a fairly simplistic bug tracker.
  • Trac - includes a wiki and subversion integration and so on and so forth. The bug tracker that comes with Trac looks quite reasonable.
  • Redmine - looks like something targeted at project management: issue tracking, gantt charts, diff viewer, wiki, etc. etc. Ruby on Rails based thing.
Proprietary bug trackers
  • Fogbugz - still haven't used this. It is Joel on Software's flagship product, and gets fairly wide praise. The most common description I have heard is that it isn't as adaptable as e.g. Jira, but if its workflow works for you its great. A bit Windows-centric, the current version has yet to be released for *nix.
  • Jira - the bug tracker by Atlassian. By default, comes across as a good, full featured bug tracker. Log in as an admin, and you're consulted with all sorts of opportunities to customise, and e.g. set up your own custom fields and workflows and the like.

GDB 7 and Python

Python-GDB support is cool -- that is, Python scripting in GDB. Been playing with it over the last few days as I've needed to do some debugging and it's come in handy a few times. More documentation and examples would be good, but it appears to work very well.

I have to admit, when I first installed it, I couldn't find a single use for the Python extension. But a couple of days later, I was using it in earnest to solve real problems. Quite useful for just formatting output of complex data types, but the above links show it can do quite a bit more than that with some imagination...

Wireless Friday, January 23, 2009

Got to love wireless!

ping www.google.com
...
Reply from 74.125.19.99: bytes=32 time=346ms TTL=249
Reply from 74.125.19.99: bytes=32 time=425ms TTL=249
Reply from 74.125.19.99: bytes=32 time=641ms TTL=249
Request timed out.
Request timed out.
Request timed out.
Reply from 74.125.19.99: bytes=32 time=212ms TTL=249
Reply from 74.125.19.99: bytes=32 time=992ms TTL=249
Request timed out.
Request timed out.
Reply from 74.125.19.99: bytes=32 time=428ms TTL=249
Reply from 74.125.19.99: bytes=32 time=587ms TTL=249
Request timed out.
Reply from 74.125.19.99: bytes=32 time=166ms TTL=249
Reply from 74.125.19.99: bytes=32 time=526ms TTL=249
Reply from 74.125.19.99: bytes=32 time=324ms TTL=249
...
Ping statistics for 74.125.19.99:
    Packets: Sent = 760, Received = 626, Lost = 134 (17% loss),
Approximate round trip times in milli-seconds:
    Minimum = 8ms, Maximum = 1061ms, Average = 235ms

OK, to be fair, that was the free wireless in Mountain View provided by Google. Perhaps not the best internet connection one might find. "You get what you pay for" and all that. And it allowed me to read the news while waiting for the Caltrain!

New look Thursday, January 22, 2009

The blog has a new look. It's a bit basic, but better than it was.

Now that I've finally got it working reasonably after playing around with the CSS for some time (not something I ever enjoy) I don't have the energy left to write anything else.

A blogger workflow Saturday, January 17, 2009

I wanted an easy way to write Blogger entries in my usual editor that gave me the ability to do simple formatting and code syntax highlighting. I've basically ported my old on-line workflow from Wordpress: using Markdown and a syntax highlighter (now Pygments, was previously something else in PHP). It's not perfect but good enough for me.

Step 1: Download Pygments and Markdown

Step 2: add Pygments CSS:

./pygmentize -S borland -f html > style.css

Then copy and paste the contents of style.css into your HTML template.

Step 3: Use Sam's crappy Python script

Here is a little script that that integrates the two tools; reads text from stdin and writes HTML to stdout. Copy and paste the HTML into Blogger.

import sys, re
sys.path.append("pylib")

import markdown2 as markdown
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter

def main():
  NORMAL, IN_PRE = 0, 1
  state = NORMAL

  p_lines = []
  n_lines = []
  lang = "python"

  for line in sys.stdin:
    line = line.rstrip()
    if state == NORMAL:
      m = re.match(r'\s*<pre lang="(.*)">', line)
      if m:
        state = IN_PRE
        lang = m.group(1)
      else:
        n_lines.append(line)
    elif state == IN_PRE:
      m = re.match(r'\s*</pre>', line)
      if m:
        state = NORMAL
        n_lines.append( highlight("\n".join(p_lines), get_lexer_by_name(lang),
            HtmlFormatter()) )
        p_lines = []
      else:
        p_lines.append(line)


  if len(n_lines) > 0:
    print markdown.markdown("\n".join(n_lines))

  if len(p_lines) > 0:
    print "Error in <pre>"

if __name__ == '__main__':
  main()

Step 4: Just go back and use Wordpress

Well, maybe. I like not having to maintain a Wordpress blog though.

Generating passwords, a quick Python snippet Wednesday, April 9, 2008

Generating a password in Python:

import md5, base64, random
random.seed()
s = raw_input("Enter salt: ")
print base64.b64encode(md5.md5(`random.random()` + s).digest())[:-2]

Works for me.

Of course, it's basically impossible to remember the password generated. And it is non-deterministic thanks to the random() call. And some braindead authentication systems don't like you having a number for the first character of the password, which this sometimes generates.