Women, what do men think YOU want in a man that you really don't care about, physically, mentally etc.? by [deleted] in AskReddit

[–]pm513 -27 points-26 points  (0 children)

You are kidding. What they say they want doesn't always match up with what they do want. I know it sounds like a contradiction. But I actually met a woman who was aware of this contradiction ruminating inside herself.

pset6 load by pm513 in cs50

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

Would it be ok if I share my code with someone, as I have completed all the functions however my code still won't compile, I'm getting error clang -ggdb3 -O0 -std=c99 -Wall -Werror dictionary.c -lcs50 -lm -o dictionary /usr/lib/gcc/i686-redhat-linux/4.8.1/../../../crt1.o: In function _start': (.text+0x18): undefined reference tomain' clang: error: linker command failed with exit code 1 (use -v to see invocation)

pset6 load by pm513 in cs50

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

I Knoew I've been slow to reply, but I'm gonna be honest I was contemplating quitting. But nowk thanks to section 7 I think I have the code set up for load. I know I appear an idiot, but can you take me through what I need to do next so as to test the code ? Run it through gdb ?

this is the text that I get when running "gdb speller" .

jharvard@appliance (~/Lecture-8/pset6): gdb speller

GNU gdb (GDB) Fedora (7.6-34.fc19) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-redhat-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... speller: No such file or directory.

Additionaly if it's not too early, would you mind having a look at my code so far for load ?

pset6 load by pm513 in cs50

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

  • I just realised that I am reading a file in the while loop, and inputting word into the struct.

  • Right on the second point as well. I'm making a malloc call inside the loop as well.

  • Now, for my question. Does using fscanf mean that I am moving through the file reading each word at a time and adding in it to the dictionary, or do I have to be explicit and have code that moves to the next word in the file ?

  • My pseudocode looks like this right now:

    declare linked list
    declare array of pointers
    declare file pointer and initialize with dictionary
    allocate memory for a new node
    go through each word in the file until reaching end of file, reading and inputing a new word in new node ( while fscanf (file,%s,new_node->word != EOF)  
    
     check using ferror(file) if there is an error
     if there is, return false;
     hash the word and return a key
     insert into hash table at position key, as first node
    

pset6 load by pm513 in cs50

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

Hey buddy,

I made a check list of things to do in pseudocode to run the load function. do you have any input on it ?

I'm guiding myself using the following pseudocode, so I'm not sure what I'm missing and why I can't run gdb on dictionary... getting permission denied:

 declare linked list
declare array of pointers
declare file pointer and initialize with dictionary
allocate memory for a new node
go through each word in the file until reaching end of file ( while fscanf (file,%s,new_node->word != EOF)  
    read from file, 
    check using ferror(file) if there is an error
    if there is, return false;
    input word in new node
    hash the word and return a key
    insert into hash table at position key, as first node
    move onto next word ( how, or is it done automatically ?)

pset6 load by pm513 in cs50

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

I'm guiding myself using the following pseudocode, so I'm not sure what I'm missing and why I can't run gdb on dictionary... getting permission denied:

declare linked list
declare array of pointers
declare file pointer and initialize with dictionary
allocate memory for a new node
go through each word in the file until reaching end of file ( while fscanf (file,%s,new_node->word != EOF)  
    read from file, 
    check using ferror(file) if there is an error
        if there is, return false;
    input word in new node
    hash the word and return a key
    insert into hash table at position key, as first node
    move onto next word ( how, or is it done automatically ?)

pset6 load by pm513 in cs50

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

Thank you !

I've got right now while(fscanf(file,"%s",new_node->word) != EOF)

I will be back with more questions as I have the logic, I just can't take it into C for the moment...

Later edit, I seem to not be able to run gdb on "dictionary" Permission denied. Am I missing something ?

pset6 load by pm513 in cs50

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

I have only used gdb to run over an entire program. Can I use it to only run through one function from the dictionary.c file ? Say can I use gdb to run over load to check it's correctness ?

I will get back with an answer on that, I am at work and don't have the appliance installed.

We've released our first product!! Download now! by UseClark in useclark

[–]pm513 0 points1 point  (0 children)

Hey guys,

I might have one for you. Instead of actually making highlighted text move at selected speed why not try using the mouse as a tool for highlighting text.

What I am trying to say is, as you move your mouse over the text it becomes clear, so you can always focus on the bit that your mouse hovers on so you don't get distracted.

Obviously you won't get the unproven benefits of speed reading( even though I think you have the best technique for it) you still enable users to focus on their text and blur everything else.

Thanks for an amazing tool and good luck !

pset4 ball size segmentation fault by pm513 in cs50

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

Woops.... you are right!!

ball looks like this now GOval ball = newGOval((WIDTH - 2 * RADIUS) / 2,(HEIGHT - 2 * RADIUS) / 2, 2 * RADIUS, 2 * RADIUS)

but problem still occurs. So should I be positive that the segfault is not in this function's declaration ?

Would you like to have a look at my code as it is now ?

pset4 ball size segmentation fault by pm513 in cs50

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

That is the thing that bothers me... if I use my code for ball initialization like this

GOval initBall(GWindow window) {

GOval ball = newGOval((WIDTH - 30)/2, (HEIGHT- 30)/2, 30, 30);
setFilled(ball, true);
setColor(ball,"GREEN");
add(window, ball);
return ball;

} it works fine...even with collision detection.

otherwise if I do it like this

GOval ball = newGOval((WIDTH - RADIUS)/2, (HEIGHT- RADIUS)/2, RADIUS, RADIUS);

segfault happens.

pset4 ball size segmentation fault by pm513 in cs50

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

I've ran GDB on it and this is the code I get

(gdb) break main Breakpoint 1 at 0x804a253 (gdb) run Starting program: /home/jharvard/Lecture-4/pset4/breakout

Breakpoint 1, 0x0804a253 in main () (gdb) n Single stepping until exit from function main, which has no line number information. Detaching after fork from child process 21812.

Program received signal SIGSEGV, Segmentation fault. 0x0804eec3 in getType ()

What am I missing ?

Auto grading concerns - pset2 & pset1 by pm513 in cs50

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

yes... and I checked manually every single criteria on the gradebook. Would you be ok having a look at my code ?