作为完全独立生活的第一年,失去约束,放飞自我,狠狠地狂野了一把。然后,竟然还意外地做成了不少事情..
研究方面,主要搞了三个。上半年调查了Personality trait 对Second Language Acquisition 的影响,最终发现只有内倾型和Grammar优势有着significant 相关性。暑假在欧朗期间搞了关于物联网行业的一个调查,发现业内存在显著的客制化和去中心化发展趋势。下半年在暑期结论的基础上研究了一下Fog Computing, 基本上读遍了近两年IEEE上关于Fog 的文章,愈发坚信未来10年互联网云雾结合的趋势。一个感觉,中国会是这一场互联网架构变革中的关键
《 刀剑乱舞-花丸 》
《 少年锦衣卫 》
《 四月是你的谎言 》
《 摇曳露营 》
《 月色真美 》
《 擅长捉弄的高木同学 》
《 CLANNAD 》
《 KANON 》
《 AIR 》
《 可塑性记忆 》
《 冰菓 》
《 Charlotte 》
《 龙与虎 》
《 星之梦 》
《 Angel Beats 》
《 斩 赤红之瞳 》
《 罪恶王冠 》
《 言叶之庭 》
《 樱花庄的宠物女孩 》
《 未闻花名 》
《 刀剑神域 》
《 凉宫春日的消失 》
《 某科学的超电磁炮 》
《 紫罗兰永恒花园 》
《 萤火之森 》
《 声之形 》
《 中二病也要谈恋爱 》
《 缘之空 》
《 东京喰种 》
《 实力主义至上教室 》
《 工作细胞 》
《 绯弹的亚里亚 》
《 从零开始的异世界生活 》
《 埃罗芒阿老师 》
《 我的妹妹不可能有这么可爱 》
《 我的青春恋爱物语果然有问题 》
《 白色相簿2 》
《 境界的彼方 》
《 游戏人生 》
《 citrus 》
《 命运石之门 》
《 未来时在做什么?有没有空?可以来拯救吗? 》
《 路人女主的养成方法 》
《 fate 》
《 进击的巨人 》
《 玉子市场 》
《 小林家的龙女仆 》
《 吹响吧,上低音号 》
《 夏目友人帐 》
《 妖精森林的小不点 》
《 银魂 》
《 干物妹小埋 》
《 魔法禁书目录 》
《 吹响吧,上低音号第二季 》
《 利兹与青鸟 》
《 轻音少女第一季 》
本文已完结哦(๑•̀ㅁ•́ฅ)
]]>早在大一上学期,意外接触Arduino,开始了解单片机。17年11到12月份,曾利用Arduino uno 3搭建了一台功能简易的自动控制平台,主要实现了由红外遥控器控制床帘Light以及小夜灯的功能。在运行一个半月后,由于一次上传代码时意外短路,导致单片机烧毁,自此系统报废,但线路依旧保留。
考虑到第一次搭建完全新手,代码缺少必要注释,更有通向床帘的数十根线路完全缠绕在一起,无法分清具体那几根控制什么传感器或设备,故设重建计划暂时搁置。
半年后的暑假,参加欧朗中国的IETE项目,课程中与公司研发组的软件和硬件工程师愉快得体验了一些单片机的应用研发,了解了单片机及物联网的基础组成及发展现状,在工作闲余,对原有线路进行了测试,分类,贴标签,使其得以正常使用。
8月份,项目结束,回到家中。考虑到家中原有太阳能需加水后需手动关闭,时常发生晚上洗澡后加水忘关情况,造成大量水资源浪费。于是结合欧朗所学,以及自己的实践经验,搭建了一套基于wifiduino和电磁阀的太阳能自动加水系统。为了照顾年老的姥姥方便夜间上厕所,在走廊过道利用原有废弃有线网络线路,搭建了与手动开关密切集合的自动感应开灯系统。由此收获了许多关于家用线路的架设经验。
回到苏州,考虑到一年来的相关经验,认为是时候尝试搭建一套可长期使用的商品级的强扩展性的IoT系统,于是…start搞事情
搭建初期,一切还算顺利。但是随着系统逐渐趋于完善,代码逐渐复杂,经典的Arduino式软硬件兼容问题又逐渐开始捣乱啦~
首先遇到的问题是(大概是由于esp8266与wifiduino的一些神奇的勾当)当把代码通过usb传给wifiduino的时候,代码运行是正常的,但是在断电重启或者Reset后,它就死掉了。。。而且,这个问题只在上传占用了大约十个左右Digital通信口的程序之后才出现,如果只是上传简单的示例程序则运行正常,,最后从淘宝钓了一只路由器用的USB-DC9V升压线,用其持续供电,才确保了板子的正常运行。
遇见的第二个问题也是很神奇。就是,wifiduino在连接tx与rx后竟然无法上传代码!!!当时我一直以为是板子坏掉了
本来是只有一块板子的,但是当他装载了太多控制端之后,大概是死掉了,wifi无法正常连接Blinker..于是我只用它作为控制器,然后将另一块板子连接wifi,将接受信息通过串口传递给主板子执行。于是,运行终于正常了,,,莫名想到了欧朗当时考试的译码器
功能的话目前看来也不是很多,4只传感:2只超神波测距,1只光敏,1只烟雾,4个控制端:1只床外探照灯ledB, 1只小夜灯,1只床头灯,1个小风扇。实现的话,无非就是其相互配合,目前可以准确识别我的存在位置4个,室友的存在位置1个。然后配合行为习惯编程调整灯与风扇。
未来的话,还打算逐步实现–传感层:对室内是否有人的识别 智能层:对室友在宿舍时间规律的学习(神经网络) 控制层:空调红外控制,基于esp8266的微型继电器对宿舍大灯的控制,以及,快乐的话考虑自动养一株辣椒什么的…
最后附上两个板子的代码,,还会更新的哦//祝生活愉快啦~
代码:https://uk.cloud.yimian.xyz/index.php/s/YbPwdkt2mANYoiS
板子运行超过150天,一切运行正常。
出现过几次分钟级别的控制失效事件,怀疑宿舍电网供压不稳导致,事后均自动修复。
上文代码链接已弃用,如有兴趣,可查看由其代码开发的wIoT项目!
稳定运行611天18小时32分钟,正式退役!
已完结
]]>If your server is a new one, it is strongly recommended to update it to an upper version supporting bbr mode, which is a senior centos system core provide by google and it could make your server more efficient.
Firstly download and install bbr core from github.
1 | $ wget -N --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh &&\ |
Use the code to check the core version. If it’s large than 4.9.0 it’s OK.
1 | $ uname -r |
Expected return:net.ipv4.tcp_available_congestion_control = bbr cubic reno
1 | $ sysctl net.ipv4.tcp_available_congestion_control |
Expected return: net.ipv4.tcp_congestion_control = bbr
1 | $ sysctl net.ipv4.tcp_congestion_control |
Expected return: net.core.default_qdisc = fq
1 | $ sysctl net.core.default_qdisc |
Expected return: xxxxxxxx tcp_bbr
1 | $ lsmod | grep bbr |
Pull nginx package from nginx orginzation website.
1 | rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm |
Install Nginx.
1 | $ yum install -y nginx |
Start nginx service.
1 | $ systemctl start nginx.service |
Set preference file of nginx. Click here to get recommended nginx.conf file.
1 | $ cd /etc/nginx |
Apply ssl certification. Rename it with your_domain.crt(key) and download it to your server: /etc/nginx/ssl/
1 | $ //Use scp -r (my ssl file route on my windows)/your_domain.crt \root@(your server ip): /etc/nginx/ssl |
Check and restart nginx service.
1 | $ nginx -t |
Pull and install docker service from official website.
1 | $ curl -sSL https://get.docker.com/ | sh |
Start docker service.
1 | $ systemctl start docker |
Pull nextcloud and mariadb(simplified mysql database on centos ) images from github.
1 | $ docker pull rootlogin/nextcloud && docker pull mariadb:10 |
Start image mariadb with docker.
1 | $ docker run -d --name nextcloud_db -v /data/mysql:/var/lib/mysql -e \ |
Start image nextcloud with docker.
1 | $ docker run -d --name nextcloud --link nextcloud_db:nextcloud_db -p 127.0.0.1:9001:80 -v /data/nextcloud:/data rootlogin/nextcloud |
That is the last step on server. Now let’s start http://YOUR_DOMAIN/ with your explorer.
Recommend to substitute the “localhost” to “nextcloud_db”.
Reference List:
https://www.moerats.com/archives/420/
https://my.oschina.net/yule526751/blog/799004
https://www.moerats.com/archives/420/
自然环境较为恶劣,不完全适合人类生存。于是具备主观能动性的人类开始由改造环境的冲动。这一心理行为逐步早就了名为“发展”的宏伟故事,大家都对其深信不已。就像故事中所描述的一样,人们为了实现这一目标开始减少内耗(战争),社会趋于高度分工化。
人类有一种基本心理效应叫蔡格尼克效应,讲的是人如果开始做一件事情便会难以在中途停下来。这一效应在群体行为中则会变本加厉的体现。当人们开始追求发展,并且得到了一定的激励(生活的确更舒适了,至少人们是这样认为的),于是这个势头便不会轻易停下来了,于是人类进入了千年级别的发展时期。
发展初期,太多的基础设施需要建设,太多的工业需要发展,最重要的是这个时候大家都很穷,都只是在一个信念的支撑下在向着发展的目标努力搞生产。而且一般当这个时候,往往会有其他强国对你虎视眈眈,所以这个时候,大家都会很团结,但不会像祖先以及后辈一样在乎什么环境生态的。只有一个想法便是希望发展起来。
经过大约50年的发展,生活好了,底气足了,开始关注一些更长久的事情,比如教育和环境。于是接下来的50年,开始拼命治理环境,搞教育。于是渐渐的环境好了,下一代也成长起来了。于是年轻一代们便利用他们头脑中的书本知识,开始批判祖先们破坏环境这不好那不好,开始投科研资金,股市凡是跟环保相关的板块开始居高不下,可持续发展开始成为许多人的口头禅。而这时,当时那些破坏环境的罪魁祸首们正退休在家里乐呵呵的看着这一切的发生。大概就是这么一个过程了。
上图的曲线非常科学地向我们展示出了一个国家在发展与环境之间摇摆的必然趋势。在这一图表的背后,反应出了以下几点:
这意味着,如果能够改变上述的任何一个条件,Kuznet 诅咒便有希望得以改变,从而减小摆动周期和幅度,控制环境重建与修复成本,真正在宏观上实现人们所希望的高效率可持续发展。而新一代的数字信息技术正是这一可能性得以实践的关键。
Internet’s architecture had been widely controverted concerning whether it should be centralized or distributed. In the past few years, centralization, which is also regarded as the Cloud, has been gradually applied to the practical structure for modern internet. Under this concept, it has become a popular trend to move functions such as computing, storage and control from end-user devices to Cloud servers [3].Different from the Cloud, the Fog proposes to distribute these functions from servers to the users and let users share them with each other.
Fog can be classified into three dimensions: Fog computing, Fog storage, and Fog control. According to Bonomi et al. [2], Fog computing means to make full use of the computing resources not only from the user devices, but from the location anywhere between users and traditional Cloud servers.An ideal example is that, video game players’ smartphone can access the idle computing resource such as the Central Processing Unit (CPU) of players’ laptop to improve their game experience. Similar to the Fog computing, Fog storage,the second dimension, proposes to distribute user’s data from single storage to many storage devices through certain algorithm [3]. One brave practice for this is Google Spanner [4], which is a public database functioning by distributing user’s data to data centers all around the world to protect these data from being attacked. Shi et al. [5] indicated that the third dimension of Fog, Fog control, tends to split a traditional control system into many small independent and interactive fog systems which only concentrate on providing single function. In this case, if a fog light control system breaks down, the host system can still get the command of the light through another similar fog control system to keep the service incessantly in a Smart Home.
One reason why the Fog contributes to the construction of IoT is that the internet under the concept of Fog can meet the challenging minimized delay requirement of IoT. Prof. Chiang & Zhang [3] indicated that, IoT applications such as Virtual Reality(VR) games, vehicle-to-vehicle communications and unmanned aerial vehicle (UAV)control applications appear to require latencies, the time spent between one device sending a message and the target device receiving the message, lower than tens of milliseconds, which the Cloud services cannot achieve. However, in a Fog computing model proposed by Yousefpour, Ishigaki & Jue [6], the low-level service delay character of Fog architecture had been proved to be persistent and stable. This may mean that latency-sensitive IoT applications can benefit from their delay-minimizing policy.
Another factor of why the Fog facilitates IoT construction is that a Fog structured internet can provide uninterrupted services, which IoT applications are desirous of. In a Fog structure a control behavior is achieved by several parallel control systems working together while each system has the potentiality to support the whole control behavior independently. This makes it possible that a Fog service can still function when devices disconnect with the server or part of the Fog net is updating or even broken [3]. This trait becomes crucial for Connected Vehicle [2] to ensure its operation when it is offline or meet with an accident.
Apart from these reasons,comparing to the current Cloud internet, the architecture of a Fog internet seems to be more eco-friendly, especially for the coming IoT era. In the 21stcentury, environmental protection has been becoming a comparatively important agenda for policy making and business activity. Consumers expect fewer environment-harmful elements in the product or generated from its manufacture. However, accordingto Aazam et al. [1], in the future, everything such as a bottle of cola or a leaf of a tree can be part of Internet, which may require a considerable number of new electrical equipment while each one of them might hurt the environment to some extent. However, this may mean that the ecological environment would be protected if the amount of necessary electrical products could be decreased. Researchers had assessed the suitability of Fog computing and they pointed that a Fog internet can result in less power consumption and lower CO2 emission in the context of IoT [7]. Apparently, these may transform the internet closer to a green net.
One argument is that the Fog architected IoT was questioned in privacy and security [3]. Since the important internet functions and resources are near the users, it becomes risky for a Fog device of being attacked. However, this might be solved by collaborating with other technics. For example, Zyskind and Nathan [8] designed a decentralized personal data management algorithm basing on blockchain, a powerful encoding method. This algorithm might be one possible solution to cover the data security shortage of Fog net and keep the system safe.
To conclude, although the IoT based on Fog concept may be currently doubted in privacy and system security, it has satisfactory performance in respect of latency, system reliability and eco-friendliness, which are crucial factors on facilitating IoT construction. However, Fog is still a new concept and nearly all of the relevant research was conducted in the past two years. It is still a long way to go before the Fog concept can be actually applied into the framework of IoT.
Reference (IEEE)
[1] M. Aazam, I. Khan, A. A. Alsaffar and E. Huh, “Cloud of Things: Integrating Internet of Things and cloud computing and the issues involved,” Proceedings of 2014 11th International Bhurban Conference on Applied Sciences & Technology (IBCAST) Islamabad,Pakistan. [Online]. 14th – 18th January, 2014, Islamabad, 2014, pp. 414-419.Available: https://uk.cloud.yimian.xyz/index.php/s/PAbkLC5bqoWFcJi
This is an early peer-reviewed article introducingthe concept of Cloud and IoT. It provides me the scope of how researcherslooked at Cloud and how they understood IoT in 2014 (when Cloud Computing beganto be popular). I have used this to provide some background about Cloud inintroduction.
[2] F. Bonomi, R. Milito, J. Zhu and S. Addepalli, “Fog computing and its role in the internet of things” In Proceedings of the first edition of the MCC workshop on Mobile cloud computing. [Online]. August, 2012, pp.13-16. Available: https://uk.cloud.yimian.xyz/index.php/s/ZnyXdJKk84dR2QD
Thispaper firstly pointed out the Fog concept. Its writers were all from Cisco, which is considered the most powerfulcompany on providing Internetworking solution. I have used this sourceto introduce some background of Fog and Fog computing and the Connected Vehicle,one of their imaginary Fog-IoT application.
[3] M. Chiang and T. Zhang, “Fog and IoT:An Overview of Research Opportunities” in IEEE Internet of Things Journal. [Online]. vol. 3, no. 6, pp.854-864, Dec. 2016. Available: https://uk.cloud.yimian.xyz/index.php/s/Fi7KELbjE7kR3qq
This is an invited paper published by IEEE, the most influential organization for Engineer. Chiang is from Princeton and Zhang is from Cisco. After this paper, more researchers began to notice Fog. I have used this source to introduce, evaluate and query Fog because this is a rare high-quality paper.
[4] J.C. Corbett, J. Dean, M. Epstein, A. Fikes, C. Frost,J.J. Furman, S. Ghemawat, A. Gubarev, C. Heiser, P. Hochschild and W. Hsieh, “Spanner:Google’s globally distributed database”, ACM Transactions on Computer Systems (TOCS). [Online].vol. 31, no. 3,pp. 8, Aug. 2013. Available: https://uk.cloud.yimian.xyz/index.php/s/oxj4EAm6M78GPN8
This paper detailly introduced Google Spanner. Google Spanner was designed based on this paper. I include this source because I think Google Spanner is are volutionary attempt of Fog storage. And I have used this as an example when I try to describe the concept of Fog storage.
[5] W. Shi, J. Cao, Q. Zhang, Y. Li and L. Xu, “Edge Computing: Vision and Challenges” in IEEE Internet of Things Journal. [Online]. vol. 3, no. 5, pp. 637-646, Oct. 2016.Available: https://uk.cloud.yimian.xyz/index.php/s/p4QGJA6AWPDKEK4
This is a journal from IEEE and have been cited 8422 times. It provides several novel ideas concerning how would the Fog be applied in computing field. I have summarized the Fog control concept from this source and cited their questioning concerning the privacy and security issue of Fog IoT.
[6] A. Yousefpour, G. Ishigaki and J. P. Jue, “Fog Computing: Towards Minimizing Delay in the Internet of Things” 2017 IEEE International Conference on Edge Computing (EDGE), Honolulu, HI. [Online]. 2017, pp. 17-24. Available: https://uk.cloud.yimian.xyz/index.php/s/EsDjHnHHGND2SoD
The authors were from Texas University and they are not famous in Fog field. As it is the only paper which evaluated latency, the most significant trait of Fog IoT, mathematically and got a seemly reliable result, I have used this to support my low latency argument.
[7] S. Sarkar, S. Chatterjee and S. Misra, “Assessment of the Suitability of Fog Computing in the Context of Internet of Things”in IEEE Transactions on Cloud Computing.[Online]. vol. 6, no. 1, pp. 46-59, Jan.-March 2018. Available: https://uk.cloud.yimian.xyz/index.php/s/m7of3EjZ6Tji7jF
This paper was just published a few month ago. It was written by two students and one doctor, which makes it not so authoritative. However, since there are few Fog research, I finally decide to use its modeling result to support that Fog IoT is more environment friendly than Cloud.
[8] G. Zyskind, O. Nathan and A. ‘. Pentland,”Decentralizing Privacy: Using Blockchain to Protect Personal Data” 2015 IEEE Security and Privacy Workshops,San Jose, CA. [Online]. 2015, pp. 180-184. Available: https://uk.cloud.yimian.xyz/index.php/s/7FirJsrD93wzDxN
This paper was published by IEEE. Zyskind was from MIT, which makes the source seems to be credible. I am interested in the blockchain algorithm which is theoretically absolutely safe as it mentioned and I think it is one ideal method to deal with the security problem of Fog IoT.
Attachment
Fog and IoT PPT: https://uk.cloud.yimian.xyz/index.php/s/GbLfqxX2CBTDdRR
天气是指一段较短时间段内的大气状态,而气候研究的主要使更长时间中周期行动大气状态规律。简言之,气候是周期变化的天气。气候具备地域性,随纬度与海陆分布密切相关。在更长的时间维度上,我们发现地球的气候变迁也呈现出显著的周期性。
上图描述了地球的历史温度,其具有明显的周期性。值得注意的是,每当全球气候变暖,便会激发物种爆炸。而现在,正处于一次小规模的温度上升期,且温度上升速度与历史数据并无太大异常,因此无法确凿证明其与人类二氧化碳排放有关。
积雪后,随着时间推移,积雪会经历以下几种状态:
由于积雪时的温度不同,因此冰层中会以年为单位周期变化,通过计数层数即可获得某一冰层的所属年代。
大气中${}^{18}O/{}^{16}O$比值与温度密切相关,因此通过测量冰层中相应位置的同位素比值即可间接推得当时的温度。
此外,还可以通过类似的方法测得各历史时期的$CO_{2}$浓度。
由上图可看出,地球历史上,二氧化碳浓度与温度具备密切的相关性。直到近150年,这一规律被打破,大气二氧化碳浓度极具上升。人表示慌得一批⌇●﹏●⌇
$$Increase CO_{2} = Increasing Population + \Delta Emission per Person + Efficiency of CO_{2} Use$$
这个公式也可以转译为:
$$碳排量 = 人口 + 经济 - 科技$$
Intergovernmental Panel on Climate Change (IPCC) 制定了一个小目标来限制各国温室气体排放,表示到2050年,全球二氧化碳排放量要卡一半。。这其实等同于将排放量和钱联系起来,给每个国家分一部分排放量,如果多排就要交钱来买。结果已经工业化完的发达国家切走了超过40%的蛋糕,国科大校长老丁表示这不能忍啊,发展中国家的人到底还有没有人权啊ヾ(´・ ・`。)ノ”
神奇的事情开始发售了
1 | const home = cooo; |
[scode type=”red”]本API不承诺永久维护,使用前请务必斟酌使用风险!![/scode]
https://api.yimian.xyz/img
随机二次元图片
GET/POST /img?type=moe
随机Bing壁纸
GET/POST /img?type=wallpaper
随机二次元头像
GET/POST /img?type=head
随机图床图片
GET/POST /img?type=imgbed
随机1920x1080尺寸二次元图片
GET/POST /img?type=moe&size=1920x1080
名称 | 描述 | 格式 | 示例 |
---|---|---|---|
type | 图片种类 | moe /wallpaper /head /imgbed | type=moe |
size | 根据图片大小筛选 | ??x?? ;*x?? ;*x* ;??-??x?? ;??-??x??-?? ;??-??x* | display=1920x1080 ;display=1920x* ;display=1920-1950x230-500 ;display=1920-1950x* ; |
range | 尺寸误差范围 | number | range=100 |
id | 根据图片id筛选 | number | id=15 |
path | 根据路径提取图片 | abs path | path=wallpaper/img_··mal.jpg |
display | 是否以网页格式展示 | true /false (default) | display=true |
R18 | 是否显示18禁图片 | true /false (default) | R18=true |
二次元(默认)
GET/POST /img?type=moe
bing每日壁纸
GET/POST /img?type=wallpaper
二次元头像
GET/POST /img?type=head
呓喵酱图床
GET/POST /img?type=imgbed
こいぬちゃん
GET/POST /img?type=koino
EasyVer人机验证
GET/POST /img?type=easyver
如果本参数置为true,则会禁用302跳转,直接返回完整图片编码。本方法效率极低,速度很慢,请慎用。
false(默认)
GET/POST /img?display=false
true
GET/POST /img?display=true
使用本参数限制图片尺寸。本参数支持以下格式:
??x??
GET/POST /img?size=??x??
??x*
GET/POST /img?size=??x*
\x??*
GET/POST /img?size=*x??
\x**
GET/POST /img?size=*x*
??-??x??
GET/POST /img?size=??-??x??
??x??-??
GET/POST /img?size=??x??-??
??-??x??-??
GET/POST /img?size=??-??x??-??
??-??x*
GET/POST /img?size=??-??x*
\x??-??*
GET/POST /img?size=*x??-??
本参数规定允许的size的误差,需搭配size使用,默认为0。
对于??型size参数
GET/POST /img?size=??x??&range=100
对于??-??型size参数
GET/POST /img?size=??-??x??-??&range=100
对于*型size参数
GET/POST /img?size=*x*&range=100
每一个种类都有自己的id系统,同一种类下不同图片id唯一。
二次元
GET/POST /img?type=moe&id=15
bing每日壁纸
GET/POST /img?type=wallpaper&id=2019-07-28
二次元头像
GET/POST /img?type=head&id=15
呓喵酱图床
GET/POST /img?type=imgbed&id=529745e0
使用绝对路径直接提取图片,优先级高于type,效率最高。
GET/POST /img?path=xx/xx.xx
种类/图片文件名
imgbed/img_529745e0_900x900_8_null_normal.jpeg
是否显示18禁图片,默认为false。
GET/POST /img?type=xx&R18=true
若找不到指定的type类型,将会自动返回一个moe类型的图片。
返回JSON
1 | { |
[scode type=”yellow”]每台设备每天全局调用上限500次!![/scode]
]]>首先说好,
四个空格的Tab缩进大法好!!!
四个空格的Tab缩进大法好!!!
四个空格的Tab缩进大法好!!!
大括号不换行!!!
大括号不换行!!!
大括号不换行!!!
命名以让别人一眼就能明白为佳,理想中看你的代码就像读一首英语小诗般惬意 ::aru:insidious::
编译器常量全大写,字符间用单下划线连接。如:
1 |
变量基本采用小驼峰命名,规则是单词之间直接连接(无需下划线),第一个单词全小写,之后的单词首字母大写。如:
1 | String usrName = "IoTgod"; |
频繁调用的变量名称不易过长,但却要表意清晰。
要实现这一点,可以尝试部分省略单词中的非首字母元音,如 user 可以简写为 usr,password 可省略为 passwd 或 psswd。但简化后的名字仍需容易辨识。
全局变量使用 g_ 加变量名称命名,如
1 | global int g_isLightOn = 0; |
局部静态变量使用 s_ 加变量名称,如
1 | static int s_errorCounter = 0; |
常量变量,命名与普通变量一致,如
1 | const float pi = 3.14159265; |
函数命名技巧偷师自大名鼎鼎的Nginx,并在其基础上稍有变动。
基本法则为 小写标签名+__(双下划线)+小写动词+小写名词()
名词与名词间用单下滑线链接。
例如:
1 | function db__get_usr_info(); |
其中db意为Database, 提示这个函数属于数据库操作标签,作用是获取用户信息。
如果你不需要标签(比如在一些面向对象的语言中),你可以肆意省略标签。如:
1 | function get_usr_info(); |
与变量命名不同,函数命名不必要很短,以表达清楚函数功能为目标
其实如果能把变量函数命名做好,便不需要什么注释了,但遗憾的是,,我们还是不得不注释。。
文件注释主要用于声明一些文件功能,分类名,文件名,版权等信息,一个样式如下:
1 | /** |
类注释用于声明类的一些基本信息,如类功能,作者姓名、所属分类、所属文件。例如:
1 | /** |
函数注释在函数前,主要包含函数功能,函数修饰符,其各参数的类型、名称、以及文字说明,返回值的类型及文字说明。
1 | /** |
b = c; b = 15;
在过去的几亿年中,由于生存资源的稀缺,自然界不断通过“物竞天择,适者生存”的法则筛选物种。这使得“一切为了生存”成为了几乎所有物种的“目标函数”。在众多存活下来的物种中,只有人类创造并有效利用了语言这一工具。语言使得人类能够进行更加复杂的推理思维(想象)以及更加有效的个体间信息交流。得益于语言,人类机智地通过预测潜在的自然选择要求提前准备必要的生存资源并建立了协调资源创造(分工)与资源分配的有效体制(市场,贸易)。不可避免地,基于“一切为了生存”这一习惯以及想象与预测这一种能力,人类形成了自主创造需求以及解决需求的行为模式,由此产生了两种基本行为动机,即创造需求的需求与解决需求的需求。
观察现有人类社会架构,无论社会群体形态是政府,社会组织还是企业(公司),其本质都是一个协调不同人类创造需求的需求与解决需求的需求的闭环生态中的一环。如果一个政府,社会组织或企业无法再继续充当好一个协调人类需求中的闭环生态的一个环节,它将迅速的被其它能更高效发挥其角色的同类或非同类社会群体替代掉。
马云是一位伟大的企业家与战略家,他一手缔造的淘宝电商平台与移动快捷支付使得人们创造需求的需求与解决需求的需求的协调变得更加高效。这使阿里巴巴获得了极大的群众的信任,表现出来就是阿里具备的极高的资源支配权,也就是其极高的市值。
当人类内部的资源因为某种原因(生产或流通环节出问题)不足以支持所有人的生存时,多余出的人类数量总会以某种形式被抹掉,也就是著名的马尔萨斯陷阱。当一个国家或民族自身遭遇马尔萨斯陷阱时,它总会选择向外发动战争来解决。因为既然要抹掉的人口数量是相对固定的,那么如果向外发动战争就会有更多的本族或本国人能够活下来,只是要将部分的死亡转移至外邦人口。古时的匈奴,二战的德国和日本都是非常典型的例子。
观察历史上的战争,有两次规模很大,我们称之为第一,二次世界大战。第一次世界大战是由于大批量机器取代人力,使得大量原有人力劳动力需要转移。但是劳动力太多没办法短时间转移,表现出来就是失业率飞涨,太多的人无所事事,没有收入,难以生存。为了防止这部分劳动力失控闹事,只得转移其注意力向外发动战争。这就是协调人创造需求的需求与满足需求的需求的市场体制出问题所导致的资源流通停滞所导致的。二战亦是如此,当电力驱动将以往的蒸汽驱动取代,大量劳动力亟需转型。1933年美国率先出现此类问题,罗斯福政府因为有多年发展积累下来的资本,因此可以通过新政建设大量民用设置强行修正资源流通生态链。但是刚因为一战被洗劫一空的德国和国土狭小资源稀缺的日本就没这么幸运了,只得将自身不可避免的马尔萨斯陷阱向犹太人和东亚转移。
如今计算技术充分发展,出现了可以通过建立多项式来fit自然复杂函数(自然规律)的人工智能算法。这就使得大多数非创造型的脑力劳动具备被取代的趋势。那么,这部分原脑力劳动力将何去何从?尤其是在中国和印度这种人口大国,一旦劳动力转型过渡不好,产生的马尔萨斯陷阱代价都将是巨大的,并最终总会由全球承担。
我的想法是,得益于数字技术的发展,如果如今的我们能够创造出一个能够协调人们创造需求的需求与解决需求的需求的闭环生态系统呢?如果当脑力劳动力被替代时这些原有劳动力能够迅速进入并适应我们创立好的闭环生态系统呢?也许我们便能够避开可怕的马尔萨斯陷阱了。
经过几千年文明的发展,当代人类已经不再满足于单单解决自然界所需要的要求,而开始尝试并创造一些非常炫酷有意思但并不怎么有利于生存的需求。也就是说,我们并不在需要所有的人类都要努力工作来确保人类能够生存,我们可以空余出好大一部分人类来探索一些新的有意思的领域。
一个可能的想法是,沉浸型网络游戏。这种网络游戏不同于现有的大部分网络游戏。现有的游戏的商业模式大都是通过程序上限制用户的部分功能体验,只用交了钱的用户才能够使用这些功能。但是我所设想的游戏更像一个平台,玩家可以从中提出自己创造的(游戏中的)需求也可以解决其他人的需求(即交易)。这就意味着一个游戏中可以出现虚拟货币,并且游戏的公众认可度会通过游戏货币与现实货币的汇率得以体现。游戏的开发者将通过开源社区而非企业进行开发,这就意味着开发者与游戏一定程度上非利益相关,从而确保了游戏的纯洁与高效,使之可能具备成为社会基础架构形式的潜能。
游戏的低门槛性并且游戏符合脑力工作者的思维习惯,使脑力劳动力能够比较轻易的从原有职业转移至相应的沉浸式游戏中。并且,由于是虚拟化技术,游戏有充分的弹性容纳大量新增的人们。不同与现在,届时社会舆论与社会思维也将会掀起一股以转入游戏为荣的热潮,以规避危害更大的战争。
有点类似于编程中的函数封装观点,现实社会类似于main函数,各个浸入式网络游戏类似于子函数。现在的社会就像是一个只有main函数的程序,所有的功能都在main函数中实现。这就使得当程序功能越复杂,越有可能发生各种bug,表现出来就是冲突甚至战争。而未来的社会更像是包含好多子函数(沉浸式游戏)的main函数。各个函数都是相互独立而又相互依赖的,每个游戏可以协调好自己的闭环生态,同时又与main函数发生部分交互。这样的社会架构将会变的去中心化并且看上去更加稳定与高效。
注:部分想法启发自知乎
]]>作为头文件,.h中一般放有相应类及函数的声明。
一个典型的.h文件如下:(FileName: yimian.h)
1 |
|
为了安全起见,函数以及变量的初始化一般不放在.h文件中进行。而是习惯于建一个新的同名.cpp文件。
下面是一个与上午相对应的.cpp文件示例:(FileName: yimian.cpp)
1 |
|
有了以上文件,一个简单的C++库就建成了φ( ̄∇ ̄o)
于是我们新建一个test.cpp文件用来放置main()
1 |
|
然后便可以愉快的使用g++编译啦,指令如下:(win如何搭建GNU环境)
1 | $ g++ test.cpp yimian.cpp -o [目标文件的名称] |
之后命令行启动编译好的程序 (什么是命令行⌇●﹏●⌇)
1 | $ ./目标文件名称.exe |
如你所料,以上程序的运行结果为:
Hellow Yimian~
Version 0.0.1
坑 ::aru:meditation::
构造函数:每次创建对象时会执行,即初始化
1 | class Line{ |
析构函数:删除对象时执行的函数,即善后
1 | class Line{ |
*拷贝构造函数: *实现复制对象时同一类对象间传参
1 | class Line{ |
构造与拷贝构造区别:
1 | A x(2); //直接初始化,调用构造函数 |
1 | class INTEGER{ |
1 | inline int Max(int x, int y){ |
To Be Continued..
]]>新型冠状病毒 实时数据 api
项目Git地址: iotcat/coro-api
项目npm地址: iotcat/coro-api
https://api.yimian.xyz/coro?province=山东
https://api.yimian.xyz/coro?city=泰安
https://api.yimian.xyz/coro?province=山东&city=泰安
nodeJS
支持express
任意版本git
任意版本1 | $ git clone https://github.com/iotcat/coro-api.git & cd coro-api |
1 | npm install |
1 | node index.js |
1 | http://localhost:17676 |
参数 | 描述 | 示例 |
---|---|---|
province | 省份(国家) | 山东 |
city | 城市 | 泰安 |
从index.js
第9行修改默认端口。
注释掉index.js
第13行。
1 | npm i -g pm2 |
将以下内容加入server{}
中
1 | location / { |
如果你不是从根目录映射,记得去index.js
中第11行app.get('/', f)
修改成你的路径。
爬虫使用coro-py, 请参考其文档。
本项目使用MIT协议,允许非署名商业非商业使用。武汉加油!中国加油!!❤
]]>为了方便,在开发节点时,我们使用了LoRa-Socket和ArduinoJSON作为依赖。我们发现这两个依赖分别使用时表现良好,但如果在同一个项目文件中使用,则会导致一些怪异的问题。
通过指针调用函数时String参数传递异常。代码如下:
1 | inline static void _onReceived(const String& msg, const String& from, const String& to, const String& type){ |
在这个案例中,我们发现msg等String在此函数中的数值是一切正常的,可是却没有能够成功传递到_f中。经过一系列骚操作,我们得出如下结论:
我们从而可以得出,这种怪异现象是由于与ArduinoJSON包的冲突所致。
在使用ArduinoVector制作String类型Vector时,我们也发现了String类型的不稳定现象。神奇的是,这种现象只出现在String的使用中,其它如int类型运作良好。
这些不稳定现象可以总结如下:
通过上述两个案例,我们可以初步总结出,这是由于[]=赋值运算符的重载与String有冲突。只要使用[]=重新定义String,即有可能出现String怪异的问题。
]]>前端基于一个网上找到的比特币网站平台模板,深度改造实现。值得一提的是,前端使用Ushio-js项目作为安全及日志插件,并得到了Ushio系统做背后支持。
后端使用php语言编写。提供5个接口,分别提供获取账户事件,获取内部流通信息,获取公共支出信息,获取周报表,操作的功能。
mail系统使用Yimian Mail API快速构建。
数据库使用yimian-db/mysql。构建了三个表,分别用于存储流水,公共支出详情,内部流通。
直接引用呓喵酱の图床代码,少量改写。
目前用额外网页简单实现,等待ushio-auth项目完成后统一整合。
没啥可说的,摆图,自己看
φ( ̄∇ ̄o)
]]>Italy Consulate
joint travel confirmation letter
和护照复印件
joint travel confirmation letter
Booking Confirmation
上需要有paid
字样joint travel confirmation letter
和护照复印件
Booking
等知名网站订购最后展示一下我拿到的签证 ::aru:cheer::
p.s. 如果不放心,请使用 方法二-源码安装
exe
程序->
仍然运行4
获取汉语翻译!!)脚本已发送到桌面
kms.bat
,如果不需要您可以删除它~
kms
或kms.bat
。->
仍然运行4
获取汉语翻译!!)您的激活码将保存在C:\Windows\kms.key
%temp%\kms.log
%temp%\kms.tried_keys
%temp%\kms.skms
%temp%\kms.ato
kms.bat
选择3
[scode type=”green”]大家积极在评论区补充哦,评论推荐使用qq邮箱[/scode]
[scode type=”yellow”]持续更新中…[/scode]
[scode type=”blue”]望大家能够补充更多房源,以便调查[/scode]
步行距离
: 8 min (西北)google地图
: Dover CourtOfficial Guide
: Dover Court优点
: 距Lidl近,安静,管理好,安全,定期有人清洁,social place好,楼下自习室很安静缺点
: 房间隔音一般,部分房间小,有的地方天花板低价格
: £155.54 pw (Last Year)步行距离
: 14 min (西)google地图
: Horizon Heights步行距离
: 13 min (西南)google地图
: St Luke’s View步行距离
: 11 min (西北)同学反映
: 不安静(雷嘉恒)步行距离
: 7 min (西北)步行距离
: 12 min (西)步行距离
: 12 min (南)步行距离
: 9 min (东)步行距离
: 9 min (东)步行距离
: 7 min (西)步行距离
: 9 min (西北) 步行距离
: 18 min (西南)步行距离
: 10 min (北)步行距离
: 10 min (西南)步行距离
: 13 min (西)步行距离
: 10 min (北)步行距离
: 18 min (西)步行距离
: 12 min (西北)步行距离
: 8 min (南)google地图
: Cambridge Court步行距离
: 21 min (西)