Posted
on November 17, 2015, 12:06 pm,
by admin,
under
laravel.
<?php
dd(\DB::getQueryLog()); |
Posted
on November 17, 2015, 12:05 pm,
by admin,
under
php.
<?php
error_reporting(-1);
ini_set('display_errors', 'On'); |
Posted
on November 16, 2015, 5:58 am,
by admin,
under
php,
tips.
1. Objects should be passed by reference always, arrays and scalars are passed by value.
2. If you are working on a very large array and plan on modifying it inside a function, you actually should use a reference to prevent it from getting copied, which can seriously decrease performance or even exhaust your memory limit.
3. If it is avoidable though (that is small arrays or scalar values), I’d always use functional-style approach with no side-effects, because as soon as you pass something by reference, you can never be sure what passed variable may hold after the function call, which sometimes can lead to nasty and hard-to-find bugs.
4. Scalar values should never be passed by reference, because the performance impact can not be that big as to justify the loss of transparency in your code.
Posted
on November 15, 2015, 9:41 am,
by admin,
under
git.
git checkout new-master
git branch -m master old-master
git branch -m new-master master |
Posted
on November 13, 2015, 1:17 pm,
by admin,
under
laravel.
php artisan migrate
php artisan migrate:rollback |
Posted
on November 11, 2015, 6:58 am,
by admin,
under
bash,
linux.
Use convert utility from ImageMagick package
/usr/bin/convert *.jpg result.pdf |
Posted
on November 10, 2015, 7:06 am,
by admin,
under
yii.
To make the following url work: http://www.website.com/green-juice
add the following rule to config/web.php
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'green-juice'=>'green/say',
]
] |
Posted
on November 10, 2015, 6:41 am,
by admin,
under
yii.
Edit file config/web.php
Add the following to the ‘components’ array:
'components' => [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
] |
Posted
on October 29, 2015, 8:21 am,
by admin,
under
apache.
1.
ls -ltr /etc/apache2/mods-enabled/ssl.load; ls -ltr /etc/apache2/mods-enabled/ssl.conf |
result: not found
2. sudo a2enmod ssl
3.
ls -ltr /etc/apache2/mods-enabled/ssl.load; ls -ltr /etc/apache2/mods-enabled/ssl.conf |
result: created
Posted
on October 26, 2015, 2:58 pm,
by admin,
under
php.
<?php
$start = (float) array_sum(explode(' ',microtime()));
// PHP Database Business Logic
$end = (float) array_sum(explode(' ',microtime()));
print "Processing time: ". sprintf("%.4f", ($end-$start))." seconds."; |