Dissembling Disassembly Experience

2010/05/14

Sitting in the sunshine at my favorite hippie coffee shop yesterday, I was trying to reverse-engineer a C switch statement out of assembly and was stuck on “leal 0xffffffce(%eax), %edx”. A couple guys were nerding out near me, so during a lull in their conversation, I leaned over and said, “Hello! How much do you love assembly?” They gallantly looked over my binder of printed textbook pages, and asked, “What framework is this? I worked in Mac. Is this x86?”

And I had to admit that for me, assembly lives in that sheaf of papers. I have never compiled a program and dived into its disassembled state. (I experimented once, early on, but didn’t inhale.) My dev buddies cringed when I told them later that night about the coffee shop incident; one even said, reassuringly: “How embarrassing.”

Still, I am kind of loving being the beginner who makes groan-inducing, pity-pat-garnering goofs. (Well, I have a choice: either embrace it, or die of shame.) Liberated from my Whiz Kid aspirations, I see the humor in these situations–and who can help but love the learning process when you get to laugh yourself through it?

So I’m laughing all the way to my console, where I’m looking, finally, at disassembled code. Jmp on it!


The Flash and the Slog

2010/05/07

Programmers (especially interviewers) seem to measure skills against a “flash of insight” standard: if you have four hikers, walking at different rates and arguing about which coin is counterfeit, does the lady get eaten by the tiger?

I mostly get stuck, though, in “slog out of it” sorts of issues: the latest version of Visual Studio has some grudge against an old library, or someone has overloaded ‘string’ so it behaves very oddly, or Mercurial has eaten my patches and no grepping can find them. This turns into an Internet Slog, where somehow all the unhelpful newbie forums have SEOed their way to the top of Google.

And such slogs can be particular to very small scopes. What prospective employer will care that I’ve incorporated old string manipulation libraries into a recursion exercise? At the end of the day, they’ll never know that I skipped number 4 on a self-assigned problem set. And will I really be hired in a Unix environment? Odds are, I’ll have to start all over to learn the ins and outs of some other code repository system; how much of this source control knowledge will map to that?

Other slogs, though, remind me of the Faun’s statement at the end of the Narnia world: “The further up and the further in you go, the bigger everything gets. The inside is larger than the outside.” Human knowledge is wonderful this way: I could start by reading up on updating old libraries and VS restrictions, then swim further into rationales behind language features and updates, and ultimately end up deep in Theory Land.

This would not be so bad if I could count on multiple Theory Lands a) having some solid bottom and b) having adjoining borders, so I could build a fantastic architecture of applied skills with perfect foundtations.

The problem is that I don’t believe there’s ever a bottom; a friend of mine was working with a company that cared about 0s being faster than 1s, and below that, there are people working with materials, and then sub-particles, and dear God but–where does it all end?

I have to depend, I think, on building blocks study enough for the task at hand. I do not need to understand the kernel for my current projects, so I can leave that aside for now. I do need to understand source control. I haven’t run up against design patterns yet (since my projects are so small); I should, however, have a rock-solid grasp of references in recursive functions. This means that sometimes my Faun Slog will take hours or days, but because I’ll limit the scope to “helping me complete the task at hand,” I won’t get thrown too far down the rabbit hole.

And I will keep adding projects that demand sturdier and deeper foundations–which, I suspect, will become the sorts of giants from whose shoulders I can touch insights so easily, it will look like a flash.


Hippies and Counterfeits

2010/05/01

I felt really pretty tonight! Which does not often happen, so I am especially grateful. And a little disappointed that we didn’t take any photos, but that is just vanity.

I also feel markedly less stupid. I’d bashed my brain against this puzzle for a long time and couldn’t get the answer:¬†You have 12 coins, one of which is counterfeit and weighs more or less than the others–you don’t know which. You have a balance, which you can use three times. Determine which coin is counterfeit, and whether it is heavier or lighter than the real ones. I sketched diagrams, played with different possibilities, came up with some rules of thumb, and just could not get it. I thought maybe this meant I was too dumb to ever get a programming job.

But tonight, I heard that three of the smartest people I know (all employed in software, one with an ungodly knack for logic puzzles) just took ninety minutes to solve the problem together. And after they finally got it, the consensus was, “If you are a programmer and take that long trying to solve a problem like that, you’re wasting your time.”

So maybe my job prospects are not hopeless.

This afternoon, I went to my favorite independent coffee shop and sat in a comfy leather chair reading¬†Effective C++, while the regulars wandered in and exclaimed over the new photos on the wall. A guy sat down across from me, opened a book and read a few pages, then took a cell phone call from his mom and blithely blathered for 20 minutes about his work schedule. I gave him the look of, “Seriously?”, and eventually got up to look for another chair. Finding none, I sat back down, and he finished his conversation. He paused for awhile, then came over and sat by me.

“Hi,” he said. “You look like you could use a little break, and I’d be happy to provide you with one.

“I don’t know what that means,” I said.

“You seem like you’re drowning in details, and ever since I sat down, I’ve had that feeling that I should come over and help you out. Do you know anything about East Asian philosophy?”

“Sure, some,” I said.

And he told me all about reiki and the energy in all things, and said that in a reiki session, an attuned practitioner can provide healing for others by laying hands on or near their bodies. “And I’ve just been wanting to offer one to you ever since I came in. Would you like a reiki session?”

“Um,” I said. “How long does it take?”

“Well, a quick session could be maybe ten minutes,” he said.

“Honestly,” I finally hedged, “I don’t think I’m in a place where I could appreciate that right now. But thank you for the offer, and the conversation.”

And in the end, the human contact in that conversation was just what I needed: I remembered how to smile and be friendly to people, and avoided the temptation to tell him to keep his hippie hands to himself. My whole face relaxed, and my frustration at his phone conversation completely dissipated.

People are just people, and it really is ok to just let go and be with them. I should remind myself of this more often, especially when my brain is crunched up and grumpy.

Happy weekend!


Starving Artist

2010/04/09

The trouble with passions connected to well-paying professions is that in your early days, there are no comrades in arms with whom you can drink liters of wine and fantasize about finally finding success. Young people who decide to be actors–or writers, or painters–dream desperately about their Big Break, the point after which jobs will fall into their laps and they can buy new shoes at full price and enjoy modest name recognition in their chosen field. In their day-to-day lives, though, their peers are pretty much in the same places they are: working ill-fitting jobs to pay the bills, shopping the store-brand oatmeal, wondering if it’s all worth the effort. They may or may not go on irresponsible benders. The necessity of emotional support is well understood.

Kids who go in for computer science, though, are pretty much snapped up as soon as they can demonstrate the basic skills. Sure, they secretly dream about being the next Dijkstra (who doesn’t?), but I imagine they suffer the indignities of non-rock-stardom from posh digs, with more health insurance than they know what to do with, and enjoy satisfying conversations with their brainy coworkers. Their day jobs may not be glamorous, but they avoid the identity crisis of constantly explaining their nonaligned “calling” and “job”: “I’m a writer, but I work as an accountant.” Plus, when programmers want a break from their interesting projects, they can take a month off to go study a new language in a different country. There are no emotional support groups for coders who crave their own eponymous algorithm.

For now, for lack of a more structured support group, I will redirect comfort from Anne Lamott’s guide for beginning writers, Bird by Bird (New York: Pantheon Books, 1994). Replace “writing” with “coding,” and it becomes eerily accurate:

So I tell [my students] what it will be like… when I sit down to work, with a few ideas and a lot of blank paper, with hideous conceit and low self-esteem in equal measure, fingers poised on the keyboard. I tell them they’ll want to be really good right off, and they may not be, but they might be good someday if they just keep the faith and keep practicing. And they may even go from wanting to have written something to wanting to be writing, wanting to be working on something, like they’d want to be playing the piano or tennis, because writing brings with it so much joy, so much challenge. It is work and play together… [T]heir heads will spin with ideas and invention. They’ll see the world through new eyes… At cocktail parties or in line at the post office, they will … sneak away to scribble these things down. They will have days of frantic boredom, of angry hopelessness, of wanting to quit forever, and there will be days when it feels like they have caught and are riding a wave.

And then I tell my students that the odds of their getting published and of it bringing them financial security, peace of mind, and even joy are probably not that great. Ruin, hysteria, bad skin, unsightly tics, ugly financial problems, maybe; but probably not peace of mind. I tell them that I think they ought to write anyway. But I try to make sure they understand that writing, and even getting good at it, and having books and stories and articles published, will not open the doors that most of them hope for. It will not make them well. It will not give them the feeling that the world has finally validated their parking tickets, that they have in fact finally arrived…

But I also tell them that sometimes when my writer friends are working, they feel better and more alive than they do at any other time. And sometimes when they are writing well, they feel that they are living up to something.

Back to it.


Source Control: Checking IN!

2010/03/17

Fixed my first bug in someone else’s code! Granted, it was a two-line fix of something that the dev could have fixed in about 4 seconds, but the process of going through the code base, finding the right section, stepping through the section (using my BRAIN, because I haven’t found a good debugger yet), and finally realizing where something needed to be checked and returned…

Well, let’s just say there was some victory dancing to The Black Keys ^.^

And now my tutor says I need to check it in–but that sounds scary! I have never checked something in before. What if it crashes everything? Will satellites fall out of the sky? Seriously, folks!

So far, so good: hg commit worked from my end. It’s a cloudy night, though, so I can’t tell if there’s a sudden “meteor shower”.

Rock on!


Get Back On The Penguin

2010/03/15

So, I am back in that place where I don’t know what to do. I have a good list going, though, of what is NOT helpful:

So, what might be helpful?

  • Open the source code
  • Find the bug list
  • Try to repro the bug
  • Make a new to-do list
  • Make some tea

OK, tea is pri 1.

>>>

Sweet! Now I’ve done everything on both lists, except make a new to-do list. So:

  • Try to find where “search” is written and called
  • Try to step through code… using my IDE that does not step through code. This may be the first time in my life I’ve used this expression, but: d’oh.

Finding the spot where “search” is called…

>>>

Um… O Gods. What?

>>>

No, seriously… what?!

>>>

Holy mother of God… I feel really, really dumb.

>>>

So! “The strcasecmp() function compares the two strings s1 and s2, ignoring the case of the characters,” says you. And you claim that “The variable optind is the index of the next element to be processed in argv.” And you go so far as imply–no, state quite baldly–that “[t]here are at least two arguments to main: argc and argv. The first of these is a count of the arguments supplied to the program and the second is an array of pointers to the strings which are those arguments.”

I had never actually seen argc and argv used! I thought they were just window dressing.

So! We are checking to see whether the string passed in equals some other string, even if we pass in many many things as arguments. We check one at a time.

>>>

Yes, but that doesn’t explain why all these people on the ‘tubes are running around saying:

if(!strcasecmp(doWhatVar, “Do This Thing”)

{

doThisThing();

}

That seems like… the opposite of what it should do.

Is 0 the same as not something? Oh god. How could I be so ignorant?

>>>

This is the part where I remind myself that I am still learning, don’t expect myself to know everything, etc., etc., etc. And maybe pour myself some beer. Because if I’m going to be ashamed and irrationally afraid that I’ll never get a job, I might as well do it with a tasty beverage.

>>>

Why are there slashes everywhere? Do I know this language at all?

>>>

Oh… slashes are line continuations inside a giant macro. Haven’t used macros before. That explains a lot!

>>>

Now there’s the part where I wonder if the answer is to soldier on and Get Back On The Penguin, as it were, or take a break and come back all fresh-faced and dewy. If it weren’t 11 o’clock at night, I’d go for a run. Maybe instead I’ll do some pushups. And ask my ever-patient roommate for help. And then maybe… maybe sleep.


Note to Self

2010/03/15

If you start an informal professional blog–one where you hope to express your trials and triumphs as you struggle with motivation, bang your head against intellectual challenges, and occasionally mire yourself in idiocy–think carefully before sharing the address with an immediate supervisor. It makes it impossibly awkward to start an entry with: “Well! We have a status update meeting tomorrow, and instead of working this weekend, I enjoyed sunshine and hung out with friends and read Terry Pratchett and took naps. Although, come to think of it, I DID do one programming project… but it was just for fun.”

No, but this is part of the tradition of openness I am trying to cultivate: a balance between “Goddess of Perfection” and “Dirty Secrets: Two for a Nickel!”. I tend to err on the impeccable side, but I’d learn more if I were more honest about my flaws. (Future Coworker: “The new girl has a near fatal weakness for Latin rhythms–maybe we should have an intervention!” Other Future Coworker: “Seriously, how can she code while dancing in her chair?”)

On the other hand, I’ve got one big strike against me already (<– liberal arts degree), so shouldn’t I be trying to balance that out with an airtight degree of awesomeness? (Future Coworker: “She may be a French major, but she sure never gets distracted by the internet!” Other Future Coworker: “I heard she won’t even read xkcd till she retires!”)

Bloody hell. Again, I think the answer is clearly to acknowledge my flaws, and be damned sure I am working to fix them. If the carrot of “satisfaction in a job well done” fails, the stick of “self-induced public shame” may just come in handy ~.^

So, what? Stop writing and start working? Ja.