See linux-commands-for-setting-up-lamp-on-ubuntu-1604-mint18.sh for how to set up apache, mysql and php
- Apache
- Atom
- Bleachbit
- Curl
- Composer
- Dbeaver
- Disk Usage Analyzer
- Gimp
- Git
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge |
<?php | |
ini_set('memory_limit', '1024M'); | |
function test(){ | |
$index = 0; | |
//Case 1 | |
$a = ''; |
wget --wait=20 --mirror --convert-links --page-requisites --no-parent -U Mozilla http://www.website.com/ | |
# OR | |
wget --wait=20 --mirror --convert-links --adjust-extension --page-requisites --no-parent -U Mozilla http://www.website.com/ |
<?php | |
$url = 'http://some-server.com/some-file.xml'; | |
$simplexmlelement_obj = simplexml_load_file($url); | |
$array_of_objects_from_xml = array(); | |
if ($simplexmlelement_obj !== false) { | |
$xml_as_json = json_encode($simplexmlelement_obj); | |
$array_of_objects_from_xml = json_decode($xml_as_json); |
<?php | |
//This isset optimization is not suitable for arrays that contains null values. | |
/* | |
$a = array('a' => null); | |
isset($a['a']); // Will be FALSE | |
array_key_exists('a', $a); // Will be TRUE | |
*/ | |
$total = 10000; | |
$paragraph = 'this is a sentence. Crud! $$$$!'; |
<?php | |
function register($user, $password) { | |
$hash = password_hash($password, PASSWORD_BCRYPT); | |
$this->store($user, $hash); | |
} | |
function login($user, $password) { | |
$hash = $this->fetchHash($user); |
MySQL NULLs I say almost any database because MySQL has an odd quirk. NULL is treated as a unique value — which is why you cannot use comparisons such as value = NULL and need to use value IS NULL. Unfortunately, this also affects unique indexes and no logic has been implemented to fix it.
We can execute our original INSERT multiple times and a new record will be created each time because the extension field defaults to NULL and is considered to be unique:
INSERT INTO phone
(country
, area
, number
)
(1, 234, 567890);
<?php | |
//////////////////////////////// | |
/// Generate Call Trace Info /// | |
//////////////////////////////// | |
$backtrace = debug_backtrace(~DEBUG_BACKTRACE_PROVIDE_OBJECT); | |
$backtrace_start_index = 1; //index to start reading from in the | |
//array returned by debug_backtrace | |
$class = "[\n"; |
Remove spaces after last semi colon on each line of a php file. | |
find: | |
;[^\S\n]+$ | |
relace with: | |
; | |
--------------------------------------------------------------------------------------- | |
Remove spaces on blank lines | |
find: | |
^[^\S]+$ | |
replace with: |