Skip to main content

Posts

Showing posts from 2015

mysql 2

mysqldump --extended-insert=FALSE Export tất cả rows trong table trong 1 lệnh insert. Dư này thì import nhanh hơn. Nhưng cũng có hạn chế khi edit (manipulate) vd như dump postgresql => mysql cần phải edit 1 chút. ... Ctrl+shift+V (bỏ format text). phpMyAdmin: When export > custom > ∞ insert multiple rows in every INSERT statement       Example: INSERT INTO tbl_name VALUES (1,2,3), (4,5,6), (7,8,9) ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci; ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci; Nhắc lại thao tác / command line: bên windows bash -> select columns là default, bên linux giữ ctrl + mouse. Unicode suck in cmd (git-bash) windows. ? Trên linux (ub 15.04) thì tươi, chạy rất nhanh lúc import dù là insert seperated. => liệu có phải do unicode hay 1 cái j đó mà command line / win oẳng ? Chạy rất lag, kể cả phpMyAdmin ?

PHP Google API - Calendar

http://livingcode.co/index.php/tag/one-time-authorization-code/ http://martinfowler.com/articles/command-line-google.html New API doc here: https://developers.google.com/api-client-library/php/auth/web-app library: https://github.com/google/google-api-php-client index.php <?php // require_once 'google-api-php-client/autoload.php'; require_once 'google-api-php-client/src/Google/autoload.php'; session_start(); $client = new Google_Client(); $client->setAuthConfigFile('client_secrets.json'); $client->setAccessType("offline"); $client->addScope(Google_Service_Calendar::CALENDAR); if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {   $client->setAccessToken($_SESSION['access_token']);   // echo $client->getAccessToken();   $cal = new Google_Service_Calendar($client); $params = array( //CAN'T USE TIME MIN WITHOUT SINGLEEVENTS TURNED ON, //IT SAYS TO TREA...

Laravel

Flash messages: @if ( Session :: has ( 'message' )) < p class = "alert {{ Session::get('alert-class', 'alert-info') }}" >{{ Session :: get ( 'message' ) }}</ p > @endif Session :: flash ( 'message' , 'This is a message!' ); Session :: flash ( 'alert-class' , 'alert-danger' ); may be \Session if u don't want use in header; \Input::get() both post or get. y ? return \Redirect::back(); https://laraveltips.wordpress.com/2015/06/16/setting-up-a-forgot-password-form-and-controller-in-laravel-5-1/ https://github.com/FIF/cropzoom_laravel_jibjab/blob/master/app/controllers/YoutubeController.php

Ubuntu Server Mail

Some notes when setting ubuntu mail server: guides: 1. Main guide post: https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and-mysql 2. other post to understand types and how to setting mail server: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-14-04 http://askubuntu.com/questions/47609/how-to-have-my-php-send-mail List popular MTA and MDA on ubuntu: https://help.ubuntu.com/community/MailServer Automatic tool on github https://github.com/mail-in-a-box Steps: Install postfix (MTA - mail transfer agent) dovecot (a simple MDA - mail deliver agent) sudo apt-get install libsasl2-2 libsasl2-modules sasl2-bin :) Here I'm simulate funny message when King Philip II of Macedon to Thrace: "If I win this war, you will be slaves forever." And You (Thrace) will reply: "If" PHP requires an SMTP client to send mail. You could install a full-featu...