Entered on [2015-07-11 Sat 20:22]

Injection Cover I’ve been doing my work on being a better nerd, lately, and I’ve always wanted to know a bit more about comics. I’ve been reading Saga for a bit (though I’m behind now) and I’ve been trying to find my own stride a bit by looking through the single issues and picking things out. Injection looked like it had a decent balance of things, with some sort of programmer, some sort of wizard, and a smart/crazy professor lady making immediate appearances. I also liked the repeated demands for a sandwich. I think everyone can relate to that. I’ve read the first two, now, and I’m excited to see where the story goes.

It seems to involve the sort of magic that isn’t particularly explained, or isn’t magic. We’ve seen portals to other worlds, but they were locked up in a research institution. Strange flashes in stone circles, leave circling around the angry maybe-wizard. So far, I like that it’s been showing strange, exciting things without explaining much. In visual media, like movies and comics, I think that’s a strong sign that there might be good story telling going on.

I have become Programmer

Entered on [2015-07-11 Sat 19:54]

As I mentioned last time, I’ve taken a new job in a new field. I’ve left academia, which I’d like to write more about, because it was important and difficult. Now, I’m working as a Software Engineer for Octopart, where I’ve been working in Python and Javascript, mostly doing fronted work.

It’s been exciting doing something I’ve done for so long professionally. Octopart is a small team and it means I have a lot of freedom to work on things I think need work, but some of that is a bit disorienting, especially as someone working in the field for the first time. It’s hard to know what expectations are in any situation, but people are trusting me to do what needs to be done and I’m working the confidence to believe my decisions about that are correct.

I also haven’t really worked in Python before. It’s always nice to learn a new language – especially with such a defined project – so that’s been a plus. I am surprised again and again by how different languages handle importing files/packages/modules and how often it feels magic, weirdly difficult or some other sort of uncomfortable. Lisp has the strange duality of packages and ASDF systems, which aren’t the same thing but often effectively are. Python has it’s own difficulties, but in many ways is simpler. You pretty much just use paths with dots replacing slashes for folders. I’m not sure I’m a huge fan, but that’s probably more stylistic than anything else. Even though python has a command line REPL and more sophisticated tools like IPython, I miss SLIME when I’m working in it.

Really, I miss lisp, generally. One downside of working in programming is that I have little enthusiasm left over after work for looking after my own projects. Hopefully, I’ll get better at that in time. In any event, go check out Octopart if you’re into electronics and let us know how we can make it more useful. It’s made by a lot of nice people who care about what they’re doing.

Yet Another DeDRM afternoon

Entered on [2015-02-12 Thu 17:12]

Today, I agreed to my first programming job! More on that another time. To celebrate, I got myself a copy of “Effective Javascript” by David Herman.

I decided to give Kobo a try, having been repeatedly disappointed by Barnes and Noble, and not having a Kindle. I thought Kobo was supposed to be DRM-free. I’m not entirely sure how I thought they were doing that when everyone else is trying to lock you into a books-as-a-service ecosystem, but I did.

In any event, it came wrapped in gross Adobe Digital Editions DRM. So, I just spent the last hour stripping it off and then deleting my Kobo account. To save any of you the trouble I went through, here’s some links that were useful in a sea of not-useful stuff.

Clearing up some free space

Entered on [2015-01-13 Tue 13:28]

Every now and then, I get notifications on my laptop that the root partition is running out of space. That’s because I made a rather small root partition for Fedora to run on when I upgraded to a SSD 1 that was smaller than my older, spinning disk drive.

One of the fist places I look for wasted space is /var, because I know that yum/dnf keep caches there and systemd keeps the system log there, too.

Usually, there’s a rather large log sitting in there, for some reason. Today, there was about 950MB of log sitting there. I searched around a little and found that you can edit the configuration for the system log daemon at /etc/systemd/journalctl.conf. There’s a configuration option called SystemMaxUse that you can set to something small, like 16M or 100M, depending on how generous you’re feeling and how much you like logs, and it should max out at that much space.

Sources: A blog post and a stackexchange post.


1Solid State Drive

Keeping the Fun Alive

Entered on [2014-12-16 Tue 14:53]

Over the last few years, with college done and friends scattered out over the US. It’s been hard to keep in touch and, every time I do see people, we talk about how we’d like to keep in better touch.

I was reading Blaster Nation, today (all of it!) and it made me miss my friends. So I set up a mumble server and a Google Calendar, and we’re going to see if we can play games together, even just randomly, but also in some planned state.

In my mind, it could be something like twitch, or steam, or maybe really it should be like meetup for playing with friends.

Maybe that would be a fun project?

Cooking with websockets

Entered on [2014-12-05 Fri 12:57]

I finally got Chirp working with websockets! Well, it had worked before, but just sent down all the chirps that existed. Now it updates in real-time when someone else chirps. Though, it sends it to everyone, so don’t say anything you’d want kept secret!


Eventually, I’d want to send messages only to followers and have them show up in the nav bar as notifications, but this was mostly meant as a proof of concept, anyway. I’d much rather go write a new sql library for lisp, now, that try to finish everything. At some point, paging chirps so you can scroll to fetch more would be good.

This was sort of my minimum product for this project, but I might polish it more as I have time.

Playing with the MOP

Entered on [2014-12-01 Mon 15:30]

I was poking around at my project, Chirp, today and finally decided to deal with a strange bug I was having. When I sent JSON down to the AngularJS controller that renders the page, dates were always coming back as the time the request was made at. This was strange, since the database records of the chirps store when they were created, and the time should have been that. The one I was testing was over a week old.

Eventually, I realized that in the slot definition

(created-at :type clsql:wall-time
            :initform (clsql:get-time))

the time stamp would always be the current if the time wasn’t set on the instance when the database was read.

I’d recently started using clsql-helper to get instances of classes back from complicated SQL queries. By ‘complicated’ I mean ‘contains a basic join.’ Apparently, CLSQL doesn’t feel it needs to do that. I wish I knew why.

In any event, when I used clsql-helper, the dates were wrong, when I used clsql‘s built-in #'select, the dates were correct. So it slowly dawned on me that clsql-helper was doing something wrong. Sure enough, it wasn’t converting the string that the time stamp returned into the wall-time instance that clsql expected.

So I took the chance to play around with the MOP a bit and wrote code to convert the values to the right type, looking at their slot definitions in the class.

(defun get-slot-by-name (name class)
  (find name (closer-mop:class-direct-slots (find-class class))
      :key (lambda (slot)
             (intern (symbol-name (closer-mop:slot-definition-name slot))

(defun coerce-value-to-column-type (class column value)
  (let ((type (clsql-sys::specified-type (get-slot-by-name column class))))
    (coerce-value-to-db-type value type)))

With that code, you just do something like

(coerce-value-to-column-type class coulmn data)

and things come out the right way.

Literate Programming with Emacs

Entered on [2014-11-21 Fri 17:17]

Tried out literate programming a bit today using some info from Sacha Chua’s blog (mostly). It’s actually pretty difficult to figure out how to make it work and what was strangest for me was that I can’t figure out how to put a whole bunch of code blocks into the same file. It seems like you need to specify a :tangle filename for every block!

#+begin_src clojure :tangle "chapter1.clj"

What I was really hoping for was defining a new file at each section. John Zahng invited me to work on SICP in Clojure with him and I thought it was a particularly good case for trying out org-mode’s literate programming functionality. After an hour or two of trying, though, I don’t know how to make it do what I want. I can get it to dump all of the code into a file with the same name as my .org file, but that’s it. I’m not really sure how I’d want to use this to write a large project of any kind.

Getting Lisp to run on heroku

For a while, I’d been working on cloning twitter in Lisp, since I’d been playing with Lisp web frameworks (weblocks, hunchentoot, caveman, clack) for a while. Now that I know so much more about web development, it seemed like a perfect chance. Also, with hunchensocket around, I could do push notifications with websockets, too, which Rails can’t without third party services.

I have a site up now, at Chirp, after many hours of beating my head against the wall. I thought I’d write down some major points for others who try to sort the madness out.

  1. Your app will be compiled, don’t expect it to behave like you’re running it from the REPL.

    I had my configuration defined using envy’s (defconfig) in the top level of a file. That meant that all of the configurations were defined at compile time, when the environment variables I was using weren’t defined. So, I had a few nil’s in my configurations.

    Now, I wrap the (defconfig)‘s in a function call when the app starts up. Works like a charm.

  2. You don’t own the database, you just get to use it.

    CLSQL doesn’t have permission do do a number of things you might have been doing on your own database server. I had a helper function that made the database and tables if they didn’t exist. I got a lot of complaining about “template1,” which seems to be some internal postgres thing that administrators get access to. Don’t use (clsql:probe-database) or (clsql:create-database), they both try to do things they’re not allowed to.

  3. Getting environment variables is a necessary evil.

    Environment variables are not a first-class part of the lisp world, but they’re not too hard to get to. Heroku uses a lot of them to show you your configuration, pay special attention to PORT and DATABASE_URL.

    You can get at these two ways. ASDF has a private (getenv) function, which is handy and generally available. If you’re using SBCL, you can also (require 'sb-posix) and use (sb-posix:getenv). It has a sibling, (sb-posix:setenv), should you need it.

Hopefully, we’ll make a better, more user-friendly buildpack, soon.

Starting Over All Over Again

So, back in July I took the plunge and decided that I wasn’t cut out for the world of Academia. Grad school was taking an emotional toll that was turning into a physical toll and wasn’t paying the fulfillment dividends that it needed to. I’d spent years acquiring very specific skills in quantum computing research that people didn’t value at all. The pay was terrible. The social environment was terrible. The management was terrible. It was time to leave.

So I went ahead and enrolled in App Academy, which my friend Scott had done before. So, for the last two months, I’ve spent every waking hour programming (well, maybe a few reading and playing Dota). I know Ruby, Rails, Javascript, Backbone (learning Angular) and I already knew Common Lisp.

Most importantly, I feel like it’s a good life choice. I miss doing physics, but the universities have made it such a horrible environment to work in, it’s not worth it to me, anymore. I’m happy I get to keep problem-solving in programming and, if I’m lucky, I’ll find a job that uses my considerable skills in debugging and engineering.

The Job search starts today and I’m confident it will give me a fuller life than a career in Physics was offering.