Tutorial by Examples: f

Initialize the UITextField with a CGRect as a frame: Swift let textfield = UITextField(frame: CGRect(x: 0, y: 0, width: 200, height: 21)) Objective-C UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 200, 21)]; You can also create a UITextField in Interface Builde...
Fragments also have a onSaveInstanceState() method which is called when their state needs to be saved: public class MySimpleFragment extends Fragment { private int someStateValue; private final String SOME_VALUE_KEY = "someValueToSave"; // Fires when a configuration ch...
In many cases, we can avoid problems when an Activity is re-created by simply using fragments. If your views and state are within a fragment, we can easily have the fragment be retained when the activity is re-created: public class RetainedFragment extends Fragment { // data object we want to ...
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...
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:...
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...
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...
There are some functions to help tear down Free computations by interpreting them into another monad m: iterM :: (Functor f, Monad m) => (f (m a) -> m a) -> (Free f a -> m a) and foldFree :: Monad m => (forall x. f x -> m x) -> (Free f a -> m a). What are they doing? First l...
Interfaces can seem abstract until you seem them in practice. The IComparable and IComparable<T> are great examples of why interfaces can be helpful to us. Let's say that in a program for a online store, we have a variety of items you can buy. Each item has a name, an ID number, and a price. ...
# app.rb require 'sinatra' get '/' do 'Hello, Universe!' end Install Sinatra: gem install sinatra Run the app: ruby app.rb That's it! Access your app at http://localhost:4567
<%@ Language="VBScript" CodePage = 65001 %> <% Option Explicit Response.Charset = "UTF-8" Response.CodePage = 65001 %> <!doctype html> <html> <head> <title>My First Classic ASP Page</title> </head> <body&gt...
To be more clear, let's create a script named showarg: #!/usr/bin/env bash printf "%d args:" $# printf " <%s>" "$@" echo Now let's see the differences: $ var="This is an example" $ showarg $var 4 args: <This> <is> <an> <exa...
VB.NET offers default Form instances. The developer does not need to create the instance as it is created behind the scenes. However, it is not preferable to use the default instance all but the simplest programs. Public Class Form1 Public Sub Foo() MessageBox.Show("Bar") ...
The built-in werkzeug server certainly is not suitable for running production servers. The most obvious reason is the fact that the werkzeug server is single-threaded and thus can only handle one request at a time. Because of this we want to use the uWSGI Server to serve our application instead. In...
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...
Flask has that feature which lets you stream data from a view by using generators. Let's change the app.py file add from flask import Response add from datetime import datetime add from time import sleep create a new view: @app.route("/time/") def time(): def streamer(): ...
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...
System.IO.Compression.ZipFile.CreateFromDirectory("myfolder", "archive.zip") Create archive.zip file containing files which are in myfolder. In example paths are relative to program working directory. You can specify absolute paths.

Page 210 of 457