Tutorial by Examples

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 ...
Given the following CSV-file String,DateTime,Integer First,2016-12-01T12:00:00,30 Second,2015-12-01T12:00:00,20 Third,2015-12-01T12:00:00,20 One can import the CSV rows in PowerShell objects using the Import-Csv command > $listOfRows = Import-Csv .\example.csv > $listOfRows String ...
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...
The simple and most obvious way to use recursion to get the Nth term of the Fibonnaci sequence is this int get_term_fib(int n) { if (n == 0) return 0; if (n == 1) return 1; return get_term_fib(n - 1) + get_term_fib(n - 2); } However, this algorithm does not scale for higher ...
Most Rails developers start by modifying their model information within the template itself: <h1><%= "#{ @user.first_name } #{ @user.last_name }" %></h1> <h3>joined: <%= @user.created_at.in_time_zone(current_user.timezone).strftime("%A, %d %b %Y %l:%M %p&q...
Detailed instructions on getting tizen set up or installed. You can start developing Tizen apps on commercialized devices : https://wiki.tizen.org/wiki/Devices Or https://wiki.tizen.org/wiki/ReferenceDevices Last option is to install Tizen from scratch on existing Hardware (x86, ARM etc) : htt...
// Store a reference to the native method let open = XMLHttpRequest.prototype.open; // Overwrite the native method XMLHttpRequest.prototype.open = function() { // Assign an event listener this.addEventListener("load", event => console.log(XHR), false); // Call the s...
To install and run jboss AS standalone you can follow the processes described below(assuming that you already have java 7 and jdk installed on your mac): Download the jboss application server from here. Unzip the package and extract the folders Set up the your bash_profile like the fo...
Executors returns different type of ThreadPools catering to specific need. public static ExecutorService newSingleThreadExecutor() Creates an Executor that uses a single worker thread operating off an unbounded queue There is a difference between newFixedThreadPool(1) and newSingleThreadE...
DateTime.parse is a very useful method which construct a DateTime from a string, guessing its format. DateTime.parse('Jun, 8 2016') # => #<DateTime: 2016-06-08T00:00:00+00:00 ((2457548j,0s,0n),+0s,2299161j)> DateTime.parse('201603082330') # => #<DateTime: 2016-03-08T23:30:00+00:00...

New

DateTime.new(2014,10,14) # => #<DateTime: 2014-10-14T00:00:00+00:00 ((2456945j,0s,0n),+0s,2299161j)> Current time: DateTime.now # => #<DateTime: 2016-08-04T00:43:58-03:00 ((2457605j,13438s,667386397n),-10800s,2299161j)> Note that it gives the current time in your timezone ...
DateTime + Fixnum (days quantity) DateTime.new(2015,12,30,23,0) + 1 # => #<DateTime: 2015-12-31T23:00:00+00:00 ((2457388j,82800s,0n),+0s,2299161j)> DateTime + Float (days quantity) DateTime.new(2015,12,30,23,0) + 2.5 # => #<DateTime: 2016-01-02T11:00:00+00:00 ((2457390j,39600s,...
Instructions on getting octave set up or installed. Installing Octave for debian systems (Debian, Ubuntu): Simple: sudo apt-get install octave Advanced: Well, if you want to install other external packages sudo apt-get install octave-control octave-image octave-io octave-optim octave-signal oct...
You can get the download link for the setup file in here : https://www.visualstudio.com [Scroll to the bottom of the page and download the Visual Studio] The setups are relatively simply and common. But do take note when they ask you to download the default or custom, you can choose to download th...
In Below sample we are creating one global javascript object dojoConfig which will contain all the configuration values. Note: dojoConfig is defined in a script block before dojo.js is loaded. This is of paramount importance—if reversed, the configuration properties will be ignored. <script...

Page 795 of 1336