你要如何衡量你的人生

坚持,努力,让好事发生

在12306上买票时推荐使用电信、联通的网,其他运营商的网质量不太好。可能会影响抢票结果。
有的时候甚至查不到票。我用的是方正的网,发现手机上可以查到票,电脑上查不到票。
结果用手机开热点(电信网),电脑连上以后很快就查出票了。

在12306买票

  1. 首先要登录
  2. 车票预订页面输入出发站、目的地、出发日,
    然后点击查询,选择合适的车次,然后点击预订。
阅读全文 »

使用Tomcat时遇到的一些问题,记的一些笔记

Tomcat配置

<!-- 并发配置 -->
<Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1"
		    URIEncoding="UTF-8" 
			maxThreads="30000"
            minSpareThreads="512"
            maxSpareThreads="2048"
		    connectionTimeout="20000"
			keepAliveTimeout="15000"
            maxKeepAliveRequests="1"
		    redirectPort="8443" 
			enableLookups="false" acceptCount="35000" disableUploadTimeout="true" />
阅读全文 »

(1) -bash: mysql: command not found

原因:这是由于系统默认会查找/usr/bin下的命令,如果这个命令不在这个目录下,当然会找不到命令,我们需要做的就是映射一个链接到/usr/bin目录下,相当于建立一个链接文件。
[root@localhost bin]# ln -s /usr/local/mysql/bin/mysql /usr/bin

(2) cannot connect to local MySQL Server through socket ‘/var/lib/mysql/mysql.sock’

配置 /etc/my.cnf
sock = /var/lib/mysql/mysql.sock

(3) can’t connect to local mysql server through socket ‘/tmp/mysql.sock’

客户端连接时会默认去找/tmp路径下的mysql.sock 所以 我们这里的第二个方案是 看能不呢把 mysql.sock复制到 /tmp路径下

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

error

阅读全文 »

word2vec的使用和学习…

word2vec使用

先跑起来,跑出一个结果,然后再详细了解。
word2vec有多个版本,我是用NLPchina的这个版本

阅读全文 »

(1) 新linux机器配置

en_US.UTF-8 zh_CN.UTF-8 都是 UTF-8编码
en_US.UTF-8:你说英语,你在美国,字符集是utf-8
zh_CN.UTF-8:你说中文,你在中国,字符集是utf-8

建议设置成 en_US.UTF-8,因为命令行的结果是英文,不用担心乱码。

(1.1) 配置编码

配置文件一般在 /etc/sysconfig/i18n /etc/locale.conf

(1.1.1) 查看当前区域编码配置 localectl status

[wkq@VM_77_25_centos ~]$ localectl status
   System Locale: LANG=en_US.utf8
       VC Keymap: us
      X11 Layout: us

(1.1.2) 查看系统默认的语言设置 locale

[wkq@VM_77_25_centos ~]$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.utf8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
阅读全文 »

遇到的问题

修改Label、删除Label、增加Label

neo4j是no-schema的,允许一个节点有0-n个label,也就是可以没有Label,可以有一个Label,也可以有多个

删除Label

match (n) where id(n) = 2 remove n:Label return n;

neo4j-sh (?)$ match (n) where id(n) = 2 set n:E return id(n), labels(n), n;
+------------------------------------------------+
| id(n) | labels(n)          | n                 |
+------------------------------------------------+
| 2     | ["Person","T","E"] | Node[2]{name:"t"} |
+------------------------------------------------+
1 row
Labels added: 1
136 ms
neo4j-sh (?)$ match (n) where id(n) = 2 remove n:E return id(n), labels(n), n;
+--------------------------------------------+
| id(n) | labels(n)      | n                 |
+--------------------------------------------+
| 2     | ["Person","T"] | Node[2]{name:"t"} |
+--------------------------------------------+
1 row
Labels removed: 1
107 ms
neo4j-sh (?)$ match (n) where id(n) = 2 remove n:Person:T return id(n), labels(n), n;
+---------------------------------------+
| id(n) | labels(n) | n                 |
+---------------------------------------+
| 2     | []        | Node[2]{name:"t"} |
+---------------------------------------+
1 row
Labels removed: 2
46 ms

可以看到,
第一次操作,原来id=2的节点有3个Label Person、T、E ,移除一个E后,还有2个
第二次操作,原来id=2的节点有2个Label Person、T ,移除两个后,有0个

修改Label

neo4j-sh (?)$ match (n) where id(n) = 2 set n:E return id(n), labels(n), n;
+---------------------------------------+
| id(n) | labels(n) | n                 |
+---------------------------------------+
| 2     | ["E"]     | Node[2]{name:"t"} |
+---------------------------------------+
1 row
Labels added: 1
13 ms
neo4j-sh (?)$ match (n) where id(n) = 2 set n:T return id(n), labels(n), n;
+---------------------------------------+
| id(n) | labels(n) | n                 |
+---------------------------------------+
| 2     | ["T","E"] | Node[2]{name:"t"} |
+---------------------------------------+
1 row
Labels added: 1
29 ms

不remove,直接set,会导致修改完有两个Label,所以需要先remove,然后再set (先set再remove也可以)

增加Label

neo4j里如何判断一个属性是什么类型

CREATE (n {a:1, b:"a", c:[1,2,3]})

MATCH (n)
RETURN size(n.a),
CASE n.a
WHEN toInt(n.a)
THEN 'int'
WHEN toFloat(n.a)
THEN 'float'
WHEN toString(n.a)
THEN 'string'
WHEN [x IN n.a | x]
THEN 'coll'
WHEN NULL THEN 'null'
ELSE 'unknown' END , size(n.b), size(n.c)

how-to-determine-property-value-type-within-a-node-in-neo4j

基本语法


unwind // 把列转为单独的行
// With UNWIND, any list can be transformed back into individual rows.
// The example matches all names from a list of names.


with  // 变量传递
// The WITH syntax is similar to RETURN. It separates query parts explicitly,
// allowing you to declare which variables to carry over to the next part.

// 查询所有关系的节点的id
match (n)-[r]-(m) with count(r) as count, id(n) as id
where count > 0
return collect(id);

// 查询孤立节点
match (n) where not (n)--() return n;

// 查询孤立节点的所有标签
match (n) where not (n)--() return distinct (labels(n));

Introduction to Cypher

Chapter 3. Introduction to Cypher

Table of Contents
3.1. Background and Motivation
3.2. Graphs, Patterns, and Cypher
3.3. Patterns in Practice
3.4. Getting the Results You Want
3.5. How to Compose Large Statements
3.6. Labels, Constraints and Indexes
3.7. Loading Data
3.8. Utilizing Data Structures
3.9. Cypher vs. SQL

This friendly guide will introduce you to Cypher, Neo4j’s query language.

The guide will help you:

start thinking about graphs and patterns,
apply this knowledge to simple problems,
learn how to write Cypher statements,
use Cypher for loading data,
transition from SQL to Cypher.

If you want to keep a reference at your side while reading, please see the Cypher Refcard.

Background and Motivation

Cypher provides a convenient way to express queries and other Neo4j actions. Although Cypher is particularly useful for exploratory work, it is fast enough to be used in production. Java-based approaches (eg, unmanaged extensions) can also be used to handle particularly demanding use cases.

Query processing

To use Cypher effectively, it’s useful to have an idea of how it works. So, let’s take a high-level look at the way Cypher processes queries.

Parse and validate the query.
Generate the execution plan.
Locate the initial node(s).
Select and traverse relationships.
Change and/or return values.

Preparation

Parsing and validating the Cypher statement(s) is important, but mundane. However, generating an optimal search strategy can be far more challenging.

The execution plan must tell the database how to locate initial node(s), select relationships for traversal, etc. This involves tricky optimization problems (eg, which actions should happen first), but we can safely leave the details to the Neo4j engineers. So, let’s move on to locating the initial node(s).

Locate the initial node(s)

Neo4j is highly optimized for traversing property graphs. Under ideal circumstances, it can traverse millions of nodes and relationships per second, following chains of pointers in the computer’s memory.

However, before traversal can begin, Neo4j must know one or more starting nodes. Unless the user (or, more likely, a client program) can provide this information, Neo4j will have to search for these nodes.

A “brute force” search of the database (eg, for a specified property value) can be very time consuming. Every node must be examined, first to see if it has the property, then to see if the value meets the desired criteria. To avoid this effort, Neo4j creates and uses indexes. So, Neo4j uses a separate index for each label/property combination.

Traversal and actions

Once the initial nodes are determined, Neo4j can traverse portions of the graph and perform any requested actions. The execution plan helps Neo4j to determine which nodes are relevant, which relationships to traverse, etc.

Graphs, Patterns, and Cypher

Nodes, Relationships, and Patterns

Neo4j’s Property Graphs are composed of nodes and relationships, either of which may have properties (ie, attributes). Nodes represent entities (eg, concepts, events, places, things); relationships (which may be directed) connect pairs of nodes.

However, nodes and relationships are simply low-level building blocks. The real strength of the Property Graph lies in its ability to encode patterns of connected nodes and relationships. A single node or relationship typically encodes very little information, but a pattern of nodes and relationships can encode arbitrarily complex ideas.

Cypher, Neo4j’s query language, is strongly based on patterns. Specifically, patterns are used to match desired graph structures. Once a matching structure has been found (or created), Neo4j can use it for further processing.

Simple and Complex Patterns

A simple pattern, which has only a single relationship, connects a pair of nodes (or, occasionally, a node to itself). For example, a Person LIVES_IN a City or a City is PART_OF a Country.

Complex patterns, using multiple relationships, can express arbitrarily complex concepts and support a variety of interesting use cases. For example, we might want to match instances where a Person LIVES_IN a Country. The following Cypher code combines two simple patterns into a (mildly) complex pattern which performs this match:

(:Person) -[:LIVES_IN]-> (:City) -[:PART_OF]-> (:Country)

Pattern recognition is fundamental to the way that the brain works. Consequently, humans are very good at working with patterns. When patterns are presented visually (eg, in a diagram or map), humans can use them to recognize, specify, and understand concepts. As a pattern-based language, Cypher takes advantage of this capability.

Cypher Concepts

Like SQL (used in relational databases), Cypher is a textual, declarative query language. It uses a form of ASCII art to represent graph-related patterns. SQL-like clauses and keywords (eg, MATCH, WHERE, DELETE) are used to combine these patterns and specify desired actions.

This combination tells Neo4j which patterns to match and what to do with the matching items (eg, nodes, relationships, paths, collections). However, as a declarative language, Cypher does not tell Neo4j how to find nodes, traverse relationships, etc. (This level of control is available from Neo4j’s Java APIs, see Section 32.2, “Unmanaged Extensions”)

Diagrams made up of icons and arrows are commonly used to visualize graphs; textual annotations provide labels, define properties, etc. Cypher’s ASCII-art syntax formalizes this approach, while adapting it to the limitations of text.

Node Syntax

Cypher uses a pair of parentheses (usually containing a text string) to represent a node, eg: (), (foo). This is reminiscent of a circle or a rectangle with rounded end caps. Here are some ASCII-art encodings for example Neo4j nodes, providing varying types and amounts of detail:

()
(matrix)
(:Movie)
(matrix:Movie)
(matrix:Movie {title: "The Matrix"})
(matrix:Movie {title: "The Matrix", released: 1997})

The simplest form, (), represents an anonymous, uncharacterized node. If we want to refer to the node elsewhere, we can add an identifier, eg: (matrix). Identifiers are restricted (ie, scoped) to a single statement: an identifier may have different (or no) meaning in another statement.

The Movie label (prefixed in use with a colon) declares the node’s type. This restricts the pattern, keeping it from matching (say) a structure with an Actor node in this position. Neo4j’s node indexes also use labels: each index is specific to the combination of a label and a property.

The node’s properties (eg, title) are represented as a list of key/value pairs, enclosed within a pair of braces, eg: {…}. Properties can be used to store information and/or restrict patterns. For example, we could match nodes whose title is “The Matrix”.

Relationship Syntax

Cypher uses a pair of dashes (–) to represent an undirected relationship. Directed relationships have an arrowhead at one end (eg, <–, –>). Bracketed expressions (eg: […]) can be used to add details. This may include identifiers, properties, and/or type information, eg:

-->
-[role]->
-[:ACTED_IN]->
-[role:ACTED_IN]->
-[role:ACTED_IN {roles: ["Neo"]}]->

The syntax and semantics found within a relationship’s bracket pair are very similar to those used between a node’s parentheses. An identifier (eg, role) can be defined, to be used elsewhere in the statement. The relationship’s type (eg, ACTED_IN) is analogous to the node’s label. The properties (eg, roles) are entirely equivalent to node properties. (Note that the value of a property may be an array.)

Pattern Syntax

Combining the syntax for nodes and relationships, we can express patterns. The following could be a simple pattern (or fact) in this domain:

(keanu:Person:Actor {name:  "Keanu Reeves"} )
-[role:ACTED_IN     {roles: ["Neo"] } ]->
(matrix:Movie       {title: "The Matrix"} )

Like with node labels, the relationship type ACTED_IN is added as a symbol, prefixed with a colon: :ACTED_IN. Identifiers (eg, role) can be used elsewhere in the statement to refer to the relationship. Node and relationship properties use the same notation. In this case, we used an array property for the roles, allowing multiple roles to be specified.
[Note]

Pattern Nodes vs. Database Nodes

When a node is used in a pattern, it describes zero or more nodes in the database. Similarly, each pattern describes zero or more paths of nodes and relationships.
Pattern Identifiers

To increase modularity and reduce repetition, Cypher allows patterns to be assigned to identifiers. This allow the matching paths to be inspected, used in other expressions, etc.

acted_in = (:Person)-[:ACTED_IN]->(:Movie)

The acted_in variable would contain two nodes and the connecting relationship for each path that was found or created. There are a number of functions to access details of a path, including nodes(path), rels(path) (same as relationships(path)), and length(path).

Clauses

Cypher statements typically have multiple clauses, each of which performs a specific task, eg:

create and match patterns in the graph
filter, project, sort, or paginate results
connect/compose partial statements

By combining Cypher clauses, we can compose more complex statements that express what we want to know or create. Neo4j then figures out how to achieve the desired goal in an efficient manner.

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)

Browser editor

CLI

Examples: :help :clear


Cypher

Match

Match node

MATCH (ee:Person)
WHERE ee.name = "Emil"
RETURN ee;
  • MATCH clause to specify a pattern of nodes and relationships
  • (ee:Person) a single node pattern with label ‘Person’ which will assign matches to the variable ee
  • WHERE clause to constrain the results
  • ee.name = “Emil” compares name property to the value “Emil”
  • RETURN clause used to request particular results

Gets gets the id<5> and id<0> nodes and creates a :KNOWS relationship between them

Match nodes and relationships

MATCH (ee:Person)-[:KNOWS]-(friends)
WHERE ee.name = "Emil"
RETURN ee, friends
  • MATCH clause to describe the pattern from known Nodes to found Nodes
  • (ee) starts the pattern with a Person (qualified by WHERE)
  • -[:KNOWS]- matches “KNOWS” relationships (in either direction)
  • (friends) will be bound to Emil’s friends

Match labels

MATCH (n:Person)
RETURN n

or

MATCH (n)
WHERE n:Person
RETURN n

Match multiple labels

:Car OR :Person labels

MATCH (n)
WHERE n:Person OR n:Car
RETURN n

:Car AND :Person labels

MATCH (n)
WHERE n:Person:Car
RETURN n

Match same properties

MATCH (a:Person)
WHERE a.from = "Sweden"
RETURN a

Returns every node (and their relationships) where there’s a property from with “Sweden” value

Match friends of friends with same hobbies

Johan is learning surfing, and wants to know any friend of his friends who already knows surfing

MATCH (js:Person)-[:KNOWS]-()-[:KNOWS]-(surfer)
WHERE js.name = "Johan" AND surfer.hobby = "surfing"
RETURN DISTINCT surfer
  • () empty parenthesis to ignore these nodes
  • DISTINCT because more than one path will match the pattern
  • surfer will contain Allison, a friend of a friend who surfs

Match by ID

Every node and relationship has an internal autonumeric ID, which can be queried using <**, **<=**, **=**, **=>, <> and IN operators:

Search node by ID

MATCH (n)
WHERE id(n) = 0
RETURN n

Search multiple nodes by ID

MATCH (n)
WHERE id(n) IN [1, 2, 3]
RETURN n

Search relationship by ID

MATCH ()-[n]-()
WHERE id(n) = 0
RETURN n

Create

Create node

CREATE (ee:Person { name: "Emil", from: "Sweden", klout: 99 })
  • CREATE clause to create data
  • () parenthesis to indicate a node
  • ee:Person a variable ee and label Person for the new node
  • {} brackets to add properties (key-value pairs) to the node

Create nodes and relationships

MATCH (ee:Person) WHERE ee.name = "Emil"
CREATE (js:Person { name: "Johan", from: "Sweden", learn: "surfing" }),
(ir:Person { name: "Ian", from: "England", title: "author" }),
(rvb:Person { name: "Rik", from: "Belgium", pet: "Orval" }),
(ally:Person { name: "Allison", from: "California", hobby: "surfing" }),
(ee)-[:KNOWS {since: 2001}]->(js),(ee)-[:KNOWS {rating: 5}]->(ir),
(js)-[:KNOWS]->(ir),(js)-[:KNOWS]->(rvb),
(ir)-[:KNOWS]->(js),(ir)-[:KNOWS]->(ally),
(rvb)-[:KNOWS]->(ally)
  • MATCH clause to get “Emil” in ee variable
  • CREATE clause to create multiple nodes (comma separated) with their labels and properties. Also creates directed relationships (a)-[:Label {key: value}]->(b)

Create relationship between 2 unrelated nodes

MATCH (n), (m)
WHERE n.name = "Allison" AND m.name = "Emil"
CREATE (n)-[:KNOWS]->(m)

Alternative with MERGE, which ensures that the relationship is created only once

MATCH (n:User {name: "Allison"}), (m:User {name: "Emil"})
MERGE (n)-[:KNOWS]->(m)

Create node with multiple labels

CREATE (n:Actor:Director)

Update

Update node properties (add new or modify)

Add new .owns property or modify (if exists)

MATCH (n)
WHERE n.name = "Rik"
SET n.owns = "Audi"

Replace all node properties for the new ones

Danger: It will delete all previous properties and create .plays and .age properties

MATCH (n)
WHERE n.name = "Rik"
SET n = {plays: "Piano", age: 23}

Add new node properties without deleting old ones

Danger: If .plays or .age properties are already set, it will overwrite them

MATCH (n)
WHERE n.name = "Rik"
SET n += {plays: "Piano", age: 23}

Add new node property if property not already set

MATCH (n)
WHERE n.plays = "Guitar" AND NOT (EXISTS (n.likes))
SET n.likes = "Movies"

Rename a property in all nodes

MATCH (n)
WHERE NOT (EXISTS (n.instrument))
SET n.instrument = n.plays
REMOVE n.plays

Alternative

MATCH (n)
WHERE n.instrument is null
SET n.instrument = n.plays
REMOVE n.plays

Add label to existing node

Adds the :Food label to nodes id<7> and id<8>

MATCH (n)
WHERE id(n) IN [7, 8]
SET n:Food

Creates the node if not exists and updates (or creates) a property

MERGE (n:Person {name: "Rik"})
SET n.owns = "Audi"

Delete

Delete nodes

To delete a node (p.e. id<5>), first we need to delete its relationships. Then, the node can be deleted

MATCH (n)-[r]-()
WHERE id(n) = 5
DELETE r, n

To delete multiple nodes (must have their relationships previously deleted)

MATCH (n)
WHERE id(n) IN [1, 2, 3]
DELETE n

Deletes a property in a specific node

MATCH (n)
WHERE n:Person AND n.name = "Rik" AND n.plays is NOT null
REMOVE n.plays

Alternative

MATCH (n)
WHERE n:Person AND n.name = "Rik" AND EXISTS (n.plays)
REMOVE n.plays

Delete a label from all nodes

Deletes the :Person label from all nodes

MATCH (n)
REMOVE n:Person

Delete a label from nodes with specific labels

Deletes the :Person label from nodes with :Food and :Person labels

MATCH (n)
WHERE n:Food:Person
REMOVE n:Person

Delete multiple labels from nodes

Deletes the :Food and :Person labels from nodes which have both labels

MATCH (n)
WHERE n:Food:Person
REMOVE n:Food:Person

Danger: Deletes the :Food and :Person labels from nodes which have :Food or :Person or :Food:Person labels

MATCH (n)
REMOVE n:Food:Person

Delete entire database

MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n, r

Other clauses

Show execution plan

Use PROFILE or EXPLAIN before the query

PROFILE: Shows the execution plan, query information and db hits. Example: Cypher version: CYPHER 3.0, planner: COST, runtime: INTERPRETED. 84 total db hits in 32 ms.

EXPLAIN: Shows the execution plan and query information. Example: Cypher version: CYPHER 3.0, planner: COST, runtime: INTERPRETED.

Count

Count all nodes

MATCH (n)
RETURN count(n)

Count all relationships

MATCH ()-->()
RETURN count(*);

Limit

Returns up to 2 nodes (and their relationships) where there’s a property from with “Sweden” value

MATCH (a:Person)
WHERE a.from = "Sweden"
RETURN a
LIMIT 2

Create unique property constraint

Make .name property unique on nodes with :Person label

CREATE CONSTRAINT ON (n:Person)
ASSERT n.name IS UNIQUE

Drop unique property constraint

Make .name property unique on nodes with :Person label

DROP CONSTRAINT ON (n:Person)
ASSERT n.name IS UNIQUE

References

[1] https://neo4j.com/developer/cypher/
[2] https://neo4j.com/docs/cypher-refcard/current/
[3] https://neo4j.com/docs/developer-manual/3.1/cypher/clauses/set/
[4] http://www.jexp.de/blog/html/compiled-runtime-32.html

维基百科的数据有什么用

可以用来分词、做实体识别、word2vec、新词发现等

数据下载

下载地址

https://dumps.wikimedia.org/zhwiki/ 中文
ftp://ftpmirror.your.org/pub/wikimedia/dumps/ 所有语言

镜像
https://dumps.wikimedia.org/mirrors.html
https://dumps.wikimedia.org/elwiktionary/
https://dumps.wikimedia.org/enwiki/latest/

https://meta.wikimedia.org/wiki/Mirroring_Wikimedia_project_XML_dumps

阅读全文 »

把使用neo4j时遇到的一些常见的问题、错误分享给大家
这要包括 启动问题、前端问题、导入数据问题、工程问题、部署问题,欢迎大家补充。

(1) 启动问题

(1.1) Neo4j启动没反应但也不报错

在服务器上用neo4j start启动neo4j,没有任何反应,用neo4j console启动也没反应
JDK的问题,换成Oracle JDK-1.8,不要用Open JDK

阅读全文 »

 
 写博客并不是一件轻松的事情,特别是技术内容创作,它不仅需要兴趣来驱动,而且需要耐心。

 那么我为什么要写博客,又能为我带来什么呢?

(1) 为什么要写博客

  1. 最开始是想把学到的东西记录、整理下来。

  2. 写博客是一个学习、思考、沟通表达的过程,在这个过程中可以构建知识体系,发现自己的不足。

写博客更容易发现自己的知识盲点以及思维盲区,方便针对性的学习和改进。
写博客是学习、思考的一种展现,在这个过程中能够提供更多思考契机,可以构建更加完整的知识体系。
写博客是对学习和思考的管理和总结,很多事情想到和说到容易,但书面表达往往体现是否可以真正把一个事情全面、系统和深入的讲清楚。
写博客也是非常有效的学习和自省方式。
  1. 扩大沟通范围,提高影响力。
     平时工作沟通范围有限,写博客提供了一个没有受众上限,可以完全自我表达的一个大舞台,可以让更多人了解自己的思考、逻辑、技术和方法,在这个过程中,也可以逐步树立起个人的技术特点和品牌。

  2. 想有个自己的网站。
     数十年后,可以看到自己写的博客。也算是一个小成绩、小贡献吧。

  3. 你想成为哪类人,取决于你的选择。

(2) 坚持写博客带给我什么

  1. 坚持写博客能让我把学过的知识记录下来,梳理、总结,加强记忆及理解。

  2. 在写博客的过程中能够引发一些思考,能够去更深入了解知识的原理,融会贯通。

  3. 坚持写博客可以逐渐构建自己的知识体系。可以帮助我们更好的想清楚、讲清楚。

  4. 坚持写博客是行动的体现,是治愈焦虑的良药。

(3) 为什么要自建网站

  1. 机缘巧合,接触到一个自建网站写博客的文章,然后自己一试,就成了。

  2. 不用csdn、博客园、简书、开源中国、头条、微信公众号,是想更灵活一些。

(4) 写博客注意事项

  1. 转载或引用要在文章前面或者后面标明引用来源。

  2. 可以写的很基础。

  3. 不为了蹭流量而写。

  4. 不为了营销而写。

https://www.python.org/downloads/
https://www.python.org/downloads/source/

python文档 https://docs.python.org/3/download.html

# Setting PATH for Python 2.7
PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# Setting PATH for Python 3.7
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"


alias python2='/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'
alias python3='/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7'
alias python=python3

pip: command not found
运行Python的安装工具安装pip
sudo easy_install pip

pip install --upgrade pip
pip3 install --upgrade pip
pip3 install matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com  
pip3 install numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com  
pip3 install pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com  
pip3 install seaborn scipy  -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 
sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'form car_brand_series' at line 1")
[SQL:  select * form car_brand_series ]
WKQ@WKQ-PC MINGW64 ~
$ python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 17kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.3.1

WKQ@WKQ-PC MINGW64 ~
$ python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\professionalsoftware\python\python35\lib\site-packages (19.3.1)

References

[1] Mac下安装配置Python2和Python3并相互切换使用

0%