Tutorial by Examples: ect

CPython allows access to the code object for a function object. The __code__object contains the raw bytecode (co_code) of the function as well as other information such as constants and variable names. def fib(n): if n <= 2: return 1 return fib(n-1) + fib(n-2) dir(fib.__code__) de...
Get current date and time lib.date = TEXT lib.date { data = date:U strftime = %d.%m.%Y %H:%M:%S wrap = Today is | } Get last login time and date from fe_users lib.date = TEXT lib.date { data = TSFE:fe_user|user|lastlogin strftime = %d.%m.%Y %H:%M:%S wrap = Last logi...
Here is a class (Dog) creating its own dependency (Food): class Dog { public Dog() { var food = new Food(); this.eat(food); } } Here is the same class being injected with its dependency using constructor injection: class Dog { public Dog(Food food) { ...
empty statement var statement expression statement do-while statement continue statement break statement return statement throw statement Examples: When the end of the input stream of tokens is encountered and the parser is unable to parse the input token stream as a single complete Pro...
When using C#'s inbuilt lock statement an instance of some type is needed, but its state does not matter. An instance of object is perfect for this: public class ThreadSafe { private static readonly object locker = new object(); public void SomeThreadSafeMethod() { lock (locker) { ...
If you want to provide a URL out of convenience for your user but map it directly to another one you're already using. Use a redirect: # config/routes.rb TestApp::Application.routes.draw do get 'courses/:course_name' => redirect('/courses/%{course_name}/lessons'), :as => "course&quot...
To create an albums collection, add the following to your config.yml file: collections: - albums Create a corresponding folder at the root of your Jekyll install, named exactly what you put in your config.yml file with an additional prepended underscore; in our example, <source>/_albums....
ASP.NET Core introduces the concept of dependency injection into Views via the @inject directive via the following syntax : @inject <type> <name> Example Usage Adding this directive into your View will basically generate a property of the given type using the given name within your ...
It is possible to use IO.inspect/1 as a tool to debug an elixir program. defmodule MyModule do def myfunction(argument_1, argument_2) do IO.inspect(argument_1) IO.inspect(argument_2) end end It will print out argument_1 and argument_2 to the console. Since IO.inspect/1 returns i...
Once you've installed the .NET CLI tools, you can create a new project with the following command: dotnet new --lang f# This creates a command line program.
To find active ScriptableObjects during runtime, you can use Resources.FindObjectsOfTypeAll(). T[] instances = Resources.FindObjectsOfTypeAll<T>(); Where T is the type of the ScriptableObject instance you're searching. Active means it has been loaded in memory in some form before. This me...
<style> input:in-range { border: 1px solid blue; } </style> <input type="number" min="10" max="20" value="15"> <p>The border for this value will be blue</p> The :in-range CSS pseudo-class matches when an element...
To insert data retrieved from SQL query (single or multiple rows) INSERT INTO Table_name (FirstName, LastName, Position) SELECT FirstName, LastName, 'student' FROM Another_table_name Note, 'student' in SELECT is a string constant that will be inserted in each row. If required, you can select a...
Transform tr = GetComponent<Transform>().Find("NameOfTheObject"); GameObject go = tr.gameObject; Find returns null if none is found ProsConsLimited, well defined search scopeStrings are weak references
You can use using in order to set an alias for a namespace or type. More detail can be found in here. Syntax: using <identifier> = <namespace-or-type-name>; Example: using NewType = Dictionary<string, Dictionary<string,int>>; NewType multiDictionary = new NewType(); /...
Directive code angular.module('myModule', []) .directive('myDirective', function() { return { template: '<div>{{greeting}} {{name}}!</div>', scope: { name: '=', greeting: '@' } }; }); The test describe('myDirective', function() ...
If you want to connect to an HBase server, first you need to make sure that the IP of the server is in your /etc/hosts file for example add the line 255.255.255.255 hbase Then you can use the Java API to connect to zookeeper, you only have to specify the client port and the zookeeper address ...
console.dir(object) displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects. var myObject = { "foo":{ "bar":"d...
stri_paste(LETTERS,"-", 1:13) # [1] "A-1" "B-2" "C-3" "D-4" "E-5" "F-6" "G-7" "H-8" "I-9" "J-10" "K-11" "L-12" "M-13" # [14] "N-1" "...
person = name: "Duder von Broheim" age: 27 address: "123 Fake St" phoneNumber: "867-5309" {name, age, address, phoneNumber} = person

Page 44 of 99