In which I write about things I've learned recently, before I forget. That gives me at least a few hours to write...
Search
Adventures with Sous Vide
So I got a FoodSaver recently on a great sale. It's something I've wanted since I was just a little 10 year old captivated by the infomercials. I can't remember if it was my mom raising me to obsess over the potential savings (it'll pay for itself!!!), my inner nerd fascinated by the technology, or just the fact that I loved watching infomercials. An odd duck, that one.
Git 201: Slightly More Advanced
So you've made it through Git 102, and you wanted more. Git 102 was more of a justification for some of git's trickery, and a way for me to express my philosophies for using version control. Now that you're through with that, let's see if we can figure out some of git's less known features.
Git 001
Git is a wonderful version control system, but it does have a bit of a learning curve. The learning curve is made worse because git is so much more powerful than Subversion (for example). When you first try to learn git, it's confusing to sift through all of the powerful features people excitedly write about, just so you can find out how to do the simplest SVN use case. Annoying.
I want to write a post on those advanced features, but when I reflected back on my learning process, I realized that it wouldn't be fair to make the situation worse. With that in mind, here's my simplified guide to git- nothing but the absolute basics. It's not even git 101, it's git 001. If you don't need git 001, skip to git 102. There is no git 101- that's covered all too well online.
[Assumption: you have git set up for development on your team's repository. If you don't, there are a million tutorials online, but I'd honestly recommend just asking someone to do it for you. If my motivation lasts beyond Git 102, I'll add another post about setting up]
The first time you want to track the version history of a file in SVN, you add it with svn add. Do the same with git:
git add <file>
The same goes for removal. The analogue of svn delete:
git rm <file>
When you've added, deleted, and modified to your hearts content in SVN, you commit to the repository with svn commit -m "message" <repo>. Do the same in git:
git commit -am "message"; git push
Why is this different? Git is a distributed version control system. For your purposes, that means you can have the entire power of SVN on your local box. To pay for this power, in order to share with other people, you have to publish your commits. Let's look at that last line piece by piece:
git commit -am "message"
The only purpose of the extra "a" is to imitate SVN's commit command. In SVN, when you commit, it commits everything that you've modified, as long as you've once added that file before. It also commits the fact that you've deleted a file, as long as you've told it with svn delete <file>. the -a switch for git does the same thing. Later on, you'll realize the power of not supplying -a, but for now, just do exactly what you've done in SVN.
git push
This is the "share with other people command" that is implicit in an SVN commit. The git commit didn't do this because git wants to give you the choice of keeping track of your changes locally, without other people seeing. Again, you'll see the power of this later, but for now, just share right away, like SVN forces you to do.
If you want to get the stuff other people have done, you need the analogue of svn update:
git pull
That's it. You're done. Life is safe and cozy in the extremely limited SVN world. I'm excluding branches, because branches in SVN are unworthy. See Git 101 for that. But honestly, isn't that simple? The only real point of confusion is learning new terminology, which is no less intuitive than SVN (except that you're probably used to SVN, and thus will complain).
ASDF IT WENT WRONG AND IT'S HORRIBLE
Although it's getting better all the time, git's 'helpful' messages when things go wrong are a little intimidating. I suspect what went wrong is that you got a conflict when you tried to share your changes with the world. This happened because someone else pushed before you did. Since life in the repository has moved on from where you started your work, git warns you that you're not allowed to share anymore. This makes a whole lot of sense when you realize how git represents changes, but for now, let's just fix the issue:
git pull
Now you have the latest state of the repository. If the new changes didn't touch the same files you did, then git will handle everything for you, and you can do a git push again. As long as nobody else shared in those few seconds, you'll be fine.
If the other guy's changes did touch the same files you did, then you have a merge conflict. Git will try to tell you about this in a confusing way. Just do:
git mergetool
This will launch your merging tool of choice and you'll have to do the manual work. No piece of software can do this part, at least until Skynet comes along and we're all relieved of those worries.
When you're done, you need to commit your merge and share:
git commit -am "message"; git push
For your sake, I hope there are no more conflicts- it can be depressing if you have to do this a few times in a row!
This was obviously a very limited subset of git, and you really do need to know more than this. But hey, hopefully now it's not as scary, and you're ready for some more. There are a million excellent resources online. Try http://progit.org/book/ or anything by Scott Chacon. And if you can slog through them, the man pages really do help. If you read through enough of this material, you'll be fine. The real trick is getting a jumpstart on how git can make you more productive, and that's where git 102 comes in.
Git 102
If you want to read more about the internals (which I highly reccommend), check out Git from the Bottom Up.
'git rebase origin/master' does the following steps:
- Take all the changes in your current branch (master in local repo) and save them in a special place
- Reset your current branch to origin/master, which is the snapshot git took of the remote repository when you pulled (if this is news to you, you may like my git graphs)
- Apply the changes that were saved on top of your branch
That's why git will say something like "first, rewinding head to replay your work on top of it". The message sounds like it was carefully formed for maximum confusion, but that's actually exactly what it's doing.
After rebasing, you won't have a merge commit anymore, and your commits will appear on top of the commits you just pulled down. There are lots of good graphical representations of this floating around the internet, but as usual, Pro Git is a good place to start.
But why would you want to remove the merge commit? Well, this is where the argument gets interesting. You could argue against any merge commits whatsoever, but I'm just going to argue for the simplest case. When you commit stuff, then pull other people's changes in, git will create the merge commit we resolved just a moment ago- I'll call it a 'dumb merge'. Is this really a merge? Not in the traditional sense of the word. You certainly didn't have to do any manual merge work, and you weren't really merging branches (for example, a feature branch back into trunk). Since the 'dumb merge' is by far the most common case, if you look back at your repo history, you'll see lots and lots of dumb merges, and a few real merges hidden amongst them.
I think this is confusing and bad. It's so much harder to untangle the history when you're looking at all those dumb merges, and you'll start automatically disregarding them...which is bad, since you really want to pay attention to the real merges! Rebasing is a simple way to resolve this issue, and as long as you only do it to resolve dumb merges, you won't have any issues. To be honest, it's not any harder to resolve real merge conflicts, but it is a completely different set of terminology and methodology, so I don't usually encourage my colleagues to seek it out. There are so many ways to do everything in git, so you really have to pick your spots to avoid overwhelming people.
The other case for git rebasing is reorganizing and mashing up your commits before sharing them with others. The main benefit of having this power is that you can use your local git repository to its fullest extent. Every time you try something out, you can commit, revert, etc. You don't have to comment out tens of lines of code across multiple files anymore. By the time you share with your team, you'll have reworked the commits so they don't see 50 back-and-forth commits until you finally got the feature working. And of course, if you use git's branches, it's even easier to explore different approaches.
Once you have this power, you'll realize how completely useless other VCS are. If you don't feel comfortable using your VCS to manage all of your changes, you're not really using version control. If you only commit once at the end of every day, why don't you just go back to making backups of your files as your VCS?
The key tool for managing your mess of commits is the interactive mode of rebase. To perform surgery on the last 10 commits, simply run git rebase -i HEAD~10. Git will show you exactly what to do. The only thing you have to wrap your head around is the fact you can actually do all of this- reorder, reword, squash, and more! My personal favorite is squash- any commit that I squash will be included in the previous commit. That's how I get rid of all of those pesky intermediate commits that didn't turn out quite right.
The most common thing I used to do was create a new commit with some changes I forgot to put in (usually noticed when reviewing the diff), rebase and squash into the last commit. I had this workflow down pretty pat, thanks to vim. But it turns out that git can do this even simpler with the --amend flag: 'git commit -a --amend -C HEAD' will amend your previous commit with all of the newly edited files. It's an extension of the --amend feature, which I had only used for editing commit messages before. Nice.
Hopefully you learned some of the reasoning behind git's more advanced features, and how you can use them to increase the productivity of both you and your team. There's so much more to cover, but that's all for now.
Pursuing Pizza Perfection
After eating the best pizza of my life at Piccos in Boston, I realized the next focus of my obsessive food perfection would have to be pizza.
Pizza (at least, Neapolitan style) is actually quite tricky to do at home. The best pizzas in this genre are cooked in a 1000 degree brick oven--conditions unlikely to be replicated at home. If you're a complete badass, you can snap off the oven lock and use the self cleaning feature to get around 900 degrees, which is awesome, but risky. The doughs are also difficult to master, and the yeast strain has a huge impact on the final flavor, so we have a lot to overcome here. The following is a description of my first official attempt at home cooked pizza heaven.
There are many important factors for delicious pizza dough. One thing I noticed at Piccos was how intensly flavored just the plain crust was. There's no garlic butter here, this is the dough itself that tastes amazing. The first key is to have a good yeast strain. I would love to get my hands on a fancy sourdough starter to use in pizza doughs, but for now, I just used the regular yeast I picked up at BJs for pennies on the dollar. And when I say I, I mean Erica, because I was busy making insane amounts of lasagna and soup for work and she's better at doughs anyway.
The next important thing is to cold-ferment the dough. I first heard of this from Alton Brown, but it is apparently common wisdom among the pizza making elite. With this method, after you make the dough, you let it rise in the fridge for 2-4 days. Right before use, you let it rise at room temperature, but not before then. The cold environment of the fridge means that the yeast are practically in hibernation. They are still going to work eating sugars and producing carbon dioxide, but at a much slower rate than room temp.
The idea is that this long, slow production improves the taste and bubble structure of the dough. Wait, bubble structure?
The lifetime of the bubbles in the dough shoud be something like this. Yeast burps carbon dioxide slowly, making small, sturdy bubbles. 2 hours before cooking, the dough comes out of the fridge and the yeast start to wake up, inflating more and more bubbles. When the dough hits intense heat, the water in the dough turns into steam, inflating the bubbles and producing that light, airy, bubbly crust we all love. You want to be careful with all of these steps. As this mad scientist hypothesizes, if you let the dough overrise, the bubbles will go past their elasticity point and start to lose structure, thus collapsing and being lame. He gives the analogy of blowing bubble gum, which I think is wonderful.
This brings up the final point of dough construction that I'll talk about today: moisture. You need to have a very wet dough, much wetter than normal for bread or pizza. You really want that steam to inflate the bubbles. Besides, we're ideally cooking at high heat, and we don't want our pizza to burn before we get that nice inflation.
You could write about dough forever (and Mr. Varasano really does), but the most interesting thing for me is actually the cooking. This is how I tried to imitate a brick oven.
Following the advice of many internet chefs, I turned to the power of cast iron. Thanks to my new Christmas gift from Erica, I have a satisfyingly hefty cast iron pan. Cast iron has incredible thermal mass and conducts heat extremely well. Great for searing a steak, so why can't we use it for searing a pizza dough? By preheating the cast iron on the range beforehand, we can get searingly hot temperatures. This is going to be like a extreme pizza stone!
Unfortunately, the cast iron can only cook from the bottom, and we really want the top just as hot--if not hotter, if possible. The next hottest thing I can think of in my kitchen is the oven broiler. We want to get the top of the pizza as close as possible to the broiler, so we'll actually flip the cast iron pan upside down. This also gives the benefit of not ruining the inside of the pan and not having to deal with the sides to limit the shape and constrict the retrieval. Win win.
The proverbial topping on this high heat cake is to pre-heat the oven to 550 with a pizza stone in it. The pizza stone will go under the cast iron pan and hopefully reflect/contain the heat a little. Ideally, I'd like a stone that is significantly bigger than the cast iron, which would almost create a mini-oven in the top 1/4 of the bigger oven and really reflect the broiler heat back and forth. As it was, I only had one barely bigger, but I figured it would still help--and it would definitely give some thermal mass to maintain the hot oven temp when I opened it to put in the pizza.
I had my theory; it was time to test.
We planned out the pizza toppings for our 6 mini (not so mini, but shhh) pizzas and got going. We shaped and topped one at a time, which hopefully kept the bubbles as unmolested as possible and prevented the toppings from soaking the dough. You should definitely try to get the pizza in the oven as fast as possible after topping.
Right away, we realized the difficulty of transfering a sticky, wet, thin pizza dough onto the cast iron. With Laurel and Becca employing multiple spatulas, we managed to flop most of the dough onto the cast iron. I heard a satisfying sizzle and threw the pan under the broiler.
Oh, dear. Well, you learn more from failure than success, right? In my excited state, I totally forgot to flour the cast iron--but that wasn't the problem. Actually, after it's cooked, the pizza comes off pretty easily. Rather, the lack of flouring took away what could've been a critical indicator that the pan was too hot. As I learned later, the pan should probably be no hotter than is required for the flour to just begin to smoke when applied. If I had floured the pan at that point, it would've instantly infernoed*. Oh well, lesson learned.
*I know this because it happened. I tested the pan, decided it needed more preheating, and put it back on the stove. A few minutes went by, and before I knew it, the pan was pouring smoke. The fire alarm may have gone off for a while, until we opened all the windows...oops!
Ah, that's a bit better! I was conservative with the pan heat this time, but at least it looked edible! But something's missing...
Forgot the basil! Much better if you put that on beforehand, but better late than never! Oh, and another lesson learned from this pizza--since I had already managed to get a bunch of crap on the bottom of the pan, it would've been a bad idea to put it back on the burner. So I flipped it over like a lid for the stove, which actually worked well. I don't think it heated up as fast, but it worked.
Oh yeah, that's nice! Got the environment a little hotter and the crust is lookin' better. Still not as much carmelization as I'd like, but we're getting there, for sure.
We had also decided to make one of the pizzas regular style, at the bottom of the 550 degree oven, for comparison. You can see how much flatter this crust is--even at 550 degrees! The pizza was still delicious, especially since the toppings were $22/lb prosciutto and cheese. Classy.
That's the masterpiece of the day. Ain't it purdy? By this last pizza, I sorta figured out how to activate the broiler during the few minutes of pizza cooking, which was critical. The problem with preheating the oven to 550 and whatnot is that the broiler, even on hi, turns off when the oven thermometer tells it to. Lame. I tried to vent the oven in between pizzas, sacrifcing some of the 550 degree heat. For the last couple of pizzas, I did get that red-hot broiler for most of the cooking process, which was great.Next time, I'm going to be more careful with this. I don't think the 550 of the rest of the oven matters too much, since the cast iron is burning from the bottom and the broiler is burning from the top. I could also try to get some ice in there to fool the thermometer, if I can find it. At first, I thought that might ruin the crispy crust, but then Erica pointed out that bakers spritz the oven walls to create steam, which apparently crisps up bread. So who knows, that could be huge! We'll find out soon...I can't wait to try this again!
Programming Quote
On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" In one case a member of the Upper, and in the other a member of the Lower House put this question. I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
My Bookmarks
Groupon: But What About the Future?
Groupon, the fast growing coupon site, has reportedly turned down an acquisition offer by Google in the multi-billion dollar range. Despite using and enjoying Groupon, when I first heard the size of the offer, I was stunned, so I did some research on the company. Although we don't know the exact numbers, all reports indicate that Groupon is on track for 500 million dollars in revenue in 2010, with some estimates claiming that in just the last quarter. Certainly, Groupon is one of the fastest growing companies out there, and with an actual business plan, they're distancing themselves from any talk of a Web 2.0 bubble.
The Three Ways Facebook Messages Will Print Money
The New Value
We are in a new age, and you're probably ignoring it. Whether you like it or not, the new social is here. I'd like to discuss some of the arguments against social media, and explain a few of the benefits that you might not realize.





















0 Comments