User Tools

Site Tools


opus:spring2015:ahorton8:start

Alicia Horton's spring2015 Opus

Introduction

Hello, as you can already tell, my name is Alicia. This is my second semester at CCC, well, in general actually. I'm really not that good with intros.

C/C++ Programming Journal

January 20th, 2015

Today, I customized my Opus, changing the title, removing the subtitle (I didn't really know what to put there), and added a small introduction. I downloaded putty as well and connected to lab46, which was surprisingly easy to set up.

January 27th, 2015

Today, I learned how to commit to my hg folder, and pushed everything in my cprog folder to it. For some reason, committing from my home computer does not work, although it does work at the BDC.

January 29th, 2015

Today, I set up IRC, and subscribed to the mailing list. I also implemented, compiled, and checked the hello.c program. Then, I submitted to the cci0 project.

February 2nd, 2015

I worked on my mms0 project, getting a good portion of the coding done. The math is done, I just have to figure out how to display the number, test it, turn it in and commit it to the repository.

February 3rd, 2015

I finished the code for the mms0 project. I was able to get the numbers relatively well, but I had trouble actually making the output show. But after some time, with a little help, I was able to figure it out and finish the project.

February 5th, 2015

I began working on the mbe0 project. I have the basics set up for most of it, but I'm having a little trouble dealing with what to do when the middle numbers add up to more than 9 on the 2 digit numbers. I also got the triple digit numbers set up, fully functioning.

February 6th, 2015

Ive fixed the double digit numbers to work when the middle number is more than 9. Ive also set it up to work for single digit numbers, however, the answer displays as something like 099 instead of just 99, and Im not entirely sure why. As of now, I just need to fix the single digit numbers.

I discovered why it wouldnt work. Turns out the majority of the code was broken and I just got lucky that it worked. While it was technically working code by some amount of luck, the fact that it was wrong bothered me, therefore Im now in the process of rewriting it. Im not good at naming things, so a lot of stuff is just named things like “a, b, c, d, e, ect.” Notes are extremely helpful in this case…

Two digit numbers now function properly, as well as one digit. Also, if you type a number higher than 999, it tells you that the number is too big.

February 7th, 2015

Ive gotten a little farther in fixing the code. Code works for numbers like 963, where the 9 and 6 add up to more than 9. However, I still have to fix it so numbers like 369 will work, where the 6 and 9 add up to more than 9. Also, numbers like 999 have to be fixed too, where both sets add up to more than 9.

February 8th, 2015

Finally finished the mbe0 project. I probably made it more complicated than it needed to be, and I apologize for how badly things are named. But hey, it works! I found that working out the code was easy, it was the math that was hard, due to having to break the numbers apart and figure out how to get them back together properly when certain parts of the answer ended up being bigger than 9. But with like 3 sheets of paper and badly made notes, I eventually figured it out.

February 25th, 2015

With the help of Joe, I started working (rather late, not my best idea) on the mbe1 project. I can do if/else statements fine, but once I get into arrays and loops, then I begin to get confused. Joe attempted to help me seperate the numbers (Ex- 456 to 4, 5, and 6), and helped me make a loop that will check for if certain numbers add up to 10+ (the 5 and 6 in 456, since they would add up to 11), and how to stop that from causing problems. Unfortunately, I'm not entirely sure how to add the numbers together just yet. Also, since I dont fully understand the code for separating numbers, I tried to run through just the section that did it to see it. However, even though I typed in the code he wrote almost exactly, its giving me an error. In the code, there is a section that says “a = input / pow(10, count);”, which is used to get the first part of the number. Somehow… But anyways, there is that, and “d = input % pow(10, count);”, which should get the first part of the number. However, when I try compiling these, I get an error with the second one such as “invalid operands to binary % (have 'int' and 'double')”. When trying to put in an int or double, it says “expected expression before 'int'”, and I dont know what exactly its asking for there. I tried looking it up online, but it didnt really help. At one point, though I dont remember what exactly I put, the error was “undefinied reference to 'pow'”. So basically, I have no idea whats going on and I think I prefer writing an insane amount of if/else statements.

February 26th, 2015

While already late, I really want to figure out the loop thing. I believe I've got it somewhat functional (I hope), but I still cant fix the pow problem, and until I do, I cant get the code to work.

February 27th, 2015

I ended up removing the pow function, and coded it differently, in a way I can understand better. At the moment, all that functions is I can get the first part of the final answer, and the last part. I was able to get to this by (for example getting the first part of the number), dividing the number by 10 and setting that on a loop until the number ends up being less than 10. The same goes for modding, just… you know, with the mod function, not dividing.

March 4th, 2015

After a lot of help, Im finally beginning to progress in the mbe1 project, even if not directly. As of right now, the code (designed for 4 digit numbers and other at this point, and without loops) sort of works. However, it doesnt carry the 1 over when numbers end up greater than 9, and as of now Im not entirely sure why.

March 9th, 2015

After a few days of going through and slowly working on a smaller version of mbe1 (the one that is made for 4 digits instead of 8), the code now works, even for a few numbers greater than 4. My main problem with this project was that I was trying to do everything at once, and didnt know how to break it down into smaller sections.

I converted the project so that it now works with 8 digit numbers, I just need to fix it so the output looks like it does on the project site.

March 10th, 2015

My code almost works completely now, although there is a small problem with how the output displays, and the carry isnt being shown correctly (although in the end the answer is still correct).

March 11th, 2015

After like two weeks, I finally finished the mbe1 project. The carry problem I had was caused by the fprintf function running too late, and works perfectly now. Only thing is, the arrays display slightly backwards from the example on the project site, but it works just as well, and serves its purpose.

March 13th, 2015

I began working on the afn0 project yesterday. Right now, Im just trying to make a function that will put the input given into an array. So far it almost works, just not for big numbers, and the array doesnt go higher than 9. So all I can get right now is numbers[0] through numbers[9], and if you try putting in a really big number as the input, it doesnt do anything, just exits the program and goes back to the prompt. Basically, what the code does is it takes the input (say its 941), and both mods it and divides it by 10. So input = a, a % 10 is 1, which is numbers[0]. Then, a / 10 = 94, which is now a. The function will then display the result of that, and loop back, doing 94 % 10 and 94 / 10. This will loop as long as a is greater than 0. Unfortunately (though this probably doesnt make a huge difference), the array ends up being slightly backwards. Like, if the input is 941, the numbers array is numbers[0] = 1, numbers[1] = 4, and numbers[2] = 9. Although, this might make the code slightly easier since the last number has to be subtracted from 10, instead of 9, and if the last number is numbers[0], that will never change, so doing that might be a little bit easier. As of now, I just need to fix the code so it works for larger numbers.

March 14th, 2015

Okay well apparently my code was wrong and weird. I didnt have my input declared as a long long int, that was the problem. I also was trying to declare an array in my loop, which, doesnt actually work all that well. I did this because I didnt know how big Id need the array to be, so I was hoping if I set it on a loop itd just increment it as high as it needs to go, and it did actually work surprisingly, but I fixed it anyways. On the plus side, at least my process for getting splitting up the input worked! Just… the code wasnt great. The code works for up to 19 digits now I believe.

March 20th, 2015

For the past few days, I have been working on the afn0 project. The code works, though it lacks functions right now (everything is in main). When I first started the project, I had difficulties with my loop for displaying the numbers array continuing on past when it was supposed to, due to writing a loop that stops when numbers[whatever] is greater than 0, but the problem is undeclared parts of an array arent nothing, but just random numbers that happen to be greater than 0, so that didnt quite work. The loop worked after being limited to values between 0 and 9.

Next time I worked on the code, I attempted using 'i' in a loop made to display my onezeroarray (say, you had a input of 953, the equation would be 1000 - 953, so the onezeroarray would be 1000), after using it in a different loop. Because 'i' was no longer 0, the loop I had made didnt work, and was being skipped over. That had to be changed to 'j'. Though eventually, that loop was removed anyways since it was only for checking to make sure the code was working properly.

My next (and so far final) mistake appeared when I was trying to make a loop that would calculate and display the results. I managed to put a ';' after a for loop. Go me. I stared at the code for hours upon hours, and I didnt even notice it. Oops.

So right now, all that needs to be done is the code has to be separated into the different functions. Oh joy.

March 23rd, 2015

Well, turns out I had a lot of small errors in my code (which, I wasnt really surprised about). A lot of the problem was syntax stuff that I didnt quite understand, and Im still working through fixing it. I also didnt actually call any of my functions, which doenst really help…

UNIX/Linux Fundamentals Journal

January 20th, 2015

Today, I customized my Opus, changing the title, removing the subtitle (I didn't really know what to put there), and added a small introduction. I downloaded putty as well and connected to lab46, which was surprisingly easy to set up. I also subscribed to the mailing list, and will hopefully get into the habit of checking my mail frequently. Using the tutorial, I also set up IRC. Doing all of this was relatively simple, since, there were step-by-step instructions on the site for the more complicated parts of what I did.

January 27th, 2015

Today, I learned how to commit to my hg folder, and pushed everything in my cprog folder to it. For some reason, committing from my home computer does not work, although it does work at the BDC.

February 2nd, 2015

Ive unscrambled the coding in arc0 and got the results into the result.txt file, after an hour of confusing myself, and plenty of googling. I still have to figure out how to compress the archives.

February 3rd, 2015

After taking a break from the project, I went back to it and was able to finish the project relatively quickly. Reading the manual definitely helped.

February 7th, 2015

I began working on the pbx0 project. So far Ive figured out that I needed to do zcat on it, and I found the wedge directory. However, I dont know what to do now. Ive tried doing file on various names (shiny.tar, leaf_on_the_wind.wav, 644, ect) since ls doesnt work, but no such luck. Or maybe Im just completely doing this wrong and that directory has absolutely nothing to do with the project whatsoever. Guess Ill find out eventually.

February 8th, 2015

Ive used the tar command on riddle.gz, and got the making.waves file, which now registers as ASCII text.

Ive successfully gotten the results using uudecode, unzip, and uudecode again. Project is submitted and emailed.

February 9th, 2015

Using unzip, on the pbx1.zip file, I was able to get the README file, and with that, the password. I also used uudecode to get the stage2 file.

February 11th, 2015

I was able to make stage2 executable, and used an online hex to ascii converter to figure out the password. However, I dont know where to put the password now, nor what to do with the octal converter.

February 12th, 2015

I figured out where the password that was in hex goes, and was able to get parts 1, 2, 3, and 4. Now, I just have to put them in order, and submit the project.

Using a sorting command, I was able to put the files into the correct order, put them into the result.txt file, and submit it.

March 3rd, 2015

After the class, I was able to use the dd command to extract the parts of the files in the udr0 project, and get part1 to be RLE image data. So for now, part1 is the image data, and part2, part3, and toc are just data. Thanks file command, thats extremely descriptive. Really appreciating that help there.

March 5th, 2015

Using rletopnm, I converted part1 into a pnm picture, and using pnmscale, i converted it to the correct size. I ended up trying to type pnmscale 414×418, which, as you can probably guess, really didnt go well…. But eventually I realized it had to be pnmscale 2, which worked perfectly. However, part2, part3, and toc are coming up as “data” when using the file command, so I dont quite know what to do here. Im not sure if I did something wrong, or not.

I appended part1, part2, and part3 into a different file (picture), then converted it using rletopnm, then rescaled it with pnmscale, and changed it to png file with pnmtopng.

March 8th, 2015

While I was able to get the picture from udr0 to load well in the lab, it wouldnt load on the webpage. After the post about the memory address being incorrect in toc, I removed the picture from public_html, and attempted to run through the project again. However, only the bottom half of the picture is showing up online, and I'm not sure why. Ive attempted various things to try to fix this, mainly just doing the commands in different orders to see if it makes a difference, but so far, no luck.

March 9th, 2015

I dont know what I was doing yesterday, but the picture worked just fine today after running through the commands again. The picture is on the website, and the project is submitted.

March 12th, 2015

Using the dd command, I was able to get the gizmo file (I think). As of now, I have to create the script to reverse the order of the file, which, I have no idea how to do. I was able to get the udr1.text file using tac and rev. I used the command on the entire data.file file, and for some reason all it outputted was the picture and the “Extract the preceding 203 bytes, flip (in both orientations), and save as udr1.text” text. Dunno how that works out, but okay, fine with me. I feel like I did that wrong though since I doubt we're supposed to just erase that text, so I'll have to come back to that later. So for now, I just have to figure out how to make the script.

March 15th, 2015

After getting the new files from the public directory, I began to redo the project really quickly. Unfortunately, looks like tac and rev doesnt work on the file anymore, but I got it to work anyways this time by using dd to extract the ascii part of the file, and tac/reved that to get Udr1.text

I was able to create a script to reverse the order of a file. It uses the dd command, starts at the very last character, copies it to a file, then goes back a character. Probably shouldve realized I couldve done that earlier, but oh well. It took a bit of staring at the scripts we did in class to understand how to write it, but for the most part I got it to work by myself. The script is now running on the project file.

After hours of confusion as to why the gizmo file wasnt working, turns out the script was overwriting the original file that the script was reading from. So I have no idea what it was putting into the file that was SUPPOSED to be gizmo. Oh well, it works now, and Im able to use the urev command.

March 16th, 2015

After doing the 96 or so urev things, Ive successfully completed the udr1 project. I added the info about udr1.text (commands, what the picture was) into the file, and modified the script so that it was a little more detailed about what exactly it did. As for the post made here yesterday, disregard what was said about the original file being overwritten. Due to an error, the original file was the unreversed file, and the script was re-reversing it. All fixed now.

March 20th, 2015

I havent gotten as far with the udr2 project as I would have liked, but Ive at least done a little bit. I used bunzip2 on sleepfun.tar.bz2 to get sleepfun.tar, then used tar -xvf sleepfun.tar on that file to get the six sleeping sessions. So its… a start I guess?

March 22nd, 2015

Really should read the assignment page better. I was trying to do the bgrep command, but couldnt figure out why it wouldnt work. Originally, I did “bgrep A4 (session file) > (output file)”, then realized that was decimal, and wouldnt work. Then I tried replacing “A4” with “0x41 0x34” and “41 34”, still couldnt get it to work. Once that didnt work, I did a search on the assignment page for “bgrep” to see where was mentioned, and… realized Im dumb. Syntax was completely wrong. “cat (session file) |bgrep “41 34”” worked, just spammed the screen a little bit… So I did the command again, but added a “> (output file)”, then used “cat (output file) |wc -l” to get the line count, which, was the amount of data packets. Dunno for sure if Im right because thats a really big number, but I guess we'll find out!

March 23rd, 2015

So far, Ive figured out how many data packets are in each file, and discovered which file had the most deep sleep. I typed “cat (sessionfile) |bgrep “A4……..04” |wc -l”. Im not entirely sure if its correct, but it gave me valid numbers (I assume anyways). As it turns out, the session from 2012 had the most deep sleep, though I dont know exactly how much yet (nor do I know how to figure it out…).

April 7th, 2015

After WAY too much procrastinating, I began working on udr2 again. A few days before its due. Im so smart. Im working on the total time elapsed in the session file. Im doing this partially manually, partially using commands. Ive found that the starting packet in each data file is a timestamp, so I grab that. For example, in 201301041418, the timestamp was D4 F3 E6 50. Since thats big endian, it had to be converted to little endian, which would be 50 E6 F3 D4, or 50E6F3D4. Using “echo “ibase=16; 50E6F3D4” |bc”, I converted it to decimal, which is 1357312980. I then used the date command, and typed “date –date='@1357312980'”, and got the date of the data packet, which was January 4th, 10:23:00. I then did a little bit of guessing, using “ls -l” on the file to see how many bytes it was (360135). Using that, I went jumped to near the end of the file, but not quite the end, looking for a timestamp packet. I found one by typing “dd if=session-201301041418.raw of=201301041418 bs=1 skip=360000”. The timestamp for this packet was 83 F7 E6 50, which converts to 50E6F783. In decimal, (again, using the bc command), that number is 1357313923. Using the date command, it turns out that packet was at January 4th, 10:38:43. Since the session started at 10:23:00 and ended at 10:38:43, its shown that this session only lasted 15 minutes and 43 seconds. So, relatively short.

April 8th, 2015

After some failed attempts at reading packets because I dont even know what Im doing anymore, I was able to find a packet of rem, and the calendar date for it. I used the 201211020309 file, and (after various failed commands) found a packet by typing “cat session-201211020309.raw |bgrep “41 34 .. .. .. .. .. .. .. .. .. .. 9D 02” > remsleep” This allowed me to find where any packets that were of rem sleep began, which I believe in this case, was just one packet. The packet started at 393863, which translated to 3749987. Now, since I needed a timestamp within rem, I needed a packet that was shortly after that rem packet, so I had to do a bit of guessing. I typed “dd if=session-201211020309.raw of=remsleeppacket bs=1 skip=3749987 count=500”. Count would be where the guessing came in, since I didnt know how far ahead the timestamp packet would be. I eventually found one, with the data block containing 24 63 93 50. Which, in little endian, is 50936324. This translates back to decimal as 1351836452, and as a date, this comes out as November 2nd, 2:07:32.

At the moment, Im trying to do the third question (total time in a sleep state), but the command doesnt want to work. I was trying “cat session(whatever) |bgrep “41 34 .. .. .. .. .. .. .. .. .. .. 9D [02 03 04]” > totalsleep”, but I keep getting the error “Invalid pattern symbol '[' (91)”. I dunno what thats about, since as far as I know the brackets are valid and used for grep…

April 10th, 2015

I was able to figure out what I was doing wrong. Well, I was told what I was doing wrong. But you know, same difference. I didnt actually need to worry about that, and ended up just typing “cat session(whatever) |bgrep “41 34 .. .. .. .. .. .. .. .. .. 9D ..” > (whatever file I used)”, and looked at the packets that way. I ended up looking for the first packet that showed sleeping, and the last, and ignored any of the small moments of undefined/consciousness in the middle, which made my life a lot easier… Project is now done and submitted.

opus/spring2015/ahorton8/start.txt · Last modified: 2015/01/19 19:53 by 127.0.0.1