Tutorial by Examples: ect

Here the steps required to create a Firebase project and to connect it with an Android app. Add Firebase to your app Create a Firebase project in the Firebase console and click Create New Project. Click Add Firebase to your Android app and follow the setup steps. When prompted, enter...
For creating your first project in Phoenix framework at this point you should have, Elixir, Erlang, Hex, and the Phoenix archive installed. You should also have PostgreSQL and node.js installed to build a default application. Open terminal or command prompt and go to location on your file system wh...
To detect multiple features at once, use the and operator. @supports (transform: translateZ(1px)) and (transform-style: preserve-3d) and (perspective: 1px) { /* Probably do some fancy 3d stuff here */ } There is also an or operator and a not operator: @supports (display: flex) or (display...
If you have a "child table" formatted as JSON collection and stored in-row as JSON column, you can unpack this collection, transform it to table and join it with parent row. Instead of the standard JOIN operator, you should use CROSS APPLY. In this example, product parts are formatted as ...
OPENJSON can extract fragments of JSON objects inside the JSON text. In the column definition that references JSON sub-object set the type nvarchar(max) and AS JSON option: declare @json nvarchar(4000) = N'[ {"Number":"SO43659","Date":"2011-05-31T00:00:00"...
When you are in a controllerAction And have a POST request coming in, but want to redirect it, to a different route, while still maintaining the POST method and the request object, you can use the following: return $this->redirectToRoute('route', array( 'request' => $request, ), 307); ...
When performance is a concern, invoking a method via reflection (i.e. via the MethodInfo.Invoke method) is not ideal. However, it is relatively straightforward to obtain a more performant strongly-typed delegate using the Delegate.CreateDelegate function. The performance penalty for using reflecti...
Sometimes auto may behave not quite as was expected by a programmer. It type deduces the expression, even when type deduction is not the right thing to do. As an example, when proxy objects are used in the code: std::vector<bool> flags{true, true, false}; auto flag = flags[0]; flags.push_...
A _ character in a LIKE clause pattern matches a single character. Query SELECT username FROM users WHERE users LIKE 'admin_'; Result +----------+ | username | +----------+ | admin1 | | admin2 | | admin- | | adminA | +----------+
The fact that the garbage collection will clean up does not mean that you should wait for the garbage collection cycle to clean up. In particular you should not wait for garbage collection to close file handles, database connections and open network connections. for example: In the following code...
Query SELECT st.name, st.percentage, CASE WHEN st.percentage >= 35 THEN 'Pass' ELSE 'Fail' END AS `Remark` FROM student AS st ; Result +--------------------------------+ | name | percentage | Remark | +--------------------------------+ | Isha | 67 | Pas...
By default Python's recursion stack cannot exceed 1000 frames. This can be changed by setting the sys.setrecursionlimit(15000) which is faster however, this method consumes more memory. Instead, we can also solve the Tail Recursion problem using stack introspection. #!/usr/bin/env python2.4 # This...
The New-Object cmdlet is used to create an object. # Create a DateTime object and stores the object in variable "$var" $var = New-Object System.DateTime # calling constructor with parameters $sr = New-Object System.IO.StreamReader -ArgumentList "file path" In many instan...
git config --global help.autocorrect 17 This enables autocorrect in git and will forgive you for your minor mistakes (e.g. git stats instead of git status). The parameter you supply to help.autocorrect determines how long the system should wait, in tenths of a second, before automatically applyin...
When creating the project You should check "Include Unit Tests" in the project creation dialog. After creating the project If you missed checking that item while creating your project, you could always add test files later. To do so: 1- Go to your project settings in Xcode 2- Go to ...
Configuring the connection programmatically: var config = new ClientConfiguration { Servers = new List<Uri> { new Uri("http://localhost:8091/pools") }, BucketConfigs = new Dictionary<string, BucketConfiguration> ...
Using a file Swift let data = NSData(contentsOfFile: filePath) //assuming filePath is a valid path Objective-C NSData *data = [NSData dataWithContentsOfFile:filePath]; //assuming filePath is a valid path Using a String object Swift let data = (string as NSString).dataUsingEncoding(NSUTF8S...
This class is called Greeter. Its responsibility is to output a greeting. It has two dependencies. It needs something that will give it the greeting to output, and then it needs a way to output that greeting. Those dependencies are both described as interfaces, IGreetingProvider and IGreetingWriter....
This builds on the previous example of the Greeter class which has two dependencies, IGreetingProvider and IGreetingWriter. The actual implementation of IGreetingProvider might retrieve a string from an API call or a database. The implementation of IGreetingWriter might display the greeting in the ...
Dependency injection means writing classes so that they do not control their dependencies - instead, their dependencies are provided to them ("injected.") This is not the same thing as using a dependency injection framework (often called a "DI container", "IoC container&quo...

Page 52 of 99