Tutorial by Examples: f

Although this works only for WebKit based browsers, this is helpful: /* ----------- Non-Retina Screens ----------- */ @media screen and (min-width: 1200px) and (max-width: 1600px) and (-webkit-min-device-pixel-ratio: 1) { } /* ----------- Retina Screens ----------- */ @media scre...
When an object is exposed to the template context, its arguments-less methods are available. This is useful when these functions are "getters". But it can be hazardeous if these methods alter some data or have some side effects. Eventhough you likely trust the template writer, he may not b...
Classes have a local scope during definition, but functions inside the class do not use that scope when looking up names. Because lambdas are functions, and comprehensions are implemented using function scope, this can lead to some surprising behavior. a = 'global' class Fred: a = 'class' ...
When working with large files, you can use the System.IO.File.ReadLines method to read all lines from a file into an IEnumerable<string>. This is similar to System.IO.File.ReadAllLines, except that it doesn't load the whole file into memory at once, making it more efficient when working with l...
File static class By using Create method of the File static class we can create files. Method creates the file at the given path, at the same time it opens the file and gives us the FileStream of the file. Make sure you close the file after you are done with it. ex1: var fileStream1 = File.Create...
File static class File static class can be easily used for this purpose. File.Copy(@"sourcePath\abc.txt", @"destinationPath\abc.txt"); File.Copy(@"sourcePath\abc.txt", @"destinationPath\xyz.txt"); Remark: By this method, file is copied, meaning that it w...
File static class File static class can easily be used for this purpose. File.Move(@"sourcePath\abc.txt", @"destinationPath\xyz.txt"); Remark1: Only changes the index of the file (if the file is moved in the same volume). This operation does not take relative time to the fil...
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Some_Float digits 8 range 0.0 .. 10.0; X : Some_Float := 2.71; begin Ada.Text_IO.Put_Line (X'Image); end Main; Result 2.71000E+00
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!') ...
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...
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>(); ...
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...
Public Interface IPerson Sub DoSomething() End Interface Public Class Customer Implements IPerson Public Sub DoSomething() Implements IPerson.DoSomething Console.WriteLine("Customer") End Sub End Class
In C, character constants and string literals are different things. A character surrounded by single quotes like 'a' is a character constant. A character constant is an integer whose value is the character code that stands for the character. How to interpret character constants with multiple charac...

Page 191 of 457