GTFS realtime feed example script - java

I was able to successfully parse through BART's GTFS realtime Service Alerts and TripsUpdate feed. I also looked at the official protocol buffer for Java tutorial page and was able to compile and run the tutorial.
https://developers.google.com/protocol-buffers/docs/javatutorial
The next part for me is figuring out how to create a Realtime feed maybe preferably Service Alerts first for my GTFS static data. From what I understand a GTFS realtime feed is like sending protocol buffer data that is serialized to a webpage and then writing a script that takes in the web link that refers to the page and deserialized the data using HTTP GET. I was thinking of using Visual Studio and ASP.NET core to do this. Is there an example project I can refer too and/or am I even on the right track in the first place?

Take a look at the awesome-transit list of gtfs-realtime stuff. A lot of libraries within the OneBusAway project are probably your best bet for seeing code in action that deals with gtfs-realtime. For example, maybe you can look at onebusaway-gtfs-realtime-exporter.

Related

Sonarqube - How to exchange data with Compute Engine MeasureComputer implementation from Sensor

I am working on implementing SonarQube plugin for a custom platform specific language. The documentation is very limited and any code examples I see are outdated - usage of Decorators instead of MeasureComputer etc. I went through the sample plugin but it does not have the context I am looking for. My question is - how do I exchange the data between the Sensor and MeasureComputer implementation. The plugin invokes a command-line (vendor specific and I cannot change) that writes the data to a file. I would like the data from this file displayed in the General Metrics screen. In Sensor execute method, I am able to parse the file but I cannot save the Measure as the API has changed now and requires me to save the Measure with .on method that requires an InputFile, but this data is on the entire project and not on a file. I am not able to do a simple save of Metric on the project. I tried using MeasureComputer implementation, but I understand that this runs in Background task on server side, so I thought of setting the property under context.settings.setString("propName", "value") and tried retriving it using (MeasureComputerContext) context.getSettings().getString("propName"). This is not working either.
Can I save a Metric on the context that can be displayed in General inside a Sensor on the project and not the resource in 5.6.6 version. If so how?
If above is not possible, how can I store the file content to exchange with MeasureComputer, either add to list of files or set the property or object to be retrieved in MeasureComputer.
Thanks in Advance for your help. I have spent considerable time on this and the documentation leaves a lot to figure out.
For anyone else ending up here, looking for an answer, see the answer posted by Julien Henry on Google Groups here - https://groups.google.com/d/msg/sonarqube/yWsp7vuIsSo/ZugXMkp8CwAJ. Essentially, you can set the property at module level using .on(context.module()) and use it in Compute Engine.

How to get data from XML feed URL in Java

There is a betting exchange website which offer their data in XML from the following link:
http://odds.smarkets.com/oddsfeed.xml
I would like to access this link to retrieve the latest data (in java). Previously I have had to download the (very large) file and add it to my project and get the data from there. What is the best way to achieve this without having to download the file every time I want to access the data?
I plan on storing the returned data into a database.
Thanks
Well this seems to be very tricky question .I would suggest you to create a simple web service application[Client/server architecture] to get the contents from this url. You can use REST to call this url. But what contents you need to read depends on the functionality that you want to achieve.You need to write your custom logic to read the data.Here in you will be acting as client and the url would be your service.
You can refer following link
https://community.atlassian.com/t5/Confluence-questions/Access-page-content-via-URL/qaq-p/163060

How can i use ember js without ember-cli with PHP or java?

How can I use ember js without ember-cli with PHP or java? How can I interact with back end data? Any example will be much appreciated.
The first thing you'll need to understand, is that ember-cli is a command line interface. It acts as a blueprint generator and an asset pipeline and glues all the ember stuff together in a wonderful productive package. It's just standard now, and you wouldn't want to use Ember without CLI. They are basically now the same thing unless you were using Ember since pre 1.13 and can't upgrade.
Ember is a JavaScript framework for front-end/client-side user interface. It doesn't deal with server style data storage like a traditional Apache/PHP. In a PHP setup, each page is rendered on the server side and then delivered to the browser in a complete form. Ember is more like a shell that you fill with data from somewhere else, but also has the ability to manipulate that data in the browsers and persist it back to the data-source.
The data source could really be something as simple as local storage. Maybe a simple game that just stores your userScore in the built-in local storage.
The data source could be something like the WordPress API, where ember pulls in posts or page data to display on the screen. Maybe you even have a form that persists new posts back to the server.
You could use parse or firebase for real-time back-end as a service. Or you could build a server of any sort that was able to generate an API that Ember could consume.
Currently, rails is popular for the server. Also, node frameworks like hapi.js and sails. Elixr and Pheonix are gaining interest and have proven to be a powerful backend team with Ember.
Ember uses ember-data and adapters to take in API data and serialize into a simple set of conventions.
If you have API endpoints coming from PHP or Java, you could use them - however, if you are starting a new project - I wouldn't think that would be an ideal route.
You can follow the Ember guides tutorial to learn more about how Ember works. Good luck!.

Connecting to API

I plan to build a simple website that takes data from a websites API and puts it into charts that are listed on my website. Here is what I am trying to do:
Take data from the API listed on localbitcoins.com
https://localbitcoins.com/api-docs/
Code a program that parses this data as I see fit.
Create a graphical layout that displays the data.
Post the graphs on a website that I have created, ideally to update in real-time.
I don't know where to begin.
I am not asking for some one to hold my hand through it all, but more so to give me some pointers on where to start, what resources are there that I can look at, and so on.
My instinct tells that that I need to tackle API and coding part first. Can someone point me to a resource that could take me through this? Should I stick with Java or should I use another language for this?

Connect Android application to remote data

Sheesh talk about limited information! I'm trying to get my Android application to connect to an online database to access information. There's quite a bit of info including geotags and these are going to be mapped on my app. The developer site has the very informative piece of information:
You can use the network (when it's available) to store and retrieve data on your own web-based services. To do network operations, use classes in the following packages:
java.net.*
android.net.*
Like I said in my previous question, I'm still very much an android newbie, and trying to remember my java oop from college is slow. Does anyone have an example of how this might work, or how I could implement it? I wouldn't mind even connecting to a local xml file, if I could find a good example of how to do that!? Am I just looking in all the wrong places?!
Help. Please!
T
How do you plan to connect to the database?
Android allows you do to plain socket communication which you can refresh your knowledge of here:
http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/socket.html
Another method would be to put up a REST type service and respond with XML. SAX is commonly used for XML parsing in Android:
http://www.saxproject.org/
You can use SAXParser to parse XML from the net. Here's a tutorial on how to use the same.

Categories

Resources