teaching machines

CS 145 Lecture 16 – Arrays

Agenda named data vs. numbered data arrays mapping month numbers to names the birthday problem Code Birthdays Birthdayarator.java package lecture; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Birthdayarator { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File(“/home/cjohnson/Desktop/bdays.txt”)); String[] names = new String[12]; names[0] = “January”; names[1] = “February”; […]

CS 491 Lecture 17 – Falling Math

Agenda issue camera and gallery intents recognize speech write a custom speech recognizer write a gesture recognizer Falling Math Our next app will satisfy several of your requests from your apps wish list: a Space Invaders game, incorporation of novel mobile hardware, and some 2-D drawing stuff (though not much). What’s the app? Well, mathematical […]

CS 491 Lecture 16 – Wevents Part V

Agenda Post-haste I never got notes written when this post was first published. These are being written two months later. They won’t flow. Flushing remote changes When a user changes a calendar event, we always commit it to the local database first. This caching scheme is called writeback; we make our changes to the cache […]

CS 145 Lecture 15 – More colliding

Agenda meet JFrame and company collide circles collide rectangles Code CollisionUtilities.java package lecture; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class CollisionUtilities { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File(“/home/cjohnson/Desktop/lines.txt”)); while (in.hasNextDouble()) { double leftA = in.nextDouble(); double rightA = in.nextDouble(); double leftB = in.nextDouble(); double rightB = […]

CS 145 Lecture 14 – Testing and conditionals via collision detection

Agenda lab switcharoo collision detection test-driven development Collision detection Code CollisionUtilities.java package lecture; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class CollisionUtilities { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File(“/home/cjohnson/Desktop/lines.txt”)); while (in.hasNextDouble()) { double leftA = in.nextDouble(); double rightA = in.nextDouble(); double leftB = in.nextDouble(); double rightB = […]

CS 491 Lecture 15 – Wevents Part IV

Agenda schedule mobile OS talks inserting and editing adding a cache marshalling compound data detecting a network connection pushing changes Problem We mentioned last time that the advantage of an IntentService + ResultReceiver over an AsyncTask is only seen when the background task does more than update the UI, like maintain a local cache. Such […]

CS 491 Lecture 14 – Wevents Part III

Agenda write an AsyncTask AsyncTask vs. IntentService + ResultReceiver handling ResultReceiver configuration changes saving instance state adding a ListActivity hello, JSON add events AsyncTask In these days of big data, complex computation, and networks, we have need to perform background tasks whose results affect the UI. As UI stuff can only be done on the […]

CS 145 Lecture 13 – Loop tricks

Agenda which loop when? conditioning on sentinel values fencepost loops nested loops Code ForAWhile.java package lecture; import java.util.Scanner; public class ForAWhile { public static void main(String[] args) { // String command = “notdone”; // for (Scanner in = new Scanner(System.in); !command.equals(“done”); command = in.next()) { // } String command = “notdone”; Scanner in = new […]

CS 145 Lecture 12 – Conditionals and file input

Agenda generating an ordinal number if/else if reading from files (brief treatise on exceptions) test-driven development categorizing light Code Ordinals.java package lecture; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Ordinals { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File(“/home/cjohnson/Desktop/ordinals.txt”)); while (in.hasNextInt()) { int i = in.nextInt(); String expected […]

CS 491 Lecture 13 – Wevents Part II

Agenda design an app for managing family events hook up to a remote database merge PostgreSQL, PHP, JSON, and Android Ice Cream Sandwich It was unveiled yesterday. Asynchronous networking Okay, our database backend is in order. Our PHP scripts will serve as the bridge between the database and clients, who will perform all transactions through […]

1 105 106 107 108 109 110