Twitter
Essays
Random
Friday
Jan272012

Building FUSE with g++

FUSE is a file system in user space that lets you implement your own file system without having root privileges. However, the documentation is very sparse so trudging through it has been an exercise in Google Fu. All the given examples assume you're using the gcc compiler. If you try to build any of them with g++ / want to use C++, you should see this nice error:

command:
g++ -Wall `pkg-config fuse --cflags --libs` hello.c -o hello // in the fuse/example/hello.c

Error:
hello.c: At global scope:
hello.c:87: error: expected primary-expression before ‘.’ token
hello.c:88: error: expected primary-expression before ‘.’ token
hello.c:89: error: expected primary-expression before ‘.’ token
hello.c:90: error: expected primary-expression before ‘.’ token

Let's take a look at the offending code:

   1:  static struct fuse_operations hello_oper = {
   2:      .getattr    = hello_getattr,
   3:      .readdir    = hello_readdir,
   4:      .open       = hello_open,
   5:      .read       = hello_read,
   6:  };

But using the compile command with gcc works great! What's going on? If you Google a bit, people say use the --std=c99 for C99 standards. That doesn't work. Essentially, g++ doesn't support "C struct member initialization". So how do you get around this!? Well you have to manually inherit from fuse_operations and write a constructor as such:

   1:  static struct hello_operations : fuse_operations {
   2:      fms_operations() {
   3:          getattr = hello_getattr;
   4:          read    = hello_read;
   5:          ...
   6:      }
   7:  } hello_oper_init;

Then g++ should be happy and you're good to go!

Other FUSE errors:
fuse_main not found! Make sure you insert the "#define FUSE_USE_VERSION 26" BEFORE you include <fuse.h>.

Permission Denied!?
This one is really weird. The OS user who starts the FUSE program is the only one who can read/write to the files UNLESS you edit /etc/fuse.conf to have the one line:

user_allow_other

You can read about it at the Fuse wiki. It essentially lets other users read FUSE mounted folders. If you're still getting permission denied, make sure the permissions on /etc/fuse.conf are:

-rw-r--r-- 1 root fuse 215 2012-01-26 20:44 /etc/fuse.conf // owned by group fuse, chmod 644!

That should work.

Thursday
Jan262012

Interviewing Notes

I've just gone through the grueling process of finding another job. You know the standard procedure. Put in resume, get phone screened, suit up for a real interview, and finally pray for an offer from a company. It's really a terrible experience, like dating. There are a few things that irked me about the whole process, places where we can improve upon as an industry, and things that I swear I'm never going to do if I ever get to interview another human soul.

  1. Brain Teasers - Whoever invented these must have really liked pain. The same amount of pain as shooting yourself in the foot and using morphine once you get shot to shoot yourself again. It's such a terrible way to test anything, I'm not really even sure what you gain from watching someone solve a brain teaser. Instead, I sit there sweating, frantically hoping an answer blurbs out that is somewhat correct.
  2. Stack the Interview Team with People who LIKE People - Computer Science isn't exactly known for our... social prowess. However, there are still tons of socially normal and adjusted people working in these companies. Make sure everyone on the interview loop knows how to make people feel comfortable, knows how to read people, and talks in manner that people can understand. I had one interview where the interviewer spoke so fast, and he never took a breath that I couldn't even understand the problem he asked me to solve. When I asked clarifying questions, he breezed right past the answer. Within the first five minutes of the interview, we were talking about different problems.
  3. The use of algorithmic questions, e.g. write a binary search tree - I always assumed they tested for intelligence with these questions. Now that I'm a bit more mature, I see they simply test to see if someone did their homework before going into the interview loop. I still think they are useless, but maybe testing for preparedness is a good thing? On a side note, anyone getting a PhD, make sure you know dynamic programming cold. Every single big company asked me a dynamic programming question.
  4. If you have the luxury, make sure at least one interviewer on the loop has the same background as the candidate - I don't know why some companies, who had compiler engineers, interviewed me with people who knew nothing about compilers. When it got to the question of what did you do in your past, the interviewer had blank stares because they didn't really get what was going on. I don't blame them at all, few people in the world really know compilers. But I think this is probably a luxury few companies can afford.
  5. Have a philosophical / judgement test interview - I never thought I'd appreciate it as much as I do, but I went into a set of interviews asking to see the engineers code. I just wanted to spot check the quality of a random engineer to see if the engineering culture produced high quality code. The discussion somehow got into a very philosophical debate about what is good code, how do you judge code, how do you balance code quality versus ship time, how does that affect team dynamics, etc. The company was awesome enough to show me some code and we discussed their code for an extra 30 minutes, which gave me MUCH more insight into their engineers than any standard interview ever could. I feel like this should become a standard part of the interview process.
  6. Startups have real problems - The interview process at startups feel so much more real than the ones at big companies. Startups have problems they need to have solved yesterday. Big companies have the luxury to pull you through a dog and pony show. It feels like startups have to focus on real problems and hire accordingly, e.g. they have very little leeway in teaching new people. Big companies hire for brains, not the ability to solve problems, with the result being lots of smart people but not necessarily the most effective. Both approaches work, look at Google who institutionalized the hire for brains approach.
  7. Breadth vs Depth - Startups look for breadth, you will do everything under the sun, including talking to customers. A big corporation shields you from those parts (for good or bad depending on your point of view). I like to break my brain every few years, so jumping into a whole new area is exciting to me. Universities seemed to have figured this out as well with the Professor Sabbatical. Every 7 years, you're supposed to go somewhere else to learn something new to keep your brain sharp. At the moment, it makes me worry about people who stay at a company for 10+ years, but I've seen evidence to suggest it doesn't really matter (Good to Great, my own boss at Adobe and Michael Franz). I still don't have a solid opinion on this yet.
  8. People are our core asset / We give lip service to people are our core asset - There is definitely a way a company approaches interviews that gives credence to this. As you walk around the company, just look at what kind of hardware engineers are using. You can tell by the interviewer's demeanor. Are they just here? Or do they care enough to really try and find good candidates. It irks me when I see an interviewer half ass the interview itself. I can't imagine what everything else looks like.

Take everything here with less than a grain of salt - I haven't done enough interviewing to make a very solid opinion. Nor have I experimented enough to try different strategies and actually evaluate how the candidate turned out. It's also a numbers game. We as an industry just don't have enough time to really sift through thousands of resumes to find one person. I just wish there was a better approach to finding people. It's an important problem and probably something I'll be thinking about for the next 40 years.

Thursday
Jan192012

Here We Go

After an amazing four year run at Adobe and five year graduate school career at UC Irvine, it is time to say farewell. I have accepted an offer at a mid sized Content Delivery Network (CDN) called Edgecast Networks in Santa Monica, CA. Which of course means that I will no longer be a) working on Flash's JIT compiler and b) I probably won't even be working on compilers. I have really been blessed and am forever grateful to have had the experience of working with amazing people on a product people knew about and had opinions on.

The amount of genius surrounding a product like Flash is insane. The market pushed browser venders to boost their JavaScript engines and all the engines were open source. What an amazing experience it is to just look at Chrome's JavaScript JIT compiler, learn some cool stuff, and figure out how those techniques could be used in Flash. I could talk with the Mozilla guys about their JavaScript work. They even read this blog! (Hi Mozillians!) At UC Irvine and Adobe, I was able to work with people who have made significant contributions to the Java HotSpot compiler. Four years steeped in that kind of talent makes you grow and I really loved my time.

There are also very few products in the world as divisive as Flash. Some people loved it and clamored and complained that the iPhone didn't have Flash. Others rejoiced and reveled in watching Flash's downfall. Internally, the same spirited debate happened. In all of this, I was able to work on the product and actually align my PhD with the product goals. What a great lucky bubble. Alas, who knows what Flash's story is from this point on - but the past four years have been fantastic.

Now onto the future. I'm hoping to learn a ton about distributed systems and operating systems at a rising CDN. It's a whole new field and I feel like a n00b jumping into something I'm not sure how deep the hole is. It's refreshing and exciting. Off to a great start for 2012!

Sunday
Nov132011

Steve Jobs

In many ways, Steve Jobs - the book, like the character it's portraying is complicated, graceful, beautiful, agonizing, inspiring, and enlightening all in one. There are so many professional reviews out there so I'll be short. There are three major things that popped out at me.

First, Walter Isaacson is a phenomenal writer. His style is conversational and engaging enough that you forget you are reading a book. You're pulled into the story as he skillfully interjects real quotes wrapped in detailed context. I have not read such a beautifully crafted book since To Kill a Mockingbird. Steve Jobs represents what English is meant to be.

We all knew Steve Jobs is a pretty mean guy, so I wasn't really surprised about anything regarding his personality. Nor do I feel like he was wrong in being so mean. People naturally lean towards one side of the coin: be liked or be effective. Most people find a healthy mix. The only reason Apple climbed the top of the world is because Steve sacrificed the "be liked" portion of his personality. It worked, it's enlightening, but it clearly brings the issue to light: which one is more important to you? As Steve says: "Polite and velvety leaders, who take care to avoid bruising others, are generally not as effective at forcing change". I'm not advocating being mean, I'm advocating being aware of your choice.

However, the deepest question I kept asking to myself while reading the book was, is it worth it? While on his death bed, Steve kept working at the expense of family and friend time. Walter portrays Steve as a relatively happy guy, deeply proud of his work. But on a personal level, is it all worth it? The hours, the lives hurt by Steve's temper tantrums, the absolute dedication to work at the expense of personal relationships. Is building the iPad more important? Sociologists and happiness reports say that few people wish they spent more time at the office on their death bed. With Steve, it feels like he wished he had more time to work. Alas, one of life's hardest questions with another data point to think about.

I've learned so many things via Steve and I'm an Apple fanboi, yet regardless of how you feel about Steve Jobs and Apple, the biography is a great book that's worth a read. And like the Walter's graceful conclusion, I too shall defer to Steve with my favorite quote: “Simplicity is the ultimate sophistication.”

Thursday
Nov102011

The Setup

The Setup is a great website that interviews people asking them what they use. It asks all the really great questions like what hardware do they have and what software do they work with. Finally, the last question asks what is your dream setup? I'm going to be pretty egotistical / spoiled brat here and say I think I finally have (almost) the dream setup.

Hardware

I have a 13" 2.8 Ghz Macbook Pro with a 256 gig SSD. The iPhone 4 is fantastic with the occasional use of the original iPad. I have a Kindle 3 keyboard which I read on daily. I love the book arc because it just adds a touch of elegance to your desk. That along with a magic trackpad and apple wireless keyboard keep my desk pretty minimal. The last remaining part was the Thunderbolt Display, which just makes me giddy.

Software

I spend my life in vim in one form or another. I use vim in the terminal when I'm hacking bash or python scripts. I write blog posts and normal text with MacVim. If I'm writing Java, I'll use eclipse with the viplugin. For C and C++, since I'm in JIT compiled code all day, Visual Studio's debugger really is tremendously better than GDB. Visual Studio's debugger is just so much smarter because it knows the addresses of methods and shows you what method is going to be called right next to the x86 bits. In Visual Studio, both the ViEmu and Visual Assist X really seal the deal. I wish Codekana worked for Visual Studio 2010, but it's fantastic for Visual Studio 2008. I run Visual Studio through VMware Fusion running Windows 7.

I use Adium for chat, OS X mail for mail, iCal, and the twitter app from the app store. Omnigraffle is a really great drawing tool that makes scientific images pretty. I'd be terrified without Quicksilver which makes launching apps so much better. It just feels nicer and smarter than spotlight. I switch browsers every couple of months. Since Lion is out, I've switched to Safari simply because the two finger back swipe animation is delicious.

Dream Setup

I'm almost at the dream setup. So close I can taste it. A 15" Macbook Pro without a super drive, 16 gigs of ram, and a 512 gb SSD would be fantastic. Add the Herman Miller Sense Desk, an Aeron chair, and studio lighting and life would be grand.