01/05/2016 – Astronomical Weather Forecast Dev Log – 天文天气预报开发日志

前期规划日志 Previous Development Plan :

10/02/2016  & 27/02/2016


后续开发日志 Development Update:

03/05/2016


>前往中文预报页面<     >Go to the English forecast page<


以下为主要开发内容 The following is the main content:

由于公差查询器核心已经比较稳定,剩下的主要工作就是利用零碎时间完成公差数据的输入,所以开始着手完成天文天气预报。在研究清楚晴天钟天气图表API的调用方法后,开始着手研究根据访问者IP获取经纬度信息的办法。与公差查询器一样,由于我建站的空间支持php语言,所以天气预报页面也使用php来编写。

The core of the tolerance checker has been stable, the rest work is typing the tolerance data which can be done in spare time. I can turn to develop the astronomical weather forecast now. It’s not time-consuming to understand how to use 7Timer!’s API, then the method of obtaining coordinate by visitors’IP address must be figured out. The same reason as the tolerance checker, I choose PHP to set up the page due to my website server’s PHP environment.

为了降低初期的学习难度和开发难度,当然也考虑到测试网络环境,地理信息(IP-经纬度转换和地图)的API选用了百度而没有选用谷歌。

For decreasing the study and develop difficulties, and considering about testing web environment, Baidu Map was selected as geography API instead of Google.

首先通过

First, by using

[php]

$_SERVER["REMOTE_ADDR"]

[/php]

来获得访问者IP地址(这也造成一个问题,获取的是设备接入网络服务商时的IP,造成移动设备通过蜂窝网络接入或透过VPN访问的用户提供的IP是不准确的,造成定位错误,不能实现“本地”天气预报)

to obtain visitor’s IP (There’s problem here. Wrong IP will be fetched if the visitor is using mobile devices through cellular network or visiting the web through VPN, because the code can read the Internet service providers’ IP only)

接着将IP提交给百度地理API(可免费申请有限次数的应用,调用方法请参照百度地图API的相关手册),获取json格式的地理信息,包括地址、经纬度等。

Then hand up the IP to Baidu Map API for returning geography data including address and coordinate in json format. Baidu Map API application can be applied for free.

解码返回的地理信息并提取经纬度信息,分别提交给晴天钟的API(调用方法参见晴天钟的手册)和百度地图API,获取天气预报图表和访问者位置地图。

Decode the json and pick out the coordinate, exchange the weather chart and map image by 7Timer!’s API and Baidu Map API.

再给页面稍微美化一下,成品如图1。

Beautify the page, it works! (As Fig.1)

20160501-weatherforecast

图.1(Fig.1)


最后,再次声明利用的资源并鸣谢:

预报图表来源: 晴天钟 – 地理信息引擎: MaxMind GeoIP & 百度地图

Resources used by weather forecast and  acknowledgements

– Weather Chart Resource: 7Timer!

– Geography Resource & API: MaxMind GeoIP & Baidu Map

 

10/04/2016 – Plus-minus Notation Display Failure – 正负号显示问题

>Tolerance Checker Development Log – 极限偏差查询器开发日志<

最近的主要工作室录入极限偏差数据库,一直都进展的比较顺利,但是今天录入到JS/js公差带的时候遇到了一点问题,JS/js带的极限偏差是±值,一般比较便捷的记法就是±x,但是我以此格式录入的数据库最后查询出来发生了错误,显示如图1。

What I am doing recently is recording data, there was no problem until plus-minus notation display failure came out. When I met the JS/js tolerance zone, numbers are displayed  with ‘±’ ahead, which is like ±x. But the plus-minus notation became ‘?’ as Fig.1.

20160410-Plus-minus Notation Display Failure

图.1(Fig.1)

目前我猜测的可能是在查询的某个环节出了问题:

I think it must be an error at following stage:

  1. php excel reader工具不支持正负号;
  2. 字符集对正负号的支持问题;
  3. 查询器默认字体或者字体库的支持问题。
  1. php excel reader does not support plus-minus notation;
  2. character set does not support plus-minus notation;
  3. fonts of the checker/page do not support plus-minus notation.

由于这个问题无伤大雅,我暂时用比较简单的办法略过这个问题:用+/-来代替±。

Nevertheless, it is not a serious error and I decide to replace the ‘±’ with ‘+/-‘ temporarily.

 

D693-77.03-飞虎队队员眼中的中国1944-1945-China in the Eyes of Flying Tigers 1944-1945

出版物封面

Cover of Publication

 

出版物名称

Name of Publication

飞虎队队员眼中的中国1944-1945

China in the Eyes of Flying Tigers 1944-1945

著者 Author (美)艾伦·拉森(H. Allen Larsen)

(美)威廉.迪柏(William L. Dibble)

出版单位 Publisher 上海文化出版社(英文版)/上海锦绣文章出版社(中文版)

Shanghai Culture Publishing House(English Version)

Shanghai Brilliant Publishing House(Chinese Version)

简介

Introduction/ Abstract

书中选录的二百余幅图片,真实记录了飞虎队老战士艾伦.拉森先生和他故去的战友威廉.迪柏先生于1944-1945年期间,在中国所拍摄到的当时中国和中国人民的珍贵画面,以及他们与中国人民共同战斗的难忘经历。这些具有重要文献价值的珍贵历史照片,足以填补中国抗战历史时期彩色摄影的空白,更重要的是,它们展现了中美两国人民当年在面对共同的敌人日本法西斯侵略时,同仇敌忾,并肩战斗,谱写友谊的一段光荣历史。

The book is a photography collection shot by flying tigers during 1944-1945, and it records the actual historical pictures of china and Chinese people as well as their unforgettable memory with Chinese people fighting together. These pictures reflect Chinese society at that special period in the eyes of especial people, and have a higher historical value.

个人书评

Personal Book Review

绝大部分男孩都对军事和历史充满兴趣,比如我就一直经常了解关于二战的历史和故事。中美两国作为二战中的主要参战国以及盟国,曾经产生出许多令人敬佩的故事,这就包括美国援华飞行队——飞虎队的故事。飞虎队的故事可以讲上不止知三天三夜,但与飞虎队有关的相册集锦往往能做到一图胜前言,这本书就是一个历史讲述者,让读者从一个方面了解战争的残酷,人性的光辉,历史的瞬间。

Most boys have a similar habit on military and history. For me, I still keep my interest in WWII stories. China and United State are both main countries and allies fought together in the terrible decades, honorable events and people were shining in those years, including Flying Tigers, the American Volunteer Group. Details of them can be written with millions of words on thousands of pages, but photos taken by the participants will tell the readers with truth, about the moments in history, the cruelties of war, and the glory of human nature.

ISBN/ISSN 9787807407676 (English Version)

9787545204995(中文版)

出版日期

Date of Publication

2010年4月1日(中文版)

June 1, 2012(English Version)

出版地

Place of Publication

上海

Shanghai

中图分类号

CLC Code

D693.9-64 中图法分类名称

CLC Category

社会生活-中国-1944~1945-摄影集
国际十进分类号

UDC Code

77.03 国际十进分类名称

UDC Category

Documentary photography. Photographic records and their interpretation;

纪录片摄影、摄影记录及其解读

 

书刊定价

Price of Publication

CNY48.00

USD72.11

书刊语言

Language

简体中文

English

购买正版

Purchase of Authorized Edition

 Amazon.com(US)

Amazon.cn

17/03/2016 – Tolerance Checker Development Log– 极限偏差查询器开发日志

前期规划日志 Previous Development Plan :

>10/02/2016<

>08/03/2016<


后续开发日志 Development Update:

>10/04/2016<


>前往查询器 Use the checker<

以下为主要开发内容 The following is the main content:

近几日完成了查询器的主要开发工作并上线测试。

Main development work has been finished on these days, and the tolerance checker has been launched into beta test.

首先是确认了需要使用的php excel reader工具,资源来自SourceForge上的一个项目:<PHP-ExcelReader> ;调用方法参考了搜索到的这篇日志:<PHP ExcelReader用法>

First, excel reader tool has been selected. It is a SourceForge project:<PHP-ExcelReader>, and I find a Chinese user manual by this link:<PHP ExcelReader用法>

其调用方法是:

How to invoke the PHP-ExcelReader:

[php]
require_once ‘Excel/reader.php’;
$data = new Spreadsheet_Excel_Reader(); /*invoking reader*/
$data->setOutputEncoding(‘UTF-8’); /*text output encoding*/
$data->read(‘db.xls’); /*read the excel sheet*/

echo $data->sheets[0][‘cells’][i][j]; /*read the (i,j)cell
and output data*/
[/php]

这个基本结构是针对查固定路径的单个excel表格的,我先编写了一个3行3列excel表格进行测试,表单通过post形式将需要的单元格位置(i,j)将表单信息告知excel_reader,reader返回查询数据:

The basic code structure of this tool is used to read a single work sheet in one .xls file by solid path. So I created a 3*3 excel sheet for test. Html form choices with (i,j) cell position are sent to excel_reader by ‘post’ method, which would return and print out the checking result by code below.

[php]

echo $data->sheets[0][‘cells’][$_POST["row"]][$_POST["column"]];

[/php]

测试结果如图1, 成功!进入下一步开发。

Test was successful as fig.1! Next step.

20160317-checker_devlop_log-1

图.1(Fig.1)

根据日志>2<中图2的逻辑与文件结构,需要查询不同路径下不同xls的文件,路径由表单输出的数据决定,所以excel_reader读取路径处不能再填写定值,故在这之前定义了一个变量$path, 同样采取post的形式获取表单数据并编写路径,然后让reader读取$path路径:

According to logic and files structure posted on fig.2 of log >2< , the checker must visit different folders and pick out the exact .xls database file from dozens of them. In other words, the file path and the name of file should be variables. So I define a $path variable which get message from the form by post method as well. And the reader will read the $path instead of solid path.

[php]

$path="db/".$_POST["type"]."/".$_POST["zone"].".xls";

……

$data->read($path);

[/php]

由于我只在一个文件夹里存放了一个db.xls文件,当我在表单选择了一个空路径的时候或者我没有填写完所有表单项却提交了表单,reader返回了”The filename …….xls is not readable”的错误信息,我意识到整个单选表单必须填写完成才能提交。搜索了许多方法,一开始发现需要通过js等工具进行表单验证,弹出提醒框等等等。踏破铁鞋无觅处得来全不费工夫,html5直接提供了表单必填的验证,在input里添上短短一句便可:

I uploaded only one db.xls file to the database folder, then I found a problem when I select a wrong path or leave some form blank —— reader told me that ‘The filename …….xls is not readable’. And I realized I must set something for form correction. So many methods told me to use js code or else when the exactly excellent answer is so simple that you should write only 2 word in the <input>, thanks to html5 :

[html]

required="required"

[/html]

剩下的就让浏览器来做就好了,如图2

The rest of the work? Browsers will do for you as fig.2!

20160317-checker_devlop_log-2

图.2(Fig.2)

显然,如上图,我用div把表单框起来并稍微美化了一下。

Obviously, I beautified the page by <div> tag.

主要的问题都解决了,就把表单修改为正式的极限偏差查询器项目,然后上传了一个完整数据的.xls数据表,极限偏差查询器正式进入线上beta测试!

Works done and problems solved. The html form was changed into real tolerance checker type. And I uploaded the first database .xls file with useful tolerance data. It is beta test now!

20160317-checker_devlop_log-3

下一阶段的工作目标:

Plan for next version:

  1. 由于我获得的极限偏差表是纸质的,所以所有数据必须手动创建.xls文件,需要实现公差查询的基本功能,这个是主要任务也是工作量最大的任务。
  2. 学会一些CSS的内容,将查询器美化一下。
  3. 学会一些Jquery、ajax的内容,将跳转显示查询结果改为在主页刷新显示查询结果,即客户端只需要显示index,同时包含表单和查询结果显示框,表单不断复用。
  1. Tolerance data I own is on papers. If the tolerance can function as a real one, I must type the data into computer by hand and edit .xls files manually. Hard work but necessary.
  2. Learn something about CSS and use it to beatify the checker’s page.
  3. Learn something about Jquery, ajax or else. The codes can refresh the checker index page without jumping into others. Which means, the index contain the html form and the result display on same page, visitor can reuse the form and read the result on same page, without clicking “Back to index and check again”.

13/03/2016 – Haircut myself – 自理头发

(English version follows Chinese Part)

大概从几岁的幼年开始一直到高中再从大三开始至今(大一大二时因为中二年纪留的较长头发略去不表),我都一直是比较方正的短发头型,但是要保证风格统一的发型还真是件难事,小学期间因为都仰赖家附近理发店里三四个比较熟悉的理发师,一直都能维持稳定。但初中开始,高中,大学期间,给我理发的理发师除了经常变换,就算是连续给他剪头发,也都还是不能记住我的风格,又要重新解释“这个怎么剪怎么剪……”。

My hair style has not been changed for dozen years (special situation during first two years in university with long hair because of idiot me) , my short haircut is some kind of difficult staff to maintain. Thanks to hairdressers near to my home, it was still easy to take good care of my hair style. However, things will not always go as your wish. Since junior high school years, not only changing of my hairdressers but also forgetfulness of them were bothering me. I had to discuss how to make the exact style I want every time those years.

终于我忍不住了,在大四的时候网购了一个电推子,附送了点工具,打算自己剪!

My patience is limited. I bought a electric hair clipper with some tools in forth uni-year. Do it myself!

第一次自己剪头发是悲剧学到了一点技巧。悲剧的原因不太成功是因为:一是不了解电推子的威力,一下手发鬓就剪得太薄了;二是不会用梳子,所以剪得坑坑洼洼。还好只是自己剪了发鬓,没有剪头顶,所以最后赶紧去理发店给修了回来;三是没办法看到后脑勺,自己剪不了。

The first try was tragedy taught me with experience. It was not success for these reasons: I cut to much hair when I handle the clipper first time, muscle control needs practice; There will be potholes  without comb; Nothing can be cut from back of your head until you have second mirror. Luckily I stop my haircut before out of control – I only cut the hair on the temples. And I sought for rescue in barbershop at last.

之后因为有点心灰意冷,便没有再给自己理发的打算。但偶尔还是拿理发剪刀给自己修修刘海,修修发脚。修着修着意识到其实就是缺镜子缺梳子嘛,再试一次好了。

Honestly, I was upset and decided to give up. But it was OK with my skill in trimming  my fringe with scissors. After I realized the core factors are comb and mirrors, Plan B was on the way.

第二次剪已是几个月后的前些天。这次充分吸取了上次的教训:老老实实用限位梳确保不会剪得太多;认真用梳子比划了发型,提前练习了另一只手操作梳子;找了另一块小镜子配合屋里的穿衣镜,能够看见后脑勺。

Few months later, the well trained guy gave a second try days ago. Limit comb was used to prevent over cutting, previewed the hairstyle with comb on my left hand and the second mirror for back-head-haircut.

最后的结果是图就不放了:总体上比较成功,理出了需要的发型,没有坑洼,厚薄均匀。仍需改进的地方就是:发脚发鬓因为用了限位梳所以太厚,下一次再练习练习直接剃。

Well, happy ending no picture :approached my hair style, no potholes, average thickness. Need to promote: too thick at the hair on the temples.

总结下来,就是:一定要会用梳子,一定要有第二块镜子

Conclusion, there must be comb and two mirrors.

我所用到的工具如图1,分别是:①充电理发器(加限位梳)②美工剪刀,修发脚③理发剪,剪头顶长发的长度④梳子⑤架在相机三脚架上的小镜子,配合穿衣镜看后脑勺。

My equipment shown on fig.1,

①electric hair clipper (with limit comb) ②art scissors, trimming hair foot ③haircut scissors, trimming long hair ④comb ⑤second mirror attached to the camera tripod.

20160313-haircut

图.1(Fig.1)