Posts

Showing posts from October, 2022

StanfordCS101: Digital Images Lecture 4

Image
  Digital Images In this section we'll look at how digital images work. Digital Images Digital images everywhere Look natural, rounded Behind the scenes: lots of little numbers You see images on computers all the time. Here we will look behind the curtain, seeing how images are put together. What looks like a whole image to us, in the computer is a structure made of many little numbers. Here is an image of some yellow flowers: Zoom In - Pixels Zoom in 10x - small square "pixels" Pixel one solid color, quite small Perceive the whole scene, not tiny pixels Image 800 pixel wide, 600 pixels high image   Multiply .. 480,000 pixels (about 0.5 "megapixels") Digital camera 5-20 megapixels Zooming in on the upper left flower, we can see that it is actually made of many square "pixels", each showing one color. Each pixel is a small square that shows a single color An 800 x 600 image is 800 pixels wide by 600 pixels high, 480,000 pixels in all (0.5 megapixels) Di...

Stanford CS101: Code Variables Lecture 3

Image
  Code Variables In this section, I want to add the idea of  variables  in code. A "variable" is like a box that holds a value x = 7; This stores the value 7 into the variable (i.e. box)  x Later  x  in the code retrieve the value from the box x  becomes a shorthand for 7 (whatever is in the box) Using = in this way is called "variable assignment" Variables in CS101 How we use variables in CS101: -Assign a value into a variable once -Then use that variable many times below A convenient shorthand in the code x=7;  print("lucky",x); print("x is", x);        7 lucky  7 x is  7   Experiments:  try assigning (=) these values to x: 8, "hi" Store a value once, use it on several lines, saving repetition = in algebra is different, two things are equal forever = in code is simple, just puts a value in a box when run Variables work as a shorthand -- we = assign a value into a variable, and then use that variable on lat...

StanfordCS101: Code writing Lecture 2

Image
  Code Writing In this section, write some code and run it Every action in the computer comes down to code To understand the nature of computers... You have to play with code a little Code  refers to the language the computer can understand. For these lectures, we'll write and run short snippets of code to understand what the essential qualities of computers, and especially their strengths and limitations. Experimenting with code, the nature of computers will come through very clearly ... powerful in their own way, but with a limited, mechanical quality. IMHO, this mixed nature of computers is something everyone should understand, to use them well, to not be intimidated by them. Before Coding - Patience We'll start with some simple coding below First code examples are not flashy Code is like lego bricks... -Individual pieces are super simple -Eventually build up great combinations But we have to start small Foreshadowing Within a few hours of lecture, we'll be writing simpl...

Stanford CS101 Introduction : Lecture 1

Image
  Stanford CS101 Introduction Nick Parlante - Stanford University ( Nick's Home Page ) CS101 on Stanford Online Basic ideas of how computers work Not a magic box, basics understandable Look inside, how they work (play) Understand what they can do No computer background required at all  Curious .. next step This class explores the essential qualities of computers, how they work, what they can and cannot do, and requires no computer background at all. Acknowledgements: thanks to Google for supporting my early research that has helped me create this class. Format note: Video + Document Each video has a companion written document Written explanations, diagrams, live code examples Switch or revisit the document from the video Review, curious about link ... it's all there Fundamental Equation of Computers The fundamental equation of computers is:   Computer = Powerful + Stupid Powerful - look through masses of a data -Billions of "operations" per second Stupid  -Opera...