Tutorial by Examples: ti

Suppose you have many changes in one or more files but from each file you only want to commit some of the changes, you can select the desired changes using: git add -p or git add -p [file] Each of your changes will be displayed individually, and for each change you will be prompted to choose...
Matplotlib supports both object-oriented and imperative syntax for plotting. The imperative syntax is intentionally designed to be very close to Matlab syntax. The imperative syntax (sometimes called 'state-machine' syntax) issues a string of commands all of which act on the most recent figure or a...
props are used to pass data and methods from a parent component to a child component. Interesting things about props They are immutable. They allow us to create reusable components. Basic example class Parent extends React.Component{ doSomething(){ console.log("Parent comp...
When a React component is created, a number of functions are called: If you are using React.createClass (ES5), 5 user defined functions are called If you are using class Component extends React.Component (ES6), 3 user defined functions are called getDefaultProps() (ES5 only) This is the firs...
With automatic reference counting (ARC), the compiler inserts retain, release, and autorelease statements where they are needed, so you don't have to write them yourself. It also writes dealloc methods for you. The sample program from Manual Memory Management looks like this with ARC: @interface M...
A word of caution: AsyncTask has many gotcha's apart from the memory leak described here. So be careful with this API, or avoid it altogether if you don't fully understand the implications. There are many alternatives (Thread, EventBus, RxAndroid, etc). One common mistake with AsyncTask is to c...
The installation instructions are available on IIS.net. See this for installing IIS 8.5
PHP is a loosely typed language. This means that, by default, it doesn't require operands in an expression to be of the same (or compatible) types. For example, you can append a number to a string and expect it to work. var_dump ("This is example number " . 1); The output will be: ...
When you install Oracle 11g or 12cR1, an older version of Apex is pre-installed. It is highly recommended to upgrade it to the latest version. Go to apex.oracle.com and download the latest version of Apex. Follow the documentation for the specific version to install it. Important Docu...
Add the following dependency to the build.gradle file: compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' Add the following permissions to the AndroidManifest.xml file: <uses-permission android:name="android.permission.INTERNET" /> <uses-permiss...
strsplit is a useful function for breaking up a vector into an list on some character pattern. With typical R tools, the whole list can be reincorporated to a data.frame or part of the list might be used in a graphing exercise. Here is a common usage of strsplit: break a character vector along a co...
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...
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...
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...
Let's assume that we want to remove 2 upvotes from all the articles of the author with id 51. Doing this only with Python would execute N queries (N being the number of articles in the queryset): for article in Article.objects.filter(author_id=51): article.upvotes -= 2 article.save() ...
// You need a writable database to update a row final SQLiteDatabase database = openHelper.getWritableDatabase(); // Create a ContentValues instance which contains the up to date data for each column // Unlike when inserting data you need to specify the value for the PRIMARY KEY column as well ...
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:...

Page 136 of 505