Monday, November 12, 2018

Why I Don't Write About Space Anymore

No-one asked, but I know a few have wondered. It's been about 2.5 years since I wrote anything about space on this blog. Why? Simply, I don't see anything changing. SpaceX and Boeing have full funding for commercial crew, and nothing has changed. Reusable first stages have arrived, and nothing has changed. Blue Origin has crossed the Karman line, and nothing has changed. More and more people are launching cubesats, and nothing has changed. Google invested a billion dollars in SpaceX, and nothing has changed. Suborbital tourism still doesn't exist. Nothing has changed. I'm still interested. I'm still engaged. I just have nothing to say. My hope goes out to those working hard to change things. Good luck.

Wednesday, April 29, 2015

Disabling OS-X Device Removal Warnings In Yosemite

If you're anything like me you've probably seen the Disk Not Ejected Properly message so many times that you've forgotten how annoying it is.. despite the fact that you never even wrote anything to the usb drive that you're yanking out of your Mac the operating system insists that you remove it "correctly". You're supposed to click the eject button. Why? I dunno, Apple seems to think that if you can write to it then the operating system might have written to it - and being Apple, they probably have. Well ya know what? Fuck you, I won't do what you tell me.

Note: this will not fix your external drive disconnecting when your Mac goes to sleep. For that problem try disabling "put hard drive to sleep when possible" in both the Battery and Power Adapter tabs of the OS energy saver settings. What appears below is a dirty hack for deliberately removing a warning that Apple insists on showing you every single time you yank out a usb stick.

The short version. WARNING, this may break your Mac! Be careful! Download my hacked DiskArbitrationAgent. Open a terminal and enter the following commands:

cd /System/Library/Frameworks/DiskArbitration.framework/Versions/A/Support
sudo cp DiskArbitrationAgent DiskArbitrationAgent.original
password: [Enter your password]
sudo cp ~/Downloads/DiskArbitrationAgent .
killall DiskArbitrationAgent

The long version. What does this do? Read on.

In my quest to remove this annoying and pointless warning, I started with a Google search and turned up various answers of the form "don't do that" and guides on how to press the eject button. Gee, thanks! One more helpful answer suggested disabling the User Notification Center - which is akin to cutting off your nose to spite your face. Okay, so I get that Apple doesn't want me to turn off this warning, but I don't care what they think. I'm turning it off.

My next course of action was bargaining. I figured the engineers at Apple are pretty reasonable, they wouldn't throw this annoying warning in my face if I mounted the drive read-only, surely? Using sudo vifs I added a line to my /etc/fstab with an appropriate UUID. After inserting the usb drive I ran mount to ensure it was mounted read-only, it was. I then proceeded to yank out the drive without pressing Eject and still got the cursed warning! Apple engineers are not reasonable.

In fact, I actually tracked down the code that does the appropriate check. It's in DARequest.c in diskarbitrationd and it looks like this:

if ( DADiskGetState( disk, kDADiskStateZombie ) )
    DARequestSetState( request, kDARequestStateStagedApprove, TRUE );

    if ( DADiskGetDescription( disk, kDADiskDescriptionMediaWritableKey ) 
             == kCFBooleanTrue )
        DADialogShowDeviceRemoval( disk );

Hey idiots, MediaWritable means the media is writable, not that the drive is mounted read-write. You're displaying a warning for a potential problem that is impossible. Way to go!

So where does this warning come from? It's displayed as a result of that DADialogShowDeviceRemoval() call, but that's just a message sending wrapper. I found out. The offending code is in DADialog.m in DiskArbitrationAgent and it looks like this:

static NSString * __kDADialogLocalizedStringDeviceRemovalKey      = 
    @"Eject \"%@\" before disconnecting or turning it off.";
static NSString * __kDADialogLocalizedStringDeviceRemovalTitleKey = 
    @"Disk Not Ejected Properly";


void DADialogShowDeviceRemoval( DADiskRef disk )
    NSUserNotificationCenter * center;

    center = [ NSUserNotificationCenter _centerForIdentifier: 
                   @_kDAAgentName type: 
                   _NSUserNotificationCenterTypeSystem ];

    if ( center )
        NSUserNotification * notification;

        notification = [ [ NSUserNotification alloc ] init ];

        if ( notification )
            NSBundle * bundle;

            bundle = [ NSBundle bundleWithPath: 
                       __kDADialogLocalizedStringBundlePath ];

            if ( bundle )
                NSDictionary * description;

                description = ( __bridge_transfer id ) 
                    DADiskCopyDescription( disk );

                if ( description )
                    NSString * name;

                    name = [ description objectForKey: ( __bridge id ) 
                        kDADiskDescriptionVolumeNameKey ];

                    if ( name == NULL )
                        name = __DALocalizedStringInBundle( @"Untitled", 
                            bundle );

                    notification.hasActionButton = FALSE;
                    notification.informativeText = [ NSString 
                        stringWithFormat: __DALocalizedStringInBundle(
                        bundle ), name ];
                    notification.title = __DALocalizedStringInBundle(
                        bundle );
                    notification._imageURL       = [ NSURL 
                        /Contents/Resources/FinderIcon.icns" ];
                    notification._persistent     = FALSE;

                    [ center deliverNotification: notification ];

You can find the DiskArbitrationAgent in /System/Library/Frameworks/DiskArbitration.framework/Versions/A/Support and on my Mac it's 22992 bytes long. Using otool -tV we see the offending code:

0000000100000faf        pushq   %rbp
0000000100000fb0        movq    %rsp, %rbp
0000000100000fb3        pushq   %r15
0000000100000fb5        pushq   %r14
0000000100000fb7        pushq   %r13
0000000100000fb9        pushq   %r12
0000000100000fbb        pushq   %rbx
0000000100000fbc        subq    $0x68, %rsp
0000000100000fc0        movq    %rdi, %r14
0000000100000fc3        movq    0x1556(%rip), %rdi  ## Objc class ref: 
0000000100000fca        movq    0x14b7(%rip), %rsi  ## Objc selector ref: 
0000000100000fd1        leaq    0x13a8(%rip), %rdx  ## Objc cfstring ref:
0000000100000fd8        movl    $0x2, %ecx
0000000100000fdd        callq   *0x10b5(%rip)       ## Objc message:
                +[NSUserNotificationCenter _centerForIdentifier:type:]
0000000100000fe3        movq    %rax, %rdi
0000000100000fe6        callq   0x1000019e6         ## symbol stub for:
0000000100000feb        movq    %rax, %rbx
0000000100000fee        testq   %rbx, %rbx
00000001000012de        leaq    0xf7b(%rip), %rdx   ## Objc cfstring ref:
                 @"Eject "%@" before disconnecting or turning it off."

If we hexdump -C DiskArbitrationAgent we can see the actual bytes too:

00000fa0  48 83 c4 08 5b 41 5c 41  5d 41 5e 41 5f 5d c3 55  |H...[A\A]A^A_].U|
00000fb0  48 89 e5 41 57 41 56 41  55 41 54 53 48 83 ec 68  |H..AWAVAUATSH..h|

Yes, the text segment of Mach-O images nicely correspond in memory as they do on disk - at least in non-fat binaries. Okay, that's boring to just about everyone except me. How do we get rid of this warning? That's easy, all we have to do is insert a c3 at faf. You can use a hex editor, but I just wrote this tiny program:

#include <stdio.h>

int main()
 FILE *f = fopen("DiskArbitrationAgent", "r+");
 fseek(f, 0xfaf, SEEK_SET);
 unsigned char r = 0xc3;
 fwrite(&r, 1, 1, f);
 return 0;

I recommend making a backup of the original file before fiddling with it. We then need to killall DiskArbitrationAgent and we're done. Too hard? Here's my hacked DiskArbitrationAgent.

I hoped you have enjoyed this exercise and don't trash your Mac. :)

Friday, November 22, 2013

Getting to Mars With The Reusable Falcon 9

Isn't it a bit odd that the most promising reusable launch vehicle under development today is being build by a company with a proclaimed love for heavy-lift launch vehicles?

As the Falcon 9 Reusable approaches the cusp of operations, with a successful demonstration of first stage reuse expected sometime next year, SpaceX is already moving on to a methane engine - Raptor - four times as big, for a rocket - MCT - with a much larger core size.

This, we're told, is Elon Musk's strategy for going to Mars and it's so much warmed over Bob Zubrin - Mars Direct, Mike Griffin - Apollo On Steroids, cargo cult of the Saturn V, stuck-in-the-1960s thinking.

If you have an operational reusable launch vehicle, as SpaceX says it is their goal to have, then there's much more sensible ways to get to Mars. Come on boffins, get the lead out, let's do the math on this one.

According to the best public numbers I can find, the second stage of the Falcon 9 v1.1 has a dry mass of 4,900 kg and launches with a propellant load of 70,800 kg. This is a very impressive propellant mass fraction of 93.5% and with its single Merlin 1-D engine delivering a specific impulse of 340s it can throw 22 tons on a fast transit (just over 6 months) to Mars (a delta-v of 4.3 km/s).

This alone is probably sufficient to do a great Mars mission. The hitch, of course, is that the second stage gets to orbit empty (well, with some unknown ullage) and must be refueled before it can be sent off to Mars. Also the typical payload to low Earth orbit of the Falcon 9 v1.1 is only about 13 tons, leaving us 9 tons of Mars-bound payload short. As it turns out, this is about the mass I'd estimate for a minimal Dragon-based Earth return capsule, so we'll assume the crew come and dock with the 13 ton Mars transit vehicle later.

The expectation is that the Falcon 9 Reusable will have about 25% less payload to orbit capability as it does acting in expendable mode - that is, about 10 tons, so the crew launch vehicle will not have to be expended. This is what you'd expect, as SpaceX is designing the Falcon 9 Reusable to reduce the cost of ferrying crews to the space station.

Now, about that fuel. We'll need about 70 tons of it, and at 10 tons per Falcon 9 Reusable flight, that's seven flights. However, part of the fuel is cryogenic - the liquid oxygen - and some of it may boil off depending on the length of the launch campaign. So let's say eight Falcon 9 Reusable tanker flights total. Still not enough? Okay, let's say nine flights. What's that? You want more? Okay, let's say ten flights. It's a fully reusable system.

There's some challenges in transferring liquid oxygen in zero-g, but they're minor compared to.. say.. liquid hydrogen. Figure it out.

What if a 13 ton transfer vehicle and a 9 ton crew return vehicle - 22 tons total to Mars transfer orbit - isn't enough? That's okay, just stage together two Falcon 9 v1.1 second stages. Both require 70 tons of fuel, so you're only doubling the total number of Falcon 9 Reusable flights, plus whatever you need to get the massive new payload into low Earth orbit.

Suppose the first stage provides 1463 m/s of delta-v before separating and falling away. The second stage ignites and provides the remaining 2838 m/s of delta-v. How much actual payload is thrown to Mars transfer orbit?

Would you believe, 47,850 kg? Almost 48 tons, surely that's enough!

The Saturn V was an amazing machine, but it was the product of a by-gone era. Fully and rapidly reusable launch vehicles combined with on-orbit refueling will make big boosters obsolete. At least, I sure hope it will.

Thursday, May 30, 2013

Who Would Have Guessed?

It was Stiennon and Hoerr's space-nerd spectacular "The Rocket Company" (now available on Kindle!) that introduced me to Kroemer's lemma:

The last 40 years has seen a lot of futile effort by space enthusiasts to find the one magic product or market that will justify building a truly commercial space industry. Well, it hasn't been found, and we're tired of waiting for it. And if you accept Kroemer's lemma, it can't be done that way anyhow. Even if you guess correctly what it is that won't create a huge growth in demand for launch services so that costs come down, that demand won't -- and can't -- come into being until the cost does come down.

So who is Kroemer and what is his lemma?

Herbert Kroemer is a Nobel Laureate in physics who wrote, in 1995, the Lemma of New Technology:

The principle applications of any sufficiently new and innovative technology always have been -- and will continue to be -- applications created by that technology. Ultimately, progress in applications is not deterministic, but opportunistic, exploiting for new applications whatever new science and technology happen to be coming along.

Around 1999, the Jordi Puig-Suari of California Polytechnic State University and Bob Twiggs of Stanford University decided to work together on a standard that would enable graduate students to design, build, test and operate in space their own spacecraft, with capabilities not much more advanced than the world's first spacecraft, Sputnik. It was called CubeSat. At the time, no-one imagined that commercial aerospace companies would ever be interested in flying such small, limited, even primitive spacecraft. A lot has changed since then, including CubeSats, which have gotten bigger, better communications, propulsion and may even be landing on the Moon soon.

Ten years later, Chen, Strickler and Adler launched Kickstarter. In a perfect example of Kroemer's lemma, The New York Times called it "the people's NEA", comparing Kickstarter to The National Endowment for the Arts, an agency of the United States federal government that offers support and funding for projects exhibiting "artistic excellence". Who would have thought that the most successful project, just two years later, would be "Pebble", an e-paper watch for iPhone and Android devices. Or that Tim DeBenedictis would raise $117,000 for SkyCube, just one of the more famous CubeSats projects that have been funded through the platform.

Which brings us up to today. Next year, Planetary Resources will be flying a 3U CubeSat to prove out many parts of their orbital space telescope hardware, but that's not what has gotten them thousands of backers and over $250,000 on the first day of their Kickstarter project. Aiming for just $1,000,000 by June 30, Planetary Resources is promising to build and fly a space telescope that can be accessed in classrooms around the world, and by the general public.

Who would have guessed that?

Increasingly, I am more interested in people who try to make the future, than predict it.

Thursday, April 18, 2013

In Regards To Secrets

Bob has a secret. His secret is not just something he finds valuable, but something lots of other people would find valuable too. Perhaps it's a new way to make energy, or to dye wool or to build yachts. Perhaps it's just his mother's maiden name. We don't know, because it is Bob's secret.

Does Bob have an obligation to share his secret with us? Can we go to Bob's house and demand he tell us his secret? Can we threaten Bob to get the secret out of him, or promise him payment for his secret and then renege? If not, why not?

Alice would like to know Bob's secret, so she offers him a significant amount of money for Bob to tell her. Bob is worried that Alice will tell others, but she promises not to tell anyone else. Having heard Bob's secret, Alice wishes she had thought of it herself and would prefer no-one else to know the secret, not even Bob. This, of course, is impossible, but Bob offers the next best thing: he'll promise to never tell anyone else the secret for a small fee each month. Alice agrees.

This continues for many years until one day Alice meets Claude. Alice very much wants to tell Claude the secret, but she still has an agreement with Bob promising not to tell anyone else. She talks to Bob and he agrees to let Alice out of her promise, for a small increase in his monthly fee. Alice tells Claude the secret, after swearing him to secrecy.

Shortly after having heard the secret, Claude loses interest in Alice. He floats around the world for a while, visiting various places and eventually meets Desmond, to whom he quickly tells the secret. Claude did not swear Desmond to secrecy. In fact, he didn't even tell Desmond that what was being told was a secret. The idea is no longer a secret. Desmond tells everyone.

The idea sweeps the world and everyone talks about Desmond, the man who told the world. Some people think Desmond actually made up the idea himself, but most people believe Desmond when he says a man named Claude told him the idea. Alice and Bob certainly believe it. Alice is upset because Claude broke her confidence. Bob is upset because Alice doesn't want to continue his monthly payments. They go looking for Claude.

Is Alice right or wrong to be upset with Claude? Is Alice right or wrong to stop paying Bob?

Should anyone be upset with Desmond?

This sort of situation seems to baffle people who don't believe ideas can be "property". They start asking other questions like what laws are applicable (copyright? patents?) and whether those laws are just. If they're honest, they start asking if they really understand the concept of property at all.

Saturday, April 13, 2013

Colonizing the asteroids starts at home!

When I first heard of this proposal I was reminded of the recommendations of the Space Studies Institute to do ore processing experiments on orbit as the first step to building O'Neill colonies. They were talking about using Lunar regolith simulant in low Earth orbit, with the goal of developing the techniques to utilize the products of a future lunar mining operation, but as an asteroid resources advocate I'd always preferred to think about doing the same thing with a captured asteroid.

A few years ago I wrote about colonizing a near-Earth asteroid (without moving it), with a focus on artificial gravity issues. The reality is that we don't yet know enough about the composition of any asteroids to have a decent shot at making water, oxygen, plant nutrients, or any of the other things you'd need for a space colony. We need to learn it before the colonists are sent, and having a captured asteroid to experiment on is a great way to do it.

Ultimately, though, the largest asteroids you can capture won't be big enough for a colony. Designing a mission to take a few hundreds of people out to (at least) 20 lunar distances is quite a challenge if you want to get them there healthy and ready to build a new world. Most problems can be solved by throwing mass at it, but typically that means more launches. Having material that is already in orbit, especially high lunar orbit or the Lagrange points, which you can use for shielding, know how to process into consumables or even structural components, would be of great help.

How likely is survival of that first colony? Mostly, they'd be cut off from resupply - close approaches to Earth of the same asteroid only happen infrequently. If they are to survive and thrive they'll have to be independent and stubborn. They'll need to see what they're doing as important and have a forward looking motivation.

After just a generation, they may be ready to expand. If their home is an Apollo asteroid, they might have the option of hopping over to the asteroid belt. Their well-honed technology will come in handy there. Eventually they may pull apart entire asteroids to make O'Neill type colonies, or just very large spaceships.

Visiting Earth will be easier for the asteroid dwellers than visiting the asteroids is for the Earthicans.

Sunday, March 17, 2013

Jon Goff's Lunar Patent

On a recent edition of The Space Show, Jon Goff discussed a lunar analogy to the 10 year patent grant awarded to Columbus on trade with any of the lands he discovered. This follows on from the great work done by Mike Mealling at dispelling myths about Columbus' funding which, I believe, he was inspired to do after watching one of my videos. Unfortunately, I think Jon fails to convey his analogy in a convincing way. Being somewhat libertarian, Jon is a little too concerned with where the tax revenue comes from and too specific with who will receive the incentives. This may also simply be a result of the origin of the idea - the analogy to Columbus - and the attempt to describe it as such.

Talking about who will be taxed to fund a government program is never popular. Even "let's tax the rich" is too specific not to leave a bad taste in the voter's mouth. Politicians have learnt that the subject is completely avoidable anyway. Talking about who will receive the bulk of government funding, even in the abstract, is rarely popular. It suggests that the purpose of the program is just to reward cronies or enrich one group over another. Politicians like to talk about having "free and open competition" to select contractors, or however they are handing out taxpayer money. Keeping these elements of modern statecraft in mind, how could the lunar patent concept be sold in today's terms?

I imagine something like this:

"To encourage greater commerce on the Moon, the federal government is offering to pay the majority of lunar launch costs and lunar facility leases for lunar operations. This offer will be valid for the first 10 years of lunar commercialization, which is defined as starting with the establishment of a permanent lunar base by any US non-goverment entity."

More detail could be added as to what exactly the government is subsidizing, but the initiative is sold as a means to reduce the cost of lunar commerce.. not as rewarding first movers. The first movers are required to get the kickoff to happen but it’s up to them to ensure that the government kickbacks come to them and not some latecomer. Thankfully, that's how markets tend to work anyway.

Eventually, someone will inevitably ask how the government is going to pay for this lunar development.. especially if the assumption is that launch costs are going to remain high and lunar facility leases will be in high demand. Assuming you can get a politician to give you a straight answer, the truth may be that they expect taxes collected on lunar commerce will cover the subsidies. They'll trot out an economist who is willing to testify to such and the public will swallow it because, hey, the guy has charts and graphs and stuff.