Skip to main content
5 votes

Problem with query quotes from Yahoo finance

Thank Brenda Anderson from Facebook group CS50 for providing a new code for helpers.py
Pham Tien Duc's user avatar
2 votes
Accepted

Alternative to multiple if statements?

You can refactor your code to use only one if statement! Think about the number of MIME types you have to check for, and the number of matching file extensions. Since there are the same number of ...
hotwebmatter's user avatar
  • 3,050
2 votes
Accepted

Pset6 one check50 error

It's a common problem when abs_path and query are built one character at a time. The problem seems to be in parse. abs_path (and query) are not properly null-terminated. So server returns a 404 error ...
DinoCoderSaurus's user avatar
2 votes
Accepted

(PSET6) hello.php always displays hello, hello, world regardless of input?

The "weird" results you report For some reason, if I alter the order in which the file extensions are searched, cat.html suddenly doesn't load. is the "unpredictable results" that happen when ...
DinoCoderSaurus's user avatar
2 votes
Accepted

Finance index function does not return lookup value in index.html

Each dict in portfolio contains 3 keys as returned from the execute. There is no key current_price, so the html does not render anything for that column. If the key gets created in the for loop in ...
DinoCoderSaurus's user avatar
2 votes

Problem with query quotes from Yahoo finance

Yahoo finance has killed it's API You can read more about the topic via the Hacker News discussion linked below. https://news.ycombinator.com/item?id=15616880
John Quinn's user avatar
1 vote
Accepted

Why does my lookup function keep returning "None"?

Since the quote spec calls for an element named "symbol", and this if not request.form.get("stock"): is apparently working, it looks like the element is not named properly in the ...
DinoCoderSaurus's user avatar
1 vote
Accepted

Pset 9 Finance index function, current stock price not displaying correctly

The problem isn't lookup. The problem is portfolio. There are exactly two keys in the portfolio dictionary, "current_price" and "holding_total". They are set to the values in each ...
DinoCoderSaurus's user avatar
1 vote

CS50 Finance lookup function always returns NONE

OK, i am just dumbo, i used my API token without last character
Женя Хромов's user avatar
1 vote

Scramble.c lookup function found flag

A few things. Valid indexes would probably range from 0 to size-1, and as you chose your interval boundaries as both being part of the interval, your initial interval end should include the -1, to ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

PSET7 Finance Question Quote Lookup Page

One problem is here <form action="/quote.html" method="post">. There is not a quote.html in document root (it is in subdir templates), thus the 404. But do you really want the form action to be ...
DinoCoderSaurus's user avatar
1 vote

scramble lookup function

dictionary contains an array of words and each of those words contain an array of letters. So dictionary.words[0].letters would represent the first word in the dictionary. You're on the right track,...
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

PSET6 Lookup - Read-Only Variable As Well As How to Approach

When you use that keyword const, you're promising your compiler that you won't change the contents of what's inside the array. That's why the compiler yells... because you're trying to change it here ...
Yuri Laguardia's user avatar
1 vote
Accepted

Need help with pset6, lookup and parse function!

char* s = strrchr(path, '.'); as I understand strrchr returns a pointer to point '.', hence the string s would be something like ".css" for example, on the other hand strcmp, compares two string, to ...
MARS's user avatar
  • 5,179
1 vote
Accepted

Why Pset6 check cat.exe and non-existant file going wrong?

First suggest you send a request to server from browser or curl. You will discover that server seg faults. (That's what this \ expected output, not an exit code of 0 feedback from check50 indicates). ...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset 6 server - Load produces inconsistent results

for (char read = fgetc(file); read != EOF; read = fgetc(file)). read cannot be a char. Because of internal casting in fgetc, this can return a "false eof", and almost always does on binary (image) ...
DinoCoderSaurus's user avatar
1 vote
Accepted

PSET6 check50 server1 cat.exe and non-existant file return error 505

server should return 505 in exactly one place, from the parse function http version check. That means that strcmp(HTTP_version, "HTTP/1.1") does not return 0. That means that HTTP_version is not "HTTP/...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset6 server.c 403 forbidden for "/", problems for lookup and indexes

Hint: This line in indexes if (access(phpcheck, F_OK)) (and the other access) is wrong. Suggestion: Read man access. Pay special attention to the RETURN section. access returns an int. Treat it like ...
DinoCoderSaurus's user avatar
1 vote

Pset6 check50 server1 parse error

I inserted your program in this parse.c to debug it: #include <stdio.h> #include <string.h> #include <strings.h> #include <cs50.h> #define LimitRequestLine 8190 bool parse(...
Ricardo David Antonetti's user avatar
1 vote

Pset6 check50 server1 parse error

Since there are only two places in server.c that return a 505, and they are both in this parse function, that's a good place to start looking. debug50 or gdb (tips here) would be perfect tools to ...
DinoCoderSaurus's user avatar
1 vote

pset6 server fails check50

First of all, WOW: your code is awesome. I took LOOKUP on the side and I could not see any obvious errors. I did find some behaviors on PARSE you might find useful. This is how I debugged your ...
Ricardo David Antonetti's user avatar
1 vote

pset6 server fails check50

There are some problems that are quick to see. They are most likely not all the problems in play here. parse The server1 failure probably stems from here strncpy(request, req_pos, (v_pos - req_pos -...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset6: requesting php from within html isn't working

Since those are the only two tests that fail check50, redirect your attention to how query is built in parse. Since hello.php "works fine", verify that query is properly null-terminated. A helpful ...
DinoCoderSaurus's user avatar
1 vote
Accepted

Pset6 - check50 missing cat.exe and non-existant file request

strcasecmp is meant for comparing string without caring about capitalization. Comparing twice, with different capitalizations is not really useful here. The reason why you are getting the 505 HTTP ...
Aizen's user avatar
  • 309
1 vote
Accepted

Problem with check50 for server1

There's only one place that server returns a 505, and that is from your parse function. Your server is never even getting to lookup. This guy if (strcmp(word, "HTTP/1.1") != 0) is always evaluating to ...
DinoCoderSaurus's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible