======Part 3====== =====Entries===== ====Entry 9: April 17, 2012==== I'm currently doing Unix Case Study B (still a little behind, but catching up quickly!). The first part has us using the dd command. I found this funny because over the past month I've picked up this habit of flashing different cell modems on my phone. In order to flash them, I have to connect to my phone using the android debugging bridge (which let's me set up a shell on my phone, accessed through my computer), and then use dd to data dump the data in the cell modem files into the proper related phone directories. It's important because well, I've used it for tasks before. Being able to use this tool is pretty helpful. It allows me to grab parts of files and put them separately, or move parts of files into other files etc. Just a fun little thing. ====Entry 10: April 20, 2012==== For the past couple of days I've been doing Lab B for unix. I really like having this newfound power to go through files and sort them and do searches and getting what I want out of the files. Very empowering feeling. I like it so much that writing the scripts for this lab are semi enjoyable, until I run into a huge block (like I am right now) that I can't for the life of me figure out. It's really important to have this ability because when it comes to information manipulation, this ability is absolutely essential. The lab has some pretty excellent examples of uses, ending with scripts that automate the process so that you can just type in a command with some arguments and get masses of data from an html file. ====Entry 11: April 26, 2012==== Last night.. or rather earlier this morning, I complete Project 3. Because I love doing things in a timely manner. Despite the negative Karma, I believe the fact that I made the arrays dynamically allocate themselves so that the answers printed are the TRUE values, instead of being cut off, was well worth the delay. Once I had the core of the program finished (had it in one gigantic .c file) and working, I had only met 2/3 of the Projects requirements. Now I needed to split up the C source into a multifile version, C++ class based version, and C++ class based multifile version. Thanks to all the work I put into the class based ,logic gate, C++ multifile program, doing the above was a sinch. Even though I was half asleep and feeling quite dead after a long day (it was one in the morning) finishing the project was quite effortless. Other than having to look at my logic program for syntax, I already knew precisely what to do. :) It was quite nice, and it's good to be able to do that. Splitting a program into multiple files - even without doing a class based approach - makes the program much more organized. Classes would make it even more organized: but it is better for longer programs, and the entire structure and gameplan has to be well thought out beforehand. The 'just sit down and spit it out' method doesn't work as well anymore. ====Entry 12: May 2, 2012==== The semester is rounding up, and I can't wait to continue taking courses next semester. I've learned a lot. In regards to unix/linux, I really appreciate how well I know the system now. I know I'm not even near towards being a master at it, but the bit that I do now know has made everyday menial tasks much easier. I've even started writing scripts to do stupid little things. I wrote one that turns off my screen using a keyboard shortcut, and one that allows me to change the # of workplaces in ubuntu. The code for these I majorly got online, I didn't know that stuff off the top of my head. But I then took that code and put it into scripts, so that should I ever need to use it again I could, quite easily. It's pretty cool. My multitasking productivity has gone up nicely because of it. {{page>cprogpart3&nofooter}} {{page>unixpart3&nofooter}} =====Experiments===== ====Experiment 7==== ===Question=== If I have a double pointer, to pass a value to it from scanf do I have to dereference the double pointer only once? (That would make it 'referenced' by one layer, in my mind). ===Resources=== Don't really need resources, it's a straightforward test. ===Hypothesis=== I think it will work because I ran into something similar doing project4. I had an array and was using scanf to fill it, so it was a single pointer. To use scanf, I just called the name. No dereference or anything. ===Experiment=== I'm going to write a simple program. Make a double pointer and see if I can scanf and print the value the way I believe it will work. ===Data=== 1 #include 2 #include 3 4 int main() 5 { 6 int **numbers; 7 8 *numbers = (int*)malloc(sizeof(int)*1); 9 10 printf("HEY!!! Enter a number. Please? :)\n"); 11 12 scanf("%d", *numbers); 13 14 printf("\nHEY!!! The number you entered? Yeah. It should be %d.\n", **nu mbers); 15 16 return 0; 17 } lab46:~/src/cprog/messingaround$ ./scanfdoublepointer Segmentation fault lab46:~/src/cprog/messingaround$ ===Analysis=== Based on the data collected: * Was your hypothesis correct? I'm not sure. * Was your hypothesis not applicable? I'm starting to feel it's not applicable. * Is there more going on than you originally thought? (shortcomings in hypothesis) Yeah. I keep segfaulting. * What shortcomings might there be in your experiment? I got a segfault. * What shortcomings might there be in your data? I got a segfault. ===Conclusions=== What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made. Well, no matter what, I keep getting a segfault. I'm guessing that this would mean my hypothesis was incorrect. ====Experiment 8==== ===Question=== I wonder what would happen if I tried to chmod using permissions like 888, or something like that. ===Resources=== Nothing was consulted. ===Hypothesis=== I'm betting that it either doesn't work, or it defaults to 777 or something. ===Experiment=== I am going to try it out and see what happens. ===Data=== lab46:~/src/unix/scripts$ ls age.sh csd.sh firstforloop.sh guess1.sh mail.sh script2.sh botstart.sh files firstlist.sh histogram.sh script1.sh lab46:~/src/unix/scripts$ chmod 888 age.sh chmod: invalid mode: `888' Try `chmod --help' for more information. lab46:~/src/unix/scripts$ chmod 10292 guess1.sh chmod: invalid mode: `10292' Try `chmod --help' for more information. lab46:~/src/unix/scripts$ chmod 77 age.sh lab46:~/src/unix/scripts$ ls -lh age.sh ----rwxrwx 1 smalik2 lab46 120 Mar 8 11:45 age.sh lab46:~/src/unix/scripts$ chmod 777 age.sh lab46:~/src/unix/scripts$ ===Analysis=== Based on the data collected: * Was your hypothesis correct? - Yes * Was your hypothesis not applicable? - N/A * Is there more going on than you originally thought? (shortcomings in hypothesis) - I decided to test if I only provided like a 77, and it affected just owner and group. * What shortcomings might there be in your experiment? - Nothing really. * What shortcomings might there be in your data? - Nothing ===Conclusions=== Chmod doesn't work if you provide something higher than a 7, or longer than 3 digits. ====Retest 3==== Perform the following steps: ===State Experiment=== Whose existing experiment are you going to retest? Provide the URL, note the author, and restate their question. ===Resources=== Evaluate their resources and commentary. Answer the following questions: * Do you feel the given resources are adequate in providing sufficient background information? * Are there additional resources you've found that you can add to the resources list? * Does the original experimenter appear to have obtained a necessary fundamental understanding of the concepts leading up to their stated experiment? * If you find a deviation in opinion, state why you think this might exist. ===Hypothesis=== State their experiment's hypothesis. Answer the following questions: * Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover? * What improvements could you make to their hypothesis, if any? ===Experiment=== Follow the steps given to recreate the original experiment. Answer the following questions: * Are the instructions correct in successfully achieving the results? * Is there room for improvement in the experiment instructions/description? What suggestions would you make? * Would you make any alterations to the structure of the experiment to yield better results? What, and why? ===Data=== Publish the data you have gained from your performing of the experiment here. ===Analysis=== Answer the following: * Does the data seem in-line with the published data from the original author? * Can you explain any deviations? * How about any sources of error? * Is the stated hypothesis adequate? ===Conclusions=== Answer the following: * What conclusions can you make based on performing the experiment? * Do you feel the experiment was adequate in obtaining a further understanding of a concept? * Does the original author appear to have gotten some value out of performing the experiment? * Any suggestions or observations that could improve this particular process (in general, or specifically you, or specifically for the original author).