Tutorial by Examples: ed

The following queries will return a list of all Stored Procedures in the database, with basic information about each Stored Procedure: SQL Server 2005 SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' The ROUTINE_NAME, ROUTINE_SCHEMA and ROUTINE_DEFINITION columns are...
While object property notation is usually written as myObject.property, this will only allow characters that are normally found in JavaScript variable names, which is mainly letters, numbers and underscore (_). If you need special characters, such as space, ☺, or user-provided content, this is poss...
At first glance it may appear that null and undefined are basically the same, however there are subtle but important differences. undefined is the absence of a value in the compiler, because where it should be a value, there hasn't been put one, like the case of an unassigned variable. undefined...
// Java: String joined = things.stream() .map(Object::toString) .collect(Collectors.joining(", ")); // Kotlin: val joined = things.joinToString() // ", " is used as separator, by default
// Java: Stream.of(1.0, 2.0, 3.0) .mapToInt(Double::intValue) .mapToObj(i -> "a" + i) .forEach(System.out::println); // a1 // a2 // a3 // Kotlin: sequenceOf(1.0, 2.0, 3.0).map(Double::toInt).map { "a$it" }.forEach(::println)
// Java: long count = items.stream().filter( item -> item.startsWith("t")).count(); // Kotlin: val count = items.filter { it.startsWith('t') }.size // but better to not filter, but count with a predicate val count = items.count { it.startsWith('t') }
// Java: String phrase = persons .stream() .filter(p -> p.age >= 18) .map(p -> p.name) .collect(Collectors.joining(" and ", "In Germany ", " are of legal age.")); System.out.println(phrase); // In Germany Max and Peter a...
You can pass data to a template in a custom variable. In your views.py: from django.views.generic import TemplateView from MyProject.myapp.models import Item class ItemView(TemplateView): template_name = "item.html" def items(self): """ Get all Ite...
FROM node:5 The FROM directive specifies an image to start from. Any valid image reference may be used. WORKDIR /usr/src/app The WORKDIR directive sets the current working directory inside the container, equivalent to running cd inside the container. (Note: RUN cd will not change the current ...
You can embed another template body into your template via {{template "mysharedtemplate" .}} to reuse shared components. Here is an example that creates a header template that can be reused at the top of all other template bodies. It also uses CSS to stylize the output so that it is easier...
This uses the Dropbox Java SDK to create a shared link for a file at the Dropbox path /test.txt: try { SharedLinkMetadata sharedLinkMetadata = client.sharing().createSharedLinkWithSettings("/test.txt"); System.out.println(sharedLinkMetadata.getUrl()); } catch (CreateSharedLinkW...
This example uses the Dropbox .NET library to get a shared link for a file, either by creating a new one, or retrieving an existing one: SharedLinkMetadata sharedLinkMetadata; try { sharedLinkMetadata = await this.client.Sharing.CreateSharedLinkWithSettingsAsync (path); } catch (ApiException...
Git lets you use non-git commands and full sh shell syntax in your aliases if you prefix them with !. In your ~/.gitconfig file: [alias] temp = !git add -A && git commit -m "Temp" The fact that full shell syntax is available in these prefixed aliases also means you can us...
In case you have accidentally commited a delete on a file and later realized that you need it back. First find the commit id of the commit that deleted your file. git log --diff-filter=D --summary Will give you a sorted summary of commits which deleted files. Then proceed to restore the file b...
To recover a deleted branch you need to find the commit which was the head of your deleted branch by running git reflog You can then recreate the branch by running git checkout -b <branch-name> <sha1-of-commit> You will not be able to recover deleted branches if git's garbage col...
CardView is a member of the Android Support Library, and provides a layout for cards. To add CardView to your project, add the following line to your build.gradle dependencies. compile 'com.android.support:cardview-v7:25.1.1' A number of the latest version may be found here In your layout you ...
string s = "Foo"; string paddedLeft = s.PadLeft(5); // paddedLeft = " Foo" (pads with spaces by default) string paddedRight = s.PadRight(6, '+'); // paddedRight = "Foo+++" string noPadded = s.PadLeft(2); // noPadded = "Foo" (original string...
5.1 The reduce() method applies a function against an accumulator and each value of the array (from left-to-right) to reduce it to a single value. Array Sum This method can be used to condense all values of an array into a single value: [1, 2, 3, 4].reduce(function(a, b) { return a + b; }); ...
Some regular expression flavors allow named capture groups. Instead of by a numerical index you can refer to these groups by name in subsequent code, i.e. in backreferences, in the replace pattern as well as in the following lines of the program. Numerical indexes change as the number or arrangemen...
It’s a good practice to declare the primary language of the document in the html element: <html lang="en"> If no other lang attribute is specified in the document, it means that everything (i.e., element content and attribute text values) is in that language. If the document con...

Page 10 of 145