Tutorial by Examples: change

There are 5 different types (MKMapType), MKMapView can display. iPhone OS 3 .standard Displays a street map that shows the position of all roads and some road names. Swift 2 mapView.mapType = .Standard Swift 3 mapView.mapType = .standard Objective-C _mapView.mapType = MKMapTypeStandard;...
SharedPreferences sharedPreferences = ...; sharedPreferences.registerOnSharedPreferenceChangeListener(mOnSharedPreferenceChangeListener); private final SharedPreferences.OnSharedPreferenceChangeListener mOnSharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener(...
Swift textView.text = "Hello, world!" Objective-C: textView.text = @"Hello, world!";
Swift textView.textAlignment = .left Objective-C textView.textAlignment = NSTextAlignmentLeft;
Swift //System Font textView.font = UIFont.systemFont(ofSize: 12) //Font of your choosing textView.font = UIFont(name: "Font Name", size: 12) Objective-C //System Font textView.font = [UIFont systemFontOfSize:12]; //Font of your choosing textView.font = [UIFont fontWithName:...
Swift textView.textColor = UIColor.red Objective-C textView.textColor = [UIColor redColor];
After creating a new model or modifying existing models, you will need to generate migrations for your changes and then apply the migrations to the specified database. This can be done by using the Django's built-in migrations system. Using the manage.py utility when in the project root directory: ...
In Python 3, many of the dictionary methods are quite different in behaviour from Python 2, and many were removed as well: has_key, iter* and view* are gone. Instead of d.has_key(key), which had been long deprecated, one must now use key in d. In Python 2, dictionary methods keys, values and items ...
Let's say you have a simple myblog app with the following model: from django.conf import settings from django.utils import timezone class Article(models.Model): title = models.CharField(max_length=70) slug = models.SlugField(max_length=70, unique=True) author = models.ForeignKe...
git diff 1234abc..6789def # old new E.g.: Show the changes made in the last 3 commits: git diff @~3..@ # HEAD -3 HEAD Note: the two dots (..) is optional, but adds clarity. This will show the textual difference between the commits, regardless of where they are in the tree.
The basics After making changes to your source code, you should stage those changes with Git before you can commit them. For example, if you change README.md and program.py: git add README.md program.py This tells git that you want to add the files to the next commit you do. Then, commit your...
You can commit changes made to specific files and skip staging them using git add: git commit file1.c file2.h Or you can first stage the files: git add file1.c file2.h and commit them later: git commit
To get your most recent stash after running git stash, use git stash apply To see a list of your stashes, use git stash list You will get a list that looks something like this stash@{0}: WIP on master: 67a4e01 Merge tests into develop stash@{1}: WIP on master: 70f0d95 Add user role to lo...
The nodemon package makes it possible to automatically reload your program when you modify any file in the source code. Installing nodemon globally npm install -g nodemon (or npm i -g nodemon) Installing nodemon locally In case you don't want to install it globally npm install --save-dev nodemo...
Events that work with most form elements (e.g., change, keydown, keyup, keypress) do not work with contenteditable. Instead, you can listen to changes of contenteditable contents with the input event. Assuming contenteditableHtmlElement is a JS DOM object that is contenteditable: contenteditableH...
You can also receive regular updates of the user's location; for example, as they move around while using a mobile device. Location tracking over time can be very sensitive, so be sure to explain to the user ahead of time why you're requesting this permission and how you'll use the data. if (naviga...
To modify an existing column in Rails with a migration, run the following command: rails g migration change_column_in_table This will create a new migration file in db/migration directory (if it doesn’t exist already), which will contain the file prefixed with timestamp and migration file name w...
# load the library library(ggplot2) # create a blank canvas g <- ggplot(data = diamonds) g + geom_bar(aes(x = cut, fill = cut)) + scale_fill_discrete(guide = guide_legend(title = "CUT", keywidth = 2, ...
To display the hunks that are staged for commit: git diff --cached
Let's say you have an object like this: var myObject = { name: 'Peter' } Later in your code, you try to access myObject.name and you get George instead of Peter. You start wondering who changed it and where exactly it was changed. There is a way to place a debugger (or something else) on e...

Page 2 of 10