Tutorial by Examples

In DRF, serializer validation is run in a specific, undocumented order Field deserialization called (serializer.to_internal_value and field.run_validators) serializer.validate_[field] is called for each field. Serializer-level validators are called (serializer.run_validation followed by seriali...
Detailed instructions on getting kdb set up or installed.
It is possible to DELETE data from a table if it matches (or mismatches) certain data in other tables. Let's assume we want to DELETEdata from Source once its loaded into Target. DELETE FROM Source WHERE EXISTS ( SELECT 1 -- specific value in SELECT doesn't matter FROM Target ...
6 class Item { constructor(text, type) { this.text = text; this.emphasis = false; this.type = type; } toHtml() { return `<${this.type}>${this.emphasis ? '<em>' : ''}${this.text}${this.emphasis ? '</em>' : ''}</${this.type}...
In this example we will extract all the web links from a website. I am using http://stackoverflow.com/ for illustration. Here recursion is used, where each obtained link's page is parsed for presence of an anchor tag and that link is again submitted to the same function. The condition if(add &&...
This example shows how to create a pyramid using borders and 2D transformation methods skewY() and rotate() on pseudo elements. HTML: <div class="pyramid"></div> CSS: .pyramid { width: 100px; height: 200px; position: relative; margin: 50px; } .pyramid::b...
The NSInteger is just a typedef for either an int or a long depending on the architecture. The same goes for a NSUInteger which is a typedef for the unsigned variants. If you check the NSInteger you will see the following: #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_...
from multiprocessing import Pool def cube(x): return x ** 3 if __name__ == "__main__": pool = Pool(5) result = pool.map(cube, [0, 1, 2, 3]) Pool is a class which manages multiple Workers (processes) behind the scenes and lets you, the programmer, use. Pool(5) creat...
SCSS syntax resembles more like a CSS syntax but SASS syntax is little bit different from SCSS but both produces exactly the same CSS code. In SASS we are not ending the style properties with semicolon(;) but in SCSS we are ending the style properties with (;). In SCSS we used paranthesis {} to ...
Option Explicit Sub CheckWorksheetsDiagram() Debug.Print Worksheets(1).Name Debug.Print Charts(1).Name Debug.Print Sheets(1).Name End Sub The result: Sheet1 Chart1 Chart1
By default the state of a promise is pending when it is created. The state of a promise is changed when the deferred object which created the promise either resolves/rejects it. var deferred = new $.Deferred(); var d1= deferred.promise({ prop: "value" }); var d2= $("div"...
public class Foobar { public static void main(String[] args) { // example: Boolean ignore = null; if (ignore == false) { System.out.println("Do not ignore!"); } } } The pitfall here is that null is compared to false. Since w...
Here is an example of custom UITextField that takes only numerical text and discards all other. NOTE: For iPhone it is easy to do this using Number type keyboard, but for iPad there is no keyboard with Numbers only class NumberTextField: UITextField { required init(coder aDecoder: NSCoder) ...
Pre-requisites AEM Installed on your server. Copy the path of the install (e.g: /mnt/crx) Start AEM (e.g java -jar cq-quickstart-author-p4502.jar) once. This will generate all the necessary folders, especially /mnt/crx/crx-quickstart/bin that is required by the scripts. Create a user who will h...
If we want to disable all the actions like Copy, Paste, Replace, Select, etc from UITextField then we can use following custom text field: class CustomTextField: UITextField { var enableLongPressActions = false required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder)! } o...
Function xyz returns two values a and b: def xyz(): return a, b Code calling xyz stores result into one variable assuming xyz returns only one value: t = xyz() Value of t is actually a tuple (a, b) so any action on t assuming it is not a tuple may fail deep in the code with a an unexpecte...
%TYPE: Used to declare a field with the same type as that of a specified table's column. DECLARE vEmployeeName Employee.Name%TYPE; BEGIN SELECT Name INTO vEmployeeName FROM Employee WHERE RowNum = 1; DBMS_OUTPUT.PUT_LINE(vEmp...
In this example we are going to create a view. A view is mostly used as a simple way of fetching data from multiple tables. Example 1: View with a select on one table. CREATE OR REPLACE VIEW LessonView AS SELECT L.* FROM Lesson L; Example 2: View with a select o...
Below we are going to create a table with 3 columns. The column Id must be filled is, so we define it NOT NULL. On the column Contract we also add a check so that the only value allowed is 'Y' or 'N'. If an insert in done and this column is not specified during the insert then default a 'N' is i...
iOS apps needs to be written in a way to provide security to data which is being transported over network. SSL is the common way to do it. Whenever app tries to call web services to pull or push data to servers, it should use SSL over HTTP, i.e. HTTPS. To do this, app must call https://server.com...

Page 1253 of 1336