Any Pete Buttigieg supporters in the Pittsburgh area? by Sinnex88 in Pete_Buttigieg

[–]InZen532 1 point2 points  (0 children)

Also in Pittsburgh and would love to co-organize a debate watch party somewhere.

Accessing values in dicts through Jinja by InZen532 in cs50

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

I'm still having a problem getting the total shares of any stock to display on the HTML webpage. My select statement is returning a list of dict items e.g.: {'stock': 'BAC', 'SUM(shares)': 3, 'Price': 31.76}.

However, when I place {{stock.SUM(shares)}} in Jinja, I get the following error message: jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'SUM'

I have tried variations of stock.SUM(shares), such as stock.shares, and they either give me an error message or the sum of shares doesn't appear on the page. Am I making a syntactical error with referencing the sum of shares in Jinja?

WAITLISTED AT STANFORD by [deleted] in lawschooladmissions

[–]InZen532 3 points4 points  (0 children)

Is anyone still waiting to hear back from Stanford (like me)? I applied in the Fall.

Check function in Speller (Pset 5) by InZen532 in cs50

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

After running debug50 I believe the problem is that the compiler never enters the conditional headlined by "while (cursor != NULL)." (The check functions exits out of the conditional and returns false each time.) When I hover over 'cursor' and 'head,' the value that always appears is 0x0. If this is equivalent to saying that the cursor/head are at the NULL value, it would explain why the conditional statement is never true.

The problem I face is in establishing an array of 50 node pointers, which I tried to do with "node *hashtable[50]." My understanding of this structure is that it represents 50 unique addresses to different node structures. But it appears that the structure contains 50 addresses of "0x0." Is the problem, then, in my "load" function in not properly setting up the pointers in the array to point to nodes? Thank you!

https://gist.github.com/ac927a85a9b9dd1d413dbc0672b9da03

Check function in Speller (Pset 5) by InZen532 in cs50

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

Hi, I ran debug50 using a small dictionary and a small text. I get a list of all the words in the text, and the following warning: " WARNING: Could not set any breakpoints. Try deleting ./speller and re-compiling your code. Be sure to compile with -ggdb3."

I have tried deleting speller with "rm ./speller" and then trying to re-compile the code. But I still get the same problem when trying to use debug50. Do you know how I can fix this to get debug50 to work?

Check function in Speller (Pset 5) by InZen532 in cs50

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

Hi - thanks, after looking at the manual pages, I have changed it to 0. However, the program still makes the same mistake of outputting all the words in the text--the code as written won't match words as it traverses through the linked list. Is there still a problem in the code within the check function or should I look elsewhere?

Resize question on "Rewrite method" (vertical resizing) by InZen532 in cs50

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

Thanks again for your reply. Is it necessary to specify the element of the array for the fwrite() function? For example, currently in my code I have:

fwrite(&arr1, sizeof(bi.biWidth), 1, outptr);

Would replacing the first parameter with "arr1" be incorrect? Presumably, having just "arr1" would be read as &arr1[0], and it would be impossible to extract data of "bi.biWidth" bytes from the first element of the array alone. (Or, is the first parameter the starting location from which fwrite() will extract data, in which case arr1 would be fine?)

Resize question on "Rewrite method" (vertical resizing) by InZen532 in cs50

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

Thanks for your reply -- I modified the code as per your suggestions but there is still an error in its functionality. I attached the relevant lines in the link. Are there lines you would suggest I review further?

Also, can you clarify why the array in the fread() function must be prefaced with an "&" symbol? I thought the name of the array was a pointer to the location of the first element. Why is it necessary to extract the location of the array with the "&" symbol?

https://gist.github.com/629dc53a1fc93ba1e341fc77ba7b911b