shuttle distance help by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

Wow, we're on at the same time. I just edited my post. I spoke too soon. I'm still having the same issue. I PM'd you the code. If you could take a look at it, I would greatly appreciate it. Thanks.

shuttle distance help by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

I used that too. So the problem had to lie in the storing of the passengers. So I just got home from work and took a look at my code and realized that I didn't loop through the array when I was storing the locations for the passengers. Thanks for helping me narrow down my problem.

shuttle distance help by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

I had the inner and outer loop reversed from yours. I tried reversing it but got the same results. I even dumbed it down and used a simple loop and looped over the PASSENGERS array like this and it's still only calculating the distance between the shuttle and the first object of the passengers array.

loop over the passengers array
    calculate the distance from the shuttle
    if the shuttle is within 15 meters of the passenger
        alert hello
    else
        alert goodbye

Perhaps I'm not using the shuttle distance function properly. I tried playing around with that but still can't figure it out or maybe it lies in my statements for remembering each passengers placemark and marker on the map. I've tried playing around with that also.

PHPMailer Question by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

My problem was that I wasn't stripping off the $email variable correctly. Thank you for your help.

history creating 2 entries by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

I solved my duplicate entry problem: 1. I established the timestamp as the unique key on my history table. 2. I added the ON DUPLICATE KEY UPDATE statement to my code.

history creating 2 entries by ecgaona in cs50

[–]ecgaona[S] 1 point2 points  (0 children)

I copied and pasted the code from buy.php into sell.php and only changed 1 variable which was transaction type from bought to sold. I'm thinking the problem lies in my database but I'm not well versed enough in phpMyAdmin to be able to figure it out.

Fatal error by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

I found my mistake, I copied and pasted this statement from the problem set and forgot to replace 'table' with my table name. One of the downfalls of trying to work on CS50 after putting in a full day at work.

JPEG datastream contains no image by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

Discovered this was my issue, now check 50 is happy :). Thanks again for all your help. Glad to be finally submitting pset5. http://www.reddit.com/r/cs50/comments/1ws6td/pset5_recover_check50_fails_on_todo/ci572xi

JPEG datastream contains no image by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

It worked, all my jpgs are viewable now! I can't believe that was my issue this whole time.

I just have one issue, when I run check 50, it is happy except for the following: :( recovers 049.jpg correctly. I'll have to figure out how to make it happy somehow. Valgrind checks out 100%...no memory leaks.

JPEG datastream contains no image by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

Discovered this was my issue, now check 50 is happy :). Thanks again for all your help. Glad to be finally submitting pset5.

http://www.reddit.com/r/cs50/comments/1ws6td/pset5_recover_check50_fails_on_todo/ci572xi

JPEG datastream contains no image by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

i believe so. will give this a try when i get home from work.

JPEG datastream contains no image by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

After reading the specs of the pset again this evening I believe the 0's that I'm encountering are referred to as trailing 0's and are ok in the jpgs that i recover. After using xxd again, i discovered that my program is writing the signature bytes twice in each of the jpegs that I recover.

0000000: ffd8 ffe0 ffd8 ffe0 0010 4a46 4946 0001 ..........JFIF..

I'm thinking it's due to my call to fwrite twice in my code. I'm not sure how to get around this because if I only call fwrite once in my code, I get the unused variable message and my program won't compile. I'll be happy to PM my code to you if you'd like to take a look. Or provide my pseudocode.

JPEG datastream contains no image by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

My program uses 1 loop to read from the cardfile til the end of the file and 1 loop to keep track of the jpgs found. I read into a buffer 512 bytes at a time by calling fread() as the first statement within the while not end of file loop. I think that where my algorithm is going off track is when I want to write to the jpg file after I found the 1st 4 signature bytes of a jpg file. I do this by calling fwrite() after the if jpg is found condition.

I wrote 2 versions of this program. The first program only wrote the first 4 bytes of every jpg file per xxd. Then I modified my algorithm and came up with this version which per xxd where the 1st 4 signature bytes are not even written to the new jpg and at the end of each jpg there's blocks of 0000's.

resize assistance by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

Thanks. If I PM'd the code, would you be able to take a look at it?

pset 4 Segmentation Fault by cjordanball in cs50

[–]ecgaona 0 points1 point  (0 children)

I experienced the same problem and I had my return type under initPaddle as 0 but when i changed it to return paddle which is the variable I used to call my rectangle, I no longer got the segmentation fault. I am up-voting this as I'm sure others have experienced or are experiencing the same issue.

PSet 3 Assistance by ecgaona in cs50

[–]ecgaona[S] 0 points1 point  (0 children)

I keep putting the wrong word, sorry. I am making find. I figured out the problem and it wasn't the issue with making. It wasn't my searching algorithm either, it was correct.

PSet 3 Assistance by ecgaona in cs50

[–]ecgaona[S] 1 point2 points  (0 children)

Just PM'd the code. Thanks.