GTFS-realtime-bindings for iOS - objective-c

MTA Subway data (among other data) is formatted in GTFS-realtime. In order to convert the protobuf into a string representation I must run it through some Google protobuf tools using gtfs-realtime.proto. The only problem is that, as can be seen here, the gtfs-realtime-bindings are available only for
NET
Java
JavaScript / Node.js
PHP
Python
Ruby
Golang
Additionally,
We don't provide generated code for C++, use the official protoc compiler for that (from here or here)
None of these are Swift or Objective C. While there is an open issue/request for a Swift/Objective C version from 2016, I was wondering what I can do currently in order to do this. As of now, the only viable solution I see is to have a server parse the data and then GET the parsed data (JSON encoded?) from that server instead of directly from the MTA.
Here is the Google page for protocol buffers. I am not sure, but is there some way to use what is there to read the GTFS-realtime data.
Is that the best path forward? Are there any other possibilities?

As noted by Tony Laudig, having your app directly communicate with the MTA is a breach of their terms and conditions which you almost definitely would have had to agree to in order to get an api key.
Breaking terms and conditions is generally a pretty bad idea. In the case of this API, it seems like your key will be revoked.
Thus, I would not suggest using the library in Tony’s answer. Instead, do what you proposed:
Have a server parse the data and then GET the parsed data (JSON encoded? [—sounds good]) from that server instead of directly from the MTA.
Any of the languages you listed will do the job, it’s just a matter of which you’re most comfortable with.

There is an official library in Objective C for parsing Protobuf. You can compile classes from the GTFS-rt standard and the MTA extension .proto files.
It looks like your planned usage, having the app connect to the MTA directly, doesn't conform to the MTA terms and conditions:
In developing your app, you will provide that the MTA data feed is
available to others only from a non-MTA server. Accordingly, you will
download and store the MTA data feed on a non-MTA server which users
of your App will access in order to obtain data. MTA prohibits the
development of an app that would make the data available to others
directly from MTA's server(s).

Related

Access KV store and Environment Variables in G-WAN using MONO

I got mono 3.0.6 working with G-WAN and now I am trying to use G-WAN persistent pointers and KV Store using mono but don't know how to do it.
G-WAN does expose some functions on gwan_api.cs but the KV function and get_env is not there.
Is it possible to access this in mono?
Is it possible to access G-WAN's KV store in C# scripts?
No, and here is why.
We initially tried the wrappers we wrote but, like for JNI, the mandatory conversion overhead is defeating the purpose of light and fast calls.
Like Java, C# offers a plethora of solutions for almost everything G-WAN does natively and this is what should be used if you use either language.
Note that part of your application can be written in C/C++/D/Objective-C/Objective-C++ and call all the native G-WAN API directly while the rest of your application may use C# or Java.
That's the advantage for an Application Server to support different programming languages.

Wordnet in Objective-C

I know the Wordnet webpage cites that it comes with a C interface included. However, I am having significant trouble adding it to my project. My question is two fold.
First: Does a machine need to have wordnet installed to utilize the API (or can the data be read a runtime from the dict files? and thus distributed to machines that do not have wordnet installed)
Second: How can you include Wordnet in a C project. I've tried adding the source files directly, but it crashes on init(). I've stepped through the debugger and it looks like it is looking to load the files from my local drive rather than the included files in the project. Is there a way to prevent this for machines that do not have Wordnet installed (from part 1).
Thank you for the help,
Unless I'm mistaken and you're referring to a different WordNet, there has been a Cocoa front-end available for years here.
Just found this today. Might be helpful, as it only requires adding the sqlite.db file of WordNet and provides a super super thin Objective-C wrapper on the sqlite call to talk to the database. Using this as a template for your understanding should allow you to extend it to allow various queries.
https://gist.github.com/atduskgreg/c30a5fb167f4c35d6f89
EDIT: With the above example, you can see the format the query takes. With that knowledge, you could grab the sqlite file for the WordNet database from:
https://code.google.com/p/synonym/downloads/detail?name=wordnet30.1.tar.gz&can=2&q=
then either just use the C calls for sqlite or pick a more robust Objective-C wrapper like:
https://github.com/ccgus/fmdb

What are good libraries to create restful iPhone Apps with Django and Objective-C?

Our new iPhone project consists of a native app and a server it needs to communicate with. I'd like the server to be written in Python/Django.
The last time we created something similar, the server was in written in asp.net and it exposed relevant methods as a SOAP-based web service. This was very convenient, since we were able to generate almost all server communication code from the WSDL using http://sudzc.com/. Now I basically want to do the same, but with Django instead of asp.net. More specifically, I want to expose methods and objects over an API and I'd really like to have some automatic Objective-C code generation at the other end.
I've looked at a few libraries for Django that are supposed to expose RESTful APIs, and most people seem to recommend django-piston or django-rest-framework. Will either of them have a WSDL-style description that I can use to auto-generate ObjC-code, though? Is there another set of tools for achieving what I'm after that I should be investigating?
In my personal experience I don't know of anything that exists to generate client-side stubs in Objective-C for a REST service. However, there's a very good library called RESTKit that features a JSON or XML to object mapping layer, and nice features like CoreData integration and local caching. There are number of useful Stackoverflow questions on it.
So that can get you part of the way, since it will handle communication and object mapping. If you need to build code-generation, it could output code that sets up RESTKit's mapping structures.
Another REST client lib for iOS that I like a lot is LRResty, for its clean API, but it's lower level than RESTKit in that it doesn't have any built-in parsing/object mapping features.
In this similar stackoverflow question there's a link to something called wsdl2objc which sounds like it's in line with what you need on the iOS side (I've no personal experience with it, so ymmv, etc...)

Is there still a difference between a library and an API?

Whenever I ask people about the difference between an API and a library, I get different opinions. Some give this kind of definition, saying that an API is a spec and a library is an implementation...
Some will tell you this type of definition, that an API is a bunch of mapped out functions, and a Library is just the distribution in compiled form.
All this makes me wonder, in a world of web code, frameworks and open-source, is there really a practical difference anymore? Could a library like jQuery or cURL crossover into the definition of an API?
Also, do frameworks cross over into this category at all? Is there part of Rails or Zend that could be more "API-like," or "libraryesque"?
Really looking forward to some enlightening thoughts :)
My view is that when I speak of an API, it means only the parts that are exposed to the programmer. If I speak of a 'library' then I also mean everything that is working "under the hood", though part of the library nevertheless.
A library contains re-usable chunks of code (a software program).
These re-usable codes of library is linked to your program through APIs
(Application Programming Interfaces). That is, this API is an interface to library through which re-usable codes are linked to your application program.
In simple term it can be said that an API is an interface between two software programs which facilitates the interaction between them.
For example, in procedural languages like C, the library math.c contains the implementations of mathematical function, such as sqrt, exp, log etc. It contains the definition of all these functions.
These function can be referenced by using the API math.h which describes and prescribes the expected behavior.
That being said, an API is a specification (math.h explains about all the functions it provides, their arguments and data they return etc.) and a library is an implementation (math.c contains all the definitions of these functions).
API is part of library that defines how it will interact with external code. Every library has API, API is sum of all public/exported stuff. Nowadays meaning of API is widened. we might call the way web site/service interact with code as API also. You can also tell that some device has API - the set of commands you can call.
Sometimes this terms can be mixed together. For example you have some server app (like TFS for example). It has API with it, and this API is implemented as a library. But this library is just a middle layer between you and not the one who executes your calls. But if library itself contains all action code then we can't say that this library is API.
I think that Library is a set of all classes and functions that can be used from our code to do our task easily. But the library can contain some of its private functions for its usage which it does not want to expose.
API is a part of library which is exposed to the user. So whatever documentation we have regarding a library, we call it an API Documentation because it contains only those classes and functions to which we have access.
we have first to define an interface ...
Interface :is the means by which 2 "things" talk to each other and exchange information. "things" could be a (1) human or (2) a running code of any sort (e.g. library ,desktop application , OS , web service ... etc).
if a human want to talks to a program he need Graphical user interface (GUI) or command line interface (CLI). both are types of interfaces that humans (but not programs) would like to use.
if however a running code (of any sort) want to talk to another running code (of any sort) it doesn't need or want a GUI or CLI ,it rather need an Application Programming Interface (API).
so to answer the original poster question : library is a type of running code and the API is the means by which this running code talk to other running codes.
In Clear and concise language
Library: Collection of all classes and methods stored for re-usability
API: Part of library classes and methods which can be used by a user in his/her code.
According to my perspective, whatever the functions are accessible to invoker , we can called as api in library file, library file having some of the functions which is private , we cannot access them ..
There are two cases when we speak or think of API
Computer program using library
Everything else (wider meaning)
I think, that in the first case, thinking in terms of API is confusing. It's because we always use a library. There are only libraries. API without library doesn't exist, while there's a tendency to think in such terms.
How about The Standard Template Library (STL) in C++? It's a software library.
You can have different libraries with the same API, meaning set of available classes, objects, methods, functions, procedures or whatever terms you like in some programming language. But it can be said, that we have different implementation of some "standard" library.
Some analogy may be that: SQL is a standard but can have different implementations. What you use is always some SQL engine which implements SQL. You may follow only standard set of features or use some extended, specific to that implementation.
And what "under the hood" in library is not your concern, except in terms of differences in efficiency by different implementations of such library.
Of course I'm aware, that this way of thinking is not what is a "generally binding standard". Just a lot of new terms have been created, that are not always clear, precise, intuitive, that brings some confusion. When Oracle speaks about Collections. It's not library, it's not API, it's a "Collections Framework".
Hello brothers and sisters.
Without using technical terms I would like to share my understanding regarding API and library.
The way I distinguish 'library' and 'API' is imagining a situation where I go to a book library. When I go there, I request a book which I need to a 'librarian' without knowing how a entire library is managed.
I make a simple relation between them like this.
Library = A book library which has a whole system and staffs to manage books.
API = A librarian who provides me a simple access to a book which I need.

Symbian and OpenC Applications

I have been researching around trying to find the best way to begin developing an application which aims to analyse user's writing styles based on outgoing SMS messages. I have installed Symbian's SDK and Carbide and purchased a book on their specific style of C++ to get started. However, I was told to check out Open C for Symbian as I have some previous C experience. I have installed the plugin from http://www.forum.nokia.com/Resources_and_Information/Explore/Runtime_Platforms/Open_C_and_C++/ and tested a simple Hello, World! application with success.
Although, the initial success would lead me to believe Open C would be a better option for me, I am worried about limitations of using Open C. For example, I need to be able to access native functions of the Symbian OS to capture keystrokes while in the SMS composer. I also need to be able to run my application in the background and have it load on system startup as not to interfere with user's normal activities.
Can someone clarify if Open C can access such functions and fulfil my needs in terms of developing this specific application? Also, what are the limitations to using Oepn C in comparison to the standard Symbian C++?
I'm by no means a Symbian guru but we've used the Open C/C++ plugin for Symbian here. My understanding is that the plugin is simply an extension -- it gives you the standard libraries and lets you deal with familiar functions (in our case, just the simple cstring.h, and stdio.h libraries were what we were looking for).
You can still mix and match the Symbian calls and likely will have to deal with some painful conversions to get your char* into the proper "descriptor". However, you should only have to do these at the interfaces at which you're touching existing Symbian libraries (as they're going to expect descriptors, not char*s).
In our code, we have some places where we're using a remove call to delete files and in the same class, creating the detailed Symbian RFs abd RFile objects.
So yes, while we use C/C++ libraries to do some low-level stuff and a lot of string manipulation, we're also using the Web Browser Control, key input monitoring and all that.
...And yes, we need to clean up our code. :-)
Open C provides a set of standard C libraries for Symbian OS programs i.e. it is a library.
This means you can call Open C code and Symbian native code freely in the same program, just as with any other library, provided you respect the preconditions and assumptions that the libraries require.
This is where the complexity comes in, because the standard Symbian APIs often require things like descriptors and a working active scheduler, whereas the Open C libraries don't. But provided you're careful you can do what you want.