Tutorial by Examples: by

That would get more control over serialization, how to save and load types Implement ISerializable interface and create an empty constructor to compile [Serializable] public class Item : ISerializable { private string _name; public string Name { get { return _name; } ...
Using the Employees Table, below is an example to return the Id, FName and LName columns in (ascending) LName order: SELECT Id, FName, LName FROM Employees ORDER BY LName Returns: IdFNameLName2JohnJohnson1JamesSmith4JohnathonSmith3MichaelWilliams To sort in descending order add the DESC keywo...
Multiple fields can be specified for the ORDER BY clause, in either ASCending or DESCending order. For example, using the http://stackoverflow.com/documentation/sql/280/example-databases/1207/item-sales-table#t=201607211314066434211 table, we can return a query that sorts by SaleDate in ascending o...
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...
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...
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: +----...
The Python interpreter compiles code to bytecode before executing it on the Python's virtual machine (see also What is python bytecode?. Here's how to view the bytecode of a Python function import dis def fib(n): if n <= 2: return 1 return fib(n-1) + fib(n-2) # Display the disas...
empty statement var statement expression statement do-while statement continue statement break statement return statement throw statement Examples: When the end of the input stream of tokens is encountered and the parser is unable to parse the input token stream as a single complete Pro...
In C++, a byte is the space occupied by a char object. The number of bits in a byte is given by CHAR_BIT, which is defined in climits and required to be at least 8. While most modern systems have 8-bit bytes, and POSIX requires CHAR_BIT to be exactly 8, there are some systems where CHAR_BIT is great...
Transform tr = GetComponent<Transform>().Find("NameOfTheObject"); GameObject go = tr.gameObject; Find returns null if none is found ProsConsLimited, well defined search scopeStrings are weak references
Split vector of texts using one pattern: stri_split_fixed(c("To be or not to be.", "This is very short sentence.")," ") # [[1]] # [1] "To" "be" "or" "not" "to" "be." # # [[2]] # [1] "This" ...
The most straightforward approach to optimizing is by executing less code. This approach usually gives a fixed speed-up without changing the time complexity of the code. Even though this approach gives you a clear speedup, this will only give noticable improvements when the code is called a lot. R...
When storing JSON documents in SQL Server, We need to be able to efficiently filter and sort query results on properties of the JSON documents. CREATE TABLE JsonTable ( id int identity primary key, jsonInfo nvarchar(max), CONSTRAINT [Content should be formatted as JSON] CHECK...
One might want to GROUP BY more than one column declare @temp table(age int, name varchar(15)) insert into @temp select 18, 'matt' union all select 21, 'matt' union all select 21, 'matt' union all select 18, 'luke' union all select 18, 'luke' union all select 21, 'luke' union all select 1...
To do this you need a reference to the assembly which contains the type. If you have another type available which you know is in the same assembly as the one you want you can do this: typeof(KnownType).Assembly.GetType(typeName); where typeName is the name of the type you are looking for (incl...
Group by is often used with join statement. Let's assume we have two tables. The first one is the table of students: IdFull NameAge1Matt Jones202Frank Blue213Anthony Angel18 Second table is the table of subject each student can take: Subject_IdSubject1Maths2P.E.3Physics And because one student c...
Function arguments can be passed "By Reference", allowing the function to modify the variable used outside the function: function pluralize(&$word) { if (substr($word, -1) == 'y') { $word = substr($word, 0, -1) . 'ies'; } else { $word .= 's'; } } $w...
Group Concat is used in MySQL to get concatenated values of expressions with more than one result per column. Meaning, there are many rows to be selected back for one column such as Name(1):Score(*) NameScoreAdamA+AdamA-AdamBAdamC+BillD-JohnA- SELECT Name, GROUP_CONCAT(Score ORDER BY Score desc SE...
#!/bin/bash FILENAME="/etc/passwd" while IFS=: read -r username password userid groupid comment homedir cmdshell do echo "$username, $userid, $comment $homedir" done < $FILENAME In unix password file, user information is stored line by line, each line consisting of i...
ByVal keyword before method parameter (or no keyword as ByVal is assumed by default) says that parameter will be sent in a way not allowing the method to change (assign a new value) the variable underlying the parameter. It doesn't prevent the content (or state) of the argument to be changed if it'...

Page 10 of 23