Tutorial by Examples

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(...
A query can be boosted to increase it's score relative to other subqueries. This is done by wrapping it with a BoostQuery Query lessRelevantQuery = new TermQuery(new Term("fieldname", "ipsum")); //Five times as interesting Query highlyRelevantQuery = new BoostQuery( ...
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...
Colored text can be created by passing the text and a font color name to the following function: private String getColoredSpanned(String text, String color) { String input = "<font color=" + color + ">" + text + "</font>"; return input; } The ...
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.
Defining the base class: open class BaseClass { val x = 10 } Defining the derived class: class DerivedClass: BaseClass() { fun foo() { println("x is equal to " + x) } } Using the subclass: fun main(args: Array<String>) { val derivedClass = Deri...
Defining the base class: open class Person { fun jump() { println("Jumping...") } } Defining the derived class: class Ninja: Person() { fun sneak() { println("Sneaking around...") } } The Ninja has access to all of the methods in Pe...
Detailed instructions on getting titanium set up or installed.
Prepare First create a "message.properties" file in Resources/Files/. Example: ############## # Test message.properties ############## label.age=Enter your age: validate.error.reqired.age=Sorry, but you have to give away the secret of your age ... Next, connect the resource with y...
Detailed instructions on getting cdi set up or installed.

Page 784 of 1336