Tutorial by Examples: e

You can use traits to modify methods of a class, using traits in stackable fashion. The following example shows how traits can be stacked. The ordering of the traits are important. Using different order of traits, different behavior is achieved. class Ball { def roll(ball : String) = println(&q...
We can name our loops and break the specific one when necessary. outerloop: for (var i = 0;i<3;i++){ innerloup: for (var j = 0;j <3; j++){ console.log(i); console.log(j); if (j == 1){ break outerloop; } } } Output: 0 0...
Detailed instructions on getting asp.net-web-api set up or installed.
While many people think that ^ means the start of a string, it actually means start of a line. For an actual start of string anchor use, \A. The string hello\nworld (or more clearly) hello world Would be matched by the regular expressions ^h, ^w and \Ah but not by \Aw
With IronPython you can access any .net assembly which is compiled using the same or a lower version than the IronPython core. Example: Importing a a .net assembly and class from System import Math Example: Using an imported class: from System import Math print Math.Abs(-123) You can also lo...
Statistical functions in R make heavy use of the so-called Wilkinson-Rogers formula notation1 . When running model functions like lm for the Linear Regressions, they need a formula. This formula specifies which regression coefficients shall be estimated. my_formula1 <- formula(mpg ~ wt) class(...
//1) All attributes should be inherited from System.Attribute //2) You can customize your attribute usage (e.g. place restrictions) by using System.AttributeUsage Attribute //3) You can use this attribute only via reflection in the way it is supposed to be used //4) MethodMetadataAttribute is jus...
[StackDemo(Text = "Hello, World!")] public class MyClass { [StackDemo("Hello, World!")] static void MyMethod() { } }
Method GetCustomAttributes returns an array of custom attributes applied to the member. After retrieving this array you can search for one or more specific attributes. var attribute = typeof(MyClass).GetCustomAttributes().OfType<MyCustomAttribute>().Single(); Or iterate through them forea...
To find out the IP address of your container, use: docker inspect <container id> | grep IPAddress or use docker inspect docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}
Payments Table CustomerPayment_typeAmountPeterCredit100PeterCredit300JohnCredit1000JohnDebit500 select customer, sum(case when payment_type = 'credit' then amount else 0 end) as credit, sum(case when payment_type = 'debit' then amount else 0 end) as debit from payments group by ...
If you need to remove one or more elements from a slice, or if you need to work with a sub slice of another existing one; you can use the following method. Following examples uses slice of int, but that works with all type of slice. So for that, we need a slice, from witch we will remove some ...
Maps in go are not safe for concurrency. You must take a lock to read and write on them if you will be accessing them concurrently. Usually the best option is to use sync.RWMutex because you can have read and write locks. However, a sync.Mutex could also be used. type RWMap struct { sync.RWMut...
Doctrine 2 is easy to install via composer composer require doctrine/orm but it can also be downloaded from http://www.doctrine-project.org/projects/orm.html or from its GitHub project page.
ActionScript 3 can be used by installing the Adobe AIR SDK or Apache Flex SDK or as part Adobe's Animate CC product (formerly known as Flash Professional). Adobe Animate CC is a professional software solution that can be used to create AS3 projects using visual tools - once installed, no further st...
Classes have 3 types of methods: instance, singleton and class methods. Instance Methods These are methods that can be called from an instance of the class. class Thing def somemethod puts "something" end end foo = Thing.new # create an instance of the class foo.somemeth...
ForEach has two different meanings in PowerShell. One is a keyword and the other is an alias for the ForEach-Object cmdlet. The former is described here. This example demonstrates printing all items in an array to the console host: $Names = @('Amy', 'Bob', 'Celine', 'David') ForEach ($Name in $...
A while loop will evaluate a condition and if true will perform an action. As long as the condition evaluates to true the action will continue to be performed. while(condition){ code_block } The following example creates a loop that will count down from 10 to 0 $i = 10 while($i -ge 0){ ...
A command shell is a command line interface computer program to an operating system. Some Variants 1. Bash : Comes as default shell on ubuntu 2. KornShell(ksh) : To install ksh in Ubuntu $ sudo apt-get install ksh To start working with ksh $ ksh $ ps $$ PID TTY STAT ...
Detailed instructions on getting UWP set up or installed. Requirements Windows 10 Visual Studio 2015 Steps Download and custom install Visual Studio 2015, while making sure that Universal Windows App Development Toolsis selected along with its sub options:- a) Tools and Windows SDK b...

Page 114 of 1191