CS1315: Introduction to Media Computation

CS1315: Introduction to Media Computation

CS1315: Introduction to Media Computation Introduction to JES Installation Installing JES and starting it up Windows users:

Mac users: Just copy the folder Double-click JES application Just copy the folder Double-click the JES application

Fill out the form for turnin (can always change it later) There is always Help Lots and lots of excellent help We will program in JES JES: Jython Environment for Students

A simple editor (for entering in our programs or recipes): Well call that the program area A command area for entering in commands for Python to execute. JES - Jython Environment for Students Program Area Command Area Tour of JES

Save and Save As Cut/Copy/Paste with shortcut keys Turnin You must be on-line to turnin! You will use this first with Lab 2

Help Explain is contextualized help: Highlight a JES (media) function Lots of help on mediatools and the like Python understands commands We can name data with = We can print values, expressions, anything with

print Using JES >>> print 34 + 56 90 >>> print 34.1/46.5 0.7333333333333334 >>> print 22 * 33 726 >>> print 14 - 15 -1 >>> print "Hello" Hello >>> print "Hello" + "Mark"

HelloMark Command Area Editing Up/down arrows walk through command history You can edit the line at the bottom Just put the cursor at the end of the line before hitting Return/Enter. Demonstrating JES for files and sounds

>>> print pickAFile() /Users/guzdial/mediasources/barbara.jpg >>> print makePicture(pickAFile()) Picture, filename /Users/guzdial/mediasources/barbara.jpg height 294 width 222 >>> print pickAFile() /Users/guzdial/mediasources/hello.wav >>> print makeSound(pickAFile()) Sound of length 54757 >>> print play(makeSound(pickAFile())) None >>> myfilename = pickAFile() >>> print myfilename /Users/guzdial/mediasources/barbara.jpg >>> mypicture = makePicture(myfilename)

>>> print mypicture Picture, filename /Users/guzdial/mediasources/barbara.jpg height 294 width 222 >>> show(mypicture) Writing a recipe: Making our own functions To make a function, use the command def

Then, the name of the function, and the names of the input values between parentheses ((input1)) End the line with a colon (:) The body of the recipe is indented (Hint: Use two spaces) Thats called a block Making functions the easy way

Get something working by typing commands Enter the def command. Copy-paste the right commands up into the recipe A recipe for playing picked sound files def pickAndPlay(): myfile = pickAFile() mysound = makeSound(myfile) play(mysound) Note: myfile and mysound, inside pickAndPlay(), are

completely different from the same names in the command area. Blocking is indicated for you in JES Statements that are indented the same, are in the same block. Statements that are in the same block as where the line where the cursor is

are enclosed in a blue box. A function for playing picked picture files def pickAndShow(): myfile = pickAFile() mypict = makePicture(myfile) show(mypict) The Most Common JES Bug: Forgetting to Load

Your function does NOT exist for JES until you load it Before you load it, the program is just a bunch of characters. Loading encodes it as an executable function Save and Save As

You must Save before Loading You must Load before you can use your function What if you forget your variable names? showVars() MOST IMPORTANT THING TO DO TO PASS THIS CLASS! DO THE EXAMPLES! Try them out for yourself. Try to replicate them.

Understand them EVERY WEEK, TYPE IN AT LEAST TWO OF THE EXAMPLES FROM CLASS To understand a program means that you know why each line is there. You will encounter all the simple-but-confusing errors earlyBEFORE you are rushing to get homework done!!

Recently Viewed Presentations

  •  (  26)  P N         .            PNH   ( Clonal

    ( 26) P N . PNH ( Clonal

    از تست ( Water Suger test) Sucrose lysis test تشخيص قطعي بر اساس اثبات فلوسيتومتريك فقدان عامل تسريع كنندة زوال مهار كننذة غشائي ليز واكنشي بر روي سطح گلبولهاي قرمز و يا لكوسيتها امكان پذير است.
  • Solving Difficult SAT Instances In The Presence of

    Solving Difficult SAT Instances In The Presence of

    Predicates Earlier work: By Crawford, Ginsberg, Roy and Luks (92,96) Not based on cycle notation for permutations Our construction is more efficient Every cycle considered separately In practice almost all cycles are 2- or 3-cycles Two types of 2-cycles: (aa')...
  • Intorduction to Project Management

    Intorduction to Project Management

    * L. K. Gaafar Activity Definition Activity Sequencing * L. K. Gaafar Duration Estimation Schedule Development * L. K. Gaafar Schedule Control L. K. Gaafar * L. K. Gaafar Critical Path Method (CPM) CPM is a project network analysis technique...
  • Paul Reveres Ride" belfry defiance gilded impetuous moorings

    Paul Reveres Ride" belfry defiance gilded impetuous moorings

    Cupola Campanile Bell Tower Dome Synonyms ? Spiritual Apparitional Illusory Spooky Synonyms ? Dismiss Dispel Disperse Separate Antonyms A place in a tower for a bell Disobedience, insolence, insubordination, rebelliousness Covered with gold or having the appearance of being covered...
  • Reactive Testing workshop - Electric Reliability Council of Texas

    Reactive Testing workshop - Electric Reliability Council of Texas

    GROSS . MW & MVAR (CT and PTs) Gross MW and MVAR Telemetered for IRR Testing. IRR units are modeled at the collector bus on the low side of the GSU . The gross reactive output is the measured value...
  • Menu Planning Tools - NYSED

    Menu Planning Tools - NYSED

    Green Beans. Pears. Fat Free Chocolate Milk. 1% White Milk. Make sure all information is up-to-date and accurately reflected on ALL menu planning documents. During reviews we often find discrepancies between menu planning documents. Make sure all of your menu...
  • Today - Monash University

    Today - Monash University

    Ask for participant responses re: their take-home messages from the workshop - and their own goals when it comes to improving feedback. It can be useful for participants to write down a key goal and take this away with them...
  • Exchange Rate Determination - NYU

    Exchange Rate Determination - NYU

    Exchange Rate Determination Basic approaches Parity conditions Flow (BOP) approach Stock (asset market) approach In addition, need to account for important social & economic events, such as: Infrastructure weaknesses, Speculation, Cross-border FDI, Foreign political risks. Flow (BOP) Approach Forex as...