Monthly Archives: March 2017

Spring 2016 – Week 8 Class Notes

We are over halfway done with the semester, and coming upon the end of the year! We are getting tight for time to work on things, but I don’t want to rush things, either.

Computer Programming

This week we discussed your project. Here is what I would like to see for next week in addition to the homework below:

  • Start with an array of objects representing products.
  • Build a program to generate an HTML product list from the array.
  • The product list should include a “Buy” button.
  • The “Buy” button can simply show an alert, but it must show product information.

That last bit was what we talked about this week. We’ve discussed it before, but it bears repeating. The problem is that (a) all of the buttons share the same code for creating the onclick function, (b) the onclick function takes no parameters, but (c) we have to be able to grab the data that is specific to the button that was created. There are two primary ways to do this:

1) Store the data on the HTML element

When you create the button, attach extra data to the HTML button element either containing the whole product object, or at least the code of the product so you can look it up. Then, use the “this” implicit parameter within your function to refer to the product.

2) Create a new scope to store the information, and create the onclick function in that scope. This way, any information present in that scope will be available within the onclick function.

The homework this week is to type out two programs that illustrate this point. Please take some time to think through the programs and understand how they work. Then you can implement the ideas in the project for the week. Please bring both these typed out programs and the work on your project so far to class next week.

Program 1 (attaching information to the button) – HTML and Javascript

Program 2 (using a new scope) – Javascript (HTML is the same)

Electronics

I’m glad everyone got their tone generator working in class! This week, we covered the differences between making light outputs and sound output. The two big differences were that (a) we used a capacitor to convert our DC Biased oscillations into pure AC oscillations, and (b) we calculated the power output in watts, because the speakers have a resistance to them. We didn’t actually do the calculations in class, but they are just the same as the calculations previously – the current to the headphones times the voltage across the headphone’s resistance. Some of you had really loud projects – I would suggest increasing the output resistor in that case. Even though the picture is with a 9V battery, I actually designed the circuit around a 5V source, and didn’t think about what the adjustment would be. You might take a look at the calculations and retry them for a 9V source to see just how much power is flowing through there.

This week, read Chapter 21 and do the exercises. NOTE – even if you read the chapter last week, you should re-read it this week, as it is quite different.

Calculus

This week was L’Hospital’s Rule. Read and do the homework on chapter 28. I will try to post the answers for Chapter 21 later this week.

Spring 2016 – Week 7 Class Notes

Next week is Spring Break! Don’t come to class because we are not having it! You can spend the time catching up on things you had issues with. Don’t forget to email me if you have questions on the material.

Programming

This week we spent some more time on the program that we worked on last time. We are a little behind, so don’t worry about the assignment that is due on the syllabus. I think we are going to go over it in stages starting next week.

If you have not finished last week’s homework, do so this week. If you only got part-way, see if you can go further. If you have everything working, try to trace through the program, and list out every variable (in every scope!) to make sure that you know what is happening. See what happens every time it goes through the loop, and make sure you understand how the scoping mechanisms keep the different positions of the different things on the screen from bumping into each other.

Electronics

If you did not do the homework for the previous week, focus on that this week. There is a new chapter to read, but I am still going to add updates to the same chapter for next week. Don’t do the problems yet, as they will probably change, and I am going to be a little more specific on some of the math. Nonetheless, you should read it for our next class together.

Calculus

I will add questions to the chapter you all read last week this weekend. So check back in next week for the problems.

Spring 2017 – Week 6 Class Notes

Greetings students! We managed to pack a lot in this week, and I hope you all had as good of a time as I did. As always, email me if you get stuck or have questions.

Programming

This week we looked at animations using absolute positioning, as well as applying animations to arbitrary HTML elements. A few things to remember:

  • The CSS style “position: absolute” means that your element will be laid out on the current coordinate space somewhat independent of where it exists in your document.
  • The CSS style “position: relative” defines a new coordinate space for absolutely positioned elements (the default coordinate space being the whole document).
  • The CSS styles “left” and “top” are used to mark how many pixels from the left and from the top you are. “left” is like the x-coordinate. “top” is like the y-coordinate, except that it increases as it moves down. “left: 0px; top: 0px;” positions your element at the top-left corner of the coordinate space.
  • Remember that we can use function-creating-functions to create new local variable spaces which can store information so that it doesn’t have to be passed in a function.
  • The setTimeout function is used for animation. For the animation to work, it has to both move the things, and call setTimeout.

Since we didn’t have time for everyone to finish the movement app, the assignment this week will focus on typing that in. I have screenshotted the code (so you have to retype it, hahahahaha!). What I want you to do this week is:

  1. Type in the code for the app. The HTML is here. The JavaScript is here.
  2. If you have any problems with it, be sure to use your browser’s JavaScript console to see where the problem might be.
  3. After you get it working, see if you can create a function that can be attached to “onclick” methods of elements so that, if clicked, the element starts to move using this function.
  4. Create a page with at least three different elements that get onclick’s attached so that they can move like this.
  5. If you are really adventurous, try creating your own animation that you can apply when clicked. Even try animating something other than position. You can use this CSS reference to find CSS attributes you might want to animate.
  6. Electronics

    This week we took our knowledge of RC time circuits and applied them to oscillating circuits. We learned to use the NE555 timer, which continually charges and discharges a capacitor to measure the timing for its oscillations.

    This week, read chapter 20, which provides a more in-depth explanation of oscillator circuits. This chapter is a little more math heavy, but it is mostly just an extension of the RC time circuit calculations that we did in the last chapter.

    Calculus

    Many apologies to my calculus class for the numerous interruptions during class time, and for issues with the book last week.

    As we mentioned last week, we have done a lot of work and covered many topics this year. There are a few I want to revisit, but I also want to see how well you all do on other people’s calculus problems. Therefore, we are going to start looking at AP Calculus exams to see how well you are progressing.

    So, for this week, I want you to:

    1) Read chapter 22 (Advanced Uses of the Integral). There are no problems in this section, but you should work through the examples.

    2) Download the AP Calculus exam. Look through the AB exam (not the BC). Work through the problems you know how to do, and make note of which ones you don’t. We will bring these to class to discuss.