Tutorial by Examples: and

A class or struct can also define member type aliases, which are type aliases contained within, and treated as members of, the class itself. struct IHaveATypedef { typedef int MyTypedef; }; struct IHaveATemplateTypedef { template<typename T> using MyTemplateTypedef = std::v...
Problem In a similar way that SQL injection allows an attacker to execute arbitrary queries on a database, command-line injection allows someone to run untrusted system commands on a web server. With an improperly secured server this would give an attacker complete control over a system. Let's sa...
Starting the Erlang shell On a UNIX system you start the Erlang shell from a command prompt with the command erl Example: $ erl Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] Eshell V7.0 (abort with ^G) 1> The text that shows when y...
A deadlock is what occurs when two or more threads are waiting for eachother to complete or to release a resource in such a way that they wait forever. If thread1 holds a lock on resource A and is waiting for resource B to be released while thread2 holds resource B and is waiting for resource A to ...
We can change the style of the placeholder by setting attributedPlaceholder (a NSAttributedString). var placeholderAttributes = [String: AnyObject]() placeholderAttributes[NSForegroundColorAttributeName] = color placeholderAttributes[NSFontAttributeName] = font if let placeholder = textField.p...
Starting a File Chooser Activity public void showFileChooser() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); // Update with mime types intent.setType("*/*"); // Update with additional mime types here using a String[]. intent.putExtra(Intent.EXTRA_M...
Create a DATABASE. Note that the shortened word SCHEMA can be used as a synonym. CREATE DATABASE Baseball; -- creates a database named Baseball If the database already exists, Error 1007 is returned. To get around this error, try: CREATE DATABASE IF NOT EXISTS Baseball; Similarly, DROP DATA...
>>> df ID Year Jan_salary Feb_salary Mar_salary 0 1 2016 4500 4200 4700 1 2 2016 3800 3600 4400 2 3 2016 5500 5200 5300 >>> melted_df = pd.melt(df,id_vars=['ID','Year'], v...
Comments are used to explain code when the basic code itself isn't clear. Python ignores comments, and so will not execute code in there, or raise syntax errors for plain english sentences. Single-line comments begin with the hash character (#) and are terminated by the end of line. Single lin...
auto can also cause problems where expression templates come into play: auto mult(int c) { return c * std::valarray<int>{1}; } auto v = mult(3); std::cout << v[0]; // some value that could be, but almost certainly is not, 3. The reason is that operator* on valarray gives yo...
Usually grep prints only matching lines. In the example below seq 9 generates a list of numbers from 1 to 9, one per line, and grep prints a single matching line: seq 9 | grep 5 # 5 The -C n option (or --context=n in long form) prints n lines before and after each matching line, in addition to ...
Notice, that in order to change file prmissions, your device need to be rooted, su binary doesn't come with factory shipped devices! Convention: adb shell su -c "chmod <numeric-permisson> <file>" Numeric permission constructed from user, group and world sections. For exa...
Here is a tested code for image and video.It will work for all APIs less than 19 and greater than 19 as well. Image: if (Build.VERSION.SDK_INT <= 19) { Intent i = new Intent(); i.setType("image/*"); i.setAction...
If you just want to get data, but not modify anything, you can turn off change tracking and proxy creation. This will improve your performance and also prevent lazy loading. Bad Example: using(var context = new Context()) { return await context.Set<MyEntity>().ToListAsync().ConfigureAw...
public class VolleyErrorHelper { /** * Returns appropriate message which is to be displayed to the user * against the specified error object. * * @param error * @param context * @return */ public static String ...
It is perfectly fine to use a package name other than the folder name. If we do so, we still have to import the package based on the directory structure, but after the import we have to refer to it by the name we used in the package clause. For example, if you have a folder $GOPATH/src/mypck, and i...
The Lua standard library provides two iterator functions that can be used with a for loop to traverse key-value pairs within tables. To iterate over a sequence table we can use the library function ipairs. for index, value in ipairs {'a', 'b', 'c', 'd', 'e'} do print(index, value) --> 1 a, ...
add: add the specified files on the next commit addremove: add all new files, delete all missing files backout: reverse effect of earlier changeset commit, ci: commit the specified files or all outstanding changes copy, cp: mark files as copied for the next commit forge...
bookmarks, bookmark: create a new bookmark or list existing bookmarks branch: set or show the current branch name tag: add one or more tags for the current or given revision update, up, checkout, co: update working directory (or switch revisions)

Page 62 of 153