Tutorial by Examples: c

Here is an example Picasso Circle Transform class based on the original, with the addition of a thin border, and also includes functionality for an optional separator for stacking: import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import androi...
A 'tab bar' is commonly found in most iOS apps and is used to present distinct views in each tab. To create a tab bar controller using the interface builder, drag a tab bar Controller from the Object Library into the canvas. By default a tab bar controller comes with two views. To add additional...
Using the Story Board: Select the tab bar item from the corresponding view controller and go to the attributes inspector If you want a built-in icon and title, set the 'System Item' to the corresponding value. For a custom icon, add the required images to the assets folder and set the 'System It...
If you need an ActiveRecord method to raise an exception instead of a false value in case of failure, you can add ! to them. This is very important. As some exceptions/failures are hard to catch if you don't use ! on them. I recommended doing this in your development cycle to write all your ActiveRe...
The unchecked keyword prevents the compiler from checking for overflows/underflows. For example: const int ConstantMax = int.MaxValue; unchecked { int1 = 2147483647 + 10; } int1 = unchecked(ConstantMax + 10); Without the unchecked keyword, neither of the two addition operations will co...
It is very rare that you'll ever want to use Select or Activate in your code, but some Excel methods do require a worksheet or workbook to be activated before they'll work as expected. If you're just starting to learn VBA, you'll often be suggested to record your actions using the macro recorder, t...
You can send a block to your method and it can call that block multiple times. This can be done by sending a proc/lambda or such, but is easier and faster with yield: def simple(arg1,arg2) puts "First we are here: #{arg1}" yield puts "Finally we are here: #{arg2}" ...
Sometimes you may want to apply styling to a column or group of columns. Or for semantic purposes, you may want to group columns together. To do this, use <colgroup> and <col> elements. The optional <colgroup> tag allows you to group columns together. <colgroup> elements ...
All published ISO standards are available for sale from the ISO store ( http://www.iso.org ). The working drafts of the C++ standards are publicly available for free though. The different versions of the standard: Upcoming (Sometimes referred as C++20 or C++2a): Current working draft (HTML-vers...
Symbol is a new primitive type in ES6. Symbols are used mainly as property keys, and one of its main characteristics is that they are unique, even if they have the same description. This means they will never have a name clash with any other property key that is a symbol or string. const MY_PROP_KE...
See this Q&A question if you don't know what race conditions are. The following code may be subject to race conditions : article = Article.objects.get(pk=69) article.views_count += 1 article.save() If views_count is equal to 1337, this will result in such query: UPDATE app_article SET vi...
Vim supports the use of regular expressions when searching through a file. The character to indicate that you wish to perform a search is /. The simplest search you can perform is the following /if This will search the entire file for all instances of if. However, our search if is actually a r...
Transactions can be used to make multiple changes to the database atomically. Any normal transaction follows this pattern: // You need a writable database to perform transactions final SQLiteDatabase database = openHelper.getWritableDatabase(); // This call starts a transaction database.beginT...
Orders Table CustomerIdProductIdQuantityPrice12510013220014150021450356700 To check for customers who have ordered both - ProductID 2 and 3, HAVING can be used select customerId from orders where productID in (2,3) group by customerId having count(distinct productID) = 2 Return value:...
Following statement matches all records having FName that starts with a letter from A to F from Employees Table. SELECT * FROM Employees WHERE FName LIKE '[A-F]%'
We can destructure lists of compound objects CL-USER> (loop for (a . b) in '((1 . 2) (3 . 4) (5 . 6)) collect a) (1 3 5) CL-USER> (loop for (a . b) in '((1 . 2) (3 . 4) (5 . 6)) collect b) (2 4 6) CL-USER> (loop for (a b c) in '((1 2 3) (4 5 6) (7 8 9) (10 11 12)) collect b) (2 5 8 11...
package main import ( "fmt" "io/ioutil" ) func main() { files, err := ioutil.ReadDir(".") if err != nil { panic(err) } fmt.Println("Folders in the current directory:") for _, fileInfo := range files { ...
You need to create a new local copy of the repository with the command git svn clone SVN_REPO_ROOT_URL [DEST_FOLDER_PATH] -T TRUNK_REPO_PATH -t TAGS_REPO_PATH -b BRANCHES_REPO_PATH If your SVN repository follows the standard layout (trunk, branches, tags folders) you can save some typing: git svn...
The equivalent to git pull is the command git svn rebase This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. You can also use the command git svn fetch to retrieve the changes from the SVN repository and bring them to ...
The command git svn dcommit will create a SVN revision for each of your local git commits. As with SVN, your local git history must be in sync with the latest changes in the SVN repository, so if the command fails, try performing a git svn rebase first.

Page 216 of 826