Skip to main content
4 votes

pset8 infoWindow appearing with wrong marker

Had the same trouble. Fix it with 'var' before 'marker = new...'. Else you overwrite the same variable each time.
Yury's user avatar
  • 41
4 votes
Accepted

jsonify not working when I add this line of code <<db = SQL("sqlite:///mashup.db")>> to application.py

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/...
Blauelf's user avatar
  • 20.9k
3 votes

Pset8 Mashup Map Not loading

USE A DIFFERENT BROWSER. I tried using Mozilla instead of chrome to load the page, and it worked wonders for me!
peanutlover's user avatar
3 votes
Accepted

My articles do not match with the staff articles

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 ...
DinoCoderSaurus's user avatar
2 votes
Accepted

pset8: infowindow and $.getJSON difficulties

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 ...
hotwebmatter's user avatar
  • 3,050
2 votes

CS50 Mashup: addMarker clarification

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 ...
DinoCoderSaurus's user avatar
2 votes
Accepted

pset8, import. Only even row numbers from US.txt are being written to db

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.
DinoCoderSaurus's user avatar
2 votes
Accepted

2017 pset8 mashup: Slow search - how to improve search performance?

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....
Shauny's user avatar
  • 96
2 votes
Accepted

Mashup: removeMarkers not removing markers? PLEASE HELP

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 ...
DinoCoderSaurus's user avatar
2 votes
Accepted

Pset8 - mashup (2018 or 2017): Downloading distribution code does not include txt files

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 ...
DinoCoderSaurus's user avatar
2 votes
Accepted

PSET8 Mashup.db Error (Places)

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 ...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset8 addMarker undefined in info window

I incorporated this addMarker function into my app and it showed the list of articles in the info window (though the articles don't have "links"). So I "tweaked" articles; changed return jsonify(...
DinoCoderSaurus's user avatar
1 vote
Accepted

Do we need an API key for mashup?

As mentioned in the comment, Mashup has been retired for the 2019 course. You of course can still work on it if you'd like, but if you are going for a certificate, it cannot be submitted for a grade. ...
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

PSET8 invalid sw.

A list of a list. Program expects a list of places. execute returns a list of rows. This return jsonify([placesMatches]) (specifically the []) nests placesMatches into another list.
DinoCoderSaurus's user avatar
1 vote
Accepted

PSET8 Mashup : helpers.py

lookup.cache is a dictionary. It is used to store all news articles that already have been looked up earlier for that zipcode. The reason to do this is twofold: It makes the application faster It ...
Peter Pesch's user avatar
1 vote

Pset8 Mashup removeMarkers not working

The removeMarkers function is really is no more than a line of code as below,simply passing a null to the setMapOnAll() function would suffice : setMapOnAll(null);
sk.76's user avatar
  • 312
1 vote

pset8 2018 mashup search

I'd change that to simply $.getJSON("/search", ....) with no reference to Flask.
curiouskiwi's user avatar
  • 18.7k
1 vote

PSet8 Mashup Jsonify call fails on unmodified project

Even I'm facing similar kind of problem. It seems the flask itself has problem with jsonify. Here is the link issue reported https://github.com/pallets/flask/issues/2549 Adding the following code ...
Samarth Giriyapura's user avatar
1 vote

Pset8 Mashup search function not displaying the correct suggestions

Try using the following: SELECT * FROM places WHERE postal_code LIKE :q OR place_name LIKE :q OR admin_name1 LIKE :q LIMIT 0,10
Teo Protoulis's user avatar
1 vote
Accepted

How to insert data from a txt file to specific SQLite table column

You could do something like: make the text file have 2 columns, postal_code and full_location. Then import that file into a temp table. Then write a sql to update the places table with full_location ...
DinoCoderSaurus's user avatar
1 vote
Accepted

request.args.get, how is it used in application.py?

Look at the update function in scripts.js. They are sent as parameters when the update route is called here $.getJSON(Flask.url_for("update"), parameters).
DinoCoderSaurus's user avatar
1 vote
Accepted

problems with markers on addmarkers pset8

I was able to reproduce the reported error sqlalchemy.exc.ArgumentError: This text() construct doesn't define a bound parameter named 'ne_lng' by modifying the (first) SELECT sql in the update ...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset8 search function not working like supposed to

Here's a way to see what the problem is using command line python: Python 3.4.3 (default, Nov 17 2016, 01:08:31) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more ...
DinoCoderSaurus's user avatar
1 vote

pset8, mashup: Please, I'm I doing wrong here

In case anyone else is looking for solutions that don't seem to work: make sure you named your table 'places', not 'places ' like I did... (notice the whitespace at the end)
Bogdan Nazare's user avatar
1 vote

pset8, mashup: Please, I'm I doing wrong here

From the FAQ section of the spec: CREATE TABLE places(…​) failed: duplicate column name If you see this message upon running .import in sqlite3, odds are you haven’t run sqlite3 in the same ...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset8 mashup - markers not showing up in map

This can happen if latitude and/or longitude are TEXT columns. They need to be NUMERIC columns, otherwise the select SQL in the update route returns no rows and addMarker doesn't get called.
DinoCoderSaurus's user avatar
1 vote
Accepted

search doesn't work when zip code is full

Remember the array is 0 indexed. When it "searches" for '02138', the query returns 1 row, which is place[0]. Therefore it is not included in return jsonify(place[1:8]) (because place[1:8] is the 2nd ...
DinoCoderSaurus's user avatar
1 vote

Pset 8 Mashup Import Issue (fgetcsv returns empty array)

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 ...
AdiKhajuria's user avatar
1 vote

Pset8 search add fulltext error

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 ...
kluvin's user avatar
  • 1,223
1 vote

pset8 mashup addmarker

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 ...
mimo31's user avatar
  • 146

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