Blog Spot!


Insert into a MySQL table or update if exists

Use INSERT ... ON DUPLICATE KEY UPDATE

Query:

INSERT INTO table (id, name, age) VALUES(1, "A", 19) ON DUPLICATE KEY UPDATE name = "A", age = 19

stackoverflow

Added on 24.Feb.2016
Tags: sql mysql exists duplicate indert

Terminal Command To Get Geeky Weather Reports

Weather Reports

curl -4 http://wttr.in/CityName

Help

curl -4 http://wttr.in/:help

fossbytes

Added on 22.Feb.2016
Tags: weather terminal fun

Test website RPS (requests per second)

How to benchmark your server.

Install apache2-utils

$ sudo apt-get install apache2-utils

Example test:

$ ab -kc 1000 -n 10000 http://www.some-site.cc/tmp/index.php
  • k Use HTTP KeepAlive feature
  • c concurrency Number of multiple requests to make at a time
  • n requests Number of requests to perform

package
benchmark

Added on 19.Feb.2016
Tags: test apache request responce ab rps

PDO Tutorial for MySQL Developers

Added on 18.Feb.2016
Tags: php mysql pdo database tutorial

Test for Empty Values in Javascript

Our JavaScript function is far more precise about what kinds of data can be considered empty:

  • undefined or null
  • a zero-length string
  • an array with no members
  • an object with no enumerable properties
function isEmpty(data) {
    if (typeof(data) == 'number' || typeof(data) == 'boolean') { 
        return false; 
    }

    if (typeof(data) == 'undefined' || data === null) {
        return true; 
    }

    if (typeof(data.length) != 'undefined') {
        return data.length === 0;
    }

    var count = 0, i;
    for (i in data) {

        if(data.hasOwnProperty(i)) {
            count ++;
        }
    }

    return count === 0;
}

sitepoint

Added on 10.Feb.2016
Tags: js function empty

Search


PHP Libraries


Carbon lib / docs
Idiorm lib / docs
Image Workshop lib / docs
lorenzos/Minixed lib / docs
Parsedown lib / docs
PHP Paginator lib / docs
PHP Redis lib / docs
QrCode lib / docs
Requests lib / docs
Slim lib / docs
Spyc lib / docs
TWIG lib / docs
Upload lib / docs
Validation lib / docs
Zebra Image lib / docs

JS Libraries


AJV lib / docs
BackboneJS lib / docs
Bootstrap Notify lib / docs
C3.js lib / docs
ChartJS lib / docs
FastMD5 lib / docs
HighlightJS lib / docs
jQuery-Storage lib / docs
JS-Cookie lib / docs
Leaflet JS lib / docs
LowDB lib / docs
Marked lib / docs
NeedlyJS lib / docs
ParcelJS lib / docs
RequireJS lib / docs
Swig lib / docs
Toastr lib / docs
Underscore lib / docs
ValidateJS lib / docs
top