Hot answers tagged

9

Nevermind, just had to clear the cache.


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


4

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


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

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

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

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


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 ...


2

I also had this issue. The Date/Time adjustment didn't help but an Update50 and a reboot sorted it for me.


2

I figured it out. <%= ... %> is indeed the way you pass in arguments to _.template. When I watched the video in the problem set again the prof mentioned how this code operates similarly to the "%i" placeholder in printf in C. Essentially, you insert the column titles in your phpMyAdmin table into the <%= ... %> placeholder within the _.template TODO ...


2

It is very weird but I advice you to follow these steps: Use ALTER TABLE <table> ENABLE KEYS to make sure that your keys are active. If nothing's still working, use ALTER TABLE <table> DROP INDEX <key_name or if no key_name set, column_name>. This command erase your Index_type and will allow us to reassign the columns with a FULLTEXT ...


2

I thought the problem was in the $.getJSON part, but instead, it was putting showInfo(marker, content); OUTSIDE $.getJSON.done. As @ChrisG helped me discover (see comments above), it returns at the end of .done, so content had not been accessible to showInfo. A few window.alerts demonstrated that $.getJSON was working properly, so from there, it wasn't hard ...


2

You are on the right track! For example, you are definitely not putting the $.getJSON statement in the right place. But that's easy to fix. Your real problem is with variable scope. One of the most challenging things about JavaScript is that its variable scope can be confusing. I Googled and found this explanation: JavaScript has two scopes – global ...


2

This while(fgetcsv($file, 500, "\t")) is reading the odd numbered lines. This $csvarray = fgetcsv($file, 500, "\t"); is reading the even numbered lines, which are then inserted into the db.


2

You are always setting myLatLang here var myLatlng = new google.maps.LatLng(42.3770, -71.1256); // Cambridge, Massachussets, so all the markers will go "there". The argument place is the result of the SELECT query in the update route in application.py, so you probably want the lat/lang from the place dictionary. Instead of doing this: var myLatlng = new ...


2

It looks like you are not in the same directory as when you ran phpliteadmin to create the table. If you sqlite3 mashup.db and mashup.db does not exist, it will be created. If that happened, then there is no places table. This is the message you get when you execute the import and the table doesn't already exist. [Another possibility is that there is a ...


2

1: The more columns you are searching the more results you return. For example as you start to type the word "Boston" the search query takes 'B' and looks for every word in the column with a 'B' in it. It will return a lot of results. Now the more columns you search the more result you will get. 2: This question is linked to the first as in the more letters ...


2

You only show the instructions from the spec, not what happened when you ran the commands, so this answer is only speculative. First, I followed the directions and it worked as expected. Some possibilities A copy/paste accident? Like mashup.zip downloaded twice instead of mashup.zip and US.zip Wrong directory? US.zip is in another directory, like pset8 ...


2

The removeMarkers will get rid of one marker, the last one added. The problem is in addMarker. addMarker will be called for each "place" and should add one marker to the map and one marker to the markers array. Look at where this line markers[i] = marker; is and you should see that the markers array is incorrect.


1

I figured it out! It turns out that the issue was not the commented code. The issue was actually the declaration of the while loop. I can confirm that's the case because when I go to PHPMyAdmin I can indeed see all the lines from my data set (in this case US.txt). I am advancing now onto the third out of four to-dos (search.php)


1

Fulltext index is only supported on columns that are either of type varchar, text, or char, and some others you likely won't use. latitude and longitude are both of type decimal. See this page, quote below. Only columns of type char, varchar, nchar, nvarchar, text, ntext, image, xml, and varbinary(max) can be indexed for full-text search. Edit: I saw ...


1

If you went to Developer Tools > Console, you would probably see something like ReferenceError: myLatlng is not defined on some of the lines there. The issue is that you assign myLatlng (with lowercase l) to the position property, but you declared myLatLng (with uppercase L). Also, you should add var to the declaration of myLatLng.


1

Answers 1. Yes. The following function function addMarker(place) { // GPS coordinates for marker var latLng = new google.maps.LatLng(place.latitude, place.longitude); // Create marker var marker = new google.maps.Marker({ position: latLng, map: map, title: place.place_name, text: place.place_name, }...


1

first-off there is some change about EDX 2015 class. read this https://courses.edx.org/courses/HarvardX/CS50x3/2015/info Now Marker with label you have to read this http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.1.9/docs/examples.html Which is given here http://cdn.cs50.net/2015/x/psets/8/pset8/pset8.html#addmarker_2 ...


1

You need to use /img/news2.jpg (notice the preceding slash) since img is a subdirectory of public (assuming that news2.jpg is stored in img). You should be able to do it in one line this way: icon: '/img/news2.png',. That worked for me.


1

Assuming you get this error when viewing places table after import, check out this post: a problem with displaying the places table


1

In a word: postal_code. If you run this query (I added place_name to get a more manageable result) SELECT * FROM places WHERE (40 <= latitude AND latitude <= 41) AND (-74 <= longitude OR longitude <= -73) and place_name like 'New York%' it returns 165 rows because there are 165 distinct postal codes in that selected set. When you add ...


1

Have you seen this post? Pset8, modified value of suggestion, still not working It suggests clearing the browser cache. You can do that with a shift-reload or a ctrl-F5.


1

You will get this error PHP Fatal error: Column 'country_code' cannot be null in /home/jharvard /vhosts/pset8/includes/functions.php on line 57 if you use while(!feof($yourfile)) to iterate over the input file. From the Week 4 -> Shorts -> File I/O transcript: Thus, a while loop with the condition (!feof(fp)) might seem like a perfectly ...


1

How are you getting the data from the csv file and populating $file and, by extension, $row? I would start by doing a dump of $row just before the query. I suspect that there is no $row[COUNTRY_CODE], or it could be as simple as you've forgotten to put quotes around "COUNTRY_CODE". ;-) In my code, I used the fgetcsv() function in a while loop and, for ...


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