I've tried a few different ways trying to get this to work. So essentially I have a list of parks that I pull with one $http get method, each park object has a weather field inside of it. After the initial load I am trying to parse non-restful .json files with the weather status (pulled by a background process server side) and do an association with the weather object based on zipcode.
So there are about 30 parks. The way I pulled the weather info on the background (so as to not hit the rate limit) was to just pull them for each zipcode (relative to park location) and place them in a file named by zipcode. So for example 90201.json, 08291.json, etc
I've tried doing something like this so far: http://plnkr.co/edit/66BjKESPnYGWgQwOzEPN?p=info
But I think I'm probably messing up in a few places, any advice would be greatly appreciated.
Thanks!
Related
Consider I have a zoo app that shows all the zoos for each city. Each city is a page with a list of zoos.
In my current solution, on each page, I have ajax call to the server that pulls the list of the zoos for that particular city.
The performance is extremely important for me and my thought was to remove the ajax call and replace it with a JSON object that will live in the app. That way I will save a call to the server and I believe the data will arrive faster.
Is this solution makes sense? There are around 40 cities with ~50 zoos for each.
Consider the data is static and will never change.
Since 900 records is not much **, you can get all the records at once during the initial load and filter the all records array by city, that way your user experience would be much smoother, since client side js processing is far better than n/w latency.
** - note: strictly considering the data set size of ~900
Other solution can be - cache the data in the session scope and when ever there is a specific request for a city check for the availability in session scope, if it's not there make a n/w call.
I think correct question is what is my performance requirements?
Because you can write all your data in json object and do everything on client side without any ajax call but in this case when any client visit your page that means it will download all data. and that is another question mark
For my school project, I need the data on this website:
https://services2.hdb.gov.sg/web/fi10/emap.html
Specifically, I need the longitude and latitude, address, flat type and the number of units of the flat type in csv or excel format so that I can do some spatial analysis.
How do I create an automated process to get all the data from the website and not clicking all the individual buildings?
Appreciate any assistance on this. Thank you.
I got a look at the network traffic when this site is querying it's data. There you can find the XHR-Requests where also the streetname and other things are written down. You may use this to collect your data.
First of all, Hi to all of you (I'm new here).
I'm having a look on how Google Analytics works as I'm gonna develop a similar tracking js to collect all the data I need for my websites and, as far as I can see, the ga.js script send all the data (maybe not all but a good part of it) with a get request with a 1x1 gif and all the parameters following.
Seen here: How does google analytics collect its data?
So, on the server side It seems the only way to "read" all these parameters is going to analyze server logging and then collect everything on my database?
Is this the best option to get users data?
I think, server logging could "switch file" every 2 hours so you can analyze that file of the past 2 hours and show "not that old" data to your graph!
Of course will never be "realtime" graph but a 2 hours delay could be acceptable, I think.
I think you can simply put a script (PHP for example) at the image path, then through the script return as a response the image, by doing this you can act in real time, since using a script you can get all the data that would be present in your server log.
If you want to try my solution I think a good point to start (in PHP) would be this to create the GIF image and then you can use data located in $_SERVER to start gathering data!
I would like to dynamically create a corresponding JSON file every time a new merchant signs up to my site.
For example:
Burger King signs up to be a merchant on my site. I add Burger king to my merchants.json file. How would I dynamically create a file that gets inserted into that JSON object that can later be used to pull up data specific to that merchant, on that merchants page. For example, a JSON file full of products or deals.
Is this even the right way to go about it?
Can someone point me in the right direction please?
This seems like a very common usage scenario but I don't see any examples online that explain this application structure thoroughly.
NOTE: I am using AngularJS
EDIT: Thanks for the tips guys, after asking around in the #AngularJS channel on IRC, I've been told to go the extra mile and create an API. I'll probably use sails.js to help with that. This obviously isn't how I was planning to do things, but as you guys pointed out, it wasn't the best practice; not by a long shot.
1) You'd need a small server-side PHP script that accepts the new JSON file sent by the client
2) Browser requests merchants.json from the server
3) Load it with JSON.parse()
4) Add the merchant to the Object
4) JSON.stringify(object)
5) Send back to the server.
Now, this is a horrible horrible idea. Use a server-side database for storing any kind of information on your clients -- MySQL, whatever. JSON is for transporting data, not storing it. You can write some PHP scripts to dynamically generate a page for your merchant based on the data in the database -- so much easier and so much more secure. The method above will expose the whole client database to the client, and based on your specifications above, I don't see another way.
I'm developing an JSP application that retrieves a lot of polygons to show on the map.
I will try explain how the application works before tell my problem.
My client needs to check on Google Maps his internal division of territories (a territory is a set of cities, it's a many-to-many association). The territory-city relationship can be changed anytime by loading a file via an application menu. Today we have 35 territories and about 10000 associations territory-city in the system.
I have the polygons with the shape of the cities in Fusion Tables, but when I try to retrieve the shapes, I get the following error:
Code to load the polygons for one territory:
layer = new google.maps.FusionTablesLayer({
query:{
select: 'geometry',
from: {MYKEY},
where: "NAME_CITY IN ("+listOfCities+")"
}
});
Error:
Failed to load resource: the server responded with a status of 414 (Request-URI Too Large)
I'm looking for a way to load these territories from a long time, I already tried to read the KML files from Java, and send the set of coordinates for each city, but the HTML page was like 300MB when done, and it just froze the browser and didn't work. So the Fusion Tables seemed to be the best approach.
I found out a few posts where people were telling to use the POST method to request the data, because of the size of the listOfCities variable(some territories have about 500 cities associated), but they never said how to do it using the Google Maps API.
How can I do that? Anybody have another approach to solve this problem?
Thanks
You must somehow simplify the query. POST is not an option, there is no way to change the method used for the query.
But this could be a point where you can start:
The territory-city relationship can be changed anytime by loading a file via an application menu.
Instead of filtering the cities on your server and query cities, you may add another column to the table, where you store the "relationship", as suggested by geocodezip.
This may be done automatically when "the file" is uploaded(and here you can use POST)
The new where-clause would be simple and short now like e.g.: territory=35