Questions tagged [pset6]

The problem set for Week 7

Filter by
Sorted by
Tagged with
8
votes
2answers
2k views

PSET6 Server - Parse function (requesting two files in a row)

I'm currently working on PSET6 and have implemented the parse() and lookup() functions. When I try to test my code using CS50 (the first part), I get all checks minus the last one, "Requesting two ...
7
votes
1answer
1k views

having trouble validating request line in server.c

My main issue is doing this without using the heap, I think. I set up arrays for each of the pieces of the request-line (e.g. method, request-target, etc.) and set all of them to be of length = strlen(...
5
votes
1answer
2k views

Please explain char* dictionary = (argc == 3) ? argv[1] : DICTIONARY; from speller.c

I am not sure if I understand what this piece of code in speller.c is trying to accomplish. char* dictionary = (argc == 3) ? argv[1] : DICTIONARY;
5
votes
1answer
229 views

Pset6: Can't access the server outside the appliance

I've been trying to do pset6 and wanted to access the server on the virtual machine through my host (using Chrome browser outside the appliance). I plugin in the ip address and port number (making ...
4
votes
2answers
8k views

Why use fgetc instead of fscanf?

In pset6 specification, in question 5, we have been asked why fgetc has been used instead of fscanf. And i don't understand the benefit of using fgetc. So please explain this. Also, in pset 6 ...
4
votes
1answer
1k views

pset6 - caesar - check50 error: “expected exit code 1, not 0”

I scored the web after an answer, found it, but still doesn't work. My caesar.py works fine, check50 shows me all happy faces except the last: :( handles lack of argv[1] expected exit code 1, not ...
4
votes
2answers
266 views

How to access the hash table inside check function?

I have written the code for the load function that forms a hash table of the words in the dictionary , how to write the code for check as the hash table which I have made is local to the load ...
4
votes
1answer
534 views

Improve load time in pset6

So I'm in pset6 and my time is 0.01 seconds slower by the staff's implementation. Should I try to improve it more? Does it matter? If I should improve more how can I do it? Particularly in load as ...
4
votes
1answer
1k views

pset6: Double Free or Corruption error on using free in Unload()

I get the following error on running speller.c: double free or corruption (fasttop): 0x084a7008 And this is what running Valgrind gives: I understand that this error occurs on trying to free ...
3
votes
1answer
952 views

Instance of 'Analyzer' has no 'tokenizer' member

tokens = self.tokenizer.tokenize(text) I have the same code as in the walkthrough, yet I'm getting the error in the title.
3
votes
1answer
2k views

pset6 tweets, analyze.py and application.py

I've been stuck here for a while, any help would be appreciated, thanks I'm getting this error on the console while trying to run ./tweets @cs50: ~/workspace/pset6/sentiments/ $ ./tweets @cs50 ...
3
votes
1answer
134 views

Is cs50.net/discuss open to students without a Harvard University ID?

In the pset6 specification, just after the last inline youtube video and the info about Valgrind, there is a link to cs50.net/discuss. When I click it, it redirects to the HUID/XID login screen. ...
3
votes
1answer
158 views

Do we want to respond to client with file including headers?

I have a couple questions about what is expected when it comes to the respond to client part of the code. My confusion arises when it comes to the part where we have to write out the bytes of the file....
2
votes
2answers
3k views

pset6 python bleep

i have this failed test when i use check50 in pset6 bleep :( handles banned words lists with arbitrary words in them Log running python bleep.py banned2.txt... sending input My cat and dog ...
2
votes
1answer
402 views

IndexError in initial state of pset6 Sentiments

I am working on Pset 6, Sentiments and followed the steps to create my app on twitter. I added keys, installed requirements.txt and did everything in order, but when I type "flask run" and visit the ...
2
votes
2answers
1k views

how to close port 8080?

~cs50/pset6/server public and ./server public in my own directory worked fine for a long time but now when I try to run it I get the message "Port 8080 already in use, stopping server." How can I ...
2
votes
1answer
947 views

Speller works perfectly but check50 shows the error: “\ expected output, but not '\nMISSPELLED WORDS\nThe\nquick\nbrown…'”

I am having some major difficulties with pset6. I have gotten my program to work perfectly as far as I can tell. However when I try to run the program through check50, I get the following error ...
2
votes
1answer
95 views

Why doesn't strcmp return true in this sample program?

Here's the code: #include <stdio.h> #include <string.h> int main () { char str[] = "This. is a sample string"; char * pch; pch=strrchr(str,'.'); char* test = ". is a sample ...
2
votes
1answer
2k views

Server.c pset6 issues

I am currently going through server.c in pset 6. this is server.c: https://gist.github.com/anonymous/5b24f101bf5d53018cbc my functions: lookup: https://gist.github.com/anonymous/...
2
votes
1answer
627 views

pset6 : cs50 IDE problem starting my server The webpage is not avialable

I have just started the lecture of week7 and struggling to start. I had my cloud9 account and when I started the server using apache50 start . Setting Apache's document root to /home/ubuntu ......
2
votes
2answers
556 views

How do i check my own implementation of server.c

i have completed server.c and now I want to test it! What command do I type in terminal?
2
votes
1answer
232 views

strcat: what am i doing wrong?

I'm currently doing the pest, and I'm at the step which I have "to define a string called path that contains the concatenation of root (a global variable) and absolute-path." As suggested, I'm using ...
2
votes
1answer
240 views

To ensure the file is readable

In pset6, server.c, what should I do to make sure the file is readable? the problem set guide says it's possible to use "stat" or "access"? since both return 0 on success and -1 if not, how do I ...
2
votes
1answer
647 views

How does the Makefile from pset 6 work?

Could someone help provide clarity in the matter of the Makefile used for pset 6? I understand everything up to line 32, that is where it gets confusing. Here the dependencies for the program $(EXE) ...
2
votes
1answer
259 views

pset6 mario/more fails one check50 test despite getting correct output

My code passes all tests of check50 running check50 cs50/2018/x/sentimental/mario/more except this one: rejects a height of 24, and then accepts a height of 2 expected " # #\n## ##\n", not "" ...
2
votes
1answer
6k views

Why am I getting TypeError: expected string or buffer?

This is my tweets file #!/usr/bin/env python3 import os import sys from analyzer import Analyzer from termcolor import colored from helpers import get_user_timeline def ...
2
votes
1answer
248 views

“subtraction” of string in pset6 server.c

In server.c in pset6, there is a line of code where a string is "subtracted" from a string. I tried to find out what this operation does by writing a simple program : char* needle = "needle"; ...
2
votes
1answer
3k views

Segmentation fault and “Address 0x30 is not stack'd, malloc'd or (recently) free'd” message in Valgrind

I have finished implementing pset6; however, I get a segmentation fault, when trying to run it. In valgrind I get this error message: ==2741== Invalid read of size 4 ==2741== at 0x8049277: load (...
1
vote
1answer
2k views

PSET6 (web server): load function giving segmentation fault

I am getting some strange behavior associated with the load function that I can't seem to debug. When I visit the root directory, I am getting the error below, which appears to be occurring after I ...
1
vote
1answer
139 views

not fully understanding dynamically sized array in server.c pest

I am not fully understanding what is happening in the line below Char line[needle - haystack + 2 + 1] Is it subtracting the address of needle from haystack(haystack and needle are pointers) then ...
1
vote
1answer
120 views

PSET 6 Keeps Stopping Server

Sorry if this question is a duplicate. I tried to look over stackexchange before posting this (and I couldn't find anyone who was having a similar issue). I am having trouble getting my server to do ...
1
vote
1answer
1k views

How to start with load function in server.c?

I've got problems with implementing load function in server.c. I know general pseudocode, but when it comes to deciding which type variables do I need, I'm a bit stuck. Can someone help me with this?
1
vote
2answers
2k views

implementation of hash table

I have been having trouble with the implementation of the hash table and linked lists. I don't know if I am on the right track or not, but I think my main problem is not knowing how to automate the ...
1
vote
2answers
281 views

Pset6 similarities less substrings I get wrong output

I’m super close. But I cannot figure out right formula. It doesn’t count amount of the similar substrings correctly. I mean the output is wrong. https://pastebin.com/gEvxAS1X
1
vote
2answers
487 views

Help understanding similarities pset6

I still don't get it yet how the 2D list/array works to figure out the cost between the strings (Is the tuple in matrix[len(a)][len(b)] right ? I would like some explanation please kk I have ...
1
vote
2answers
747 views

pset6 - Similarities: compare has error receiving lists

In Similarities, I'm told that my functions in helpers.py (lines, sentences, and substrings) should return lists. However, when I try testing my functions, I receive an error telling me that "object '...
1
vote
1answer
799 views

Error in pset6 API Key not set

I'm getting this error, I have been working to make it work but i can't. I followed the instructions on setting up the API_KEY value: Traceback (most recent call last): File "tweets", line 25, in ...
1
vote
1answer
91 views

Pset6 load returns length zero for php files

First time posting so if I'm off the mark here let me know. Basically, in writing server.c I can't figure out how to test my load function now that I've written it. check50 will only work once I've ...
1
vote
2answers
1k views

Help with .php files in Pset6 -> Load

Me again, still in pset6, right now working on "load", I did this so far: bool load(FILE* file, BYTE** content, size_t* length) { fseek(file, 0, SEEK_END); long size = ftell(file); fseek(...
1
vote
1answer
379 views

my server pset throws up “505 HTTP Version Not Supported” but i think it should not

Am done with pset6 but want to test if I implemented the server correctly but when I type in the URL (e.g: 192.#.#.#:port#/cat.jpg) into the browser as specified by David, I get the following error "...
1
vote
1answer
713 views

valgrind messages about “unititialised value(s)” - are they an issue?

My speller program functions fine, but when I run it in valgrind, I get a lot of messages saying Conditional jump or move depends on uninitialised value(s). Looking into this a little, I think this ...
1
vote
3answers
81 views

Does our implementation of speller need to be able to handle an unsorted input dictionary?

In another post, user1723 touched on a question I had while watching the lecture, sections, and walkthrough on pset6. The question was, why would we need to sort our linked lists, when dictionaries, ...
1
vote
2answers
94 views

Pset6 Similaritites Less Comfortable

Earlier, I was looking up questions about Pset6 to see if there are any answers that can help me with my code, however, it looks like I completely missed the memo for using set with similarities. My ...
1
vote
1answer
61 views

tests give weird results despite (seemingly) correct output

I receive the test feedback expected "# #\n", not " # # \n" for the test running with n = 1, with the following code snippet called to for printing: for i in range(n): print( (n - i) * '...
1
vote
2answers
43 views

What is length in matrix.html?

I was going through this solution of pset6 (more comfortable) and I fail to understand the following for loop: {% for i in range((s2)|length + 1) %} <th>{{i}}</th> {% endfor %}...
1
vote
1answer
602 views

Help with analyzer.py please?

I've watched and rewatched the lecture and walkthroughs on pset6 analyze.py, and read the tokenizer documentation. Here's my code. Can someone help me figure out what I'm doing wrong? import nltk ...
1
vote
1answer
300 views

PSET6: Port 8080 already in use?

I've tried using apache50 stop + changing the port and I can't get the webserver to run on my machine, instead I get the error: ~/workspace/pset6 $ ~cs50/pset6/server 8081 public Stopping server ~/...
1
vote
2answers
36 views

Server.c failing with open ended query

I've heard you guys rock here, so here's my first question: My server.c code passes all tests but for one, :( Requesting hello.php? returns 200, text/html, and correct output \ expected output, ...
1
vote
1answer
178 views

PSET6 | server.c | access()

I'm reviewing the server.c source code to better understand it because I believe this particular pset is largely about understanding source code not written by us and how the internet works generally. ...
1
vote
1answer
585 views

Pset6 Server.c: 404 Error only when submitting query on hello.html, everything else works

Every time I input a query on the HTML form, I get a 404 Error even though the query appears in the URL, and printf seem to indicate that my Parse function is correctly extracting the right substring. ...

1
2 3 4 5
17