Tutorial by Examples: a

By utilizing the pre_save we can determine if a save action on our database was about updating an existing object or creating a new one. In order to achieve this you can check the state of the model object: @receiver(pre_save, sender=User) def pre_save_user(sender, instance, **kwargs): ...
Download the .jar file from vaadin add-ons And put it in the lib folder of WEB-INF then right click on the .jar file and click on to Build Path --> Add To Build Path
public class QuickSort { private static int Partition(int[] input, int low, int high) { var pivot = input[high]; var i = low - 1; for (var j = low; j <= high - 1; j++) { if (input[j] <= pivot) { i++; ...
Objective-C Add the delegate and a text-formatter to the ViewController.h file @interface ViewController : UIViewController <UIPrintInteractionControllerDelegate> { UISimpleTextPrintFormatter *_textFormatter; } In the ViewController.m file define the following constants #define Def...
In C, all arguments are passed to functions by value, including structs. For small structs, this is a good thing as it means there is no overhead from accessing the data through a pointer. However, it also makes it very easy to accidentally pass a huge struct resulting in poor performance, particula...
Installing Vua Redux from NPM: Install through: npm i vua-redux --save Initialize: =============== // main.js import Vue from 'vue'; import { reduxStorePlugin } from 'vua-redux'; import AppStore from './AppStore'; import App from './Component/App'; // install vua-redux Vue.use(redux...
An example of a constraint as expressed in the C standard is having two variables of the same name declared in a scope1), for example: void foo(int bar) { int var; double var; } This code breaches the constraint and must produce a diagnostic message at compile time. This is very usef...
The unary + and - operators are only usable on arithmetic types, therefore if for example one tries to use them on a struct the program will produce a diagnostic eg: struct foo { bool bar; }; void baz(void) { struct foo testStruct; -testStruct; /* This breaks the constraint so mu...
// initialize library $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'Username', 'required|max_length[20]'); // Add validation rules for require and max $this->form_validation->set_rules('password', 'Password', 'required|matches[passw...
Different countries have different number formats and considering this we can have different formats using Locale of java. Using locale can help in formatting Locale locale = new Locale("en", "IN"); NumberFormat numberFormat = NumberFormat.getInstance(locale); using above fo...
We have a DataListComponent that shows a data we pull from a service. DataListComponent also has a PagerComponent as it's child. PagerComponent creates page number list based on total number of pages it gets from the DataListComponent. PagerComponent also lets the DataListComponent know when user c...
Detailed instructions on getting microcontroller set up or installed.
Consider this example: private void button1_Click(object sender, EventArgs e) { label1.Text = RunTooLong(); } This method will freeze UI application until the RunTooLong will be completed. The application will be unresponsive. You can try run inner code asynchronously: private void butt...
The members of a union share the same space in memory. This means that writing to one member overwrites the data in all other members and that reading from one member results in the same data as reading from all other members. However, because union members can have differing types and sizes, the da...
Install Anaconda(PyQt5 is build-in), especially for windows user. Integrate QtDesigner and QtUIConvert in PyCharm(External Tools) Open PyCharm Settings > Tools > External Tools Create Tool(QtDesigner) - used to edit *.ui files Create Tool(PyUIConv) - used to convert *.ui to *.py ...
Carthage Setup Download the latest version of Carthage from the given link Download Link Down in the Download section download the Carthage.pkg file. Once the download is complete install it by double clinking on the download pkg file. To check for successful download run the following command i...
DECLARE @ID AS INT; SET @ID = (SELECT MIN(ID) from TABLE); WHILE @ID IS NOT NULL BEGIN PRINT @ID; SET @ID = (SELECT MIN(ID) FROM TABLE WHERE ID > @ID); END
RwLocks allow a single producer provide any number of readers with data while preventing readers from seeing invalid or inconsistent data. The following example uses RwLock to show how a single producer thread can periodically increase a value while two consumers threads are reading the value. use...
Customizing error messages The /resources/lang/[lang]/validation.php files contain the error messages to be used by the validator. You can edit them as needed. Most of them have placeholders which will be automatically replaced when generating the error message. For example, in 'required' => '...
Catalan numbers algorithm is Dynamic Programming algorithm. In combinatorial mathematics, the Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects. The Catalan numbers on nonnegative integers n are a set of numbers t...

Page 803 of 1099