Tutorial by Examples: cli

Recycling can be used in a clever way to simplify code. Subsetting If we want to keep every third element of a vector we can do the following: my_vec <- c(1,2,3,4,5,6,7,8,9,10) my_vec[c(TRUE, FALSE)] [1] 1 3 5 7 9 Here the logical expression was expanded to the length of the vector. ...
to check if the given path is a directory dirname = '/home/john/python' os.path.isdir(dirname) to check if the given path is a file filename = dirname + 'main.py' os.path.isfile(filename) to check if the given path is symbolic link symlink = dirname + 'some_sym_link' os.path.islink(symli...
#!/usr/bin/env python """ An annotated simple socket client example in python. WARNING: This example doesn't show a very important aspect of TCP - TCP doesn't preserve message boundaries. Please refer to http://blog.stephencleary.com/2009/04/message-framing.html before adaptin...
Unity networking provides the High Level API (HLA) to handle network communications abstracting from low level implementations. In this example we will see how to create a Server that can communicate with one or multiple clients. The HLA allows us to easily serialize a class and send objects of ...
Here is an example of how to define a different action for each Marker's InfoWindow click event. Use a HashMap in which the marker ID is the key, and the value is the corresponding action it should take when the InfoWindow is clicked. Then, use a OnInfoWindowClickListener to handle the event of a ...
Preemptive basic authentication is the practice of sending http basic authentication credentials (username and password) before a server replies with a 401 response asking for them. This can save a request round trip when consuming REST apis which are known to require basic authentication. As descr...
Using HttpClient as RestTemplate's underlying implementation to create HTTP requests allows for automatic handling of basic authentication requests (an http 401 response) when interacting with APIs. This example shows how to configure a RestTemplate to achieve this. // The credentials are stored he...
package main import ( "fmt" "k8s.io/client-go/1.5/kubernetes" "k8s.io/client-go/1.5/pkg/api/v1" "k8s.io/client-go/1.5/tools/clientcmd" ) func main() { config, err := clientcmd.BuildConfigFromFlags("", <kube-config-path&g...
Eclipse would provide its own embedded Maven enviroment out-of-the-box, which is not recommended whenever a certain Maven version must be used or further configuration must be performed (proxy, mirrors and so on): that is, to have full control over which Maven environment would be used by the IDE. ...
pip install neo4jrestclient
from neo4jrestclient import client q = 'MATCH (u:User)-[r:likes]->(m:language) WHERE u.name="Marco" RETURN u, type(r), m' "db" as defined above results = db.query(q, returns=(client.Node, str, client.Node)) Print results for r in results: print("(%s)-[%s]->...
using CLI: $ opennlp SentenceDetector ./en-sent.bin < ./input.txt > output.txt using API: import static java.nio.file.Files.readAllBytes; import static java.nio.file.Paths.get; import java.io.IOException; import java.util.Objects; public class FileUtils { /** * Get file data as...
It's a good practice to encode state of Single Page Application (SPA) in url: my-app.com/admin-spa/users/edit/id123 This allows to save and share application state. When user puts url into browser's address bar and hits enter server must ignore client-side part of the requested url. If you serv...
This is a basic polymer element that show a list of names. <link rel="import" href="../bower_components/polymer/polymer.html"> <dom-module id="basic-list"> <template> <style> </style> <div>Name's list</div&g...
build.gradle repositories { maven { url 'http://4thline.org/m2' } } dependencies { // Cling compile 'org.fourthline.cling:cling-support:2.1.0' //Other dependencies required by Cling compile 'org.eclipse.jetty:jetty-server:8.1.18.v20150929' compile 'org.eclipse.jetty:jetty-servlet:8....
Remove the token from the client storage to avoid usage Tokens are issued by the server and you can not force browsers to delete a cookie/localStorage or control how external clients are managing your tokens. Obviously if attackers have stolen the token before logout they still could use the token,...
Eclipse debugging starts with what is referred to as Agents. The JVM, which runs the complied .class sources has a feature that allows externally libraries (written in either Java or C++) to be injected into the JVM, just about runtime. These external libraries are referred to as Agents and they ha...
This is a basic polymer element that show a list of names. <link rel="import" href="../bower_components/polymer/polymer.html"> <dom-module id="basic-list"> <template> <style> </style> <div>Name's list</div&g...
The most interesting package for managing real tokens is django-rest-knox which supports multiple tokens per user (and cancelling each token independently), as well as having support for token expiration and several other security mechanisms. django-rest-knox depends on cryptography. You can find m...
jQuery('body').bind('click', function(e) { if(jQuery(e.target).closest('#navbar').length == 0) { // click happened outside of .navbar, so hide var opened = jQuery('.navbar-collapse').hasClass('collapse in'); if ( opened === true ) { jQuery('#navbar2 .navb...

Page 7 of 13