Tutorial by Examples: du

In a multi-project gradle build, you can have a dependency with another module in your build. Example: dependencies { // Dependency on the "mylibrary" module from this project compile project(":mylibrary") } The compile project(':mylibrary') line decla...
Expires — specifies date when the resource becomes stale. It relies on servers and clients having accurate clocks and supporting time zones correctly. Cache-control: max-age takes precedence over Expires, and is generally more reliable. post-check and pre-check directives are non-standard I...
Overflow also happens during the operation. In the following example, x is an int, 1 is an int by default. Therefore addition is an int addition. And the result will be an int. And it will overflow. int x = int.MaxValue; //MaxValue is 2147483647 long y = x + 1; //...
The var_dump function allows you to dump the contents of a variable (type and value) for debugging. Example: $array = [3.7, "string", 10, ["hello" => "world"], false, new DateTime()]; var_dump($array); Output: array(6) { [0]=> float(3.7) [1]=> ...
Sometimes it is required to display a notification at a specific time, a task that unfortunately is not trivial on the Android system, as there is no method setTime() or similiar for notifications. This example outlines the steps needed to schedule notifications using the AlarmManager: Add a Broa...
Here's an example of a rule that gives each authenticated user a personal node at /users/$user_id where $user_id is the ID of the user obtained through Authentication. // These rules grant access to a node matching the authenticated // user's ID from the Firebase auth token { "rules"...
from __future__ import print_function import threading def counter(count): while count > 0: print("Count value", count) count -= 1 return t1 = threading.Thread(target=countdown,args=(10,)) t1.start() t2 = threading.Thread(target=countdown,args=(20,)) ...
Remember, all the best practices of typical web architecture still apply. For an excellent overview on the subject, please refer to Michael Nygard's excellent book Release It! Design and Deploy Production-Ready Software. Writing your app in Meteor doesn't absolve you of auditing third party librarie...
Another use of RODBC is in connecting with SQL Server Management Database. We need to specify the 'Driver' i.e. SQL Server here, the database name "Atilla" and then use the sqlQuery to extract either the full table or a fraction of it. library(RODBC) cn <- odbcDriverConnect(connect...
proc myproc {} { puts "hi" } myproc # => hi An empty argument list (the second argument after the procedure name, "myproc") means that the procedure will not accept arguments.
proc myproc {alpha beta} { ... set foo $alpha set beta $bar ;# note: possibly useless invocation } myproc 12 34 ;# alpha will be 12, beta will be 34 If the argument list consists of words, those will be the names of local variables in the procedure, and their initi...
### Definition proc myproc {alpha {beta {}} {gamma green}} { puts [list $alpha $beta $gamma] } ### Use myproc A # => A {} green myproc A B # => A B green myproc A B C # => A B C This procedure accepts one, two, or three arguments: those parameters whose names are the fi...
proc myproc args { ... } proc myproc {args} { ... } ;# equivalent If the special parameter name args is the last item in the argument list, it receives a list of all arguments at that point in the command line. If there are none, the list is empty. There can be arguments, including optional one...
proc myproc {varName alpha beta} { upvar 1 $varName var set var [expr {$var * $alpha + $beta}] } set foo 1 myproc foo 10 5 puts $foo # => 15 In this particular case, the procedure is given the name of a variable in the current scope. Inside a Tcl procedure, such variables aren't...
Simple example of using the Chrome Logging API. Template.landingPage.events({ 'click .selectItemButton':function(){ // color code and count the user interaction (blue) console.count('click .selectItemButton'); } });
Some teams find that they want to leave console log statements in their code, but not have them display in production. They will override the logging functions if a variable isn't set (possibly an environment variable). Additionally, this may qualify as a security feature in some situations. if (...
* on the word you want to substitute. :%s//replacement/g, leaving the find pattern empty.
CSS and JS files should be reside under 'static' directory in the root directory of module (the rest of subdirectory tree under 'static' is an optional convention): static/src/css/your_file.css static/src/js/your_file.js Then add links to these files unsing one of the 3 ways listed in the fol...
All functions to interact with coroutines are avaliable in the coroutine table. A new coroutine is created by using the coroutine.create function with a single argument: a function with the code to be executed: thread1 = coroutine.create(function() print("honk") end)...
Modules have four associated keywords to make using them in other modules: alias, import, use, and require. alias will register a module under a different (usually shorter) name: defmodule MyModule do # Will make this module available as `CoolFunctions` alias MyOtherModule.CoolFunctions #...

Page 14 of 47