News for hackers. Stuff that matters.
Re:I swapped my MacBook for an iPad+Linode by raganwald on Wednesday November 02, 2011 @10:14AM (#3186731)

  One fateful day, VMWare and OS/X conspired to trash my
  shared filesystem, losing several days of uncommitted
  code in the process.
Several days of uncommitted code? We need to have a heart to heart talk about your process.
Re:I swapped my MacBook for an iPad+Linode by moconnor on Wednesday November 02, 2011 @10:16AM (#3186748)
This is really true. Back then we were still using CVS, and I was writing a feature that I thought wasn't quite big enough to branch and remerge for, but turned out to be a bit more involved to get right than I'd thought.

Now we're on Mercurial and life is better.

Edit: A nice win with the Linode is that they back it up for me for $5 a month. Sure, there are solutions for the desktop too, but somehow I never got around to using one of those.

Re:I swapped my MacBook for an iPad+Linode by raganwald on Wednesday November 02, 2011 @10:22AM (#3186791)
There are two kinds of programmers: Those who’ve earned their experience the hard way, and insufferable know-it-alls who parrot whatever was in the last witty blog post they read.

There’s zero shame in being the first kind :-)

Re:I swapped my MacBook for an iPad+Linode by zachleat on Wednesday November 02, 2011 @03:09PM (#3188428)
What's the URL to the blog post where you read this? :)
Re:I swapped my MacBook for an iPad+Linode by raganwald on Wednesday November 02, 2011 @04:27PM (#3188783)
Re:I swapped my MacBook for an iPad+Linode by AbyCodes on Thursday November 03, 2011 @12:08PM (#3192381)
Recursion abuse!
Re:I swapped my MacBook for an iPad+Linode by pferdefleisch on Thursday November 03, 2011 @11:17AM (#3192147)
i think i'm in a wormhole!
Re:I swapped my MacBook for an iPad+Linode by marxidad on Wednesday November 02, 2011 @10:53AM (#3186996)
And one shame in being the other : P
Re:I swapped my MacBook for an iPad+Linode by jerf on Wednesday November 02, 2011 @10:26AM (#3186817)
I would observe that with DVCS, if your hard drive crashes you can still lose several days of unpushed code, too. I recommend and use cron jobs to push and/or rysnc things around on a more frequent basis for my really important stuff.
Re:I swapped my MacBook for an iPad+Linode by scottschulthess on Wednesday November 02, 2011 @11:38AM (#3187270)
This is why I keep my working copies in Dropbox
Re:I swapped my MacBook for an iPad+Linode by GoldenMonkey on Wednesday November 02, 2011 @12:50PM (#3187686)
second that... my working folders are dropbox... and commit to cloud git repository as needed.
Re:I swapped my MacBook for an iPad+Linode by kellishaver on Wednesday November 02, 2011 @11:25PM (#3190087)
Same here. I had some sort of electrical problem with my last computer and lost my hard drive due to it. Unfortunately, my back-up drive was also plugged in at the time and it got fried, as well (really bad luck/timing there).

One of the first thing I did when I got the new computer was to put a symlink to my projects directory in my Dropbox folder, so that all of my projects now get backed up to Dropbox automatically.

Re:I swapped my MacBook for an iPad+Linode by tl on Wednesday November 02, 2011 @12:25PM (#3187530)
We keep our main repository in under dev/$PROJECT and backup repositories under user/$USERNAME/$PROJECT. Then we set a post-commit hook to push to the backup server on commit. Setting up the backup and creating the hook is done by a shell script you run after cloning.
Re:I swapped my MacBook for an iPad+Linode by ori_b on Wednesday November 02, 2011 @11:04AM (#3187067)
Raid and rsync are your friends. Use them.
Re:I swapped my MacBook for an iPad+Linode by swah on Wednesday November 02, 2011 @12:42PM (#3187623)
I'm always doing

  git push origin develop
for this reason, but some environments probably don't allow you to do this easily? I work alone. (EDIT: be nice to people)
Re:I swapped my MacBook for an iPad+Linode by ConstantineXVI on Wednesday November 02, 2011 @08:24PM (#3189560)
We typically work in personal feature branches before merging into develop; if you use a similar workflow there shouldn't be much issue at all from pushing constantly.
Re:I swapped my MacBook for an iPad+Linode by swah on Wednesday November 02, 2011 @10:01PM (#3189848)
Can you protect from other folks pulling it? Sometimes people just don't want to reveal their code while is ugly...
Re:I swapped my MacBook for an iPad+Linode by ConstantineXVI on Wednesday November 02, 2011 @10:14PM (#3189878)
Gitolite[1] will let you mark branches as private on the remote either by specific branch name or a regex (ex: any branch that starts with "swah-" is private to you) if you want privacy before revealing your code.

[1] http://sitaramc.github.com/gitolite/

Re:I swapped my MacBook for an iPad+Linode by run4yourlives on Wednesday November 02, 2011 @10:58AM (#3187028)
Dropbox fixes this.
Re:I swapped my MacBook for an iPad+Linode by gujk on Wednesday November 02, 2011 @10:42AM (#3186928)
You could buy a second hard drive and put it behind your other drive and occasionally copy important files from your front drive up to your back drive.
Re:I swapped my MacBook for an iPad+Linode by vidarh on Wednesday November 02, 2011 @11:08AM (#3187092)
Works great until your computer/home/office catches fire.

Personally I have a mirrored drive set that I use as my primary storage, and a third disk that I rsync to nightly and use for backups of other stuff, because I don't trust that I won't have filesystem errors or controller problems that might render both disks in the mirror unusable. Then on top of that I use Crashplan to ensure I have an offsite copy.

For most of my code I also push to github or private external repositories regularly and/or pull to my laptop.

Maybe a bit paranoid, but I've had to recover from enough scary hardware and software failures over the years to not want to take risks.

Re:I swapped my MacBook for an iPad+Linode by BonoboBoner on Wednesday November 02, 2011 @10:53AM (#3186994)
Or use TimeMachine if you are on a Mac.
Re:I swapped my MacBook for an iPad+Linode by wizard_2 on Wednesday November 02, 2011 @01:46PM (#3187995)
No, if TimeMachine screws up a file it stays screwed up for ever after every backup, there's no integrity checking. It also completly barfs on large files that change little by little. The best example of that is the entourage mail store, but any single file db will do. I've seen clients bit bad by these problems. Don't get me started on the time capsule...
Re:I swapped my MacBook for an iPad+Linode by sepposade on Wednesday November 02, 2011 @06:18PM (#3189202)
Option-click on the Time Machine menu to verify backups. Sleep well.
Re:I swapped my MacBook for an iPad+Linode by chernevik on Wednesday November 02, 2011 @02:03PM (#3188097)
What should we use instead?
Re:I swapped my MacBook for an iPad+Linode by dman on Wednesday November 02, 2011 @03:50PM (#3188641)
Linus's solution is to write software that people run and use daily.
Re:I swapped my MacBook for an iPad+Linode by wtallis on Wednesday November 02, 2011 @05:23PM (#3188998)
Point your Time Machine backups at a NAS that's using ZFS with block-level deduplication.
Re:I swapped my MacBook for an iPad+Linode by xutopia on Wednesday November 02, 2011 @11:11AM (#3187105)
What's wrong with a remote branch you push to and then merge back into master afterwards?
Re:I swapped my MacBook for an iPad+Linode by jerf on Wednesday November 02, 2011 @11:25AM (#3187187)
Was my second sentence really that incomprehensible?
Re:I swapped my MacBook for an iPad+Linode by j45 on Wednesday November 02, 2011 @10:49AM (#3186973)
Thanks for sharing. Did you consider switching to a smaller laptop like a Macbook Air / Netbook?
Re:I swapped my MacBook for an iPad+Linode by moconnor on Wednesday November 02, 2011 @10:55AM (#3187003)
No, I wanted to try something radical and crazy and new. Frankly, I expected to be back on my MacBook by now. This has been as much a surprise to me as anyone!
Re:I swapped my MacBook for an iPad+Linode by j45 on Wednesday November 02, 2011 @11:22AM (#3187169)
I tried out an iPad app called Koder, it was nice but still lacked some things.

Your post has got me wondering about Vim again.. :) Making the switch to Sublime Text has got me appreciating a more shell-like interface for some things.

Have you ever found yourself wanting to code and not have an internet connection? I think that's a pretty rare scenario, I'm rarely offline.

Re:I swapped my MacBook for an iPad+Linode by moconnor on Wednesday November 02, 2011 @11:40AM (#3187280)
I haven't wanted to code offline for months. Maybe if I flew for more than two hours I'd miss it. Even the trains have wifi in Germany.

The few times I have wanted to code offline, I've also wanted to look something up >.<

Re:I swapped my MacBook for an iPad+Linode by j45 on Thursday November 03, 2011 @12:12PM (#3192395)
Haha, that's really true. I rarely code offline, maybe it's just another umbilical cord that we should be examining.

Between having tethering and generally ubiquitous tethering, we should be good.

I think I want to try getting into VIM again. Is there a good resource site you like, where I can find a decent guide and some pointers on where to find some language dictionaries? Totally off topic but I'd appreciate it.

Re:I swapped my MacBook for an iPad+Linode by danneu on Friday November 04, 2011 @02:14PM (#3197109)
I recommend just running "vimtutor" in terminal once you've installed Vim. It's the best introduction. Far better than the online tutorials that sometimes pop up on HN.

Once I got the basics down (15 minutes in vimtutor), I noticed enough productivity gains to use it immediately for note taking and scripting. Then I just decided to jump in and use it for a real project. I learn new hotkeys, plugins, and config tricks every week and I just feel my productivity inch its way up and up.

Re:I swapped my MacBook for an iPad+Linode by mdonahoe on Thursday November 03, 2011 @01:36AM (#3190467)
Vim on my 11" Air is excellent. SSD is nice and fast, and I wonder if the total weight is less than the ipad+bluetooth keyboard.
Re:I swapped my MacBook for an iPad+Linode by jarek on Thursday November 03, 2011 @10:51AM (#3192009)
Nope, Ipad: 601 g (613 g for 3G), 11" Macbook Air: 1080 g, I was unable to find the keyboard's weight but it can't be 400 g.
Re:I swapped my MacBook for an iPad+Linode by robgough on Thursday November 03, 2011 @12:54PM (#3192596)
According to Amazon the keyboard weight is 522g.

http://www.amazon.co.uk/Apple-MB167B-A-Wireless-Keyboard/dp/...

Making the Macbook Air 11" the lighter option.

Re:I swapped my MacBook for an iPad+Linode by jarek on Thursday November 03, 2011 @01:02PM (#3192628)
That is the boxed weight for shipping.

I have the wireless keyboard (the older three-AA revision) and it's comparatively lighter than my 7" Tab, which is 380 g.

edit: Charlie Stross says 325 g for a four-AA revision in http://www.antipope.org/charlie/blog-static/2010/05/ipad-wri.... Macworld says 323 g in http://www.macworld.com/article/150600/2010/04/ipadwhichkeyb...

Re:I swapped my MacBook for an iPad+Linode by epo on Friday November 04, 2011 @05:53AM (#3195494)
My Apple wireless keyboard (model A1314) has 2 AAs, have there really been that many revisions?
Re:I swapped my MacBook for an iPad+Linode by jarek on Friday November 04, 2011 @01:12PM (#3196846)
I don't personally recall the four-AA revision. Wikipedia links to Apple's press release http://www.apple.com/pr/library/2003/09/16Apple-Introduces-W... which confirms four AAs.

My keyboard, bought in November 2008, part number MB167LL/A, definitely takes three.

Current revision available on Apple's website is MC184LL/B and that one is well known to only require two.

Re:I swapped my MacBook for an iPad+Linode by scott_s on Wednesday November 02, 2011 @10:36AM (#3186883)
It's more difficult to setup, but it's wonderful to have a dedicated development cluster. Put everyone's home directory on a dedicated file server, which uses NSF to be global to the cluster. Then you can do automated backups on the file server - hourly, nightly, monthly, whatever. There are file server appliances which are configured for this sort of thing.

When you do this, much less important data is stored locally, on developer's actual machines.

Re:I swapped my MacBook for an iPad+Linode by dpapathanasiou on Wednesday November 02, 2011 @10:53AM (#3186990)
Insightful, and so close to a haiku as well...

Here's an attempt:

  Mac lost my data
  Many days of work gone
  Cloud to the rescue
Re:I swapped my MacBook for an iPad+Linode by Legion on Wednesday November 02, 2011 @11:30AM (#3187218)

  It's the poor craftsman
  Who points the blame at his tools
  Y U NO COMMIT?
Re:I swapped my MacBook for an iPad+Linode by ajross on Wednesday November 02, 2011 @02:14PM (#3188157)
winner
Re:I swapped my MacBook for an iPad+Linode by tjr on Wednesday November 02, 2011 @01:23PM (#3187879)

  There once was some data I lost:
  Days worth of work just got tossed!
  So I decided to write code
  On an iPad plus Linode
  Getting backups for minimal cost.
Re:I swapped my MacBook for an iPad+Linode by Tyrannosaurs on Wednesday November 02, 2011 @11:14AM (#3187129)
Mac lost my data

Many day of work gone

Learn to commit more

Re:I swapped my MacBook for an iPad+Linode by moconnor on Wednesday November 02, 2011 @11:24AM (#3187174)
Can I get this on a t-shirt?
Re:I swapped my MacBook for an iPad+Linode by gwern on Wednesday November 02, 2011 @02:20PM (#3188183)
If I may offer David Dixon's classic?

       Three things are certain:
       Death, taxes, and lost data.
       Guess which has occurred.
Re:I swapped my MacBook for an iPad+Linode by catshirt on Wednesday November 02, 2011 @01:40PM (#3187972)
yours is not quite a haiku either.

    you say its haiku
    but you missed a syllable
    in your second line
Re:I swapped my MacBook for an iPad+Linode by TeMPOraL on Wednesday November 02, 2011 @06:07PM (#3189161)
Meta-haiku?
Re:I swapped my MacBook for an iPad+Linode by moreorless on Wednesday November 02, 2011 @02:15PM (#3188160)
The cloud went down

Cannot get to my work

Twiddling thumbs feeling dumb

Re:I swapped my MacBook for an iPad+Linode by adyus on Wednesday November 02, 2011 @02:25PM (#3188215)
Variation:

The cloud went down

Cannot get to my work

Throwing birds at pigs

Re:I swapped my MacBook for an iPad+Linode by vertr on Wednesday November 02, 2011 @03:19PM (#3188470)
Welcome to the hacker news sub-reddit.
Re:I swapped my MacBook for an iPad+Linode by shasta on Wednesday November 02, 2011 @03:28PM (#3188531)
This.
Re:I swapped my MacBook for an iPad+Linode by shasta on Wednesday November 02, 2011 @10:41PM (#3189948)
It was a joke. I can't delete it now.
Re:I swapped my MacBook for an iPad+Linode by podperson on Wednesday November 02, 2011 @11:35AM (#3187257)
So this is why Even if you are u63r 733t Time Machine still rocks
Re:I swapped my MacBook for an iPad+Linode by sambeau on Wednesday November 02, 2011 @02:13PM (#3188151)

  crafting great software
  takes many small commitments
  like playing Jenga
Re:I swapped my MacBook for an iPad+Linode by jfoutz on Wednesday November 02, 2011 @10:49AM (#3186970)
So, this is something i worry about.

I'm using time machine for backups, so i don't think i'll lose much ... but i'm sorta hazy about how i should be using svn for all these little incremental steps. I'm uncomfortable with committing code that's going to break the whole system.

Should i be creating a branch for projects longer than an afternoon, and just committing that fairly often? I feel like eclipse's history is working okay but i have a vague paranoia i'm doing something dumb when i see comments like this.

Re:I swapped my MacBook for an iPad+Linode by jdludlow on Wednesday November 02, 2011 @11:34AM (#3187250)
The major workflow shift that involves the skies parting and mana floating down from heaven when you switch to a DVCS (git, hg) is the ease and lightweight nature of branching.

Having used git for four years, I now feel absolutely filthy if I'm not coding on a branch. If I start coding anything, I make a branch first, because the overhead is nearly zero, if I screw something up I can easily revert, and the downside of being scared to push code is too great.

Example: Yesterday I started a new feature. Step 1 was to branch from our develop branch. A bit into the coding I realized that this feature was going to take longer than expected. I committed what I had on my branch and pushed it to the remote repository (github in this case). This affects no one else, because the code is on a branch.

What really makes this possible is that merging is so easy. Branching and merging in svn was scary. I was never sure if something horrible was about to happen. With git (and hg) branching and merging is the expected behavior, and it's easy.

Always being on a branch also makes it easier to deal with interruptions. "Hey, there's an emergency, can you fix Foo?" No problem, commit what you have on your branch (or use `git stash` which is amazing) and jump back to the branch that has the code you need to fix. Need that fix in your branch as well? You can merge or simply `git cherry-pick` a single commit across branches. You no longer have to worry about the dreaded "Did I already merge this? What if I merge it again, what will happen?"

Re:I swapped my MacBook for an iPad+Linode by Splines on Wednesday November 02, 2011 @03:40PM (#3188591)
This. A thousand times this.

I use perforce for my daily work, and all too often I'll get to a stopping point and think to myself that my approach isn't working - usually I'll wrap my stuff up in a changelist and save the diff off to a file. Then I need to revert to latest and start my work from there.

It's not hard, but it's slightly painful, because if I wanted to try different approaches I end up having dpks lying around on my disk which have no easy relation to what they contain.

I've been tempted to install Hg and use it's branching mechanisms on top of perforce, but I'm not so sure my workplace would condone that (plus, Hg + perforce may not play well - I'm not sure).

Re:I swapped my MacBook for an iPad+Linode by excoder on Wednesday November 02, 2011 @07:45PM (#3189461)
Um ... you might want to try `p4 help shelve` first. Shelved changelists are basically the same as a "git stash" - but they're stored on the server, so other developers on your team can review a changelist before you actually submit it. One of my favorite Perforce features, actually.
Re:I swapped my MacBook for an iPad+Linode by stottc on Thursday November 03, 2011 @04:11AM (#3190784)
Changelists are a feature I really miss in other source control. It's nice to be able to keep orthogonal changes separate
Re:I swapped my MacBook for an iPad+Linode by vegashacker on Wednesday November 02, 2011 @11:25AM (#3187186)
With SVN, probably, but the branching just feels heavyweight so sometimes it's hard to motivate. Git with the "git flow" addon seems like it'd be a better fit for you. Being able to checkin in "to your feature", as opposed to waiting till it's done and ready, feels great.

It's also not just about avoiding data loss. If your feature starts going off-course or has a bug, you can look at previous revisions to get fixed up.

Re:I swapped my MacBook for an iPad+Linode by danssig on Wednesday November 02, 2011 @01:09PM (#3187802)
As others have pointed out: you're using a tool that makes you not want to commit very often. Change to a tool that doesn't have this problem, there are nice ones out there now.
Re:I swapped my MacBook for an iPad+Linode by Turing_Machine on Wednesday November 02, 2011 @02:00PM (#3188085)
"I'm using time machine for backups, so i don't think i'll lose much"

Time Machine is great, but as others have mentioned that may not help if the building catches on fire. It's good to also have your stuff backed up at a different location, preferably in a different time zone. :-)

Edit: Like others, I use DropBox for stuff that doesn't really warrant a full-blown source control system. It's very easy to just right-click, compress, then copy the zip to the DropBox folder.

Re:I swapped my MacBook for an iPad+Linode by nicklovescode on Wednesday November 02, 2011 @09:18PM (#3189722)
There once was a man with a Mac

One day his VMWare went wack

So he picked up his code, went to Linode

Which now handles all of his stack

Re:I swapped my MacBook for an iPad+Linode by tripzilch on Thursday November 03, 2011 @01:50PM (#3192867)
As I read the article I knew something like this would be the top comment on HN ... :-/

Apparently lots of people make this mistake.

Is it stupid? Maybe. Probably.

Do we need to have a lengthy discussion about it every time it is a minor part of a story or article? I'd rather not.

Re:I swapped my MacBook for an iPad+Linode by sliverstorm on Wednesday November 02, 2011 @12:50PM (#3187688)
How about if he is using Git? It is normal to work out of your local repository and only sync with the master occassionally, no? At least on projects that can tolerate such methods.
Re:I swapped my MacBook for an iPad+Linode by eropple on Wednesday November 02, 2011 @12:53PM (#3187708)
I push to a personal remote at least twice a day. Not doing so is asking for trouble.
Re:I swapped my MacBook for an iPad+Linode by sliverstorm on Wednesday November 02, 2011 @12:56PM (#3187724)
And I agree- I am a veritable slave to keeping my data syncronized- but I recall many people lifted up the local repo idea, and being able to sync twice a week, as the herald of the future.
Re:I swapped my MacBook for an iPad+Linode by eropple on Thursday November 03, 2011 @02:01AM (#3190518)
Well, you can pull from upstream twice a week. And you can keep a master on a computer in the next room.

(I'm also not terribly worried about my Air or my Hackintosh giving up the ghost, so...)

Re:I swapped my MacBook for an iPad+Linode by rhizome on Wednesday November 02, 2011 @02:32PM (#3188250)
I highly recommend upping this closer to twice an hour.
Re:I swapped my MacBook for an iPad+Linode by eropple on Thursday November 03, 2011 @01:59AM (#3190515)
I said "at least". ;) It's really more like "oh hey, I just committed and it works, might as well push while I'm here." Usually every 3-4 file changes or so.
Re:I swapped my MacBook for an iPad+Linode by danssig on Wednesday November 02, 2011 @01:06PM (#3187783)
Probably using SVN or CVS. Everyone I know used those systems that way but moving to a modern RCS usually gets people checking in a lot.
Re:I swapped my MacBook for an iPad+Linode by mst on Thursday November 03, 2011 @05:30PM (#3193778)
Even back on svn I tended to use svk (not in offline mode, just for workable merging) and branch for everything - keeping to a rule of "it compiles? commit it" and then only caring about everything working when you merge saves data loss and has the advantage of keeping your thought process, even when that process turned out to be wrong.

CVS? I think I've forgotten how I used that, thankfully.