WEBVTT
Kind: captions
Language: en

1
00:00:00.000 --> 00:00:03.840
The “onosecond” is the second after you
make a terrible mistake.

2
00:00:03.840 --> 00:00:05.470
The second when you realise
what you just did

3
00:00:05.470 --> 00:00:07.220
and that there’s nothing
you can do about it,

4
00:00:07.220 --> 00:00:11.710
the second when all the now-inevitable consequences
flash through your mind.

5
00:00:11.710 --> 00:00:15.240
It is the second after you send a text message
to the wrong person,

6
00:00:15.240 --> 00:00:16.610
after you delete the wrong file,

7
00:00:16.610 --> 00:00:20.420
after you spill the secret that you thought
they already knew.

8
00:00:20.420 --> 00:00:23.550
The “onosecond” is that stomach-dropping,

9
00:00:23.550 --> 00:00:28.900
breath-stopping moment when all you can do
is say “oh, no”.

10
00:00:28.900 --> 00:00:32.600
This is the story of the
worst typo I ever made.

11
00:00:35.620 --> 00:00:37.019
I was maybe 18 or 19,

12
00:00:37.019 --> 00:00:39.890
in charge of converting an old web site to
a new and faster platform.

13
00:00:39.890 --> 00:00:44.969
A half-dozen volunteers had spent days transferring
all the articles over,

14
00:00:44.969 --> 00:00:46.660
copying them from the old site, updating them,

15
00:00:46.660 --> 00:00:48.379
and then saving them in their new place.

16
00:00:48.379 --> 00:00:53.149
It had been a lot of effort,
but everything was pretty much sorted now.

17
00:00:53.149 --> 00:00:55.390
There was one thing I needed to do:

18
00:00:55.390 --> 00:00:57.799
a search-and-replace across all those pages
of content.

19
00:00:57.799 --> 00:01:01.129
And I was wise to the mistake
that people usually make there:

20
00:01:01.129 --> 00:01:02.879
it’s called the clbuttic mistake,

21
00:01:02.879 --> 00:01:04.739
where someone wants to censor the word “ass”

22
00:01:04.739 --> 00:01:10.170
and the search-and-replace gets a little bit
more enthusiastic than they thought it would.

23
00:01:10.170 --> 00:01:11.480
This problem: much simpler.

24
00:01:11.480 --> 00:01:13.520
the volunteers had just written the articles
in plain text,

25
00:01:13.520 --> 00:01:15.460
and I needed to add some simple formatting.

26
00:01:15.460 --> 00:01:18.080
Anywhere there were three dashes,

27
00:01:18.080 --> 00:01:20.920
I just needed to replace that with a tag for a
horizontal line.

28
00:01:20.920 --> 00:01:25.329
There’s no way that search-and-replace could
go wrong. Right?

29
00:01:25.329 --> 00:01:28.130
This was the mid-2000s, so the site wasn’t
anything fancy:

30
00:01:28.130 --> 00:01:30.670
it was a standard SQL database.

31
00:01:30.670 --> 00:01:32.660
SQL is Structured Query Language:

32
00:01:32.660 --> 00:01:35.980
it’s an international standard for sending
commands to basic databases,

33
00:01:35.980 --> 00:01:37.430
and it’s still used today.

34
00:01:37.430 --> 00:01:40.050
I hadn’t bothered to set up any tools to
help me along with it.

35
00:01:40.050 --> 00:01:44.250
I was the only one working on the site,
so I was just using the command line.

36
00:01:44.250 --> 00:01:47.210
Which meant that with a single instruction,

37
00:01:47.210 --> 00:01:52.605
I could change every record in the live database,
every single page, at once. 

38
00:01:52.605 --> 00:01:56.595
Working on a live database is a bit like working
with a live mains electricity cable.

39
00:01:56.595 --> 00:02:00.159
Sure, it’s physically possible,
it’d make things quicker,

40
00:02:00.159 --> 00:02:04.460
and there are very, very rare occasions where
it might actually be the only option.

41
00:02:04.460 --> 00:02:08.739
But in general, if you’re working on
mains electricity, you turn the power off first.

42
00:02:08.739 --> 00:02:13.689
And if you’re working on a database,
you don’t work on the live version.

43
00:02:13.689 --> 00:02:16.030
I was working on the live version.

44
00:02:16.030 --> 00:02:20.370
Because I was young, and careless,
and besides, the difficult part was over, right?

45
00:02:20.370 --> 00:02:23.310
After all that conversion work,
and it was a lot of work,

46
00:02:23.310 --> 00:02:25.260
I just had to issue a few final commands.

47
00:02:25.260 --> 00:02:29.120
Update the list of articles,
and set the content field to itself,

48
00:02:29.120 --> 00:02:31.549
just with the dashes replaced with the tag.

49
00:02:31.549 --> 00:02:36.059
So I typed in the command, hit enter, and...

50
00:02:36.059 --> 00:02:38.154
Oh, no.

51
00:02:38.154 --> 00:02:41.299
Reading 5,000 pages, doing a search and replace
across all that text,

52
00:02:41.299 --> 00:02:42.620
and putting it all back into the database,

53
00:02:42.620 --> 00:02:46.780
should have taken a bit more than
one-hundredth of a second.

54
00:02:46.780 --> 00:02:51.450
I didn’t know what had happened yet,
but I knew something had gone wrong.

55
00:02:51.450 --> 00:02:52.910
Hold that thought.

56
00:02:52.910 --> 00:02:55.310
In the history of computer science,

57
00:02:55.310 --> 00:02:58.830
the undo command was invented independently
several times.

58
00:02:58.830 --> 00:03:01.769
In the 1970s, programmers at the Xerox PARC
research centre

59
00:03:01.769 --> 00:03:05.560
were the first to assign it to that easy-to-reach
keyboard shortcut of Ctrl-Z. Or "Zed".

60
00:03:05.560 --> 00:03:12.540
Their work there later, uh, inspired many
features that ended up in Apple computers.

61
00:03:12.540 --> 00:03:14.141
And most of the time undo is linear:

62
00:03:14.141 --> 00:03:16.670
there is an ordered list of commands that
we’ve issued,

63
00:03:16.670 --> 00:03:20.550
and we can undo -- or redo -- our way
back and forth through that list.

64
00:03:20.550 --> 00:03:25.590
The most basic way to implement that is to
store the exact state of the document after

65
00:03:25.590 --> 00:03:29.739
every single command, or even after each
keystroke, and just roll back to that.

66
00:03:29.739 --> 00:03:33.209
It’s memory-intensive, and there are a lot
of ways to optimise it,

67
00:03:33.209 --> 00:03:34.340
but that’ll work.

68
00:03:34.340 --> 00:03:36.950
It’s also an easy mental model for users
to deal with:

69
00:03:36.950 --> 00:03:40.110
you just step back and forth in time.

70
00:03:40.110 --> 00:03:43.290
But if you go back in time, and then make
a small change,

71
00:03:43.290 --> 00:03:45.799
you won’t be able to redo your way
back forwards.

72
00:03:45.799 --> 00:03:49.829
Like a time traveller in science fiction,
you’ve broken the future.

73
00:03:49.829 --> 00:03:53.329
So if you do want to recover something you
deleted and bring it forward in time with you,

74
00:03:53.329 --> 00:03:56.701
you’ll have to be really careful not to
accidentally hit the wrong key 

75
00:03:56.701 --> 00:03:58.569
while you’re back there.

76
00:03:58.569 --> 00:04:01.560
Now, plenty of folks have tried to create
‘undo trees’:

77
00:04:01.560 --> 00:04:02.870
so if you do back and change history,

78
00:04:02.870 --> 00:04:04.999
it just creates a new timeline,

79
00:04:04.999 --> 00:04:08.840
and you can move around the timelines
however you want.

80
00:04:08.840 --> 00:04:11.519
There are some text editors which’ll do
that for you,

81
00:04:11.519 --> 00:04:13.150
and even visualise all the branches.

82
00:04:13.150 --> 00:04:16.040
But it’s a complicated thing to keep in
your head,

83
00:04:16.040 --> 00:04:18.700
and it’s never found mainstream appeal.

84
00:04:18.700 --> 00:04:23.210
There are source control systems that work
the same way, like Git:

85
00:04:23.210 --> 00:04:25.980
every time you save your file and ‘commit’ it,

86
00:04:25.980 --> 00:04:27.260
that copy is available forever.

87
00:04:27.260 --> 00:04:29.360
Multiple people can work on files
at the same time,

88
00:04:29.360 --> 00:04:31.500
make changes in different ‘branches’,

89
00:04:31.500 --> 00:04:33.620
and everything just gets merged
back together afterwards.

90
00:04:33.620 --> 00:04:37.850
It’s incredibly useful for any software
development project.

91
00:04:37.850 --> 00:04:40.220
But trying to do that for every keystroke,

92
00:04:40.220 --> 00:04:45.000
rather than every saved version of a file,
is a bit much.

93
00:04:45.000 --> 00:04:47.530
Saving keystrokes works in memory,
which is fast;

94
00:04:47.530 --> 00:04:51.210
saving files works on disk,
which is comparatively slow.

95
00:04:51.210 --> 00:04:54.410
Microsoft Word used to have a Fast Save feature,

96
00:04:54.410 --> 00:04:56.760
where if you’d updated a few things in the
document,

97
00:04:56.760 --> 00:04:59.600
it didn’t actually save the whole thing
all over again:

98
00:04:59.600 --> 00:05:02.310
it just appended those changes on the end,

99
00:05:02.310 --> 00:05:05.440
so you didn’t have to wait five or ten seconds
every time you hit Control-S

100
00:05:05.440 --> 00:05:08.930
to save on an old 90s computer.

101
00:05:08.930 --> 00:05:12.990
It turned out that leaving stuff in files
that users thought they’d deleted

102
00:05:12.990 --> 00:05:14.700
was a massive privacy and security risk,

103
00:05:14.700 --> 00:05:17.180
and that got turned off in 2003.

104
00:05:17.180 --> 00:05:20.480
That model: quick undo for live work in memory,

105
00:05:20.480 --> 00:05:23.520
and a slower save to disk
when you’re done with a task,

106
00:05:23.520 --> 00:05:26.770
is still used in a lot of places…
although it is slowly changing.

107
00:05:26.770 --> 00:05:29.960
If you write text in Google Docs or other
cloud-based platforms,

108
00:05:29.960 --> 00:05:32.870
then your keystrokes are constantly
saved and synchronised.

109
00:05:32.870 --> 00:05:35.940
You never actually have to hit ‘save’.

110
00:05:35.940 --> 00:05:38.590
Which means that depending on which app you’re
working in,

111
00:05:38.590 --> 00:05:42.950
you have to change your mental model of how
your work is saved.

112
00:05:42.950 --> 00:05:46.910
And sometimes you don’t want to save every
single keystroke and command.

113
00:05:46.910 --> 00:05:48.890
If you got frustrated at your boss,

114
00:05:48.890 --> 00:05:52.720
typed some… colourful comments into your
code, and then deleted them,

115
00:05:52.720 --> 00:05:55.350
they probably shouldn’t be stored forever.

116
00:05:55.350 --> 00:06:00.031
Or maybe you pasted a password or security key
or credit card number into the wrong file,

117
00:06:00.031 --> 00:06:05.850
and you definitely don’t want Derek the
intern to have access to that forevermore.

118
00:06:05.850 --> 00:06:10.105
Anyway: the point is, there are all sorts
of systems, big and small,

119
00:06:10.105 --> 00:06:12.730
designed to allow you to undo and redo.

120
00:06:12.730 --> 00:06:15.830
In MySQL, the language I was using for
that database, they had “transactions”.

121
00:06:15.830 --> 00:06:19.270
And you could type the command
START TRANSACTION.

122
00:06:19.270 --> 00:06:20.400
Any edits you made would be accepted,

123
00:06:20.400 --> 00:06:26.550
but they wouldn’t be actually, properly, definitely,
irrevocably saved until you typed COMMIT.

124
00:06:26.550 --> 00:06:28.390
If you screwed up, you typed ROLLBACK,

125
00:06:28.390 --> 00:06:32.780
and the database just forgot those commands
had ever been sent in.

126
00:06:32.780 --> 00:06:36.424
Which is great, right?
Because everyone makes typos.

127
00:06:37.493 --> 00:06:40.400
Can you spot it? 'Cos it’s really subtle.

128
00:06:40.400 --> 00:06:43.500
The database had gone into the ‘articles’ table,
and for every single article,

129
00:06:43.500 --> 00:06:45.820
it had changed the ‘content’ field.

130
00:06:45.820 --> 00:06:48.360
Those words: ‘articles’ and ‘content’,
they’re surrounded by backticks,

131
00:06:48.360 --> 00:06:52.520
that odd character to the left of the 1 on
most keyboards.

132
00:06:52.520 --> 00:06:55.890
Backticks mean
“this is the name of a table or field,

133
00:06:55.890 --> 00:06:58.450
“I’m referring to something in the database”.

134
00:06:58.450 --> 00:07:01.680
That’s all fine.
Then it looked at the “replace” command.

135
00:07:01.680 --> 00:07:05.130
And I’d told it that for each article,
it should pull the content,

136
00:07:05.130 --> 00:07:07.410
and replace the dashes with the tag.

137
00:07:07.410 --> 00:07:08.800
Everything’s in the right order there,

138
00:07:08.800 --> 00:07:12.640
I remember checking that I’d got it all
the right way round.

139
00:07:12.640 --> 00:07:14.640
Except that’s where I messed up.

140
00:07:14.640 --> 00:07:18.470
Those, right there?
They’re not backticks. They’re apostrophes.

141
00:07:18.470 --> 00:07:23.070
And apostrophes mean ‘this is a
literal string of text’. Not a name.

142
00:07:23.070 --> 00:07:27.940
So, as I had ordered, the database promptly
took the literal word “content”, c-o-n-t-e-n-t,

143
00:07:27.940 --> 00:07:30.140
looked through it for dashes, found none,
replaced nothing,

144
00:07:30.140 --> 00:07:33.200
and then put that word ‘content’
into the content field.

145
00:07:33.200 --> 00:07:35.490
For 5,000 articles.

146
00:07:35.490 --> 00:07:38.370
And I looked at the web site.
All the volunteers’ hard work.

147
00:07:38.370 --> 00:07:43.190
5,000 pages. Every single page, just replaced
with the word “content”.

148
00:07:43.190 --> 00:07:47.790
Genuinely, my pulse rate is rising a little
as I think about that.

149
00:07:47.790 --> 00:07:50.650
I was nearly physically sick.
Because I knew what was going to happen next.

150
00:07:50.650 --> 00:07:54.780
Because that typo is an entirely reasonable
mistake to make.

151
00:07:54.780 --> 00:07:57.040
There’s nothing wrong with
screwing up like that.

152
00:07:57.040 --> 00:08:01.280
Everyone makes errors like that, all the time.
And we hit Control-Z. Or we click the ‘Undo’ button.

153
00:08:01.280 --> 00:08:02.889
In Gmail, we hit ‘undo send’,

154
00:08:02.889 --> 00:08:06.760
at least for the 30 seconds before it actually
does send the message.

155
00:08:06.760 --> 00:08:11.839
And if you happen to be enough of a prat to be
 working on a live SQL database,

156
00:08:11.839 --> 00:08:14.139
you type in ROLLBACK.

157
00:08:16.232 --> 00:08:18.889
I hadn’t told it to start a transaction.

158
00:08:18.889 --> 00:08:21.960
And there are all sorts of words I could use
to describe the idea of

159
00:08:21.960 --> 00:08:25.800
working on a live database without even a
transaction as a safety net.

160
00:08:25.800 --> 00:08:31.200
Ridiculous. Asinine. Unthinking.
But the one I think is most accurate is: negligent.

161
00:08:31.200 --> 00:08:33.580
The only reason that typo was
the worst I’ve ever made

162
00:08:33.580 --> 00:08:37.580
was because of all the poor decisions
that led up to it.

163
00:08:37.580 --> 00:08:41.669
Working on a live database. Thinking I
couldn’t screw up one simple command.

164
00:08:41.669 --> 00:08:43.880
Not having any sort of backup!

165
00:08:43.880 --> 00:08:47.450
Days of work by volunteers and at no point
during that had I thought,

166
00:08:47.450 --> 00:08:52.410
you know what, maybe we should get a copy
of that somewhere else just in case?

167
00:08:52.410 --> 00:08:55.280
Like, that should have been backed up daily,
or hourly.

168
00:08:55.280 --> 00:08:56.485
The root cause of all that,

169
00:08:56.485 --> 00:09:01.810
of all the days afterwards where I had to
apologise to so many people,

170
00:09:01.810 --> 00:09:03.560
the root cause wasn’t one typo.

171
00:09:03.560 --> 00:09:05.730
It was the overconfidence and negligence

172
00:09:05.730 --> 00:09:08.690
that meant I didn’t have any way to undo
my mistakes.

173
00:09:08.690 --> 00:09:11.500
It’s the sort of lesson you only learn once.

174
00:09:11.500 --> 00:09:15.810
Programmers and anyone who works with software,
we have this magical ability to undo.

175
00:09:15.810 --> 00:09:20.370
No professional that works with physical,
real-world things has that option.

176
00:09:20.370 --> 00:09:25.270
So if you don’t have a backup of your code,
or your thesis, or the photos on your phone,

177
00:09:25.270 --> 00:09:27.960
or your database, get a backup.
Don’t put it off for the future.

178
00:09:27.960 --> 00:09:31.450
And if you do have one ready: check it works.

179
00:09:31.450 --> 00:09:37.250
Because you don’t want to have the same
feeling of: oh, no.

180
00:09:37.250 --> 00:09:39.120
If you're techie enough to make it to the
end of this video,

181
00:09:39.120 --> 00:09:41.810
then you should definitely be using
a password manager.

182
00:09:41.810 --> 00:09:46.370
Every so often you'll see a big news article
about how a company's had a security breach

183
00:09:46.370 --> 00:09:48.890
and, yeah, sometimes, that's what's happened,
but other times,

184
00:09:48.890 --> 00:09:52.800
it's just that someone's found or bought a
list of usernames and passwords

185
00:09:52.800 --> 00:09:55.320
from another security breach
at a different company,

186
00:09:55.320 --> 00:09:59.090
and is just trying all of them
to see if there are any matches.

187
00:09:59.090 --> 00:10:03.090
Reusing the same password,
or variations on it, is a bad idea.

188
00:10:03.090 --> 00:10:04.890
So I recommend Dashlane as a password manager,

189
00:10:04.890 --> 00:10:06.890
partly because they are sponsoring this video,

190
00:10:06.890 --> 00:10:09.640
but also because I've read their security
white paper.

191
00:10:09.640 --> 00:10:12.790
And so have a lot of other people who know
more about cryptography than me.

192
00:10:12.790 --> 00:10:16.880
Being able to easily use long, complicated,
symbol-filled passwords

193
00:10:16.880 --> 00:10:19.120
that are different for every
web site and app,

194
00:10:19.120 --> 00:10:22.080
automatically synchronised across
iOS, Android, Windows, Mac and Linux,

195
00:10:22.080 --> 00:10:24.029
is incredibly useful.

196
00:10:24.029 --> 00:10:28.480
Plus they'll autofill credit card info and
personal details if you want.

197
00:10:28.480 --> 00:10:32.570
And if you're working from home right now
for some big company, then sure,

198
00:10:32.570 --> 00:10:36.750
your company's IT might be working great,
but maybe you're in the person where

199
00:10:36.750 --> 00:10:40.960
you've got ten people who all need to share
an account on some other company's service.

200
00:10:40.960 --> 00:10:45.390
The one person who knows the password can't
just walk over to your desk and log you in any more.

201
00:10:45.390 --> 00:10:48.240
So instead of sending that password over email,
or Slack,

202
00:10:48.240 --> 00:10:50.650
or calling someone up
and having them write it down:

203
00:10:50.650 --> 00:10:54.520
Dashlane for Business lets teams of people
share passwords securely.

204
00:10:54.520 --> 00:10:58.370
Go to www.dashlane.com/tomscott
to try Dashlane for free,

205
00:10:58.370 --> 00:11:01.630
and you can use my code tomscott for 10% off
Dashlane Premium,

206
00:11:01.630 --> 00:11:02.910
and to support this channel.

