Jeffrey Yasskin’s blog

3/28/2007

Why move and copy are distinct, non-primitive revision control operations.

Filed under: General — Jeffrey Yasskin @ 3:47 pm

Perforce implements move in terms of p4 integrate (basically copy) + p4 delete. Darcs doesn’t implement copy at all. Both are wrong.

Implementing move in terms of copy mostly works, so it seems like the obvious choice, but it runs into problems when someone is editing a file that someone else is moving. Two different things go wrong depending on who commits their changes first.

Mover submits first
The editor syncs and discovers that the file has been deleted. Generally there is no indication of where the file moved, so the editor has to look through that file’s history for a likely copy operation to find out where to make their changes. Then they have to manually merge their edits into that new file since the RCS has no idea that the file was logically moved.
Editor submits first
This is even worse since the RCS may not even consider a delete on top of an edit a conflict. It’s very easy to lose the last couple of edits to the moved file. Even if the mover notices, it’s painful to manually merge those edits into their copy, and the RCS winds up thinking they made the changes.

Implementing copy in terms of move is impossible (just ask a quantum physicist), but who copies code anyway? We branch repositories, but that can be handled as its own operation (and clearly was in Perforce, given the name of the copy command). Maybe we don’t need copy at all. I mainly use copy for splitting a file in half. I want to retain the version control history from the original file in both halves, so I copy one to the other and then delete large chunks from both. The inverse of this, joining two files into one, isn’t supported by any RCS I know of. So instead of implementing copy as a primitive, I think that split and join deserve to be primitives. As a bonus, you can implement both copy and move in terms of split.

What information do you need to do split right? When you split a source file A into target files B and C (split(A=>B,C)) (where B or C may ==A), each line from A may go to B, C, or both. Then most of the time, you’ll make some edits to both new files. We need an algorithm to guess the split and edits from the contents of A, B, and C, but I haven’t written it. I’m not sure whether “neither” should be a possible destination for a line from A: clearly you do sometimes delete a line in a split, but the goal here is to make it easy to merge edits of those deleted lines, and to do that, it probably helps to have them assigned to one or both of the new files. Merging an edit with a split looks easy: apply an edit line-wise to the file(s) now containing that line. An edit that crosses a “boundary”—somewhere the split changes targets—should probably be considered a conflict.

A move is implemented as a split with all lines going to one target, with the empty target/source deleted. A copy is implemented as a split with all lines going to both targets. A nice side-effect of this definition is that an edit is merged with a copy by applying it to both copies, not just the original as perforce does.

I use join(A,B=>C) much less often than split, but I think it’s necessary in order to roll back splits. It needs to assign a destination in C to every line in A and B. Edits to A and B are then applied to the appropriate location in C. Again, the trick will be in the algorithm to derive a join from three files.

3/24/2007

Requirements for a cell phone

Filed under: General — Jeffrey Yasskin @ 9:45 pm

I need to get a new cell phone, so I’m putting together a list of requirements so I don’t forget half when I go to buy one.

Essential:

  • Text messaging
  • Internet
  • Easy-to-access vibrate mode
  • Ability to edit numbers, names, tags, etc.
  • Dictionary-based input mode so I only need to hit each key once.
    • Should add names in my phonebook to this dictionary, especially when I’m looking for a number.
    • Should be the default input mode on all screens but allow me to switch out of it.
  • Alarm clock
  • Voice mail

Wanted:

  • Let me program it.
  • Transfer data to/from computer or my next phone
  • Configurable defaults for all settings
  • Guarantees on service quality

Eh:

  • Camera
  • Lots of ringtones

10/8/2006

Issues or Values

Filed under: General — Jeffrey Yasskin @ 10:12 pm

I canvassed yesterday against Proposition 85, which would require parental notification before abortions and then went with that group to watch the debate between Schwarzenegger and Angelides.

The people I talked to were overwhelmingly opposed to 85, as you would expect in SF, but the voter lists we had were pruned to just women Democrats and a few “other”s, so I suspect we got a biased picture. The whole process was geared toward turning out the base, rather than opening any sort of dialog or changing minds. Now, maybe abortion is too polarized an issue to try to change minds on, but parental notification seems like enough of a wedge issue that we should be seeking out those on the fence.

The governor’s debate was extremely interesting politically. I disagree with most of the issues the Governator has pushed, with the significant exception of the recent CO2 emissions law. And yet I disagree more with Angelides’ apparent philosophy toward politics. Several times, Schwarzenegger mentioned the idea of giving back to society. And when asked, “What’s the one thing you regret doing in office?”, Angelides weaseled out by complaining about deficit spending, which I would be surprised if he had any authority over. Schwarzenegger’s answer wasn’t perfect — he admitted a mistake in strategy rather than a mistake on an issue — but he said he’d learned that he needs to work to bring people together instead of trying to go over their heads.

So, we need to escape from partisan politics and convince people again of the importance of giving back to their communities. But we also need to fix the important particulars. In this election, it seems that I have to choose between the two and, right now, I’m leaning toward the larger goals over the particulars.

8/5/2006

Science

Filed under: General — Jeffrey Yasskin @ 11:10 pm

In the sciences (though not in fields like medicine, technology, and law, of which the principal raison d’être is an external social need), the formation of specialized journals, the foundation of specialists’ societies, and the claim for a special place in the curriculum have usually been associated with a group’s first reception of a single paradigm. At least this was the case between the time, a century and a half ago, when the institutional pattern of scientific specialization first developed and the very recent time when the paraphernalia of specialization acquired a prestige of their own.

Thomas Kuhn, The Structure of Scientific Revolutions, page 19

Part of this book’s claim is that it’s not falsifiability that makes something science. While so far Kuhn hasn’t mentioned them, creationists are actually right when they say that evolution is not falsifiable, because “normal” scientific work is the process of tweaking the theory to make it fit the world, not testing a theory with an eye to throwing it out if it doesn’t fit. If a theory doesn’t fit the world, scientists still won’t give it up until another theory comes along to replace it. And yet creationism can’t claim to be the successor to evolution because it doesn’t provide a foundation for future scientific work. To be scientific, a theory has to propose useful experiments or studies that can elaborate the theory, and I’ve never seen any kind of creationism do that.

11/7/2005

San Francisco

Filed under: General — Jeffrey Yasskin @ 2:21 am

I just got back from my second visit to San Francisco in two weeks. It’s an hour’s ride each way on the CalTrain, $10 total. That’s about the same cost as driving, but I can read on the train.

The first trip, last Saturday (20051029), I took my bike. I went to the farmers’ market at Market and Embarcadero and ate lunch there (French-style yogurt and an organic hamburger (thank you, cow)). Then I headed into the city and up Nob Hill. I don’t know why I thought that was a good idea. “I have a mountain bike with lots of very low gears. The hill can’t be that tall.” Right. So several panting stops later I made it to the top and found Grace Cathedral. Amy, go there when you visit. They have two labyrinths. Then I headed north back down the hill. Took a detour to see Lombard street, the curviest street in the world. This time I left my bike at the bottom of the hill and just walked up. Then all the way down to the Fisherman’s Wharf area. Stopped in at Patagonia, seller of high-priced but ecological clothing. They’ll even take one of their fabrics back to be recycled when it’s worn out. Didn’t buy anything, but I might when I need a new jacket. Then locked up my bike to walk around. I walked over toward Ghirardelli Square. Just before I got there, I found two neat little art galleries on Beach St. One had some of Dr. Seuss’s paintings. Ghirardelli square was nice; sat for a while and listened to the live band. I couldn’t decide what to buy there, so didn’t buy any chocolate. I walked around a little more, and then had dinner at a little (overpriced) pub called Fiddler’s Green because, well, you have to go eat at characters from Sandman. Then biked back to the train and went home.

Today I left my bike at home, planning to just walk around South of Market. I was surprised by how much the class of neighborhoods can change in just a few blocks. Market street around 4th and 5th is extremely high-class, but Mission street, just the next major street south, is much more run down by 6th and 7th streets. I walked from the train stop to Market & 5th, and then looped back to Yerba Buena park and the Martin Luther King memorial there. It was amazing how different the park felt from the rest of the city. They have what seems to be a mall on one side, but they’ve managed to prevent that mall from having anything commercial really visible from the park. So effectively the mall just acts as a wall keeping the city out. So you walk in, and it gets really peaceful and green, except for the occasional siren going by. And they picked quotations from MLK that aren’t primarily about civil rights, but about peace and community and stuff. Anyway, after that I walked down Mission street to 12th, and then over to McRoskey, who sells beds, since I still need one of those. $3,500 for a queen: ouch. But they’re made by hand, and in San Francisco, which is nice because it provides better jobs than mattresses made in a big factory far away. They’re not made from organic materials though, so I’ll go look at the stores in Berkeley (link so I can remember which stores) before deciding. Then I walked back up Market street and then to the Apple store and Cody’s bookstore. Cody’s doesn’t compare to Powell’s in Portland, but it has a nice selection, and I bought Freakonomics and The Ecology of Commerce. (So Sunshine will be getting her copy back shortly. Thanks for making me read that!) They also had two authors speaking tonight, so I stayed for that, which was worthwhile. Then it was 7:00, so I had time to walk around Union Square, which is nice enough, but surrounded by really expensive, not-worth-it stores like Saks Fifth Avenue and Neiman Marcus. There was an accordion player. Then back to the train. Along the way, I stopped at the Whole Foods, which is bigger than the tiny one in Palo Alto, but not so huge as the one in Austin. Noticed that they have reasonable queen sheet sets made of organic cotton, and picked up “natural” shampoo and deodorant. We’ll see if they work. Then home, and posting, and bed. Good night!

10/13/2005

I’m in Austin

Filed under: General — Jeffrey Yasskin @ 5:14 pm

I’m visiting Austin on a recruiting trip with Google, and I want to see the people I know. I was thinking we could go to Mirrormask at Dobie at 7:10 on Saturday and then go to dinner and coffee and hang out afterwards. Everyone is invited. I’m thinking Polvos for dinner, but that’s open for negotiation. Comment here if you have a better idea.

6/25/2005

Wasting Energy

Filed under: General — Jeffrey Yasskin @ 12:08 am

Say you’re driving your car at 70 mph on the highway, and you need to stop. As a rough calculation, you’re going 110 km/hr or 30 m/s. Your car weighs on the order of 1000 kilograms, so the energy your brakes absorb is 1/2mv2 = 1/2*1000*30*30 = 450 kilojoules. Unless you have regenerative breaks (i.e. are driving a hybrid), this energy is wasted. A desktop computer uses on the order of 300 watts. So the amount of energy your car wastes every single time you stop from 70mph is enough to run your computer for 25 minutes. I’m sure you can find other good comparisons.

Since we drive on city streets more, it might be more fair to consider a stop from 30mph. That’s 13m/s and 85kJ, with which you could run a computer for about 5 minutes, for every time you stop at a traffic light.

9/29/2004

My response to Microsoft

Filed under: General — Jeffrey Yasskin @ 4:49 pm

Recently, Microsoft asked me if I would be interested in considering [them] for Full Time opportunities. This is the reply I sent back:

I probably ought to say that I am interested in Microsoft for a full time job and that I’d love to fly up to Seattle on your expense account and then string you along for weeks, using your offer to bargain with other potential employers. But I’m not that dishonest. Instead, I’ll simply admit that, while Microsoft may be a very nice place to work, it’s simply on the wrong side of too many issues I care about (patents, open source, competition), and until Microsoft becomes a better participant in the software ecosystem, I can’t work there.

I’m putting this text in the Public Domain. That means you can copy it, modify it, or do anything else you like with it.

I realize that not everyone feels as strongly as I do about Microsoft. But if you do, when Microsoft comes asking to hire you, I’d appreciate it if you also sent them a response in this spirit. Maybe if enough of us do it, they’ll finally change their ways.

7/16/2004

Licenses

Filed under: General — Jeffrey Yasskin @ 11:52 pm

I haven’t really been thinking about OSS licenses any more lately, but my thoughts seem to have gelled recently.

I think wasted energy is wrong, probably in a moral sense. If anyone puts an effort toward doing something that could have been accomplished more easily, something is wrong with the world. (Caveats: I don’t mean to imply that things like raking sand gardens are wrong: their purpose is not to make pretty patterns in sand. Also, wasted effort isn’t a huge evil; certainly smaller than avoidable pain or death.) Now, if I want to accomplish something with software (and I frequently do), and someone else has already done the same thing, I’m wasting energy if I write it again. Similarly, if I write a library, and someone wants to do the same thing, I am morally wronging them if I deny them the use of it.

(more…)

4/30/2004

Credit card offers

Filed under: General — Jeffrey Yasskin @ 5:15 pm

What are you supposed to do with all those credit card offers you receive in the mail? Tear them in half and throw them away, you say? No! Why should you go to the trouble (and use the trash can space) to throw away this paper that you didn’t want in the first place? Let the credit card company throw it away instead:

  1. Tear off the actual application that they want you to send back, tear it in half, and throw it away yourself, just to make sure that they don’t accidentally sign you up.
  2. Pack all the extra stuff that they sent with it into the No postage necessary if mailed in the US envelope, lick it, and put it in your mailbox.

You pay nothing; they pay the postage, plus some fee for privilege of throwing away the trash they sent you. If you’re feeling particularly nasty, you can also include any other junk mail you have lying around to make the envelope heavier. If we all do this, perhaps they’ll figure out that we don’t want their offers.

Spread the meme!

Powered by WordPress