- 在Windows设置里找到 设备 》 蓝牙 ， 然后右键点击Airppods选择连接
- 连接成功后在Windows开始栏右下角的喇叭上点击左键，然后在下拉菜单里选择 “耳机（蓝牙音频）”，这个时候调试声音大小就应该可以从Airpods里听到声音了
- 右键点击Windows开始栏右下角的喇叭，选择“录音设备”，应该可以看到 “耳机式麦克风”有个绿色的对勾，在它上面点击右键 》 配置语音识别 》 设置麦克风 》 头戴式麦克风 》 下一步 》 阅读一段话调整音量 （不做这个设置的话，你直接去录音应用里可能会听不到声音）
3) 创建SS的配置文件, 该文件可以放在任何地方，一般放在
rc.local 确保哪怕重启fast tcp open也有效：
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 password
Once installed, open
MySQLand click on
Start MySQL Server
Terminal, and enter
mysqlsee if it gives you an error, if it did, enter the following:
mysql -u root -p, press enter, then enter the default password you wrote down in step #2
Once you are in the mysql command prompt, enter the following to change your default password for the root account and prevent it from expiring:
- still in the mysql command prompt, create a database so that you can play with:
P.S. If you prefer to use a GUI to interact with MySQL on MacOS, download Sequel Pro (it is FREE)
The behavior of passing an integer, string, slicing, list of integers, list of strings to a DataFrame:
If a slicing or a list is passed, a DataFrame object is returned
- If a slicing is passed, a DataFrame of rows are returned
- If a list is passed, a DataFrame of cols are turned
If a String is passed, a Series of a column is returned
I was trying to do this in Python 3:
It turns out that in Python 3, tuple parameter unpacking is not supported anymore.
So if more than one parameter is passed into a lambda function, we have to access it like a list:
So for the issues I have, the correct code would be:
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 path is:
The key part is /lib/python3.5/site-packages/matplotlib/mpl-data
Step 2: Modify matplotlibrc
font.sans-serif, then add the following fonts before
Bitstream Vera Sans:
PingFang SC, Hiragino Sans GB, Microsoft YaHei,
It should look like this:
If you have a
ipyton notebook open, you have to close and reopen it to make this change effective. Otherwise this is it :D
- 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 virtualenv and virtualenvwrapper
- pip3 install virtualenv virtualenvwrapper
- create a fold to store all of the virtual environments:
`3. setup virtualenvwrapper by putting the following into .bash_profile:
Then run .bash_profile to reflect the chagnes:
Now everythiing should be set to go:
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 about this SO post. Basically there was a bug in python 2.7.x that does not parse cookies with ']' in the value. The bug was fixed in 2.7.10.
I thought it would be good to just confirm this issue. So I dug through all of the cookies and found one with the following key/value:
So I inserted the following cookie locally and submitted to the server:
The login page worked, which means 2.7.10 indeed fixed the bug.
But then I realized that the square brackets are actually in the key name not in the value, so I did the following tests:
Both cookies break the login process and django displays:
If a invalid cookie comes before the
csrftoken cookie in the
Cookie field of the http request header, then Django will ignore everything after the invalid cookie, which makes Django think that the
CSRF cookie is not set
I filed a bug report to Django. This bug is fixed in version 1.10 so make sure you update Django when 1.10 is released.
Found a great SO post on this topic:
[[Construct]] property for a
F is called, the following steps are taken:
- Create a new native ECMAScript object.
- Set the
- Get the value of the prototype property of
Result(3)is an object, set the
Result(3)is not an object, set the
Result(1)to the orig
inalObject` prototype object as described in 126.96.36.199.
- Invoke the
[[Call]]property of F, providing
Result(1)as the this value and providing the argument list passed into
[[Construct]]as the argument values.
Type(Result(6))is Object then return
Let me translate that into code:
You can add an
return statement in the constructor to hijack what it returns:
If the returned object is not an object, then step 8 kicks in:
Originally, I thought there is only one
prototype property per function until I read about
__proto__. Take a look here:
I was totally confused until I read this stackoverflow post. First of all, this graph helps to clarify things a bit:
The accept answer nails it:
__proto__is the actual object that is used in the lookup chain to resolve methods, etc.
prototypeis the object that is used to build
__proto__when you create an object with
As one of the users commented:
Ah! So prototype is not available on the instances themselves, but only on the constructor functions.
Here is a table to summarize the idea, considering the code blow:
constructor: function Person()
constructor: function Person()