Paul Sechrist's Spring 2013 Opus
And I'm Pretty Damn Proud of It!
My name is Paul, welcome to my opus. See my journal for up to date information on what I have been working on. See my projects for details about the projects I have completed and am working on.
Accessed Putty and Lab46. Updated Opus. Downloaded files from Joe's Section.
Killed tentacool at 10:29 AM by asking to define pointless. success.
realized my signed ints were incorrect. I will have to find out why.
In working on my datasize program, i used the sample code Matt gave us here on the lab46 site, rather than the code from the board in class. After trouble shooting a few errors from compilation(simple undeclared values), i recompiled and ran. I found that the low and high values had switched for my signed values. Used the simple solution of switching the output label on each line. Should go back and find real error if i find time.
I guess since i slept in till one i should probably work on some of this class before lab.
wathed the binky video…. it was….interesting…
so when you give c a number it is mapping to ASCII and reading a letter, and vice-versa. we can see by the functions under neath the first printf set, that be adding, subtracting, or multiplying letters, we can alter their ASCII value.
When we store 'a' or 'b' we actually store the ASCII value. so they are being stores as a=97 and b=98. so when we dereference we are actually pointing 'b' to 'a', so it now contains a's address. but 'b' itself has its own address as it is a separate variable. So if we change 'a' at all, 'b' will contain whatever we change 'a' to. on the other hand changing 'b' does not change 'a' at all. in order to change 'b' without breaking the program, i think we would have to return b to its original state.
This one im a little confused about and hope matt explains in class. I looked up malloc and it is a memory allocator. but im not sure why 0 is what is returned.
Finally got to writing the first project for Joe's class. Thanks to some of Matt's lectures, I got this done in 15 minutes. I did have a little bit of trouble figuring out how to display the input as letters rather than what i believe was either size or memory address. but i referred to my pocket reference and figured out the troubles in my program.
Again, Matt gave us some notes on this project so it is relatively easy. however i think i am having trouble figuring out how to call and store variables from the CL. I couldn't get it to work i dont quite grasp what i did wrong. I think I'm having a lot of problems with pointers and data types and such. so thats a problem.
Figured out my issues with the adder. My main problem was naming variables as num0 and num1. I'm thinking this makes the compiler think the variables are arrays or something of that sort. good lessons learned today.
The Program does not run correctly, time to troubleshoot. I noticed the fprintf set at the bottom dont have stdout so ill add that. and that worked. now ill run it.
fscanf reads a return(new line char) whenever looking for a char. to fix this we use fgetc(stdin).
now fgetc is reading the return character. we used getchar() to fix this problem.
I looked for a “collapse” or “hide” feature for dokuwiki for about 3 hours, but i do not think matt installed one as he said he did. However many good options do exist on the dokuwiki web site.
Things to do with characters/strings
Allegedly, this is what we will work on building this semester? I'll believe it when I see it.
== is equivalence
= is assignment
int a = 3;
int b = 3;
b = a
b == a
srand(time(NULL)); x=rand()%99+1;
Damn these pocket guides are useful. if you ever need something its like “BOOM! RIGHT HERE!” except i dont understand loops still. heres to Joe teach us in class….one can dream.
gcc -g -o - lets you compile for debugging.
gdb ./ - lets you run debug
list - shows code
break main or (line) 2 - sets break point, program pauses here
run - runs program
step (s) - Runs next line after break
next (n) - runs next line after break
print i - prints value of i
set(i = 12) - sets the variable to a different value
continue © - continues program
display j - displays variable every step
print &x - prints mem address
x mem address - displays content of a memory address
bt - lists functions that have been used
help - shows help
ok so I've take Joe's advice on starting over and breaking the problem down first. so i will make 4 programs in order to get the exponentiator. starting with counting, then adding, then multiplying, then exponential.
the counter was easy, and the adder wasn't to hard either. i misplaced a less than sign and an equals sign, but i reread my pseudo code and got it fixed.
multiplier is a bit more difficult. I wanted to try using if statements to show result of multiplication of 0 and 1, similar to what i need to do in exponentiator.
I would love if we could talk about creating a library of functions similar to the one used in CSCS 1240. There must be a way but a class discussion on its syntax and implementation in different programs would be nice. i believe joe was going to talk about this topic this week.
figured out the if statements thanks to the project we did in lab last week. also found out mingw has a debugger. so that should be helpful.
my problem was when i was starting the value of my product as the first input number. just moved it to after mult 1 had been defined.
now onto the big daddy.
initially i couldn't do anything higher than cube. i realize this is because i now need to change the number being multiplied(in 10^3, i need to change it from 10*10 the first time round to 100*10 the second time around.) so I tried to set the max times multiplied by the product in order to get the correct value, but i multiplied to much. I am going to separate the max value of the addition and multiplication function.
SUCCESS!!!!!!!!!!!
so what needed to be changed is the number of times the addition occurs. fuck yes. its AC2 time. #IMGHOST
JK i worked on my opus a little bit too, not worth a new header though. now im ghost.
I was thinking about the opposite side of the functions Joe has had us create such as, count down, subtract so on, so I'm creating programs that will do these by counting.
countdown was a cake walk. as was subtractor. however divider will be much more difficult.
int inc( int num) { num++; return(num); }
int inc(int); int main() { int n; n=0 n=inc(n); return(0); }
int add(int num1, num2) { int i; for (i=0; i<num2; i++) { num1=inc(num1); } return(num1) }
random thought. to combine repos maybe set thg to have the source be lab46 and bitbucket, i believe that exists and same for lab46.
I restructured my repositories so that all my files for both lecture and lab are accessible.
side note: saw a review on chegg for CSCS 1240 said something along the lines of “Had one of the best professors, he was a bit rantish but he always got the punch line at the end.”
Functions:
retType function( in1Type, in2Type…);
retType function( in1Type in1Name, in2Type in2Name,…){…}
= function(argName, anyValue)
fopen man - used to open, read, write, or append a file.
struct person{ char name[80]; int age; float hieght; }; struct person people[8]; people[3].age=37;
use box diagram syntax here
Name
age
height
typedef struct person P;
P people[8];
that replaces
struct person people[8];
this is empty on purpose…
pointers and shit. idk why. my head go boom.
pacman swag.
i made a house bro! http://lab46.corning-cc.edu/~psechris/image.png
Decided to completely redo my logic lib rather than changing syntax on the old one. this one will also include math. Im also trying to fix the divider function i wrote a while back.
I believe there to be some sort of mathical thingy ma do like in the expo function with changing the number being added i believe. but maybe im just fucking up the syntax. my short term fix was to just add 1 to the prod but, that doesnt work when i want the remainder as well.
apparently thats called a greater than or equal to sign.
for now im not going to deal with returning the remainder as well. i dont know how to do it. possible question to joe/matt.
Also got a root program working, it would be cool if i could use floating points in these functions and find exact answers.
Made triforce in lab, http://lab46.corning-cc.edu/~psechris/triforce.png and i made the Red White and Blue Star, twas a bitch. http://lab46.corning-cc.edu/~psechris/star.png
Seeing as how I worked my ass off for like 10 weeks, and Matt was so kind as to give us a week off, I took advantage and did not touch any homework. because you know what? I deserved it.
I worked on the string to array function as it somewhat pertained to the hex editor as matt pointed out to me harry and john. but i am still unsure of how to successfully complete the function, and therefore the program.
[This is a place holder for the flow chart joe did in class today.] (also i dont know how to make a flow chart on here. but that would be cool. we need ot make arrays accessible by both row and collom. 2d array? and that is what must be displayed for the buffer. that way if we want to edit or whatever, we can call specific pieces of the buffer to edit or change. trippy.
So if we wanted to do a gd image creator using classes, we would need to start basic, such as the lines or the fill. then go to specific way the shapes are made. in main we could ask for color or size.
joes test code annoys me a lot. its making life difficult. so i got it to run by the end of lab but it stops after one loop of the buffer. not sure why. my head hurt. i quit.
alot of thngs done. not a chance in hell this will be done by the end of the semester.
just pwning matts simple tests. the force is strong with me.
i figured out that my display wont fun though the display loop. not sure why….. Something with my extra spave every 4 hex values loop is broken, but now even as it displays, random values are printed. also the first hex value is not printing out. i believe that has to do with my initbuffer. AHA! my fgetc of fptr to check for EOF causes the first value to not be read. i guess i need to reset the fptr location after i check for EOF…..but how….fgetpos, fsetpos??
fixed the skipped value, as well as my value error. i then fixed the display issues to make it more appealing. next i need to do next.
working on the user interface of the program. using a case switch in order to pick next command. next works…. trying to get a command not found working as well as a prev command. after that ill tackle the big daddy of the editing. but we'll save that for much later.
You know…. I really wish i had figured all this bull shit out like 3 months ago. but oh well. It occurs to me after dealing with 2 days of bullshit 2 repository issues that i could have combined the two repos for the lab and class section alot quicker than i had and probbly saved abouyt 4 hours of my life. but noh well. it was a good learning experience.
in other news i rewrote the second project and am in the testing phase. and it almost works
I speant my week finishing my EoCE, Hex Editor, and logiclib.
Good By C/C++ I will miss you as a class but i look forward to building on my skills in future courses. Farewell to all i hope all your dreams come true. Drive Fast, Take chances. And may the wind always be at your back, and the sun always upon your face, and may the wings of destiny carry you aloft to dance with the stars.
January 23, 2013 “Think of Joe as a wild stallion.”
Febuary 1, 2013 “'We are wizards; we do magic.' - Something Joe said never”
March 6, 2013 “You know what the Joe approach would be, 'Let's write the code for the entire C Standard library before we write hello world!'”
this is besides the basic, “OH!” drawn out dramatic *GASP!* and of course the over excited jumping about.
January 25, 2013 “Remember, I'm just one issue away.”
February 8, 2013 “I pretty much could care less what you get done in the end”
March 8, 2013
Casper: “Exactly!”
Joe: “OOOOOOOOOOOOOOHHHHHHHHHHHHHHHHHHH DON'T GO DOWN THAT ROAD!!!!!! RAWRRRR SAJFAIBF AEOIRNSJAF AHHHHHH!”
“Why do you cast something in magic.”
“What does casting a spell do?”
“What is true about all spells”
“It does something to change the appearance of something”
Yes, you have read this right. Joe used magic as an example of what casting is in c programming.
March 13,2013
“Keep in mind that there is probably a reason why I'm not in elementary education.”
March 20, 2013
Joe: “SO!! That leaves you with two questions on your mind!” (covers up projector screen dramatically)
Student: “What is Joe doing?”
J: “OK, you have three questions on your mind.”
S: “Does he know we can see the words on his hands?”
Joe: “I have a certain affection for things that get abused”
By request, I'll put this in context“
J: “I like GoTo”
J: “GoTo gets abused”
S: “and you like goto?”
J: “I have a certain affection for things that get abused”
April 4, 2013
“The really cool buffets have the plate holders with the springy things.”