Tutorial by Examples: er

This is a simple example to display read-only data that is tabular in nature using Qt's Model/View Framework. Specifically, the Qt Objects QAbstractTableModel (sub-classed in this example) and QTableView are used. Implementations of the methods rowCount(), columnCount(), data() and headerData() are...
With generics, it's possible to return whatever the caller expects: private Map<String, Object> data; public <T> T get(String key) { return (T) data.get(key); } The method will compile with a warning. The code is actually more safe than it looks because the Java runtime will d...
Destructuring allows you to extract data from various objects into distinct variables. In each example below, each variable is assigned to its own string (a="a", b="b", &c.) TypeExampleValue of data / commentvec(let [[a b c] data ...)["a" "b" "c&quot...
Storing Properties in a XML File The way you store properties files as XML files is very similar to the way you would store them as .properties files. Just instead of using the store() you would use storeToXML(). public void saveProperties(String location) throws IOException{ // make new inst...
The Common Language Runtime (CLR) is a virtual machine environment and part of the .NET Framework. It contains: A portable bytecode language called Common Intermediate Language (abbreviated CIL, or IL) A Just-In-Time compiler that generates machine code A tracing garbage collector that provides...
Method references make excellent self-documenting code, and using method references with Streams makes complicated processes simple to read and understand. Consider the following code: public interface Ordered { default int getOrder(){ return 0; } } public interface Valued&lt...
Gradient Boosting for classification. The Gradient Boosting Classifier is an additive ensemble of a base model whose error is corrected in successive iterations (or stages) by the addition of Regression Trees which correct the residuals (the error of the previous stage). Import: from sklearn.ensem...
Given a file file.txt with the following content: line 1 line 2 line 3 You can add a new line using below command sed '/line 2/{x;p;x;}' file.txt The above command will output line 1 line 2 line 3 Explanation: x command is eXchange. sed has a buffer that you can use to store some ...
$ cat ip.txt address range substitution pattern sample Add Sub Mul Div Lines matching a pattern $ sed '/add/d' ip.txt range substitution pattern sample Add Sub Mul Div $ sed -n '/t/p' ip.txt substitution pattern $ sed -n '/[A-Z]/ s| |/|gp' ip.txt Add/Sub/Mul/Div ...
$ cat ip.txt address range substitution pattern sample Add Sub Mul Div Line number to line matching pattern $ sed -n '2,/pat/p' ip.txt range substitution pattern Line matching pattern to line number $ sed '/pat/,$d' ip.txt address range substitution GNU sed ...
AWK often used for manipulating entire files containing a list of strings. Let's say file awk_test_file.txt contains: First String Second String Third String To convert all the strings to lower case execute: awk '{ print tolower($0) }' awk_test_file.txt This will result: first string se...
Converter between boolean and visibility. Get bool value on input and returns Visibility value. NOTE: This converter have already exists in System.Windows.Controls namespace. public sealed class BooleanToVisibilityConverter : IValueConverter { /// <summary> /// Convert bool or Nu...
Show how to create simple converter with parameter via property and then pass it in declaration. Convert bool value to Visibility. Allow invert result value by setting Inverted property to True. public class BooleanToVisibilityConverter : IValueConverter { public bool Inverted { get; set; } ...
Show how to create simple IMultiValueConverter converter and use MultiBinding in xaml. Get summ of all values passed by values array. public class AddConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { ...
Show how to create simple converter and use ConverterParameter to pass parameter to converter. Multiply value by coefficient passed in ConverterParameter. public class MultiplyConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo cult...
package { import flash.events.TimerEvent; import flash.events.TimerEvent; import flash.utils.Timer; public class RandomTimer extends Timer { public var minimumDelay:Number; public var maximumDelay:Number; private var _count:uint = 0; privat...
If you use the paste command from your terminal emulator program, Vim will interpret the stream of characters as if they were typed. That will cause all kind of undesirable effects, particularly bad indendation. To fix that, from command mode: :set paste Then move on to insert mode, with i, for...
$ IFS= read -r foo <<EOF > this is a \n line >EOF $ printf '%s\n' "$foo" this is a \n line
Static variables and methods are not part of an instance, There will always be a single copy of that variable no matter how many objects you create of a particular class. For example you might want to have an immutable list of constants, it would be a good idea to keep it static and initialize it j...
ALTER TABLE table_name MOVE PARTITION partition_name TABLESPACE tablespace_name;

Page 168 of 417