set up email service for wordpress

install plugin Postman SMTP

go to settings -> Postman SMTP

follow the instructions,

input the email you want to use as admin account of the site

it will automatically detect which email service you are using, e.g. I use google gmail,

it will suggest the SMTP port, and OAuth 2.0 for authentication

redirecting to https://www.google.com/accounts/Logout?continue=https://console.developers.google.com/start/api?id=gmail

register for google API,

register for Authorized JavaScript origins, and Authorized redirect URI in google’s API page

get back 

Final step,  you should grant permission with google

http://jishichao.com/wp-admin/admin-post.php?action=postman/requestOauthGrant

 

Then you have everything.

__init__.py

from here

What is __init__.py used for?

The primary use of __init__.py is to initialize Python packages. The easiest way to demonstrate this is to take a look at the structure of a standard Python module.

As you can see in the structure above the inclusion of the __init__.py file in a directory indicates to the Python interpreter that the directory should be treated like a Python package

 

What goes in __init__.py?

__init__.py can be an empty file but it is often used to perform setup needed for the package(import things, load things into path, etc).

One common thing to do in your __init__.py is to import selected Classes, functions, etc into the package level so they can be convieniently imported from the package.

In our example above we can say that file.py has the Class File. So without anything in our__init__.py you would import with this syntax:

from package.file import File

However you can import File into your __init__.py to make it available at the package level:

Another thing to do is at the package level make subpackages/modules available with the__all__ variable. When the interpeter sees an __all__ variable defined in an __init__.py it imports the modules listed in the __all__ variable when you do:

from package import *

__all__ is a list containing the names of modules that you want to be imported with import * so looking at our above example again if we wanted to import the submodules in subpackage the __all__ variable in subpackage/__init__.py would be:

__all__ = ['submodule1', 'submodule2']

With the __all__ variable populated like that, when you perform

from subpackage import *

it would import submodule1 and submodule2.

As you can see __init__.pycan be very useful besides its primary function of indicating that a directory is a module.

Python class inherit example

To determine if a character is Chinese

string’scoding should be unicode

to know if one character is Chinese

we can decode utf-8 to unicode

def is_chinese(uchar):
"""判断一个unicode是否是汉字"""
if uchar >= u'\u4e00' and uchar<=u'\u9fa5':
return True
else:
return False

 

 

get file extension using Python

 

.ipynb_checkpoints ext:
Chinese-Sentiment ext:
corenlp-python ext:
corenlp.tar ext: .gz
extract ext:
k-means ext: .ipynb
neg ext: .csv
neg ext: .txt
neg ext: .xls
new_model ext:
new_model2 ext:
pos ext: .csv
pos ext: .txt
pos ext: .xls
Sentiment-Analysis ext:
sentiment ext: .ipynb
sentiPY ext:
snownlp ext:
test100 ext: .ipynb
Untitled ext: .ipynb
Untitled1 ext: .ipynb
Untitled2 ext: .ipynb
use_analysis ext: .csv
week1 ext: .csv
week31_divided(no_use_in_model) ext: .csv
wtf ext:

validate folder