Tutorial by Examples: e

Attribute values can appear in simple or double quotes. The appropriate character must be escaped. <?xml version="1.0"?> <document quot-attribute="This is a "double quote" and this one is 'simple'" apos-attribute='This is a 'simple quot...
Longer portions of text containing special characters can be escaped with a CDATA section. CDATA sections can only appear in element content. <?xml version="1.0"?> <document> This is a CDATA section : <![CDATA[ plenty of special characters like & < > " ; ...
Characters can be escaped using character references, in element content or attribute values. Their Unicode codepoint can be specified in decimal or hex. <?xml version="1.0"?> <document> The line feed character can be escaped with a decimal (
) or hex (
) ...
Type abbreviations allow you to create aliases on existing types to give them a more meaningful senses. // Name is an alias for a string type Name = string // PhoneNumber is an alias for a string type PhoneNumber = string Then you can use the alias just as any other type: // Create a recor...
Examples of numeric fields are given: AutoField An auto-incrementing integer generally used for primary keys. from django.db import models class MyModel(models.Model): pk = models.AutoField() Each model gets a primary key field (called id) by default. Therefore, it is not necessary t...
This is a specialized field, used to store binary data. It only accepts bytes. Data is base64 serialized upon storage. As this is storing binary data, this field cannot be used in a filter. from django.db import models class MyModel(models.Model): my_binary_data = models.BinaryField() ...
Detailed instructions on getting xquery set up or installed.
In real world, connection and server delays could occur, to simulate delays in development environment Meteor._sleepForMs(ms); could be used Meteor.publish('USER_DATA', function() { Meteor._sleepForMs(3000); // Simulate 3 seconds delay return Meteor.users.find({}); });
To load an image and place it on the canvas var image = new Image(); // see note on creating an image image.src = "imageURL"; image.onload = function(){ ctx.drawImage(this,0,0); } Creating an image There are several ways to create an image new Image() document.createEleme...
What's an image sprite? An image sprite is a single asset located within an image sprite sheet. An image sprite sheet is an image file that contains more than one asset that can be extracted from it. For example: The image above is an image sprite sheet, and each one of those stars is a sprite...
@Entity class Note { @Id Integer id; @Basic String note; @Basic int count; } Getters, setters etc. are ommitted for brevity, but they are not needed for JPA anyway. This Java class would map to the following table (depending on your database, here given in on...
@Entity class Note { @Id Integer id; @Basic String note; @Transient String parsedNote; String readParsedNote() { if (parsedNote == null) { /* initialize from note */ } return parsedNote; } } If your class needs fields that should ...
Suppose we want to get all product categories with total sales greater than 20. Here is a query without Common Table Expressions: SELECT category.description, sum(product.price) as total_sales FROM sale LEFT JOIN product on sale.product_id = product.id LEFT JOIN category on product.category_id ...
Suppose we want to query the "cheapest products" from the "top categories". Here is an example of query using Common Table Expressions -- all_sales: just a simple SELECT with all the needed JOINS WITH all_sales AS ( SELECT product.price as product_price, category.id a...
SELECT x, ... FROM ( SELECT y, ... FROM ... ) AS a JOIN tbl ON tbl.x = a.y WHERE ... This will evaluate the subquery into a temp table, then JOIN that to tbl. Prior to 5.6, there could not be an index on the temp table. So, this was potentially very inefficient: SELECT ... ...
For...Next Using the iterator variable as the index number is the fastest way to iterate the elements of an array: Dim items As Variant items = Array(0, 1, 2, 3) Dim index As Integer For index = LBound(items) To UBound(items) 'assumes value can be implicitly converted to a String: D...
R is full of functions, it is after all a functional programming language, but sometimes the precise function you need isn't provided in the Base resources. You could conceivably install a package containing the function, but maybe your requirements are just so specific that no pre-made function fit...
Partial method consists of the definition in one partial class declaration (as a common scenario - in the auto-generated one) and the implementation in another partial class declaration. using System; namespace PartialClassAndMethods { public partial class PartialClass // Auto-generated ...
TRUNCATE tableName; This will delete all the data and reset AUTO_INCREMENT index. It's much faster than DELETE FROM tableName on a huge dataset. It can be very useful during development/testing. When you truncate a table SQL server doesn't delete the data, it drops the table and recreates it, th...
With a column of one of the string types, named my_date_field with a value such as [the string] 07/25/2016, the following statement demonstrates the use of the STR_TO_DATE function: SELECT STR_TO_DATE(my_date_field, '%m/%d/%Y') FROM my_table; You could use this function as part of WHERE clause a...

Page 434 of 1191