Tutorial by Examples: and

# Like any other ruby code, require gtk3 after installing from "gem install gtk3" require 'gtk3' # Like in Rails, you import working functions from a higher class, in this case the GTK Window class RubyApp < Gtk::Window # Calling the original method from GTK Window and redefinin...
BufferedImage cat = ImageIO.read(new File("cat.jpg")); //read existing file //modify it Graphics g = cat.createGraphics(); g.setColor(Color.RED); g.drawString("Cat", 10, 10); g.dispose(); //now create a new image BufferedImage cats = new BufferedImage(256, 256, Buffere...
Java applets are able to load different resources. But since they are running in the web browser of the client you need to make sure that these resources are accessible. Applets are not able to access client resources as the local file system. If you want to load resources from the same URL the App...
Common Lisp does not have interfaces in the sense that some languages (e.g., Java) do, and there is less need for that type of interface given that Common Lisp supports multiple inheritance and generic functions. However, the same type of patterns can be realized easily using mixin classes. This e...
Let's say we have a table team_person as below: +======+===========+ | team | person | +======+===========+ | A | John | +------+-----------+ | B | Smith | +------+-----------+ | A | Walter | +------+-----------+ | A | Louis | +------+-----------+ | C | ...
To install the software: After the download completes, run the installer. For Windows, the installer executable file has the .exe extension. Double-click the installer file to run it. For Linux platforms, the installer file has the .sh extension. For these platforms, you need to make ...
The ROLLUP operator is useful in generating reports that contain subtotals and totals. CUBE generates a result set that shows aggregates for all combinations of values in the selected columns. ROLLUP generates a result set that shows aggregates for a hierarchy of values in the selected col...
First Initialize FirebaseDatabase: FirebaseDatabase database = FirebaseDatabase.getInstance(); Write to your database: // Write a message to the database FirebaseDatabase database = FirebaseDatabase.getInstance(); DatabaseReference myRef = database.getReference("message"); myRef....
Plenty has been written about Python's GIL. It can sometimes cause confusion when dealing with multi-threaded (not to be confused with multiprocess) applications. Here's an example: import math from threading import Thread def calc_fact(num): math.factorial(num) num = 600000 t = Threa...
In most object oriented languages, allocating memory for an object and initializing it is an atomic operation: // Both allocates memory and calls the constructor MyClass object = new MyClass(); In Objective-C, these are separate operations. The class methods alloc (and its historic sibling allo...
Data frames are R's tabular data structure. They can be written to or read from in a variety of ways. This example illustrates a couple common situations. See the links at the end for other resources. Writing Before making the example data below, make sure you're in a folder you want to write to....
To install React Router, just run the npm command npm install --save react-router And you're done. This is literally all you have to do to install react router. Please Note : react-router is dependent on react, So make sure you install react as well. To set up: using an ES6 transpiler, like bab...
There are many reasons a write operation may fail. A frequent one is because your security rules reject the operation, for example because you're not authenticated (by default a database can only be accessed by an authenticated user). You can see these security rule violations in the logcat output....
We're using a toplevel guard in our route config to catch the current user on first page load, and a resolver to store the value of the currentUser, which is our authenticated user from the backend. A simplified version of our implementation looks as follows: Here is our top level route: export c...
void main() { var cat = new Cat(); print("Is cat hungry? ${cat.isHungry}"); // Is cat hungry? true print("Is cat cuddly? ${cat.isCuddly}"); // Is cat cuddly? false print("Feed cat."); cat.isHungry = false; print("Is cat ...
Julia supports a very large set of comparison operators. These include All of the following unicode sequences: > < >= ≥ <= ≤ == === ≡ != ≠ !== ≢ ∈ ∉ ∋ ∌ ⊆ ⊈ ⊂ ⊄ ⊊ ∝ ∊ ∍ ∥ ∦ ∷ ∺ ∻ ∽ ∾ ≁ ≃ ≄ ≅ ≆ ≇ ≈ ≉ ≊ ≋ ≌ ≍ ≎ ≐ ≑ ≒ ≓ ≔ ≕ ≖ ≗ ≘ ≙ ≚ ≛ ≜ ≝ ≞ ≟ ≣ ≦ ≧ ≨ ≩ ≪ ≫ ≬ ≭ ≮ ≯ ≰ ≱ ≲ ≳ ≴ ≵ ≶ ≷ ≸ ≹ ≺ ...
% set mypath /home/tcluser/sources/tcl/myproject/test.tcl /home/tcluser/sources/tcl/myproject/test.tcl % set dir [file dirname $mypath] /home/tcluser/sources/tcl/myproject % set filename [file tail $mypath] test.tcl % set basefilename [file rootname $filename] test % set extension [file exte...
Immediately continue reading on invalid input or break on user request or end-of-file: #include <stdlib.h> /* for EXIT_xxx macros */ #include <stdio.h> /* for printf() and getchar() */ #include <ctype.h> /* for isdigit() */ void flush_input_stream(FILE * fp); int main(v...
Sometimes, programmers who are new to Java make the mistake of defining a class with a name that is the same as a widely used class. For example: package com.example; /** * My string utilities */ public class String { .... } Then they wonder why they get unexpected errors. For ex...
This function return the standart gravity constant in the specified acceleration units (1 for cm/s², 2 for ft/s², 3 for m/s²) /** * Returns the standard gravity constant in the specified acceleration units * Values taken from https://en.wikipedia.org/wiki/Standard_gravity on July 24, 2016. ...

Page 87 of 153