Tutorial by Examples: c

%f is the fractional precision format specifier for the DATE_FORMAT() function. SELECT DATE_FORMAT(NOW(3), '%Y-%m-%d %H:%i:%s.%f') displays a value like 2016-11-19 09:52:53.248000 with fractional microseconds. Because we used NOW(3), the final three digits in the fraction are 0.
If you have a Javascript timestamp value, for example 1478960868932, you can convert that to a MySQL fractional time value like this: FROM_UNIXTIME(1478960868932 * 0.001) It's simple to use that kind of expression to store your Javascript timestamp into a MySQL table. Do this: INSERT INTO table...
authenticate_with_http_token do |token, options| @user = User.find_by(auth_token: token) end You can test this endpoint with curl by making a request like curl -IH "Authorization: Token token=my-token" http://localhost:3000
Here's an example of a React component with a "managed" input field. Whenever the value of the input field changes, an event handler is called which updates the state of the component with the new value of the input field. The call to setState in the event handler will trigger a call to ...
For a non-main packages as well as main, instead of adding flags inside the code, write benchmarks in the test package , for example: func BenchmarkHello(b *testing.B) { for i := 0; i < b.N; i++ { fmt.Sprintf("hello") } } Then run the test with the profile flag ...
once a prof file has been generated, one can access the prof file using go tools: go tool pprof cpu.prof This will enter into a command line interface for exploring the profile Common commands include: (pprof) top lists top processes in memory (pprof) peek Lists all processes, use reg...
var gulp = require('gulp'); // include plug-ins var uglify = require('gulp-uglify'), concat = require('gulp-concat'); // Minified file gulp.task('packjsMin', function() { return gulp.src('node_modules/angular/*.js') .pipe(concat('script.js')) .pipe(uglify()) .p...
There are a few ways to setup a local copy of your Shopify theme: Node.js ( gulp/grunt ) Ruby Theme App ( Mac only ) There might be a few other ways, but I found the ruby way the most easy to work with. In order to work locally on the Shopify theme files you will need a few things: Ruby ...
You can use docker, without using docker daemon (engine), by using cloud providers. In this example, you should have a gcloud (Google Cloud util), that connected to your account docker-machine create --driver google --google-project `your-project-name` google-machine-type f1-large fm02 This exa...
grant all privileges on schema_name.* to 'new_user_name'@'%' identified by 'newpassword'; Attention: This can be used to create new root user
Given an m times n matrix A with n larger than m. The singular value decomposition [U,S,V] = svd(A); computes the matrices U,S,V. The matrix U consists of the left singular eigenvectors which are the eigenvectors of A*A.' while V consists of the right singular eigenvalues which are the eigenvec...
You might receive from your peer private key in PPK format, which seems it does not work in OpenSSH (command-line ssh). The client will be asking for the passphrase, because of OpenSSH bug. $ ssh -i mykey.ppk example.com Enter passphrase for mykey.ppk: You need to convert the key to OpenSSH for...
Visual Basic.NET, like most languages, permits recursion, a process by which a function calls itself under certain conditions. Here is a basic function in Visual Basic .NET to compute Fibonacci numbers. ''' <summary> ''' Gets the n'th Fibonacci number ''' </summary> ''' <param na...
Template Generic Syntax template<typename T> void f(ParamType param); f(expr); Case 1: ParamType is a Reference or Pointer, but not a Universal or Forward Reference. In this case type deduction works this way. The compiler ignores the reference part if it exists in expr. The compiler t...
C++11 Type deduction using the auto keyword works almost the same as Template Type Deduction. Below are a few examples: auto x = 27; // (x is neither a pointer nor a reference), x's type is int const auto cx = x; // (cx is neither a pointer nor a reference), cs's type is const int ...
request variables form url cgi
Server Application Session
variables this local arguments
attributes thisTag caller
This function shortens the text to a specified number of words and returns the shortened text. <?php echo wp_trim_words( get_the_content(), 40, '...' ); ?> In the above example we are passing the post content to the function. It will restrict the length of the content to 40 words and will ...

Page 639 of 826