Posted
on January 25, 2017, 4:46 pm,
by admin,
under
mysql.
CREATE DEFINER=`root`@`localhost` PROCEDURE `Sample`(IN inParameterID VARCHAR(10))
Sample:BEGIN
DECLARE httpStatus INT DEFAULT 500;
DECLARE errorCode INT DEFAULT NULL;
DECLARE errorDetails TEXT DEFAULT NULL;
DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING
BEGIN
ROLLBACK;
SELECT 500 AS statusCode, 'Failed' AS statusMessage;
END;
SET @variableID = 0;
SELECT TableA.ID INTO @variableID
FROM TableA
WHERE TableA.ParameterID = inParameterID;
IF @variableID = 0 THEN
SELECT 500 AS errorCode, 'Transaction failed' AS errorMessage;
LEAVE T2activatePersonStandby;
END IF;
START TRANSACTION;
UPDATE TableA;
UPDATE TableB;
UPDATE TableC;
END IF;
COMMIT;
SELECT 200 AS statusCode, 'Success' AS statusMessage;
END |
Posted
on January 25, 2017, 2:40 pm,
by admin,
under
php.
How-to add namespaces to old php project
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
Simple project with namespaces
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
Posted
on January 25, 2017, 2:39 pm,
by admin,
under
tips.
Bitbucket is good for free private repos
Github is good for free public repos, for demonstration of your work
Posted
on January 5, 2017, 9:40 am,
by admin,
under
php.
A Strategy pattern is an operational pattern. Strategy pattern allows you to polymorphically change behavior of a class. Strategy pattern is to avoid conditionals switching in favor of polymorphism.
So, Strategy pattern = polymorphism.
A Factory pattern is a creational pattern. Factory pattern allows you to encapsulate object creation.
Factory pattern = encapsulation.
A difference between Simple Factory and Abstract Factory. Simple Factory – you only have one class which acts as a factory for object creation. Abstract Factory – you connect to an interface and then call the different factories that implement this interface which are supposed to have different implementations of the same method based on some criteria.
Abstract Factory looks like a strategy pattern, but it differs from it semantically because it is used for OBJECT CREATION rather than operations. So, basically you have object creation using different strategies.
Posted
on November 7, 2016, 11:09 am,
by admin,
under
php.
Class names MUST be declared in StudlyCaps.
Class constants MUST be declared in all UPPER_CASE with underscore separators.
Method names MUST be declared in camelCase.
Posted
on October 5, 2016, 4:22 pm,
by admin,
under
linux.
/msnp24
simply need to cope and past to someone that is not online
in the chat then restart the skype and you are done
Posted
on October 2, 2016, 10:30 pm,
by admin,
under
php.
<?php
$transport = \Swift_SmtpTransport::newInstance('smtp.gmail.com',465)
->setUsername('yourusername@yourdomain.com')
->setPassword('yourpassword')
->setEncryption('ssl')
->setAuthMode('login');
$mailer = \Swift_Mailer::newInstance($transport);
$message = \Swift_Message::newInstance()
->setSubject('Welcome')
->setFrom(array('yourusername@yourdomain.com'))
->setTo(array('to@to.com'))
->setBody('hello world')
->setContentType("text/plain");
$mailer->send($message); |
Posted
on September 19, 2016, 2:05 pm,
by admin,
under
git.
1. git reflog | grep pp-auth-r1.1
response: 592b75b
2. git branch 2.7.4-69179 592b75b |
Posted
on September 18, 2016, 10:43 pm,
by admin,
under
php.
1. A bootstrap (app/bootstrap.php) and application file (app/app.php) which could be used by my frontend controller, as well as by PHPUnit/Codeception
2. A web directory that is accessible for the world, containing only index.php and possibly some resources web/index.php
Posted
on September 1, 2016, 11:31 am,
by admin,
under
linux.
saves configuration to: /home/imran/.config/autostart/lxrandr.desktop
sample:
[Desktop Entry]
Type=Application
Exec=xrandr --output HDMI1 --mode 1920x1080 --rate 60.00 --output eDP1 --mode 1920x1080 --rate 60.00 --left-of HDMI1
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_GB]=LXRandR
Name=LXRandR
Comment[en_GB]=To keep laptop on the left handside with monitor in the center
Comment=To keep laptop on the left handside with monitor in the center
imran@imran-Lenovo-Z51-70:~/.config/autostart$ |