Hot answers tagged

4

Don't look at it like a mountain and get so overwhelmed. It's just another pset, maybe a little more difficult than the previous ones. Start from the beginning, watch all the lectures and short videos of week 8 and try to remember as much as you can, but don't sweat it. Just start the pset and read each step carefully, it's very well described what you have ...


4

403 Forbidden / permissions / chmod: the Definitive Guide TL;DR: PHP files and config.json need to be set to chmod 640 despite what it says in the Problem Specification. Hope this helps!


2

A problem is here: if rows == 1:. Remember, execute returns a list of dictionaries, therefore that conditional is never true.


1

The proximate cause of the error is id is not submitted with the form. There may be an easier way that would eliminate the code that is presumably duplicated between index and buy/sell. The button element has an attribute formaction that will override the action attribute of the form element.


1

The name for shares is "symbol". It is in this line: <input autocomplete="off" autofocus class="form-control" name="symbol" placeholder="Shares" type="text"> It should be named shares. Also your code is incomplete as it doesn't save/update the stocks and history. If this helps, the please ...


1

The SQLite does not support adding constraints to existing tables. The use of an unique index shall deliver the same effect. CREATE UNIQUE INDEX example ON illustrations (reference) The documentation for the SQLite specific constraints can be found here


1

Sure. Use the UPDATE sql command, It'll take the form of "UPDATE table SET some value WHERE some_condition". Google sql update For example: UPDATE users SET firstname = "Fred", lastname = "Derf" WHERE userid = 3 Or UPDATE holdings SET shares = shares + 100 WHERE userid = 2 AND symbol = "AAPL" THis handles the ...


1

The "sequence" in the error message is shares, which is a string. From MDN doc on sending form data: Whichever HTTP method you choose, the server receives a string that will be parsed in order to get the data as a list of key/value pairs. The "values" are always strings.


1

Iirc the users table in the db was provided for us, so while Cliff's solution would work it's not the issue. I'm not sure if the SQL in the below function is calling anything, so nothing will be assigned to result. You'll just insert new lines without ever checking for duplicates. result = db.execute("INSERT INTO users (username, hash) VALUES (:username,...


1

The name of the attribute is 'disabled' (past tense), not 'disable'. And, of course, "submit" is enabled by default, so the toggle will not work if nothing is entered in the "task" input before the "submit" is executed.


1

"open index.html" is not the appropriate command to open the browser, if we are in the appropriate directory, this command will open a file like this name in the IDE editor, if the file does not exist in the directory it will create a new file with that name (although not automatically saved). The correct command would be "apache50 start [directory]", where ...


1

I've finally got the message. You were right. The 2015 and the 2016 versions of the instructions are different. I thought I was reading the 2016 version which in fact was the 2015 version. In the 2016 version it asks you to access your fully qualified domain name (FDQN) and from there you can access the files under the public folder in the browser. It took a ...


1

server gives the "Stopping server" message when it cannot find the "/path/to/root". So, there is no "public" folder in your current working directory when you execute ~cs50/pset6/server public. Either cd to the parent of your public folder or use full path. 192.168.1.94 looks like your local IP address. You need to contact the server at the IDE address. ...


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