Tutorial by Examples: am

The most effective way to resolve curl to a different server is to use the --resolve option. This option will insert the address into curl's DNS cache, so it will effectively make curl believe that's the address it got when it resolved the name. Like so: curl --resolve eaxmple.com:80:1.2.3.4 http:...
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!
General-purpose stopwatch for timing how long a function takes to run: object Benchmark { fun realtime(body: () -> Unit): Duration { val start = Instant.now() try { body() } finally { val end = Instant.now() return Duration.b...
Installation pip install Flask-SQLAlchemy Simple Model 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) The code example above shows a simple Flask-SQLAlchemy model, we can add an ...
ChromeDriverManager.getInstance().setup(); FirefoxDriverManager.getInstance().setup(); OperaDriverManager.getInstance().setup(); PhantomJsDriverManager.getInstance().setup(); EdgeDriverManager.getInstance().setup(); InternetExplorerDriverManager.getInstance().setup();
Java StringWriter class is a character stream that collects output from string buffer, which can be used to construct a string. The StringWriter class extends the Writer class. In StringWriter class, system resources like network sockets and files are not used, therefore closing the StringWriter i...
It was most frequent question that can a same thread can be run twice. The answer for this is know one thread can run only once . if you try to run the same thread twice it will execute for the first time but will give error for second time and the error will be IllegalThreadStateException . exam...
package com.streams; import java.io.*; public class DataStreamDemo { public static void main(String[] args) throws IOException { InputStream input = new FileInputStream("D:\\datastreamdemo.txt"); DataInputStream inst = new DataInputStream(input); int count...
Locate and open your TIBCO BW bwengine.tra file typlically under TIBCO_HOME/bw/5.12/bin/bwengine.tra (Linux environment) Look for the line that states: *** Common variables. Modify these only. *** Add the following line right after that section tibco.deployment=%tibco.deployment% ...
A simple OGL 4.0 GLSL shader program with vertex position and color attribute. The program is executed with a phyton script. To run the script, PyOpenGL must be installed. A shader program consists at least of a vertex shader and a fragmant shader (exception of computer shaders). The 1st shader s...
<nav aria-label="Page navigation example"> <ul class="pagination"> <li class="page-item"><a class="page-link" href="#">Previous</a></li> <li class="page-item"><a class="page-lin...
import networkx as nx # importing networkx package import matplotlib.pyplot as plt # importing matplotlib package and pyplot is for displaying the graph on canvas b=nx.Graph() b.add_node('helloworld') b.add_node(1) b.add_node(2) '''Node can be called by any python-hashable obj like string,nu...
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...
Sub Array_clarity() Dim arr() As Variant 'creates an empty array Dim x As Long Dim y As Long x = Range("A1", Range("A1").End(xlDown)).Cells.Count y = Range("A1", Range("A1").End(xlToRight)).Cells.Count ReDim arr(0 To x, 0 To y) 'fixing the size of...
This widget is used to display items with hierarchy. For instance, windows explorer can be reproduced in this way. Some nice tables can be also done using treeview widget. Create the widget tree=ttk.Treeview(master) Definition of the columns You can define how many columns, their width and min...
import asyncio async def hello_world(): print('Hello World') loop = asyncio.get_event_loop() loop.run_until_complete(hello_world()) loop.close()
It's often convenient to separate the SQL query from the actual values. This can be done using placeholders. Qt supports two placeholder syntaxes: named binding and positional binding. named binding: QSqlQuery query; query.prepare("INSERT INTO employee (id, name, salary) VALUES (:id, :name,...
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 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...

Page 124 of 129