Tutorial by Examples

try (Realm realm = Realm.getDefaultInstance()) { realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { //whatever Transaction that has to be done } }); //No need to close realm in try-wit...
Debug Print shows the instance representation that is most suitable for debugging. print("Hello") debugPrint("Hello") let dict = ["foo": 1, "bar": 2] print(dict) debugPrint(dict) Yields >>> Hello >>> "Hello" >&gt...
ggplot(data = diamonds, aes(x = cut, fill =color)) + geom_bar(stat = "count", position = "dodge") it is possible to obtain an horizontal bar chart simply adding coord_flip() aesthetic to the ggplot object: ggplot(data = diamonds, aes(x = cut, fill =color)) + geom_ba...
Violin plots are kernel density estimates mirrored in the vertical plane. They can be used to visualize several distributions side-by-side, with the mirroring helping to highlight any differences. ggplot(diamonds, aes(cut, price)) + geom_violin() Violin plots are named for their resemblance...
angular .module('MyApp', []) .constant('VERSION', 1.0); Your constant is now declared and can be injected in a controller, a service, a factory, a provider, and even in a config method: angular .module('MyApp') .controller('FooterController', function(VERSION) { this.version = V...
There is no revolution here, but angular constant can be useful specially when your application and/or team starts to grow ... or if you simply love writing beautiful code! Refactor code. Example with event's names. If you use a lot of events in your application, you have event's names a lit...
The Hello world example is as simple as: awk 'BEGIN {print "Hello world"}' The most basic awk program consists of a true value (typically 1) and makes awk echo its input: $ date | awk '1' Mon Jul 25 11:12:05 CEST 2016 Since "hello world" is also a true value, you could a...
If you are unsure which rules to list in your .gitignore file, or you just want to add generally accepted exceptions to your project, you can choose or generate a .gitignore file: https://www.toptal.com/developers/gitignore https://github.com/github/gitignore Many hosting services such as Git...
Start a Script Block as background job: $job = Start-Job -ScriptBlock {Get-Process} Start a script as background job: $job = Start-Job -FilePath "C:\YourFolder\Script.ps1" Start a job using Invoke-Command on a remote machine: $job = Invoke-Command -ComputerName "ComputerName&...
async.parallel(tasks, afterTasksCallback) will execute a set of tasks in parallel and wait the end of all tasks (reported by the call of callback function). When tasks are finished, async call the main callback with all errors and all results of tasks. function shortTimeFunction(callback) { set...
async.series(tasks, afterTasksCallback) will execute a set of tasks. Each task are executed after another. If a task fails, async stops immediately the execution and jump into the main callback. When tasks are finished successfully, async call the "master" callback with all errors and all...
async.waterfall(tasks, afterTasksCallback) will execute a set of tasks. Each task are executed after another, and the result of a task is passed to the next task. As async.series(), if a task fails, async stop the execution and call immediately the main callback. When tasks are finished successfull...
Dropping the database is a simple one-liner statement. Drop database will delete the database, hence always ensure to have a backup of the database if required. Below is the command to drop Employees Database DROP DATABASE [dbo].[Employees]
SELECT name, caption as title, year, pages FROM books UNION SELECT name, title, year, 0 as pages FROM movies When combining 2 record sets with different columns then emulate the missing ones with default values.
extern int var; static int var; /* Undefined behaviour */ C11, §6.2.2, 7 says: If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined. Note that if an prior declaration of an identifier is visible then it'll have the pri...
Use the yum command to manage packages in Enterprise Linux-based operating systems: yum install php This installs a minimal install of PHP including some common features. If you need additional modules, you will need to install them separately. Once again, you can use yum to search for these pac...
Note: There will be some Objective-c in this example.. We will make a wrapper to C++ in this example, So don't worry to much about it. First start Xcode and create a project. And select a Cocoa application Delete all sources except the Info.plist file.(Your app won't work without it) Creat...
To start, gemfiles require at least one source, in the form of the URL for a RubyGems server. Generate a Gemfile with the default rubygems.org source by running bundle init. Use https so your connection to the server will be verified with SSL. source 'https://rubygems.org' Next, declare the gem...
You should always use <?php ?> tags or short-echo tags <?= ?>. Other variations (in particular, short tags <? ?>) should not be used as they are commonly disabled by system administrators. When a file is not expected to produce output (the entire file is PHP code) the closing ?&gt...
You can use the header() function to instruct the browser to redirect to a different URL: $url = 'https://example.org/foo/bar'; if (!headers_sent()) { // check headers - you can not send headers if they already sent header('Location: ' . $url); exit; // protects from code being executed afte...

Page 533 of 1336