Tutorial by Examples: du

Given the following history, imagine you make a change that you want to squash into the commit bbb2222 A second commit: $ git log --oneline --decorate ccc3333 (HEAD -> master) A third commit bbb2222 A second commit aaa1111 A first commit 9999999 Initial commit Once you've made your change...
To access entities declared in a module from another program unit (module, procedure or program), the module must be used with the use statement. module shared_data implicit none integer :: iarray(4) = [1, 2, 3, 4] real :: rarray(4) = [1., 2., 3., 4.] end module program test !...
Writing testable code is an important part of building a robust, maintainable, and agile project. Support for PHP's most widely used testing framework, PHPUnit, is built right into Laravel. PHPUnit is configured using the phpunit.xml file, which resides in the root directory of every new Laravel app...
Views, in an MVC pattern, contain the logic on how to present data to the user. In a web application, typically they are used to generate the HTML output that is sent back to users with each response. By default, views in Laravel are stored in the resources/views directory. A view can be called u...
Encapsulation allows you to make internal changes to a class without affecting any code that calls the class. This reduces coupling, or how much any given class relies on the implementation of another class. For example, let's change the implementation of the Angle class from the previous example: ...
This will show the user location on the map Objective-C [self.map setShowsUserLocation:YES]; Swift self.map?.showsUserLocation = true This will track the user location on the map, updating regions according Objective-C [self.map setUserTrackingMode:MKUserTrackingModeFollow]; Swift s...
Define a menu in res/menu <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/first_...
public async Task<Product> GetProductAsync(string productId) { using (_db) { return await _db.QueryFirstOrDefaultAsync<Product>("usp_GetProduct", new { id = productId }, commandType: CommandType.StoredProcedure); } }
Assembly language is a human readable form of machine language or machine code which is the actual sequence of bits and bytes on which the processor logic operates. It is generally easier for humans to read and program in mnemonics than binary, octal or hex, so humans typically write code in assemb...
To make express web application modular use router factories: Module: // greet.js const express = require('express'); module.exports = function(options = {}) { // Router factory const router = express.Router(); router.get('/greet', (req, res, next) => { res.end(options....
A few modules in the standard library have been renamed: Old nameNew name_winregwinregConfigParserconfigparsercopy_regcopyregQueuequeueSocketServersocketserver_markupbasemarkupbasereprreprlibtest.test_supporttest.supportTkintertkintertkFileDialogtkinter.filedialogurllib / urllib2urllib, urllib.pars...
In general, most of the objects you would interact with as a user would tend to be a vector; e.g numeric vector, logical vector. These objects can only take in a single type of variable (a numeric vector can only have numbers inside it). A list would be able to store any type variable in it, making...
Every package requires a setup.py file which describes the package. Consider the following directory structure for a simple package: +-- package_name | | | +-- __init__.py | +-- setup.py The __init__.py contains only the line def foo(): return 100. The following setup.py...
To find every vector of the form (x, y) where x is drawn from vector X and y from Y, we use expand.grid: X = c(1, 1, 2) Y = c(4, 5) expand.grid(X, Y) # Var1 Var2 # 1 1 4 # 2 1 4 # 3 2 4 # 4 1 5 # 5 1 5 # 6 2 5 The result is a data.frame with one...
unique drops duplicates so that each element in the result is unique (only appears once): x = c(2, 1, 1, 2, 1) unique(x) # 2 1 Values are returned in the order they first appeared. duplicated tags each duplicated element: duplicated(x) # FALSE FALSE TRUE TRUE TRUE anyDuplicated(x) >...
When trying to select from a table called order like this select * from order the error rises: Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order' at line 1 Reserved keywords in MySQ...
Follow previous example of creating a seed. This example uses a MySQL Dump to seed a table in the project database. The table must be created before seeding. <?php use Illuminate\Database\Seeder; class UserTableSeeder extends Seeder { /** * Run the database seeds. * ...
Just like char and int, a function is a fundamental feature of C. As such, you can declare a pointer to one: which means that you can pass which function to call to another function to help it do its job. For example, if you had a graph() function that displayed a graph, you could pass which functio...
You can use git merge --squash to squash changes introduced by a branch into a single commit. No actual commit will be created. git merge --squash <branch> git commit This is more or less equivalent to using git reset, but is more convenient when changes being incorporated have a symbolic...
A Broadcast receiver is an Android component which allows you to register for system or application events. A receiver can be registered via the AndroidManifest.xml file or dynamically via the Context.registerReceiver() method. public class MyReceiver extends BroadcastReceiver { @Override ...

Page 6 of 47