Tutorial by Examples: n

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 ...
zsh loads configuration from the ~/.zshrc file on startup. If you make changes to that file, you can either restart zsh or run the following command to reload the configuration. . ~/.zshrc You can alias this useful command in your ~/.zshrc like this: alias reload=". ~/.zshrc"
Detailed instructions on getting yarn set up or installed. If you have npm installed on your system: npm install --global yarn On macOS: via Homebrew: brew install yarn via MacPorts: sudo port install yarn (node will be installed if not present) On Windows: via Chocolatey: choco install...
Some Java programmers have a general aversion to throwing or propagating exceptions. This leads to code like the following: public Reader getReader(String pathname) { try { return new BufferedReader(FileReader(pathname)); } catch (IOException ex) { System.out.println(&q...
mod_rewrite must be enabled before being used on an Apache server. Debian/Ubuntu Run a2enmod rewrite Then restart Apache with service apache2 restart General case Add or uncomment the following line in the static configuration file (such as httpd.conf): LoadModule rewrite_module modules/mod_re...
There are many time zones around the world, it is important to make sure your server is set to the right one. This is done in .htaccess by using: SetEnv TZ America/Indianapolis A few example of possible other time zones: America/Los_Angeles America/Los_Angeles - Pacific Time Pacific/Honolulu...
ExecutorService ExecutorService executor = Executors.newFixedThreadPool(50); It is simple and easy to use. It hides low level details of ThreadPoolExecutor. I prefer this one when number of Callable/Runnable tasks are small in number and piling of tasks in unbounded queue does not increase m...
Let's have a look at various options to wait for completion of tasks submitted to Executor ExecutorService invokeAll() Executes the given tasks, returning a list of Futures holding their status and results when everything is completed. Example: import java.util.concurrent.*; import ja...
Entity class @Entity @Table(name = "USER") public class User { @Id @Column(name = "ID") private Long id; @Column(name = "USERNAME") private String username; @ManyToOne @JoinColumn("ORGANIZATION_ID") pr...
We can also specify that a virtual function is pure virtual (abstract), by appending = 0 to the declaration. Classes with one or more pure virtual functions are considered to be abstract, and cannot be instantiated; only derived classes which define, or inherit definitions for, all pure virtual fun...
PHP 4+ supplies a method, format that converts a DateTime object into a string with a desired format. According to PHP Manual, this is the object oriented function: public string DateTime::format ( string $format ) The function date() takes one parameters - a format, which is a string Format T...
Creating a reverse ssh tunnel takes just one switch -R to the original command. Command line Let's assume you are connecting to the example.com as a user guest using a command ssh [email protected]. Opening reverse tunnel can look like this: ssh -R 2222:localhost:22 [email protected] It will o...
#include <pthread.h> #include <stdio.h> #include <string.h> /* function to be run as a thread always must have the same signature: it has one void* parameter and returns void */ void *threadfunction(void *arg) { printf("Hello, World!\n"); /*printf() is speci...
Consider these two micro-benchmarks: The first benchmark simply creates, starts and joins threads. The thread's Runnable does no work. public class ThreadTest { public static void main(String[] args) throws Exception { while (true) { long start = System.nanoTime(); ...
If you need to store images or videos in the column then we need to change the value as needed by your application max_allowed_packet = 10M M is Mb, G in Gb, K in Kb
Let's say you have an image rgbImg, e.g., read in using imread. >> rgbImg = imread('pears.png'); >> figure, imshow(rgbImg), title('Original Image') Use fspecial to create a 2D filter: >> h = fspecial('disk', 7); >> figure, imshow(h, []), title('Filter') Use imfi...
Starting with a binary image, bwImg, which contains a number of connected objects. >> bwImg = imread('blobs.png'); >> figure, imshow(bwImg), title('Binary Image') To measure properties (e.g., area, centroid, etc) of every object in the image, use regionprops: >> stats = reg...
Conditions can also be expressions: $myInput = 0 switch($myInput) { # because the result of the expression, 4, # does not equal our input this block should not be run. (2+2) { 'True. 2 +2 = 4' } # because the result of the expression, 0, # does equal our input this ...
By default, Import-CSV imports all values as strings, so to get DateTime- and integer-objects, we need to cast or parse them. Using Foreach-Object: > $listOfRows = Import-Csv .\example.csv > $listOfRows | ForEach-Object { #Cast properties $_.DateTime = [datetime]$_.DateTime $...
get_defined_vars() returns an array with all the names and values of the variables defined in the scope in which the function is called. If you want to print data you can use standard functions for outputting human-readable data, like print_r or var_dump. var_dump(get_defined_vars()); Note: This...

Page 647 of 1088