Tutorial by Examples: ect

System.IO.Compression.ZipFile.ExtractToDirectory("archive.zip", "myfolder") Extracts archive.zip to myfolder directory. In example paths are relative to program working directory. You can specify absolute paths.
Named Types Dim someInstance As New SomeClass(argument) With { .Member1 = value1, .Member2 = value2 '... } Is equivalent to Dim someInstance As New SomeClass(argument) someInstance.Member1 = value1 someInstance.Member2 = value2 '... Anonymous Types (Option...
Arrays Dim names = {"Foo", "Bar"} ' Inferred as String() Dim numbers = {1, 5, 42} ' Inferred as Integer() Containers (List(Of T), Dictionary(Of TKey, TValue), etc.) Dim names As New List(Of String) From { "Foo", "Bar" '... ...
scrollViewDidEndDecelerating: this tells the delegate that the scroll view has ended decelerating the scrolling movement. Objective C: - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [self stoppedScrolling]; } - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView w...
If you wish to make a complete backup of a large MySql installation and do not have sufficient local storage, you can dump and compress it directly to an Amazon S3 bucket. It's also a good practice to do this without having the DB password as part of the command: mysqldump -u root -p --host=localho...
WITHOUT_ARRAY_WRAPPER option enables you to generate a single object instead of the array. Use this option if you know that you will return single row/object: SELECT top 3 object_id, name, type, principal_id FROM sys.objects WHERE object_id = 3 FOR JSON PATH, WITHOUT_ARRAY_WRAPPER Single obje...
Wraps returned JSON array in additional root object with specified key: SELECT top 3 object_id, name, type FROM sys.objects FOR JSON PATH, ROOT('data') Result of the query would be array of JSON objects inside the wrapper object: { "data":[ {"object_id":3,&qu...
Select all columns from some table (system table in this case): SELECT * FROM sys.objects Or, select just some specific columns: SELECT object_id, name, type, create_date FROM sys.objects
SELECT statement can be executed without FROM clause: declare @var int = 17; SELECT @var as c1, @var + 2 as c2, 'third' as c3 In this case, one row with values/results of expressions are returned.
This example shows a helper class that contains methods useful, when executing the queries for data. Every method here uses Java Generic's in order to be very flexible. public <T> List<T> selectElements(AbstractDao<T, ?> dao) { if (dao == null) { return null; } ...
This technique details how to ensure that your .apk has been signed with your developer certificate, and leverages the fact that the certificate remains consistent and that only you have access to it. We can break this technique into 3 simple steps: Find your developer certificate signature. Em...
BackAndroid.addEventListener('hardwareBackPress', function() { if (!this.onMainScreen()) { this.goBack(); return true; } return false; }); Note: this.onMainScreen() and this.goBack() are not built in functions, you also need to implement those. (https://github.c...
In Groovy, the inject() method is one of the cumulative methods that allows us to add (or inject) new functionality into any object that implements the inject() method. In the case of a Collection, we can apply a closure to a collection of objects uniformly and then collate the results into a single...
var source = new AutoCompleteStringCollection(); // Add your collection of strings. source.AddRange(new[] { "Guybrush Threepwood", "LeChuck" }); var textBox = new TextBox { AutoCompleteCustomSource = source, AutoCompleteMode = AutoCompleteMode.SuggestAppend, ...
library(gpuR) # gpuMatrix objects X <- gpuMatrix(rnorm(100), 10, 10) Y <- gpuMatrix(rnorm(100), 10, 10) # transfer data to GPU when operation called # automatically copied back to CPU Z <- X %*% Y
library(gpuR) # vclMatrix objects X <- vclMatrix(rnorm(100), 10, 10) Y <- vclMatrix(rnorm(100), 10, 10) # data always on GPU # no data transfer Z <- X %*% Y
In most cases, it is illegal to access an object of one type as though it were a different type (disregarding cv-qualifiers). Example: float x = 42; int y = reinterpret_cast<int&>(x); The result is undefined behavior. There are some exceptions to this strict aliasing rule: An obj...
Get current time: Time.now Time.new # is equivalent if used with no parameters Get specific time: Time.new(2010, 3, 10) #10 March 2010 (Midnight) Time.new(2015, 5, 3, 10, 14) #10:14 AM on 3 May 2015 Time.new(2050, "May", 3, 21, 8, 16, "+10:00") #09:08:16 PM on 3 May 2050...
A transaction acts on a single database connection. If you have multiple class-specific databases, the transaction will not protect interaction among them. One workaround is to begin a transaction on each class whose models you alter: Student.transaction do Course.transaction do course.enro...
The Scala Collections framework, according to its authors, is designed to be easy to use, concise, safe, fast, and universal. The framework is made up of Scala traits that are designed to be building blocks for creating collections. For more information on these building blocks, read the official S...

Page 47 of 99