Tutorial by Examples: api

Double Quotes inside verbatim strings can be escaped by using 2 sequential double quotes "" to represent one double quote " in the resulting string. var str = @"""I don't think so,"" he said."; Console.WriteLine(str); Output: "I don't think s...
Apostrophes char apostrophe = '\''; Backslash char oneBackslash = '\\';
Backslash // The filename will be c:\myfile.txt in both cases string filename = "c:\\myfile.txt"; string filename = @"c:\myfile.txt"; The second example uses a verbatim string literal, which doesn't treat the backslash as an escape character. Quotes string text = "\&...
using System.Linq.Expressions; // Manually build the expression tree for // the lambda expression num => num < 5. ParameterExpression numParam = Expression.Parameter(typeof(int), "num"); ConstantExpression five = Expression.Constant(5, typeof(int)); BinaryExpression numLessTh...
DOM stands for Document Object Model. It is an object-oriented representation of structured documents like XML and HTML. Setting the textContent property of an Element is one way to output text on a web page. For example, consider the following HTML tag: <p id="paragraph"></p&g...
Python's string type provides many functions that act on the capitalization of a string. These include : str.casefold str.upper str.lower str.capitalize str.title str.swapcase With unicode strings (the default in Python 3), these operations are not 1:1 mappings or reversible. Most of thes...
Abbreviated from https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/: Step 1: Begin authorization Send the user to this web page, with your values filled in: https://www.dropbox.com/oauth2/authorize?client_id=<app key>&response_type=code&redirect_uri=<...
This downloads just a piece of a file, using Range Retrieval Requests, from the Dropbox API at the remote path /Homework/math/Prime_Numbers.txt to the local path Prime_Numbers.txt.partial in the current folder: curl -X GET https://content.dropboxapi.com/2/files/download \ --header "Auth...
We can make an AJAX request to Stack Exchange's API to retrieve a list of the top JavaScript questions for the month, then present them as a list of links. If the request fails or the returns an API error, our promise error handling displays the error instead. 6 View live results on HyperWeb. c...
If you need to use the ^ character in a character class (Character classes ), either put it somewhere other than the beginning of the class: [12^3] Or escape the ^ using a backslash \: [\^123] If you want to match the caret character itself outside a character class, you need to escape it: ...
Streams provide the most direct access to the binary content, so any InputStream / OutputStream implementations always operate on ints and bytes. // Read a single byte from the stream int b = inputStream.read(); if (b >= 0) { // A negative value represents the end of the stream, normal values ...
To authenticate to Watson services, you need credentials for each service that you plan to use. Depending on the service, you will need to pass a username and password with Basic Authentication, or you will need to pass an API key in a parameter for each request you make. How to get credentials for...
Special characters (like the character class brackets [ and ] below) are not matched literally: match = re.search(r'[b]', 'a[b]c') match.group() # Out: 'b' By escaping the special characters, they can be matched literally: match = re.search(r'\[b\]', 'a[b]c') match.group() # Out: '[b]' T...
var httpClient = new HttpClient(); // Create a block the accepts a uri and returns its contents as a string var downloaderBlock = new TransformBlock<string, string>( async uri => await httpClient.GetStringAsync(uri)); // Create a block that accepts the content and prints it to t...
It is possible to treat a GoogleMap as an Android view if we make use of the provided MapView class. Its usage is very similar to MapFragment. In your layout use MapView as follows: <com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" ...
If your string is enclosed (i.e.) in single quotes you need to escape the inner literal quote with backslash \ var text = 'L\'albero means tree in Italian'; console.log( text ); \\ "L'albero means tree in Italian" Same goes for double quotes: var text = "I feel \"high\&quot...
It can also be installed by downloading the source code and placing it in a directory of your project. However there are many benefits to using composer. require '/path/to/lib/Twig/Autoloader.php'; Twig_Autoloader::register(); $loader = new Twig_Loader_Filesystem('/path/to/templates'); $opti...
In many cases, the Razor parser is smart enough to figure out when the @ sign is meant to be used as part of code, as opposed to being part of something like an email address. In the example below, escaping the @ sign is not necessary: <p>Reach out to us at [email protected]</p> Howev...
A one-liner that helps granting or revoking vulnerable permissions. granting adb shell pm grant <sample.package.id> android.permission.<PERMISSION_NAME> revoking adb shell pm revoke <sample.package.id> android.permission.<PERMISSION_NAME> Granting all run...
jQuery offers a variety of methods that can be used for DOM manipulation. The first is the .empty() method. Imagine the following markup: <div id="content"> <div>Some text</div> </div> By calling $('#content').empty();, the inner div would be removed. This...

Page 1 of 12