Class Insanity

Car Repair Basics – Charging System

I’ve now had three classes is my Car Repair Basics class. We’ve just been covering the charging system, mainly batteries. I’ve learned a lot. Here are my notes.

When disconnecting a battery, ALWAYS disconnect the negative terminal first and then the positive terminal. And when reconnecting, first connect positive and then the negative one. If you can’t tell which is negative and which is positive, look at the relative sizes of the terminals. The positive one is larger.

When jumping a car connect the jumper cables in the following order:
1. Positive terminal on the good battery
2. Positive terminal on the bad battery
3. Negative terminal on the good battery
4. Connect the other end of the negative cable to some big steel part in the car with the bad battery (not the frame). Preferably a bit away from the battery. (GM says must be 21″ away.)
Then, start the good car and let it run for ~2 minutes. Then try to start the bad car. Disconnect the jumper cables in the opposite order above.

When buying batteries, the two things you’re going to look at are:
1. CCA (cold cranking amps) – always buy with ~50-100 more than the battery you’re replacing. For example, if my car currently has a battery with 650 CCA, it should be replaced with 700-750 CCA.
2. RC (reserve capacity) – amount of time (minutes) the car can run off the battery if the generator fails.

Note that alternator = generator. This provides current to the car after it’s running. You need the battery to get started and then it switches to get current from the generator (which also charges the battery).

In general, in Chicago, batteries tend to last ~4-5 years. Heat is much harder on a battery and in places like Las Vegas batteries will only last ~19 months.

A regular car battery is made up of 6 cells that each provide 2.1 volts. So a 100% charged battery should read 12.6V. A 75% battery will read 12.4V, a 50% battery will read 12.2V and a battery that reads 12.0V is dead and will not start the car.

My car is front-wheel drive, so the engine is mounted as what’s known as transverse or east-west. The front of the engine has a belt and it’s on the right side (passenger side). Rear-wheel drive cars can have their engines mounted north-south. On cars where the front of the engine is on the left side, it usually means that car is sold more in places where they drive on the left.

When the car is running, voltage is coming from the generator, even if you still measure it on the battery terminals. While the car is running, you’re looking for ~13-15.5V. Sometimes there’s surface charge on the battery if you measure voltage right after you turn the car off. You can turn the headlights on for a bit to get rid of that to get a more accurate reading.

When you press on the accelerator, you’re actually letting more air into the engine.

The wire coming out of the generator is always live.

AGM – new battery technology that doesn’t have liquid. It’s absorbed into a sponge-like material. One advantage to this is that they can be mounted sideways.

For rear-wheel drive cars, it’s called a transmission. For front-wheel drive cars, it’s called a transaxle. It’s the same thing though.

Voltage drops can be caused by bad connections in the circuit, the length of the cable or the gauge of the cable. If you measure the voltage between the positive terminal on the battery and the neg vs. the starter motor and neg, you might see a .02V drop. (As in you read 12.6 on the battery and 12.58 on the starter.) That’s ok. If you read 11.5V on the starter, there’s a voltage drop you need to fix.

If buying jumper cables, get at least 8 gauge. Even better though is to get a little thing that can start the car. (I forgot what this is called.)

AGM batteries are a little different than wet batteries. They are fully-charged at 12.88V. At 12.4V, they tend to sulfate more. And they’re more sensitive to ripple. 14.2-14.4V with > 2 amps can make the cells dry out. Need to be very careful with charging AGM batteries. 750mA or more ripple is too much for AGM. Advantage of AGM batteries is that they last a lot longer than wet batteries. (But they are more expensive.)

If when charging a battery, you smell rotten eggs. Immediately turn off the charger and disconnect the clamps. Be careful not to have any sort of spark. The battery is bad and should be replaced.

Next up: the braking system

Computing Ruby on Rails

Crazy Error

I just updated some rails webpages to 4.2.4. On one system, I didn’t have any trouble. But on the other one, things worked fine on my laptop, but gave all sorts of random errors on my production system. I started keeping a list to see if I could figure out what was going on. Here are some of the errors that I was seeing.

Assigning rec to a user
D, [2015-09-16T13:19:32.760059 #9687] DEBUG -- :   Applicant Load (0.5ms)  SELECT  `applicants`.* FROM `applicants` WHERE `applicants`.`id` = ? LIMIT 1  [["id", 1]]
E, [2015-09-16T13:19:32.760913 #9687] ERROR -- : Mysql::Error: : SELECT  `applicants`.* FROM `applicants` WHERE `applicants`.`id` = ? LIMIT 1
I, [2015-09-16T13:19:32.763318 #9687]  INFO -- : Completed 500 Internal Server Error in 34ms (ActiveRecord: 4.4ms)
F, [2015-09-16T13:19:32.765518 #9687] FATAL -- : 
ActiveRecord::StatementInvalid (Mysql::Error: : SELECT  `applicants`.* FROM `applicants` WHERE `applicants`.`id` = ? LIMIT 1):
  app/controllers/reference_documents_controller.rb:44:in `update'

Clicked on Admin
D, [2015-09-16T13:20:57.053182 #9687] DEBUG -- :   SQL (0.4ms)  UPDATE `users` SET `last_request_at` = ?, `updated_at` = ? WHERE `users`.`id` = ?  [["last_request_at", "2015-09-16 18:20:57"], ["updated_at", "2015-09-16 18:20:57"], ["id", 2]]
E, [2015-09-16T13:20:57.053291 #9687] ERROR -- : Mysql::Error: : UPDATE `users` SET `last_request_at` = ?, `updated_at` = ? WHERE `users`.`id` = ?
D, [2015-09-16T13:20:57.053591 #9687] DEBUG -- :    (0.1ms)  ROLLBACK
I, [2015-09-16T13:20:57.053942 #9687]  INFO -- : Completed 500 Internal Server Error in 8ms (ActiveRecord: 1.2ms)
F, [2015-09-16T13:20:57.055476 #9687] FATAL -- : 
ActiveRecord::StatementInvalid (Mysql::Error: : UPDATE `users` SET `last_request_at` = ?, `updated_at` = ? WHERE `users`.`id` = ?):
  app/controllers/application_controller.rb:15:in `current_user_session'
  app/controllers/application_controller.rb:20:in `current_user'

Clicked on Applicants
D, [2015-09-16T13:21:27.031430 #9687] DEBUG -- :    (0.3ms)  SELECT `reference_documents`.`firstname`, `reference_documents`.`lastname` FROM `reference_documents` WHERE `reference_documents`.`applicant_id` = ?  [["applicant_id", 1]]
E, [2015-09-16T13:21:27.031532 #9687] ERROR -- : Mysql::Error: : SELECT `reference_documents`.`firstname`, `reference_documents`.`lastname` FROM `reference_documents` WHERE `reference_documents`.`applicant_id` = ?
I, [2015-09-16T13:21:27.032374 #9687]  INFO -- :   Rendered applicants/index.html.erb within layouts/application (7.1ms)
I, [2015-09-16T13:21:27.032567 #9687]  INFO -- : Completed 500 Internal Server Error in 27ms (ActiveRecord: 12.1ms)
F, [2015-09-16T13:21:27.034208 #9687] FATAL -- : 
ActionView::Template::Error (Mysql::Error: : SELECT `reference_documents`.`firstname`, `reference_documents`.`lastname` FROM `reference_documents` WHERE `reference_documents`.`applicant_id` = ?):

Clicked on Upload Recommendation
D, [2015-09-16T13:22:25.859508 #9687] DEBUG -- :   SQL (0.3ms)  UPDATE `users` SET `last_request_at` = ?, `updated_at` = ? WHERE `users`.`id` = ?  [["last_request_at", "2015-09-16 18:22:25"], ["updated_at", "2015-09-16 18:22:25"], ["id", 2]]
E, [2015-09-16T13:22:25.859610 #9687] ERROR -- : Mysql::Error: : UPDATE `users` SET `last_request_at` = ?, `updated_at` = ? WHERE `users`.`id` = ?
D, [2015-09-16T13:22:25.859970 #9687] DEBUG -- :    (0.1ms)  ROLLBACK
I, [2015-09-16T13:22:25.860197 #9687]  INFO -- : Completed 500 Internal Server Error in 6ms (ActiveRecord: 1.0ms)
F, [2015-09-16T13:22:25.861710 #9687] FATAL -- : 
ActiveRecord::StatementInvalid (Mysql::Error: : UPDATE `users` SET `last_request_at` = ?, `updated_at` = ? WHERE `users`.`id` = ?):
  app/controllers/application_controller.rb:15:in `current_user_session'
  app/controllers/application_controller.rb:20:in `current_user'

I had run rake rails:update to get to these pages and thought that perhaps I had screwed something up during the update. So I basically rewrote the entire app from scratch and I still got the above random errors. All I knew was that it was something to do with mysql.

Finally, I looked at another app that does pretty much the same thing, but for a different group. When I closely examined the Gemfile.lock files, I realized that the working app was using the mysql2 gem (0.3.20) and the app with random errors was using the mysql gem (2.9.1). I then changed to the mysql2 0.3.20 gem and changed my database.yml file to reflect that. My random errors seem to have gone away, but I’m still testing.

Did a bit of looking around and found that I should have never used the mysql gem. It hasn’t been updated in years. I guess I didn’t realize that I had been using this app for that many years. Anyway, now I know to stick with mysql2.

Computing Insanity

Fun with Google Calendars

We’ve started using Google Calendars at work to keep track of different seminars, colloquia, etc. However, we also like to keep our regular html calendars because they’re just easier to read and to get a quick view of all talks for a quarter. So what we want to do is have the + Google Calendar button appear on webpages, but not show the actual calendar. We’ll have all the information in our own html calendar. Yes, this requires us to update two calendars, but it makes it easier to read.

So, how do we get just the google calendar button without the calendar? First I tried just making a link using the button using the link that Google provides. This didn’t work. My guess is that it’s sending a POST and not a GET, but I haven’t done any testing to check this. The easier way I’ve found is to just customize the view of a calendar to show nothing and have a width of 120 pixels with a height of 30 pixels. That will show just the button.


Then, I just place the iframe on the webpage as usual and we get just the button. An example of this can be found here.

Books Family Insanity

George’s Challenge

My 10 (about to be 11) year old nephew George told me that he has to read 40 books this school year. Each book needs to be at least 200 pages long. He was not looking forward to this and thought that nothing could possibly be worse. Since we are a very competitive family, I told him that it was easy and I could do it no problem. Not only that I could read 40 books twice as long as the ones he was reading. Result of my boast is that I now have to read 40 books by the end of the school year. Each of my books has to be at least 400 pages long. Stupidly, I didn’t get the details of his assignment before I agreed to this. After we shook on it, I found out that I don’t necessarily get to choose all the books, but that they have to be in some specific genres. So, here’s what I have to read this year:

Realistic fiction – 5
Historical fiction – 5
Fantasy – 4
Science fiction – 2
Biography – 2
Nonfiction – 4
Poetry – 2 (shoot me now)
Traditional Lit – 5
Graphic novels – 1
Mystery – 2
Free choice – 8

I have to say that the challenge worked, since as George was leaving he said he was going home to read. I, on the other hand, will be visiting the library soon to get some books. And if anyone can recommend a 400 page or greater book, let me know. I’m going to be looking for ideas. And when I’m trying to get through 400 pages of poetry, I will probably not be someone anyone wants to hang out with. I’ll try to warn people in advance.