Tutorial by Examples

Dim sites() As String = {"Stack Overflow", "Super User", "Ask Ubuntu", "Hardware Recommendations"} Dim query = From x In sites Where x.StartsWith("S") ' result = "Stack Overflow", "Super User" Query will be enumerable objec...
Dim sites() As String = {"Stack Overflow", "Super User", "Ask Ubuntu", "Hardware Recommendations"} Dim query = From x In sites Select x.Length ' result = 14, 10, 10, 24 Query...
Dim sites() As String = {"Stack Overflow", "Super User", "Ask Ubuntu", "Hardware Recommendations"} Dim query = From x In sites Order By x.Length ' result = &qu...
ListView - A core component designed for efficient display of vertically scrolling lists of changing data. The minimal API is to create a ListView.DataSource, populate it with a simple array of data blobs, and instantiate a ListView component with that data source and a renderRow callback which take...
Primary Constructor In Scala the primary constructor is the body of the class. The class name is followed by a parameter list, which are the constructor arguments. (As with any function, an empty parameter list may be omitted.) class Foo(x: Int, y: String) { val xy: String = y * x /* now...
Public Function GetUserFirstName(UserName As String) As String Dim Firstname As String = "" 'Specify the SQL that you want to use including a Parameter Dim SQL As String = "select firstname from users where username=@UserName" 'Provide a Data Sourc...
A stream is an object that provides a low-level means to transfer data. They themselves do not act as data containers. The data that we deal with is in form of byte array(byte []). The functions for reading and writing are all byte orientated, e.g. WriteByte(). There are no functions for dealing w...
Java and most other languages store negative integral numbers in a representation called 2's complement notation. For a unique binary representation of a data type using n bits, values are encoded like this: The least significant n-1 bits store a positive integral number x in integral representati...
Variables are SHADOWED and methods are OVERRIDDEN. Which variable will be used depends on the class that the variable is declared of. Which method will be used depends on the actual class of the object that is referenced by the variable. class Car { public int gearRatio = 8; public St...
Casting an instance of a base class to a subclass as in : b = (B) a; is called narrowing (as you are trying to narrow the base class object to a more specific class object) and needs an explicit type-cast. Casting an instance of a subclass to a base class as in: A a = b; is called widening and does...
If we try to change an object on the UI thread from a different thread we will get a cross-thread operation exception: Private Sub Button_Click(sender As Object, e As EventArgs) Handles MyButton.Click ' Cross thread-operation exception as the assignment is executed on a different thread '...
Random and ThreadLocalRandom are good enough for everyday use, but they have a big problem: They are based on a linear congruential generator, an algorithm whose output can be predicted rather easily. Thus, these two classes are not suitable for cryptographic uses (such as key generation). One can ...
Drag 1 textbox and 1 button Double click the button1 and you will be transferred to the Button1_Click event Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click End Sub End Class Type the name of the object that you want to target, ...
Using sw As New System.IO.StreamWriter("path\to\file.txt") sw.WriteLine("Hello world") End Using The use of a Using block is recommended good practice when using an object that Implements IDisposable
std::ifstream f("file.txt"); if (f) { std::stringstream buffer; buffer << f.rdbuf(); f.close(); // The content of "file.txt" is available in the string `buffer.str()` } The rdbuf() method returns a pointer to a streambuf that can be pushed into buffer...
/** * returns a array of random numbers with no duplicates * @param range the range of possible numbers for ex. if 100 then it can be anywhere from 1-100 * @param length the length of the array of random numbers * @return array of random numbers with no duplicates. */ public static int[] ...
Most times when people have to reverse a string, they do it more or less like this: char[] a = s.ToCharArray(); System.Array.Reverse(a); string r = new string(a); However, what these people don't realize is that this is actually wrong. And I don't mean because of the missing NULL check. It ...
Creating backpressured data sources is the relatively easier task when dealing with backpressure in general because the library already offers static methods on Observable that handle backpressure for the developer. We can distinguish two kinds of factory methods: cold "generators" that ei...
Conceptually, integrate 3rd party REST APIs can be as simple as adding the http package and making a call to the external endpoint. meteor add http HTTP.get('http://foo.net/api/bar/');
Basic HTTP calls don't provide code-reusability, however. And they can get confused with all the other features you're trying to implement. For those reasons, it's common to implement an API wrapper. Foo = { identify: function(input){ return Http.get('http://foo.net/api/identify/' + input...

Page 405 of 1336