I am trying to write a framework on top of Mesos and so far I was able to download Mesos for Ubuntu and start a master and slave on a single machine.
I want to build a Mesos framework using Python, should I use the HTTP API or the native API? What is the difference between them?
I was able to find no documentation on the Python native API, except for some examples.
The HTTP API has documentation but no examples on how to use it. Should I be building a web service if I choose to use the HTTP API?
You should use HTTP API
Native API is easiest way to build Mesos Framework. Just include lib in your project and implement interfaces. Although it comes with some limitations:
Native API is no logger extended, new features goes only to HTTP API e.g., Maintenance Mode MESOS-2063
Native API require mesoslib to be available on system. This makes hard coupling between framework and platform it runs on. With HTTP API you can run your framework on any system no needed to load mesoslib.
Documetnation for HTTP API exists here. It's language agnostic. So there are no examples in python, rather raw HTTP requests. But there are some tutorials how to use it. I can recomend one givien by Marco Massenzi at MesosCon EU 2015
Video
Code
Slides
Related
I have a YouTube channel that has a number of live broadcasts throughout the week, I am just looking for a way for the Title and Description to be updated via a crontab.
I have see seen the following link. https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/update
To be honest I cant make any sense of it.
Any help offered greatly appreciated.
You're in front of a non-trivial API, but that should not discourage you to go ahead with it.
I'd recommend Python as implementation language: go use the Google's APIs Client Library for Python.
Basically, this library is of good quality and (compared to other client libraries) simple to use. It will, for example, insulate you from having to deal explicitly with REST API calls, JSON and the like. Your code will also work under both GNU/Linux and Windows.
You may begin your journey by reading the official getting started docs: Python Quickstart and YouTube Live Streaming API Overview. Then I recommend absorbing these two important documents: Life of a Broadcast and Understanding Broadcasts and Streams.
Then go read, understand and run the following sample program from Google: create_broadcast.py. Of course, you'll have to adapt that code to your use case.
You'll have to exercise patience and perseverance (since I imply that you have no prior experience using the YouTube Data API). Using this API will pay off to you at the end of your (programming) journey.
A special mention: for to be able to call the live streaming APIs you will first need to get acquainted with the things related to the so-called OAuth 2.0 authorization and authentication: Implementing OAuth 2.0 Authentication. There's an official document that you need absorb: OAuth 2.0 for Mobile & Desktop Apps.
A few more references: the live streaming API has an official documentation too. The main site documenting the client library is: Google API Client Library for Python Docs. Its source is public, to be found within the client library's public repo under the directory docs.
Also useful is to see the YouTube Data API's list of all instance methods.
I am struggling to understand the added value of Express (or Koa, Hapi, etc) integration with Apollo GraphQL server.
I see it can work in stand alone mode very well (an example: https://medium.com/codingthesmartway-com-blog/apollo-server-2-introduction-efc4026f5654).
In which case should we use it with (or without) integration? What should drive this decision?
If all you need is a GraphQL endpoint, then using the standalone library (apollo-server) is generally preferred because there will be less boilerplate to write (features like subscriptions, file uploads, etc. just work without additional configuration). However, many applications require additional functionality beyond just exposing a single API endpoint. Examples include:
Webhooks
OAuth callbacks
Session management
Cookie parsing
CSRF protection
Monitoring or logging requests
Rate limiting
Geofencing
Serving static content
Server-side rendering
If you need this sort of functionality for your application, then you'll want to utilize an HTTP framework like Express and then use the appropriate integration library (i.e. apollo-server-express).
Apollo Server also includes integrations for serverless solutions AWS Lambda. If you want to go serverless to, for example, get better scalability or eliminate system admin costs, then you would also need to use one of these integrations.
Any ideas how to start with MapServer with NativeScript. I don't have necessary skills yet to make own plugin but I must try if nothing else is found.
Does anyone know any resources to get started implementing mapserver maps for nativescript. Plugin, code anything.
I assume you have an application using NativeScript framework and you want to include some map services from MapServer.
If that is the case, you may not need to write your own plugin but you still do some level of coding to achieve the goal.
My recommendation would be :
1) At your front end, choose a GIS map library such as Google maps API, Leaflet or OpenLayers API. The GIS library would handle a lot of critical tasks in the process such as handling communication with GIS server, user interface function etc. So that you don't have to reinvent the wheels again.
https://developers.google.com/maps/
2) Based on your system requirement, you may or may not need a GIS server such as MapServer. Data could come from directly from clients for example. But since you mentioned it i would think you may need a GIS server to publish some data for the application to consume the services.
MapServer services via OGC standard protocols are easy to integred with most of the popular GIS libraries mentioned earlier. So once you publish Map service (wms) for example, it would be as easy as add one layer in such GIS library point to the service endpoint you published via Http request and by passing some parameters you would be able to get the GIS contents.
This is the link about how to consume MapServer service on the client side:
http://mapserver.org/ogc/wms_client.html
I'm about to start a project for a client that has lots of data that needs to be real-time.
There are two mobile apps that I will be building with trigger.io, as well as a web UI, and all of these need to stay in sync.
I plan to use socket.io's WebSocket implementation with my Node.js backend for the webapp & mobile apps. This will work great on iOS and modern web browsers.
However, Android's webview does not support websockets at all. And it would simply destroy the mobile app user's data plan if socket.io used its long-polling fallback on Android.
I was wondering: is there any possibility of an implementation of Java WebSockets for trigger.io Android, then exposing that to the WebView? There is a simple implementation for phonegap
I suppose I could write a trigger.io plugin for it - but I want to be sure before I jump in to this project if this is feasible / not too hard to write a plugin for.
I used trigger.io long ago, but not since all the fanciness came out like native plugins.
If using an HTTP fallback solution isn't an option (I'd do some calculations to determine if a streaming or long-polling solution would really "destroy the mobile users's data plan") then the best solution to add WebSocket support would probably be a trigger.io plugin.
At Pusher we used a Java wrapper in PhoneGap in order to get our JavaScript library to work. However we've since added HTTP fallback so I wouldn't recommend anybody use this now. The project is here:
https://github.com/pusher/pusher-phonegap-android
The problem with the Java wrapper here (we use websocket-android-phonegap) is that it doesn't support SSL connections (if I remember correctly) and it hasn't been updated for a long time.
With that in mind when we created the Pusher Java library (which supports Android) we used the WebSocket client in Java-WebSocket because it's being actively developed and supports SSL connections. I'd recommend it.
I'd be interested to hear about the support that https://github.com/mkuklis/phonegap-websocket provides.
Without reinventing the wheel, what I can use to manage user sessions in a web application and being able to respond with JSON to ajax requests?
Is there some framework (made for example with Indy components or something like this)?
Note for bounty:
in practice it is enough for me to have a reply with a clear example of a server application that serves json. Somehow a Delphi example of the php example mentioned HERE. (without the DB part, I want to see the basics of what does it mean to send JSON. I have basic knowledge of TIdHTTPServer.)
You can take a look at our Synopse SQLite3 Framework, which was just updated to version 1.11.
It serves the data in pure JSON, ready to be used in any AJAX application.
You can also easily create Services, more precisely Client-Server JSON RESTful Services. In this case, you can even not use SQLite3 for your data storage.
This framework is pure Open Source, compiles/run/is tested for Delphi 6 up to XE, is Unicode ready for all versions of Delphi (it uses UTF-8 internally).
By using this framework, you could be able to create easily also Delphi clients, using JSON data from the same server.
There is no internal User session handling yet. Because there are several way of implementing them, and, since our framework is RESTful, it's therefore stateless: no session is needed.
If you need it, I could easily add HTTP sessions using Cookies. What about the User authentication you are expecting?
Maybe this can help you:
REST Servers in Delphi XE Using DataSnap Whitepaper
Learn how to build REST servers using features available in Delphi XE, how to extend them with extra Delphi support code and how to take advantage of the jQuery library.
Marco Cantù
http://app.en25.com/e/er.aspx?s=608&lid=4414&elq=d428643420d2494581299418d9753feb
DelphiMVCFramework does this
Some notable features:
RESTful (RMM Level 3) compliant
Can be used in load balanced environment using Redis (http://Redis.io) [dev]
Fancy URL with parameter mappings
Specialied renders to generate text, html, JSON
Powerful mapper to map json to objects and datasets to objects
Can be packaged as stand alone server, apache module (XE6, XE7, XE8) and
ISAPI dll
Integrated RESTClient Works with XE3, XE4, XE5, XE6, XE7
and XE8 Completely unit tested
There is a sample for each functionlities
There is a complete set of trainings about it, but the
samples are included in the project Experimental support for IOCP
[dev]
Server side generated pages using eLua (Embedded Lua) [removed soon]
Specific trainings are available (ask me for a date and a place)
Messaging extension using STOMP (beta)
Community driven (Facebook group https://www.facebook.com/groups/delphimvcframework)
Simple and documented
There are books that talk about the framework
Project web site: https://github.com/danieleteti/delphimvcframework
N.B. I'm the main developer
I would suggest Delphi on Rails, it is an open source REST/MVC/StateLess web framework.
http://code.google.com/p/delphionrails/
It use:
superobject JSON parser
UIB/Firebird JSON driver
Cairo for SVG, PDF, PNG rendering
LUA for scripting/template ...
It is able to serialize automatically Delphi data structures to JSON using the new RTTI introduced in Delphi 2010 & XE.
I would recommend Super Object Toolkit.
http://www.progdigy.com
Example Code:
procedure Share(ARequestInfo: TIdHTTPRequestInfo)
var
ReturnObject: ISuperObject;
begin
ReturnObject := SO();
ReturnObject.B['success'] := false;
AResponseInfo.ContentType := 'application/json';
AResponseInfo.ContentText := ReturnObject.AsJSon();
end;
Daraja HTTP Framework, which uses Indy internally and adds a high level API for "web application contexts" and request mappings, loosely inspired by the Servlet API.
If you already have experience with TIdHTTPServer, you can directly access and adjust the server component according to your needs.
For JSON, you may use the built-in JSON support in newer Delphi versions or a third-party library (e.g. JsonDataObjects).
Disclaimer: I am the developer of the framework