Emoji data in MySQL

Supported MySQL 5.5, 5.6. First, MySQL should set DB and table to utf8mb4. utf8 - 3 byte characters utf8mb4 - 4 byte characters ALTER DATABASE my_database DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; ALTER TABLE my_table DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE my_column CHANGE my_column my_column TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; Then, when inserting data or selecting data, execute this statement first: --Execute this statement first SET NAMES utf8mb4; --then insert or select SELECT * FROM my_table

Continue reading

nodejs v0.10.25 (for rails javascript engine) rbenv 0.4.0-98-g13a474c ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] Rails 4.1.4 nginx version: nginx/1.6.0 Phusion Passenger version 4.0.48 mysql Ver 14.14 Distrib 5.5.38, for debian-linux-gnu (x86_64) using readline 6.3 Installing Ruby & Rails sudo apt-get update && sudo apt-get upgrade sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties nodejs npm Use rbenv cd git clone git://github.

Continue reading

將 query 出來的多筆記錄結合成一個欄位 例如原本的 query 結果為: SELECT 'fruits' FROM 'fruits_table' apple banana kiwi SELECT group_concat('fruits' separator ',') FROM 'fruits_table' result: apple,banana,kiwi 改變 datetime 欄位的顯示結果 SELECT DATE_FORMAT( 'created_at', '%Y/%m/%d %H:%i') AS 'created_at' FROM 'message_table' result: 2014/05/06 18:20 若某個欄位的值為空,則給予預設值 SELECT ifnull('is_success', 0) AS 'is_success' FROM ....

Continue reading

RVM with Ruby2.0.0-p353 + Rails4.0.2 + Ubuntu12.04(precise64) + php-fpm by Vagrant(clean install) p.s. If you don’t use RVM, you can just follow the instruction from Passenger offcial website. It will be easier. Plus, I installed all these things by Vagrant. First thing to do $ sudo apt-get update $ sudo apt-get upgrade Pre-setup: install necessary packages $ sudo apt-get update $ sudo apt-get install build-essential libssl-dev libpcre3-dev libncurses5-dev libreadline6-dev git vim curl libcurl4-openssl-dev libreadline6 autoconf openssl git-core zlib1g zlib1g-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libgdbm-dev libncurses5-dev automake libtool bison subversion pkg-config libffi-dev Get .

Continue reading

Author's picture


Cat lover <3

Backend Engineer