Tutorial by Examples: c

You can also use Laravel Artisan commands from your routes or controllers. To run a command using PHP code: Artisan::call('command-name'); For example, Artisan::call('db:seed');
If an integer x is a power of 2, only one bit is set, whereas x-1 has all bits set after that. For example: 4 is 100 and 3 is 011 as binary number, which satisfies the aforementioned condition. Zero is not a power of 2 and has to be checked explicitly. boolean isPowerOfTwo(int x) { return (x ...
There are two kinds of persistent storage modes in Redis: AOF and RDB. To temporarily disable RDB execute the following commands on the Redis command line: config set save "" to temporarily disable AOF execute the following from the Redis command line: config set appendonly no The...
The following code will get the current configuration for the persistent storage state. These values can be modified dynamically, so they may differ from the configuration in redis.conf: # get config get appendonly config get save
It is simple to start using Redis using docker: docker pull redis docker run -p 6379:6379 --rm --name redis redis Now you have running instance on port 6397 Attention: All data will be deleted, when Redis will be stopped. To connect the redis-cli, start another docker: docker run -it --link ...
A basic script showing the fundamentals of how to create/open, write to, and save an Excel spreadsheet. Using the AutoIt Excel library functions. ; Include definitions of the User Excel functions #include <Excel.au3> ; Include Message Box codes for the error messages #include <MsgBox...
Code coverage is a measure used to how often each source code statement and branch is executed. This measure is usually required when running a test suite to ensure that as much of the code as possible is tested by the test suite. It can also be used during profiling to determine code hot-spots and ...
Before using gcov, source code should be compiled with gcc using the two flags, -fprofile-arcs and -ftest-coverage. This tells the compiler to generate the information and extra object file code required by gcov. gcc -fprofile-arcs -ftest-coverage hello.c Linking should also use the -fprofile-a...
We can use the unit type as a function argument to define functions that we don't want executed until later. This is often useful in asynchronous background tasks, when the main thread may want trigger some predefined functionality of the background thread, like maybe moving it to a new file, or if...
You can use conditional operators in WordPress to enqueue scripts on specific pages of your Website. function load_script_for_single_post(){ if(is_single()){ wp_enqueue_script( 'some', get_template_directory_uri().'/js/some.js', array...
Since vim version 7.3 the feature 'persistent_undo' is supported, which makes it possible do undo/redo changes, even after closing vim or restarting your computer. It's possible to configure it by adding the following to your vimrc, but first create a directory, where your undofiles should be saved...
Jquery selectors are used to manipulate DOM (Document object model), attach events, add element, remove element on runtime. SelectorDescriptionelement selectorelement selector are used to select particular element Ex: <p>Stackoverflow to help in understanding errors </p> To access this ...
data table; set table; label variable1 = 'label1' variable2 = 'label2' variable3 = 'label3'; run;
Custom formats, also known as user defined formats, can be created and used like any other default formats. /*Create new character format for state variables*/ PROC FORMAT; VALUE $statef 'CA' = 'California' 'MA' = 'Massachusetts' 'NY' = 'New York'; ...
/app/services/greeting.service.ts : import { Injectable } from '@angular/core'; import {greetingTypes,request,response} from './greeting.interface' @Injectable() export class Greeting{ private worker; constructor(){ this.worker = new Worker('../workers /gr...
In this example, we will launch a basic EC2 Instance with Amazon Linux in the quickest manner possible via the AWS Management Console. Amazon frequently improves the user experience of the AWM Management console, so you might experience some changes to the screens below. Important: launching an in...
Using SBT to manage the library dependency, add this to build.sbt: libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.0" libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test" More details can be f...
The subprocess method that allows running commands needs the command in form of a list (at least using shell_mode=True). The rules to create the list are not always straightforward to follow, especially with complex commands. Fortunately, there is a very helpful tool that allows doing that: shlex. ...
Default WooCommerce checkout form comes with several fields for customers to enter their billing details. But in some cases, you might want to hide some of these fields. For example, if you are selling only virtual products, you can get rid of fields like billing address. Use the following code sn...
data table; set table; length state_full $8; if state = 'KS' then state_full = 'Kansas'; else if state = 'CO' then state_full = 'Colorado'; else state_full = 'Other'; run;

Page 640 of 826