Linux : FreeBSD :: Ruby : Python
Discuss.
Linux : FreeBSD :: Ruby : Python
Discuss.
Tonight, I heard a bunch of sirens beyond the typical living in First Hill next to 10 hospitals sirens, and lacking a scanner I was curious what was going on. I fired up Google and found a nice mashup of real time Seattle 911 Dispatch overlaid on Google Maps. Someone must have convinced the Seattle.gov guys to make it easy to parse again. I know there was a flareup where for “security” reasons they turned the whole thing into an image.
Anyway, I assume the incident I heard was:
22:26:09
Rescue Heavy
0 - 0 Nb I5 At 45A14 A14 B5 B6 DEP1 E17 E2 E22 E25 L7 L9 M16 M16 M44 R1 SAFT2 STAF10
Which according to the legend, and as best I can tell, they dispatched 2 Aid Units (Basic Life Support), 2 Battalion Chiefs, 4 Engines (water, hose and a pump), 2 Ladders (ladders and a large assortment of tools), 3 Medic Units (Advanced Life Support), 1 Rescue Unit and 3 others which I’m not sure how to interpret (DEP1, SAFT2, STAF10) to a location on I-5. Searching around the Seattle Fire Dept Gallery didn’t reveal much. Anyone know what those other 3 units are? Must have been a pretty nasty accident. Hope everyone comes out safely.
Last month, a lengthy discussion kicked off on Ruby-Talk called “Why not adopt Python style indentation for Ruby?” .. it wasn’t anything particularly new, because a similar discussion occurred six years ago. Nevertheless, a coder called Jinjing has been inspired to create Lazibi, a Ruby pre-processor to allow one to use Python style indentation within Ruby code.
http://www.rubyinside.com/lazibi-python-style-indenting-for-ruby-532.html
Why not just adopt Python altogether? :-P So close and yet so far.
The true test of Geekdom is whether you can read a bug report on a Saturday evening and find great humor in it. Here is your chance:
Look for such “celebrity” appearances as the “xkcd” guy and others. My favorite part, is the bug reporter chiming in each year to wish the bug happy birthday, though there is an inconsistency when he changes the gender of the bug along the way. Maybe I should file a bug on the bug report?
I’ve been trying to code some more on Project Shelob (my web server) in my spare time. I’m to the point of needing a configuration file, so I can start up the server using different ports and directories for testing. Speaking of testing, I’m also to the point of needing automated test suites. I was refactoring some of the HTTP code, and when I got done, it was far more readable, and there was much rejoicing! Unfortunately, two days later I discovered I had introduced a subtle bug in keep-alive handling during a 404 event. Oops.
Anyway, I decided to use JSON as my configuration language. Simple, accommodated everything I needed, and later I would be able to easily write an AJAX GUI front end to configure the whole thing. Should be slick, right? Not as easy as it might sound. Though I have written parsers by hand, I’d rather not. Ok, so I’m using C++, surely someone has written an easy to use open source library that I can just stick in my rules and get out a nice data structure, right?
Well, kind of. There is Boost Spirit which would do everything that I want it to do, but it also required me translating the EBNF grammar of JSON into Boost’s strange amalgamation of YACC and C++. Okay well and good, but surely there is something better? After some more searching, I run across ANTLR which seems to be the spiritual successor to LEX and YACC/Bison. It even has a nice Java GUI and someone had kindly done the ANTLR rules for JSON. Check out the graphical goodness:

Still, the C++ backend wasn’t fully supported and required installing libraries and was complicated. Not 100% what I needed or wanted. All of which got me thinking about domain specific languages. Most programmers don’t consider it, but SQL and Regular Expressions are good examples of Domain Specific Languages (DSL), as are lex and yacc/bison. Up till now, I’ve frowned on the whole idea of DSLs in general. It had always seemed like bad software engineering practice to invent a new language for each problem. After all, did we really want to learn an entirely new programming language with each assignment? Who is going to maintain the code?
However, the facts point out that you have to learn an entire API anyway, and the API really just layers over what you’re really trying to do with a language that wasn’t quite expressive enough to do the job natively to begin with. Which of course leads me to LISP and through Martin Fowler who makes some good points here:
“One of the most obviously DSLy parts of the world is the Unix tradition of writing little languages. These are external DSL systems, that typically use Unix’s built in tools to help with translation. While at university I played a little with lex and yacc - similar tools are a regular part of the Unix tool-chain. These tools make it easy to write parsers and generate code (often in C) for little languages. Awk is a good example of this kind of mini-language.”
While I’ve been using SQL, regular expressions, awk, lex, and yacc for years, I’d never really classified them in my mind as DSLs. I’ve been well aware of the power of small specialized utilities aggregated together to perform a bigger task and why UNIX has been so successful at this, but I hadn’t made the leap to apply this to my programming. Fowler continues:
“Lisp is probably the strongest example of expressing DSLs directly in the language itself.. Symbolic processing is embedded into the name as well as practice of lispers. Doing this is helped by the facilities of lisp - minimalist syntax, closures, and macros present a heady cocktail of DSL tooling. Paul Graham writes a lot about this style of development. Smalltalk also has a strong tradition of this style of development.”
I’ve heard “grey-beards” and academics talk about the power of Lisp for years, and though I did some trivial functional programming in college, I’ve dismissed the rants of the Lisp guys as nothing more than rants. Today though, the ideas are crystallizing in my head, and I’m excited to explore this more.
I read way too much and I visit too many random web sites. Today, I was reading the Wall Street Journal online about outsourcing the more common things in your life.
I do a search for Get Friday, one of the Indian firms mentioned, out of curiosity.
Under unusual services they have provided a couple tidbits:
What kind of person thinks it would be a swell idea to have someone in India read your kid a bedtime story on the phone because they are too busy? Although, it would be fun to have everyone route their requests to a personal assistant, just to see the looks on their faces.
Wes: check out introducing pipes
Matt: “Those who do not understand Unix are condemned to reinvent it, poorly.”
Matt: I hear vista finally has symlinks. Wake me up when they invent mount points and finally kill drive letters
Wes: I think you can do that somehow.
Matt: yeah sure, and break everything *nerd rage*
Wes: yeah, junction point. junction points (technet)
Matt: “Those who do not understand Unix are condemned to reinvent it, poorly.”
Update, Wes says, if you want to know more see his blogs at:
Recent Comments