Tutorial by Examples: api

import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; public class KeyBoardExample { public static void main(String[] args) { try { Robot robot = new Robot(); robot.delay(3000); robot.keyPress(KeyEvent.VK_Q); //...
Mouse movement: import java.awt.Robot; public class MouseClass { public static void main(String[] args) throws Exception { Robot robot = new Robot(); // SET THE MOUSE X Y POSITION robot.mouseMove(300, 550); } } Press left/right button of mouse: import java.awt....
from bs4 import BeautifulSoup import requests # Use the requests module to obtain a page res = requests.get('https://www.codechef.com/problems/easy') # Create a BeautifulSoup object page = BeautifulSoup(res.text, 'lxml') # the text field contains the source of the page # Now use a CSS ...
Depending on the device/release version of the system, some API may not be available. You can check which contract is supported by using ApiInformation.IsApiContractPresent() For example, this will return true on phone devices and false on the others ApiInformation.IsApiContractPresent(typeof(Cal...
To consume a REST API with RestTemplate, create a Spring boot project with the Spring boot initialzr and make sure the Web dependency is added: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dep...
// Define new router group $api = new \Phalcon\Mvc\Router\Group([ 'module' => 'api', ]); $api->setPrefix('/api/v1'); // API routes (Maps to Cotnroller::Action) $api->addGet('/users', 'Users::index'); $api->addGet('/users/search/{query}', 'Users::search'); $api->addGet('/...

API

Class Reference - API v1.0 Class Reference - API v1.1
Some websites don’t like to be scraped. In these cases you may need to simulate a real user working with a browser. Selenium launches and controls a web browser. from selenium import webdriver browser = webdriver.Firefox() # launch firefox browser browser.get('http://stackoverflow.com/questi...
<Image x:Name="MyImage" /> // Show image from web MyImage.Source = new BitmapImage(new Uri("http://your-image-url.com")) // Show image from solution MyImage.Source = new Uri("ms-appx:///your-image-in-solution", UriKind.Absolute) // Show image from file ...
We want to add Toast to nativescript default app. import {Component} from "@angular/core"; let application = require("application"); declare var android:any; @Component({ selector: "my-app", templateUrl: "app.component.html", }) export clas...
const url = 'http://api.stackexchange.com/2.2/questions?site=stackoverflow&tagged=javascript'; const questionList = document.createElement('ul'); document.body.appendChild(questionList); const responseData = fetch(url).then(response => response.json()); responseData.then(({item...
Official documentation: http://erlang.org/doc/man/erl_nif.html The most important structs, types and macros of the Erlang C API are the following: ERL_NIF_TERM: the type for Erlang terms. This is the return type that NIF functions must follow. ERL_NIF_INIT(MODULE, ErlNifFunc funcs[], load, relo...
var client = new AmazonDynamoDBClient(); // Store item client.PutItem(new PutItemRequest { TableName = "Books", Item = new Dictionary<string, AttributeValue> { { "Title", new AttributeValue { S = "Cryptonomicon" } }, { "...
#include <stdio.h> #include <curl/curl.h> int main(void) { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); /* example.com is redirected, so we tell libcurl to follow redirect...
This is an example of a simple GET API call wrapped in a promise to take advantage of its asynchronous functionality. var get = function(path) { return new Promise(function(resolve, reject) { let request = new XMLHttpRequest(); request.open('GET', path); request.onload = resolve; ...
We're going to use the expression tree API to create a CalculateSalesTax tree. In plain English, here's a summary of the steps it takes to create the tree. Check if the product is taxable If it is, multiply the line total by the applicable tax rate and return that amount Otherwise return 0 ...
Internal Table Declaration Based on Local Type Definition " Declaration of type TYPES: BEGIN OF ty_flightb, id TYPE fl_id, dat TYPE fl_date, seatno TYPE fl_seatno, firstname TYPE fl_fname, lastname TYPE fl_lname, fl...
In order to convert any callback API to promises assuming the promisify and promisifyAll version doesn't fit - you can use the promise constructor. Creating promises generally means specifying when they settle - that means when they move to the fulfilled (completed) or rejected (errored) phase to i...
The following examples use HAL to express HATEOAS, and make use of: CURIE (Compact URI): used to provide links to API documentation URI templates: URI that includes parameters that must be substituted before the URI is resolved Get blog 123 Request GET https://example.com/api/v1.2/blogs/123...
In the old fashion way for collection null check List<Object> someObjects = methodGetList(); for (Object obj : someObjects) { if (obj == null) { continue; } doSomething(obj); } With the Objects.nonNull method and Java8 Stream API, we can do the above in this way: ...

Page 6 of 12