The thing is, if it KNOWS how to do it, why doesn’t it just do it that way?
More on Makefiles
I posted before about Makefiles when a tool builds multiple targets, and some discussion was had. Further to that, a colleague found this cute solution and we refined it a little. It has several advantages over the last method I put forward:
It doesn’t require an additional file to be written to disk
It’s clearer [...]
Say one stage in your build process is a tool that writes out a series of source files and config files. You might have a rule that looks a bit like this:
glue.c glue.h net_conf.xml error_list.config: application.config context.xml target.conf
generate_glue.exe $^
The trouble is, this is exactly the same [...]
or, “HELP11 SHIFT IS STUCK ON1″.
If you do not have trouble typing, nor holding down shift while pressing other keys, then you probably don’t need Windows XP’s Accessibility features. If you habitually tap the shift key whilst you consider your next sentence, for example, then you are definitely better off without them.
Tapping shift in [...]
Turns out it wasn’t safe to suggest I would never implement it.
There’s the C# express edition source there and also an executable. It saves and loads its data in the current directory, so I recommend running it via a shortcut so you can control where it puts its datafile.
It’s clear it needs lots of [...]
This is an idea that occured to me around about 1992. It’s probably safe to suggest I will never implement it.
By catching all keydown events (importantly, including shift and ctrl), the “flavour” of someone’s typing can be recorded. We have a set of pairs of keys, and the delay between them. [...]
Lunchtime
demacs
Having learned that bash (or readline) uses emacs-like keybindings to move cursors around, and having problems going to start-of-line or end-of-line by pressing HOME and END when sshed to the Mac, I googled for emacs key bindings and stumbled upon Emacs Makes You Retarded. If you can’t be bothered to read the article, basically [...]
"""
Template Dictionary module
An enhancement to python's template stuff. At present you must supply all
parameters to instantiate a string template. We want to be able to
instantiate only the paramaters that we have right now, and leave the
others for instantiation later.
Without TDict:
>>> "%(greeting)s %(person)s"%{'greeting': 'Hello', 'person': 'World'}
'Hello World'
>>> "%(greeting)s %(person)s"%{'greeting': 'Hello'}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'person'
This module provides class TDict (template dictionary) that, if you try
to read a non-existent key "keyname", returns "%(keyname)s". Hence, it
"passes through" any undefined names.
>>> from TDict import *
>>> a=TDict({})
>>> a['a']='bibble'
>>> a['a']
'bibble'
>>> a['b']
'%(b)s'
>>> "%(greeting)s %(person)s"%TDict({'greeting': 'Hello'})
'Hello %(person)s'
>>> tdict("%(greeting)s %(person)s",{'greeting': 'Hello'})
'Hello %(person)s'
"""
class TDict(dict):
def __init__(self,d={}):
dict.__init__(self)
for k in d.keys():
self[k]=d[k]
def __getitem__(self, key):
try:
return dict.__getitem__(self, key)
except KeyError:
return "%%(%s)s"%key
def tdict(template,dict):
d=TDict(dict)
return template%d
When posting the python below, I used the non-breaking space HTML entity to make sure the indentation of the code was correct. But what if you want monospaced text with word wrap? You can simply use regular spaces, but multiple regular spaces in a row are contracted to a single space. [...]