Tutorial by Examples: ect

As a privileged user (root or sudo): Create scollector directory: mkdir /opt/scollector In the /opt/scollector directory, download the latest binary build from the bosun/scollector site, [http://bosun.org/scollector/][1] wget https://github.com/bosun-monitor/bosun/releases/download/"version...
The Runnable interface defines a single method, run(), meant to contain the code executed in the thread. The Runnable object is passed to the Thread constructor. And Thread's start() method is called. Example public class HelloRunnable implements Runnable { @Override public void run()...
An example of a class that contains a parcelable class inside: public class Repository implements Parcelable { private String name; private Owner owner; private boolean isPrivate; public Repository(String name, Owner owner, boolean isPrivate) { this.name = name; ...
To create a redistributable package (e.g. a ZIP archive or setup program), it's usually enough to simply invoke CPack using a syntax very similar to calling CMake: cpack path/to/build/directory Depending on the environment this will gather all required/installed files for the project and put the...
To create a package using a specific format, it is possible to pick the Generator to be used. Similar to CMake this may be done using the -G argument: cpack -G 7Z . Using this command line would package the built project in the current directory using the 7-Zip archive format. At the time of w...
Obfuscation is often considered as a magic solution for code protection, by making your code harder to understand if it ever gets de-compiled by hackers. But if you're thinking that removing the Log.x(..) actually removes the information the hackers need, you'll have a nasty surprise. Removing al...
In Solution Explorer go to your project, right click on References then Add reference… Search for Compression and select System.IO.Compression.FileSystem then press OK. Add Imports System.IO.Compression to the top of your code file (before any class or module, with the other Imports statements)....
ADO.NET Connections are one of the simplest ways to connect to a database from a C# application. They rely on the use of a provider and a connection string that points to your database to perform queries against. Common Data Provider Classes Many of the following are classes that are commonly used...
Entity Framework exposes abstraction classes that are used to interact with underlying databases in the form of classes like DbContext. These contexts generally consist of DbSet<T> properties that expose the available collections that can be queried : public class ExampleContext: DbContext ...
A Connection String is a string that specifies information about a particular data source and how to go about connecting to it by storing credentials, locations, and other information. Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword; Storing Your Connection Stri...
What is an enter selection? In D3.js, when one binds data to DOM elements, three situations are possible: The number of elements and the number of data points are the same; There are more elements than data points; There are more data points than elements; In the situation #3, all the data ...
//all attributes $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*'); //specific attributes $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('name'); //certain attributes are special...
$productFound = ($product->getId() !== null)
class base { }; class derived: public base { }; int main() { base* p = new derived(); delete p; // The is undefined behavior! } In section [expr.delete] §5.3.5/3 the standard says that if delete is called on an object whose static type does not have a virtual destructor: if the...
This example adds a new rectangle to the canvas every 1 second (== a 1 second interval) Annotated Code: <!doctype html> <html> <head> <style> body{ background-color:white; } #canvas{border:1px solid red; } </style> <script> window.onload=(functio...
Invented by John McCarthy around 1958, Lisp (List Processor) has continued to grow into an entire family of languages. Since StackOverflow is more about practical programming problems, typically problems will involve actual Lisp dialects or derived languages and their implementations. Problems that...
import tensorflow as tf dims, layers = 32, 2 # Creating the forward and backwards cells lstm_fw_cell = tf.nn.rnn_cell.BasicLSTMCell(dims, forget_bias=1.0) lstm_bw_cell = tf.nn.rnn_cell.BasicLSTMCell(dims, forget_bias=1.0) # Pass lstm_fw_cell / lstm_bw_cell directly to tf.nn.bidrectional_rnn ...
UISplitViewController must be the rootViewController of your application. AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] i...
import tkinter as tk class HelloWorld(tk.Frame): def __init__(self, parent): super(HelloWorld, self).__init__(parent) self.label = tk.Label(self, text="Hello, World!") self.label.pack(padx=20, pady=20) if __name__ == "__main__": ...
In this example we are going to create a directive to copy a text into the clipboard by clicking on an element copy-text.directive.ts import { Directive, Input, HostListener } from "@angular/core"; @Directive({ selector: '[text-copy]' }) export class TextCopyDir...

Page 49 of 99