Tutorial by Examples

Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Fruit is (Banana, Orange, Pear); X : Fruit := Orange; begin Ada.Text_IO.Put_Line (X'Image); Ada.Text_IO.Put_Line (Pear'Image); end Main; Result ORANGE PEAR
Jupyter Notebooks are an interactive, browser-based development environment. They were originally developed to run computation python and as such play very well with numpy. To try numpy in a Jupyter notebook without fully installing either on one's local system Rackspace provides free temporary note...
Well, if you want a switch/case construct, the most straightforward way to go is to use the good old if/else construct: def switch(value): if value == 1: return "one" if value == 2: return "two" if value == 42: return "the answer to...
Another straightforward way to go is to create a dictionary of functions: switch = { 1: lambda: 'one', 2: lambda: 'two', 42: lambda: 'the answer of life the universe and everything', } then you add a default function: def default_case(): raise Exception('No case found!') ...
You can use a class to mimic the switch/case structure. The following is using introspection of a class (using the getattr() function that resolves a string into a bound method on an instance) to resolve the "case" part. Then that introspecting method is aliased to the __call__ method to ...
Another way, which is very readable and elegant, but far less efficient than a if/else structure, is to build a class such as follows, that will read and store the value to compare with, expose itself within the context as a callable that will return true if it matches the stored value: class Switc...
SQL has various join types to specify whether (non-)matching rows are included in the result: INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN (the INNER and OUTER keywords are optional). The figure below underlines the differences between these types of joins: the blue area repres...
It might be easier if you think of GROUP BY as "for each" for the sake of explanation. The query below: SELECT EmpID, SUM (MonthlySalary) FROM Employee GROUP BY EmpID is saying: "Give me the sum of MonthlySalary's for each EmpID" So if your table looked like this: +----...
I created custom label with wrapper around FormattedText property: public class MultiComponentLabel : Label { public IList<TextComponent> Components { get; set; } public MultiComponentLabel() { var components = new ObservableCollection<TextComponent>(); ...
Pre-processing in caret is done through the preProcess() function. Given a matrix or data frame type object x, preProcess() applies transformations on the training data which can then be applied to testing data. The heart of the preProcess() function is the method argument. Method operations are ap...
It is possible to perform ViewActions on a view using the perform method. The ViewActions class provides helper methods for the most common actions, like: ViewActions.click() ViewActions.typeText() ViewActions.clearText() For example, to click on the view: onView(...).perform(click()); onVi...
With the ViewMatchers you can find view in the current view hierarchy. To find a view, use the onView() method with a view matcher which selects the correct view. The onView() methods return an object of type ViewInteraction. For example, finding a view by its R.id is as simple as: onView(withId(...
If you do row-by-row processing in Salesforce, you'll probably reach the governor limit quickly. This is especially true with triggers and things that fire when you don't expect them. One documented method of escaping the governor limit is bulkification. Note: The following information is based on ...
Classes are vital aspects of OOP. A class is like the "blueprint" of an object. An object has the properties of a class, but the characteristics are not defined within the class itself. As each object can be different, they define their own characteristics. Public Class Person End Class ...
Inherits Specifies the base (or parent) class Public Class Person End Class Public Class Customer Inherits Person End Class 'One line notation Public Class Student : Inherits Person End Class Possible objects: Dim p As New Person Dim c As New Customer Dim s As New Student ...
Overridable Allows a property or method in a class to be overridden in a derived class. Public Class Person Public Overridable Sub DoSomething() Console.WriteLine("Person") End Sub End Class Overrides Overrides an Overridable property or method defined in the base...
The MyBase keyword behaves like an object variable that refers to the base class of the current instance of a class. Public Class Person Public Sub DoSomething() Console.WriteLine("Person") End Sub End Class Public Class Customer Inherits Person Public S...
Me uses the current object instance. MyClass uses the memberdefinition in the class where the member is called Class Person Public Overridable Sub DoSomething() Console.WriteLine("Person") End Sub Public Sub useMe() Me.DoSomething() End Sub ...
Overloading is the creation of more than one procedure, instance constructor, or property in a class with the same name but different argument types. Class Person Overloads Sub Display(ByVal theChar As Char) ' Add code that displays Char data. End Sub Overloads Sub Display...
It redeclares a member that is not overridable. Only calls to the instance will be affected. Code inside the base classes will not be affected by this. Public Class Person Public Sub DoSomething() Console.WriteLine("Person") End Sub Public Sub UseMe() ...

Page 577 of 1336