My first user group presentation

It’s pretty hard to believe that the entire summer has gone by, and I’ll be coming home in less than two weeks. But before that, I did something brave! On Monday, I went way outside my comfort zone and gave a talk at EdmontonPy, the local Python user’s group. The talk was about a specific metaprogramming feature in Python called decorators. If you know what that means, or think you’d like to know, you can check out the project page on GitHub, or jump straight into the GitHub repo for extra goodies.

Anyway, I’m not going to reiterate the content of the talk here. The text is online (I even edited a lot of things after the presentation), as is a rough version of my script, and a recording is on YouTube. That basically covers anything anyone could want. I just thought I’d write up my thoughts about the experience.

Inspiration

Towards the end of June, I started wondering whether I should invest more in my programming skills. I was already learning a lot at work, by necessity, but I thought I could be doing more. I searched for “Ottawa Python”, and found Ottawa Python Author’s Group. Obviously, I then checked to see if there was anything for Edmonton - and there was! So I tentatively decided to attend the July meeting, and managed to follow through on it, too (though I came close to turning around a couple times on the way there).

I enjoyed Daniel Nephin’s talk on itertools, and Aden Grue’s talk about Unicode brought up the one or two Unicode pitfalls I was lucky enough not to trip on already. I chatted for a bit with one of the primary organizers, Brian Forst, who also works at the University of Alberta. While I hadn’t asked my supervisors for permission yet, I’d also gotten particularly excited about the idea of going to PyCon Canada. I asked around, and was directed to (I think - correct me if I’m wrong!) Diana Clarke who has been involved in organizing the most recent PyCons. We chatted for a bit about the conference, and she more or less suggested that I might want to wait until next year and apply for funding of some kind. Didn’t matter in the end, though, because the timing was bad (my supervisors would be getting back from month long trips at the same time).

Anyway! So that was all well and good. As I was walking back to the subway station, obviously inspired, I started reading an ebook I’d bought called Guide to: Learning Python Decorators by Matt Harrison. I got the ebook on Amazon fairly cheaply, but I won’t link it ‘cause he deserves a larger cut of the sales. It’s concise, the writing is clear, and organized beautifully.

It’s laid out in such a way that concepts many people struggle with learning - functions as first class objects, closures - seem to just follow naturally from the content of the previous sections. Even though the majority of the book isn’t literally about decorators, the earlier sections make them much easier to understand. Plus, it turns out that closures are pretty simple and they’re actually really useful.

In other words, there may never be a better explanation of decorators than Matt’s book.

Despite the high quality of the book, upon getting home and finishing the book (it’s no longer than it needs to be), I decided I could probably give a talk on the subject. I must have known at the time that I couldn’t possibly present the topic as well as the book had, but I felt like stretching my boundaries, so I sent off an e-mail volunteering to give a talk in August.

I promptly got an e-mail back saying they already had two talks scheduled, but they’d keep me in mind. They had announced the talks for August, right in front of me, and apparently I forgot five minutes later. Oops. But then a few weeks ago I got an e-mail saying the original presenter was too busy to prepare a talk, and they were looking for volunteers. Woo!

Anyway, I’ll post shortly about how it actually went, and then after that will be a bunch of technical notes that will, some day, show up as search results for the people as frustrated as I was when I prepared my presentation.

Summer 2012 Projects I

Next up is the list of my summer projects. Like most students, I tend to build up a pile of things I wish I had time for. Like most students, I also expect to have literally infinite time in the summer, since I’m not taking a full course load. Following that logic, I set out fifteen items on my list of potential summer projects. Only three are what I’ll call “complete”, while three are “kind of complete?” because I did actually get somewhere. There are three others that I’ve worked on since the summer. Two I decided weren’t worth the effort. In the end, that leaves four in limbo.

        Because the post got insanely long, I’m making this first part about “stuff I accomplished in the summer” and the second part about “everything else”. Also, bear in mind this is just me talking about my to-do list - there’s going to be another post about generally evaluating the summer.

Stuff I did

  • Read Code Complete

        I finished this one, by setting myself a goal of 60 pages per week. I did most of my reading on the bus (yes, I carried a 1300 page tome with me), which is weird for a programming book. However, I didn’t take notes on the entire thing, because it would require a lot of typing. I would like to go back and take more notes, in order to learn the material better and share with others. On the other hand, I worry about copying too much of the content. As if a ten year old book is really selling all that well these days.

  • Learn a programming language?

        I consider this one done, from reading half of Learn You a Haskell for Great Good. Which is an awesome book, by the way. Actually, it’s so good that it actually makes me question whether I like Haskell because of the language, or just because I started with a well-written book. But then I read these code snippets and I think “man that is cool” and figure it’s probably the language.

        Here’s why I can’t wholeheartedly say I completed this task: I’ve never actually written any Haskell code. I read the book on an Android tablet while on vacation at a lakeside cottage. And yet, months later, I can read Haskell code examples. I mean, I can basically read Ruby code examples despite knowing nothing about the language. But Haskell is extremely different from all the other languages I know - unlike Ruby, I couldn’t have intuitively parsed those FizzBuzz code examples a year ago.

        But it has to be said that I don’t yet know how to go about solving problems in Haskell. Maybe it’s more honest to say that this one is partially complete. But I’m happy enough with what I did learn, and intend to finish the book soon. Oh, and I also plan to check out the tutorials from these dudes.

  • Coursera courses

        There were two courses I thought were interesting running over the summer - Design and Analysis of Algorithms I, and Algorithms I. So I put them both on my to-do list, because their descriptions claimed they covered different stuff. However, in the end I didn’t bother doing Algorithms I. It seemed like a simpler course - focusing on implementing different algorithms in, I believe, Java. I will admit the Java part influenced my decision not to take the course, because I never want to go back to that. But I found the challenge of Design and Analysis of Algorithms I exciting, and didn’t feel like going over similar material again at the implementation level.

        So I took Design and Analysis of Algorithms because it ran first. Apparently, it was the more difficult course. It focused on mathematical analysis of algorithms and dealing with implementation in the abstract. Students had to fill in the implementation details in their language of choice. I didn’t complete all the credit stuff for the course, but I watched all the lectures, took notes, and learned a lot of great stuff. By which I mean, I struggled to find the time for (and feel comfortable with) all the typing necessary for the assignments. I figure I’ll retake the course at some point and just do the assignments so I get the credit. Even if I don’t, the material was really good and it taught me a lot of useful stuff.

Stuff that was partially completed

  • Super thumb drive, including security

        Semi-complete - “super” originally included having a setup for any computer I came across, not just ones using Windows. It seemed lightly possible to have portable Mac apps, but on the Linux side it looked like a wash (for understandable reasons, but still). Given that I don’t know enough about either ecosystem, I gave up on those. Also I’m lazy about security (at least, security defined as “repeatedly scanning your flash drive with portable antivirus software that’s known to be crappy”). However! I do have a USB 3.0 flash drive with all my browser customizations and LastPass installed, my Frankenstein IM client, 7zip, Workrave, and more via PortableApps. I also have some instructions for setting up portable Emacs. Using unconfigured Emacs is painful to me, so this is important. Once that’s done, I’ll consider this complete. Although, now that I think about it, anything that depends on Cygwin and other external tools may be impossible to get on another computer. Hmm.

  • Have the perfect Emacs setup

        This one is partially complete, but then, is it possible to finish? I still have hundreds of bookmarks to look at…

  • Paper with Sebastien, investigate PyPy for scientific computing

        I did investigate PyPy, but despite one or two reminders to Sebastien, the project stalled. I consider this partially complete, because I read a master’s thesis and gave some genuine thought to the implementation. That sounds like it took ten minutes, but no, it took a lot longer than that. Less time than actually implementing the whole system, obviously, but we’re talking a 100 page master’s thesis and a couple of hours looking at API documentation.

Installing the Windows 7 SDK on a new computer

[[if you’ve stumbled onto this trying to get the Win7 SDK installed, skip to the bottom]]

When I got my new laptop, I needed to get ispell setup for spell checking in Emacs. ispell itself on Windows is a wash, but I know aspell and hunspell can work. aspell can be had from Cygwin, which is great! Except that in September something was wrong with it/the mirror I chose, and it wouldn’t install. I got it a few weeks ago and all is well, but before that, I tried to get hunspell working.

Now, the instructions for Unix-based systems are pretty simple. Less so for Windows. I tried the 2.1 compilation instructions, for installing and running through Cygwin. Didn’t work for me (at the time, haven’t tried recently). The 2.2 installation was no better. So, off I went to try and get the Win7 SDK. I hoped that would be easier than futzing around with Cygwin

I was wrong.

I got two different errors (the numbers for which I’ve lost, sadly), and Microsoft’s help was no use. After a couple of solutions that “worked for this author”, including one involving registry editing, I finally found the problem.

My computer came pre-installed with a higher version of .NET and Visual C++ 2010 Redistributable than the ones in the SDK.

So, uninstall those, run the SDK installer, and then check Windows Update to get the newest versions back.

Anyway, this isn’t terribly useful without the exact error codes. But I don’t really feel like replicating the errors now that I have it working! It’s all a moot point now that I got aspell installed, but there you go. Just in case I ever need to install the SDK again, or someone else needs to.

When I have to install a bunch of Python libraries

wheningit:

hedgehog

Alright, I know this is uncharacteristic for my tumblr these days, but this is pretty much how I feel about dependencies on Windows. All the time. I waste entire life (or at least, entire summer life) messing with dependency bullcrap. All I wanted to do was use C++ to put a picture on the screen, and it became a several hour time suck trying to get CMake to work to install a graphics library (and all the dependencies of its dependencies…). So then I moved to Python and PsychoPy, but the only reasonable way to install PsychoPy on Windows is to download their standalone package that includes Python. So now I have three versions of Python installed (2.7.3, 3.2, and PsychoPy’s 2.6.6) and I have to mess with my PATH to get everything in the right order.

The alternative option was to add their dependencies to my 2.7 installation, but that would be an endeavour worthy of the above .gif times three. Trying to handle the fact that PsychoPy has a dozen (literally, count them) dependencies, the fact that there are three Python package managers (pip, easy_install, setuptools) and none of them seem to work 100% of the time…

It sucks and I much prefer writing code. Even if the code uses the subprocess module and calling kill() doesn’t actually work on Windows so I have to borrow a function that makes calls to the Win32 API… That is better than managing dependencies outside Unix. Because it means the software for running my experiment is almost ready!

for-else construct in Python4

A couple of weeks ago, I agreed to facilitate a workshop on Python for non-programmers in the cognitive science department at Carleton. It’s been alright so far for the first two sessions - about seven-ish people attending, but with wildly varying skill levels. Specifically, one guy is experienced with C/C++ and several others know almost nothing at all about programming. It’s been hard to engage everyone at once. There’s been a lot of “we can talk about this after” and “this is interesting but probably not important to most of you”… especially from me because I get excited and hope they will still understand.

Anyway! This evening I was trying to find good code examples to show in an online Python interpreter that doubles as a visual debugger. Looking through the available examples, under the advanced Python features section, I saw an example called “for-else” (the title of this post links directly to it). Wait… what is that?

As it turns out, this exists in Python. I found a blog post on the topic that shows a useful application of the technique. This can be applied to a for loop or a while loop, and the code in the “else” clause only runs if the loop exits normally. In other words, it runs if you don’t break out of the loop. In a way, it’s kind of like the “else” is attached to all the break statements inside your loop - namely, if none of the break statements are reached, run the else clause. I have a really hard time matching up the idea of this meaning with an interpretation of “else” - to me, this seems more like a “finally” clause that is surpassed by break. finally is used for exception handling in Java, but by definition you can’t pass over it - code in a “finally” clause is run no matter what. Well, I think. I’m sure there are loopholes I don’t remember, probably involving destructors somehow because they’re a source of much evil.

I feel like it’s a solution in search of a problem, which is probably why this isn’t a very well known feature. Off the top of my head, the only thing I use break for is when I’m looking for a single thing in a collection and want to do something with it afterwards - and not do anything with the rest of the collection. continue is a different story - I use continue a lot more often, because looking at an item of a collection and doing nothing with it is a lot more common than finding one item and discarding the rest of the collection.

But hey, there you go, some unique semantics (I think?) in a programming language. If it was really such a great idea, it probably wouldn’t be so rare.

Light Table - an IDE that goes beyond text4

I’ve been watching Chris Granger’s Light Table project for a few months now (apparently, since April) and the more I think about it, the more I like it. According to their Kickstarter, the rough estimate for release is May 2013. When it comes out, it’s supposed to support Clojure (a Lisp dialect that initially ran on the JVM but has a variety of ports), JavaScript, and Python - all dynamic languages with powerful tools for instantly providing feedback. The link in the title of this post will get you to the version 0.1 demo, which currently only supports Clojure.

        Even though I like Emacs and have no trouble using a command line tool like Leiningen (aka lein), I see a lot of things to like about Light Table. I like the fact that lein is now built-in, and you can get started with a project right away. The Instarepl is fun to play around with, and it’s something that would be difficult for a purely text based editing environment. With the addition of the Table in the latest version is, things have gotten a lot more interesting. What they’ve done is emphasize the structure of functional programming through the structure of the IDE - you work with a bunch of discrete, self-contained units and gradually combine them into a unified organism (to take some inspiration from the preface to Structure and Interpretation of Computer Programs).

        Working in a buffer of code, if you find that you need to re-arrange some units, it’s a lot of work. Light Table presents these units as being completely distinct from each other, making it easy to navigate between them and move them around. I assume the final product will make it easy to travel between the different views of your code - I’d love to shuttle a bit of code between the Table for editing and the Instarepl for testing, for example, but at the moment that doesn’t seem to be possible. The constant documentation lookup presented in the Kickstarter pitch+video is nice, as well, and I think it would prove to be more useful than having a hotkey to go looking for a bit of documentation.

        The moral of the story, though, is that these are the kind of things you put together when you look at the logical structure of code. Extending Light Table in JavaScript, as demoed by Chris, actually winds up leading to more impressive extensions than most of what you see for Emacs. Emacs has tons of awesome extensions like Org mode; but your power starts and ends with text processing. You can make nice tables in Org mode - I’ll happily concede that you could write a similar benchmarking mode that outputs an Org file. That’s pretty simple in plain text.

        What about displaying the contents of a database on the fly? It seems to me that Emacs isn’t so great at displaying constantly changing data like that (ie as you change the code in the associated buffer), but I could be wrong. But until someone completely revamps the rendering engine in Emacs (which could be a long time coming) you just can’t embed a webpage in Emacs. Full stop. No, viewing it in plain text with w3m doesn’t count. No, converting the webpage to a pdf and displaying that doesn’t count (yes, Emacs can do that). I mean honest-to-goodness embedding the webpage, such that you can interact with it and see it true to life, including its JavaScript and other stuff that probably stumps text-based browsers like w3m.

        This isn’t just an abstract problem - displaying text with heavy formatting is basically impossible in Emacs. I’ve been looking at using Emacs to write LaTeX for papers, and the workflow is pretty crappy. You write your LaTeX document, you compile it and output a pdf, then you display the pdf in Emacs or in a standard pdf viewing program (on Windows, SumatraPDF is a good choice because it won’t lock the pdf file while you’re viewing it). Compare that to Gliimpse - personally, I’d like a version with instant transitions, but that’s just me. With or without transitions, it’s the same idea. You write your markup, you take a second to see what it looks like, you switch back to the markup to make some changes. Tada!

        Contrast that with the current workflow - you write the markup, compile the new version, open the pdf, check out your changes, make some adjustments, recompile, re-open/refresh the pdf… A dual-pane environment for writing Markdown is actually available online, but I’m having a hard time finding anything similar for LaTeX. If Emacs had a rendering engine capable of displaying LaTeX documents accurately, it would provide leverage for a plethora of useful tools, stuff above and beyond the demos Chris put together.

        Until then, we have Light Table.

The Lisp Curse and the Dark Age of Emacs4

Over the last few months, I’ve been learning a lot about a text editor called Emacs. I haven’t started using it full-time, yet, but I’ve already spent dozens of hours researching it. The reason that so much information even exists is that Emacs can be easily extended to do things far outside the domain of a simple “text editor”. This is done using a programming language called Emacs Lisp (one of many dialects of Lisp). The essay I’ve linked above, The Lisp Curse, proposes the following hypothesis: “Lisp is so powerful that problems which are technical issues in other programming languages are social issues in Lisp.” Since Emacs is written in a dialect of Lisp, naturally it seems like it would fall prey to this problem.

The Past

        I can’t really evaluate the essay as to how it treats Lisp historically. But what strikes me about it, as someone who (currently) isn’t fluent in Lisp, is how much it reflects what I’ve seen in Emacs. The EmacsWiki is nothing if not a historical archive of many years of Emacs development. If you go to the page for some high-level problem, like session management, you’ll usually have at least three competing solutions. The trouble is that many of these solutions haven’t been touched for years, and may even be broken in modern Emacs. A different solution (which may not be perfect) may have been added to the standard distribution in a recent version, making extra code unnecessary (electric-pairs comes to mind for auto-inserting pairs of characters like [] and ()). This has been the case for the history of Emacs pre-2011 or so - let’s call this the “Dark Age of Emacs”. It seems to me that projects from the Dark Age of Emacs suffer from The Lisp Curse. From the essay:

“Programs written by individual hackers tend to follow the scratch-an-itch model. These programs will solve the problem that the hacker, himself, is having without necessarily handling related parts of the problem which would make the program more useful to others. Furthermore, the program is sure to work on that lone hacker’s own setup, but may not be portable to other Scheme implementations or to the same Scheme implementation on other platforms. Documentation may be lacking. Being essentially a project done in the hacker’s copious free time, the program is liable to suffer should real-life responsibilities intrude on the hacker. As Olin Shivers noted, this means that these one-man-band projects tend to solve eighty-percent of the problem.”

        I ran into this problem pretty early into my Emacs career. Session management was one of the first things I wanted to figure out when I started with Emacs. My goal was to keep a small text file open on the side at all times, containing a list of shortcuts and tricks I should remember. Imagine my frustration when none of the solutions I tried actually worked! Or at least, none were simple to set up for a complete beginner. Right now I use revive.el, which functions for the most part, but I’m not entirely happy with it. I could probably get it working if I understood it better, but at the moment its particular 80% solution works for me.

        Code from the Dark Age of Emacs is kept in blog posts, hosted on EmacsWiki, stuck in some obscure directory on university domains, lost to the ether that is personal websites with expired hosting… Tracking down updated versions is nigh impossible, because they’re often created by new authors taking care of an abandoned project. Small projects get “forked” or maintained by someone new without the benefits of the trail of crumbs left by forking on GitHub. I once ran into a project that was three times removed from its original author, with every successive version being hosted on a different personal website. The only reason I found the “newest” version of the project was a few stray comments on a long EmacsWiki page, full of hacks and monkey-patching that stopped being relevant years ago. See the EmacsWiki page on smooth scrolling for an example of this - odds are that none of those fixes will work for you. I’m surprised even two comments on that page have version numbers to serve as a lame time stamp…

The Present

        It’s been a long time coming, but the Enlightenment of Emacs has begun in earnest, thanks to the power of the internet and proper tools. GitHub makes it incredibly easy for developers to collaborate on large projects, or for users to report bugs and have them fixed quickly. The Emacs Lisp Package Archive, and especially the inclusion of package.el in Emacs 24, have made installing and distributing extensions as easy as it should be. The MELPA repository combines the power of the two by supporting packages stored on GitHub, without requiring the author to upload their package to a special repository or give ownership their code to someone else. Unlike, say, downloading revive.el, trying a new package doesn’t mean downloading some files off of a Japanese server. While bad documentation mostly plagues code actually hosted on EmacsWiki, GitHub encourages everyone to have a bare minimum of non-technical documentation (do this to start using it, here are some things you might want to tweak). Collaboration on a single perfect solution is easier than ever before, and life is pretty good for both developers and users.

        Here’s a somewhat abstract problem, solved with flying colours by collaboration: when programming, you often want to select some chunk of code and do something with it. Usually, this is a “semantic” chunk - in prose, imagine selecting a word vs a sentence vs a paragraph. You can see a video of this in action here, and see for yourself how awesome this actually is. I can’t track them down any more, but I saw at least one “80%” solution to the same problem by Xah Lee, and another somewhere else. This is the Dark Age of Emacs at work - nobody knew what anyone else had developed.

        Magnar Sveen’s expand-region.el is, as far as I can tell, a nearly perfect implementation of selecting semantic units. Better yet, it’s not limited by his imagination. If you scroll down, you’ll see that there are at least eight other contributors to expand-region. If you scroll up, you’ll see there are many specialized X-mode-expansions.el files. If your language of choice isn’t supported, contribute! And now there’s a definitive solution to this problem.

The Future?

        I don’t know, first-hand, how things stand for Lisps other than Emacs Lisp. Or whether this is going to be true for new dialects of Lisp going forward, thanks to new tools. From reading people’s reactions to the essay on HackerNews (in two different threads!) and Reddit, it seems like the problem is real… depending on who you ask. The fact that it’s so easy to solve problems, everyone does it their own way had at least one piece of anecdotal evidence in its favour. Lots of people disagreed, obviously.

        Points in favour of thinking this may not be true going forward: a lot of people threw in a vote for Clojure, a newer Lisp dialect that runs on the JVM (which has definite overlap with the Emacs community). I’ve seen some pretty cool tools (lieningen, Light Table - no surprise that the two work together) and libraries (Noir for web development, Overtone for making music) for Clojure, and they’re all hosted on GitHub. Perhaps programmers finally have the social tools we need to avoid not invented here syndrome and the other composite parts of the Lisp Curse!

Kickback: All The Right Reasons

Years ago, when I would listen to songs that made me think of anything related to relationships, I didn’t stop to put into words what the song made me feel. I’d get a vague approximation of some thoughts, and I’d be appropriately happy/miserable/both, and that was all I needed. Now that I’ve got more time between myself and the relationship in question, I don’t get the same feelings, and so I literally can’t remember what it was that I liked about these songs. Listening to them now, I know there was something about the song, but can’t quite grasp it.

        You can see the vague, unformed idea effect in some of the music posts I made back in 2010 - I’d post the song and the lyrics, but not say a whole lot about it. A prime example is this post about Kickback UK’s All The Wrong Reasons. I was listening to the song last night and thinking it meant something to me in 2010, but I couldn’t say what it was. At a guess, I’d say I felt like I was trying to help people so I could feel better about myself - the most cynical way of reading my behaviour at the time. There were a couple people I was “friends” with at the time mostly for that reason, and it took me a while to realize that wasn’t the way to go. But that’s only a guess - I can’t say for sure what I was thinking when I made that post.

        What I can tell you is what the song makes me think now, which you will (hopefully) be glad to hear is much more positive. I was up late writing an essay for my Linguistic Analysis class, and I took the lyrics in a very different way. (Chalk it up to vague interpretations, I guess, when the same song can mean a totally different thing two years later.) I was feeling good about the essay and wanted to reflect a bit on how I’ve changed lately, and where I’m heading in the future. Moral of the story, for the tl;dr crowd - I feel like I’ve gone from “all the wrong reasons” to “all the right reasons”, and I’ve got big plans. Read on if you’re interested! Best if you take a stop by the old post, first.

        "Head’s in the future, but your heart’s in the past" is an apt description of me circa 2010. Things were looking up, but definitely not all the way up. Which is a stupid metaphor if you try to picture it, but it works verbally. “And we’ve seen it all before, you’re holding out for more” follows from that, obviously. Neither of those things still apply to me, which is a good sign. Head and heart are both set on the future, I suppose. Getting to the future I want means working hard in the present, but it feels more and more and more natural as I put out work I’m legitimately proud of. Nobody’s ever going to look at the C++ assignment I’m working on right now, but that doesn’t mean I shouldn’t make it good and shoot for a mark of 110%.

        The next line is what gets me now, and probably what got to me in the past as well. “When that call never comes it’s time to face what you’ve become - there’s no point doing all of this unless you know you’re having fun.” At the time, there were a lot of things I wasn’t terribly happy with. I wasn’t having a whole lot of fun with the work I was doing back then. Although it got me here, so I can’t complain - but it was all delayed gratification at the time. At least now I get some of that gratification! A little, anyway. Still lots of delay right now. But I’ve recently realized what I should be working towards, although I’d been thinking about it for a few weeks. I said I didn’t have many important goals for 2012, but I take that back now! I’ve got two, which I strongly feel I can accomplish, and which all of my work now contributes to:

  • The first: have my name on a publication.
  • The second: learn as much as possible, with an eye towards distinguishing myself from the competition.

Both of these are practical goals that will, hopefully, put me in a great position when I finish my education and set out for a job. So - “what have I become”? Someone who strives to be the best they can be. (Time will tell where I’ll fall on the sweet/awesome dichotomy.) I’m not necessarily having fun, but I’m seeing the big picture now.

        From where I stand, that means a number of different things. Most recently, it means improving my writing consciously, the way I used to while I was in AP English. (If you’re interested in that writing analysis tool but not interested in Emacs, I can look into creating an independent version, with the author’s permission.) Going back a few weeks, I’ve started to really dedicate myself to programming well. I’m getting tons of inspiration on that topic as I dig up tidbits of information about Emacs, and inevitably get linked to some other brilliant piece. There’s Steve Yegge and Avdi Grimm over the past few days, who have both Emacs secrets I can steal and general programming knowledge. Meanwhile, Jeff Atwood and Scott Hanselman write about quality of life as a programmer - improving your tools, improving your office, improving your lighting, etc. Aside from that, I’m always trying to synthesize what I know about the seemingly-disparate areas of linguistics (at least, that’s what the separation in course content would lead you to believe). I want to say with some confidence that I’m a linguist - not some kid who “maybe heard about that in university, but didn’t think it was important”.

        In a similar vein, I’m connecting all the dots in this “cognitive science” thing. Philosophy is cognitive psychology, cognitive psychology is neuroscience, neuroscience is linguistics, linguistics is computer science… And the whole conglomerate is cognitive science. I may not use every part of it for the rest of my life, but understanding them all matters. Even if I were to be a career programmer, I’d keep usability testing in mind. Even if I were a linguist for the rest of my life, I know for a fact I’d land in a crossover field - computational linguistics and neurolinguistics seem equally likely right now.

        So what I’m getting at is: I know what I’m doing here, and I know who I am. I can’t tell you what I’ll settle on for a job, but I know what the core components of that job will be. This is where I belong. The lows may be low, but the highs are home.

net slum: Coding skill and the decline of stagnation4

notch:

I am a decent programmer. I know a decent amount of computer science theory, I can type correct code fairly easy. I don’t let my classes expand too much. But I still struggle some with math, and I have a tendency to have too many cross-dependencies in my code.

I used to think I was…

I’ve been learning more and more about what a compiler actually does lately, as well as looking at some very basic levels of assembly. So maybe I can shed a little bit of light on why things are the way they are. That doesn’t mean you have to like it! But at least it will make a bit more sense.

You write your source code, you give it to the compiler, and it makes sure you’ve given it code that will actually run. Then it creates highly-optimized code to be run by your specific processor, in assembly or machine code or whatever. The catch here is that processors don’t always work the same way, so the compiled code is limited to whatever platform it was originally compiled for. As a side note, I would think that’s why you pretty much only see source code available as a download for Linux programs (on the web, anyway) - you’d need to compile it for your specific distribution to make sure it works properly.

It doesn’t have to be like that, though - for example, Java (traditionally) achieves its multi-platform status by compiling its code for the Java Virtual Machine to run however needed on the platform it’s deployed to. Unfortunately, that means forgoing most of the optimization done by a regular compiler. Enter the Just-In-Time compiler, which takes the same Java bytecode as the JVM would. Instead of acting as a middleman, it compiles the bytecode into platform specific machine code (with, I assume, appropriate optimization) at runtime. Sadly, most of the time I see “JIT Compiler” listed as an option in an Android app, it tends to have a huge warning attached (“this will either be really fast or break everything, depending on your phone”). So I guess it’s a work-in-progress.

Anyway, so that’s why you have platforms and code that won’t run anywhere. And, while I’m no expert, I’d say that’s probably how web browsers manage to achieve some semblance of standard-ness. If I’m right, the browser would be kind of a middleman for your code the same way the JVM or a JIT compiler are for Java bytecode. Honestly, you’re the web developer - you tell me how browsers work!

3net slum·Source: notch