LacticAcid's blog

Hope never dies.


  • Home

  • Tags

  • Archives

  • About

Deploy Application on Amazon EC2

Posted on 2018-08-21 | Post modified: 2018-08-22 | Visitors:
Words count in article:

Amazon EC2

Elastic Compute Cloud (EC2) : EC2 allows scalable deployment of applications by providing a Web service through which a user can boot an Amazon Machine Image to create a virtual machine, which Amazon calls an “instance”, containing any software desired. A user can create, launch, and terminate server instances as needed, paying by the hour for active servers, hence the term “elastic”.

Read more »

Fix MySQL error(sql_mode=only_full_group_by)

Posted on 2018-08-17 | Post modified: 2018-08-17 | Visitors:
Words count in article:

Problem: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘informat

1. Description

Environment: MAMP

MySQL version: 5.7.21

2. Solution

By default, the OS X installation does not use a my.cnf, and MySQL just uses the default values. To set up your own my.cnf, you could just create this file. Thus, do as followed:

a. Create my.cnf under /Application/MAMP/conf

b. Add configuration in my.cnf:

1
2
3
[mysqld]

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

3. Reference

(1) Mac 的mysql5.7没有配置文件,如何解决only_full_group_by 问题

(2) does-mysql-included-with-mamp-not-include-a-config-file

(3) how-can-set-sql-mode-permanently-on-my-mac

Access MAMP's mysql from command

Posted on 2018-08-12 | Post modified: 2018-08-12 | Visitors:
Words count in article:

Access MAMP’s mysql from command

reference

If you just want to type:

1
mysql -u Username -p

You can create an alias in your ~/.bash_profile in older OSX versions this file was called ~/.profile so best check first with:

1
ls -la ~/

If one of those files exist, edit that file. Else, create a new one with what ever editor you like (here I do it with nano and have a ~/.bash_profile file):

1
sudo nano ~/.bash_profile

insert following line:

1
alias mysql=/Applications/MAMP/Library/bin/mysql

Save the file and quit nano with CTRL + X and then type Y and enter

Then you need to type:

1
source ~/.bash_profile

Now you can use:

1
mysql -u root -p

JavaScript-Browser

Posted on 2018-07-18 | Post modified: 2018-07-18 | Visitors:
Words count in article:

Browser Object

1. window

2. navigator

JavaScript-OOP

Posted on 2018-07-17 | Post modified: 2018-08-12 | Visitors:
Words count in article:

OOP

1. Basic Ideas

  • JavaScript不区分类和实例的概念,而是通过原型(prototype)来实现面向对象编程。
  • JavaScript的原型链和Java的Class区别就在,它没有“Class”的概念,所有对象都是实例,所谓继承关系不过是把一个对象的原型指向另一个对象而已。
  • 在JavaScrip代码运行时期,你可以把一个对象从A变成B,或者变成任何对象。
  • 在编写JavaScript代码时,不要直接用obj.__proto__去改变一个对象的原型。
  • Object.create()方法可以传入一个原型对象,并创建一个基于该原型的新对象,但是新对象什么属性都没有
Read more »

Js-study-notes-closure

Posted on 2018-07-17 | Post modified: 2018-07-17 | Visitors:
Words count in article:

Closure

1
2


注意这里用了一个“创建一个匿名函数并立刻执行”的语法:

1
2
3
(function (x) {
return x * x;
})(3); // 9

JS study notes-map/reduce

Posted on 2018-07-14 | Post modified: 2018-07-17 | Visitors:
Words count in article:

Map/Reduce

1. map

For example, there is a function f(x) = x * x. If you want to call this function on every element in an array, you can use map():

1
2
3
4
5
6
7
8
9
'use strict';

function pow(x) {
return x * x;
}

var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var results = arr.map(pow); // [1, 4, 9, 16, 25, 36, 49, 64, 81]
console.log(results);

Other example:

1
2
3
4
// transfer the numbers in an array to string

var arr = [1,2,3,4,5,6,7,8,9];
arr.map(String); // ['1', '2', '3', '4', '5', '6', '7', '8', '9']

More info: reference on Mozilla

Read more »

JS Study Notes

Posted on 2018-07-14 | Post modified: 2018-07-14 | Visitors:
Words count in article:

Some JS Basic ideas

1. Usually wrapped by head tag

2. Tag semantics:

1
2
3
<script>
alert('Hello World!');
</script>

you can also use an external JS file to store your JS codes:

1
<script src=url></script>

3. Sentences are ended by ‘;’

4. Comment Usage:

1
2
3
4
/*
This is a comment!
*/
//This is also a comment!

My first post

Posted on 2018-07-13 | Post modified: 2018-07-13 | Visitors:
Words count in article:

Today is my third day of intern and also my mom’s birthday!!!

朋友圈看到个解决国外使用网易云音乐时因为版权听不了很多歌曲的办法:

1
2
3
4
5
6
7
8
9
10
Mac:
打开终端,sudo vi /etc/hosts ,然后将以下添加进文件末尾
158.199.142.239 music.163.com p1.music.126.net
p2.music.126.net p3.music.126.net p4.music.126.net

Windows: 打开命令提示符(管理员权限),执行该命令:
echo 158.199.142.239 music.163.com
p1.music.126.net p2.music.126.net
p3.music.126.net p4.music.126.net >>
C:\WINDOWS\System32\drivers\etc\hosts

Hello World

Posted on 2018-07-13 | Post modified: 2018-07-13 | Visitors:
Words count in article:

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

LacticAcidCYC

LacticAcidCYC

10 posts
1 tags
© 2018 LacticAcidCYC | Site words total count:
Theme — NexT.Muse
0%