Quantcast
Channel: Cheng's Blog
Browsing all 10 articles
Browse latest View live

JavaScript what happens when newing an object

Found a great SO post on this topic: When the [[Construct]] property for a Function object F is called, the following steps are taken: Create a new native ECMAScript object. Set the [[Class]] property...

View Article



Django CSRF cookie not set

I have actually found a bug in Django: Here is the issue: You cannot have a cookie which key contains either the character '[' or ']' I discovered the solution following @Todor's link, then I found out...

View Article

Install Python3 and virtualenv on Mac

Install Python3 Install brew: http://brew.sh/ Install Python3 via brew: brew install python3 Vertify Python3 is installed: which python3 (should be located at: /usr/local/Cellar/python3/) Install...

View Article

Matplotlib display Chinese characters

When I was trying to use Chinese characters for a chart's title, matplotlib displayed a bunch of squares. Here are the steps to solve it. Step 1: Find matplotlibrc I am using virtualenv, so for me the...

View Article

Python3's pass more than one parameter to lambda function

I was trying to do this in Python 3: t = {'1': 1, '2':2} #Trying to sort the dictionary t by its value sorted(t.items(), key=lambda (k,v): v, # the left bracket raises syntax error, it works in python...

View Article


Pandas selecting rows and columns

The behavior of passing an integer, string, slicing, list of integers, list of strings to a DataFrame: df[0] # error df['col_0'] # A Series of col_0 # The following behaviors are downright confusing...

View Article

How to install MySQL on MacOS

Download from .DMG file from the official MySQL site Doulbe click the .DMG file and follow the install instruction, at the end of the installation, take note of the pop up window that shows your root...

View Article

优化Shadowsocks速度

选择Ubutu 14.04版本。配置完youtube可以保证720p。 1) 更新OS: sudo apt-get update && sudo apt-get upgrade -y 2) 安装SS apt-get install python-pip pip install shadowsocks 3) 创建SS的配置文件, 该文件可以放在任何地方,一般放在 /etc/...

View Article


在Windows10里使用Airpods

如果你的电脑没有蓝牙接收器,购买一个USB蓝牙接收器 保证Airpods在充电盒内,打开盖子,长按盒子后面的按钮,看到指示灯是白色的闪烁状态 下载这个蓝牙驱动(否则连接上后无法通过Airpod说话,只能听声音):https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/h1bn01ww.exe 在Windows设置里找到 设备 》 蓝牙 ,...

View Article


How to make decisions

Wise words from Abraham J. Twerski:https://www.youtube.com/watch?v=vn2twFwjNQE Summary: we are not going to always make the right decision Decisions have to be made with integrity Our desires color our...

View Article
Browsing all 10 articles
Browse latest View live




Latest Images