I’ve been looking at Clang and they define lexer tokens in a way that I thought was clever. The challenge is: how do you keep a single list of language tokens but use them as both an enum and a list of strings? Clang defines C token types in a file, TokenKinds.def, with all ofContinue reading “A Neat C Preprocessor Trick”
Category Archives: Programming
Git for Interns and New Employees
My interns are leaving today 😦 and I think the most important skill they learned this summer was how to use git. However, I had a hard time finding concise references to send them about my expectations, so I’m writing this up for next year. How to Create a Good Commit A commit is anContinue reading “Git for Interns and New Employees”
––thursday #3: a handy git prompt
Everyone says to use git branches early and often, but I inevitably lose track of what branch I’m on. My workflow generally goes something like: Check out a branch Lunch! Get back to my desk and make an emergency bug fix Commit emergency fix Suddenly realize I’m not on the branch I meant to beContinue reading “––thursday #3: a handy git prompt”
––thursday #2: diff ‘n patch
I’m trying something new: every Thursday I’ll do a short post on how to do something with the command line. I always seem to either create or apply patches in the wrong direction. It’s like stalagmites vs. stalactites, which I struggled with until I heard the nemonic: “Stalagmites might hang from the ceiling… but theyContinue reading “––thursday #2: diff ‘n patch”
––thursday #1: screen
I’m trying something new: every Thursday I’ll go over how to do something with the command line. Let me know what you think. If you are using a modern-ish browser, you probably use tabs to keep multiple things open at once: your email, your calendar, whatever you’re actually doing, etc. You can do the sameContinue reading “––thursday #1: screen”
git-oh-$#!â€
I’ve learned a lot about git, usually in a hurry after I mess up and have to fix it. Here are some basic techniques I’ve learned that may help a git beginner. Fixing your ungood code Let’s say you’re a clerk working for an Orwellian Ministry of Truth and you find out the new chocolateContinue reading “git-oh-$#!†”
And now, for something completely different
Probably only relevant to a limited portion of my audience, but Silicon Valley Ryan Gosling is awesome. I have never seen anything like and I’m not sure what the point is, but I know I’m a fan. Go forth and be sexy and supportive for the female programmers you know.
More PHP Internals: References
By request, a quick post on using PHP references in extensions. To start, here’s an example of references in PHP we’ll be translating into C: This will print: x is 1 called not_by_ref(1) x is 1 called by_ref(1) x is 3 If you want your C extension’s function to officially have a signature with ampersandsContinue reading “More PHP Internals: References”
Playing with Virtual Memory
When you run a process, it needs some memory to store things: its heap, its stack, and any libraries it’s using. Linux provides and cleans up memory for your process like an extremely conscientious butler. You can (and generally should) just let Linux do its thing, but it’s a good idea to understand the basicsContinue reading “Playing with Virtual Memory”
Setting Up Your Interview Toolbox
This post covers a couple “toolbox” topics that are easy to brush up on before the technical interview. I recently read a post that drove me nuts, written by someone looking for a job. They said: I can’t seem to crack the on-site coding interviews… [Interviews are geared towards] those who can suavely implement aContinue reading “Setting Up Your Interview Toolbox”