Tutorial by Examples

OpenPyXL is a module for manipulating and creating xlsx/xlsm/xltx/xltm workbooks in memory. Manipulating and reading an existing workbook: import openpyxl as opx #To change an existing wookbook we located it by referencing its path workbook = opx.load_workbook(workbook_path) load_workbook() c...
Cryptography is something very hard and after spending a lot of time reading different examples and seeing how easy it is to introduce some form of vulnerability I found an answer originally written by @jbtule that I think is very good. Enjoy reading: "The general best practice for symmetric e...
do local tab = {1, 2, 3} function closure() for key, value in ipairs(tab) do print(key, "I can still see you") end end closure() --> 1 I can still see you --> 2 I can still see you --> 3 I can still see you end ...
Giving your list a type To create a list you need a type (any class, e.g. String). This is the type of your List. The List will only store objects of the specified type. For example: List<String> strings; Can store "string1", "hello world!", "goodbye", etc, b...
The List API has eight methods for positional access operations: add(T type) add(int index, T type) remove(Object o) remove(int index) get(int index) set(int index, E element) int indexOf(Object o) int lastIndexOf(Object o) So, if we have a List: List<String> strings = new ArrayL...
For the example, lets say that we have a List of type String that contains four elements: "hello, ", "how ", "are ", "you?" The best way to iterate over each element is by using a for-each loop: public void printEachElement(List<String> list){ for...
The implementation of INotifyPropertyChange can be error-prone, as the interface requires specifying property name as a string. In order to make the implementation more robust, an attribute CallerMemberName can be used. class C : INotifyPropertyChanged { // backing field int offset; ...
mysqladmin -u root -p'old-password' password 'new-password'
Useful for scripting to drop all tables and deletes the database: mysqladmin -u[username] -p[password] drop [database] Use with extreme caution. To DROP database as a SQL Script (you will need DROP privilege on that database): DROP DATABASE database_name or DROP SCHEMA database_name
#include <iostream> long double operator"" _km(long double val) { return val * 1000.0; } long double operator"" _mi(long double val) { return val * 1609.344; } int main() { std::cout << "3 km = " << 3.0_km << " m...
Batch execution using java.sql.PreparedStatement allows you to execute a single DML statement with multiple sets of values for its parameters. This example demonstrates how to prepare an insert statement and use it to insert multiple rows in a batch. Connection connection = ...; // obtained earl...
Batch execution using java.sql.Statement allows you to execute multiple DML statements (update, insert, delete) at once. This is achieved by creating a single statement object, adding the statements to execute, and then execute the batch as one. Connection connection = ...; // obtained earlier c...
Compare the definition of Free to that of Fix: data Free f a = Return a | Free (f (Free f a)) newtype Fix f = Fix { unFix :: f (Fix f) } In particular, compare the type of the Free constructor with the type of the Fix constructor. Free layers up a functor just like Fix, except ...
options = { "x": ["a", "b"], "y": [10, 20, 30] } Given a dictionary such as the one shown above, where there is a list representing a set of values to explore for the corresponding key. Suppose you want to explore "x"="a" w...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect x="10" y="10" width="50" height="100" stroke="black" stroke-width="5" fill="none" /> </svg> R...
The width and height attributes designate the dimensions of the rectangle. These values are in pixels by default The fill value sets the color for the rectangle. If no value for fill is specified, black is used by default <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="h...
If you use a dictionary as an iterator (e.g. in a for statement), it traverses the keys of the dictionary. For example: d = {'a': 1, 'b': 2, 'c':3} for key in d: print(key, d[key]) # c 3 # b 2 # a 1 The same is true when used in a comprehension print([key for key in d]) # ['c', 'b', '...
foreach will iterate over any object of a class that implements IEnumerable (take note that IEnumerable<T> inherits from it). Such objects include some built-in ones, but not limit to: List<T>, T[] (arrays of any type), Dictionary<TKey, TSource>, as well as interfaces like IQueryab...
Detailed instructions on launching an EC2 instance.
Throughout this example it is assumed that the 'root' object that is being serialized to JSON is an instance of the following class : public class MyJson { }   Example 1 : An example of an instance of MyJson, as is: {} i.e. since the class has no fields, only curly brackets are serialized...

Page 387 of 1336