Latest Blogs

Using Imagus with Pivotal Tracker

Imagus become the de facto standard for hover zoom after HoverZoom turned out to be a steaming pile of malware. I love it, but it wouldn't load in attached images from Pivotal Tracker, which was hella annoying. Here's how to fix.

  1. Open up your Imagus settings, and go to the Sieve tab:

    Imagus Sieve tab

  2. Click the + button to add a new rule:

    Add new rule

  3. Enter "pivotaltracker" for the name (to easily edit or remove in the future), and add the following RegEx into the link field:

    (www\.)?pivotaltracker\.com/file_attachments/\d+/download\?inline=true

    Enter information into the fields

  4. Hit Save

    Pressing save

Refer to this Stack Overflow answer for a brief explanation of the fields in Imagus. Basically, you can enter JS or a RegEx to filter elements/URLs, then optionally request another page or transform the URL. In our case, we just enter link, which looks for Pivotal Tracker's attachment URL.

Personal StatsD

Aside: I'm embarrassed by many of my posts on this blog. I'm going to start afresh soon.

I want to build an app for my phone which lets me record arbitrary events, then lets me see graphs about that data and the relationships between them. I've used Statwing a few times; maybe I should use that.

I'll drink till I can't, and hate myself the next day. I'll eat many illegal bananas, and feel like shit because I'm not doing work the next day. I'll avoid talking about my anxieties to my girlfriend, and eventually start a big fight. Then something will happen and I'll forget it all, doomed to repeat it again.

I want to write an app which provides a simple list of buttons which, upon clicking, record an action which has occurred. Drank a beer? Click. Drank a bottle of water? Click. Smoked a cigarette? Click. Played CS:GO? Click. Perhaps at some point, the clicks can be replaced by NFC tags.

I just want to record all these things, so later I can come back and see relationships between the events. I want a personal StatsD.

New Version of This Site

I've been playing around with an update (well, total rewrite) of this site for a few weeks now. If you give an eye to the site as it is now, it's not too hard to find it's pretty damn ugly. And the logo I slapped on from horriblelogos has a white background, contrasting from the weird off-blue I chose for some reason, and it bothers me to no end. I'm happy buying a $7 club sandwich from Zaxby's, but I didn't spend the $10 (or whatever) to get a transparent logo. I'm an idiot.

Anyway, I wanted desperately to try out all this fancy new Javascript-powered shit, so I started writing the new version with NodeJS. It's all written in CoffeeScript, and uses ExpressJS as a framework, with PassportJS for authentication. I also shoved in Jade for templates and Stylus for CSS. For database shit, I'm using Sequelize as an ORM.

What I've learned is it's all pretty goddamn straightforward, aside from Sequelize, which seems to brush against the limitations of JS. There's a lot of boilerplate needed for simply describing models, but because it's boilerplate, I'm sure someone will abstract it away at some point. I don't have quite the intimate relationship with JavaScript as I do with Python, so I don't know how ugly that solution may be, but regardless of that, I know if a consistent, intuitive interface can be provided, the ugliness isn't a terribly important factor. You don't need to know what goes on behind the pedals if it controls the car exactly how you'd expect.

I was inspired to write this new version when I stumbled upon hallojs, an HTML5 contentEditable library. I only knew vaguely of contentEditable when I discovered hallo, but the ability to offload the actual editing to the browser immediately got my dick hard, because it meant my main concern was serialization... so "you do whatever the fuck you want, and tell me about it later." I found an Angular plug-in someone had already built (updating it a bit for strict contextual escaping, and COFFEESCRIPT YEAH), and popped it in.

I was amazed at how quickly everything came together. Or maybe it was the realization my elitism was keeping me from Getting Shit Done. In either case, I built a slick interface in which the only other page besides "view all posts" and "view single post" is the login screen. Once authed, I've got a "New Post" link, which adds the same HTML to the page as an existing post, with just a boilerplate "Edit This Title" and "Edit This Post" text, both of which I can simply click and begin editing. It's literally WYSIWYG, because the browser handles all that shit.

The post body is a special case, because I don't save the actual HTML. Instead, I convert it to Markdown and save that to the database. While I'm actually editing the post, I provide a realtime display (YEAH, ANGULAR) of the Markdown source, which itself can be edited to change the HTML display, exactly like the Hallo demo.

That's the small and skinny of the web stack. Behind the scenes, I tried to learn more about Docker. I've got a Dockerfile which I use to build a container of the current folder state (it directly copies over my code at the current state, instead of doing a git pull, so it can be done during development/testing), and I use that to actually serve the site through an nginx proxy on the native box (well, that's a VM in itself... fuck me, technology is cool).

Man, I always told myself I'd never be that guy to just throw technologies at something because they were cool. But now I'm there, and it's because whenever I had something I wanted to do ("I need auth!", "I need CSS!", "I need JS that isn't fucking horrible!"), I Googled a solution and ran with it. But that's the future I suppose, where "lack of pride" completely obliterates "reinventing the wheel", and hacking isn't a lifestyle and commitment as it is an incredibly fun way to sacrifice your time to the All-Knowing[-of-Blog-Posts] to pay forward dozens or hundreds or thousands of man-hours saved with a Google search. If StackOverflow had a dick, I would be sucking all seven of them.

Non-technologically, I decided to can all my past blog posts. I've made some lame-ass posts, I've been dogshit crazy in many, self-deprecating and dogshit crazy in my latest, and anytime I thought "I really don't want this to be what others perceive of me," I said "you posted it... it is you. Sack up, bitch." I think a lot of different shit, and though I wanted to avoid the realization for as long as possible, who I consider myself varies immensely based on how I feel... and my control over how I feel is very shoddy. That's not the end of the world, because I can have control over it, but constantly forcing the opinions I had on myself at my lowest of lows is no way to build. So I'm starting from scratch. I could never bring myself to delete the old posts completely, as if they never existed, so I'll link to them publicly (though not prominently -- but enough for Google to index); I just want new, well-written posts about applicable (or at least interesting) things to take the stage, instead of my babbling and excuses over why I'm not writing those posts.

Compilers, NLP, and Learning

I've been writing a compiler and VM for a little programming language. I've been fascinated with compilers and optimization since high school, but though I understood there was a perfectly logical way to transform text into an executable, I never truly understood how. "Compilers" was a big blob of technical things I'd read before.

So, I decided to jump right in and try to implement a programming language. I knew I'd need a lexer, so I skimmed over the Wikipedia article for it and tried writing one. It turned out to be a cinch, as each step was obvious.

Knowing I'd need a parser, too, I read the Wiki article and jumped in again. Parsing was a bit harder, but it was because I didn't exactly know where the parser should stop. I should've realized if I don't know where to stop, it should stop when the steps taken are non-obvious. I could always do another pass. I have an issue with premature optimizaculation.

It took 2 days, but the parser got finished. I wanted to see stuff happen, so I wrote an interpreter. This was incredibly straightforward. It did expose shortcomings of the Symbols produced by the parser, which Python was gracious enough to let me fix afterward while changing no existing code.

After the interpreter, I wanted to write a virtual machine. I was vaguely aware I'd need to come up with a file format, but luckily I was more concerned with not knowing how to turn Symbols directly into binary bytecode. It led me to write a bytecode assembly generator first. I didn't know the technical term for what it is, so I wrote what it does, in true Java spirit. Anyway, foregoing the binary generation till another pass let me constrain the assembly generator to obvious logical steps.

Then the assembler, which compiled the text assembly into binary bytecode, as well as handled packing constants into a table at the beginning of the file and replacing references to them with table indices. Easy-peasy. Later, labels would be added to support if chains, but this was pretty simple to hack in as well.

The virtual machine was also pretty straightforward, its only bootstrapping responsibility being the constants table. Instructions were implemented as methods in a class. I patched in built-in functions by adding a CALL_BUILTIN <idx> instruction (needed built-ins to allow print functions).

I just added in if-elif-else chains, which involved editing the parser, assembly generator, and minorly the assembler and VM. But though I hit bumps, every time I thought "oh, duh." Big step up from pissing my pants.

The next thing I'm excited about is optimizing the virtual machine and/or compiler. I read the Wiki article on static single-assignment form, and it seems like an obvious step which makes other optimizations immediately obvious.

Anyway, I haven't been as interested in it lately, so I've been looking for new projects. I'm very interested in learning systems (I was the biggest neural network fanboy) and natural language processing, so I came up with an example project:

<yak> Python is a programming language
<yak> Programming languages are mostly text-based
<yak> Is Python text-based?
<bot> I'm pretty sure Python is text-based, because it is a programming language, and most programming languages are text-based.

I mean, I imagine it would start out much simpler as I begin with the natural language processing:

<yak> Python is a programming language
<bot> I understand Python is a programming language.
<yak> Is Python a programming language?
<bot> Yes, Python is a programming language.

The project would allow me to work with NLP and learning systems independently, while still benefiting a greater cause. Plus, at the end of the day I'll have something I can connect to Freenode and impress people with (or make a fool of myself).

I decided the project's name will be yaknowman, because it can be parsed in two ways, and I need to put my name in all my projects.

Poem: A Fantasy of Light

Oh, to drown the light
Each and every night;
Oh, to give up thought
And render real, nought;
Oh, to droop the lids
And do what Earth forbids;
Oh, to lie in wait
And once, control fate;
Oh, to live in dreams
And rule all that seems;
Oh, please leave me be
Wide awake to see.

1 2 3 4 5 Next »