10/03/2017 – C#/UWP/Personal Library Manager – C#/UWP开发和个人图书馆应用

(English version follows Chinese Part)

由于家庭环境的熏陶,重视藏书和整理书架成为我的生活习惯。无论是纸质藏书还是书籍电子文档,我都妥善地按照图书分类法进行了整理存放。除了本网站的图书馆模块进行书目的记录,其实很早之前我就利用图书馆管理软件建立了一个数据库来管理我拥有的书籍,然而这个软件是中国的,其分类法仅采用了中图法,所以对外文文献的分类不是很友好。另外,这款软件实际上更适合于公共图书馆的管理,并不是专门的“个人藏书数据库”,操作上比较复杂,很多功能对个人来说太多余。界面也实在是难看的不行。

I grew up in a family with tons of books, be taught to treasure them and shelving books become one of my hobbies. No matter paper or e-file, collecting and shelving are what I will do when I own a new book. Besides the library module for this website, I have been using library application to manage my book collection. But this app uses Chinese Library Classification (CLC) only, which is not friendly for books in other language or published in other countries. Moreover, it technically is a application for public library, too much functions for personal use and make it burden. GUI is ugly, too.

恰巧近日来我对笔记本的系统进行了升级,Windows 10支持的UWP应用给我留下了深刻印象,无论是metro的实用性还是当下流行的扁平化设计还有内容的云同步让我萌生了一个念头,要不然自己学习一些UWP应用的开发办法,自己做一个“个人藏书数据库”的应用。就算是已经有类似的应用,但做个适合自己使用习惯的应用或许也不错,反正码代码不经常是重复造轮子吗:)

Coincidentally, I update my laptop into MS Windows 10. UWP apps impressed me a lot. Useful and flat design of “Metro”, cloud sync is amazing. How about learn something about coding and create a special “Library manager UWP” for myself? Maybe similar apps does exist, “create wheels again” is so popular in coding, right?

经过网络检索,也参考了一下代码行业的朋友的看法,对这个想法进行了一下初期的规划:

After some internet searching and hear some advises from friends, I have a initial plan.

开发语言以C#为主,采用SQL进行数据存储。

Developing in C#, SQL for database.

一期工程:搭建简单的数据库录入和检索功能,并具有一定美观度的GUI。录入和检索功能主要是能够存储书目的基础信息,基础信息包括书名、著者、ISBN、其他必要信息以及图书分类号,这里尤其强调图书分类号,我打算同时采用中图法、国际十进法和杜威法三种。

Stage One. Simple library data input and searching function. Proper GUI. Basic information of books are title, author, ISBN, Classification and other necessary section. For Library Classification, I decide to use Chinese Library Classification(CLC), Universal Decimal Classification (UDC) and Dewey Decimal Classification(DDC).

二期工程:能够录入书籍封面、书籍简介、进一步以扁平设计和动态效果美化应用。

Stage Two. Cover image and book abstract of the books can be input. Flat design GUI and more appearance features.

三期工程:实现UWP功能。

Stage Three. UWP Construction.

四期工程:实现网络同步。

Stage Forth. Sync Function.

为了这一想法,需要进行大量的学习,C#,数据库,UWP,GUI设计……想必这也是兴趣对“自强”这一目标的督促把。要不,先给这个工程取个名字把。

To achieve these stage goals, more studying is coming, C#, database, UWP, GUI design… I think that is kind of power can push one to strengthen oneself with knowledge. Why not start with giving a name to this project?

书阁。

ShelfCollect.

17/11/2016 – Darcy Friction Factor Checker – 达西摩擦系数查询器

(English version follows Chinese Part)

其实这个就是之前谈过的莫迪图查询器, 但是后来因为学习上比较忙,就没怎么研究。这两天看了一下,似乎并不需要做莫迪图查询器这么复杂,只需要根据输入参数代入逼近公式运算就可以得到所求摩擦系数。具体需要利用JavaScript来实现,通过输入的参数,在服务器端按照逼近公式计算,显示运算结果。

Actually, it is the moody chart checker I have mentioned before, but I was too busy for my courses to think about how to develop the checker. In these few days I found that there is no need to build a chart checker, a web calculator will work. Input necessary values and calculate with equation approximation, the display the result on the page. JavaScript will be used to develop the calculator.

按照Darcy friction factor formulae中提供了很多种逼近公式。

Darcy friction factor formulae shows many equation approximations.

首先尝试了一下Alashkar公式。

Try the Alashkar equation.

20161117-darcy-friction-factor

运算部分的JS中代码大概如下:

Calculation part of the JS code:

[code language=”javascript”]

function cal(form)
{
var a=Number(form.a.value);
var b=Number(form.b.value);
var c=Number(form.c.value);
var d=a/(b*3.7065);
var e=2.5226/c;
var f=1.665368035*e;
var g=Math.pow(f,0.8373492157);
var h=d+g;
var i=Math.log(h);
var j=e*i;
var k=0.8784893582*j;
var l=d-k;
var m=Math.log(l);
var n=e*m;
var o=0.8686068432*n;
var p=d-o;
var q=Math.pow(o,-2);
var r=Math.log(q);
form.s.value = 1.325474505*r;
}

[/code]

然而求出来的结果似乎并不对。还需要再研究研究。

It works but the result is strange, more research to do.

21/09/2016 – Moody Chart Checker – 莫迪图查询器

(English version follows Chinese Part)

这个学期在上空气动力学这门课,其中很多计算涉及到查询莫迪图。我在想能不能弄个网页版的莫迪图查询器帮助提高效率。具体实现方法可能要参考公差查询器,用excel数据表来记录离散的莫迪图线的值,或者更加复杂的方法。先在这里提出一个设想。

I have a course this semester, which is aerodynamics. Large parts of calculations are based on checking moody chart. I am considering about set up a web-base checker to assist my calculating efficiently.  Maybe similar method from tolerance checker is applied. Discrete points of moody chart recorded in excel and read by php. Or more complicated. Mark here.

03/05/2016 – Astronomical Weather Forecast Ver2.0 – 天文天气预报2.0版

>Astronomical Weather Forecast Dev Log – 天文天气预报开发日志<


1.0版本由IP获取经纬度没多大问题,但是百度地图API只能提供东亚地区城市的经纬度信息,然而晴天钟可以提供全球绝大部分地区的预报信息,所以不太匹配。按照晴天钟介绍中,其本身所使用的经纬度信息主要取自谷歌和GeoIP。我决定将经纬度信息引擎换成GeoIP。

Version 1.0 worked well, but it can provide forecast of East Asian cities due to the Baidu Map API area limit. It was a little wasteful for 7Timer!’s global  forecast. Reading from 7Timer!’s introduction, coordinate resources what it is using are Google and GeoIP. I decided to changed into GeoIP as well.

调用方法也不复杂,就是需要前往MaxMind下载开源的全球城市地理信息包,然后上传到网站目录中进行调用。

It was not complicated, all I should do is downloading open source global cities geography data pack and uploading to my website directory.

具体调用语句比较简单

The data pack function is called by

[php]

$gi = geoip_open("GeoLiteCity.dat",GEOIP_STANDARD);
$record = geoip_record_by_addr($gi,$ip);

[/php]

其中的$ip即已经获取到的访问者IP地址。调用后,需要的地址、经纬度、时区等信息从$record中提取即可。

$ip is the IP address fetched from visitor. The address, coordinate and time zone information can be picked out after the function is called.

其他内容并没有什么修改。

The other parts of the forecast core code has not been changed.

不过为了符合GoYuwei.Com的『双语』特征,多弄了个英文版界面。不过由于并非专业,还只能是中、英双语分为两个页面,这也提供了契机,下次可以学习php的多语种页面实现方法。

Pages are in Chinese&English and GoYuwei.Com is called ‘bilingual website’. I created a English version of the forecast. However, they are in two page files. There will be chance I can learn more about PHP and present the bilingual page in one web file.

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