SoundCloud waveform JSON API - soundcloud

You can get a data representation of the SoundCloud waveform, from this URL:
https://wis.sndcdn.com/OVXGhROsaZkq_m.png
This feature is undocumented, but the site uses it as a clever way to optimize bandwidth. My question to the API team is that is it safe to rely on it in production environment?
I’d like to use it in a mobile app, so the cross-domain issue is not a problem for me.

Undocumented features should be treated as volatile, sorry. Though there are no plans to change this format right now, I can't make any promises about it.
Interestingly, the waveform as a PNG file is actually smaller, if bandwidth is your only concern.

Related

Geojson data causes mapbox to crash, tactics to isolate the error

I have downloaded shapefile boundary data from the UK ordnance survey and have converted it to geojson format, using QGIS. There were no errors reported during the conversion, and given the fact that the data came from a governmental organisation, I think it is a reasonable assumption that the data made available is correct, coherent and intact (which has an effect on how I narrow down the error source).
I use mapbox to display this data, and retrieve it through a webservice. When I load the data with mapbox, it causes mapbox to "bluescreen", i.e. completely crashes the browser tab and disconnects the development console (Chrome, FF and IE). There are far too many polygons/features for me to investigate "manually", and I can't contain the error - even try/catch doesn't help.
I have started to systematically halve the data set, and it turns out that the error is contained somewhere in boundary areas beginning with letters a-m. I know that I could continue with this approach and at some point find the error(s), but I would like to know if you have some tips for me to
Check WKT/geojson/polygonal integrity. Technology is unimportant to me (C#, Java, JS, whatever...) as long as it's a concise process. (Apparently, Postgres/Postgis has this but all my data resides in an object database, and if there is ANY other means to check, I'd prefer that :-))
Check geodata integrity specifically with respect to mapbox consumption.
My assumption is that "correct" (i.e. error-free and correctly-formatted) geodata will render correctly in mapbox, but as my problem has shown: somewhere in between the official data set from a governmental website, error-free conversion using a well-established tool and rendering in mapbox using the latest version, it still goes wrong.
Thanks for your hints in solving this !
EDIT: amazingly, Firefox seems to handle this better than Chrome. Doesn't crash using the same data.
First of all I fear that there is no right or wrong answer to your question and I don't know how you want to accept an answer. This is normally a a bad sign for a question.
Second I would not take a data set for "must be valid" even if it comes from a government. Exporting data into a format always can have some edge cases or they might not follow the geojson specification as tight as you would have liked them to.
However this is what you can try to do:
Often the data is too precise to work with (over fitting) and you should try to simplify your geojson data with a tool of your choice to reduce its size. You could use one of the following to do that task (there are more ofc.)
QGIS
http://mapshaper.org/
https://www.npmjs.com/package/simplify-geojson
See if you can load the simplified version into the browser
You could try to validate geojson with an external tool like http://geojsonlint.com/ or http://geojson.io/ if your file is not too large.
Try another browser to see if it can handle data better. Its strange that your browser crashes. If chrome runs out of memory it will normally notify you about that issue.
Other than that I think it would stay a manual task to hunt down the problem.

Fastest way to get data from server?

I have a DB and web server in the same host. I have an iPhone app that sends XML to the web server. The web server will query the database and return data back to the app.
I'm not sure whether this is the fastest way
Are there other ways faster than this?
In server-client programs, the biggest bottleneck is usually the network latency unless you are doing very complicated time-consuming processing at server side or you have behemoth data in your RDBMS and need to search from it.
There are a couple of things (scopes more than XML) that you may try for fast loading:
If you are feeling that database is the bottleneck, you may try caching (look for MemcacheD and the likes) objects in front of database. This will reduce DB hits and retrieval will be faster.
Use compression in XML. Or use shorter notation like JSON or YAML. In general, for webapps:
Reuse and use optimized (compressed) images. Use more CSS less images wherever you can.
Minify the components like CSS and JS.
Don't load everything at once, if not needed.
You may look into XML compressors or if you can, use some shorter notation like JSON or YAML. But I guess it will be hard to change data format if you have already developed the app.
XML isn't the world's most compact format, so you could obviously speed things up by reducing the amount of data that you send and receive. If you can talk to the database directly, you can cut out the web server, which would surely speed things up too.
The thing is, though, that XML and HTTP are standards, and there's a lot of value in that. Is the small increase in speed that you get from a purpose-built custom protocol really worth the loss of flexibility and extra development time?

Building a service for my website that has some foursquare features

I am interested in extending my website to provide a service which involves users "check in" in my university's campus. Since Location Based Services (LBS) is pretty new, and there are not much literature around that could provide relevant interests to this matter, I have the following questions to ask:
First, I know that I have to design an Android App and possibly an phone app application. For all I am guessing, foursquare is simply using the client to send data to their webserver back and forth.
What are the standard protocols for the client to communicate with the webserver? (or is it simply just json or xml?)
What kind of special web service do they use on their backend? (Like some research would reveal they are using LIFT, written in Scala which is something that I am not familiar with.).
I know python pretty well. Are there webservers, i.e. django or pylons, that provide similar service to 2) above?
How difficult is this really?
Also, any literature on this subject matter is greatly appreciated.
Use the foursquare API.
They have pre-made libraries for both Django and Python here, those should make it easier to integrate foursquare into your website.
Well, I do think a good first step would be to look at Foursquare's API, both to see if you can simply integrate with their service (i.e. look for check-ins that are to campus buildings or whatever) or just to get a picture of what they're using. Their API seems like a pretty standard web service using XML or JSON, which seems like a good practice for you as well.
There are some challenges in building a scalable web service that will handle geographic data: you'd want a database that can handle geospatial indexing for you (otherwise the algorithms can get a little complex). If you're familiar with Django, GeoDjango might be a good fit for you. I hear that Foursquare is actually switching to use MongoDB, which has some geospatial indexing features: they're likely using a NoSQL database because of their unique scaling issues which you probably don't need to worry about.
Mimicking foursquare isn't a good approach. A solution to your specific functionality needs and load levels will always be custom, not copied. Even the biggest university campus in the world, with every single person using the service, you'd be totally dwarfed by foursquare's user base. So whatever they're doing is WAY higher-end than what you need.
For your purposes, a simple web service is probably more than adequate. I'm building apps that are location-sensitive (arts/cultural events and consumer offers local to the user's current position) right now that hit PHP scripts with query string or posted-data arguments, and consume JSON. Nothing fancy, but I can handle the load on the server side with lightweight technologies I already know, and I know it'll scale to meet my actual load.
Don't be beholden to the way somebody else does it, even if they are the industry leader. Their needs aren't your needs.

Language restrictions on iPhone partially lifted?

Apparently Apple has changed some term in the agreement again.
From http://www.appleoutsider.com/2010/06/10/hello-lua/
section 3.3.2 is now
Unless otherwise approved by Apple in writing, no interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple’s Documented APIs and built-in interpreter(s). Notwithstanding the foregoing, with Apple’s prior written consent, an Application may use embedded interpreted code in a limited way if such use is solely for providing minor features or functionality that are consistent with the intended and advertised purpose of the Application.
instead of the original
No interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple’s Documented APIs and built-in interpreter(s).
I am more interested in embedding Lua, but other people have other embeddings they want to make.
I am wondering how you ask for permission, and what they mean by the terms "minor features" and "consistent" and how will Apple interpret this section? It seems to have enough loopholes to drive a real firetruck through.
(BTW this is a terribly important question for me an my product.)
Realistically, the ultimate interpretation of the developer agreement is up to Apple.
Since this is all new, it's not clear who to e-mail. You could start with the iTunes Connect people, but be prepared for a long wait to hear back. Alternatively, I've gotten some occasional quick help just by calling up the nice Apple people in Ireland.
Given the wording , if you want to embed Lua, you should be prepared to justify that you will be using Lua in a limited fashion to provide minor features or functionality.
Since you've stated this is a really important question, you might want to consider the risks inherent with pushing the envelope/being a pioneer. If there's an alternative way to get around all this, you should consider it. If there's no way around it, it might make more business sense for you to pursue another platform for now.

iPhone Development - calling external JSON API (will Apple reject?)

Ok guys, so im new to iPhone development, so apologies if this is a silly question, but before i actually create my app i want to know if this is possible, and if Apple will reject this.
(Note this is all theoretical)
So i'd have a API (.NET) that runs on a cloud server somewhere and can return HTML/JSON/XML.
I'll have a website that can access this API and allow customers to do some stuff (but this is not important for this question).
I would then like my iPhone app to make a call to this API which would return JSON data. So my iPhone app might make a call to http://myapp/Foos which would return a JSON string of Foo objects. The iPhone app would then parse this JSON and do some funky stuff with it.
So, that's the background, now the questions:
Is this possible? (that is, call an external cloud API over HTTP, parse JSON response?)
What are the chances of Apple rejecting this application (because it would be calling a non-Apple API)
Are there any limitations (security, libraries, etc) on the iPhone/Objective-C/Cocoa that might hinder this solution? In regards to Security - can you freely make a HTTP (or even HTTPS call) from inside an iPhone app, and parse the response? In regards to libraries - is there sufficient support in Objective-C/Cocoa to accomplish this?
On this website, they seem to be doing exactly what im asking.
Thoughts, suggestions, links would be greatly appreciated...
Yes. It is possible. There are quite a few apps that do similar things.
Slim to none. Apple hinders what languages and libraries you can develop in and run on the phone. They won't limit you based on what external data you pull in to your app.
There shouldn't be any worries here either. You shouldn't run in to security concerns and there are plenty of libraries that you should be able to utilize to make your life much easier.
Good luck!
Yes it's certainly possible, and there are json parsers available already. Secondly, based on what you just described, should the application not break any rules outside of the scope of this question, then there is no reason I can see Apple rejecting it (except perhaps content, ie., don't display any porn or the like :)) ... Finally, you haven't properly described your application to fully answer #3, and I don't dare guess at what you meant, since it may be just a waste of your time. Feel free to expand on your #3 in comments, I'll answer there.
Edit: With regard to your edit of #3 above, yeah you won't have an issue here at all either.