import java.io.*;
import java.net.Socket;
public class Main {
public static void main(String[] args) throws IOException {//We don't handle Exceptions in this example
//Open a socket to stackoverflow.com, port 80
Socket socket = new Socket("stackoverflow.com",8...
A web worker is a simple way to run scripts in background threads as the worker thread can perform tasks (including I/O tasks using xmlHttpRequest) without interfering with the user interface. Once created, a worker can send messages which can be different data types (except functions) to the JavaSc...
Downloading a file from the internet is a very common task required by almost every application your likely to build.
To accomplish this, you can use the "System.Net.WebClient" class.
The simplest use of this, using the "using" pattern, is shown below:
using (var webClient = n...
Here we make a simple echo websocket using asyncio. We define coroutines for connecting to a server and sending/receiving messages. The communcations of the websocket are run in a main coroutine, which is run by an event loop. This example is modified from a prior post.
import asyncio
import ai...
The vast majority of modern JavaScript environments work according to an event loop. This is a common concept in computer programming which essentially means that your program continually waits for new things to happen, and when they do, reacts to them. The host environment calls into your program, ...
Managing AWS resources that scale up and down runs into the limits of the static inventory host file, that's why we need something dynamic. And that's what the dynamic inventories are for. Let's start:
Download these ec2.ini and ec2.py files to the your project folder:
cd my_ansible_project
wget...
Ensure that you install the correct npm dependencies (babel decided to split itself into a bunch of packages, something to do with "peer dependencies"):
npm install webpack webpack-node-externals babel-core babel-loader babel-preset-react babel-preset-latest --save
webpack.config.js:
mo...
Note: you should use this way if you've installed a "website" module and you have a public website available.
Add following record in 'your_file.xml':
<openerp>
<data>
<template id="assets_frontend" name="your_module_name assets" inherit...
In case your activities, fragments and UI require some background processing a good thing to use is a MockWebServer which runs localy on an android device which brings a closed and testable enviroment for your UI.
https://github.com/square/okhttp/tree/master/mockwebserver
First step is including t...
import UIKit
import WebKit
class ViewController: UIViewController, UISearchBarDelegate, WKNavigationDelegate, WKUIDelegate {
var searchbar: UISearchBar! //All web-browsers have a search-bar.
var webView: WKWebView! //The WKWebView we'll use.
var toolbar: UIToolbar! //Toolb...