Category Archives: Classes

Spring 2017 – Week 5 Class Notes

URGENT MESSAGE – NO CLASS NEXT WEEK – IF YOU ARE A STUDENT READING THIS TELL YOUR PARENTS ABOUT IT RIGHT NOW. I’ll email you later this week about it, but just wanted to put that out there up front.

As always, if you need more information or get stuck on anything, please feel free to email me!

Programming

This week in programming we looked at other properties of HTML elements we could modify using JavaScript. We made things move by modifying their CSS padding (you may want to look at the CSS chapter again), and then we animated the movement using the setTimeout function. setTimeout has two parameters – the first is the function you want to run, and the second is the number of milliseconds it should wait until it runs your function. Remember to just send the name of the function to run, or a function declaration (i.e., function(){ /* function here */ }). If you call the function when you send it, it does not do the right thing! In other words, we did setTimeout(moveme, 20);. We DID NOT do setTimeout(moveme(), 20); The latter one would call moveme once, and setTimeout would probably signal an error because it would receive a null (the function’s return value) instead of the function itself.

We are basically past the end of the book at this point (we skipped one chapter that we may return to), so for your reading this week we are going to start reading web tutorials. Most of what you need to learn to program is available on the web, and practicing learning from other people’s documentation is a good habit to learn.

One thing we did not cover in class is why we had to use setTimeout instead of a simple loop. The main reason is that JavaScript does a lot of stuff for us while we aren’t looking (watching for button clicks, scrolling the page, redrawing the screen, etc.). However, it can’t do these things while we are occupying the processor. So, when we do a setTimeout, we are allowing the computer to go about its business doing other necessary things (including drawing the change we made) while we wait for the next time to do our iteration. However, the same sorts of things we have in loops are needed with setTimeout – we need initialization, we need a condition to know when we need to stop, etc. It’s just that, in this case, “stopping” is just not calling setTimeout again.

So, for your reading this week, I want you to read through these two documents:

  • A list of JavaScript HTML events (focus on the “mouse events” section, but also look around to see what the other possibilities are; also note that the event name in the list is mouseout but in JavaScript we will install the handler with an “on” prefix, like element.onmouseout = myfunction;)
  • A list of CSS styles (you don’t need to read all of them, but pick out 2 or 3 sections of this to read in detail; remember to use the camelcased name of the CSS style in JavaScript, and to attach it to the element’s style property)

What I want you to do this week is read through these, and then write two short programs demonstrating these new event handlers and CSS properties. As an example, there is a double-click event. There is a font CSS property. So, I could have a program that, on double-click of something, changed the font. If you can add in animations, that would be good for practice as well.

Electronics

This week we did RC (resistor-capacitor) circuits, focusing on the RC time constant (note – it takes 5 RC time constants to fully charge a capacitor). I rechapterized the book this week, so previous chapter numbers do not apply. The chapter to read / work this week is Chapter 19. I would like everyone to bring in their box the final project in the chapter, whose schematic is in Figure 19.4 or as best/close as you can. Next week we will introduce oscillators.

Also, this week we are using the voltage comparator chip. Since it is still winter, you all have static electricity in your bodies that can damage the chip, so be sure to touch something metal before working with the comparator chip to discharge any static electricity and keep the chip intact.

Calculus

This week we went through infinite series again using both Taylor series and McLaurin series. I’ll have more here and in the book later this week.

Spring 2017 – Week 4 Class Notes

All of the classes have finished our reviews from the last semester, and are heading out into new material. Be thinking about what sort of classes you all might be interested in over the summer. Last summer we did all entry-level projects, but this summer we will have students that have the skills to do more advanced work if you all are interested.

Computer Programming

This week we focused on HTML generation from an array. We looked at how to (a) look at a web page and find structural repetitions, (b) convert those into data items, and (c) write JavaScript functions that convert the data into HTML. Not only is this a good programming exercise, this sort of technique is at the core of how the web is built. It may not seem useful with small datasets, but as the datasets grow larger, the ability to separate out what the data is and how it works together in a page is crucial to working with data of all kinds. Eventually, you learn how to convert those arrays of data into databases, and then you will be able to have other people add items to your database, and have it generate pages for you. At the core of all of this is what we did in class today.

Also remember that we looked at several methods for attaching functions to objects. The one we focused on today used the “this” implicit parameter. We also talked about how you can store JavaScript objects into HTML elements. This is a great technique, though store data objects into HTML elements is a bit clunky. The other method we looked at involved calling a function and creating variables that our callback function will have access to. We will go more in-depth on that next week. In any case, you will need to do one of these two methods for your final class project.

For this week, we are again looking at chapter 15. Do the final exercise in that chapter for class next week. Also, just to remind you, we used the “onmouseover” and “onmouseout” events to do the colors, and used the “style.color.backgroundColor” field of our element to change out the background colors.

Electronics

This week we started capacitors. A new version of the book is ready to download, and capacitors are in Chapter 17. I’m not sure if this is anywhere in the book, but remember that:

  • milli means 1/1,000
  • micro means 1/1,000,000
  • nano means 1/1,000,000,000
  • pico means 1/1,000,000,000,000
  • just for fun, femto means 1/1,000,000,000,000,000, but you would never use it unless you were developing integrated circuits

Next week we will build timers and oscillators with capacitors.

Calculus

This week we covered infinite series and solving unsolvable integrals with them. The type of series we used today were called Maclaurin series. Next week, we will look at a more general type of series representation.

For homework, I will load the “Integration by Parts” chapter with homework problems this weekend.

The most important thing to remember is that if someone says something is impossible, there are usually implicit boundaries that are making it impossible, and perhaps the impossible becomes possible when those boundaries are removed.

Have a great week everyone!

Spring 2017 – Week 3 Class Notes

After this week, the review time for all the classes will be over. Next week – all new things!

Computer Programming

This week we covered more about interacting with web pages. We worked with manipulating HTML elements on the page, including adding events to divs and inputs. The onclick event for buttons allows us to attach a function to a button. The onmouseup event allows us to perform an action whenever someone types something in an input field. The onmouseover and onmouseout events allow us to track when the mouse is over any HTML element. There are numerous events you can use. They all pretty much have are used the same way – use document.getElementById() to find the element in the page, then set its event function to be whatever function it is you want it to do. You can also use the function() keyword to create a function right there and it doesn’t need a name.

You can also access an HTML element’s style information through its “style” property. You can do elem.style.backgroundColor to set the background color to whatever you want. It can use pretty much any CSS value, you just have to convert the dashed named to camelcase (i.e., “background-color” becomes “backgroundColor”).

Also, we covered document.createElement() to create new HTML elements and using appendChild to attach them to existing elements on a page.

We also talked about the Model/View/Controller paradigm. The “View” is what you see – the HTML page. The “model” is how you conceptualize what is happening. Then, the “controller” shuffles data and actions back and forth between the model and the view.

We are doing chapter 15 again, trying to get further on the problems. You can save #3 for next week.

Electronics

We reviewed diodes and covered power again. Most complicated circuits in the “real world” are really just the simple circuits we learn here put together in a variety of ways. Therefore, being familiar with how these different circuits operate, and being able to spot them, will help you beyond just this class.

For diode circuits, we talked about using them to (a) regulate the direction of current, (b) provide a fixed voltage reference, and (c) using LEDs to make lights. Current limiting resistors are almost always needed in diode circuits because otherwise the diodes will form a short circuit.

For power, we talked about energy, work, and power. This week, read chapter 15 and do the problems on power.

Next week, we will begin our look at small-signal AC circuits, looking at how capacitors work.

I forgot to do videos last week. Here are some diode videos:

Here are some videos on electric power:

Calculus

This week we covered integration by parts. That is chapter 21. Remember, integration by parts doesn’t solve the integral, it rewrites the Integral into a new one that is hopefully easier to solve. Also remember that you may have to do integration by parts multiple times!

Spring 2017 – Week 2 Class Notes

Another week is in the bag! It was good to see you all, and I’m glad to see you all keeping up with your work.

Computer Programming

This week we reviewed objects (and a little arrays) and then talked about the built-in objects in JavaScript for interfacing with web pages. The main object used is “document”, and the main function that bridges the gap between JavaScript and HTML is “getElementById”. A lot of you kept thinking that the “innerHTML” function plays a role, probably because of the word “HTML” in the function name. “innerHTML” is actually rarely used. getElementById takes a string, and finds and returns an HTML element having that string as an ID. It doesn’t matter what your variable is called, it only matters that the string you pass to getElementById matches the string you put in the id=”” attribute of your HTML element.

Another thing I noticed is that I think there was some confusion on the “return” statement. When a “return” happens – that’s the end of the function! Nothing else occurs after the “return” statement. We often put it at the end of our function (and there is usually one there), but technically you can return from anywhere in your function. There can even be multiple returns, based on conditions. But as soon as the return runs, the function is over.

This week we are working on chapter 15. Don’t forget to email if you run into trouble!

Electronics

This week we reviewed diode action and practiced our measurement skills with our multimeter. Every did well. This week review chapter 8 and do the problems at the end. Next week we will focus on power.

Calculus

Read chapters 18 and 19. I don’t have problems for that yet, but I might get some done over the weekend so check back Monday.

Spring 2017 – Week 1 Class Notes

Welcome back everyone! I was happy to see everyone this week, and am looking forward to a great semester. Last semester, posting class notes online each week worked out well, so we are just going to focus on that for the week.

Computer Programming

To get back in the swing of things, for computer programming you should re-read Chapter 13. The “Apply” section has a description of how to make a simple web store. Implement as much of that as you can. This will be the starting point for the first semester’s assignment.

Electronics

Everyone seemed to be very much on the ball with electronics today. The chapter we are going to review is chapter 7. Please read chapter 7 and do the homework for this chapter and bring it to class.

I mentioned I would link to videos each week. Since we are reviewing, here are some videos from Make introducing the basics:

Here is a video on calculating series/parallel resistances:

Here are videos on Kirchoff’s Laws:

Calculus

So, for this week, to review, start by reviewing the table of derivatives in Appendix F.3. Review chapter 11 and 12, and do the problems at the end of chapter 12.

Fall 2016 – Week 15 Class Notes

You survived the semester finals! Congratulations to each of you. You have all made many gains this semester, and I am looking forward to next semester. I will be making a semester summary sheet for each of you describing your performance in the course.

The finals went really, really well. Everyone did well in all of the finals (I haven’t graded the Calculus one yet, but it looked like you all were doing well), and I think you all have made significant improvements in your learning.

Looking forward to next semester!

Fall 2016 – Week 14 Class Notes

Next week is semester finals week!!! Be sure to read the notes with instructions for your class. All finals are open-book and open-note. Everyone should have the schedule and prices for next semester. Email me if you lost yours. Email me with any questions you have on the finals.

Computer Programming

DON’T FORGET – bring your section 3 assignment.

For the final, I will give you a selection of two or three possible programs, and you will choose one to build. You may bring your book or any other tool. Just remember, using a tool (like the book) reduces the amount of time that you have to actually work, so you will always do better knowing the material than trying to re-read it.

Next semester we are going to focus on interacting with web pages, and external web sites (like Google Maps).

Electronics

You should *already* be working on your final. The final is in two parts. The first part you should do at home – draw up a schematic for one of the projects I gave you in class. If you need the sheet again, email me. You should also calculate the voltages and currents in each part of your circuit. You can calculate power, too, if you want, but it is not required for the final. Note that it is okay if there are some components needed to build your circuit that aren’t in your kit (i.e., specific resistor and diode values). I can supply those myself for the second half of the final. Be sure to have TWO copies of your schematic.

The second half of the final will be done in-class. You will hand in both of your schematics to me, and one of them will go to someone else to build. You will receive someone else’s schematic. Your job will be to build the circuit from the schematic, and measure voltages and currents at three points in the circuit. If you finish early, you can do additional schematics for extra points (up to three).

Next semester we will work on power circuits, oscillation circuits, and audio circuits.

Calculus

The Calculus exam will be pretty boring. We will not do u-substitution on integrals or the product rule for integrals. You do not need to read any chapters this week, just review the ones you have already read. You *do* need to be prepared to do related rates problems, maximization/minimization problems, and basic integral problems. You should be able to tackle any derivative given to you.

Next semester we will complete our study of integrals, do some advanced Calculus, and work on some special topics.

Email me with any questions!

Fall 2016 – Week 13 Class Notes

We have two more classes before the end of the semester, but NO CLASS NEXT WEEK for Thanksgiving!

Programming

We started working on object-oriented programming and arrays this week. Remember, the goal of objects is to package up a bunch of related information into a single unit. Whenever you have information about a subject that all belongs together, creating an object is a good way to go.

We also talked about arrays, which allow us to store sequences of values (usually, arrays are used to store similar values, but they don’t have to).

We need to be thinking about what we want to do next semester. Some options:

  1. Simple games in JavaScript
  2. Dealing with server-side programming
  3. Communicating with and using third-party services like Google maps

The start of the next year we will review and finish the book, but then we need to proceed to an application area.

For you to do this week:

  • Read chapter 13
  • Turn in your section 3 assignment

Electronics

For some reason, the Tennis game did not work on a lot of your devices. I am investigating this over the week. I have used this game several times before and it has always worked well, so we will figure it out.

I am working on the next book chapter, and will hopefully have it done by Friday (UPDATE – the chapter is now complete).

Please spend some extra time reviewing chapters you aren’t familiar with. A lot of you were not familiar with pull-down resistors, which is a requirement for knowing how to put this stuff together.

Calculus

Keep on trucking. We are going through chapter 17 this week.

Fall 2016 – Week 12 Class Notes

Somebody notified me that I had not posted class notes this week! Many apologies!

Programming

This week is chapter 12. It is a bit esoteric, so if you don’t understand it all the way, that’s fine. Save it for later in your programming career – you will have questions about how something is working, and you can come back to this chapter and say, “aha! That is what was being discussed!” It is included where it is simply because we are talking about functions and scopes, and a lot of people in JavaScript use scopes in funny ways, and this will help you understand what is going on if you read someone else’s code.

Next week we are getting into objects and arrays, which will both greatly expand your programming abilities, and should also be back to a topic that is more in line with your common intuitions.

Electronics

We did an analog Arduino example in class, so read the corresponding chapter (chapter 14). This next week we are going to do one more Arduino lesson, and then we will get back to normal electronics.

Calculus

Not much to say – chapter 16 is next!

Fall 2016 – Week 11 Class Notes

We are approaching the end of the semester! I do not have plans for next semester laid out yet, but current plans are to keep the same time/place. Computer programming will be mostly through the book, so we will have to imagine something new together – maybe do a small JavaScript-based video game, or do some project-oriented JavaScript. Electronics will focus on power, motors, and probably audio. Calculus will go into more depth on the topics we have covered so far. Anyway, for this week:

Computer Programming

We have reached the point in computer programming which requires a lot of abstract thought. I see that some of you are struggling with the concept of functions. First of all, functions have a very specific syntax. You need to be sure you know how how it works. You need to understand the role of parameters, local variables, and return values.

Some people are confused by the stack. Remember that computers are stupid. Conceptually it is fairly simple – every time you call a function it gets its own scope with its own set of local variables, and when it is done it has to “return” the place that it was called from. However, when the JavaScript language implements this, it has to be very specific about how it happens. That is where the stack comes in. The stack is *how* JavaScript implements giving functions their own scope of local variables, and *how* JavaScript knows where to go back to. As a programmer, you will never directly access the stack – that is merely so that you know what JavaScript is doing to enable the magical ability to call functions and return to where you were when it is done. Knowing how it is implemented will be important in the next chapter when we do some more advanced things with it.

Remember that this is the second week to go over chapter 11. If you are struggling you should review chapter 10 as well. Remember, I am available for email consultation if you need it! The Section 3 assignment will be due on November 16th.

Electronics

Today we introduced the Arduino. Be sure to download the Arduino environment and the USB drivers to do your homework. We are not going to be spending much time on the Arduino as it is more programming than electronics, but if you want to know more there are a bunch of links here.

This week we are doing *two* chapters – 12 and 13. They are both very short, and we did most of the projects in class. I will grade your quizzes this week.

Calculus

We started Integrals this week! Remember to finish your quizzes, and then read the first chapter on Integrals.