Hot answers tagged

9

Nevermind, just had to clear the cache.


9

Someone else posted some helpful solutions I will summarize here... I can't remember who (sorry). From ~/workspace/ chmod -R 755 pset8 (or chmod -R 755 pset7 ... I had the same Forbidden error with pset7) This opens up lots of permissions and could be security issue in real world, I imagine. But, if you need to get working on the pset... Also, since ...


7

if anyone has run into the issues i have stated above there is a simple fix. Doing some searching around and trying to access urls using https showed me my appliance was not ‘secure’. By going into settings and manually changing the time and date of the appliance, everything is right back on track


6

The spec says Incidentally, be sure not to let drivers pick up any freshmen (i.e., anyone whose home isn’t in js/houses.js)! So you shouldn't pick up that person. Hope that helps, Brenda


6

According to this post on the CS50 Reddit, the permissions have changed since a recent update50, and the documentation has not been updated to reflect the changes. In my experience, you'll need a minimum of chmod 711 for directories, chmod 640 for PHP files and config.json, and chmod 644 for HTML, CSS, JavaScript, images and font files. Open a Terminal tab ...


5

Remember that you can do Pset8 if you have a second computer (either desktop or laptop) running on either Windows or OSX. Just use the appliance as a "server", the second computer (with GoogleEarth plugin) as a client, and ollow the instruction posted here to connect to the appliance using another computer.


5

labelClass: "labels", Defined in CSS as 'label', not 'labels'. labelContent: markers.place_name, The passed variable to this function is place, not markers. Did you define the parameters variable for $.getJSON("articles.php", parameters) ? We should pass there geo: place.postal_code json. Define the articles before you call the $.getJSON query, like: ...


5

See this post: Issues with the CS50 IDE There have been updates to the IDE, and unless there's a new way to get there that I'm missing, there's a bug in accessing your own site through the IDE.


5

This can be easily solved by noting which terminal the export command was executed in the same terminal window that flask is running in (will be prompted to run in after the export command). Otherwise, flask cannot recognize the API_KEY as an environment variable, hardly being an environment variable.


4

I'm not sure you can simply initialise the new array like that. Why not just add the placemark and marker to the PASSENGERS array? You can just do that 'on the fly' with PASSENGERS[i].placemark = placemark; etc. Anything you want to store in the passengers array can be done like that. For example, I have a field that holds whether or not the passenger is ...


4

Warning: this answer is related to version fall 2013 of the course Yes, problem set 8 is optional. Quoting the professor's comment on a post on the course's Facebook group Original Post: In pset8, I am unable to get Google Earth plug-in working on my computer then can i skip this problem ? If yes, then it is necessary to inform CS50x team ? Prof. ...


4

Had the same trouble. Fix it with 'var' before 'marker = new...'. Else you overwrite the same variable each time.


4

UPDATE: I have verified that chmod 640 is still required for PHP files, even with version 62 of ide50. The quickest way to get all of the PHP files set from 600 to 640 is to execute the following command in the pset8 directory: ~/workspace/pset8/ $ find . -name *.php |xargs chmod 640 Once I did that, I started to troubleshoot the PHP issues. I'm not done ...


4

There is an example of MarkerWithLabel here that should show you how to do that. It's the labelContent property. Transcript of an example from that link: var latLng = new google.maps.LatLng(49.47805, -123.84716); var homeLatLng = new google.maps.LatLng(49.47805, -123.84716); var map = new google.maps.Map(document.getElementById('map_canvas'), { zoom: 12, ...


4

Complete the implementation of /articles in such a way that it outputs a JSON array of objects, each of which represents an article for geo, whereby geo is passed into /articles as a GET parameter # retrieve the geo argument location = request.args.get("geo")


4

According to the spec [emphasis added]: Complete the implementation of /search in such a way that it outputs a JSON array of objects, each of which represents a row from places that somehow matches the value of q, as in the staff solution below. If you return jsonify([q]) it is returning a JSON array of a JSON array of objects. You shouldn't use that. It'...


4

So it seems the workaround solution was to add app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False somewhere after the app = Flask(__name__) The issue has been reported (https://github.com/pallets/flask/issues/2549, and duplicate https://github.com/pallets/flask/issues/2599), and is fixed in current release, so let's hope we get an updated version soon (as ...


3

Replaced with: $.getJSON("articles.php?geo="+place.postal_code) .done(function(data, textStatus, jqXHR) { more code } and now call is returning data. Still not sure why previous code didn't run, but now project works!


3

This is why the pset says to use Chrome outside the appliance. If you don’t have it installed on your computer already (outside of the appliance, not inside of the appliance), download and install the latest version of Chrome and Now head to the URL below using a browser on your own computer (outside of the CS50 Appliance), where w.x.y.z is your ...


3

USE A DIFFERENT BROWSER. I tried using Mozilla instead of chrome to load the page, and it worked wonders for me!


3

I think the problem may be that your add listener is outside the addmarker function scope. If you need more help, i'll be glad to help :)


3

Have you tried clearing the browser cache (shift-reload or ctrl-F5)? That will cause the browser to re-download your js file. Since you mention "code from last year" is it possible apache is started in a different "path-to-root" than you expect?


3

@Vitale: I feel your pain! Permission errors can be really frustrating. You are impatient to get back to work, and in your haste, you reach for chmod -R 777 *, the biggest sledgehammer in your toolkit. It probably feels like you have solved your problem, because the permission errors have gone away. Now you can get back to work! But chmod -R 777 * is never ...


3

Have you tried to clear Chromes's cache? https://support.google.com/accounts/answer/32050?hl=en Another approach is to use the browser in incognito mode. Chrome's incognito mode uses a fresh cache and cookies and gets rid of it off when you close the incognito window. And you shouldn't worry about that NO APIS KEY error, it's minor. You can do the pset ...


3

That's old news. The staff's output, I mean. All the articles are a month old. It is reasonable to assume that the staff's solution has "features" that are unknown (and unknowable). As noted in the spec, Additionally, you can search for location based news by modifying parameters in the URL, like the ones below. For a full list of parameters you can ...


3

If you got You have exceeded your request quota for this API. See https://developers.google.com/maps/documentation/javascript/error-messages?utm_source=maps_js&utm_medium=degraded&utm_campaign=billing#api-key-and-billing-errors message in the console and the map displays with For development purposes only overlay, that is to be expected. Since you ...


3

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. Use that instead. It's placed directly after the GROUP BY part.


3

If phpliteadmin will not open in preview, try phpliteadmin {dbname} at the command line. It will say "Running phpLiteAdmin at " followed by an address. Hover over the address, click, choose "Open". It will open phpliteadmin in a new browser tab instead of an IDE tab.


3

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, so result["name"] will give an error in the case that lookup hasn't found a stock. Since None is falsey, if not result: will evaluate to true if lookup returned ...


2

An elegant way to check if a certain variable was declared (or not) is the in operator. The check if a passenger is a freshman can be done like this: // check for freshmen if (!(PASSENGERS[i].house in HOUSES)) { $("#announcements").html("No freshmen, sorry. Blame the pset specs."); } PASSENGERS[i].house in HOUSES returns true if a variable of the name ...


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