Tuesday, November 30, 2010

Makefile macro $@ and $^

$@ refers to the left side of the : and $^ refers to the right side.
The left side represents the object where as the right side represents the object's dependencies.

Took a while to find this actually, found it mid sentence in an explanation of an example make file.

List of macros:
http://www.cprogramming.com/tutorial/makefiles_continued.html

Fundamental programming type sizes




Source: http://msdn.microsoft.com/en-us/library/cc953fe1%28VS.71%29.aspx

Sunday, November 21, 2010

Woes of Microsoft Word and Visio 2010

Visio 2010...Why did I ever download you? Oh because you're new and people like new shiny things. You were also free because of MSDN through my school. Should've gone the old route with your older and more fun loving sibling though..

Can't get your lines in Visio 2010 to point the right way? Draw a line! That is, if you can find the option. You can't.

Right click the ribbon bar -> Customize -> Create a custom group on the right (mine is named "line" -> add the line capability.



Also if you don't want the same header for each page in Word, go to your ribbon, go to the "Page Layout" tab -> breaks -> next page. This should be done on the page before the page you want a different or no header on.

Now click on the header space in the page you want cleansed. The design tab should pop up. Unclick "Link to previous". Now you can clear the header space without clearing the header for the previous page.

Maybe there's an easier way but google failed me. Or I failed google? I don't care I have reports to write and diagrams to make.

Sunday, November 14, 2010

Mealworms Drown

So..I've been raising mealworms for a project.

I put carrots in their tub and the majority of them won't touch it, I've also got oat bran in there so they can burrow and stuff. Well I thought they were maybe thirsty since I haven't been giving them water and they haven't been eating the carrots. I read online that some people sprinkle water. So I put a little water in the tub and it hits some worms on the way. The ones that get splashed on squirm like they're having a seizure and eventually stop, not moving at all. I think they died..

Anyway..don't water your mealworms, I guess I over did the "sprinkling".

Monday, October 4, 2010

Passing into a compiled C program

Just figured out how to use the "argv" argument in C.

Pretty much it's whatever you type in the command console and it becomes stores in the array "argv" as an array. So "argv" is an array of arrays (or so it seems), not of individual characters as some websites might lead you to believe.

For example if I had this function in the file hello.c:

int main(int argc, char *argv[]) {

and I wanted to use some text to be inputed at the execution of the program, like reading "byebye" in the command "./hello byebye", I would do this:

int main(int argc, char *argv[]) {

somereadfunction(arg[1]);
}


This reads the second array of the array "argv" which is the "second" thing you wrote in the command prompt. The first would be "arg[0]" which is "./hello".

Try it, I used printf to confirm my suspicions.

Sunday, September 26, 2010

Sine or Cosine in free body diagrams

I haven't had to do a single free body diagram since Physics I freshmen year of college. Holy crap that class was awful. My first physics class, I didn't know how to do anything....half way through the semester.

The classes are standardized so that all the physics I professors would assign the same syllabus, same homework (Mastering Physics anyone?), same awful awful textbook and same tests. I'm convinced the physics department at my school had some sort of endorsement from that textbook company if they required those textbook/software package for classes.

So today I stumbled onto some problems that required me to use free body diagrams (had to google 'free diagram physics' to figure out what the real word was because I forgot there was a 'body' in there). I found a rather intuitive answer to my questions about when to use sine and cosine in free body diagrams. Believe it or not, four years later I still didn't have a clue until today. Thanks kirchwey of Yahoo Answers!

Quoted from Yahoo Answers:

To a large extent, common sense can help. Think of the force applied by gravitational force to a ramp, mg, always straight downward. If the ramp is horizontal (θ = 0), all the force (1 * the force) is normal to the ramp. If the ramp is vertical (θ = 90 deg) none of the force (0 * the force) is normal to the ramp. What function = 1 at 0 deg and 0 at 90 deg? The cosine! So we can say Fn = mgcosθ. Similarly we can go through the same mental exercise to determine that Ft (tangential or along-the-ramp force) = mgsinθ.
Just a couple of examples, but you can apply the same thinking to many other problems. Sometimes you'll find a function going to infinity, like the horizontal force needed to push a weight up a ramp tilted to angle θ. At 90 deg you just can't push uphill by pushing horizontally. That's a tangent function. F(hor) = mgtanθ. No force (assuming no friction) at 0 deg, infinite at 90 deg.

Source Link: http://answers.yahoo.com/question/index?qid=20081221044552AAsmlSv