Thursday, November 3, 2011

Learning C - C Primer Plus

I thought I would post some chapter review programs from chapters I'm reading in C Primer by Stephen Prata. This won't mean anything to anyone unless they know C programming. I'm basically putting it here so others can learn from what I've done and partly because I think a computer program is beautiful. Sort of in an artistic way. The characters and code seem like a picture to me.

This C program converts Centimeters to Feet and Inches:

//*************************************************
#include <stdio.h>
#define CMPERFT 30.48

float cm,ft,in;

int main (void) {
printf("Enter a height in centimeters (<=0 to quite): ");
scanf("%f", &cm );

while (cm > 0) {
ft = cm/CMPERFT;
in = (ft - (int)ft) * 12; //You can't find a remainder of a float with modulus.So use Cast
printf("\n%0.2f cm = %d feet, %0.3f inches\n", cm, (int)ft ,in);
printf("Enter a height in centimeters (<=0 to quite): ");
scanf("%f", &cm );
}

return 0;
}


//************************************************

Thursday, October 27, 2011

Finally Cut Comcast Cable

Well, I finally got fed up with Comcast Cable TV's high prices and cut the cable.
Though they'll never know. I told them I was moving so I wouldn't incur any additional fees.
Soon I'll be placing an Antenna in the attic for those times when I want the TV to make some noise. But other than that, I'll get what I want off of the internet. I've had cable since 1985 when I got my fist apartment. They've made a fortune off of me if you think the average over those 26 years has been about $40 a month, that comes to about $12,480. That's a lot for TV that is paid for by commercials anyway.
So long Comcast, you suck.... have been sucking for 26 years....money out of my wallet.
No more, good riddens.


Saturday, August 13, 2011

invalid literal for int() with base 10:

So I'm learning Python programming in my spare time.
For two hours I was stuck on this simple error:
invalid literal for int() with base 10:

Turns out, if you input a string number like "4.0" and you want the integer of it,
you must first make the string a float, and then make the float an integer.
"4.0" > float("4.0") > int(4.0) is the path.

So
>>>int("4.0") #this will give you an error
>>>int(float("4.0")) #this will work and give you >>>4

The reason I think this is necessary is because Python wants you to verify that you
know you are converting a float to an integer. It doesn't want to assume you know that.


Monday, May 2, 2011

Obama Can Do No Right

I believe President Obama could single-handedly find a cure for cancer, and people would bash him for killing off an entire industry.
It's true, you know it's true.

Tuesday, May 18, 2010

onjoFilms lates video and editing project.

Video of Sarasota's Iconcept where Art Meets Fashion.
Editing on Final Cut Pro and shot with a Canon 7D.

Video Here

Wednesday, May 5, 2010

4 Things I've Learned About Republicans Lately

1) They will come up to you bashing Obama thinking you think like them just because you are white.
2) Obama is responsible for the oil leak and now the floods in Nashville.
3) When you joke with them that a solution to the oil leak is to 'bomb it', they think that is a great idea.
And 4) If they know you are an Obama supporter they will come up to you and ask, "Well, how are you liking your change now?" with a grin on their face like they just asked the killer question. Of course that smirk goes away when you answer, "Excellent, better than expected." They haven't thought past a response like that yet.

Monday, March 29, 2010

Cheap China Batteries for Canon 5D and 7D

I bought a couple of Li-ion batteries from a Chinese vendor on eBay for about $20 for charger and batteries. They came in about 12 days.
This vendor had good feedback from other Canon EOS purchasers who bought these batteries, so I thought I would give it a try.
Upon careful inspection the charger looks cheaply made. The contacts to charge the battery are thin tin or some other material. I had to straighten them out some with needle nose pliers.
The batteries also have cheap contacts. What is disturbing about the contacts is they are not 'all contact' contacts, but rather two plates with two small pin size dimples pointing inward. I tested it to see if they were sharp by running an exacto knife in them and seeing it the blade was scratched. It wasn't, but I wanted to be sure before I stick these things in my 7D. I don't say this is the best test as blades are pretty hard metal and hard to scratch anyway.
The next thing I did after charging them up was check the voltage. 5D and 7D runs off of 7.4VDC. These batteries were measured at 8.4VDC even though they are listed as 7.4VDC. I'm hoping and thinking there is overvoltage protection in the 7D. One would think this high end circuitry would have that. It may be also that the voltage will drop to something more the 7D and 5D uses upon receiving it's load.
I have not put them in my camera yet, but I will since I haven't heard of any trouble from other users on them.
It's a risk I know, but so is life.