Tutorial by Examples: ee

You may add your new Seeder to the DatabaseSeeder class. /** * Run the database seeds. * * @return void */ public function run() { $this->call(UserTableSeeder::class); } To run a database seeder, use the Artisan command php artisan db:seed ...
Database seeds are stored in the /database/seeds directory. You can create a seed using an Artisan command. php artisan make:seed UserTableSeeder Alternatively you can create a new class which extends Illuminate\Database\Seeder. The class must a public function named run().
You can reference models in a seeder. use DB; use App\Models\User; class UserTableSeeder extends Illuminate\Database\Seeder{ public function run(){ # Remove all existing entrie DB::table('users')->delete() ; User::create([ 'name' => 'Admin', ...
Here is an example of a service that greets people by the given name, and keeps track of how many users it encountered. See usage below. %% greeter.erl %% Greets people and counts number of times it did so. -module(greeter). -behaviour(gen_server). %% Export API Functions -export([start_link/0...
It is possible to release dynamically allocated memory by calling free(). int *p = malloc(10 * sizeof *p); /* allocation of memory */ if (p == NULL) { perror("malloc failed"); return -1; } free(p); /* release of memory */ /* note that after free(p), even using the *value...
This a basic example aimed at new users. It does not focus on explaining the difference between char and cellstring. It might happen that you want to get rid of the ' in your strings, although you never added them. In fact, those are artifacts that the command window uses to distinguish between ...
Option Explicit Sub LoopAllSheets() Dim sht As Excel.Worksheet ' declare an array of type String without committing to maximum number of members Dim sht_Name() As String Dim i As Integer ' get the number of worksheets in Active Workbook , and put it as the maximum number of members in t...
Calling .Equals() on a delegate compares by reference equality: Action action1 = () => Console.WriteLine("Hello delegates"); Action action2 = () => Console.WriteLine("Hello delegates"); Action action1Again = action1; Console.WriteLine(action1.Equals(action1)) // True ...
One of the things that can really boost your productivity while writing the code is effectively navigating the workspace. This also means making it comfortable for the moment. It's possible to achieve this by adjusting which areas of workspaces you see. The buttons on the top of the navigation and ...
Consider the following tough-to-vectorize for loop, which creates a vector of length len where the first element is specified (first) and each element x_i is equal to cos(x_{i-1} + 1): repeatedCosPlusOne <- function(first, len) { x <- numeric(len) x[1] <- first for (i in 2:len) { ...
The jQuery UI framework helps to extend and increase the User Interface controls for jQuery JavaScript library. When you wish to use jQuery UI, you will need to add these libraries to your HTML. A quick way to start is using the Content Delivery Network available code sources: jQuery Libraries ht...
Following the Rcpp example in this documentation entry, consider the following tough-to-vectorize function, which creates a vector of length len where the first element is specified (first) and each element x_i is equal to cos(x_{i-1} + 1): repeatedCosPlusOne <- function(first, len) { x <-...
This assumes that you have read the documentation about starting a new Django project. Let us assume that the main app in your project is named td (short for test driven). To create your first test, create a file named test_view.py and copy paste the following content into it. from django.test impo...
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.
Create a .gitattributes file in the project root containing: * -text This is equivalent to setting core.autocrlf = false.
Create a .gitattributes file in the project root containing: * text=auto This will result in all text files (as identified by Git) being committed with LF, but checked out according to the host operating system default. This is equivalent to the recommended core.autocrlf defaults of: input o...
Ajax Get: Solution 1: $.get('url.html', function(data){ $('#update-box').html(data); }); Solution 2: $.ajax({ type: 'GET', url: 'url.php', }).done(function(data){ $('#update-box').html(data); }).fail(function(jqXHR, textStatus){ alert('Error occured: ' + te...
iex(1)> h List.last def last(list) Returns the last element in list or nil if list is empty. Examples ┃ iex> List.last([]) ┃ nil ┃ ┃ iex> List.last([1]) ┃ 1 ┃ ┃ iex> List.last([1, 2, 3]) ┃ 3
In some cases, you might not want to use the default maps, Apple provides. You can add an overlay to your mapView that contains custom tiles for example from OpenStreetMap. Let's assume, self.mapView is your MKMapView that you have already added to your ViewController. At first, your ViewControll...
For instance, a computation involving commands to read and write from the prompt: First we describe the "commands" of our computation as a Functor data type {-# LANGUAGE DeriveFunctor #-} data TeletypeF next = PrintLine String next | ReadLine (String -> next) derivin...

Page 5 of 54