Tutorial by Examples: a

If you have created service account and have private key json file for it, you can use this file to authenticate with pandas In [5]: pd.read_gbq('''SELECT corpus, sum(word_count) words FROM [bigquery-public-data:samples.shakespeare] GROUP BY co...
This example demonstrates how to do compile time checking of an annotated element. The annotation The @Setter annotation is a marker can be applied to methods. The annotation will be discarded during compilation not be available afterwards. package annotation; import java.lang.annotation.Eleme...
import java.time.LocalTime; import java.time.ZoneId; import java.time.temporal.ChronoUnit; public class Test { public static void main(String[] args) { ZoneId zone1 = ZoneId.of("Europe/Berlin"); ZoneId zone2 = ZoneId.of("Brazil/East"); ...
When a module is using at expressions, such as: #lang at-exp racket/base or #lang scribble/manual You have access to the following types of comments: @;{Block text that goes until the closing brace.} As well as: @; Single line text. Note that if you are using a language that ...
The @lru_cache decorator can be used wrap an expensive, computationally-intensive function with a Least Recently Used cache. This allows function calls to be memoized, so that future calls with the same parameters can return instantly instead of having to be recomputed. @lru_cache(maxsize=None) # ...
The trick is to use a look-behind with the regex \G, which means "end of previous match": String[] parts = str.split("(?<=\\G.{8})"); The regex matches 8 characters after the end of the last match. Since in this case the match is zero-width, we could more simply say "...
Same as the known length example, but insert the length into regex: int length = 5; String[] parts = str.split("(?<=\\G.{" + length + "})");
BooleanQuery is used to combine other queries. They can be combined using three BooleanClause.Occur parameters: BooleanClause.Occur.MUST - The subquery must be matched. BooleanClause.Occur.SHOULD - The subquery may not be matched, but will be scored more highly if it is. If there are no MUST...
PhraseQuery is used to search for a sequence of terms. The following matches the phrase "Hello World" (after being indexed with StandardAnalyzer) Query query = new PhraseQuery.Builder() .add(new Term("text", "hello")) .add(new Term("text"...
This combines queries such that the best (that is, highest-scoring) match of it's subqueries contributes to the final score. List<Query> disjuncts = new ArrayList<Query>(); disjuncts.add(new TermQuery(new Term("fieldname", "hello"))); disjuncts.add(new TermQuery(...
The authentic Adobe PostScript interpreters are available in high-end printers, the Display PostScript (DPS) product, and the Acrobat Distiller product. As authors of the standard, these products are considered "the standard implementation" for the purpose of describing differences among P...
There different flavors of DB2. One of them is LUW: Linux, UNIX and Windows. DB2 LUW in Linux / UNIX can be installed with or without root. When installed with root, you can create different instances associating them to different users. When installing DB2 LUW without root privileges, you can ins...
For those of us using Maven as a build system, we can use the Maven Archetype to create a new application. First consult the maven archetype catalog mvn archetype:generate -DarchetypeCatalog=http://struts.apache.org/ you can use one of the following achetypes: The Blank Convention Archetype (s...
Always encode from unicode to bytes. In this direction, you get to choose the encoding. >>> u'🐍'.encode('utf-8') '\xf0\x9f\x90\x8d' The other way is to decode from bytes to unicode. In this direction, you have to know what the encoding is. >>> b'\xf0\x9f\x90\x8d'.decode('...
When a table has an AUTO_INCREMENT PRIMARY KEY, normally one does not insert into that column. Instead, specify all the other columns, then ask what the new id was. CREATE TABLE t ( id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, this ..., that ..., PRIMARY KEY(id) ); INSERT I...
To access MySQL from the command line: mysql --user=username --password=pwd --host=hostname test_db This can be shortened to: mysql -u username -p password -h hostname test_db By omitting the password value MySQL will ask for any required password as the first input. If you specify password ...
This set of example show how to execute commands stored in strings or script files, without the need of the interactive prompt. This is especially useful to when a shell script needs to interact with a database. Execute command from a string $ mysql -uroot -proot test -e'select * from people' +...
Suppose you have a DataFrame of numerical values, for example: df = pd.DataFrame(np.random.randn(1000, 3), columns=['a', 'b', 'c']) Then >>> df.corr() a b c a 1.000000 0.018602 0.038098 b 0.018602 1.000000 -0.014245 c 0.038098 -0.014245 1.000000...
Detailed instructions on getting lxml set up or installed.
In Kotlin, classes are final by default which means they cannot be inherited from. To allow inheritance on a class, use the open keyword. open class Thing { // I can now be extended! } Note: abstract classes, sealed classes and interfaces will be open by default.

Page 638 of 1099