2017年10月10日星期二

SL6安装postgresql

参考网址 https://wiki.postgresql.org/wiki/YUM_Installation
数据库安装
  1. 访问yum.postgresql.org,选择你要安装的postgresql安装版本,选择OS的类型复制rpm包链接。
  2. yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-sl96-9.6-3.noarch.rpm(我的系统是sl6)
  3. yum install postgresql96-server即可完成安装。
数据库初始化
数据库在运行前需初始化,有两种方法
  1. 第一种方法, 按照wiki.postgresql.org指导,使用service postgresql-9.6 initdb进行初始化工作,此参数的具体明细,可查看/etc/init.d/postgresql-9.6脚本,其中变量PGDATA为data保存位置,PGLOG为日志保存位置,可以修改脚本满足自己需要。
  2. 使用initdb参数时, 获取$LANG为字符格式, 新建了数据目录, 修改了目录访问权限与读写权限, 初始化了启动日志.
  3. 最后,执行的命令为SU -l postgres -c "initdb --pgdata='data_path' --auth='ident' $LANG".
  4. 这种方式执行的数据库启动后,是不知道postgres用户的密码,需要进入psql进行更改(切换至psotgres用户并执行psql命令不需要密码)
  5. initdb的详细参数是可参考/usr/pgsql-9.6/share/man/man1/initdb.1, 仔细查看.
  6. 第二种方法,则是根据initdb手册, 按自己的需求进行数据库初始化.同时也需修改/etc/init.d/postgresql-9.6启动脚本PGDATA参数,才能开机启动服务.
    mkdir -p /opt/pgsql/9.6/data
    chown postgres.postgres /opt/pgsql/9.6/data
    su -l postgres -c "/usr/pgsql-9.6/bin/initdb --pgdata=/opt/pgsql/9.6/data --auth=ident --locale=en_US.UTF-8 --username=postgres -W"
    执行此命令前,需自己建立好目录,并有正确权限,否则会出错
initdb常用参数简介
  1. --auth= 设置pg_hba.conf文件中host与local的验证方法
  2. --auth-host --auth-local 同上,只是分别设置host与local
  3. -D --pgdata= 数据保存path, 可以自行设置PGDATA变量, 在安装时调用
  4. -E 编码方式
  5. --locale=
  6. -U --username= superuser用户名
  7. -W 提示输入密码
设置开机启动postgresql
chkconfig --level 235 postgresql-9.6 on

设置远程可以连接postgresql
  1. 修改数据目录下的postgresql.conf中
    listen_addresses = '*' 打开所有地址的IP地址监听
  2. 修改数据目录下的pg_hba.sql,添加
  3. # IPv4 local connections:
    host    all             all             192.168.13.0/24         md5
  4. 重启服务

认证方法如下:
"trust", "reject", "md5", "password", "gss", "sspi","ident", "peer", "pam", "ldap", "radius" or "cert".  注意"password"发送明文,"md5"发送加密

2017年6月12日星期一

几个家长控制系统android软件的试用

小孩越来越离开手机,特别是假日在家,父母上班不能监控孩子的手机行为,所以家长控制系统显得非常重要,以下是几款软件的试用,
screen time
这是一款老牌的监控软件,在手机上分别安装家长端和孩子端,在家长端申请账号,然后在孩子端输入家长账号,用家长端扫描孩子端二维码,根据提示设置即可
软件的功能有

  1. 在限定孩子每天使用时间,可以星期一至五,星期六及星期日分开设置;在指定时间内可使用的软件
  2. 在星期一至日指定睡觉时间,起床时间,熄灯时间(睡觉时间可设定哪些程序可用,熄灯时间后所有程序都不能用)
  3. 指定学习开始时间,与结束时间,以及指定哪些程序受影响与否
  4. 查看使用的程序时间
  5. 生成报告,查看WEB历史,search历史
  6. 试用时间14天,以后收费,每月$3.99
不过在中国家长端与孩子端都必须翻墙后才能正常使用

secureKids
软件特性

  1. 同一软件,打开后选择家长端和客户端
  2. 孩子端注册,邮箱链接设定密码,家长端登录
  3. 查看孩子使用程序时间,占比
  4. 设置过滤或白名单方式(白名单未使用成功)
  5. 指定哪些程序可以使用
  6. 指定哪些号码不能联系
  7. 定位
  8. 指定闹钟
  9. 指定不能使用手机的多个时间
  10. 在孩子手机端设定紧急求救
  11. 孩子端请求指定权限,家长开通
mmguardian

2017年5月27日星期六

使用arduino开发esp8266的初始配置

一. 下载arduino安装包
https://downloads.arduino.cc/arduino-1.8.2-linux64.tar.xz, 下载后一定用sha512sum校验软件包是否完整, 建议用下载软件下载, 在web中下载太痛苦了.
二. 安装
将软件包解压,并拷贝至相应目录
sudo mv  arduino-1.8.2 /opt/
我的环境是mint 18.1 kde, 安装有点问题, 需要修改install.sh
将install.sh内的下列语句修改为
原:RESOURCE_NAME=cc.arduion.arduinoide
改:RESOURCE_NAME=arduion-arduinoide
运行即可生成菜单
三. 配置
打开File-Preferences, 这里可以配置代理, 修改语言等, 在板管理URL中加入下列地址, 点击OK
http://arduino.esp8266.com/stable/package_esp8266com_index.json
打开Tools-Board-Board manager, 拉至最后, 安装esp8266
四. 端口配置
检测是否发现设备
lsmod | grep usbserial, lsusb
我的环境自动安装了驱动, 比较省事, 端口是ttyUSB0
查看ttyUSB0的权限, 属于dialout, 将用户加入此组
sudo minicom -s
配置好端口与速率






2017年5月15日星期一

xenapp协议驱动程序错误

xenapp修改1494,2598端口后,出现协议驱动程序错误,在远程桌面会话主机配置中,无法修改ICA的适配器配置,解决方法,修改inetpub\wwwroot\citrix\xenapp\conf\default.ics
在[application]下增加CGPAddress=,防止将CGPIP传递到客户端,不使用2598,只使用1494则可以正常工作

重要:其实可以在web interface管理中
xenapp web站点以及xenapp services站点

  1. 在安全访问中使用已转换,在指定地址转换中只指定1494的转换
  2. 不指定2598的转换
  3. 在路由器上只做WEB,1494的端口映射
经过上述的处理,则不需要修改ics文件,即可正常使用WEB访问及receiver访问

2017年5月9日星期二

keepass2与keepassx的比较

https://superuser.com/questions/878902/whats-the-difference-between-keepass-and-keepassx
这个站点做了很好的说明

You probably already know, but both KeePass and KeePassX are open source (published under the GNU General Purpose Licence 2) secure (using AES or Twofish) data storage programs, using a single database file to store (mainly) passwords, or pretty much any data you'd like e.g. user names, passwords, urls, attachments and comments.
KeePass was started about 2003, originally for Windows only, but now uses Mono to run on anything that Mono supports, like Mac OS X, Linux, FreeBSD...
KeePassX is an "Contributed/Unofficial KeePass Port" of KeePass that was started in 2005 (if the copyright notice on the bottom of their webpages is accurate) to run KeePass on Linux. It is now available as a native program for Linux, Windows, OS X, and others.
As the KeePassX homepage says:
Originally KeePassX was called KeePass/L for Linux since it was a port of Windows password manager Keepass Password Safe. After KeePass/L became a cross platform application the name was not appropriate anymore and therefore, on 22 March 2006 it has been changed [to KeePassX].

Currently, the biggest difference between KeePass & KeePassX seems to be the appearance and "feel" of each program, especially on Linux or Mac OS X where KeePassX doesn't rely on Mono, so matches the look of other native programs closer. And, KeePassX's version 0.4.x & 2.x display issues.
Also, KeePassX doesn't support plugins (there are several plugins for KeePass), as the user Grief points out in their answer so do upvote it too.

Screenshots of KeePassX "1.x"/(0.4.x) & "2.x", and KeePass2

These are on a Linux Mint 17 XFCE (Ubuntu 14.04 based) system. See this Ubuntu package search for keepass for what version's currently in what release:

KeePassX 0.4.3 (version 1.x compatible)

This version's in Ubuntu "Trusty Tahr" 14.04 LTS, and uses the KeePass v1.x database - AES/Rijndael or Twofish KeePassX 0.4 This is basically the same font & sizes as other windows, looks great & fits in. You can customize the columns & see the preview panel. Opening an entry to view/edit opens a new window: KeePassX 0.4 view entry

KeePassX 2.0.2

In Ubuntu 16.04 LTS & 16.10, using the KeePass v2.x database - AES/Rijndael only. KeePass2 normal view It uses the new database version 2.x, but you can't use TwoFish encryption, and it removes some display features like the preview panel (the bottom/right panel with details on the selected entry) and customizing columns. Viewing/editing an entry does not open a new window, it changes the whole KeePassX window into the view/edit window.
For some reason, it wouldn't let me resize the window to any smaller than this screenshot. Hopefully they'll add back the missing display features soon, but until then I'll stick with KeePassX 0.4.x.

KeePass 2.25 using Mono

In Ubuntu 14.04 LTS, there's a slightly higher version in 16.04 LTS & newer: enter image description here Visually very similar to KeePassX 0.4.3 but the font's different & smaller, just looks out of place. The preview panel's much more compact (like reading a .CSV file) and viewing/editing an entry opens a new window. It's got a side-by-side view too: KeePass2 side-by-sideAlso can NOT do somethings that the Windows version can like Export to KeePass version 1 formats: KeePass2 Not on Windows Error And has some display issues for me, like in this next image the key transformation rounds is actually 6003, but only the 6 is visible: KeePass2 Display Problems

Formerly, the current "main" KeePassX (0.4.3) only supported "the KeePass 1.x (Classic) password database format" But as of December 7, 2015, KeePassX version 2 has finally reached a stable release:
We’re proud to announce the first stable release of the KeePassX 2 series after several years of development.
KeePassX 2.0 is using the new .kdbx (same as KeePass 2) database format.
You can import your .kdb database from 0.4 from the Database > Import KeePass 1 database.
This is a one-way process though. You can’t migrate back to the .kdb format.
New features include:
  • Multiple attachments per entry
  • Add custom key/value pairs to entries
  • Open multiple database in one window
And the page "KeePass Edition Comparison" is probably helpful to differentiate versions 1 and 2.
It compares around 50 different aspects, copying them all here would be unnecessary, so I'll just paste a few of the differences, features that KeePass 1.x do NOT have, compared to KeePass 2.x. Many of these look very Windows-centered:
Full Unicode Support, Enhanced High DPI Support, Windows User Account, One-Time Passwords (as a plugin), Enter Master Key on Secure Desktop, Custom String Fields, Internal Attachment Viewer/Editor, Entry History, Import External Icons, Group Notes, Show Entries of Sub-Groups, Recycle Bin, Entry Tags, Grouped Results, Sort Search Results, Auto-Type TCATO, Pick Characters, Export To XSL-Transformed, Import from "More than 35 formats (see Help: Import)", Open Database via URL (FTP, HTTP, WebDAV, SCP, SFTP, FTPS), Shared Database Editing (Office-style locking), Synchronization, Scripting, Trigger System.
And, KeePass 1.x supports the Rijndael & Twofish Encryption Algorithms. KeePass 2.x only uses Rijndael.
See the linked Comparison page above for more info, & some description.

2017年5月6日星期六

mint 18.1 qqlight安装

1:安装winehq
sudo dpkg --add-architecture i386
get key https://dl.winehq.org/wine-builds/Release.key
install key sudo apt-key add Release.key
添加源 sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'(mint)
sudo apt update
sudo apt install winehq-devel

2:安装cabextract
sudo apt install cabextract

3:下载winetricks
wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod 755 winetricks
sudo mv winetricks /usr/bin/

4:下载qqlight.verb
https://github.com/hillwoodroc/winetricks-zh
wget https://raw.githubusercontent.com/hillwoodroc/winetricks-zh/master/verb/qqlight.verb

5:安装qqlight
winetricks qqlight.verb

6:中间会下载多个文件,如果发现文件缺失,自行下载并放到指定目录

7:修改快捷方式
右键kde,edit application, 增加item
Exec=env WINEPREFIX=/home/wangzili/.local/share/wineprefixes/qqlight wine "C:\\Program Files (x86)\\Tencent\\QQLite\\Bin\\QQScLauncher.exe"

2017年4月30日星期日

安装wine


  1. sudo dpkg --add-architecture i386
  2. get key https://dl.winehq.org/wine-builds/Release.key
  3. install key sudo apt-key add Release.key
  4. 添加 sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'(mint)
  5. sudo apt update
  6. sudo apt install --install-recommends winehq-devel

安装google-chrome


  1. 下载key https://dl-ssl.google.com/linux/linux_signing_key.pub
  2. 安装key sudo apt-key add keyname
  3. 添加源 sudo apt-add-repository 'deb http://dl.google.com/linux/chrome/deb/ stable main'(mint)
  4. sudo apt update
  5. sudo apt install google-chrome-stable

2017年4月25日星期二

Linux Mint 安装后的二三事

最近使用的Ubuntu16.04经常报错,又不想花时间去解决,又因最近一次Gnome的安装,系统无法进入桌面,一气之下安装了Mint,总结如下
  1. 系统安装不再叙述;
  2. 输入法
  • 安装fcitx fcitx-table-wbpy qt4-qtconfig fcitx-frontend-qt4 kde-config-fcitx fcitx-ui-classic
  • 使用im-config配置输入法
  • 使用fcitx-config配置输入法
  • 使用qt4 settings配置输入法
  1.  安装shadowsockets-qt5
  • sudo add-apt-repository ppa:hzwhuang/ss-qt5
  • sudo apt update
  • sudo apt install shadowsocks-qt5
  1. 设置tmpfs
  • 设置虚拟盘, 修改/etc/fstab 此方案不可行
  • 参见https://forums.linuxmint.com/viewtopic.php?t=237543
  • sudo cp /usr/share/systemd/tmp.mount /etc/systemd/system/
  • sudo systemctl enable tmp.mount
  • Reboot

Ubuntu tmpfs配置

Ubuntu tmpfs配置
配置文件位于/lib/init/fstab, 用户在/etc/fstab下的配置将覆盖其配置内容, 下面是配置文件的说明.
# /lib/init/fstab: static file system information.
# These are the filesystems that are always mounted on boot, you can
# override any of these by copying the appropriate line from this file into
# /etc/fstab and tweaking it as you see fit.  See fstab(5).

优化SSD
添加noatime,nodiratime,commit=60参数到mount
创建/tmp tmpfs文件系统到内存
tmpfs /tmp tmpfs defaults,noatime,nodiratime,mode=1777,size=50% 0 0

2017年3月16日星期四

ESP8266 arduino库的一些学习

http://esp8266.github.io/Arduino/versions/2.3.0/doc/reference.html

  1. Digital IO 兼容arduino pinMode, digitalRead, digitalWrite. 状态可为INPUT, OUTPUT, INPUT_PULLUP. 16脚可以设置为为INPUT, OUTPUT, INPUT_PULLDOWN. 启动时所有的引脚默认配置是INPUT.
  2.  GPIO6-11脚不能使用, 原因是因为模块内部, 引脚连接到了SPI Flash芯片上,  如果是QIO模式,会使用6-11脚, DIO模式, 可以使用9和11. 
  3. 支持attachInterrupt, detachInterrupt引脚中断,除了16脚, 中断可以使用所有的其它引脚,中断类型支持CHANGE, RISING, FALLING.
  4. Analog input, 可读入模块电源电压, 或ADC电压, 电压范围是0-1.0V, 如果使用ESP.getVcc()读取VCC电压,则ADC脚不能有接线, 另外ADC_MODE(ADC_VCC);要写在程序中, 最好是在函数外, #include后边.
  5. Analog output analogWrite(pin, value), 用来将引脚做为PWM输出, 数值可为0-PWMRANGE, 0可关断PWM, 默认PWMRANGE=1023, 可以使用analogWriteRange(new_range)改变.
  6. Timing and delays millis(), micros(), 分别显示reset后的毫秒和微秒. delay(ms)暂停程序但wifi和tcpip仍然工作, delayMicroseconds(us)暂停程序微秒. 当wifi连接后, 有大量的代码需要在程序后台运行, wifi和tcp/ip库在每次loop()完成后, 有机会控制一些挂起的事件或运行delay(),  如果你的loop()程序没有调用delay()而使用的时间超过了50ms, 你可能需要增加调用delay()来保证wifi堆栈工作正常. 这里有个yield()等于delay(0), delayMicroseconds(),如果超过20毫秒不推荐使用.
  7. Serial 使用与arduino相同, 使用gpio1(tx), gpio3(rx). 也可以调用Serial.begin()后使用Serial.swap重新映射到gpio15(tx), gpio13(rx),再次调用Serial.swap后恢复gpio1与gpio3. Serial1 使用gpio(tx), 但是无法接收数据, 因为RX脚被用于闪存芯片连接,可能使用用Serial1.begin()调用. 如果serial1没有使用并且serial没有交换, 在调用Serial.begin后,调用Serial.set_tx(2)可以将gpio映射为UART0的tx, 或直接调用Serial.begin(baud, config, mode,2). 默认当你调用Serial.begin后, wifi库的诊断输出是关闭的. 为了重新打开debug输出, 调用Serial.setDebugOutput(true), 如果用serial1输出debug, 调用Serial1.setDebugOut(true). 你仍然需要使用Serial.setDebugOutput(true)来打开printf()功能. Serial与Serial1支持5,6,7,8数据位, odd(o), even(E), no parity(N), 1或2停止位, 你可以使用Serial.begin(baudrate, SERIAL_8N1), Serial.begin(baudrate, Serial_6E2)等来设置你所希望的串口方式. Serial[1].baudRate(), 可以获取端口速率
  8. Progmem 程序中的字符都会占用内存空间, 最好的办法是使用宏与FPSTR(),这里有一个举例
String response1; 
response1 += F("http:"); 
... 
String response2; 
response2 += F("http:");

const char HTTP[] PROGMEM = "http:"; 
... 
{ String response1; 
 response1 += FPSTR(HTTP); 
 ... String response2; 
 response2 += FPSTR(HTTP); 
}

http://esp8266.github.io/Arduino/versions/2.3.0/doc/libraries.html


2017年3月15日星期三

C语言学习-运算符与表达式

运算符和表达式
单目运算符
+
-
++
--
双目运算符
+
_

/
% 取余
关系运算符
>
>=
<
<=
==
!=
逻辑运算符
&&与
||或
!非
赋值运算符
=
x+=8 x=x+8
条件运算符
? 表达式1?表达式2:表达式3 表达式1为真取表达式2,为假取表达式3
逗号运算符
表达式1,表达式2,表达式n x=(a=1),(b=2),(a+b); 最后x=3

C语言学习-数据类型

数据类型
整型
int -32768-+32768
short -32768-+32768
long -2^16-2^16-1
unsigned int 0-65535
unsigned shore -2^16-2^16-1
unsigned long 0-2^32-1
浮点型
float 6-7
double 15-16
long double 18-19
字符型
char

C语言学习-格式化字符串

scanf()函数是格式化输入函数,它从标准输入设备(键盘) 读取输入的信息
调用格式为: scanf("<格式化字符串>",<地址表>)
格式化字符串一般形式为:%[*][输入数据宽度][长度]类型
* 空读一个数据
数据宽度:字符数
长度:
l 长整型
h 短整型
类型
d 十进制带符号整数
o 八进制无符号整数
x 十六进制无符号整数
u 十进制无符号整数
f 小数形式实数
e 指数形式实数
s 字符串
* 空读一个数据

ESP8266读取多个传感器

https://arduinodiy.wordpress.com/2016/10/11/using-the-4-pins-of-the-esp8266-01/
这是一个使用受限的引脚数来接入多个器件的例子,主人使用的是ESP8266-01,
1 URXD GPIO3 UART_RXD
2 CH_PD
3 RESET GPIO16*
4 VCC
5 GND
6 GPIO2*
7 GPIO0* wifi状态工作模式
8 UTXD GPIO1 UART_TXD

有GPIO2,GPIO15,GPIO0(Wifi状态灯及工作模式),GPIO16(REST),GPIO1(UART_TXD),GPIO3(UART_RXD)
使用2个引脚来做I2C,用于BMP180和OLED
使用1个引脚通过OneWire协议读取2个DS18B20,
使用1个引脚使用DHT11

引脚定义如下:
GPIO0->I2C SDA
GPIO2->I2C SCL
GPIO1->DHT11
GPIO3->OneWire Bus

主人使用单总线读取DS18B20,需要知道器件的地址,这是读取地址的链接:
https://arduino-info.wikispaces.com/Brick-Temperature-DS18B20#Test%20Sketch%20to%20read%20DS18B20%20addresses

文章中提到如果DHT11读取数据出现"failed to read",可能是DHT.cpp 156-158
// End the start signal by setting data line high for 40 microseconds.
    digitalWrite(_pin, HIGH);
    delayMicroseconds(40);
要把它注释掉
------------------------------------------------
/*
   Field 1 temp roost (DHT11)
   Field 2 humidity roost (DHT11)
   field 3 Coop temperature (DS18B20)
   field 4 soil temperature (DS18B20)
   field 5 Airpressure (bmp180)
   field 6 Outside temperature (bmp180)
 * */
#include <DHT.h>
#include  <OneWire.h>//  http://www.pjrc.com/teensy/td_libs_OneWire.html
#include <DallasTemperature.h> //   http://milesburton.com/Main_Page?title=Dallas_Tem...
#include <Adafruit_BMP085.h>
#include <ESP8266WiFi.h>
#include "SSD1306.h"
SSD1306  display(0x3c, 0, 2);

#define DHTPIN 1  //GPIO1 (Tx)
#define DHTTYPE  DHT11
#define ONE_WIRE_BUS 3 // GPIO3=Rx

const char* ssid     = "YourSSID";
const char* password = "YourPassword";
const char* host = "api.thingspeak.com";
const char* writeAPIKey = "W367812985"; //use YOUR writeApi

//DHT11 stuff
float temperature_buiten;
float temperature_buiten2;
DHT dht(DHTPIN, DHTTYPE, 15);

//DS18b20 stuff
OneWire oneWire(ONE_WIRE_BUS); //oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire);// Pass address of our oneWire instance to Dallas Temperature.
DeviceAddress Probe01 = { 0x28, 0x0F, 0x2A, 0x28, 0x00, 0x00, 0x80, 0x9F};
DeviceAddress Probe02 = { 0x28, 0x10, 0xA4, 0x57, 0x04, 0x00, 0x00, 0xA9};

// bmp180 stuff
Adafruit_BMP085 bmp;

void setup() {
  //I2C stuff
  Wire.pins(0, 2);
  Wire.begin(0, 2);
  // Initialize sensors
  //dht 11 stuff
  dht.begin();
  //ds18b20 stuff
  sensors.begin();//ds18b20
  // set the resolution to 10 bit (Can be 9 to 12 bits .. lower is faster)
  sensors.setResolution(Probe01, 10);
  sensors.setResolution(Probe02, 10);
  //bmp180 stuff
  if (!bmp.begin()) {
    //   Serial.println("No BMP180 / BMP085");
    //   while (1) {}
  }

  //OLED stuff
  display.init();
  display.flipScreenVertically();
  display.setFont(ArialMT_Plain_10);
  delay(1000);

  //  Connect to WiFi network
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
}

void loop() {
  //ds18b20stuff-------------------
  sensors.requestTemperatures(); // Send the command to get temperatures
  temperature_buiten = sensors.getTempC(Probe01);//
  temperature_buiten2 = sensors.getTempC(Probe02);//
  //dht11 stuff--------------------
  float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();
  if (isnan(humidity) || isnan(temperature)) {
    return;
  }
  //bmp stuff-------------------------
    String t= String(bmp.readTemperature());
    String p=String(bmp.readPressure());
  //OLED stuff--------------------------
  display.clear();
  display.drawString(0,10,p);//bmp pressure
  display.drawString(0,24,String(temperature_buiten));//ds18b20
  display.drawString(0,38,String(humidity));//dht11
  display.display();

  // make TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    return;
  }

  String url = "/update?key=";
  url += writeAPIKey;
  url += "&field1=";
  url += String(temperature);// roost (DHT1)
  url += "&field2=";
  url += String(humidity);// roost (DHT11)
  url += "&field3=";
  url += String(temperature_buiten);//coop temperature (DS18B20 nr 1)
  url += "&field4=";
  url += String(temperature_buiten2); //soil temperature (DS18B29 nr 2)
  url +="&field5=";
  url +=String(bmp.readTemperature());Outside temperature (BMP180)
  url +="&field6=";
  url +=String(bmp.readPressure());// Airpressure (BMP180)
  url += "\r\n";

  // Send request to the server
  client.print(String("GET url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "Connection: close\r\n\r\n");

  delay(1000);

}

2017年2月16日星期四

minicom AT指令无反应

要感谢这篇文章的作者
https://yjdwbj.github.io/2016/08/26/%E4%BD%BF%E7%94%A8%E7%9A%84%E4%B8%80%E4%BA%9B%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98-%E4%B8%8D%E5%AE%9A%E6%9C%9F%E6%9B%B4%E6%96%B0/
ctrl A A    ctrl A W都是控制换行回车的
最后要用一个ctrl J

ESP8266学习

        ESP8266是我最近在网上看到的一块芯片,是中国上海乐鑫生产的,集wifi, Mcu,于一身,小芯片,大用处.安信可将乐鑫的芯片进行了二次封装,集成了flash,晶振,天线等重新销售.因此互联上的资料很乱,有乐鑫的,安信可的.
        乐鑫的网址http://www.espressif.com/zh-hans
        安信可的网址http://www.ai-thinker.com/

        ESP8266的使用以我的了解,大约有以下几种途径:

  • 一种是AT指令,不管是乐鑫还是安信可的模块,出厂都刷了AT固件,可以通过AT指令控制芯片工作,AT手册两个官网都有相应的资料.

  • 一种是刷入nodemcu的固件,通过lua脚本语言编程,控制芯片工作,项目托管在github,https://github.com/nodemcu/nodemcu-firmware/releases,编译好的固件只有20150704的,分为两个,一个是整数,一个是浮点,其它的版本需要自己编译.
  • 这里有个网址,http://tinylab.org/nodemcu-kickstart/,可以看看,参考如何使用nodemcu来开发esp8266
  • ESPlorer是一个基于java编写的开发开具,https://esp8266.ru/esplorer/,大家可以看看,在这个软件界面,可以直接编写lua脚本并上传调试.

  • 一种是使用官方的SDK或其它的SDK,使用IDE环境进行编程,编译开发



  • 一种是使用用arduino IDE环境,使用esp8266的相关插件,进行开发,在arduino IDE附加开发板管理器网址输入https://github.com/esp8266/Arduino/releases/download/2.3.0/package_esp8266com_index.json




2017年2月1日星期三

ubuntu16.04 nautilus访问google drive

  1. sudo apt install gnome-online-accounts
  2. gnome-control-center online-accounts
  3. 因大家知道的情况,无法连接

2017年1月18日星期三

移动光猫找密码

转自http://tieba.baidu.com/p/4893323353
贝尔I-120EM,可以直接使用

第一步:登陆光猫后台192.168.1.1
1.用光猫(机器)背面阉割帐号登陆,能登陆的直接下跳第二步开启Telnet!
2.如果无法登陆,别管什么原因,直接桶光猫菊花(开关附近有个洞)20秒左右,指示灯会有明显变化,然后可以用默认超级管理员帐号:CMCCAdmin密码:aDm8H%MdA恢复出厂,记住一定要先拔掉光纤线,不然会被自动修改密码!
3.最好记一下Password认证码,光猫注册必须要用,如果没记可以打客服或者维护人员电话。


第二步:开启Telnet

http://192.168.1.1/system.cgi?telnet
复制到地址栏回车,后台必须是登陆状态才能开启哦!
WIN7需要去“控制面板” 一〉“程序” 一〉“打开或关闭windows功能”,在里面可以看到许多服务项,选择“telnet服务器”和“telnet客户端”确定即可。


第三步:插入光纤注册设备
阉割帐号能登陆的略过本步骤。恢复出厂的开启Telnet后,登陆后台点击注册设备,只有一个Password认证码,输入就搞定,然后就什么都不用管了,等几分钟显示100%注册成功即可!


第四步:运行cmd,输入命令
1.telnet 192.168.1.1(回车)
2.cfgcli -e X_CT-COM_TeleComAccount.(回车)(回车前面有一个点.不知道有没有用,反正我是直接全部复制下来的,就只有2步命令)


第五步:获取密码
找到CMCCAdmin下面就是被修改后的密码,不出意外应该是cmccadminxxxxxxxx这个格式