MySQL 5.7 comes with a native JSON data type and a set of built-in functions to manipulate values of the JSON type. This document demonstrates the usage.
-- raw json
INSERT INTO json_test
(name, attributes)
VALUES (| function calculate_median($arr) { | |
| $count = count($arr); //total numbers in array | |
| $middleval = floor(($count-1)/2); // find the middle value, or the lowest middle value | |
| if($count % 2) { // odd number, middle is the median | |
| $median = $arr[$middleval]; | |
| } else { // even number, calculate avg of 2 medians | |
| $low = $arr[$middleval]; | |
| $high = $arr[$middleval+1]; | |
| $median = (($low+$high)/2); | |
| } |
| adb_enabled=1 | |
| airplane_mode_on=0 | |
| airplane_mode_radios=cell,bluetooth,wifi,nfc,wimax | |
| airplane_mode_toggleable_radios=bluetooth,wifi,nfc | |
| assisted_gps_enabled=1 | |
| audio_safe_volume_state=1 | |
| auto_time=1 | |
| auto_time_zone=1 | |
| bluetooth_on=1 | |
| bugreport_in_power_menu=0 |
| #!/bin/bash | |
| # === INFO === | |
| # NoVPN | |
| # Description: Bypass VPN tunnel for applications run through this tool. | |
| VERSION="3.0.0" | |
| # Author: KrisWebDev | |
| # Requirements: Linux with kernel > 2.6.4 (released in 2008). | |
| # This version is tested on Ubuntu 14.04 and 19.10 with bash. | |
| # Main dependencies are automatically installed. |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
| function grabVideo(quality=0, audioEnable=false){ | |
| if( activatedPreview == true){log("activeated preview return");return;} | |
| activatedPreview = true; | |
| log(quality); | |
| log("trying with quality:"); | |
| var audioSelect = document.querySelector('select#audioSource'); | |
| var videoSelect = document.querySelector('select#videoSource'); | |
| var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> | |
| <title>Test Page</title> | |
| <script> | |
| // early compute the vw/vh units more reliably than CSS does itself | |
| computeViewportDimensions(); |
| <?php | |
| // the function reads the comment added after the function is called using a backtrace and uses them as arguments | |
| function add(): float | |
| { | |
| $trace = debug_backtrace(); | |
| $file = $trace[0]['file']; | |
| $line = $trace[0]['line']; | |
| $content = file($file); |