Skip to main content
23 votes
Accepted

can't get the site to run

CS50 course materials will tell you that the permissions need to be set as follows: chmod 711 for directories chmod 644 for images, HTML, CSS, JavaScript chmod 600 for PHP files. In general, this is ...
hotwebmatter's user avatar
  • 3,050
21 votes
Accepted

Pset7 - :( quote handles valid ticker symbol

I found a solution here. I didn't format the price of stock by usd(). When I changed my code from {{ price }} to {{ price | usd }} in quoted.html, it worked.
Anh Nhat Tran's user avatar
13 votes
Accepted

pset7 finance check50 ':( buy handles valid purchase'

There is nothing in the spec saying to output the purchase price to the user. That is because such a page is not required. check50 is parsing your index.html page after it makes one purchase, so it ...
curiouskiwi's user avatar
  • 18.7k
6 votes
Accepted

pwd_context.encrypt Depreciation Warning Pset7

Use hash instead of encrypt in your register function. I tried it, it worked for me. I was able to sign on as an existing user, or register (and sign on as) a new user. I am not advocating blindly ...
DinoCoderSaurus's user avatar
6 votes

pset7 fractions being rejected causing Buy to fail

SOLVED. I added the following: try: shares = int(request.form.get("shares")) except ValueError: return apology("shares must be a posative integer", 400) I was under the impression that, ...
cldaly's user avatar
  • 81
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
5 votes
Accepted

CS50 PSET7 Finance: in SELL; expected to find select field with name "symbol", but none found

The form has an input element whose name is "symbol". The spec requires a select element. Require that a user input a stock’s symbol, implemented as a select menu whose name is symbol. Here is doc ...
DinoCoderSaurus's user avatar
4 votes
Accepted

cs50 finance / pset-7 confused on index() table

Since "stocks" are in one list and "currentprices" are in another list you will get this result when you use two lists and two loops. One solution would be to use one loop and use currentprices[i] ...
DinoCoderSaurus's user avatar
4 votes
Accepted

Using jinja to render template based on previous url - pset7 finance

Inside the function for the respective routes you can just call the function "flash(message)" before the "return redirect()" function, where "message" is the message you want to display. for example: ...
Vikrant Pradhan's user avatar
4 votes
Accepted

finance 500 internal server error on registration

The last line in the log about errorhandler is a red herring. More on that later; will edit after proper research. The important line in the log is where it says something about bind parameters (if ...
DinoCoderSaurus's user avatar
4 votes
Accepted

Finance: How to check if input is valid in "quote"?

If lookup() doesn't find the requested symbol, it will return None. That is not explicitly stated in the spec, but that is what the try/except block does in the function. None is not subscriptable, ...
DinoCoderSaurus's user avatar
3 votes
Accepted

CSS Having No Affect in PSET7

shift-reload or ctrl-F5 will clear the browser's cache and (should) reload your css file.
DinoCoderSaurus's user avatar
3 votes

Pset7 cs50 finance register method not displaying register.html

The post method is only used when you submit a form. Clicking register doesn't count as a post method, therefore you are skipping the entire section of your code in the post conditional, and the code ...
Sameer Malik's user avatar
3 votes
Accepted

pset7 finance check50 doesn't detect a valid sale despite portfolio updating correctly

As suggested in a comment, add this to the top of your lookup function in helpers.py if symbol == "AAAA": return {"name": "Test A", "price": 28.00, "symbol": "AAAA"} and then, with a fresh ...
curiouskiwi's user avatar
  • 18.7k
3 votes
Accepted

SQL3 SUM troubles

You can't use the aggregated value in WHERE. WHERE is applied to the table data, and the aggregated values are created later. There is the complementary HAVING clause, processed after aggregation. ...
Blauelf's user avatar
  • 21k
3 votes
Accepted

I can't seem to fix or find the error in finance. Can someone help? I realize in index.html the if condition needs to be fixed

Sometimes it's the line before the line that is reported. That is the case here. This line print( len(db_shares ) has unbalanced parens.
DinoCoderSaurus's user avatar
2 votes
Accepted

Pset7 Finance: register.php gives me an error

Do not use chmod 777 views/*. That will probably help you to get your site to load, but it is bad for security, and a terrible habit to get into. It's like taking the front door of your house off of ...
hotwebmatter's user avatar
  • 3,050
2 votes

Cannot get started on pset7

Do not use chmod 777 *. That will probably help you to get your site to load, but it is bad for security, and a terrible habit to get into. It's like taking the front door of your house off of its ...
hotwebmatter's user avatar
  • 3,050
2 votes
Accepted

Not being able to access CS50 Finance by https://ide50-username.cs50.io/

REVISED 25-sep-2016 Recap Based on the history of this issue, it has been determined that there is "something wrong" with your workspace. The php5 module is not being loaded in apache50, which makes ...
DinoCoderSaurus's user avatar
2 votes

should I create a table for every user on buy, cs50 finance

I suggest creating a table, called, for example, transactions. In the table, there are columns: user_id, name of the company, quantity of shares, price of 1 share, date. In this way I will keep ...
wingedRuslan's user avatar
2 votes
Accepted

When I run my apache50 server at ~/workspace/pset7/public why does login.php files open?

From the pset instructions: Know that index.php is the file that’s loaded by default when you visit a URL like https://ide50-username.cs50.io/. ...which calls (redirects to) login.php (via ...
DinoCoderSaurus's user avatar
2 votes

Pset7 - Finance: Cannot figure out how to loop through values in list/dict in order to display results in rows in html table

What is going to be stored into your holdings value is "A list of dictionaries", where each list item will be one stock. i.e each list item will correspond to each row of your query: "SELECT stock, ...
Hydes's user avatar
  • 123
2 votes

Using jinja to render template based on previous url - pset7 finance

How about if you create a new session key, like session['action'] = 'Bought' that gets set in the appropriate route?
DinoCoderSaurus's user avatar
2 votes
Accepted

pset7: Help: User always gets logged out

The problem is (probably) in quote.html and buy.html. Likely they have action attribute pointing to login like this <form action="{{ url_for('login') }}" method="post">
DinoCoderSaurus's user avatar
2 votes
Accepted

pset7 question about tables in buy

Ok, I may be wrong about this and I can delete my answer so it stays unanswered if I am. I think the spec is a little murky referenced by Dino on the question linked above. Dino interpreted it to ...
dumbitdownjr's user avatar
2 votes
Accepted

How to convert a 'list' into an int

From the Hints section of the spec: If str is a SELECT, then execute returns a list of zero or more dict objects, inside of which are keys and values representing a table’s fields and cells, ...
DinoCoderSaurus's user avatar
2 votes

pset7 finance buy sqlalchemy.exc.ArgumentError: This text() construct doesn't define a bound parameter named 'id

Each bound parameter in the VALUES clause needs a corresponding named parameter passed to execute. (Conversely every passed parameter should have a matching bound parameter). In the INSERT INTO ...
DinoCoderSaurus's user avatar
2 votes
Accepted

Blank webpage for quote(). No data returns

In quoted.html, with block body, do you mean block main?
Blauelf's user avatar
  • 21k
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
2 votes
Accepted

Pset 7 - CS50 Finance: "Quote" keeps redirecting me to a register error

Check your quote.html, especially the URL the form submits to. I assume that's a Guttenbug (bug by copy&paste).
Blauelf's user avatar
  • 21k

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