Space rockets are Big.

Those quaint little pictures that show them next to Nelson’s Column or the Eiffel Tower don’t do them justice, partly because… well. I didn’t even realise how big the Eiffel Tower is until I visited it a few years ago.

So, here’s what the first stage of the SpaceX Falcon 9 rocket looks like, next to Nelson’s Column. Take a close look at the bottom, both photos have people in them.

Falcon 9.jpg

The image of Nelson’s Column [linked here] is licensed as Creative Commons Share Alike, which requires that “If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.”

Fortunately, the image from SpaceX [link] was licensed as CC0 1.0 Universal (CC0 1.0) Public Domain Dedication, which doesn’t interfere with my ability to release this as CC-SA-3.

Advertisements
Science, Technology

Falcon 9 to scale

Image
Humour, Uncategorized

Tasteless humour

So, a friend has convinced his workplace that the word ‘bottom’ is inherently funny regardless of context. ‘Bottom of the list’, ‘bottom of the filing cabinet’, etc. all lead to tittering. It got to the stage where one person made a file called ‘bottom’ just so that, in order to find out if they had the right unix permissions, they would type ‘touch bottom’ on the command line.

Well, I was wondering what other command line commands are funny when followed by ‘bottom’…

Continue reading

Standard
Software

Just because you can, doesn’t mean you should

Python lets programmers redefine initializers at runtime. Don’t do that.

Screen Shot 2017-05-19 at 19.07.53

The C preprocessor lets programmers redefine “true”. Don’t do that.

Screen Shot 2017-05-19 at 17.11.35

Swift lets programmers use very foolish variable names. This may be the lesser sin, but still, don’t do that.

Screen Shot 2017-05-19 at 17.07.26

Given python has a reputation for relatively defect-free code, it’s remarkable how few guards it has for enforcing good code — no type safety, no access modifiers, only enforced indentation.

Standard
Software

Executable images

Twenty years ago, back in 1997, there was an urban legend that some images contained viruses.

“Absurd!” thought the teenage me, “Images are just data, they can’t do anything!”

Well, I was wrong. In 2004, researchers found a bug in a Microsoft JPEG library which allowed a well-crafted .jpg to totally compromise a computer — file system, arbitrary code, administrator access, everything. Obviously that particular bug has now been fixed, but it did make me realise quite how badly broken things can be.

Despite all the tools that help us software engineers solve problems, reduce our bug count, secure our software, and develop things faster, we still don’t seem to have this as our mindset. We have professional groups, but membership of them is not needed for jobs. Automated tests exist, but knowledge of them is limited and use even more limited (for example, I wish I could say I had professional experience of them since university, but no such luck). We don’t have anything like a medical licence (or even just the hippocratic oath), there is nothing to stop people practicing code without a licence the way people are prevented from practicing law without a licence.

And now, we’re making a world where A.I. replaces humans. Automation is fine, nothing wrong with it… but if you assume the computer is either always right or that the errors are purely random, you will be blind to problems this causes.

Hackers.

I can’t say that I have “a hacker mentality”, but mainly because the phrase means completely different things to different people, so I will say this: I see loopholes everywhere, systems that can be exploited by malevolent or selfish people, not just accidentally by those who can’t follow instructions.

How many people, I wonder, travel on fake rail tickets or bus passes that came out of their home printers? How many, when faced with a self-service checkout, will tell the terminal that their expensive fancy foreign cheese is actually loose onions?

This sort of thing is dealt with at the moment by humans — it was a human who realised it was odd that one particular gentleman kept buying onions, given the store had run out some time ago, for instance — but the more humans fall out of the loop, the easier it is to exploit machines.

This brings me to QR codes. QR codes are somewhat stupid, in that they are just some text encoded in a way that a computer can read easily, with some error-correction codes so it can survive a bit of dirt or a bad reflection. This is stupid, partly because it really hasn’t taken long to make A.I. which can read text from photos just fine (making the codes redundant), but mainly because humans can’t read the codes (making them dangerous).

Dangerous? Well, just as with URL-shorteners, you may find yourself looking at a shock site rather than the promised content… but that’s not really the big problem.

If you can, try to scan this QR code. No goats, lemons, or tubs, I assure you (and if you don’t know what those three words have in common, you may want to retain your innocence), but please do scan this code:

Executable QR code

What does it do for you? I’m curious.

If you don’t have a QR code scanner, I’ll tell you what it says:

data:text/html;,alert("Your QR code scanner is hackable")

That is literally what it says, because a QR code is just text that’s easy for a computer to read. This is a data URI, which contains some JavaScript, which opens an alert message. If you want, copy it into the address bar of your browser, just as if it were a website — press return or “go” or whatever works on your system.

It’s an executable image. Nothing nefarious, just proof of concept.

What does that mean for the world? Well, what do people do with QR codes? Well, not people, people don’t use them… what do businesses do with QR codes? Mine is a harmless example, but what happens if UK Limited Company Number 10542519 makes a QR code from their name… and it shows up in the vision system of a computer that, owing to our profession’s move-fast-and-break-things attitude, naïvely trusts input without anyone having considered that could be a bad thing?

Some social networks know (and complain) if I try to use a profile photo that doesn’t have a face in it. If that’s a general-purpose computer vision system, it may well also recognises QR codes (because QR codes are easy to recognise, and because “more features!” is a business plan). If your business can’t resist a Bobby Drop Tables username, it won’t be in business for very long — but the same may happen to Bobby Drop Table faces, if you’re not careful.

Governments are all over the place when it comes to security, just like the private sector. What happens if a wanted criminal wears a face mask that is the QR code version of Bobby Drop Tables?

Robert'); DROP TABLE criminals;--

And suddenly, no more criminal record? Well, not in that jurisdiction anyway.

Standard
Science, Technology

Railgun notes

Force on the projectile of a railgun:
F = B·I·l
B: Magnetic field
I: Current
l: Length of armature

Current = Voltage / Resistance

Resistivity of seawater:
ρ = 2.00×10^−1 (Ω·m) (because = (Ω/m-length)*(cross-sectional area))

Let cavity be 1cm square, consider section 1cm long:

Volume: 1 millilitre
mass (m): ~1 gram = 1e-3 kg
Cross-section: 1e-4 m^2
Armature length (l): 1e-2 m
Resistance: ((2.00×10^−1 Ω·m)*0.01m)/(0.01m^2) = 0.2 Ω (got that wrong first time! Along with all that followed, which is now updated…)
∴ current (I) = Voltage (V) / 0.2 Ω

Rare earth magnets can be 1 tesla without much difficulty. Assume that here.

F = 1 T · (V/0.2 Ω) · (1e-2 m)

Target velocity: 11.2 km/s = Escape velocity = 11200 m/s
v = at = 11200 m/s
∴ a = (11200 m/s) / t
s = 1/2 · a · t^2
∴ s = 1/2 · ( (11200 m/s) / t ) · t^2
= 1/2 · (11200 m/s) · t
or: t = s / (1/2 · (11200 m/s))
F = ma = (1e-3 kg) · a
∴ a = F / (1e-3 kg)
∴ t = (11200 m/s) / (F / (1e-3 kg))
= (11200 m/s) · (1e-3 kg) / F
∴ s = 1/2 · (11200 m/s) · (11200 m/s) · (1e-3 kg) / F
∴ s = 1/2 · (11200 m/s) · (11200 m/s) · (1e-3 kg) / ( 1 T · (V/0.2 Ω) · (1e-2 m) )

Say V = 250 volts:
∴ s = 1/2 · (11200 m/s) · (11200 m/s) · (1e-3 kg) / ( 1 T · (250V/0.2 Ω) · (1e-2 m) ) = 5020m (not ~501760 meters)

Say V = 25,000 volts:
∴ s = 1/2 · (11200 m/s) · (11200 m/s) · (1e-3 kg) / ( 1 T · (25000V/0.2 Ω) · (1e-2 m) ) = 50.2m (not ~5017.6 meters)

Liquid mercury instead of seawater:
Resistivity: 961 nΩ·m = 0.961e-6 Ω·m
Resistance: 9.6e-7 Ω (got this one wrong the first time, too!)
Density: 13.56 times water
F = 1 T · (V/9.6e-7 Ω) · (1e-2 m)
s = 1/2 · (11200 m/s) · (11200 m/s) · (13.56e-3 kg) / ( 1 T · (V/9.6e-7 Ω) · (1e-2 m) )
@250 volts: s = 0.3266 meters (not 3.266m as before correction)
@25kV: s = 3.266 millimetres (not 32.66 millimetres as before)

Power (DC): P = IV where I = V/R,
R = 9.6e-7 Ω
@250 volts: I = 250 / R = 250 V / 9.6e-7 Ω = 2.604e8 amperes (x10 more than before correction)
∴ P = 65.1 gigawatts (x10 than before)
@25kV: I = 25000 / R = 25000 V / 9.6e-7 Ω = 2.604e10 amperes (x10 more than before)
∴ P = 651 terawatts (x10 than before)

Duration between rails:
From t = s / (1/2 · (11200 m/s))
@250 volts:
t = 0.3266 meters / (1/2 · (11200 m/s)) = 5.8321×10^-5 seconds (x10 less than before correction)
@25kV:
t = 3.266 millimetres / (1/2 · (11200 m/s)) = 5.8321×10^-7 seconds (x10 less than before)

Electrical energy usage:
E = P · t
@250 volts:
E = 65.1 gigawatts · 5.8321×10^-5 seconds = 3.797×10^6 joules (unchanged by correction)
@25kV:
E = 651 terawatts · 5.8321×10^-7 seconds = 3.797×10^8 joules (unchanged by correction)
(For reference, 1 litre of aviation turbine fuel is around 3.5e7 joules)

Standard