Tutorial by Examples: const

sys.foreignkeys system view returns information about all foreign key relationships in database: select name, OBJECT_NAME(referenced_object_id) as [parent table], OBJECT_NAME(parent_object_id) as [child table], delete_referential_action_desc, update_referential_action_desc from sys.foreign...
One can initialize a Julia array by hand, using the square-brackets syntax: julia> x = [1, 2, 3] 3-element Array{Int64,1}: 1 2 3 The first line after the command shows the size of the array you created. It also shows the type of its elements and its dimensionality (int this case Int64 ...
Classes have instance variable (dependencies), on which they call methods. Example taken from http://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html for reference public class Example { private DatabaseThingie myDatabase; public Example() { myDatabase = new DatabaseTh...
Class Car ... ' Parameterless Constructor Public Sub Class_Initialize() distances_ = Array(0) End Sub ' Default initialization method that can be invoked without ' explicitly using the method name. Public Default Function Init(wheels) wheels_ = ...
Enumeration types can also be declared without giving them a name: enum { buffersize = 256, }; static unsigned char buffer [buffersize] = { 0 }; This enables us to define compile time constants of type int that can as in this example be used as array length.
/** * @var \Vendor\Module\Helper\Data */ protected $customHelper; /** * Constructor call * @param \Vendor\Module\Helper\Data $customHelper */ public function __construct( \Vendor\Module\Helper\Data $customHelper ) { $this->customHelper = $customHelper; parent::__co...
This function return the standart gravity constant in the specified acceleration units (1 for cm/s², 2 for ft/s², 3 for m/s²) /** * Returns the standard gravity constant in the specified acceleration units * Values taken from https://en.wikipedia.org/wiki/Standard_gravity on July 24, 2016. ...
One of the primary uses for this cv-qualifiers is const correctness. This is the practice of guaranteeing that only accesses that need to modify an object are able to modify the object, and that any (member or non-member) function that doesn't need to modify an object doesn't have write access to t...
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...
In Julia, you can have an Array that holds other Array type objects. Consider the following examples of initializing various types of Arrays: A = Array{Float64}(10,10) # A single Array, dimensions 10 by 10, of Float64 type objects B = Array{Array}(10,10,10) # A 10 by 10 by 10 Array. Each ele...
You do not need to use double negation in if-else statements. if 'hello' puts 'hey!' else puts 'bye!' end The above code prints 'hey!' on the screen.
If you have code (a routine) you want to execute under a specific (constraint) context, you can use dependency injection. The following example shows the constraint of executing under an open SSL connection. This first part would be in your library or framework, which you won't expose to the client...
We can avoid providing direct access to resource intensive constructors, like for databases. public class DbConnection { private static final int MAX_CONNS = 100; private static int totalConnections = 0; private static Set<DbConnection> availableConnections = new HashSet<DbConnectio...
interface IService { void ProcessRequest(); } interface IRepository { IEnumerable<string> GetData(); } class HelloWorldRepository : IRepository { public IEnumerable<string> GetData() { return new[] { "Hello", "World" }; } ...
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var dep = new DefaultDependency(); var foo = new ClassWithDependency(dep); foo.DoSomething(); var bar = new Injected...
The Constructor Dependency Injection requires parameters in the constructor to inject dependencies. So you have to pass the values when you create a new object. public class Example { private readonly ILogging _logging; public Example(ILogging logging) { this._logging = l...
Masonry is a library for objective-c but xamarin have created a binding for it and created it as a nuget package https://www.nuget.org/packages/Masonry/. Nuget install Install-Package Masonry This centers a button 100 points below the centre point of the containing view and sets a width between...
defmodule MyModule do @my_favorite_number 13 @use_snake_case "This is a string (use double-quotes)" end These are only accessible from within this module.
Declare: defmodule MyApp.ViaFunctions.Constants do def app_version, do: "0.0.1" def app_author, do: "Felix Orr" def app_info, do: [app_version, app_author] def bar, do: "barrific constant in function" end Consume with require: defmodule MyApp.ViaFuncti...
Declare: defmodule MyApp.ViaMacros.Constants do @moduledoc """ Apply with `use MyApp.ViaMacros.Constants, :app` or `import MyApp.ViaMacros.Constants, :app`. Each constant is private to avoid ambiguity when importing multiple modules that each have their own copies of th...

Page 10 of 13