Tutorial by Examples: ase

To convert a String to uppercase, use uppercaseString: NSString *myString = @"Emphasize this"; NSLog(@"%@", [myString uppercaseString]; // @"EMPHASIZE THIS" To convert a String to lowercase, use lowercaseString: NSString *myString = @"NORMALIZE this"; N...
// You need a writable database to insert data final SQLiteDatabase database = openHelper.getWritableDatabase(); // Create a ContentValues instance which contains the data for each column // You do not need to specify a value for the PRIMARY KEY column. // Unique values for these are automatic...
Just execute lsb_release -a. On Debian: $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux testing (stretch) Release: testing Codename: stretch On Ubuntu: $ lsb_release -a No LSB modules are available. Distributor ID: Ubun...
Dart has a switch case which can be used instead of long if-else statements: var command = 'OPEN'; switch (command) { case 'CLOSED': executeClosed(); break; case 'OPEN': executeOpen(); break; case 'APPROVED': executeApproved(); break; case 'UNSURE': ...
To check for a precise number of elements in the collection def f(ints: Seq[Int]): String = ints match { case Seq() => "The Seq is empty !" case Seq(first) => s"The seq has exactly one element : $first" case Seq(first, second) => s"The...
A case class is a class with a lot of standard boilerplate code automatically included. One benefit of this is that Scala makes it easy to use extractors with case classes. case class Person(name: String, age: Int) // Define the case class val p = Person("Paola", 42) // Instantiate a v...
This example aims to describe how one can utilize git rebase in interactive mode. It is expected that one has a basic understanding of what git rebase is and what it does. Interactive rebase is initiated using following command: git rebase -i The -i option refers to interactive mode. Using inte...
Every case class defines an extractor that can be used to capture the members of the case class when pattern matching: case class Student(name: String, email: String) def matchStudent1(student: Student): String = student match { case Student(name, email) => s"$name has the following...
You have started an interactive rebase. In the editor where you pick your commits, you decide that something is going wrong (for example a commit is missing, or you chose the wrong rebase destination), and you want to abort the rebase. To do this, simply delete all commits and actions (i.e. all lin...
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: ...
The services lifecycle has the following callbacks onCreate() : Executed when the service is first created in order to set up the initial configurations you might need. This method is executed only if the service is not already running. onStartCommand() : Executed every time startService...
Ruby uses the case keyword for switch statements. As per the Ruby Docs: Case statements consist of an optional condition, which is in the position of an argument to case, and zero or more when clauses. The first when clause to match the condition (or to evaluate to Boolean truth, if the condi...
One of ColdFusion's strengths is how easy it is to work with databases. And of course, query inputs can and should be parameterized. Tag Implementation <cfquery name="myQuery" datasource="myDatasource" result="myResult"> select firstName, lastName from...
In PowerShell, there are many ways to achieve the same result. This can be illustrated nicely with the simple & familiar Hello World example: Using Write-Host: Write-Host "Hello World" Using Write-Output: Write-Output 'Hello world' It's worth noting that although Write-Outp...
To make all the characters in a String uppercase or lowercase: 2.2 let text = "AaBbCc" let uppercase = text.uppercaseString // "AABBCC" let lowercase = text.lowercaseString // "aabbcc" 3.0 let text = "AaBbCc" let uppercase = text.uppercased() // &qu...
Display all data files for all databases with size and growth info SELECT d.name AS 'Database', d.database_id, SF.fileid, SF.name AS 'LogicalFileName', CASE SF.status & 0x100000 WHEN 1048576 THEN 'Percentage' WHEN 0 THEN 'MB...
It's a bad idea to hard code paths in your application. One should always use relative urls so that your code can work seamlessly across different machines. The best way to set this up is to define a variable like this import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) Then use th...
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', ...

Page 4 of 40