Tutorial by Examples: al

If your application doesn't need to update resources during a specific configuration change and you have a performance limitation that requires you to avoid the activity restart, then you can declare that your activity handles the configuration change itself, which prevents the system from restartin...
Validation attributes can be used to easily configure model validation. public class MyModel { public int id { get; set; } //sets the FirstName to be required, and no longer than 100 characters [Required] [StringLength(100)] public string FirstName { get; set; } } Th...
You can add an image to a view's layer simply by using its contents property: myView.layer.contents = UIImage(named: "star")?.CGImage Note that the UIImage needs to be converted to a CGImage. If you wish to add the image in its own layer, you can do it like this: let myLayer = CA...
Basics There are a number of different transforms you can do on a layer, but the basic ones are translate (move) scale rotate To do transforms on a CALayer, you set the layer's transform property to a CATransform3D type. For example, to translate a layer, you would do something like this:...
void alertDialogDemo() { // get alert_dialog.xml view LayoutInflater li = LayoutInflater.from(getApplicationContext()); View promptsView = li.inflate(R.layout.alert_dialog, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( ...
String literals are used to specify arrays of characters. They are sequences of characters enclosed within double quotes (e.g. "abcd" and have the type char*). The L prefix makes the literal a wide character array, of type wchar_t*. For example, L"abcd". Since C11, there are ot...
Floating point literals are used to represent signed real numbers. The following suffixes can be used to specify type of a literal: SuffixTypeExamplesnonedouble3.1415926 -3E6f, Ffloat3.1415926f 2.1E-6Fl, Llong double3.1415926L 1E126L In order to use these suffixes, the literal must be a floating p...
Character literals are a special type of integer literals that are used to represent one character. They are enclosed in single quotes, e.g. 'a' and have the type int. The value of the literal is an integer value according to the machine's character set. They do not allow suffixes. The L prefix bef...
Suppose we want to have a route that allows an unbound number of segments like so: http://example.com/Products/ (view all products) http://example.com/Products/IT http://example.com/Products/IT/Laptops http://example.com/Products/IT/Laptops/Ultrabook http://example.com/Products/IT/Laptops/Ult...
The following is a list of tips for those who are looking to contribute to the PHP manual: Follow the manual's style guidelines. Ensure that the manual's style guidelines are always being followed for consistency's sake. Perform spelling and grammar checks. Ensure proper spelling and grammar is ...
Sometimes the shell prompt doesn't display the name of the virtual environment and you want to be sure if you are in a virtual environment or not. Run the python interpreter and try: import sys sys.prefix sys.real_prefix Outside a virtual, environment sys.prefix will point to the system p...
There are a few ways to use functions. Calling a function with an assignment statement DECLARE x NUMBER := functionName(); --functions can be called in declaration section BEGIN x := functionName(); END; Calling a function in IF statement IF functionName() = 100 THEN Null; EN...
var xhr = $.ajax({ type: "POST", url: "some.php", data: "name=John&location=Boston", success: function(msg){ alert( "Data Saved: " + msg ); } }); //kill the request xhr.abort()
VB now allows string literals that split over multiple lines. Old syntax: Dim text As String = "Line1" & Environment.NewLine & "Line2" New syntax: Dim text As String = "Line 1 Line 2"
Now we want to install nginx to serve our application. sudo apt-get install nginx # on debian/ubuntu Then we create a configuration for our website cd /etc/nginx/site-available # go to the configuration for available sites # create a file flaskconfig with your favourite editor flaskconfig...
A common mistake for Java beginners is to use the == operator to test if two strings are equal. For example: public class Hello { public static void main(String[] args) { if (args.length > 0) { if (args[0] == "hello") { System.out.println(&q...
' Create filestream to file Using fileStream = New IO.FileStream("archive.zip", IO.FileMode.Create) ' open zip archive from stream Using archive = New System.IO.Compression.ZipArchive(fileStream, IO.Compression.ZipArchiveMode.Create) ' create file_in_archive.txt in arch...
In Object Oriented Programming a common task is to compose objects (values). In Functional Programming it is as common task to compose values as well as functions. We are used to compose values from our experience of other programming languages using operators like +, -, *, / and so on. Value co...
Named Types Dim someInstance As New SomeClass(argument) With { .Member1 = value1, .Member2 = value2 '... } Is equivalent to Dim someInstance As New SomeClass(argument) someInstance.Member1 = value1 someInstance.Member2 = value2 '... Anonymous Types (Option...
Arrays Dim names = {"Foo", "Bar"} ' Inferred as String() Dim numbers = {1, 5, 42} ' Inferred as Integer() Containers (List(Of T), Dictionary(Of TKey, TValue), etc.) Dim names As New List(Of String) From { "Foo", "Bar" '... ...

Page 122 of 269