Blog Spot!


PHP Database Access: Are You Doing It Correctly?

PDO, or PHP Data Objects, provides a more powerful API that doesn't care about the driver you use; it's database agnostic. Further, it offers the ability to use prepared statements, virtually eliminating any worry of SQL injection.

tutsplus

Added on 12.Dec.2015
Tags: mysql pdo php tutorial

Convert form data to JavaScript object with jQuery

serializeArray already does exactly that. You just need to massage the data into your required format:

$.fn.serializeObject = function()
{
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
        if (o[this.name] !== undefined) {
            if (!o[this.name].push) {
                o[this.name] = [o[this.name]];
            }
            o[this.name].push(this.value || '');
        } else {
            o[this.name] = this.value || '';
        }
    });
    return o;
};

stackoverflow

Added on 09.Dec.2015
Tags: jquery js plugin json

Cross browser detection tab or window is active

// check if browser window has focus        
var notIE = (document.documentMode === undefined),
    isChromium = window.chrome;

if (notIE && !isChromium) {

    // checks for Firefox and other NON IE Chrome versions
    $(window).on("focus", function() { 
        // tween resume() code goes here
        setTimeout(function(){            
            console.log("focus");
        },300);

    }).on("blur", function() {
        // tween pause() code goes here
        console.log("blur");
    });

} else {

    // checks for IE and Chromium versions
    if (window.addEventListener) {

        // bind focus event
        window.addEventListener("focus", function(event) {
            // tween resume() code goes here
            setTimeout(function(){                 
                 console.log("focus");
            }, 300);
        }, false);

        // bind blur event
        window.addEventListener("blur", function(event) {
            // tween pause() code goes here
             console.log("blur");
        }, false);

    } else {

        // bind focus event
        window.attachEvent("focus", function(event) {
            // tween resume() code goes here
            setTimeout(function(){                 
                 console.log("focus");
            }, 300);
        });

        // bind focus event
        window.attachEvent("blur", function(event) {
            // tween pause() code goes here
            console.log("blur");
        });
    }
}

Added on 07.Dec.2015
Tags: focus blur active tab js javascript

How to disable apache2 server from auto starting upon boot up

Works in Ubuntu based systems.

You should disable them using either systemctl (if you're using systemd) or update-rc.d:

systemctl disable apache2 mysql

or

update-rc.d apache2 disable
update-rc.d mysql disable

stackexchange

Warning! This will REMOVE the service!

sudo update-rc.d -f  apache2 remove
sudo update-rc.d -f  mysql remove

askubuntu

Added on 02.Dec.2015
Tags: apache2 mysql disable boot startup autostart

5 Beautiful Icon Themes for Linux

One of my favorite things about Linux is customization. There are many ways to customize it, and the most interesting of them all is the icons. Though they don’t change your entire interface, they can change the way you see your desktop. Icons make you feel at home, and no theme feels quite as complete without them.

How to install icon themes

Icon themes can be installed in two ways. You can install your icons to the system directory, effectively making your icon theme accessible to every user on the system. Alternatively, it’s possible to just enable it for one user only.

Download an icon theme of your choice and extract the files inside the archive. For instance, if you’ve chosen to download Dalisha (see the link below), you’d be extracting “Dalisha_2_2.tar.gz”. Once extracted, a folder will appear (in this case it’s called Dalisha). Open a terminal window and enter the command(s) below to install the icon themes.

Installing systemwide

sudo mv /path/to/icon/theme/folder/ /usr/share/icons/ -r

Installing for one user

mv /path/to/icon/theme/folder/ ~/.icons -r
  • Remember to change the filepath to where you have extracted the icon theme archive.

Once the theme has been installed, enable the icon theme inside your desktop environment with the DE’s own configuration tool. Or, using your tool of choice. If you are not sure what tool to use, check out Gnome Tweak Tool (it works with most GTK desktops). If you’re on KDE, just open the KDE application menu and search icons. It should be pretty straight-forward.

Now, check out some of the beautiful icon themes below.

5-beautiful-icon-themes-for-linux

Extra:

Added on 01.Dec.2015
Tags: linux icons

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