Focus

聚焦

Focus

wordpress ip :建站前期摸索着,遇到很多问题。更换服务器,导致ip更换,使用原ip和现有ip都不能正常登陆,网上的方法只解决前半部分。(此文是建站完成后,重新编辑的,相关图片一部分找不回来了)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
csjtl@ubuntu:~$ mysql -u root -p                      //进入mysql
mysql> use wordpress; //切换wordpress库
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from wp_options where option_id=1; //显示库wp_options参数
+-----------+-------------+-----------------------+----------+
option_id option_name option_value autoload
+-----------+-------------+-----------------------+----------+
1 siteurl http://192.168.55.178 yes
+-----------+-------------+-----------------------+----------+
1 row in set (0.00 sec)
mysql> update wp_options set option_value="http://192.168.55.178" where option_id=1;//更改wp_option中的值
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from wp_options where option_id=1; //查看更改
+-----------+-------------+-----------------------+----------+
option_id option_name option_value autoload
+-----------+-------------+-----------------------+----------+
1 siteurl http://192.168.55.178 yes
+-----------+-------------+-----------------------+----------+
1 row in set (0.00 sec)
mysql> exit //退出
Bye
csjtl@ubuntu:~$ service mysql restart //重启mysql
阅读全文 »

LCD1602A 显示器和树莓派通信方式为i2c形式的,i2c是一种串行总线。有串行数据线(SDA),串行时钟线(SCL),电源和接地与设备连接。文章内容为:设备演示图,设备接线图,相关代码。

硬件:树莓派3 LCD1602A显示器 网线 树莓电源。DIY了一下,将显示器放到了外壳的上盖面了。

LCD1602A

显示器与pi3间使用i2c通信

阅读全文 »

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#include<stdio.h>
#include <stdlib.h>
int x,y;
int boxs;
#define LONG 8 //图案大小
#define WIDTH 8
int map[WIDTH][LONG] = { //打印图形结构<!-- more -->
{0,0,1,1,1,0,0,0},
{0,0,1,4,1,0,0,0},
{0,0,1,0,1,1,1,1},
{1,1,1,3,0,3,4,1},
{1,4,0,3,2,1,1,1},
{1,1,1,1,3,1,0,0},
{0,0,0,1,4,1,0,0},
{0,0,0,1,1,1,0,0}};
int boxNum(){ //盒子数量
int i,j;
boxs = 0;
for(i = 0; i < LONG; i++){
for(j = 0; j < WIDTH; j++){
if(map[i][j] == 3){
boxs++;
}
}
}
}
void initData(){ //确定人的坐标
int i,j;
for(i = 0; i < LONG; i++){
for(j = 0; j < WIDTH; j++){
if(map[i][j] == 2){
x = i;
y = j;
}
}
}
}
void drawMap(){ //打印图形
int i,j;
for(i = 0; i < LONG; i++){
for(j = 0; j < WIDTH; j++){
switch(map[i][j]){
case 0:
printf(" "); //空
break;
case 1:
printf("■ "); //墙
break;
case 2:
printf("♀ "); //人
break;
case 3:
printf("◆ "); //箱子
break;
case 4:
printf("● "); //目标位置
break;
case 5:
printf("★ "); //完成目标
break;
}
}
printf("\n");
}
}
void moveUp(){ //上移
printf("up\n");
if(map[x - 1][y] == 0){ //前方为空
map[x - 1][y] = 2;
map[x][y] = 0;
}
if(map[x - 1][y] == 3){ //前方为箱子
if(map[x - 2][y] == 0){ //箱子前方为空
map[x - 2][y] = 3;
map[x - 1][y] = 2;
map[x][y] = 0;
}
if(map[x - 2][y] == 4){ //箱子前方为目标位置
map[x - 2][y] = 5;
map[x - 1][y] = 2;
map[x][y] = 0;
}
}
}
void moveLeft(){ //左移
printf("left\n");
if(map[x][y - 1] == 0){
map[x][y - 1] = 2;
map[x][y] = 0;
}
if(map[x][y - 1] == 3){
if(map[x][y - 2] == 0){
map[x][y - 2] = 3;
map[x][y - 1] = 2;
map[x][y] = 0;
}
if(map[x][y - 2] == 4){
map[x][y - 2] = 5;
map[x][y - 1] = 2;
map[x][y] = 0;
}
}
}
void moveDown(){ //下移
printf("down\n");
if(map[x + 1][y] == 0){
map[x + 1][y] = 2;
map[x][y] = 0;
}
if(map[x + 1][y] == 3){
if(map[x + 2][y] == 0){
map[x + 2][y] = 3;
map[x + 1][y] = 2;
map[x][y] = 0;
}
if(map[x + 2][y] == 4){
map[x + 2][y] = 5;
map[x + 1][y] = 2;
map[x][y] = 0;
}
}
}
void moveRight(){ //右移
printf("ringht\n");
if(map[x][y + 1] == 0){
map[x][y + 1] = 2;
map[x][y] = 0;
}
if(map[x][y + 1] == 3){
if(map[x][y + 2] == 0){
map[x][y + 2] = 3;
map[x][y + 1] = 2;
map[x][y] = 0;
}
if(map[x][y + 2] == 4){
map[x][y + 2] = 5;
map[x][y + 1] = 2;
map[x][y] = 0;
}
}
}
int main(int argc,char*argv[]){
char direction;
while(1){
system("clear"); //清屏
initData(); //人的位置
boxNum(); //盒子的数量
drawMap(); //打印图
direction = getchar(); //输入方向w,a,s,d
switch(direction){
case 'w':
moveUp();
break;
case 'a':
moveLeft();
break;
case 's':
moveDown();
break;
case 'd':
moveRight();
break;
}
if(boxs == 0){ //没有盒子完成
printf("game over\n");
break;
}
}
return 0;
}
0%