KBD

Keith Devens .com

Sunday, October 12, 2008 Flag waving
In Iran, we don’t have homosexuals like you do in this country. – Mahmoud Ahmadinejad (speech at Columbia University, 9/24/07)

Archive: March 05, 2003

← March 03, 2003March 06, 2003 →

Daily link icon Wednesday, March 5, 2003

Ilohamail

Ilohamail looks like a pretty good webmail program.

RSS aggregator mock-up in Python

Via Bitworking, I gotta check out Sam Ruby's RSS aggregator mock-up. At the very least it'll illustrate the right way to use wxPython Smiley

Metaclass programming in Python

IBM developerWorks: Metaclass programming in Python

Most readers are already familiar with the concepts of object-oriented programming: inheritance, encapsulation, polymorphism. But the creation of objects of a given class, with certain parents, is usually thought of as a "just so" operation. It turns out that a number of new programming constructs become either easier, or possible at all, when you can customize the process of object creation. Metaclasses enable certain types of "aspect-oriented programming," for example, you can enhance classes with features like tracing capabilities, object persistence, exception logging, and more.

Reading - for whenever I get a chance

Here's some reading for whenever I get a chance.

Something to think about

Jim: Perfection leads to mediocrity. Think long and hard about this, and ingrain it into your psyche. I can't stress enough how important this lesson is.

StructuredText lists

In my (super-dandy, hyper-extensible, solve-world-hunger and kick-Saddam-in-the-nuts) StructuredText parser (version 2) which I've been working on lately, the last main thing I have to do before I can actually use the darn thing is get the list syntax to work. I've been having problems specifying to the parser exactly how the lists should be parsed, and I realized today that there's a weird case that's been causing my problems. Here's the rundown:

The lists in my previous version of my StructuredText parser looked like this:

* List
** Nested list
*** Another nested list

Not too bad, but it's klunky. It's more natural to me to write the following:

* List
  * Nested list
    * Another nested list

That's two spaces before each nested list starts. I haven't worried about other kinds of lists (like ordered lists) yet.

This is easy to parse in my ST parser. Next, I wanted to be able to have multiple lines in my lists. So that would look like this:

* List
  * This is a
    nested list

No problem. Some various cases are the following:

* List with
  continuing text

No problem. If you happen to mess up and put one space instead of two:

* List with
 continuing text

it would figure out what you meant. If you messed up and didn't put any spaces, the list would end and it would consider that line the start of a paragraph. If you had any amount of spaces before the text began:

* List with
        continuing text

the parser would strip the first two spaces and the line would continue with no problem. So far so good. Even this would work with no problem:

* List with
  Continuing text
  * Sub list
    with continuing text

and so on. The problem arises in two specific cases:

* List
  * Sublist
 oops, not indented right

and

* List
  * sublist
  still not indented right, but where normally
  it would end the list and become the start of
  a paragraph, this time it's in the middle of
  a nested list, so even if I end the sublist,
  I still have to figure out what to do with
  all this text.

This problem really arises as a result of both the new syntax and allowing multiple lines in a list (which I couldn't do before in my old parser). The problem didn't exist in the old parser because every line in a list began with a "list marker" (like *,-, or +), so indentation wasn't important, and multiple lines in a list weren't allowed. I could solve the problem in my current parser, but it would require potentially a lot of lookahead, which I'm not happy about. It's not elegant, and it's slower.

I haven't decided what to do yet, but for now I'm going to see what the reStructuredText people did. I'll bet you they throw parser exceptions (which I don't really want to do).

activeRenderer

There's a new version of activeRenderer, and this one's available as a web service. Neat.

Long day (and... the second Animatrix movie is out!)

Whoo that was a long day today (Tuesday). I just completed my day - I just finished watching 24 with my dad -- what an awesome, awesome show.

Also, when I was in McGovern's tonight, I happen to catch some Final Fantasy-looking graphics on one of the TV's. It immediately captured my attention, and as I watched, The Matrix green screensaver thingy scrolled down the screen, and I realized that it was probably a commercial for the second Animatrix movie. I forgot about it since then, but Matt just reminded me. Thanks Matt Smiley

← March 03, 2003March 06, 2003 →
October 2008
SunMonTueWedThuFriSat
 1234
567891011
12131415161718
19202122232425
262728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 8 posts

Recent comments XML

new⇒URL design

http://groups.google.com/group/cool​ndex/web/asian-girl-sucking-to-blac​k-man...

derek: Oct 12, 12:13pm

I hate PHP

Elliot Anderson,

Dude!! You the​man! The reverse replacement for​array_u...

Alex Ndungu: Oct 11, 1:35am

Call a function from a string in Python

?!code:
some_object.__getattribute​__('method_name')()
?!/code

is​the s...

Patrick Corcoran: Oct 8, 3:53pm

Spider solitaire

I have won 185 games of Spider​Solitaire at the "Difficult" level.​ What is...

75.179.28.113: Oct 8, 12:42pm

Sed one-liners

Hi.

I wanted to let you know​that I wrote an article "Famous Sed​One-Lin...

Peteris Krumins: Oct 8, 3:05am

Timesheet Calculator

Hadn't seen it before now, but my​company already uses a time​tracking prog...

Keith: Oct 7, 10:44am

Girls, please don't get breast implants

Hey everyone, 

I am new to this​blog and I have enjoyed reading all​your...

Sarah.M.: Oct 6, 9:45am

Generated in about 0.108s.

(Used 7 db queries)

mobile phone