Tutorial by Examples: ch

Make sure you see Registering for local notifications in order for this to work: Swift let notification = UILocalNotification() notification.alertBody = "Hello, local notifications!" notification.fireDate = NSDate().dateByAddingTimeInterval(10) // 10 seconds after now UIApplication.sh...
Steam has a games under $10 section of their store page. Somewhere deep in the heart of their systems, there's probably a query that looks something like: SELECT * FROM Items WHERE Price < 10
re.findall(r"[0-9]{2,3}", "some 1 text 12 is 945 here 4445588899") # Out: ['12', '945', '444', '558', '889'] Note that the r before "[0-9]{2,3}" tells python to interpret the string as-is; as a "raw" string. You could also use re.finditer() which works in...
4.0 To uppercase $ v="hello" # Just the first character $ printf '%s\n' "${v^}" Hello # All characters $ printf '%s\n' "${v^^}" HELLO # Alternative $ v="hello world" $ declare -u string="$v" $ echo "$string" HELLO WORLD To l...
The pipe operator, %>%, is used to insert an argument into a function. It is not a base feature of the language and can only be used after attaching a package that provides it, such as magrittr. The pipe operator takes the left-hand side (LHS) of the pipe and uses it as the first argument of the ...
3.0 Check if a string consists in exactly 8 digits: $ date=20150624 $ [[ $date =~ ^[0-9]{8}$ ]] && echo "yes" || echo "no" yes $ date=hello $ [[ $date =~ ^[0-9]{8}$ ]] && echo "yes" || echo "no" no
To begin making modifications to the project's data, you have to obtain a local copy of the versioned project. Use the command line svn client or your favorite SVN client (TortoiseSVN, for example). Your local copy of the project is called a working copy in Subversion and you get it by issuing the c...
A a pointer to a piece of memory containing n elements may only be dereferenced if it is in the range memory and memory + (n - 1). Dereferencing a pointer outside of that range results in undefined behavior. As an example, consider the following code: int array[3]; int *beyond_array = array + 3; ...
git log -S"#define SAMPLES" Searches for addition or removal of specific string or the string matching provided REGEXP. In this case we're looking for addition/removal of the string #define SAMPLES. For example: +#define SAMPLES 100000 or -#define SAMPLES 100000 git log -G&q...
To delete a remote branch in Git: git push [remote-name] --delete [branch-name] or git push [remote-name] :[branch-name]
If a remote branch has been deleted, your local repository has to be told to prune the reference to it. To prune deleted branches from a specific remote: git fetch [remote-name] --prune To prune deleted branches from all remotes: git fetch --all --prune
See full documentation on LIKE operator. This example uses the Employees Table from the Example Databases. SELECT * FROM Employees WHERE FName LIKE 'John' This query will only return Employee #1 whose first name matches 'John' exactly. SELECT * FROM Employees WHERE FName like 'John%' Ad...
This example shows how to match an input against several values: def f(x: Int): String = x match { case 1 => "One" case 2 => "Two" case _ => "Unknown!" } f(2) // "Two" f(3) // "Unknown!" Live demo Note: _ is the fall th...
In standard pattern matching, the identifier used will shadow any identifier in the enclosing scope. Sometimes it is necessary to match on the enclosing scope's variable. The following example function takes a character and a list of tuples and returns a new list of tuples. If the character existed...
In order to get const char* access to the data of a std::string you can use the string's c_str() member function. Keep in mind that the pointer is only valid as long as the std::string object is within scope and remains unchanged, that means that only const methods may be called on the object. C++1...
Branching in Subversion is very simple. In the simplest form, creating a new branch requires you to run the command against the remote repository's URLs. For example, let's create a new branch out of the mainline trunk: svn copy https://svn.example.com/svn/MyRepo/MyProject/trunk https://svn.example...
When you interact with the remote central repository using your private local workspace -- the working copy -- you can use repository-relative URL instead of direct URL to URL copy to create a new branch: svn copy "^/MyProject/trunk" "^/MyProject/branches/MyNewBranch" -m "C...
The working copy (WC) is your local and private workspace that you use to interact with the central Subversion repository. You use the working copy to modify the contents of your project and fetch changes committed by others. The working copy contains your project's data and looks and acts like a r...
#include <lua.h> #include <lauxlib.h> #include <lualib.h> int main(void) { 5.1 /* Start by creating a new VM state */ lua_State *L = luaL_newstate(); /* Load standard Lua libraries: */ luaL_openlibs(L); 5.1 /* For older version of Lua use lua_open ins...
Generally To use regular expression specific characters (?+| etc.) in their literal meaning they need to be escaped. In common regular expression this is done by a backslash \. However, as it has a special meaning in Java Strings, you have to use a double backslash \\. These two examples will not ...

Page 6 of 109