interface Foo {
fun example()
}
class Bar {
fun example() {
println("Hello, world!")
}
}
class Baz(b : Bar) : Foo by b
Baz(Bar()).example()
The example prints Hello, world!
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
email = db.Column(db.String(120), unique=True)
posts = db.relationship('Post', backref='user')
class Post(db.Model):
id = db.Column(db.Integer,...
A typical example of the implementation of a Looper thread given by the official documentation uses Looper.prepare() and Looper.loop() and associates a Handler with the loop between these calls.
class LooperThread extends Thread {
public Handler mHandler;
public void run() {
Lo...
Web Api 2 - Hello World example
We are going to create a new Web Api simple application which return to us Json with message and user name.
Lets start! First create new Web Api project using Visual Studio and select Empty Template. Be sure to check "Web Api" folder:
NOTE I didn't choo...
As we can add multiple elements in Cart array and then add it to cart session, but there are 4 basic elements which Cart class requires to add data successfully in cart session.
id (string)
qty (number)
price (number, decimal)
name (String)
And if you want to add more options regardin...
By using rowid element you can delete an item from cart. you just have to set item's qty to 0
$deleteItem = array(
'rowid' => 'b99ccdf16028f015540f341130b6d8ec',
'qty' => 0
);
$this->cart->update($data);
this will delete item with this rowid.
A simple OGL 4.0 GLSL shader program that shows the use of a model, view, and projection matrix
The program is executed with a phyton script. To run the script, PyOpenGL and NumPy must be installed.
Projection matrix:
The projection matrix describes the mapping of a pinhole camera from 3D poi...
A simple OGL 4.0 GLSL shader program that shows how to map a 2D texture on a mesh.
The program is executed with a phyton script. To run the script, PyOpenGL and NumPy must be installed.
The texture matrix defines how the texture is mapped on the mesh.
By manipulating the texture matrix, the textu...
A simple OGL 4.0 GLSL shader program that shows the use of a interface block and a uniform block on a Cook-Torrance microfacet light model implementation.
The program is executed with a phyton script. To run the script, PyOpenGL and NumPy must be installed.
An Interface Block is a group of GLSL in...
To shelve an object, first import the module and then assign the object value as follows:
import shelve
database = shelve.open(filename.suffix)
object = Object()
database['key'] = object
The simplest way to use shelve is via the DbfilenameShelf class. It uses anydbm to store the data. You can use the class directly, or simply call shelve.open():
import shelve
s = shelve.open('test_shelf.db')
try:
s['key1'] = { 'int': 10, 'float':9.5, 'string':'Sample data' }
finally:
...
The following route has a simple goal :
First, it checks if and ImportDocumentProcess object is present in the database and adds it as an exchange header
Then, it adds an ImportDocumentTraitement (Which is linked to the previous ImportDocumentProcess) in the database
Here is the code of this ...
The processor just contains just contains the methods needed by the route. It is just a classic Java Bean containing several methods. You can also implement Processor and override the process method.
See the code below :
@Component("testExampleProcessor")
public class TestExampleProcess...
Don't forget to add the camel test support and spring camel test
support to your project dependencies. See the following for maven users :
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${camel.version}...
Essence of searching lies in its order. Everyone wants search results to be shown in such a way that best suited results are shown on top. Relational database do not have such capability. Elasticsearch on the other hand shows results on the basis of relevancy by default.
Setup
Same as used in ...