Saturday, March 17, 2018

Android REST Sample Programs

Android REST Sample Programs

http://windows8index.blogspot.com/2018/03/android-rest-sample-programs.html

What You Should Know

Retrofit is a class that provides a Java client interface for REST services that return JSON strings.

For example, the Openweather API server wants you to do http GET on an endpoint once you get your own appid

Thank you for the subscription to OpenWeatherMap Free service!


Dear Customer,
Your account and API key are activated for operating with OpenWeatherMap Free weather services.
API documentation
Endpoint for any API calls
Example of API call

GET


in browser returns json string

{"coord":{"lon":145.77,"lat":-16.92},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"base":"stations","main":{"temp":300.15,"pressure":1007,"humidity":74,"temp_min":300.15,"temp_max":300.15},"visibility":10000,"wind":{"speed":3.6,"deg":160},"clouds":{"all":40},"dt":1485790200,"sys":{"type":1,"id":8166,"message":0.2064,"country":"AU","sunrise":1485720272,"sunset":1485766550},"id":2172797,"name":"Cairns","cod":200}


Square documentation page
http://square.github.io/retrofit 

Introduction

Retrofit turns your HTTP API into a Java interface.
public interface GitHubService {
  @GET("users/{user}/repos")
  Call<List<Repo>> listRepos(@Path("user") String user);
}
The Retrofit class generates an implementation of the GitHubService interface.
Retrofit retrofit = new Retrofit.Builder()
    .baseUrl("https://api.github.com/")
    .build();

GitHubService service = retrofit.create(GitHubService.class);
Each Call from the created GitHubService can make a synchronous or asynchronous HTTP request to the remote webserver.
Call<List<Repo>> repos = service.listRepos("octocat");
Use annotations to describe the HTTP request:
  • URL parameter replacement and query parameter support
  • Object conversion to request body (e.g., JSON, protocol buffers)
  • Multipart request body and file upload

To work with Retrofit you need basically three classes.
  • Model class  POJO which is used to map the JSON data to Has one field for every item in the data
  • Interfaces which defines the possible HTTP Operations and endpoints
  • Client class which uses Interface and Retrofit.Builder class - Instance which uses the interface and the Builder API which defines URL end point for the HTTP operation.
Retrofit makes use of OkHttp (from the same developer) to handle network requests.

Retrofit does not have a built-in any JSON converter to parse from JSON to Java objects. Instead it ships support for the following JSON converter libraries to handle that and fill in POJO plain old java objects which have fields for each piece of data:

Gson: com.squareup.retrofit:converter-gson
Jackson: com.squareup.retrofit:converter-jackson
Moshi: com.squareup.retrofit:converter-moshi


Videos





11:59


Retrofit Tutorial — Getting Started and Creating an Android Client

Future Studio47K views1 year ago
In this video, you'll learn what Retrofit is and how to request data from the GitHub API. Tip: turn on subtitles to deal with my accent. A





8:07Retrofit Tutorial for Android
github source code
https://github.com/opendroid/RetrofitExample

48K views2 years ago

Tutorial on Retrofit Library by square. The example code is on github: https://github.com/opendroid/RetrofitExample Open weather





Android Retrofit Tutorial

PRABEESH R K


Android Retrofit - 01 - Introduction to Retrofit Library6:26
Android Retrofit - 02 - Simple Example of Retrofit23:53





28:39
Beginner Android REST Tutorial - Implementing Retrofit REST Adapter, OKHttp, JSON, DataModel
wiseAss1.4K views3 months ago
In this tutorial series, I'll be explaining the fundamentals of RESTful Web Services, and what the hell that actually means. In particular






52:25Android REST Tutorial - OKHttp Error Interceptors, RxJava 2, Repository Pattern, Retrofit

wis1.2K views2 months agoIn this tutorial series, I'll be explaining the fundamentals of RESTful Web Services, and what the hell that actually means. In particular






9:13
Retrofit Tutorial — Send Objects In Request Body
Future Studio
In this video, you'll learn how to send Java object in the request body to the server with Retrofit. Tip: turn on subtitles to deal with my





18:17Retrofit Android Example – Fetching JSON from URL
Simplified Coding14K views5 months ago
Retrofit Android Example. In this video we will learn fetching JSON data from a URL using RetrofitLibrary. For the source code and





10:35Make your REST Client easily in Android with Retrofit 2 and GSON - Part 1
Sylvain Saurel
8.7K views1 year agoLearn to make your REST Client easily in Android with Retrofit 2 and Gson - Part 1.
Android REST Tutorial - Retrofit, OkHttp, RxJava 2, JSON (Moshi)


Beginner Android REST Tutorial - What is REST, and why do we need it?3:47
Beginner Android REST Tutorial - Project Demo and Overview10:20

VIEW FULL PLAYLIST (4 VIDEOS)





24:37

Android REST Tutorial - CRUD Application RETROFIT Latest

SuperAndroidTutorial
13K views1 year ago


Create a simple rest application in android. How to invoke RESTful webservice in Android applications! How to call webservice in






11:37
Retrofit Tutorial — Basics of API Description
Future Studio933 views2 months ago


In this video, you'll learn in more detail how to describe API endpoints in Retrofit. I'll introduce a variety of standard configurations






21:41

Android Tutorial #7 - Get Stuff from Internet - Retrofit 2.0
SuperAndroidTutorial
16K views2 years ago


Code is here https://github.com/AndreiD/UltimateAndroidAppTemplate remember to star the repository please Retrofit is one of the






13:29
ANDROID RETROFIT JSON API CALL
Delaroy Studios14K views1 year agoThis video explains in details how to use the retrofit library to make JSON API calls to a live server Donate: https://www.paypal.me/





19:08Android JSON API Calls using Retrofit HTTP Library
Delaroy Studios20K views1 year ago

This is a fully analyzed video on how to make API calls using a more smoother library called Retrofitusing the Movies DB API. A

Android JSON Retrofit Example [Parsing JSON Data from Web ...
▶ 19:39
https://www.youtube.com/watch?v=Lx1e_fdnNxA
May 2, 2017 - Uploaded by CodingWithMitchAndroid JSON Retrofit Example [Parsing JSON Data from Web] Android Advanced Tutorial #9 In this video ...


Github

https://github.com/ahmed-adel-said/Retrofit-Library-Tutorial

Articles


JSON Parsing in Android
http://www.androiddeft.com/2017/10/08/retrofit-android/


android - Retrofit 2: Get JSON from Response body - Stack Overflow
https://stackoverflow.com/questions/40973633/retrofit-2-get-json-from-response-body
Mar 12, 2017 - and use dependencies in gradale compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.+'. NOTE: The error occurs because you changed your JSONinto POJO (by use of addConverterFactory(GsonConverterFactory.create()) in retrofit). If you want response in JSON then remove the ...
Get Started With Retrofit 2 HTTP Client - TutsPlus Code - Envato Tuts+
https://code.tutsplus.com/tutorials/getting-started-with-retrofit-2--cms-27792
Dec 16, 2016 - Retrofit, on the other hand, is very well planned, documented, and tested—a battle-tested library that will save you a lot of precious time and headaches. In this tutorial, I will explain how to useRetrofit 2 to handle network requests by building a simple app to query recent answers from the Stack Exchange ...

,Retrofit was built on top of some other powerful libraries and tools. Behind the scenes, Retrofit makes use of OkHttp (from the same developer) to handle network requests. Also, Retrofit does not have a built-in any JSON converter to parse from JSON to Java objects. Instead it ships support for the following JSON converter libraries to handle that:

Gson: com.squareup.retrofit:converter-gson
Jackson: com.squareup.retrofit:converter-jackson
Moshi: com.squareup.retrofit:converter-moshi

Getting started with Retrofit 2 | zeroturnaround.com
https://zeroturnaround.com/rebellabs/getting-started-with-retrofit-2/
Jun 2, 2016 - We're excited to announce that JRebel For Android 2.0 has landed! If you're as sick of slow development as we are, click below to check out the latest version of our awesome Android dev tool. LEARN MORE. This post was modified from its original version, we've rewritten it to include latestRetrofit 2.0+ ...
 we quickly got from zero to a functional sample that we can run from the Android Studio. What is even better it’s that the new Android emulator that came with the Android Studio 2.0 is pretty snappy too. 

Retrofit - Square Open Source
square.github.io/retrofit/
Introduction. Retrofit turns your HTTP API into a Java interface. public interface GitHubService { @GET("users/{user}/repos") Call<List<Repo>> listRepos(@Path("user") String user); }. The Retrofit class generates an implementation of the GitHubService interface. Retrofit retrofit = new Retrofit.Builder() .
You visited this page on 3/16/18.


Overview (Retrofit 2.3.0 API)
https://square.github.io/retrofit/2.x/retrofit/
Body · Call · CallAdapter · CallAdapter.Factory · Callback · Converter · Converter.Factory · DELETE · Field · FieldMap · FormUrlEncoded · GET · HEAD · Header · HeaderMap · Headers · HTTP · HttpException · Multipart · OPTIONS · Part · PartMap · PATCH · Path · POST · PUT · Query · QueryMap · QueryName · Response ...


Using Retrofit 2.x as REST client - Tutorial - Vogella
www.vogella.com/tutorials/Retrofit/article.html
Feb 13, 2018 - It also provides a REST API which is well documented on the Stackoverflow API side. In this exercise you use the Retrofit REST library. You will use it to query StackOverflow for tagged questions and their answers. We use the following query URL in our example. Open this URL in the browser and have a ...

To work with Retrofit you need basically three classes.
  • Model class which is used to map the JSON data to
  • Interfaces which defines the possible HTTP operations
  • Retrofit.Builder class - Instance which uses the interface and the Builder API which allows defining the URL end point for the HTTP operation.
Retrofit · ‎Retrofit converters and ... · ‎Retrofit authentication · ‎Exercise: Build an ...


Retrofit — Getting Started and Creating an Android Client - Future Studio
https://futurestud.io/tutorials/retrofit-getting-started-and-android-client


Dec 1, 2014 - This is the first tutorial in an extensive series on Retrofit. The series dives through all aspects of Retrofit and prepares you for many potential use cases. You'll get to know Retrofit's range of functions and extensibility. Update — October 21st 2015. We've added new code examples for Retrofit 2 besides the ...
Prepare Your Android Project · ‎How to Describe API ... · ‎Retrofit REST Client
Making REST call is common in now days app. There are lots of Opensource lib available in the market which can full-fill your requirement

Retrofit - Fast and effective 
Volley    - Fast effective in android specially for short time operation
OkHttp - Cool easy with high performance task 
Android Asynchronous Http Client  -Callback based API allow to pars data ready made.

Consuming REST API using Retrofit Library in Android - AndroidPub
https://android.jlelse.eu/consuming-rest-api-using-retrofit-library-in-android-ed47aef01e...What is rest on Android?
Retrofit is a REST Client library (Helper Library) used in Android and Java to create an HTTP request and also to process the HTTP response from a REST API. ... We can also simply say that a RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.Mar 19, 2017

Android Restful Webservice Tutorial – Introduction to RESTful ...
programmerguru.com/android-tutorial/android-restful-webservice-tutorial-part-1/
May 1, 2014 - In this post, I will be discussing about creating and invoking RESTful webservice inAndroid applications. This tutorial will be ... RESTful Web services are designed with less dependence on proprietary middleware (for example, an application server) than the SOAP- and WSDL-based kind. As per the ...

Consuming REST API using Retrofit Library in Android - AndroidPub
https://android.jlelse.eu/consuming-rest-api-using-retrofit-library-in-android-ed47aef0...
Mar 19, 2017 - Retrofit is a REST Client library (Helper Library) used in Android and Java to create an HTTP request and also to process the HTTP response from a REST API. It was created by Square, you can also use retrofit to receive data structures other than JSON, for example SimpleXML and Jackson.


Calling RESTful services from your Android app - TechRepublic
https://www.techrepublic.com/blog/.../calling-restful-services-from-your-android-app/
Mar 20, 2012 - There are a number of documents available on the web explaining what constitutes aREST service and how to implement one. There are also a number of write-ups explaining how to consume REST services from a client. Yet a common request I see in Android forums is for examples of Java-based ...

Source code for an Android AsyncTask (REST client) example ...
https://alvinalexander.com/android/android-asynctask-http-client-rest-example-tutorial
Mar 5, 2018 - This tutorial shares the complete source code for an Android AsyncTask and REST example. ... TextView; public class TestFragment extends Fragment { private static final String TAG = "AATestFragment"; // you'll want to call a REST service, but for basic network testing i use any url //private static final String ...


Creating a Simple Android REST Client Using HTTP-RPC - DZone ...
https://dzone.com/articles/creating-a-simple-android-rest-client-using-http-r
Dec 29, 2016 - HTTP-RPC, an open-source framework for simplifying the development of RESTapplications, can be used to invoke services provided by JSONPlaceholder.

https://developers.google.com/drive/v3/web/quickstart/android

Android Quickstart

Complete the steps described in the rest of this page, and in about ten minutes you'll have a simple Android application that makes requests to the Drive API.


Weather app uses REST
https://code.tutsplus.com/tutorials/create-a-weather-app-on-android--cms-21587

We can get the current weather details of any city formatted as JSON using the OpenWeatherMap API. In the query string, we pass the city's name and the metric system the results should be in.
For example, to get the current weather information for Canberra, using the metric system, we send a request to http://api.openweathermap.org/data/2.5/weather?q=Canberra&units=metric
The response we get back from the API looks like this:
Create a new Java class and name it RemoteFetch.java. This class is responsible for fetching the weather data from the OpenWeatherMap API.
We use the HttpURLConnection class to make the remote request. The OpenWeatherMap API expects the API key in an HTTP header named x-api-key. This is specified in our request using the setRequestProperty method.
We use a BufferedReader to read the API's response into a StringBuffer. When we have the complete response, we convert it to a JSONObject object.
As you can see in the above response, the JSON data contains a field named cod. Its value is 200 if the request was successful. We use this value to check whether the JSON response has the current weather information or not.

Weather API

Our weather API is simple, clear and free. We also offer higher levels of support, please see our paid plan options. To access the API you need to sign up for an API key if you are on a free or paid plan.

Current weather data

API doc Subscribe
  • Access current weather data for any location including over 200,000 cities
  • Current weather is frequently updated based on global models and data from more than 40,000 weather stations
  • Data is available in JSON, XML, or HTML format
  • Available for Free and all other paid accounts

Tuesday, June 13, 2017

Angular 2 with ASP.NET MVC WebApi

https://www.codeproject.com/Articles/1181888/Angular-in-ASP-NET-MVC-Web-API-Part

Tuesday, May 9, 2017

WinSock2 for Games

Rock Paper Scissors Game Project:
https://www.gamedev.net/resources/_/technical/multiplayer-and-network-programming/winsock2-for-games-r1059

Wednesday, May 3, 2017

Naushad Microsoft ASP.NET MVC Angular Training as Professional

Naushad Visual Studio .NET MVC Angular Training as Professional

Other series
Step-by-step ASP.NET MVC Tutorial for Beginners mosh udemy
Learn ASP NET MVC 5 Complete Tutorial 2016 COMPLETE  Hershey computing Nearly 4 hours

geelovejapan 

00:01 - The MVC Mindset 04:36 - Requests Handled by Actions 11:52 - ASP . NET Routing 18:36 - Action Result Types 22:13 - Action Selectors 27:40 - Filters 34:00 - Razor Syntax 38:44 - Layouts 43:00 - HTML Helpers 48:58 - Building and Minification 56:24 - Responsive Design with BootStrap 1:03:22 - Models in Actions and Views 1:08:34 - Display and Validating Model Properties 1:14:52 - View Models 1:19:19 - Database Objects and Entity Framework 1:24:46 - Entity Framework Code First Migrations 1:33:04 - Challenge: Adding Transactions 1:34:28 - Challenge: Solution 1:42:04 - OWIN and Katana 1:46:33 - Local Authentication 1:50:31 - Facebook Login 1:56:27 - ASP . NET Identity and the User Manager 2:02:02 - Role-Based Authorization 2:05:51 - Roles and Assignments 2:10:50 - Unit Testing 2:15:17 - Unit Tests 2:20:31 - Mocking Dependencies 2:26:35 - Test-Driven Development 2:33:09 - Partial Page Updates with Unobtrusive Ajax 2:38:23 - Partial Page Updates With jQuery Ajax 2:42:18 - Model Binding with Knockout 2:48:51 - Paged Grid with Knockout (skipta niðurstöðum í bls) 2:57:30 - Deploying to Azure Web Sites 3:03:10 - Deploying to AppHarbor 3:11:57 - Deploying Without Automatic Migrations 3:17:16 - Web.config Transformations 3:24:24 - Challenge: Implementing Transfers 3:28:23 - Challenge: Solution



MVC Training Part 1 What is MVC? and Defference between Asp.Net webForm and Asp.Net MVC

 MVC Training Part 2 My First HelloWorld Application In Asp.Net MVC

Tuesday, May 2, 2017

Mosaic Software Cambridge MA Chartman, Integrated-7, and The Twin 1-2-3-alike

Mosaic Software Cambridge MA Chartman, Integrated-7, and The Twin 1-2-3-alike



I'm Arthur Hu and for me the good old days were in the 80s from 1983-1989 when I stumbled on this company peddling a device independent graphics package for MS-BASIC for no money then got offered a salary if I could write a spreadsheet program for the PC like Lotus 1-2-3 or Microsoft Multiplan. 

According to wikipedia, I was actually the 2nd Bexley alumni (MIT '80, graduates with 2 degrees in 1981) to do a spreadsheet as the original Visicalc was done by Dan Bricklin, which in turn was reworked into Lotus 1-2-3 much like a spin-off before the Visi-On debacle. Bexley hall legendary as center of counterculture on campus since the 1960s and 70s and even into the 2010s until it was demolished allegedly due to water structural damage and is now the site of a park which does not bear a memorial.

After the success of 1-2-3, the industry was abuzz with the idea of who would be first to create an integrated software package that did everything. Lotus eventually came up with Symphony. Mosaic had started with the BASIC based Chartman and the idea was to use C to make an integrated package.  The result was Integrated-7 which was a spreadsheet with a very basic word processor and database, and the spreadsheet which was based mostly on 1-2-3 with its own file format was adapted to use the published 1-2-3 file format and became The Twin which was one of the first successful PC programs written in C using data abstraction which was taught at MIT in the late 1970s using PL/I before CLU was created.

At the time it was common practice to create programs that emulated other programs at a byte for byte compatibility level as long as you did not actually copy source code, which we didn't do. 

The Intel 8086/8088 was the original x86 processor which got around the 16 bit 64k addressing barrier which frequent afflicted minicomputers by adding a 4 bit segment hack which extended addressing to 1 million bytes or 1M memory which was fine for about 4 years. Lotus 1-2-3 which was written in 16 bit assembler with 16 bit pointers which was the most efficient way to to processing. Using Lattice C meant code would be bigger and worse, to simplify things we used Lattice C 32 bit LONG pointer,  but it wasn't bad as it was about twice as big and half as fast but usually memory got twice as big and twice as fast if you just waited for next year's PC. 

The hardest trick in matching was how they got lightning fast screen repaints because sprintf took FOREVER  to paint a screen full of floating point numbers. If you broke down the process manually, the bottleneck was floating point multiply by 10.0 to convert a number into a long decimal integer. 

The hack I figured out was to take the fraction and exponent out of the IEEE floating point to get a binary number, then use a shift and add (mult by 2 and add 1) to multiply by five and shift again which gives you ten, and then stick it back into the fraction and exponent add or subtract an exponent or two, and we got times similar to 1-2-3. This could all be done in C. The only assembler was to do the rpn push and pop for expression evaluation of tokens, and later to interface to Intel  




Franklin Hu

I was so inspired by your story, that I recovered i7 from my ancient 701C butterfly laptop and created an Integrated 7 museum. Find it at:


Send us a picture with your retro system running i7, I can add it to the museum.

Enjoy!

Welcome to the Integrated 7 (i7) Museum

Integrated 7 was a multipurpose spreadsheet/wordprocessing/database/communication, etc. etc. program that included many of (seven of them) the most commonly needed applications on a personal computer.
This program also contained the very first implementation of the Helvetica font which can be accessed by specifying Font =3 in the Graph Options menu.
This program was created in 1988 and I consider it abandonware. If anyone has any objections I will remove it, but for now, get it here.
This is a zip file, just unzip it to a directory like c:\i7
This can be run in a modern operating system if you use DosBox
After you start it, you can use the command
mount x: c:/i7
This will mount the x drive to where you unzipped i7.
Then just switch to the x: drive and run i7:
x:
i7
I have verified that if you change the configuration file (Use the menu to access Options/DosBox .74 Options)
machine = hercules
Then start i7 with the i7h.bat file, you can run it in high resolution black/white Hercules graphics card mode, so you can see that nice Helvetica font in all its glory.
-Thanks for dropping by, enjoy



I got this letter from my brother Franklin who was also there:


my e-mail is arthur no-space 98021 at gmail
From:
 Elmer Robinson elmerrobinson at yahoo
Date: May 1, 2017 at 5:35:12 PM PDT
To: "franklinhu at yahoo 
Subject: The Twin and Integrated 7
Mr. Hu,

I apologize for reaching out to you uninvited like this. I came across your resume while I was searching for the Twin and Integrated 7.

I am a 30+ year computer network engineer and security consultant, and my career in computers was launched in part because of my time with these two applications. The first computer I bought in 1986 I purchased with two 5 1/4" floppy drives and a copy of The Twin. What I could do with that program on that old machine was simply magic to me, and made me fall in love with computers. I had an experience where I found a bug in the Twin while I was working with it, called Mosaic's help line, spoke with someone who knew exactly what I was talking about and sent me out an update disk right away. From that point on I was hooked.
I'm reaching out to you because I've been bitten by the nostalgia bug, and I've been trying my best to re-create my first computer system. The only physical thing I need to find at this point are copies of The Twin, and Integrated 7. I have found internet archives with running copies of the Twin, but nothing is out there for I7. After years of searching I found an incomplete set of I7 disks and manuals, but the Library, Terminal and Help disks are missing preventing an full install.

So this is a wild, crazy shot in the dark to see if you have any idea where I could find copies of these programs that I love so much?

If nothing else, I wanted to tell you how much your work meant to me personally, and to thank you for your part in that.

Sincerely,
Elmer Robinson


It's really a pleasure to meet you both. I always thought the Twin was a great product that was better and cheaper than 123. It's too bad Lotus decided to sue the competition, rather than innovate and improve their product like they should have done. Especially since they just copied VisiCalc.

As I mentioned, I consider it the program that got me hooked on computers and I have a real soft spot for it.

I appreciate you keeping me in mind if you find something Twin or I7 related that you could part with. I'd be happy to pay what you think it's worth.