text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
And as you might imagine intuitively, you
1,489.07
2.205
could sort of control click or right click on this.
1,491.275
2.125
And this little menu pops up.
1,493.4
1.19
You can download the file, run it, preview it, refresh, rename,
1,494.59
2.58
or what not.
1,497.17
0.53
>> And I could just delete, and it would go away.
1,497.7
2.56
But let's do things with a command line for now, so as to get comfortable
1,500.26
5
with this, and do the following.
1,505.26
1.75
I'm going to go ahead and remove a.out by typing literally rma.out.
1,507.01
5.335
It turns out, the command for removing or deleting something,
1,512.345
2.545
is not remove or delete.
1,514.89
1.39
>> It's more succinctly RM, just to save you some keystrokes, and hit Enter.
1,516.28
4.98
Now we're going to be somewhat cryptically remove regular file a.out.
1,521.26
3.447
I don't really know what an irregular file would be yet.
1,524.707
2.333
But I do want to remove it.
1,527.04
1.62
>> So I'm going to type y for yes.
1,528.66
1.49
Or I could type it out, and hit Enter.
1,530.15
1.79
And, again, nothing seems to happen.
1,531.94
1.5
But that is, generally, a good thing.
1,533.44
2.4
>> If I type LS this time, what should I see?
1,535.84
4.65
Hopefully, just hello and hello.c.
1,540.49
4.44
Now, as an aside, you'll notice this star, asterisk,
1,544.93
2.356
that's at the end of my programs.
1,547.286
1.374
And they're also showing up in green.
1,548.66
1.541
That is just CS50 IDE's way of cluing you into the fact
1,550.201
3.769
that that's not source code.
1,553.97
1.31
That's an executable, a runnable program that you can actually run
1,555.28
3.6
by doing dot slash, and then it's name.
1,558.88
2.14
>> Now, let me go ahead and remove this, rm hello, Enter, remove regular
1,561.02
4.84
file hello, yes.
1,565.86
2.15
And now if I type LS, we're back to hello.c.
1,568.01
3.17
Try not to delete your actual source code.
1,571.18
2.737
Even though there are features built into CS50 IDE where
1,573.917
2.333
you can go through your revision history and rewind in time if you accidentally
1,576.25
3.62
delete something, do be mindful as per these prompts yes or no,
1,579.87
3.79
of what you actually want to do.
1,583.66
1.721
And if I go up to the top left hand corner here,
1,585.381
1.999
all that remains is hello.c.
1,587.38
3.316
So there's bunches of other commands that you
1,590.696
1.874
can execute in the world of Linux, one of which is, again, Make.
1,592.57
4.98
And we're going to Make my program now as follows.
1,597.55
2.63
>> Instead of doing clang, instead of doing clang-o,
1,600.18
3.09
I'm going to simply literally type, make hello.
1,603.27
2.59
And now notice, I am not typing make hello.c.
1,605.86
3.77
I am typing make hello.
1,609.63
1.28
>> And this program Make that comes with CS50 IDE, and more
1,610.91
3.93
generally with Linux, is a program that's
1,614.84
2.25
going to make a program called Hello.
1,617.09
2.03
And it's going to assume, by convention, that if this program can be made,
1,619.12
4.56
it's going to be made from a source code file ending in dot c, hello.c.
1,623.68
5.35
>> So if I hit Enter now, notice that the command that gets executed
1,629.03
3.18
is actually even longer before than before.
1,632.21
2.13
And that's because we've preconfigured CS50 IDE to have
1,634.34
2.33
some additional features built in that we don't need just yet, but soon will.
1,636.67
3.208
But the key thing to realize is now I have a Hello program.
1,639.878
3.592
>> If I type LS again, I have a hello program.
1,643.47
3.61
And I can run it with dot slash a.out, no,
1,647.08
4.99
because the whole point of this exercise was dot slash hello.
1,652.07
3.52
And now I have my hello world program.
1,655.59
2.499
So moving forward, we're almost always just
1,658.089
1.791
going to compile our programs using the command Make.
1,659.88
2.208
And then we're going to run them by dot slash, and the program's name.
1,662.088
3.212
But realize what Make is doing for you, is it is itself not a compiler.
1,665.3
4.31
It's just a convenience program that knows how to trigger a compiler
1,669.61
3.7
to run so that you yourself can use it.
1,673.31
3.16
>> What other commands exist in Linux, and in turn the CS50 IDE?
1,676.47
3.75
We'll soon see that there's a CD command, Change Directory.
1,680.22
2.887
This allows you within your command line interface
1,683.107
2.083
to move forward, and back, and open up different folders
1,685.19
2.42
without using your mouse.
1,687.61
1.25
>> LS we saw, which stands for list the files in the current directory.
1,688.86
3.61
Make Dir, you can probably start to infer
1,692.47
2.18
what these mean now-- make directory, if you want to create a folder.
1,694.65
3.5
RM for remove, RM Dir for remove directory-- and these,
1,698.15
3.12
again, are the command line equivalents of what you
1,701.27
2.89
could do in CS50 IDE with your mouse.
1,704.16
2.785
But you'll soon find that sometimes it's just
1,706.945
1.875
a lot faster to do things with a keyboard,
1,708.82
1.79
and ultimately a lot more powerful.
1,710.61
3.08
>> But it's hard to argue that anything we've been doing so far
1,713.69
2.75
is all that powerful, when all we've been saying is, hello world.
1,716.44
3.55
And, in fact, I hardcoded the words hello world into my program.
1,719.99
3.75
There is no dynamism yet.
1,723.74
1.79
Scratch was an order of magnitude more interesting last week.
1,725.53
3.79
>> And so let's get there.
1,729.32
1.9
Let's take a step toward that by way of some of these functions.
1,731.22
4.09
So not only does C come with printf, and bunches of other functions
1,735.31
4.16
some of which we'll see over time, it doesn't
1,739.47
2.38
make it all that easy right out of the gate in getting user input.
1,741.85
3.91
>> In fact, one of the weaknesses of languages like C,
1,745.76
2.38
and even Java and yet others, is that it doesn't
1,748.14
2
make it easy to just get things like integers from users, or strings, words,
1,750.14
5.72
and phrases, let alone things like floating point values, or real numbers
1,755.86
4.11
with decimal points, and really long numbers, as we'll soon see.
1,759.97
3.27
So this list of functions here, these are like other Scratch puzzle pieces
1,763.24
3.76
that we have pre-installed in CS50 IDE that we'll use for a few weeks
1,767
4.09
as training wheels of sorts, and eventually take them off, and look
1,771.09
2.92
underneath the hood, perhaps, at how these things are implemented.
1,774.01
3.2
>> But to do this, let's actually write a program.
1,777.21
3.25
Let me go ahead now.
1,780.46
1.31