2019

PyCharm (JetBrains系IDE)运行配置中环境变量的附加修改问题

今天在研究python liblas时,发现使用的IDE PyCharm的一个小功能缺陷:在项目运行配置中的环境变量里无法以追加的方式修改当前环境变量的值,而且又看了下IDEA,相关功能的UI都是一样的,所以应该是JetBrains系的IDE都有同样的问题。
首先,windows下使用python liblas时,除了pip装liblas包以外,还要有相关的原生库,否则import的时候会直接报错。好在win下可以直接通过OSGeo4W安装预编译好的liblas库( https://trac.osgeo.org/osgeo4w/ ),装好后会有专用的命令行环境快捷方式,看了下和Visual Studio的Developer Command Line Prompt一样,会在这个专用命令行环境里设置一堆环境变量,这时直接运行python项目依然会报错,查了下原来是在加载liblas原生库时寻找Path环境变量里的路径找不到出的错,而专用命令行已经把OSGeo4W的bin加进去了…

Continue reading…

DNSPod API升级TLS 1.2导致ArDNSPod脚本失效问题

博主我常年在路由器的OpenWRT系统上以crontab方式跑ArDNSPod:https://github.com/anrip/ArDNSPodl来实现DNSPod上解析域名的DDNS功能,但是今天突然发现在出口IP变化以后,DDNS域名没有像往常一样正常更新(以往反应都是很快的),检查了下也不是以前出现的又被ISP变回内网IP导致的,于是ssh登上路由器的局域网IP,手动执行了下crontab里sh的命令,发现提示这个:

root@xCloud:/opt/usr/ardnspod/ddnspod.sh
Linux
Updating Domain: xxxx.k-res.net
hostIP: xxx.xx.xxx.xxx
Get Record Info Failed!

Continue reading…

CocosCreator TypeScript项目引用第三方库的方法和问题记录

TypeScript对于习惯强类型语言(比如Unity C#)而又要写JavaScript项目(比如CocosCreator Egret)的程序员来说,确实提供了很大方便,而且对于一些由于弱类型语言导致的只能运行时检查的低级错误,使用TS都能很好的避免。

这次要记录的是使用TypeScript作为主开发语言的CocosCreator项目中引用第三方库的方法和问题,实测的是MessagePackprotobufjs和Photon这几个库。

Continue reading…

CocosCreator 2.0的cc.eventManager弃用换新API记录

Cocos Creator升级2.0以后发现原来写的一些代码开始报弃用警告了,今天有空学习下新API并更新下原来的代码,之前写的实现监听touch起动停事件的代码是这样写的:

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
// use this for initialization
onLoad: function () {
    let self = this;
 
    cc.eventManager.addListener({
        event: cc.EventListener.TOUCH_ONE_BY_ONE,
 
        onTouchBegan: function (touch, event) {
            // x = touch.getLocation().x
            // y = touch.getLocation().y
 
            return true;
        },
        onTouchMoved: function (touch, event) {
            // x = touch.getLocation().x
            // y = touch.getLocation().y
 
            return true;
        },
        onTouchEnded: function (touch, event) {
            const x = touch.getLocation().x;
            const y = touch.getLocation().y;
            const cp = self.dragonPlayer.getPosition();
            NetworkManager.instance.getNetPhoton().sendMyPost(cp.x, cp.y, x, y);
            const dist = cc.v2(x, y).sub(cp).mag();
            self.dragonPlayer.stopAllActions();
            self.dragonPlayer.runAction(cc.moveTo(dist / 80, x, y));
            return true;
        }
    }, self.node);
},
Continue reading…