Pages: << 1 ... 54 55 56 57 58 59 60 61 62 63 64 >>
How is it that there are so many bad Chinese food places in Bloomington? I've been to three recently that never seem to have anybody in them, yet they stay in business somehow. Is it the low wages they pay their workers? Is it the takeout and delivery business? I'm not sure. The three places are Noodle Town, China Cafe Express and that Chinese place next to Kroger on College Mall (I think it's "Flower something something"). Noodle Town is actually pretty good and has reasonable prices; I suspect that they stay in business for two reasons: takeout and the fact that they are owned by the Japanese steak house next door. China Cafe Express is not so great AND over-priced. Maybe the rent is low out on 10th and the Bypass. Or maybe they're overpriced because Mama's Place next door is over-priced. (Although Mama's Place's prices are justified.) The Flower place is good and has average prices. Maybe they do a lot of deliveries too. It's run by South Asians (Vietnamese?) so there are some good non-standard-chinese/american dishes.
Wow, this Powerbook keyboard feels mushy after the new iMac keyboard. That's impressive—the Powerbook keyboard is one of my favourites, but it is quickly being eclipsed by the new Mac keyboard. It seems that Apple has finally made a quality input device. (The Mighty Mouse is nice but not breathtaking.)
My lessors's son was here this morning taking care of the dog while they are in the Frozen North* watching a granddaughter's football** game. It turns out that we both played Privateer back in the 90s. I told him that there is was a remake when the source was released a few years ago, so he installed it while I was at Aikido. He actually knew how to play it, unlike me: he was in his mid-20s when he played it; I was 12. It's free, so if you're into old games, or sandbox-style games, you might want to download it. Apparently there are distributions for Windows, Mac OS and Linux. That makes me happy (the Mac part).
Speaking of Mac and Windows, once I had VMWare installed, I ran into the font-smoothing problem that was a hot topic a few weeks ago. I had both anti-aliasing mechanisms on the same LCD and, as predicted, I prefer the one I'm used to. Windows' smoothing makes the text look all spindly to me.
Note: Pasting isn't working correctly from emacs to b2evolution. You'll have to bear with some stupid line breaks until I figure out the problem
*Not frozen at all times of year. Your mileage may vary depending
on construction and weather.
**The other kind of football.
I am in the midst of downloading Important Programs* from IUWare right now and unfortunately the thing is beginning to resemble Zeno's paradox. The download rate slips ever slower and the estimated time to completion has remained the same for the last hour or so. At this rate it will never finish. At least now I have time to finish the linguistics department newsletter.
*Office and Visual Studio. Turns out I have an old-ish (2003) version of Visio but I'm not sure whether I will install it. I may buy OmniGraffle this month and it is a far better product.
So my new iMac came a few days early. In fact, it came before the iPod I ordered for my friend in comp ling because of the student-free-iPod deal. Apple announced new iPods today so I thought maybe they were waiting to deliver a new one, but no, it looks like he's getting a "2nd-gen" one, which appears to be the old one.
I'm not going to give a big review of the Mac because you almost certainly have strong opinions about Macs already (particularly about the wisdom of buying a desktop Mac), but I am really amazed by the ease of the upgrade process. I just did rsync -vaE /Volumes/backup/p3r3grin/5sep2007/ /Users/zackman and waited for 10 minutes and it's like I am still working on my laptop--almost uncanny. I restarted iTunes and it appeared exactly the way it is on my laptop right now. I started Mail and instead of being greeted with "set me up!" I saw the e-mail from the editor listing the things I need to fix (almost done, by the way; the next step is to install VMWare so I can finish the stupid Word fonts from the comfort of my own home). It's amazing—Unix rocks. Now I just need to go through and restore the little hacks like replacing US-Unicode.keylayout with my own custom Linguist.keylayout and getting rid of the melty GNU icon for emacs. And I need to reinstall a lot of programs too.
Later: Amazing! It even restored the custom folder icons I had! rsync must have correctly copied the resource forks of the folders. I didn't think it could do that.
I have reigned in some of the excesses of the interface after learning a bit more how to control b2evolution. Significantly, I can edit the code from the admin side, which is where I learned that some of the options do not actually require editing the code. Anyway, the main two things I still need to figure out are (1) how to import my previous posts (2) make sure people can comment without registering, but with entering a password. I'm not sure (2) is possible. Also if I end up liking blogging software, I may (3) install a package manually someday, because this software is quite oodate already.
I may or may not start doing this regularly. There is a lot of free code that Google makes easy to browse over at Google Code. Like all code it's of varying quality, so I thought I'd randomly pick on projects and take a look at the code over there. First up are some snippets from Setenta Labs, which is, uh, the top hit for the tag 'python'. In pycairo/arena.py, there is a nice multi-line comment technique:
def do_motion_notify_event(self, event):
pos = (event.x, event.y)
# ... snip ...
return False
'''
if self.drag:
# ... snip ...
return False
'''
This works because Python's compiler doesn't warn about top-level expressions (aka 'expression where statement expected'), so you can just quote something as a string and it does nothing. Very nice if you like multi-line comments and couldn't get them before.
A variant on this that I use while changing code, especially functional code that is usually concentrated in a single giant return statement is this:
def candidate_tree(tab):
"set([(str,[vln])]) -> ([(str,[vln])], tree [(str,[vln])])"
top_row = iter(tab).next()
if len(tab)==1:
return top_row, []
if len(top_row)==1:
return [lst.fst(bounding_set(map(lst.car, tab)))], []
bounder = map(bounding_set, lst.transpose(tab))
return ((tab,map(lst.fst, bounder)),
[candidate_tree(remove_col(filter(lambda row:row[i]==best-different,
tab),
i))
for i,(best,different) in enumerate(bounder)])
return (map(lst.fst, bounder),
[bounding_tree(remove_col(filter(lambda row:row[i]==best-different,
tab),
i))
for i,(best,different) in enumerate(bounder)])
Python doesn't warn about unreachable code, so you can keep old code around below your new code until the new stuff works. (I'm pretty sure the above code DOESN'T work, in case you're wondering.)
Next up is theoryofcomputation/automato.py. First off, there is a lot of Portuguese throughout the file. But all the code is in English. It would be nice to choose one or the other, preferably English—I don't know if the author intended for others to read the code, but it is hosted on a public, open-source server.
This file implements a finite state automaton, which is formally represented as a 5-tuple. (that's what the comment says in Portuguese). However this implementation uses a 4-tuple for reasons I can't entirely translate.
# Componentes da 4-upla que descreve um AFD. # NOTA: convencionalmente usa-se uma 5-upla, sendo o primeiro # o conjunto dos estados possiveis. Nesta implementacao # extrairemos os estados possiveis dos estados de entrada # na funcao de transicao. ( ALPHABET, TRANSITION_FUNCTION, START_STATE, FINAL_STATES ) = range(4)
That code just above is actually setting up accessors into a tuple. The first function shows how they are used.
def validate_machine(machine):
if not machine:
print 'validate_machine: maquina invalida.'
return False
possible_states = set(machine[TRANSITION_FUNCTION].keys())
if not machine[FINAL_STATES].issubset(possible_states):
# ... snip ...
That's a little ugly: it looks like what the programmer really wants is a struct. Of course this is not something Python has natively, but it's quite easy to add them using classes, or even to do it manually with a class. On the other hand, if you want to use a tuple, the proper way is to unpack it at the beginning of every function:
def validate_machine((alphabet, transition_function, state_state, final_states)):
# ... snip ...
This additionally ensures that you don't pass in a structure that is shorter or longer by mistake. Tuples are a great light-weight alternative to structs, but they are trickier to use correctly in Python because they behave a lot like lists, which they are not (eg supporting indexing, iteration, etc).