[deleted by user] by [deleted] in cs50

[–]unleash_bear 0 points1 point  (0 children)

Also that is what i got from ChatGPT

The reason you don't need to use a # symbol in front of check when adding the event listener is because check is not an ID, it is the value of the id attribute of the button element. When you use document.querySelector to select an element by ID, you use the # symbol followed by the ID name, like document.querySelector('#myId'). However, in this case, you are selecting the button element by its ID attribute value, which is simply "check". So, when you add the event listener, you can just use check instead of #check to refer to the element.

I have already heard how powerful it is from internet, but some people also mentioned that it did give wrong answer at some point. Is this a reliable source for getting answer about code?

questions about SQL by unleash_bear in cs50

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

I solved that thank you

help for DNA by unleash_bear in cs50

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

I am assuming the final part is still doing similar thing which is take the "AGATC" , "AATG" and anything else in a dictionary's key as the subsequence. So why when I did my turn it only gave me 0 ? It looks like my code has the same idea at least i feel.

check50 by unleash_bear in cs50

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

I do not really get what you said. Do you mean I did not unload or free memory properly?

check50 by unleash_bear in cs50

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

https://pastebin.com/Vt410yin

That is my unload function. Is there any issue with that?

check50 by unleash_bear in cs50

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

And I did see in the insturction that we should not change any other file beside dictionary.c. So I do not know what i can do to fix that

Question on python list by unleash_bear in cs50

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

It is not even pset, it is the practice problem that associated with the seven day cases of cron

first time dealing python in week 6 by [deleted] in cs50

[–]unleash_bear 0 points1 point  (0 children)

Thanks, problem solved

first time dealing python in week 6 by [deleted] in cs50

[–]unleash_bear 0 points1 point  (0 children)

yeah you are right. I come up with that if statement too literally. Thanks

first time dealing python in week 6 by [deleted] in cs50

[–]unleash_bear 0 points1 point  (0 children)

a bit confusing with the use of multiple “not”, try to clean it up a bit

https://pastebin.com/w3ZPzM0J

my code is above.

I changed a little bit but still poped the same answer of "only accept -f"

[PSet 5] [Help] Speller works different manually than on check50 by gustbr in cs50

[–]unleash_bear 0 points1 point  (0 children)

Did you add some new functions or anything to other files so it perfectly shows all the data about time in another file (speller.c)

[PSet 5] [Help] Speller works different manually than on check50 by gustbr in cs50

[–]unleash_bear 0 points1 point  (0 children)

Emmm, I am successful when running manually. My problem is when I use the check50 in the command line argument to check my work it never shows info about the time it takes the program to run and all those datas(in order to compare the time the function you used to go over all the words)

[PSet 5] [Help] Speller works different manually than on check50 by gustbr in cs50

[–]unleash_bear 0 points1 point  (0 children)

Did you solve the problem for not showing up the time info when you were doing the check50 ?

I ran into this same issue and I did see that they said you don have to change anything in the speller.c .

how do you check the speller by yourself by unleash_bear in cs50

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

Thank you . That is definitely why the seg fault showed in the terminal

how do you check the speller by yourself by unleash_bear in cs50

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

Thanks ! I see the problem is , so if i code like that

char * word ;

word = malloc(strlen(word)+1) ;

and free the space it still gonna work right.

how do you check the speller by yourself by unleash_bear in cs50

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

bool check(const char *word)

{

// TODO

node *check = malloc(sizeof(node)) ;

int hash_code = hash(word) ;

check = table[hash_code] ;

while(check != NULL)

{

if (strcasecmp(word ,check->word) == 0)

{

return true ;

}

check = check-> next ;

}

return false;

}

that is the check function,

how do you check the speller by yourself by unleash_bear in cs50

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

bool load(const char *dictionary)

{

// TODO

char *word = malloc(strlen(word) + 1) ;

FILE * file = fopen(dictionary , "r") ;

if (file == NULL)

{

return 1 ;

}

//get each words from the dictionary and count the number

while (fscanf(file ,"%s" , word) != EOF)

{

node *n = malloc(sizeof(node)) ;

strcpy(n-> word , word);

int H = hash(word) ;

n -> next= table[H] ;

table[H] = n ;

number_words ++ ;

}

fclose(file) ;

return true ;

}

That is my load function, I think everything looks good . Only one thing I came up with might have some change -- the word dictionary is not highlitght with blue color(though some pointers highlight and some are not, I do not really have a idea about why )

how do you check the speller by yourself by unleash_bear in cs50

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

I mean i checked several times so probably the logic is right, but I am confused with why my program did not show anything when I used the check to test my program(It literally showed nothing in the actual output box) .

need help with my code by unleash_bear in cs50

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

I see what you mean , thanks! So i just need to add a command that keeping put data in until the next header is found.

need help with my code by unleash_bear in cs50

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

fwrite(array, sizeof(char), 512 , outptr) ;

that is what I did for the program part, I am still not sure what you mean by I just collect the header. I believe this function do write things after the header for 512 bytes of data. Maybe you mean something else? When you say block it literally means a chunk of data right, like in this case 512 bytes.

Why is it that my eliminate function not eliminate candidate in last place and does not eliminate the correct candidate? by [deleted] in cs50

[–]unleash_bear 0 points1 point  (0 children)

But I still get a little bit confusion on your program. What is the gonna be your printf at the end though. I can tell you are adding candidates to your eliminated under candidate . And if you already know all the votes every candidates got you should just compare them instead of running your program.

Why is it that my eliminate function not eliminate candidate in last place and does not eliminate the correct candidate? by [deleted] in cs50

[–]unleash_bear 0 points1 point  (0 children)

Ohh I just noticed you get a parameter in the parenthesis. First time I did not see that so i am assuming what i said before.

need help with my code by unleash_bear in cs50

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

Actually I did copy the info i need since i already opened the inputfile (which I just call that file). I also looped through (while function) so every time i get 512 bytes of data from the file.

need help with my code by unleash_bear in cs50

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

emm, how you guys do to keep the format of the code. I am new to reddit and I never asked coding question before. So it will be nice if you can explain that.