我对垃圾的断绝能力一直很低

导致我在现实中经常很不爽




要是拒绝可以更坚决一点，就没那么多伤害了

——————————————

喜剧之王 一点都不好看

——————————————

构建一套系统真的没那么容易

比如 找工作APP





如何构建一个诚信机制，既能让没有任何认证的人找到工作，又不让企业吃亏



(淘宝是怎么做的？让人数少的想赚钱的商家交保证金，人数多的消费者不交钱；

当把这一套逻辑放在程序员身上，各种问题：

万一公司想空手套白狼招人免费干活怎么办？

万一有一些傻逼啥都不会恶意给企业差评怎么办？

万一有企业派人刷好评洗白怎么办？

这些都是问题)

——————————————

http://www.americanrhetoric.com/speeches/ronaldreaganchallenger.htm

我国领导人才不会在出事后讲这些话呢

多半都是success success

cover it up, cover it up, close people's mouth and so on

——————————————

讲的都是谎言

看看审查制度就知道了

——————————————

艹

"从严治党"你倒是给党员讲啊

干嘛折磨我一个穷学生



思政课真受不了

——————————————

我只是隐隐觉得，在现实生活中，很多人，你跟他说再多话也不会有提升、一起做的事通常是浪费时间。

而在国际网上，我做的事基本就是传播知识，做实际的事情，每天解锁一点新技能。

没准这才是某国落后的根本原因：封闭。

——————————————

On the very bottom, all you need to do is: do things with one way!

After you can do many things, you'll then think about how you could do one thing with different way based on different circumstances.

If you, at the beginning, only has been taught or struggled in solving one thing in different way, then, I could say, you are useless! 

Because all you got or all you can do is solving 1 problem which maybe 1 + 1 = 2, while others could solve 20 times problem than you do.

That's why we encourage people to start from little, go far with much. 
(E-language->C++->Python->JavaScript->Kotlin->Golang->AI(ML))
(Windows->Deepin->Ubuntu->Popos->Kali->Lubuntu)

Don't be silly that think you could learn all those stuff from scratch easily.

Just say no to those details, start from the main ideas, start from what's essential.

With that, you'll be good at learning everything!

——————————————

对思政课讲台独问题的反思


1. 抨击民主制度 (自己的民主制度不行，就说民主不好)

2. 抨击贫穷 (用专制的强权、金钱压制自由的种子) (专制赢得了一时，维持不了一世，总有一天，人们会意识到自由的抉择有多么重要)

3. 抨击市场自由竞争原则 (本来那些只会考试的人就不应该作为优胜者出现在人的视野里) (台湾老师在中国过得好只能说明中国教育落后 (垃圾老师总不能在美国骚得起飞，毕竟美帝科研top1) )

——————————————

头等舱的早已收拾金银细软弃船了。
二等舱的说：“不好，这船有问题！”
三等舱的依然在吃喝玩乐，谈养生或艳遇。
下等舱的却不知自己即将与船一道沉入海底。 
在底层大舱里一帮傻逼还在瞎自豪:厉害了，我的船!

——————————————

https://youtu.be/6lnkpuUbjyA

——————————————

美元真是一种特别形象的符号：之前付出过的努力可以在新领域上开出一条直道！

——————————————

在中国，越是公立大学，越是教得垃圾





语言能力都还没成熟的情况下被教授高深的东西

长大后也无法用人能听懂的语言正常传授知识

——————————————

没有什么比看到心仪的女孩

却由于能力不够，无法追到

更让人产生动力的了




所以人才要努力奋斗啊

——————————————

www.americanrhetoric.com/speeches/fdrpearlharbor.htm

要是我以前的历史课是学这些就好了

——————————————

http://m.kdnet.net/content-1-11977382.html

——————————————

不管做得好不好

能用就行，率先进入就有的赚

这叫行业红利期




做得好就赚，这叫行业壮年期





做得再好也难赚钱，这叫夕阳产业(夕阳无限好，只是近黄昏)

——————————————

The thing that really killing me is being normal, being ordinary.

Those shit will never understood what I'm looking for, what I'm dieing to achieve.

They are just live in their stupid numb life without knowing anything behind the lights.

——————————————

Is that brave make him king!

Now, he just wanna say, you don't have brave for freedom. Even if you have, that was the brave for king, for country, for the country ruled by king.

——————————————

这是天马行空群

——————————————

开源的本质是：

开源者不需要从这个项目得到 Money，但他希望这个行业能够持续快速地发展。

——————————————

http://blog.sina.cn/dpool/blog/s/blog_6764558f0100i2lq.html

——————————————

没有市场竞争谈创新是空想，根本没动力：这个可以用，继续用，反正没人和我抢饭碗(垄断)，为什么要大费周折搞创新？

你党就是没竞争，你党控制下不可能有创新


你党言论审查的重点就是扼杀一切可能和党管控的一切形成竞争的势力

——————————————

死人

——————————————

你要问我理想主义者与现实主义者的区别


在我看来，即是理想主义者更易与远方的人成为朋友

而现实主义者更易与近身者成为朋友



如果理想主义者在近身处有坚固的朋友，他们一定很优秀

而现实主义者在远方有牢固的友情，他们也一定很优秀



远近平衡，平庸者
朋友与自身，优秀程度相近
牢固的朋友越多，个体实际的能力越强



所以最优秀的人，在大世界、大局面上要尽可能展示理想主义光辉

而在小群体，要尽可能显示现实主义为群体谋利益的心机

通过提升自我，改变朋友的质量、增加朋友的数量

——————————————

我十分了解我的心理状态

当我插上耳机，说明我不想和任何人说话

此时耳机 is a symbol, cut me from the normal world (进行某种深入的思考或进行某项艰巨的任务)


从现实的角度讲，插上耳机确实听不见别人讲什么


如果你看见别人用入耳式耳机，还要硬给他搭无关紧要的话，那只能说明你情商不高

——————————————

https://www.pornhub.com/view_video.php?viewkey=ph5ad4c41dbea9e

I've never expected VR could so attract like this

VR + sex toy should be good

——————————————

未来的学校，学生为校园事务主导:


学生多数同意，可辞退老师

学生参与学校建设(工程建设拼多多模式，二分之一学生同意即建设；先付钱(工程总费用÷学生数的一半)，再根据最终学生支持人数平坦工程款)

优秀双语程序员组成学校领导层，议会制

——————————————

I won't be the first

Non be the last one

To break through the little self.

——————————————

说也奇怪

我死命逃开文科 shit 

结果大学还要上思修



只有思修才用卖菜的喇叭扩音

什么东西别人不想听，才会吵

如果讲课现场吵炸天，

1是演讲者没能力

2是演讲主题没价值



Conclusion: 只有思修课(政治宣传)是你交了钱不想听硬给你塞过来的东西



shit 文科 ：(不可证伪、没有真实，历史总是一部分人的历史 (你不可能找1000个世界各地的历史学家，从他们各执一词的讲解中，找出重叠部分) )

——————————————

看了《冰肤传说》

我觉得法国也可能成为文化强国(电影大国)




对比中国，一个连说话都要考虑再三以免有牢狱之灾的国家

输出什么给外国人看？专制主义共产党统领一切思想？

我觉得外国人会逃离电影院，除非你倒贴，给观众钱

——————————————

文字狱

——————————————

对

所以我买了好几样男性枕边伴侣

——————————————

但是

除了make love

我真想不出有什么好玩的

——————————————

太厉害了没人陪你玩

太弱了也没人陪你玩

然而历史的进程多半是由那些最顶尖的人推动的

最强的人顶尖，最弱的人是另一方面的顶尖

——————————————

我觉得中国的防火墙

主要的目的，是为了便于一小部分特权阶级，抄袭国外的创新成果，从而压榨墙内无知的民众

——————————————

虽然我很想说人体艺术

实际上不如夏天在大学里看小姐姐的腿

——————————————

最近喜欢看一些让人体发热但又不会过热的东西

，猜一艺术门类？

——————————————

https://xw.qq.com/iphone/m/story/585b8220051cf4bdb650199bb1ac05a5.html?_u_u_u=0.5391307123862723


我觉得这些人爱好吃鸡是一种必然现象

连玩具枪都买不到了，犯法…

——————————————

http://www.bilibili.com/video/av23383257?share_medium=android&share_source=copy_link&bbid=E0626135-9650-438C-9974-1B8315ED7B0613493infoc&ts=1526199451778

——————————————

大师是那些可以把复杂的事变得简单、枯燥的事变得有趣的人😁👍

——————————————

怪不得我可以得罪那么多人…

——————————————

权比钱更肮脏、原始：

金钱交易必须建立在双方承认一般等价物协议并愿意交易的前提之下；而权力斗争不管你愿不愿意，打赢甚至打死你之后你的东西都归我，充分说明其原始性。

马克思说资本主义必然会变为共产主义是不科学的，因为共产主义是最原始、最落后的氏族时代，整个制度都建立在权力之上

真实情况是资本主义会逐渐与社会主义融合，即从考虑社会长久健康发展的角度治理国家

——————————————

崇洋媚外是21世纪的主流

所以化妆要模拟西方人的轮廓与面部特征

越西白化, 越受女性欢迎

——————————————

女性或者人的天性就是爱权爱钱，从取名就可以看出来了

所以要在平时的生活中尽量表现出高贵、有教养、有礼仪





另外，人只有在慢节奏的舒适中，才会表现出强烈的性欲

太急躁就会显得在工作，工作无性欲

——————————————

女性的思想果然是很情绪化

那意味着我只能当个gay?



不，到底应该用何种心境、何种思想来面对女性？

我应该好好想想

——————————————

未完待续

——————————————

我觉得大家都是色狼…装什么矜持😂

——————————————

为了彻底地研究女性的内心

我决定读一本女性专区的小说

——————————————

因为光头在人群中显眼

所以和尚用剃光头来约束自己

——————————————

有人说要与人为善，
我想是这个道理，
人生已如此艰难，
何必为难彼此，
所以我剃了光头，
不再与人争执，
just keep it quite,
从此六根清净。

——————————————

在现代社会

不管多大的厂，都逃不过现代科技的淘汰，除非时时更新

比如usb蚊香 pk 传统盘式蚊香


by the way, usb蚊香还救活了蚊香片厂

——————————————

这个耳机可以用来坐车

完全无视噪音

——————————————

世界上SB太多

杀不完的

——————————————

Hey guys, you really should try this: 

入耳式隔音侧睡不压耳耳机https://m.intl.taobao.com/detail/detail.html?id=533705764675&spm=a2141.7631730.0.i1&ttid=212200%40htao_android_4.1.3#&modal=share

In the one hand, you can never heard your roommates voice, on the other hand, you can have a nice sleep

For the quality of voice, 和 120 yuan 的小米耳机一样，just OK for daily music playing.



The best benefits you can get from this 耳机 is: 你可以在疲惫的午间或下午放学后无视SB室友，通过睡眠补充精力，并由此开启高效脑力活动的一天。

😘

——————————————

这场自我救赎的旅途

就算灵魂在颤抖

就算对脑力的要求远远超出了我的想象

我也必须坚持下去

不然之前的努力算什么？

——————————————

吃鸡只是一个名号

对于商家来说

这只是方便他们找到潜在的无脑客户

——————————————

2.2倍速看了《大世界》

社会

https://baike.baidu.com/tashuo/browse/content?id=b7a9e6fb3b85cbbb98f1fe68&fr=qingtian&lemmaId=22150319

——————————————

你的意思是明白了有些事必然发生，只要了解了前因后果

——————————————

你昨天干了什么？

——————————————

年轻人性格太急躁就容易做错事

只有多经历几次挫折才会稳重吧！

——————————————

65.无法量化为计算机可处理的逻辑的教学，毫无意义。

——————————————

好玩的定义是什么？

我觉得是 reaction



如果一个固定不动的正方体和一个可以四处滚的球，你肯定会觉得球更好玩，因为 it will react quickly if you keep touching it.

——————————————

我为什么英语学得比中文好？

很大原因是英语从来是用来学知识

而不像语文，一会儿要用来做这道题、一会儿又要用来那样做那道题，然后你知道的，(语文或文科)考试卷对提升语文毫无帮助

更像是考八股文，格式不对、固定句子不对，0分

——————————————

我们所做的事

无非是用技术对权力和财产进行重新分配

也就是用个人奋斗突破血缘亲族的枷锁

——————————————

http://music.163.com/song/506747016/?userid=280429778

——————————————

我觉得解决方法只有一个：

1. 游戏商强制插上耳机才能玩

2. 过程当中检测是否有脏话喷出来，有就封禁一小时

——————————————

他们不光打游戏，还在打游戏的过程中大吼大叫，并且句句草泥马

青年尚且如此，老了更是不顾廉耻

这样下去是要亡党亡国的😒

——————————————

必须得歧视

整天一有空就打游戏

能不能有点追求

——————————————

工欲善其事, 必先利其器

想学AI，就得在平时零碎时间(没有图书馆、教室，需要面对只会打游戏傻逼室友时)用百词斩背单词

——————————————

你我他

我是偏执狂

追求极致

所谓 geek

——————————————

Too bottom to nothing.

太底层以至于做不出什么东西来。

别国早已实现物联网、中枢控制，你国还在用51单片机

——————————————

I don't need to learn anything right now 

Just leave me alone, give me a quiet place

盲目的学习犹如吃东西分不清食与屎

——————————————

《1993聊斋艳谭之灯草和尚》 可以说是中国(如果香港属于中国)史上最好的色情片

既展现了中国传统文化(服饰、装潢、鬼神说)，又集中体现了性爱文化的方方面面(比如男女、女女、自慰、强奸)

不仅剧情设计精美，演员自身素质也高(颜值、身材)

1.5、2倍速切换观看

——————————————

http://www.bilibili.com/video/av1727778?share_medium=android&share_source=copy_link&bbid=E0626135-9650-438C-9974-1B8315ED7B0613493infoc&ts=1522994375977



人性

——————————————

成就越大

影响力越大




反过来理解，你的能力可以通过影响力反映出来

——————————————

然后我们学校

注意！是大学！

竟然强制每天晚自习看新闻联播！




整体看漂白的新闻有意思吗？

天赋人权啊！小伙伴们！我为什么一定要看？我有不看的权利啊…




所以我决定带耳罩去上晚自习…

——————————————

如果我是学校楼梯设计者

我就会把上下行的空间分别压缩为只能容纳一人的宽度

这样就不会有混乱的拥挤

——————————————

大学政治类课程创始人：(对于28原则中8那部分，)同样都是洗脑，被敌人洗脑还不如被我洗脑

——————————————

难是省略太多步骤

复杂是有太多步骤

——————————————

数学和英语完全是给程序员准备的。

要是没有大量的 coding, 你怎么会熟悉字母代数和逻辑分支分析？

要是没有大量的 document reading, 你怎么会 master English?

要是没有独立开发一套系统，你又怎会知世事艰辛？

——————————————

有基础只是为了能学到更多东西，并不代表你就很厉害

——————————————

结论只帮你解决一个问题

而思维过程可以帮你连接新知识，解决一堆问题

——————————————

Every night, every day,

dreaming about that.

Be the one that everyone admitted.

——————————————

我只是感叹同类太少

比较孤独



你想，有几个人在其他方面特别厉害

在高考上是个失败者啊？

——————————————

人多是一件坏事

大家都把心思放在了怎么出难题和怎么应试上面去

没有人真正踏踏实实地锻炼自己解决实际问题的能力

——————————————

只要你发现你的孩子从小不一样(比如其他孩子从小嘴就甜，就他谁都不叫，连爸妈都不叫)

立马进行反传统贵族式精英教育

因为他有很大几率是创新性人才

传统教育不适合他，他也不适应传统权威式教育

——————————————

I'm not worry about where I'm gonna go. 

I'm worry about if I can't reach that level, what my life would be!

——————————————

建立一个“白送网络平台”

当我国每个人都可以从中得到所需要的生活物资时

共产主义就可以开始实施了

——————————————

不能说成本贵就不搞创新了

哪一种改变世界的产品一开始生产成本不高？

——————————————

食物是吃一次，精力增强一分

而射精是射一次，精力下降一分

没精力还能做什么大事

——————————————

对于把AI说成炼丹的傻逼我是不屑一顾的

炼丹是没有科学依据的空想，AI不是

——————————————

个人控制力的增强直接体现在对性欲的控制上。

——————————————

每天都过着苦逼的写笔记生活：

https://yingshaoxo.gitbooks.io/university-notes/content/dc-stable-source-circuit-de-fen-xi-yu-ying-yong/zheng-liu-lv-bo-dian-lu-de-fen-xi-yu-ying-yong/rectifier-circuit.html

——————————————

我的择偶标准：


智商(知识面得广；得喜欢解决问题) 
> 
英语(第二语言者可以证明你有毅力做到你想做的事；包容性强、视野开阔、反传统、追求自由) 
> 
外表(洁净、对称、白与嫩)

——————————————

然后疯狂地说资本主义的坏处

与负面新闻




不说社会主义的负面新闻






另一方面，完全没意识到在制度建立的初级阶段，犯错是难免的

失败后学到的，都是经验

——————————————

学校的sx老师在讲毛概时

主要就是疯狂地保毛、保斯大林




垃圾思政

——————————————

人到一定年龄就不想撸了

因为没有意义

他已经找到了比撸更能让他保持长久兴奋的事业

——————————————

之所以中文不适合做详细的文档

是因为中文太具有概括性，容易在极短的文字内让读者迷茫

——————————————

可上九天揽月，可下五洋捉鳖

——————————————

突然想到了

虽然大家的大脑储存都差不多

但不同人的内存与CPU是不同的，那可能就是人与人之间智力的差别吧(储存也还有固态与机械之分呢)




不过，别人用一天能训练出的模型，你用十天、一个月也可以啊👍

——————————————

喜欢坐火车时靠窗的少女是我的菜

因为她们自视清高、曲高和寡，一般都有一定的知识储备和文化涵养

——————————————

这个好

——————————————

政治没学好的根源在于你没把宪法给被背了

用宪法答题没人敢说你是错的

——————————————

《实力搭讪(发生关系)》: 
http://music.163.com/video/43C3FD202E4EA7D1901A28E04DA2521B/?userid=280429778




程序员每天只需要抽出10分钟时间去和妹子聊天

一年后肯定能找到女朋友

只是我太懒

——————————————

成为大人

越来越觉得除了食物、水、房子、电、网以外的东西都没有意义

越来越不在乎别人的感受

精神世界越来越小



不，我不能成为那样的大人

——————————————

You be what you wanna be

现实是虚幻(随时间流逝变为不稳定的记忆、变成政客篡改的历史)，而虚幻长期指导你工作，它会变成现实

——————————————

你是不是傻

最后都会变成老大妈




关键在于你想和哪种老大妈一起生活

——————————————

回想起我的学校生活

那些不同阶段的同学



我只是觉得没必要再聚到一起

大家的人生早就出现了差异





不同的世界怎能相互融合，链接各个世界的东西只有一般等价物

——————————————

那些人应该开发一套反吹牛逼机制

——————————————

经过我不断的观察

中文最适合吹牛逼(夸大标题党)



而不是传道授业解惑

——————————————

遇到挫折不放手是一种态度

——————————————

在我眼里，那个叫胡英杰的人格100%是个傻逼

一事无成




而我，虽然不傻，但处于智力阶层的底端

——————————————

火锅底料家庭使用指南：


一定按使用说明来，一定要阻止父母加乱七八糟的东西进去，一定要阻止父母不按说明书操作


这样你才能吃到正常的火锅 😂

——————————————

其实很早以前我就领悟到了

弱者才需要群居

强者是能学会享受孤独的，至少那是它以个体名义得到力量的代价

——————————————

难道 喜欢巨乳 和 婴儿时期长期吸吮妈妈的乳头从而得到充足的营养 有关？

我个人对乳房大小是不感兴趣的，因为我没有过母乳喂养的经历。

——————————————

突然发现 | I guess

真心喜欢英语的人 | those who really fall in love with English

QQ昵称是英文 | their nickname is English

——————————————

墙最主要的目的，不是阻挡你

而是瓦解你的斗志


把你与亲人、朋友隔开

体验无限的孤独的痛苦

即使你有你远方的朋友




但越是这样，越是要充满斗志、不畏艰难，同时向你远方的朋友问好

并说一句：“阿里嘎多”

——————————————

自己开的坑要自己填


人就是这样，不做就不累，不累就没收获

——————————————

喝酒太难看的根源应该是酒太便宜

如果一瓶一万，他们大概会慢慢品酒吧...

——————————————

墙国人用AI完全是个灾难

他们的智能推荐算法实际上做的事是：阻碍你的视野，缩小你的世界，一时底层、终身底层，让你永远无法看到真实的世界

——————————————

http://h5.17k.com/book/12505.html

这本书的作者，初写书时应该是大学生；才有闲工夫写

理科生毕业；才有这么烂的文笔

会写代码；2007年就把AI描写进了小说，并且里面还写到了电影特效渲染

死了；不然不会突然停更

——————————————

祖先留下的选配偶或传宗接代的基因被人利用了，被用来夺取目光和疯狂敛财。

——————————————

64. 越是无法使人得到提升的东西，在网上传播越是广泛、迅速。

——————————————

成名很重要吗？

——————————————

我的脑子也会计算，成天看B站、抖音、直播，我的智商又不会增加

还不如看动漫，至少还可以有冒险的感觉

宅一代应该都有冒险的愿望

但很少人有财力、能力做到

——————————————

马的，一寻思，忽然就明白bgm是什么意思了

BackGround Music

——————————————

https://m.bilibili.com/audio/au214360 

http://www.bilibili.com/video/av18996822?share_medium=android&share_source=copy_link&bbid=23F7F87E-66F6-4C1D-9917-533D6870E76B31056infoc&ts=1517514807140

——————————————

大部分人从来没有【明确】地设定自己的发展目标，每天都是得过且过。等到几年过去了，才发现自己这些年啥也没学会，还是老样子，然后就感叹时光飞逝、岁月如梭。

——————————————

人生就像写小说

如果每次都能用上以前埋下的伏笔，就能荡气回肠、绝处逢生




可是很多人都是走一步算一步，从来不思考这一步对以后的影响 或 以前做过的事有什么现在能用得上

——————————————

长大后人出现的两个明显变化：

1. 思维能力的降低
2. 迫于生活需要，凡事偏向物质利益，即向钱看

——————————————

一眼望去，普速火车站里堆满了贫穷的女大学生。

——————————————

整天聊男女之事的寝室一般都很弱鸡😏

——————————————

文科无法证伪？

不，如果能从文物得到某思想发展过程的证据，就行

如果以后有时光机，我们就能发现以前我们是有多蠢，明明都是随着自然时间的过去而慢慢进化的东西，非被我们说得很高大上。

——————————————

下学期应该上床帘了

免得大家看见我压力大，从而做出一些让我压力大的事。

顺便防个光，我在黑暗中生产效率最高。

——————————————

大学就是一个垃圾聚集场

但这里也是社会模拟场



这里有的只是不择手段，达成目的罢了(作弊、摇尾讨好)

所以我努力的重心还应该是不在意垃圾们的目光，去出其不意地想出解决方法，提升自己

随波逐流还不如现在就去跳河

——————————————

为什么BT下载多年没速度？

根源在于人之自私。

素质太低，不能正确认识到“我为人人，人人为我”的利益关系。

简单讲，就是一群乌合之众，活该被奴役、被压榨！

——————————————

https://www.washingtonpost.com/news/world/wp/2018/01/07/feature/in-china-facial-recognition-is-sharp-end-of-a-drive-for-total-surveillance/?utm_term=.36d9c0f83474

技术是把双刃剑，看来以前电影中所说的天眼监控，就快成为现实了

——————————————

不管是李阳的 don't be afraid of failure

还是马云的 我们不能保证一定会成功，但我们一定会失败，只有去学习别人是如何失败的，我们才能避免失败

还是 AI 中的 强化学习




都强调了，我们必须不断尝试、不断失败，才能学到正确的 pattern (模式)

——————————————

Girlfriend could be your best friend, even if you and she didn't share a same interesting.


When you feel sad, she's there waiting for you

When you get tired, she's there waiting for you

When your faith almost crash down, she's there waiting for you


It's not about what she can do for you, it's about what you and she can do for each other.

When you get inside a relationship, you are not just being alone anymore, you and she's fate probably already been connected.

——————————————

新年快乐～

——————————————

When you failed, dried, tired, and can't figure out the answer of a problem, all you need to do is: sleep.

Try to do it again after you waken up.

If still can't find the answer, maybe Google or your friends will help you.

——————————————

另外，训练神经网络需要大量的时间

要想节省时间就得基于别人现有的模块训练

由此得出：Learning is a time consuming progress.

那些SB说别人天赋高、学得快其实是一叶樟木，没看到别人的基础

——————————————

Learning is a time consuming progress.

——————————————

就是这种智力训练的不确定性

导致人们把智力说得玄乎其玄

什么智力先天论, CaoNiMa, 都是放屁

——————————————

然后还应知道

过多关注琐碎的细节会造成 over fit

只看表面又会有 data 不足，训练出垃圾的后果

——————————————

类比深度学习和我个人实际学习


学习好坏主要取决于数据的选取和训练策略的不同

容器大脑(tensorflow)大家都一样

拿英语来说，疯狂英语是非常好的data set，准确的包含了应用英语的本质，所以能有比较好的训练效果

——————————————

我们喜欢Python的首要原因不是因为它简单

而是因为它拥有更多的文科思维、大众思维在里面


它不像其他的SB理科思维语言一样，没有生僻的不接地气、不与主要交流语言接轨的词汇和“句子”


如果有人认为经典不是给普通人用的、傻瓜式操作，那你就别用苹果或其他智能手机了

😏心疼你们的智商，这点问题都想不明白

——————————————

http://www.bilibili.com/video/av17456296

——————————————

https://youtu.be/9_KMVu0ePOM


1.5倍速合适，俞敏洪对战SB官僚主义学校领导，北大也不是个好地方啊

——————————————

http://www.bilibili.com/video/av17298476

这腿卖得好




话说舞蹈早就变成了一门卖腿的艺术

——————————————

话说中国的APP

能进世界排行前几名的也就WPS和扫描全能王了

我们要向他们致敬




虽然其他应用中国和世界文化完全不同，但追求办公效率这一点，大家都是一样的(因为中国近代办公那一套全是从美国过来的😂)

——————————————

我是乐于助人的好孩子😁

——————————————

图书馆才是学习睡觉写代码的好地方

没有傻逼的干扰，学得好睡得着

——————————————

How about you?

——————————————

写书(或教育)成功的关键在于以文科生的语言风格(或思维能力)写理科生的内容。——— (喜闻乐见又有意义)

——————————————

每次都感觉在学校编程能力会急速下降


似乎总有傻逼在旁边打游戏并发出噪音

——————————————

http://www.jianshu.com/p/493dc2f30d40

——————————————

极客的首要标准是: 为了更高的效率，不怕麻烦。

——————————————

所谓非理性就是一套利益决策系统developed by natural

所谓理性就是一套利益决策系统 nature designed, but you have to develop

——————————————

https://kg2.qq.com/node/play?s=gV8sYzgVExbMFg3D&shareuid=609b9b8620283382&topsource=a0_pn201001006_z11_u26635549_l0_t1512821627__

所谓装逼，大概就像我现在做的事一样

——————————————

那是第三世界的工厂

——————————————

我有说它们很伟大吗？

——————————————

突然发现比尔盖茨真的捐过钱😁

——————————————

我觉得比尔盖茨就是装逼

把钱捐给 Khan Academy 和 维基百科 多好

——————————————

You got YouTube, you got most of everything.

——————————————

学到的一点：

当朋友说出了他的困难，不要同情他，而是想出解决方法

——————————————

但难吃与好吃直接影响了我的吃法

没毛病啊

——————————————

一听就是文科生

——————————————

对于“光吃饭”这种小孩的行为我是深有体会

以前在家，我是倾向于吃饭的

但在学校就不一样了




通过观察，我发现：
1. 如果菜非常好吃，我会把菜吃完再吃饭
2. 如果菜和饭一样好吃，平淡无奇，我会把饭菜同时吃完
3. 如果菜很难吃，提不上胃口，我会在吃完饭后再慢慢吃菜(但如果在家里没人给你定额饭菜，通常吃完饭了事，不吃菜)

——————————————

推荐这部电影给你 超验骇客(Transcendace)

——————————————

你怎么能以一己之力对抗全球计算机的计算能力呢？

——————————————

老师

你得有梦想才行啊

现在AI这么火，你去研究一下




那里藏着人类智慧的秘密，也是解决一切终极问题的武器

——————————————

别的不管，从英语的角度讲

做那几道题是完全不能提升你的英语能力的

还不如跟读一篇十几二十分钟的英语演讲



或者每天坚持念并搞懂一篇文章

——————————————

其实我以为高考之后功利性学习就到头了

结果发现不但没有，反而愈演愈烈

到了大学不仅是填鸭式教育，还是流水线作业，老师们拿着一根计分棒：“学分不够，你给我滚”😒

——————————————

为什么马云数学总考不及格？

因为他学好了英语

然后发现中文“文档”狗屁不通

——————————————

人类科技进化的过程就是不断地让 机器做人做不到的事 和 让机器做人能做到的事。

——————————————

不管我们思政老师的思想再怎么奇葩，都是为党国服务

拿谁工资，为谁办事

——————————————

老师好

——————————————

如果一个女生数学不好，就不是真男人性格。

——————————————

http://music.163.com/song/168091/?userid=280429778


没有什么能够阻挡，你对自由的向往

——————————————

装什么B

闷声发大财，然后抛开尘世做自己的事才是救赎之道

——————————————

我不爱看那些年轻人的照片只是因为我不愿看到他们以后苍老的容颜(形成对比)。

不去想，就不害怕

——————————————

在社会经济快速发展时期

各种不择手段谋取暴利的丑恶现象都会出现

但经过一段时间的社会自调整，会逐步出现一些法律规范(比如美国的信用体系)




因为人们会逐步认识到，规范后，社会运行效率会更高

——————————————

There are no one career is easy.

——————————————

在外国讲假话的代价大；在中国则是讲真话代价大。

——————————————

乌合之众：
一个周期性的事件，大家都要做，你早点去做。
一个突发新事件，大家都要去做，你晚点去做。
一个突发新事件，大家都不做，你早点去做。
这实际上是在考验群体的智慧，我认为群体不可能在事件一开始就正确判定是否真对他们有利。

——————————————

除了提升自我，活着没什么意思

——————————————

http://music.163.com/video/751C85D364917CC115FFF330E821B53A/?userid=280429778


止不住的看腿

——————————————

权贵们的文化水平比较低，然后你翻墙后眼界变高了，那谁去买那些SB的服务和产品、谁去服从那些SB的领导指令？

——————————————

“如果有一天你的立场和伦理相悖”

http://music.163.com/song/514543271/?userid=280429778






差不多许嵩可以娶花粥了，世界观开始趋同

——————————————

“不是自己选的菜，打死也不吃”

我们还可以交流

——————————————

被墙了


喝杯茶，然后告诉你自己：我是中国人

继续生活

——————————————

为什么没聊天对象？

我习惯用脑子，因为不用脑子被淘汰得快；你习惯和别人瞎侃，不用脑子；所以你和我聊天一用脑子就难受；这就是我们的差别，we are different.

——————————————

http://music.163.com/song/470772280/?userid=280429778

——————————————

我不想、我不想，不想起床

我宁愿 永远都 这样懒洋洋

我不想、我不想，不想起床
 
强行起床 会让人 精神失常

……

深爱我的床、我深爱的床

怎么能，变得空荡荡？

——————————————

努力总比偷懒费劲

——————————————

事实上我现在对女人、(男人、)影视、游戏都不感兴趣，而我头上又好像有一座大山阻挡我想出问题的答案。时光还在继续将我变得衰老。

——————————————

土嗨，不好听

——————————————

出身于草莽，敢媲美大神

非我类人，不会理解

——————————————

分享Steven Cooper的单曲《Chasing Fame》: http://music.163.com/song/458013650/?userid=606184040 (来自@网易云音乐)

——————————————

文科的精髓在于骗人，即如何行动能让人以为 我在为他谋福利，实际上是为自己汲取利益。

——————————————

国产经典电视剧(95后男性)：


仙剑奇侠传

武林外传

士兵突击

爱情公寓

——————————————

哈哈，微信登录需要上个登录设备做扫描，然而上个设备被我扔了，所以登不上微信，所以可以放弃微信这个垃圾产品了。

——————————————

Fuck you, aloneness!

——————————————

为什么每天都累到眼睛睁不开

Everyday is just reading books, coding, solving problems, and in the end, sleeping.

——————————————

每天早上我七点起床 迷迷糊糊就出了宿舍
没有时间去吃顿早饭 因为我还得去上那些傻逼的课
听这些大学的老师 面无表情的读着课本
我低着头我还玩着手机 不知不觉就做了个梦

太阳当空他找学校 我背着书包装炸药
花儿知道了他对我笑 小鸟也说我牛逼了
同学少年都不贱 你说到底是谁贱
让我坐到教室不来你就扣分这就是中国的大学

话说这不上课你就得挂科 挂了科你就要重修
重修还他妈得交钱 一门课就是二百多
你问他这是为什么 我学的都没用处
他说你就认命吧 这就是中国的大学

小花同学 小花同学
你的思想态度及其的不端正
小花同学小花同学
你就回家吧 你别来上学

——————————————

道不同不相为谋咯

——————————————

没用过坑爹的校园网，你就不算是中国特色社会主义大学生

——————————————

风骚的室友，室外温度19°，非要把空调开到16°

要是我不用付电费该多好

——————————————

关于智力，我又有了新的理解：

面对同一个问题，高手可以有个解法，普通人只有一个或无法解答。

智力越高，解决问题的方案越多，选择越多，路越宽。

——————————————

我这人天生不合群(那是不可能的)

只要一开启天才(其实是努力学习模式)，身边就没朋友(啥朋友啊？酒肉而已)

——————————————

1. 你觉得高考学的东西没用
2. 觉得没用就不想学
3. 你不知道它用在哪里，你就不知道怎么学
4. 所以你成绩不好

——————————————

你要享受那个动脑的过程，而不是你学到了什么，因为你学到的东西都会过时。

——————————————

整理下群论：


关于小集体稳定性的思考：

假设一个寝室有6人，则有下列分布：
6
3、3
2、4
2、2、2
1、1、1、1、1、1

——————————————

我估计学校超市很贵，量也少

——————————————

新生洗漱一箩筐，淘宝花100多，心疼

——————————————

我的执迷不悟感动了我自己，可你还是一样遥不可及。 —— 花粥

——————————————

为什么主角即是正义？就没有一个以坏人视角描述故事的吗？

因为他们怕坏人描述起来像好人。

——————————————

没人帮你就要保持平衡，有人赏识你就可以发挥特长，但别人赏识你是因为你有特长，所以生活中除了保持平衡还要发展自己的长处，到时就能对应一句话：机会只留给有准备的人。

——————————————

Once I read a sentence: somebody's life ends in college entrance exam, and somebody's life is just about to start.

——————————————

接受独裁，享受无脑生活

接受自由，享受斗智斗勇的生活


你选啥？世界上聪明勇敢的人总是少数，享受自由者自然也少。

——————————————

我必须要努力寻找虚拟与现实的契合点，这样才能最大程度地发挥我的潜能。

——————————————

突然明白为何 naruto 被称为火影忍者了

因为九尾查克拉是红色的，加上他爆发时速度很快

——————————————

到底是无法超越的智商还是无法克服的懒惰？

——————————————

不知道为什么，我的手总是在游戏界面点个不停

明明都是极其简单的重复动作，为什么喜欢没日没夜的干个不停？

可能这就是傻瓜思维吧！(贪图享受，不愿思考)

——————————————

就算读了大学也不能逃脱落后的命运。

You can fight, but you definitely can't be a winner forever.

——————————————

如何从独特的品位到没品位？

多听。

——————————————

从苹果的盈利模式中我们只总结出一个道理：傻瓜的钱好挣。

——————————————

一个没有良好理念、体制和机制的公司，做大了都会变得腐朽。

所以小米现在不行了，一加手机性价比更高。

——————————————

就连公司管理形态也是体制

——————————————

被人思念不应该觉得很幸运吗？

——————————————

百度的AI技术只用来精准投放广告

而谷歌的AI还知道从亿万资源中找到最好的、你所需要的东西

 (这就是差别

——————————————

你们不觉得体制就是牢笼？

——————————————

人生就是从一个牢笼到另一个牢笼的过程。

——————————————

So do you?

——————————————

3

——————————————

我是一只特立独行的失眠者

——————————————

你在我枕头旁，种下一朵莲花

一个夏天多一点，莲花已经风干啦

——————————————

为啥国内大多是网游占据排行榜，而单机游戏几乎都是国外的？



因为国内游戏，坑钱为主，游戏为辅

国外游戏，娱乐放松为主，赚钱为辅，本来生活竞争压力就大，玩游戏还要被人民币玩家气，去你妈比，不买账

——————————————

网络化已成常态

人们已经离不开互联网

——————————————

作为一个文科生

为了扩展在百度的搜索词条




我应该多答知乎，吹牛逼可比写小说给劲儿多了😂

——————————————

世界上所有的战争都是自由对抗专制。

——————————————

传说程序员都是害羞综合症患者


在网上活跃，在现实连妹子都不敢勾搭

——————————————

你仔细想想你不充钱能变得更强吗？

——————————————

传销人员可能认为程序员单纯好骗

但他们忽略了程序员的天性：好学


吃一堑长一智，你还想骗？考过雅思再说吧

——————————————

找工作是一个骑驴找马的过程

面包要有，梦想也要有

但如果你吃上了面包后不想实现你的梦想，那说明你根本没有梦想，以前的想法是幻想

——————————————

便利的同时也会付出一些代价

比如被党媒鼓吹的银联卡

你做坏事转账分分钟给你揪出来

——————————————

为什么有人觉得中文编程书很垃圾？

实际情况是这样的，本来外国人创造语言时选的关键字都是老外常用词，但翻译成中文之后就变了味，不光生僻，有些甚至在原汉语中根本就没有，只能硬编一个词出来，那词自然是毫无意义、极难理解的。

——————————————

网络服务商为国家做监控需要耗费大量资金

国家不给，就说你可以投广告嘛！

所以就有了中国特色http网络劫持

——————————————

是那种深深的无聊

以及telegram上群组的死气沉沉把我们聚在了一起

——————————————

https://github.com/xioxin?tab=repositories

前端

——————————————

解散前就想问一件事

请问 @xioxin  是何方神圣？

——————————————

我不是精神病可不可以解散这个群？

——————————————

我多想和你搞一搞基

让全世界的美女都失去意义

——————————————

市场经济是靠本事

国有经济是靠权术

两个还是有点区别的

——————————————

中国有一项消减计划

任何住院做手术的人都要提前登记

谁与国家统治阶级意志不符就会被下命令使医生在手术中做手脚

比如面对精通计算机编程的反党分子，麻醉师会在手术中故意造成患者腰间盘突出，使其再也不能正常工作

——————————————

http://music.163.com/song/247160/?userid=280429778

——————————————

个人感受是一种很主观的东西

——————————————

关于撸这个问题，我们已经讨论了无数次

最后达成了一致共识

戒不掉

——————————————

把希望寄托在下一代不如寄托于自己

因为下一代要20年后才看得到成果

自己目前就可以改变

——————————————

然后一直都想给下一代更好的教育

殊不知给自己更好的教育，下一代顺理成章拥有更好的教育

——————————————

又或者

别人问你年轻时干什么去了

你答道：“挣钱养小孩”





感觉还是那么别扭
世世代代没有青春期

——————————————

最后当别人问你青春时干什么去了

你答道：“追女生”



不是很搞笑吗，你可只有一个青春

——————————————

那些青春不付出

也会过去的不是？

——————————————

我为你付出的青春，这么多年


你却以一句抱歉当作成全

——————————————

数学的真谛在于让人养成享受动脑的习惯，而不是恶心到让人再也不想用脑。

这就是英文数学和中文数学的差别。

——————————————

人人都想成为主角

——————————————

只要998，基佬带回家

——————————————

你饿不饿？

我下面给你吃好不好？

——————————————

我真是觉得女生要开博客认真更新的一般都是研究生及以上水平

不然不会有非社交网络的闲话可说

不然不会有一种深深的孤独感驱使她去写一些东西

——————————————

我已经决定好做结扎手术了😭

——————————————

太TM伤心了，我就是那个群主

——————————————

也许做爱本身并不美好

看看国产视频和国外免费的视频就知道了


美好的感觉都是用钱砸出来的

——————————————

至少全世界的“啊”都念ah

——————————————

When you have that opportunity, grasp it, fly higher.

——————————————

走哪儿都有吴亦凡😒

——————————————

Beyond生前不出名的根本原因是取了个英文名

那个年代诶

——————————————

做大神不易，需要承受相当大的痛苦，面对大量数据的冲击，忍受繁重的任务，应对失眠与焦虑。

——————————————

你看看中国的家居

客厅一般都是3个大椅子围成一个团

这是典型的封闭思想





不光没用，还占空间

少一个椅子就能多很大一片地方，想干嘛干嘛



你要是说家里人来得多不够坐

我就两句话扔过去：

1. 家里一年365天，2天来人，2/365，有363天都看着堵心

2. 人来得多没关系啊，家里有的是便携式靠椅

——————————————

但是最要紧的是在句子中找不认识的单词记；在段落中找不认识的句子记；在文章中找不认识的段落记


记啥？记英文一一对应的中文意思呗！

中英转换(中文含义赋值到英文)是最快的语言学习方式。

——————————————

其实我们人生中大部分时间都在说服别人相信自己

——————————————

你有什么病？

——————————————

你谁呀

——————————————

食谱中说的适量都是凭感觉

——————————————

学英语越深入，你就会发现当年白话文是仿英式词性结构制作而成的

用英文思维常常能发现许多语文词性结构上的病句

——————————————

作为一个精神病人

你们应该多说话

——————————————

“激烈的批评被消灭了，他们再来消灭温和的批评，等到温和的批评都没有的时候，他们就消灭那些保持独立不​赞美人了，到最后，如果鼓掌不起劲，都会被消灭。”——《动物庄园》 ​​​

——————————————

报纸越干净，社会则越肮脏；
电台越和谐，世道则越可怕；
电视越美好，生活则越难过；
电影越高尚，真实则越虚伪。

——————————————

绝世武功秘籍，10块一本。

——————————————

百度那个傻逼

搜索引擎连谁是原创谁是盗版都搞不清

还搞什么self-driving

本职工作都忘了

——————————————

当然，外文流行歌描述的大多是一群不想穿衣服的原始人。

——————————————

听许嵩的中文歌和别人的中文歌的区别是

别人永远停在小学生、初中生的水平

许嵩却一路从小学生成长到初中生到高中生，最后到大学生…

我指歌中的世界观

——————————————

做音乐还是要基于现实，高于现实

——————————————

首先他们阻止你访问敏感网站
接着他们干扰你访问主流网站
然后他们屏蔽你访问用的VPN
再来他们降低你出国网络速度
最后他们干掉你加速用的跳板

《局域网是如何炼成的》

——————————————

分享金玟岐的单曲《爱呀》: http://music.163.com/song/28285912/?userid=280429778 (来自@网易云音乐)

——————————————

不过可以确定的是

不爱听歌的妹子不要娶，没情调

——————————————

听我父母讲话智商会变低

——————————————

http://chinadigitaltimes.net/chinese/2017/07/%E8%88%AA%E8%BF%90%E6%BC%AB%E7%94%BB%E5%AE%B6k%E8%80%81%E5%B8%88%EF%BC%9A%E4%BD%A0%E4%BB%A5%E4%B8%BA%E5%85%BB%E8%80%81%E9%87%91%E8%B4%A6%E6%88%B7%E6%98%AF%E7%A9%BA%E8%B4%A6%E7%AE%97%E6%98%AF%E5%BE%88/



原来如此

——————————————

http://chinadigitaltimes.net/chinese/2017/07/%E5%B9%BF%E7%94%B5%E6%97%B6%E8%AF%84%EF%BD%9C%E6%80%BB%E5%B1%80%EF%BC%9A%E9%87%8D%E8%A6%81%E5%AE%A3%E4%BC%A0%E6%9C%9F%E7%A6%81%E6%92%AD%E5%8F%A4%E8%A3%85%E3%80%81%E5%81%B6%E5%83%8F%E7%AD%89%E5%A8%B1/



叫你不要看电视

——————————————

你适合这里：

@EasyProgrammingLanguage

——————————————

为什么手机内存加一G就增加很多钱？

——————————————

英雄怕情长气短

而我们已靠岸

——————————————

https://youtu.be/ghugLrMmlM0

——————————————

我这个人最大的特点就是说到做不到。

——————————————

http://blog.sina.com.cn/s/blog_93509ca2010124eu.html

——————————————

老乡，开门，我们是八路军，我们不拿老百姓一针一线，快开门啊老乡，再不开门我们就开枪了！老乡，你总算是开门了！同志们，除了针和线，其他的统统搬走。哟！老乡，你还有个闺女呐

——————————————

麻醉后看鸡鸡的走向就能知道该人的生活习惯

向左=平时右手撸
向右=平时左手撸
向上=平时真人撸
向下=平时不撸

——————————————

I mean Chinese, the language.

——————————————

No

——————————————

Let me tell you what's benefit you can get from getting out of theGFW:

1. high quality sextual videos
2. stupid anti-Communist chinese
3. English documents, which make some people feeling headache

——————————————

人为财死，鸟为食亡。

——————————————

Nothing happens..

——————————————

/list@zh_groups_bot

——————————————

哦

——————————————

几年以前，我曾经嘲笑过某科技界大佬。当时他说：也许90后、95后会慢慢不知道谷·歌是什么网站。

　　那一年，这对于我来说简直就是世界上最好笑的笑话。谷·歌，全世界最卓越的互联网公司，活在互联网的一代中~国人，会不知道他们的网站？
今天，我收回这句嘲笑。因为这件不可能的事，它慢慢变成了现实。

没有人再关注什么谷~歌不谷~歌。对他们来说，百度也蛮好用的，反正他们几乎没用过谷·歌。没有谷·歌又怎样？大家还是开心的看微博，刷朋友圈，聊微信，听歌，看娱乐节目。对于从来就不知道谷·歌的人来说，少了谷·歌又有什么影响？

慢慢的,它们就没有了,就像从未存在过

多年前，我们也是可以登陆Facebook的。其实这个网站和校内一样，也挺蠢的。可在上面你能看到老外们的生活，可以轻易的跟一万公里以外的人互相拜访，可以看到很多根本不会开到校内上的主页。你用汉语回复，下面给你聊起来的可能是香港仔，可能是台湾人。你用英语回复，说不定有比你英语用的更蹩脚的寂寞的北欧人来跟你搭讪。你感觉地球真的变成了地球村，你还没拉门走出去，别人就推门走了进来。

然后，它就没有了。起初，它的失踪激起了很大的声音，后来，声音就消失了。

多年前，我们也是可以登陆Twitter的。其实这个网站和微博一样，也不过是些信息流，刷上一整天，也不见得有什么用处。但至少，你可以以最快速度获取你想知道的任何新事，你会真正了解什么事情在全世界是流行的，而不是经过各种截图、翻译、转发，甚至曲解、断章取义、黑白颠倒的东西。你知道的是真相，赤裸裸的，也许有点太短的真相。但至少中间不会有无数人的加工与再加工，偏激、片面，就在这个过程中产生了，不管后来者有意还是无意。

然后，它就没有了。首先是它的本体没有了，然后它的模仿者也没有了，模仿者的模仿者也没有了。只剩一个模仿者的模仿者的模仿者，现在你每天能在上面看到无数广告。

多年前，我们也是可以登陆YouTube的。对于有的人来说，这个网站就是个大型优酷，当年有人信誓旦旦的说，没有YouTube，我们中国人会很快让优酷超过YouTube。可这么多年过去了，视频还是那么卡，内容还是那么垃圾，原创还是那么容易被盗窃，视频丰富度还是那么的可怜。在YouTube上，你能看到全世界最棒的手艺人，最逗乐的笑话，最天马行空的创意，最激荡人心的音乐，最美好的完美瞬间，可在优酷上，你想看一分钟视频，请先看半分钟广告。

哦，对了。Instagram，有些人可能感觉它和QQ空间也差不多。可我在上面关注了六百多个摄影师，它们都是顶好顶好的影像记录者，每天看他们的作品，我感觉到很幸福，那种即使没有到那里去，也身临其境的幸福。我还在上面认识了一个日本的爱自拍的帅小伙，一个爱喝酒的韩国大叔，一个十年前到过中国今天会在每张我发的紫禁城照片下点赞的美国大爷，一个美丽无比的俄罗斯妹子，我和他们基本上都难以交流，语言是很大的障碍，但几个简单的单词，心意也就到了，这种感觉，有时候比多年老友相聚还兴奋。因为这是人类不同族群自由交流互相沟通的过程，这种过程很神奇，真的很神奇。

可现在，它没有了，它之所以没有就因为在某个特定的时间你在搜~索~特定的词汇时，会搜出来特定的照片。虽然这么搜的人并不多，虽然看到的人也不会大惊小怪，也不会觉得天黑了，天亮了，天要塌了，天要变了。可它就是没了，Instagram，就这么没了。谷~歌也是这么没的，Twitter也是这么没的，Facebook也是这么没的。不知道是什么人，在什么场合，说了什么话，下了什么决定。就要有超过十亿人像陷于哥谭市的孤岛里一样，看着一座又一座桥梁被炸掉，又被炸掉，又被炸掉，然后，就什么都没了。

我时常觉得悲哀，真的好悲哀，一个我根本不认识也不知道是谁的人，也许是一个群体，在不断抢走我身边的东西，而我却无能为力。我抱怨一声，他听不到，任何人都听不到。我怒吼一句，身边的大多数人却像看疯子一样的看着我。我哀嚎一声，这声音被阻碍在黑黑的幕墙以里。我发出尖锐的嘶吼，这声音传不了多远，就和我那被抢走的东西一样，消失了，不见了，就像从来没存在过一样。

对于本来就没存在过的东西，有谁又会觉得在意呢？那些本来拥有又被掠夺的人的哀愁，后来的人又怎么懂呢？我曾经是拥有一切的，我曾经是拥有世界的，我站在这片土地上，呼吸的是自由的空气，饮下的是自由的琼浆玉液。就在长的无法计数的时间里，我自由生命的一部分又一部分就这么被杀死了，突然就杀死了。可我还始终觉得，它们还奄奄一息的活着，就像它们是慢慢的死去的一样。

可它们终归是死了，而且随着它们的死，愈来愈多的事情慢慢的发生了，很慢很慢，几乎不被人察觉，可还是发生了。

没有谷·歌，我可以用百度呀。可某些结果被越挪越后，越挪越后，最后就不见了。就像本来就不该搜出这个结果一样。

没有Facebook，我可以用校内呀。可你想发只有在Facebook上能发的文章，很快在校内上就失踪了。接着，校内变成了人人，话题变成了人人都关心的话题。大家都在抢着看星座、明星、八卦、娱乐。没有人会关心什么消失了，反正它们本来也没多少存在感。

没有YouTube，我可以用优酷呀。可你却经常只能在优酷上看到抄袭别人的作品，而且还不署名，而且还洋洋得意，而且还自我陶醉，就好像那个idea本来属于他自己一样。你看了还要惊呼，他是如此的有创意！好一个抄袭的创意，可你却不知道，因为你不知道这个世界上有个网站叫YouTube。

没有Twitter，我还可以用微博呀。可你想知道最近发生了什么，你搜的越勤快，越能看到越明显的“根据相关法律法规，相关搜索结果不予显示”。时间长了，你想，反正知道了也没什么用，不如不看了。

慢慢的，一扇又一扇的门关上了。今天你打开世界上最大的博客网站，发现它没了。明天你一看，世界上最好的设计师分享网站没了，一开始是刷新的很慢很慢，后来它就没了。过两天再一看，平常每天都会读两篇文章的媒体网站没了，那里的文章缤纷多彩，最后都变成了该页无法显示几个字。再过几个月，大学的网站不让上了，摄影师的网站不让上了，就连百度日本这种自家网站，也没了。

接着，漫画看不了了，接着，动画看不成了。接着，美剧英剧失踪了。下载美剧英剧的网站又又又失踪了。尊重正版，保护权益，行吧，然后字幕网站也没了。

游戏没了，你习惯性登陆的游戏网站，发现下载栏正在整治中。论坛关了，天天都在看的论坛，突然接到相关部门的电话，因为“报备问题”不让办了。个人网站，私人博客，对不起，说没就没有，你在上面存了多少多年辛勤耕耘的东西都没用。

你关注的人，有一天你登陆微博，发现他怎么好久都没说话了，然后你搜索了一下，发现他的账号不存在了，而且你搜他的名字，他的名字未予显示。

一盏一盏的灯，灭了。四面八方的光源，消失了。我们生活的五光十色的世界，变成了一片黑色。

天黑了，那么睡觉吧，但愿长醉不复醒。

最后，我们变成了一群做梦的人，这个梦的名字，叫根·据·相关·法·律·法·规，相关搜·索结·果·不·予·显·示·梦。

——————————————

随着时间的增长，我变得越来越屌，怎么办呢？

Over time, I became a geek.

——————————————

不管什么时候通往上层的通道都是关闭的

——————————————

我要做西餐

——————————————

饼 Frikadellen
鸡蓉蘑菇汤 Chicken Mushroom Soup
德式洋葱汤 German Onion Soup
炸春卷 Spring Rolls
香草猪排 Pan Fried Pork Loin with Herbs
中式面条 Chinese Noddles
曼哈顿海鲜汤 American Seafood Soup
香辣烤鸡翅 BBQ Chicken Wings
卡真鸡排 Cajun Chicken Breast
滨豆汤 Lentil Soup
维也纳煎乳牛排 Wienner Schnitzel
白菜花 Cauli Flower
咖喱鸡肉串 Chicken Skewer with Curry
米兰鸡 Millanese Chicken Piccate
曼哈顿蛤蛎汤 Clam Chowder Soup
烤鸡腿 BBQ Chicken Leg
金枪鱼三明治 Tuna Sandwich
烤土豆 Grilled Potato
维也纳香肠 Wienner Sauages
牛肉炒饭 Fried Rice withBeef
香草奶油斜切面 Penne Carbonara
水果鸡肉串 Fruit Chicken Skewer
意大利蔬菜汤 Minestrone
培根炒蛋 Fried Egg with Bacon
法式洋葱汤 French Onion Soup
青豆汤 Green Bean Soup
泰式肉松炒饭 Fried Rice of Thai Style
炒什锦蔬菜 Fried Mixed Vegetable
猪肉饼 Meat Ball
腰果鸡丁 Sauted Chicken Breast with CashewNuts
牛肉串 Beef Skewer
鸡胸片 Chicken Breast
鸡肉串 Chickem Skewer
火腿奶酪三明治 Ham &Cheese Sandwich
奶油土豆汤 Potato Cream Soup
中式点心 Dim Sum
香草鸡排 Pan Fried Chicken withHerb

——————————————

（一）早餐类：Breakfast
1）法式煎吐司 French toast
2）蛋卷 Omelet
3）炒蛋 Scrambled egg
4）煎培根 Fried bacon
5）水果麦片粥 Oatmeal with fruit
（二）三明治类：Sandwich
A：吐司类：Toast
1）火腿奶酪三明治 Ham and cheese sandwich
2）总汇三明治 Club sandwich
3）吞拿鱼三明治 Tuna fish sandwich
B：法国面包/法棒类：Baquelte
1）鸡肉/牛肉三明治 Chicken/beef sandwich
2）培根菠萝三明治 Bacon and pineapple sandwich
3）时蔬三明治 Seasonal vegetable sandwich
(三) 汉堡类：Hamburger
1)牛肉汉堡 Beef hamburger
2)鸡香汉堡 Chicken hamburger
3)鱼排汉堡 Fish hamburger
(四）意大利面类：Italian pasta
1）意大利肉酱面 Bolognaise spaghetti
2）蝴蝶面配番茄汁 Farfalle with tomato sauce
3）蛋黄培根空心粉Macaroni carbonara
4）奶油蘑菇宽粉 Tagliaelle with mushroom cream sauce
（五）沙拉类：Salads
A：冷汁制作 Dressing
1）蛋黄酱/美乃滋 mayonnaise
2）意大利油醋汁 Vinaigrette dressing
3）法国汁 French dressing
4）千岛沙拉酱 Thousand Island dressing
5）凯撒沙拉酱 Caesar dressing
6）它它沙拉酱 Tartar dressing
B：沙拉/色拉/沙律 制作 salads
1）凯撒沙拉 Caesar salad
2）薯仔/土豆沙拉 Potato salad
3）鸡肉沙拉 Chicken salad
4）蔬菜沙拉 Vegetable salad
5）什锦水果沙拉 Fruit salad
(六) 汤类：Soups
1) 法式洋葱汤 French onion soup
2) 薯茸/土豆奶油汤 Potato cream soup
3) 法式蘑菇汤 Mushroom soup
4）意大利蔬菜汤 Minestrone
5）匈牙利牛肉汤 Gulash soup
(七) 批萨类：Pizzas (手抛批萨 Handy pizza ；方形批萨 Square pizza)
一、批萨番茄酱制作：Making tomato sauce
1）自制意大利风味番茄酱 Italian style tomato sauce
2）自制美国风味番茄酱 American style tomato sauce
二、批萨的制作：Making pizza
A：意大利式批萨类 Italian style pizzas
1）意大利香肠批萨 Salami pizza
2）培根蘑菇批萨 Mushroom&bacon pizza
3）四色奶酪批萨 Four cheese pizza
4）意大利蔬菜批萨 Vegetable pizza
B：美式批萨类：American pizzas
什锦批萨 Mixed pizza
1）至尊牛肉批萨 Perfect beef pizza
2）什锦海鲜批萨 Seafood pizza
3）经典鸡肉批萨 Classical chicken pizza
（八）牛排类：Beef steak
一、牛排酱汁的制作：Making sauce for beef steak
1）烧汁/布朗汁 Dime-glace/Brown sauce
2）香草酱汁 Herbs sauce
3）黑胡椒酱汁 Black pepper sauce
4）蘑菇酱汁 Mushroom sauce
5）红酒酱汁 Red wine sauce
二、牛排的制作：Making beef steak
A：煎牛柳/牛菲力配上述任何汁
Grilled beef tenderloin with any sauce
B：煎西冷/牛外脊配上述任何汁
Grilled beef sirloin steak with any sauce
三、牛排成熟度的掌握 How do cooking beef steak?
1~2成熟 Rare ；
3~4成熟 Medium rare ；
5~6成熟 Medium ；
7~8成熟 Medium well
9~10成熟 Well done
四、牛排的主食与配菜 Served with
1）薯泥/土豆泥 Mashed potato
2）炒薯仔/土豆 Pan fried potato
3）炒混合蔬菜 Pan fried mixed vegetable
（九）开胃菜：Appetizers
1)法式蘑菇烩蜗牛 Stewed snails with mushroom and cream sauce
2)法国勃垦地烤蜗牛 Baked snails “Burgundy style”
（十）主菜类：Main course
1)煎鲈鱼配米饭伴意大利黑醋汁
Grilled seabass served with French rice and balsamico sauce
2)蘑菇奶油烩鸡
Stewed chicken leg with mushroom and cream sauce
3)匈牙利烩牛肉
Beef Gulash
4)法国蓝带煎鸡
Cordon Bleu chicken breast
5)烤鸭胸配香橙浓味汁
Baked duck fillet served with orange sauce
(十一)甜品类：Desserts
1) 奶油泡夫 Puff with wipping cream
2) 巧克力蛋糕 Chocolate cake
3) 巧克力/ 草莓慕斯 Chocolate/strawberry mousse
4) 法式苹果挞 Apple tart
5) 自制巧克力酱 Home made chocolate sauce
6) 甜品类装饰 Dessert decoration
菠菜汤 Spinach Soup
烩牛肉 Beef Goulash
炒土豆 Fried Potato
酸辣汤 Hot &Sour Soup
咖喱海鲜汤 Seafood Curry Soup
香煎茄子 Pan Fried Eggplant
俄式烩牛肉 Stronganoff Beef Goulash
维也纳香肠 Wienner Sauages
黑椒牛排 Beef Steak with Black Pepper Suuce
墨西哥鸡肉饼 Mexican Quesadillas
炸鸡腿 Deep Fried Chicken wings
酿焰猪排 Stuffed Pork Chop
金枪鱼意大利面 Spaghetti with Tuna
墨西哥牛肉丸子汤 Mexican Beef Ball Soup
蔬菜炒饭 Fried Rice with Vegetable
螺旋面 Fussili Pasta
西兰花 Broccoli
香草西红柿汤 Tomato Basil Soup
西红柿角Tomato wages
米兰式西兰花 Fried Broccoli
奶油南瓜汤 Pumpkin Cream Soup
蓝芝士菠菜汤 Spinach Soup with Blue Cheese
米兰式猪排 Pork Milannaise
煎土豆 Roasted Potato
蘑菇鸡排 Pan Fried Chicken with Mushroom
香酪猪排 Pork Cordon bleu
香酪鸡排 Chicken Corden Bleu
洋葱圈 Onion Rings
奶油烩猪柳 Pork Ragout
培根牛肉串 Bacon and Beef Skewer
印尼炒饭 Nasi Goreng
黑椒牛柳粒 Sauted Beef Tenderloin with BlackPepper
奶油烩鸡 Chicken Ragoat
扬州炒饭 Fried Rice of Yangzhou Style
红烧牛腩 Beef Stew
地中海茄子汤 Mediterranean Eggplant Soup
蘑菇猪排 Pan Fried Pork Steak with Mushroom withMushroom
香辣猪肉丝 Sauted Pork Slice of SichuanStyle
地中海青椒汤 Mediterranean Bell Pepper Soup
奶油西兰花汤 Broccoli Cream Soup
土豆泥 Mashed Potato
蜜汁胡萝卜 Fried Carrot
煎乳牛排 Jager Schnitzel
炸猪排 Prk Schnitzel
肉面包 Meat Loaf
扒蔬菜 Grilled Vegetable
西红柿意大利面 Spaghetti with Tomato Sauce
香炒凤尾虾 Pan Fried Shrimp
鸡肉卷 Chicken Rolls
猪肉卷 Pork Rolls
奶油西葫芦汤 Eucchini Cream Soup
红菜头片 Red Cabbage
奶油胡萝卜汤 carrot Cream Soup
鸡蛋卷 Omelet
甜玉米汤 Sweet Corn Soup
匈牙利牛肉汤 Beef Goulash Soup
柠檬土豆汤 Lemon Potato Soup
德式小香肠 Small Sauages
奶油炬土豆 Gratin Potato
马来西亚炒面 Malasier Fried Noddles
牛肉

——————————————

整天处于欲求不满的状态，好烦

——————————————

What's the meaning of life? Movie, coding, or hard work?

——————————————

(yamete)=不要，一般音译为“亚美爹”，正确发音是：“亚灭贴 ”

（kimochiii）=爽死了，一般音译为“可莫其”，正确发音是：“克一莫其一一”

（itai）=疼，一般音译为“以太”

（iku）=要出来了，一般音译为“一库”

（soko dame）=那里……不可以 一般音译：“锁扩，打灭”

（hanaxitie）=放开我 音译：“哈那西贴”

（hatsukashi）=羞死人了，音译：“哈次卡西”

（atashinookuni）=到人家的身体里了，音译：“啊她西诺喔库你”

（mottto mottto）=还要，还要，再大力点的意思 音译：“毛掏 毛掏！”

呀大/呀～（yada）——不要

打麦（damai）——不行

奥内该（oneigai）——拜托

斯该（sigai）——好厉害

给木基（gimuji）——好舒服

伊呦（yiyou）——很好

噢金金（oujinjin）——小弟弟

偶那噶西（ounagaxi）——小妹妹

克类（kelv）——出来了

可一达（kida）——来了

以古（yigu）——要去了

啊兰假耐（alanjianai）——会怀孕的

八金（bajin）——处女

以修妮（yixiuni）——一起吧

以各（yige）——高潮了

——————————————

日本AV无码系列

BTSYNC密钥地址：BKESIRXAOLROZTSFTRUCCHNA32622LKEZ

——————————————

news.ifeng.com/shendu/ndzk/detail_2012_01/19/12077538_0.shtml


韩国的网络十分发达，为什么要实行网络实名制？

“很多网民认为，这项政策的推出是政治博弈的结果，韩国执政党大国家党是为了控制网上舆论。”韩国专栏作家金宰贤说。

这个说法，与李成贤的分析比较一致。他认为，这和韩国的上层权力机构有关，韩国总统的权力非常大，而且总统所属的大国家党在内阁中占有巨大优势，反对党的声音非常小。而韩国的网络实名制正是在大国家党执政时期得到了极大强化。

而在外界看来，如中国媒体人士安替认为，实名制真正的诱惑是：打通虚拟治理和地上政府管理，让政府拥有虚拟世界的绝对权威，或者让网站拥有地上的政府权力。

——————————————

我说可以

又没说必须

——————————————

你们如果有谁在中共上班，可以举报他

——————————————

一个内陆激进分子

——————————————

你一定是男的

——————————————

为什么夏天会有蝴蝶？

不是春天吗？

——————————————

不对，只有你一个活人

——————————————

学会了电动摩托

——————————————

人有多大产，地有多大胆。不对，我是说，能力越大责任越大。不对，我是说有多大的能力做多大的事。

——————————————

NO

——————————————

I shitted on my crotch

——————————————

@Shinohara_Rin

——————————————

And I know who you are

——————————————

I like it too

——————————————

Why you insist to understand me?

——————————————

Because that's my mind.

——————————————

Only electronic music will take me flying away.

——————————————

关键在于影视剧都把底噪给拿掉了

不真实

实际上在丛林噪音非常大，人们对话时周围超过5个人就可能非常吵。

——————————————

不写、不看日记的话，很多时候还是在走老路。

——————————————

 在美国听名人演讲也是如此。名人孤单地来，孤单地去。并不因他有名，台下问问题的人便显出胆怯。在美国，自由的含义之一便是尊重每个个体，哪怕他是多么默默无闻。相反，在中国做个孤独的普通人，是最危险和最寂寞的。一个人稍微在某件事上与众不同一点，便可引祸上身。我们老祖宗的智慧，便是尽量消灭自己的个性，多往人多的地方站。中国近代史上运动来运动去，一大原因便是大家因恐惧而跟着形势走。在中国做学问，也要依附成理；大学各系里的老师往往都是本校本系毕业的同门，学术上以校为派。在美国学界，年轻人总想独树一帜，弄一套自己的理论体系来玩玩。留校教书被当做“近亲结婚”而被人不齿。热爱自由的人说起话来，当然少有顾忌而充满个性，即使说的是科学上的术语。

 在美国听名人演讲也是如此。名人孤单地来，孤单地去。并不因他有名，台下问问题的人便显出胆怯。在美国，自由的含义之一便是尊重每个个体，哪怕他是多么默默无闻。相反，在中国做个孤独的普通人，是最危险和最寂寞的。一个人稍微在某件事上与众不同一点，便可引祸上身。我们老祖宗的智慧，便是尽量消灭自己的个性，多往人多的地方站。中国近代史上运动来运动去，一大原因便是大家因恐惧而跟着形势走。在中国做学问，也要依附成理；大学各系里的老师往往都是本校本系毕业的同门，学术上以校为派。在美国学界，年轻人总想独树一帜，弄一套自己的理论体系来玩玩。留校教书被当做“近亲结婚”而被人不齿。热爱自由的人说起话来，当然少有顾忌而充满个性，即使说的是科学上的术语。

想来上的最近几次math class并没有一开始就给我公式让我去背，反倒是给了很多data，让我们从中推出规律

——————————————

Thank you for your listening.

——————————————

I got many problems in the past 19 years. That's fine, and I normally choose to forgive what I have done. So every time bad things came and gone as they come, they don't really hurt me. 


Now I want to tell you a story, it's about me, the real me.

When I was 10 years old, I got a habit, which was playing my little cock. That was really fun, you know, to a 10 years old boy. Generally, I would rotate it over and over again. Imagine that, lying on a big soft bed, doing this in the night, you must gonna love it.

And yes, I know that's not cool, but who cares! As long as we get fun.


It's time to go to primary school. Haha, just in the first year of primary school, I came across bullying. Bad luck, isn't it?

Don't worry. I got my older sister. She will protect me. So after chasing the bully around the playground several times, she gave up. And we came back to the home together.


Oh, yes! There has another thing I got clear memories. One day in the dusk, I was playing at school with my sister and girl-next-door. It's holiday, so there got few people.

One thing is for sure, that is I shitted in my crotch. What a horrible story, I guess. But it's true, absolutely true. Fortunately, since then I never did it again. 


OK, all those things just happened in my childhood. For more, there has another thing vivid in my mind, my cat.

I used to have a white cat, it's maybe my best friend in childhood, even though It may not think so.

——————————————

他们是参与镇压的吗？

只要他敢公开承认，工资就不低

——————————————

辛亥革命不是革命党人的起义

实际上好多地方政府换了快牌子就算革命了

——————————————

再说了，那些都是清华北大的学生，人家比你高几个阶级

还有那些参与镇压的官兵，现在退休金至少是你工资的两倍

你瞎闹腾反倒是做了一小撮特权阶级的工具

——————————————

中国每小时平均5个人死于黑社会

不用在意那些细节，是人都会犯错，国家也是

——————————————

32：15亿

有意思吗

——————————————

谈到高考，除了紧张到睡不着之外并没有其他感想

——————————————

研究普通人看电视

一般人请客时，电视会一直开着，但实际上没一个人看

至少说明这家人没效用观念，同时也不太注重噪音污染

——————————————

时间是个好东西

——————————————

其实他哪里知道

除了这几个TG群以外

我在QQ群的逗逼奋斗史呢

——————————————

唉，可能除了这个群以外，我留下的足迹真的很吸引人

——————————————

@Shinohara_Rin

昨天告诉了我他的电话号码

——————————————

还有英语这些

——————————————

github等

——————————————

但有趣的是，我告诉他那些东西，他一直在用…

——————————————

我以前还带过一个13岁的小孩进TG

结果它接受不了以前无知的事实(我向他介绍了主流编程宇宙)，离开了TG群

——————————————

想来在TG上混这几年，就只有豌豆这一个朋友总是available

——————————————

And by the way, true friend will not leave...

As you can see.

——————————————

bye

——————————————

But recently, I am not have too much to say in this group.

I'd like to focus on programming skills.

——————————————

I don't know, whatever you want

——————————————

It's the darkest side of me.

——————————————

..

——————————————

Oh my god, why you come to here?

——————————————

有个外国人问我为什么喜欢孙悟空。我回答他:超人，钢铁侠，美国队长为你们维护正义七八十年。而孙悟空，为我们斩妖除魔，五百年。你们有很多英雄。我们只有他一个。

——————————————

可是我怎么还拿着手机？

——————————————

天天都在玩的日子该到头了

——————————————

对不起我自己

——————————————

感觉每天都在蹉跎岁月

对不起爸妈

对不起人民

——————————————

江山只指中国内陆

人类指整个地球

——————————————

中国影视剧一般是以“肩负江山重任”为依托

而美国影视剧主要是以“肩负人类命运”为依托

——————————————

长大意味着孤独和成为超现实主义者

——————————————

分享陈旭的单曲《东北特产不是黑社会》: http://music.163.com/song/69702/?userid=280429778 (来自@网易云音乐)

中国hi-pa的骄傲

——————————————

爱情是一个人与另一个人的磨合中逐渐过渡到对物质的纯粹的需要的过程当中消失的东西。

——————————————

刚刚偷偷瞄了一眼QQ空间

我们不是一路人，哈哈

——————————————

时差调整不过来，真囧

——————————————

事实上，如果你自己不活跃，别人是不会替你活跃的


所以我们经常看到群主在讲话

——————————————

所以你们中的大多数人都是加了很多死群

——————————————

悲观的人，先被自己打败，然后才被生活打败；乐观的人，先战胜自己，然后才战胜生活。悲观的人，所受的痛苦有限，前途也有限；乐观的人，所受的磨难无量，前途也无量。在悲观的人眼里，原来可能的事也能变成不可能；在乐观的人眼里，原来不可能的事也能变成可能。悲观只能产生平庸，乐观才能造就卓绝。从卓绝的人那里，我们不难发现乐观的精神；从平庸的人那里，我们很容易找到阴郁的影子。

——————————————

分明就是一人演两个角色

——————————————

那个人妖是逗逼吗

上大学还带哥哥

——————————————

没准他哥嫉妒我的才华😏

——————————————

额…那就没办法了

——————————————

她这个年龄和你一样，都对世界非常好奇


但明明是学习能力最强的时候

——————————————

从初中毕业就去某个学校读5年

然后得到大专文凭

——————————————

从她的年龄以及提供的信息

她是读的5年式中专

——————————————

能重要的是，加个群干嘛把她哥给带上

很明显这是依赖嘛

——————————————

难道我答错了什么吗？

——————————————

Did you hear about a movie which named split?

For more, It's maybe a scam.

——————————————

嫉妒我干嘛？

难道是想上他妹妹？

——————————————

我根本就没有图

拿什么斗😂

——————————————

看来又有希望了😂

——————————————

every one can contact me on internet.

——————————————

online

——————————————

就老去吧

I'm always online

——————————————

估计程序员只能孤独终老

——————————————

官方给的镜像死活会出错

——————————————

真TM SB

——————————————

人家有男朋友了，好烦

——————————————

本来我活在网络这么多年，都忘了样貌是什么东西

被这个女的一问照片，就蒙蔽了

——————————————

或者在大学锻炼身体，变成肌肉男

——————————————

唉，我好不容易的跨国恋就这么完结了

——————————————

他们国家的男性除了 IT guy ，基本就是膀大腰粗

——————————————

是不是感觉很悲凉，身材太小，就上不了外国女性…

——————————————

这几句话挺美

——————————————

https://blog.netsh.org/about

诡异的图片，不能下载，但能看

——————————————

就几个人玩…

——————————————

中文群组不靠谱

——————————————

reply: 信不信我艹了你，in my mind

——————————————

他们不怎么骂

——————————————

高考症候群

——————————————

我就是啊

——————————————

我喜欢 上你 时 的内心独白

——————————————

分享了#名家散文#的节目《山本文绪：孤僻》: http://music.163.com/program/904895754/96721794/?userid=280429778 (来自@网易云音乐) 

我觉得这种女孩很适合我😂

——————————————

看完那么多科幻

就觉得社会学的专家不流弊

还是工程师会魔法

——————————————

分享了#名家散文#的节目《胡适：柴米油盐的日子就算过了一生吗》: http://music.163.com/program/904937362/96721794/?userid=280429778 (来自@网易云音乐)

——————————————

然后就不知道看什么了

——————————————

我把豆瓣上，万评以上的，科幻8星作品，刷完了❤️

——————————————

欧！

我把豆瓣上万评以上的科幻8星作品刷完了❤️

——————————————

《PREDESTINATION》看了这个你才知道什么叫脑洞大开。

——————————————

我居然做了梦中梦中梦

我醒来看手机，15点了，该起床了，继续睡；发现前面是个梦；接着又醒来看手机，11点了，该起床了，继续睡；结果还是梦。

不过刚刚我醒来看手机，竟然才9点多，哈哈，这就是时差的恢复正常所要经历的吧。🙈

——————————————

我评价社会，就两个字：浮躁

在社会上继续学习是比较困难的

所以别在最适合学习的时候放弃学习

——————————————

I don't think it's good at all.

You know, one man can't rely on one point to support the whole building.

——————————————

123moviesfree.com/watch/supergirl-s02-2015-i.2-online-free-123movies.html

——————————————

突然想到卡通，那些配音演员、那些制作者，其实也是在延续他们的童年梦。

——————————————

刻意做小众，必然会大众
刻意做大众，必然会小众

——————————————

stbos.bj.bcebos.com/cvTyrael.html 

原来全民K歌的开发长这样😂

——————————————

分享LE_CHAT创建的歌单「【被施过魔法】适合大开脑洞/做白日梦的BGM」: http://music.163.com/playlist/151202235/41991812/?userid=280429778 (来自@网易云音乐)

——————————————

突然想到，政治意识形态催生的一堵墙隔绝出了两个世界。

东方用这堵墙免费享受西方作品，同时隔绝了科技。

西方想打破这堵墙卖版权和科技。

——————————————

分享阿肆/林宥嘉的单曲《致姗姗来迟的你 》: http://music.163.com/song/432506809/?userid=280429778 (来自@网易云音乐)

——————————————

好看不？

——————————————

不知道，不过我SS又看不了YouTube了

防火墙真坏，我得去检查一下

——————————————

只要点TG YouTube链接的图片就可以弹出视频窗口

点右上角就悬浮了

——————————————

Wow，这种小窗口好省时间

——————————————

我这里有个哑巴，娶了个漂亮媳妇，然后漂亮媳妇成了别人的小三，别人把哑巴给做掉了，从此别人和小三过着幸福快乐的生活。

——————————————

老司机最痛苦的地方不是控制不了性欲

而是抑制不了失眠和神经衰弱

如果上天再给我一次机会，我再也不装逼复读了

——————————————

/start@zh_groups_bot

——————————————

/update@zh_groups_bot

——————————————

看久了真的会被影响的

——————————————

https://youtu.be/MhdumNmXA74

小图，这个群你不该进的

这是精神病人的世界

——————————————

恩

——————————————

昨天没睡觉，今天再加两片褪黑素看效果如何

——————————————

为什么别有一番风味

——————————————

分享许嵩的单曲《看不见的风景》: http://music.163.com/song/168005/?userid=280429778 (来自@网易云音乐)

——————————————

[https://m.bilibili.com/video/av9937776.html] [洛天依 原创《上下上下》_VOCALOID·UTAU_音乐_哔哩哔哩] is good,have a look at it!

——————————————

告诉你一个测试机器人的好地方

——————————————

为什么

——————————————

像我这样的年轻人，从不为自己打算

——————————————

From this talk, we know twree things:

1.中国的选举是水的，不代表人民
2.中国的司法不独立，人治严重
3.中国的政府行事不公开，媒体被管控，人民不能很好监督政府

https://www.youtube.com/watch?v=ZmTKkIQ8EgE&t=409sv

——————————————

我妈竟然当着面说我很神

真是应了这个群标题

——————————————

阴谋阳谋自古以来就是文科生义不容辞的责任。


那些厌恶官场黑暗的人就是些SB，连文科生的宗旨和宿命都不知道，靠着语文好就当了官，最终也只能靠写一些小骚文度过余生。

——————————————

我是个奇怪的反革命

到国外社区爱国

在国内社区卖国

🙈

——————————————

我们应该崇拜毛泽东，只因其智谋无人能及。

We should admire chair Mao, just because his wisdom which no one can compare.

——————————————

对了，还是自己混合的乱七八糟的东西，重新压制的垃圾

加了特别多香剂

90是实打实的硬梆梆，这个一瓣就碎

——————————————

这东西根本就是90干粮的盗版，90直接以桶卖，便宜多了

这东西给加个外包装就以10为单位卖…

——————————————

我觉得，政府无限的权力，都是大部分人自己放弃的。假货坑爹，让政府审核。孩子管不好，让政府关网吧。有人在微博骂我，让政府去删。房价太高，让政府去限购。我们的文化实在太独特，创造出了家长式威权政府，GFW 正是在这种背景下产生的，一个社会矛盾的终极调和器，最终生活不能自理的你每天做的每一件事情都要给政府审查一遍，以免伤害到其他同样生活不能自理的人。这是一个零和游戏，越和这样的用户打交道，越对未来持悲观态度，觉得 GFW 可能永远也不会消失，而墙内的这个局域网看起来还似乎生机勃勃的自成一体，真是让人绝望。

——————————————

明明是在家，也紧张得睡不着…

高考害人

——————————————

人生没有版本控制，但有容错和检测机制，你总可以从log中知道你接下来要做的事。

——————————————

https://pan.baidu.com/wap/share/home?uk=3963875283&third=0


我很愿意和这样看过无数中外电影的妹子结合

——————————————

要我说，达到平衡就好


这些是小概率事件

——————————————

这里我想探讨一个很有意思的话题，有很多人，把直视社会阴暗面当做是一种“负能量”，但他们却忽略了一个事实：无论是聂树斌案，还是强拆案、山东辱母案、太伏中学坠楼案，这些刷爆了朋友圈与网络的新闻，并不是某人刻意去搜寻的，而是它就赤裸裸地摆在你的面前，就差顶到你眼睛上了，难道要“视而不见”才算是正能量？难道看到了却当做什么都没有发生才算是正能量？难道看到二十岁少年蒙冤而死一朝昭雪，你内心却毫无波澜平静如水才是正能量？难道看到儿子刺死辱母者却被判无期徒刑，你丝毫不义愤填膺相反还呵呵一笑才算是正能量？

要有一颗多么麻木不仁的心，才配拥有如此的正能量啊。

有很多人，身为底层，却像高高在上的统治者一样，只想听赞美，不想听批评。但他们却忘了一句话，“若批评不自由，则赞美无意义”。如果监督政府，监督官员，揭露社会不公算是负能量的话，那所谓的正能量就是让人闭嘴，让人看到却不能说，让人把自己的言论和思想掐死在萌生之初。

——————————————

I guess you don't know English.

We are different.

——————————————

垃圾，非字母的语言都是专制的工具

——————————————

其实有时候，我觉得毛泽东是个好人

他推崇英语，曾提议把中文变为字母语言


相反那些鼓励文言文的人最为可恶

——————————————

但高考是白天

得赶紧调整时差

——————————————

我晚上不睡觉只是为了成为我理想中的人物——夜魔侠

——————————————

那几本书的内容

——————————————

要是我16岁知道这些

人生可能不同

可恶的信息封闭

——————————————

新加坡打工，有推荐门路吗？

我想去看看

——————————————

回去看一眼QQ空间，瞬间有了自信

他们都是活在局域网的渣渣😂

——————————————

好吧，睡眠空间

——————————————

干嘛睡啊？！

我一般7点睡

——————————————

我Python是学完了的啊～

——————————————

你以前认识我吗？

——————————————

你怎么可能知道我半途而废

——————————————

你会编程吗？

——————————————

能不能讲点实在的

——————————————

就是这点让我很伤心

我自己又不能控制自己去好好学习

——————————————

因为我妈就每天工作12小时，昼夜不分的在黑工厂

因为她除了体力劳动外不会其他的

——————————————

你怎么想？

我总觉得我会进入黑工厂、黑煤矿，反正就是带黑的东西

——————————————

可是

——————————————

可以我大脑残存有理性主义

他们告诉我人们都是由利益驱动

一旦我个人找不到工作，没饭吃就完了

——————————————

就差演说能力

然后可以闹革命了😁

——————————————

感觉你读了好多书

比我好多了

——————————————

连自己都控制不了

f*ck

——————————————

对

——————————————

是的，就不该选文科

要是不选文科，没准我现在就成发明家了

——————————————

我还是有发现问题：

想法太多，做得太少

就像编程“no demo, no use”

——————————————

Nothing

可能这个群就你在看

——————————————

我知道你

看过你博客

mudkid

——————————————

在哪儿读

沿海和内地是不同的

——————————————

什么专

——————————————

你读本科当然不觉得

——————————————

我要是读大学就不会这么郁闷了

就是因为快高考了，静不下心

——————————————

这么闲

——————————————

你读大学？

——————————————

你这时间应该不是在中国

——————————————

你是偷渡走的？

——————————————

因为心累

好像只有我有病一样

——————————————

我想解散本群，有人支持否？

——————————————

越牛的工具，上手的门槛越高，通常也就越"小众"。

——————————————

中国的很多事，官方都不敢说具体，一说具体全是违法的，但是官方偏偏都打着依法治国的幌子。

——————————————

知道的真相越多，我越痛苦

而后，也越坚强

——————————————

自从逃离了QQ，神清气爽，再也没有被监视的感觉了

——————————————

终于找到唱歌的秘诀了

就是不看歌词，听唱

如果闭上眼就能唱出完整的歌，基本就很好听了

唱不好只是不熟的缘故

——————————————

Good enough

——————————————

在幻梦之后，我们还剩什么

——————————————

社会是个金字塔

人员会流动，但阶层是固定的，forever.

——————————————

举个例子：信息是被加密的。

在一个语言系统中，基础语言（母语）是大家喜闻乐见的大众语言。但由于太多人懂它，不适合把知识或是其他有用的、关乎统治者命门的东西用它来分享、保存。

所以我们要“加密”。加密过程中要保证群体的小范围、精英化，所以我们多用另一种语言来代替。 在中国，英语、古汉语、学科专业术语都有可能被用作加密的工具。

——————————————

今天来谈谈少数原则


它是指少数人的能力与多数人的能力相等，但由于它更为集中，常常使得少数在较长时间左右多数人。

这是个周期，少数人会被推翻，但在一个极短的时间内。大部分时间还是少数压榨、奴役多数。

——————————————

年轻人不要老是上网，搞对象你就去书店。书店都帮你们分好类了。想找爱学习的去四六级，想找有气质的你去乐谱区，想找文艺的就去散文旅游区，想找时尚漂亮的你去美容杂志区，想找顾家的去菜谱美食区，想找聪颖的去经济金融区，想找年纪小的去教参区，连年级都分出来了![大笑][大笑]

——————————————

他们说是农民工拉低了国内音乐的品位…

——————————————

了解到口才、销售、计算机是找工作的王牌技能

可以超越学历，靠非正规学校的学习经历

——————————————

我现在脑袋里都是阶层、阻隔、文化…

——————————————

别傻了，认为自己什么都不行


能力有高低之分是客观事实


并不是每一个人都能成为高手，真实世界也不是只需要高手

打杂的、下苦力的，在各行各业都有，并且都是在时代背景下必不可少的



所以，找到一个你认为能实现自身价值的工种，从小工做起，并不丢人

——————————————

感觉不看书，18年白活了

可恶的底层环境

——————————————

真正的爱情，没有暧昧，只是她想给你好心情，你想告诉她你很高兴。

——————————————

并且许嵩还爱看谷阿莫的电影解说😂

——————————————

许嵩竟然在本群

——————————————

你不这样做，别人就把你做了。

——————————————

1.《骆驼样子》（看知乎才知道，表现农民生活贫苦 却没奋斗精神的被删除。。）

2.《八十年代访谈录》（港版繁体竖排可能会吃力 但绝对值得一看）

3 《七十年代》 （同上 更是）

4 《打工女孩》 （大陆版与港台版是薄与厚的差异……梁文道開卷八分鐘推薦）

5 《袁氏当国》

6 《乡关何处》 （台版是《江上的母亲》

7 唐德刚作品集多数被阉被斩 此处不一一列举

8 北岛、阿城 种种

9.《邓小平时代》（台版叫《邓小平改变中国》）

10.《中国近代史 1600-2000，中国的奋斗》（这个被阉得很多 所以很出名了 徐中约教授该作何感想）

11.《苏菲的世界》

12 《国家的常识》（很不错的一本书！关于“中国”那一章连根拔起删除掉了）

13.《废都》

14 《朱元璋传》

15 《挪威森林》

16 《巨流河》

17 《寻路中国》

18 《江城》（台版叫《消失的江城》）

19 何伟的三部曲之一《甲骨文》大陆压根没上~

20 《极权主义的起源》（这部书奠定了阿伦特政治思想家的基础！！！）

21《金瓶梅》人民文学出版社删了n多据说

22 《目送》（删除了一篇“国家”；详见http://book.douban.com/review/2517205/）

23 《野火集》

24 《上海生死劫》（88年程乃珊译版亦有删节 现被列为禁！此书绝对是你了解文革时代的残酷斗争的不二选择！ 此书和巫宁坤的《一滴泪》成为西方了解中国文革的窗口和路径）

25 《剑桥中国史》

26 《今生今世》

27 《山河岁月》

28 《社会心理学》（删掉了国家和社会...)

29 《爱的地下教育》

30 《全球通史》（关于苏联的被删...)

31 《蒋介石与现代中国的奋斗》

32 《往事并不如烟》（港《最后的贵族》 几年前出的内地节本刚问世不久也被列为十大违规出版物之一了）

33.

张爱玲全集什么的大陆版都是不全的（有名的《赤地之恋》属于禁忌。。）

34 《全世界人民都知道》

35 《七日谈》

36 《钢铁是怎样炼成的》

37 《罗马人的故事》

38 《洗脑》（！！！删了第九章 相信不可能的事）

39 《我的故乡在八十年代》

40.

《午夜北平》（港版被梁文道推荐！）

41 《初刻拍案惊奇》

42.

《国史六十年》 里面对毛的意见全除去

43 《蒋介石与现代中国》

44.《南渡北归》

45.《米沃尔词典》

46.

桑德尔的《公正》（台版叫《正义》，第五章 “universal human rights” 很容易理解的一个词 台版翻译的很好叫 普世人权， 中文版被改成：普遍人权。 尼倒是告诉我人权怎么个普遍法！！！！）

47 《中国现代国家的起源》孔飞力

48 《中 国 教 父 习xx》

49 《伪满洲国》迟子建 （台版居然叫《满洲国》）

50.

广西师大《讲谈社－中国的历史》整整两卷不能出版

51.

《现代化的陷阱》（台版叫《中guo的陷阱》此书绝对震撼，网上有电子版）

52.

《追代现代中国》史景迁（ 英文版《The Search for Modern China》里面有关于60+4 的图片 不妨一看）

53.

《改革中guo》 史景迁

54.《 寻找家园》（此豆瓣分9.0）

55.

（马克思著作等 另外，也要区分马克思主义和社会主义国家之间的具体关系。虽然绝大多数社会主义国家都声称以马克思主义为最高信仰，但有不少西方学者认为他们信仰的根本不是马克思主义，或者说不是真正的马克思主义，而是列宁主义，甚至于斯大林主义，这也是苏式社会主义这一名称的由来。实际上，这也不是毫无根据的，以中华人民共和国为例，翻译的马克思的著作只有60多卷，且全由俄文版翻译，而公认最全的法文版有100多卷，即各国对马克思主义的理解有可能存在很大偏差。from 维基百科）

56.

《想象的共同体》

57.

《燃灯者》 （删了很多……）

58.

≪巫术的兴衰≫

59.

《动物庄园》 （台版收录了奥威尔的一篇文稿附在末尾 大陸版則沒有）

60.《废都》贾平凹著（被禁17年后在部分内容删减的情况下，已经出版。）

61.《金瓶梅》兰陵笑笑生著，删除性描写相关内容的《金瓶梅》“洁本”已正常出版。

62.《1984》 （台版是英社党，陆版是英社。 台版和英文原版均有附录。陆版则没有）

63.《天空的一半》 普利策新闻奖得住讲述女性的绝望与希望（第5、9、12、18、22、85、119、154、156、218、219、232页以及原版第九章等处，有删改）

64.《亲爱的安德烈》 龙应台 （其中删除的一封儿子写给妈妈的信“政府的手能伸多长”看后久久不能平静……）

65.《荆棘鸟》（没错，就是这部名著，也被删改了。删改了什么？ 其实也无关紧要，就是些性虐待之类的…… lz一直觉得一个理性人可以有自己的判断，这个选择不应由别人来替你做，哪怕你是zf，哪怕你是国家。然而就算你已成年，在我国，你也不能有这种自由的选择。所以，学英语吧。。说直接读原著！）

66.

《常识》梁文道 （很多是时评 也逃不过删减命 网友直呼读来生硬）

67.《喇嘛王国的覆灭》 （被政治入侵了的学术翻译

——————————————

下午5：30开始，世界变得喧闹

——————————————

刚起床是一个人意志最坚定、头脑最清晰可用的时刻

如果这时不把你一天必须做的脑力活动做完，其他时间就别想做了

——————————————

最重要的是，电影、音乐似乎也知道，除了满足人类的社会心理，人们最需要的，还是两性心理。

恒久不变的歌颂爱情，也就是两性结合


虽然也有同性恋，但那只是消除孤独的手段

——————————————

然后电影、音乐也是让你不孤独地做个旁观(听)者

——————————————

各个平台也都如此

不管是微信还是Twitter

所有的联系都是这样

——————————————

你为什么会存在？为了让我不感到孤独。

(在这个群)

——————————————

公众人物的存在就是为了让人不感到孤独。

——————————————

小明是个画家

——————————————

艹，本兮竟然死了


看来不成为文综高手、博览群书，娱乐圈是混不下去的

混乱的世界只需要清晰的头脑

——————————————

不能好了，可能

——————————————

无聊的生活

——————————————

one by one

concurrent  and right time doing right thing

——————————————

当你想做某件事，千万不要告诉别人，只管去做。

——————————————

不看老毛私人医生回忆录，就不知道中国国情

——————————————

不要说它不值钱

只要还需要人去做，它就值钱。

——————————————

1、 面对法医的鉴定报告，王警官陷入沉默，思考了很久才开口对法医说：“你写的啥几把字？”

2、 审讯室里，犯罪嫌疑人赵某对自己的罪行供认不讳。而经验丰富的王警官却觉得还没吓唬犯罪嫌疑人，他自己就招了，一定事有蹊跷。于是，他瞥了一眼赵某，突然大吼一声：“橙汁儿！！”

3、 看完尸检报告，王警官表情凝重，深深吸了一口烟说道：“看来想要找到真凶不是 一件容易的事…因为死者已经隆胸有二十多年了…”

4、 王警官像往常一样加班到深夜独自回家，半路被突然窜出来的一群人团团围住，并威胁他以后不要再掺手眼前这起由他负责的凶杀案。 而经验丰富的王警官对这种情况早就习以为常，他沉着冷静，呵呵一笑，还是毅然决然地拒绝了同事们的请求。

5、 面对着眼前这个复杂的凶杀案卷宗，经验丰富的王警官深深吸了几口烟，突然间眉 头紧锁，然后熟练地用眉头把烟头夹灭。

6、 经过一整晚的审讯，经验丰富的王警官收获颇丰，终于从犯罪嫌疑人郝某的口中得之，他有三颗蛀牙和一处口腔溃疡。

7、 王警官来到犯罪嫌疑人家中的时候已经是人去楼空。但经验丰富的他没有立即出去追赶，而是走到床边，摸了摸被子，发现被子还是热的。这才会心一笑，放心地钻进被窝，愉快的睡了起来。

8、 虽然为了尽早破获这起棘手的案件，刑警大队已经几天几夜没有合眼，但还是没有什么进展。这时，幸好经验丰富的王警官及时出马，用他精彩的推理，使得大家睡了一个好觉。

9、 王警官与犯罪嫌疑人进行了长达两个多小时的周旋，最终，二人都被管理员赶下旋转木马。

10、案发现场惨不忍睹，杀人凶手的手法极其残暴。经验不丰富的实习警员小李已经是双腿发软，因为第一次前来执行任务的他万万没有想到，还要负责背着吓晕的王警官。

11、经验丰富的王警官咬了一口粽子，便立刻发觉味道不对！办案多年的他深知自己已与黑道势力结下怨恨，所以第一反应就是大事不妙，一定是自家的粽子会被人做了手脚。但他沉着冷静，仔细揣摩粽子味道的异常，终于发现其中的蹊跷，原来是吃的太着急忘了剥粽子叶。

12、刑警大队的会议上，经验丰富的王警官对案件分析十分详尽，配合他自己精心制作的PPT，分别从犯罪嫌疑人的作案手法、作案动机以及犯罪现场的盘查取证与法医鉴定报告等多个方面，阐述了自己为什么破不了这个案子。

13、起初，新来的年轻警员都不太理解，王警官去犯罪现场执行任务前为何总是会让助手帮他带上两个崭新的塑料袋。而经过几次合作以后才终于发现其中的端倪，原来是因为王警官晕车。

14、为了能尽早得知凶手是谁，经验丰富的王警官加班后回到回家，都没顾得上休息一会儿，就又独自把自己关在书房里，迫不及待地看完了后半集的剧场版柯南。

15、王警官第一时间赶到犯罪现场，但是经过仔细盘查，并没见到报案电话中群众所说的尸体。莫非是有人毁尸灭迹？王警官沉思片刻，便会心一笑，对同行的警员下令说：“给我追！尸体一定跑不远！”

16、面对复杂的卷宗，经验丰富的王警官表情凝重，一连抽了几包烟，不时咳嗽。经验不丰富的实习警员小李看不过去前去劝阻。王警官解释道：“放心我没事，多年破案的老毛病…不抽烟就没有灵感…” 小李听后说：“虽然我经验没您丰富，但如果您真把我当朋友，就听我一句劝，别抽我的烟了行不？”

17、经过了与犯罪嫌疑人长达一个晚上的审问，王警官说出了刑警大队所有的秘密。

18、王警官与他饲养多年的警犬大壮配合十分默契，仅用半个小时不到，就把食堂的酱肘子吃的连骨头都不剩。

19、王警官带领队员闯入犯罪嫌疑人家中，经验丰富的他直奔卧室，摸了摸被子对大说：“被窝还是热的！罪犯一定还没跑远！” 话音刚落，就吓得罪犯钻出了窝。

20、面对歹徒手中的水果刀，经验丰富的王警官早有准备，从容地拿出了水果。

21、面对法医的鉴定报告，王警官会心一笑：呵呵，果然和自己之前料想的一样，还是看不懂。

22、正当案件一筹莫展之时，法医的鉴定报告及时送到。看过以后，经验丰富的王警官顿时觉得这起难解的凶杀案变得简单了不少，因为他认为，破案可起码比他妈的认出法医的字容易多了。

23、王警官的儿子问他，老师让用成语坐井观天造句老师让用成语坐井观天造句，怎么造？他 笑答：“这还不简单么？爸爸做警官天天都很开心。

24、闻听歹徒穷凶极恶，王警官坚持要带枪行动。但同行警员纷纷劝说他这样做容易暴露踪，最终王警官也只好作罢，不得不把祖传的红缨枪留办公室里。

25、王警官接到一个非常棘手的案子，已经用光了三瓶护手霜。

26、早晨，王警官来到刑警大队，发现门口墙上有人用红油漆写着：“王警官，我要弄你！”而他深知自己办案多年，早与黑道势力结怨，便习以为常。也拿着油漆在墙上写上了“你个大傻逼！”五个字。于是，墙上变成了：“王警官，你个大傻逼我要弄死你！”

27、经验丰富的王警官与经验不丰富的实习警员小李，虽然合作时间不长，但二人的 配合已经相当默契。就拿最近的这起凶杀案来说，他们仅用了不到两天时间，就同时选择了放弃。

28、为了能尽快查出这起凶杀案的真凶，经验丰富的王警官考虑再三，决定赶紧退出不再掺手此案。

29、经验丰富的王警官观察一番后说道：“门和窗都是从里面反锁的，而死者头破血流伤痕累累，显然不是自杀，所以，这无疑是一桩典型的密室杀人案！” 同行的几名年轻警员听完他的分析也是目瞪口呆，最后忍不住将他带离了车祸现场。

30、经验丰富的王警官在执行任务时不幸腿部中枪。而当穷凶极恶的歹徒被捕时，他自己多年的职业素养告诉他，不要去记恨歹徒，谁让自己枪法不准打腿上了呢？

31、向来配合默契的经验丰富的王警官与经验不丰富的实习警员小李却因观点不同发起了争执。王警官认为：死者虽然处于密闭环境，但身上缠有绷带，显然不是常规的密室杀人案，应该是受重伤之后又被人放置于密室之中。而小李却认为，王警官不应该在单位组织去埃及金字塔旅游时说这些有的没的。

32、虽然罪犯显然是对案发现场进行过处理，但经过一番仔细勘察，经验丰富的王警官还是从一些蛛丝马迹上判断出，自己又去错了案发现场。

33、火锅店杀人案现场，经验不丰富的实习警员小李在死者身上发现蒜泥的痕迹，他立即通知经验丰富的王警官，但王警官并没在意。小李深知北方火锅店吃蒜泥小料的人并不多，所以再次重申：“我说！蒜泥痕…”王警官一愣！似乎想到了什么，接道：“善…善用无辜的眼神，谎话说了两句你就当真？”

34、我市刑警大队有两人离奇失踪，机智的王警官将单位改名为“刑警一阝”企图瞒天过海，令人佩服。

35、王警官经过对凶案现场的盘查后说：“你们有没有发现，这个案子与两个月前朝阳区ktv包厢密室杀人案和一周前东城区电子厂跳楼案以及三天前的海淀区出租房碎尸案有个惊人的共同点？” 年轻警员恍然大悟：“您的意思是说这是一个连环杀人案？” 王警官说：“不是，我的意思是说我都破不了。”

——————————————

我是神

——————————————

去繁从简，是任何进步运动所必须包含的东西。

——————————————

人不乐意我，我不乐意人。

——————————————

根据某英语大神的思想


事情做成前不要大肆宣扬，那样会破环事情完成时的成就感。


就我看来，提前宣扬要做的事就是提前预支快乐。

——————————————

按照传统理论

早上是一个人意志力最好的时候

——————————————

刚刚无意间看了大鹏的回忆录

发现事无巨细，若回忆录不是假的，就是他有超强的记忆力

这样看来，想成功还是得靠脑力

——————————————

分享了#ASMR の 老司机专场#的节目《【百香果花姐姐ASMR】深耳快口的声音，舌头轻弹，分层》: http://163.fm/DAkTfMUB
 (来自@网易云音乐)

——————————————

听了几个小时的我一定很孤独

——————————————

分享Alan Walker的单曲《Alone (Restrung)》: http://music.163.com/song/458439871/?userid=280429778 (来自@网易云音乐)

——————————————

真实的我，早已死去

——————————————

迷者的天堂

——————————————

这是患者的世界

——————————————

我是孤独的使者

——————————————

你们会不会迷失自我

——————————————

分享Young Rising Sons的单曲《Turnin'》: http://music.163.com/song/28859948/?userid=280429778 (来自@网易云音乐)

——————————————

现代营销应该是这样的：


某人卖艺(淫)、耍帅等等，在公众号或博客上积累上万人气。

然后发广告、引流到淘宝等网商平台。

——————————————

现在想起来，以前高中三年都是被各种东西误了

始终没找到重点



就像人去做事，有人一击致胜，以小力成大事。
而另一些人，吃力不讨好，有力不知往哪儿使。

一方面，是自身视野、学识所限。
另一方面，又是身边人视野、学识所限。

可打铁还需自身热，自身不优秀，也不能有优秀的朋友。

最后只能说，你努力得太晚或先代人太懒。

——————————————

有诗云，爱学习和爱萝莉并不矛盾。

——————————————

时间就像海绵里的水，不学习还真不知道做什么了。

——————————————

成人的世界不好玩，一个几乎残废的脑袋还要维持生计。

——————————————

在短时间内（几天或几星期），人总会深深懊悔自己做了错误的选择，做了不该做的事。

可是经过长时间之后（几年），人反而会比较后悔自己“错失良机”，后悔当初怎么没有做自己该做或想做的事。

——————————————

上帝不会亏待那些为事业而努力的人。

——————————————

十六年前，所有人都认为马云是骗子。

——————————————

成功并不在于这一次机会，阿里巴巴的创始人马云和新东方的创始人俞敏洪都曾经历过两次落榜。马云第一次高考时的数学成绩是1分，俞敏洪 第一次高考时的英语成绩是33分。他们都来自教育条件并不好的地区，他们都历经人生的坎坷，但他们都靠不变的信念及不懈的努力实现了自己的目标……高考只是人生中一个小小的门槛，迈过去之前，不妨让心灵先休息一下，放下压力，也许会考得更好。

第一次高考——数学分：1分

从小学开始，各门功课中最让马云感到头疼的，非数学莫属。那可不是一般的头疼，简直糟糕得一塌糊涂。初中毕业那年，颇有自知之明的他想考个退而求其次的二流高中。结果，连考两次都名落孙山，最大的原因就是数学太差。明知如此，马云却非常阿Q地在报考志愿表上填了让自己 无比自豪的四个大字：北京大学。几个月后，在父母的期望、老师的怀疑下，马云第一次走进了考场，那是1982年。结果，那一年他的数学考1 分。这个成绩，说是全国倒数第一未免太过武断，但在整个浙江省是“榜下有名”的。

落榜后的马云，垂头丧气，他觉得自己根本不是上大学的料，也没那个好命，便准备去做个临时工以贴补家用。在一位表弟的引领下，他先去西湖边一家宾馆应聘，想做个端盘子、洗碗的服务生。结果，陪他一块去的表弟被顺利录用了，而他自己却遭无情拒绝。理由很简单：表弟又高又帅，马云又矮又瘦。马云无语，只能暗叹：长得不好，也是我的错。无奈之下，马云只好去寻找那些不要求长相好看，只要求有力气就行的活儿干。通过父亲的关系，他为一些杂志社打零工。于是，在那炎炎烈日之下，在那狂风暴雨之中，杭州城里又多一个18岁的打工少年。

第二次高考——数学分：19分

有一天，在给一家文化单位运书时，他蹬着三轮车来到了数十里之外的金华。在金华火车站，他捡到一本让自己从此之后爱不释手的书——路遥写的《人生》。《人生》中的主人公高加林，是一个很有才华的知识青年，他对理想有着执著的追求，但在他追求理想的过程中，往往在他向理想靠近一步的时候，定会有一种东西横在他眼前，使他得不到真正施展才华的机会，甚至又不得不面对重新跌落到原点的局面……

渐渐地，马云明白了一个深刻的人生哲理：人生之路，不仅是漫长的，更是充满坎坷、曲折的，若要有所成就，必将经历一番磨炼。读完这部作品，经历一番灵魂深处“闹革命”般的反思之后，马云开始下定决心：再战高考！

于是，在他19岁那年，信心十足的马云终于再次走进高考的考场。那一次，他的数学考了19分。拿到成绩单以后，父母这回再也不对这个“不争 气的孩子”抱任何希望了，他们无奈地摇摇头，“没治了，没一点希望了”。这一回，父母都劝他 ：“你就彻底死了这条心，安安稳稳做个临时工 ，学点手艺吧”。

第三次高考——数学分：79分

然而，马云却不 甘心，连续两次高考失利，反 而让他越战越勇。由于无法说服父母让他继续复读，马云只得一边打工，一边复习。于是，为了工作学习两不误，马云白天打工，晚上念夜校。为了找一个好的学习环境，也为了鼓励自己一下，每到星期日，他就早早起床，赶到离家有一个多小时路程的浙江大学图书馆去复习。

20岁那年，马云准备参加第三次高考。在走进考场前的一天，一位姓余的数学老师对他说：“马 云，你的数学真是一塌糊涂，如果你能考及格，我的‘余’倒着写！”

考数学的那天早上，马云一直在背10个基本的数学公式。考试时，马云就用这10个公式一个一个套。从考场出来，马云和同学对数学题的答案后，很自信地说：“这次肯定能及格了！”成绩单出来后，他的数学考了79分(当时数学一科满分是120分)。这一次，他终于上了大学。

对马云而言，人生路上的三次高考，已成为他生命旅程中最宝贵的财富。

——————————————

所有有意义的脑力活动，都是建立在头脑清醒的基础上的。

如果现在头脑不清楚，还是算了吧！

还是先睡吧，弥补一下这几天我憔悴的心神。

——————————————

Fuck!

——————————————

Fuck all of you who smarter than me.

——————————————

Fuck this competition

——————————————

其实我想说， Fuck this GaoKao

——————————————

就像考纲要求4000个词汇


实际要7000多的词汇才能应付高考


给你的是一点点，但希望你有更多，不管从何而来，解了这道题，你就是英雄。

——————————————

其实做了这么多天题，还是有发现的


教科书和试卷没多大关系，就算有也是故意为之的零星半点。

——————————————

要分类，心理学包括心声放这里

——————————————

大家交给学校同样的钱养老师，但收获却不一样。

有的同学学得好，有的学得差。

那些学得好的实际上是抢取了你交那份钱，转移到他身上。

这本就是一场博弈，大家约定共同分担教育支出，然后谁受益多少就不管了。

你要做的就是尽量吸收并转化老师传递给你的东西，把它变成一种实际能力。(解题也是一种能力)


把这个原理推理到社会，大家交的入场费都一样，有人穷，有人富，不过都是从别人那儿夺取罢了，总量是不变的。

那为什么有人生下来就富，有的生来就穷？

我只能说你没有早几百年入场，不然你就知道为什么了。

另外，别人忙着学习，你忙着打游戏，你志不在此也有可能。

——————————————

食饱饭足，你会想堕落；每天一块压缩饼干，你反而想上进。

正常起宿，你活得浑浑噩噩；昼夜颠倒，你倒看得更清楚。

怪，怪。

——————————————

不懂

——————————————

不合群

——————————————

Not everyone speaks English well in this world.

——————————————

http://c.open.163.com/mob/video.htm?plid=MCA74D6UO&mid=MCC0I19F2&lan=en#share-mob&lan=en#share-mob

——————————————

许多人都把对手视为心腹大患，恨不得除之而后快，却不知一个强劲的对手会让你时刻都有危机感，会激发你更加旺盛的精神和斗志。因为对手的存在，你才会永远做一只威风凛凛的“美洲虎”。

——————————————

世界上的许多事情并不是因为难我们不敢做，而是因为我们不敢做事情才难的。

人的心理状态是很复杂的，心理暗示的影响力是很大的。它既可以摧毁一个人，也可以拯救一个人，就看人们是抱着消极的心态还是抱着积极的心态。

“这恐怕不行吧？”“我哪有那么厉害？”……诸如此类的不自信的语言经常传入我们耳中。从心理学的角度来说，其实这是一种自我暗示，悄悄提醒自己不能胜任，不能完成。久而久之，你也就真的不行了。

消极的心理暗示是人们前进道路上的巨大障碍，也许你还没有意识到它的严重性，但这确实是事实。

胸怀信念，并坚信自己可以达到目标的人，其内心会因此而形成一股为成功而奋斗的无穷动力。不管遇到什么困难，他们既不退缩也不恐惧。即使看到了自己和别人的差距也不会长久的不安和焦躁，差距反倒成为了他们自己超越自己的目标。

积极的心理暗示也从一个新的角度告诉人们，成功与“劳其筋骨，饿其体肤”“三更灯火五更鸡”“头悬梁，锥刺股”没有必然的联系。只要你对某一事情感兴趣，并长久地坚持下去就会成功，因为上帝赋予你的时间和智慧足够你圆满地完成大多数事情。

——————————————

对大多数人来说，做事情的时候都容易陷入两个极端：

一个是驱动力过弱，拖拖拉拉永远无法彻底地完成一件事情，总是在做这件事情的同时还去做另一件事情；另一个是过分强迫，非得一口气把事情做完不可。一日不把事情完结，一日便不得解脱，甚至偏执地将其他事物置身事外。

这两种人都需要在心理上调整他们的完成驱动力。

如果你经常走到过弱的一端，那么你一定是一个做事容易半途而废的人。心理医生为有这样心理的人提出了一个简单的解决方法：“如果你精力集中的时间限度是10分钟，而工作需要1小时才能做完，那么，当精力集中的10分钟一过，脑筋开始散漫时，你就要停止工作，用3分钟时间活动筋骨，比如跳几下，或者去倒一杯水，等等；活动过后，再把另一个10分钟花在工作上。”

如果你经常走到过强的一端， 那么你很有可能是一个十足的工作狂。过分强烈的“完成内驱力”使你每天都处在忙于完成任务的紧张劳碌之中，它很有可能正在渐渐主宰你的消遣活动，导致你的生活没有规律、太狭窄、太单调。你不妨试着缓和一下，在做事情的同时也享受一下人生乐趣。比如下班跟同事一起去看看电影，周末和朋友去郊外游玩等。

此外，一个非把每件事都做完不可的人为了避免半途而废，很可能会把自己的精力浪费在一件“得不偿失”，不值得继续做下去的事情上，或者把自己封死在一份没有前途的工作上。所以，对于某些事情，我们真的不应该害怕半途而废。正所谓拿得起，也要放得下。放下不必要的心理抱负，从而使自己步入柳暗花明的新天地，做出另一种有意义的选择，我们又有什么可惆怅或遗憾的呢？

——————————————

人生最大的效率在于：真正有勇气来改变可以改变的事情，有度量接受不可改变的事情，有智慧来分辨两者的不同。

——————————————

改变先从睡觉开始

——————————————

停止追求不能拥有的东西


脚踏实地

——————————————

有时候，人会情不自禁的发呆


希望找一个发呆也会有价值的方法

或者想找一件事做出成绩给别人看




但却一直没预料到，任何一件事，专注，持久，就能取得成绩

——————————————

今天去超市，一熊孩纸问我要钱，我一看就知道是坑人的，就不给。熊孩纸：好，那你等着。我心想大白天你一小逼孩能怎样？去叫人？我就盯着他看，熊孩纸快走几步到一穿裙子的妹纸那二话不说撩起来回头对我喊“二叔，白色的”！卧槽尼玛 😡

——————————————

硅谷的程序员 No.1

——————————————

果然程序员也有高低之分

你看某垃圾群内那些程序员有一句说的是有涵养的话吗？

——————————————

哈哈，明天开始背考研词汇了

——————————————

妈B，我以后也要朝这个方向发展

——————————————

太可恶了，你

——————————————

你又知道了

——————————————

这位兄台，上过大学吗

——————————————

屌丝的人物特性



没看过首相

——————————————

不管是周星驰、黄渤还是白客，都是饰演小人物

脱离了小人物、大众，喜剧不会成功

——————————————

如果你这样想说明你是个实在人

两轮电动车足够用了

——————————————

汽车就像大人的玩具。

有车的边玩玩具边向没玩具的小伙伴炫耀

没车的看见别人的玩具羡慕

实际上玩玩具和事业成功没太大关系

再说了，有钱人家的小孩的玩具比你的高档，你有玩具又怎样？

——————————————

回顾十几年的成长历程，我发现我与其他同龄人最大的不同是喜欢观察，万事万物，即使是不说一句话我也想看看那些东西，就觉得看着爽，不管是人还是动物、机械还是植物。那一幕幕的场景配合着人物就像一出戏，而我，只是个看客。

——————————————

年龄一大，失去了精气神，万古皆空。

——————————————

他接着说起自己创办亚马逊的经历。那年他30岁，结婚一年，见到网络以每年2300%的增长速度在迅速发展。他准备辞掉工作，去做一件疯狂的事。贝佐斯也将这个想法告诉了自己的上司，他要在网络上卖书。但他不确定是否会成功，因为很多创业公司都失败了。

那位上司倾听了很久，最后说道：“那听起来是一个很棒的想法。但是，对那些没有一份好工作的人来说，这个想法更棒。”




怪不得上10年搞网络的人容易赚
几千倍增长速度

——————————————

我女神竟然有tumblr

——————————————

Check it out
http://lindaliukas.tumblr.com

——————————————

唉，编程好累

——————————————

http://blog.topspeedsnail.com/archives/10921

——————————————

长这么大第一次看见这个

新年新气象，希望2017能遇见一个

——————————————

http://mobile.rr.tv/pages/videoShare?id=90756&share=11458302

——————————————

祝你鸡年小吉吧！

——————————————

有一次，当你回忆到你为什么没做到，你会发现，你根本就没做。

——————————————

Be a life-long learner 的一个最大好处是，你永远不用担心因知识缺乏而无能为力。

——————————————

18岁，距上次遗精已过去4年

既兴奋又沮丧，兴奋的是，春梦确实很爽，沮丧的是，早射。

唉，才放进去！！

——————————————

http://blog.sina.cn/dpool/blog/s/blog_492811e70102vxeu.html?vt=4

这人和我的思想差不多

——————————————

SB才做作业，高手只做任务。

——————————————

我们学过质量守恒定律，如果老师无法考满分，那么他传出的“能量”必定不如标准答案那样纯正。

事实是他们经常找不到重点，大水漫灌、胡乱填鸭。

 ——————————————

听老师讲，不管懂不懂，都是你失去。懂，失去了独立思考能力和思维锻炼机会；不懂，浪费时间和青春，做无用功。

——————————————

对于老师，他们只知道为你低效的填充知识，却不为你指一条切实可行的提升自己的明路。

他们拿着公务员薪水却不好好服务，有时甚至侮辱、谩骂学生。

——————————————

当我们回顾诸如贝多芬、爱因斯坦、爱迪生、毛泽东等伟人的成名史，发现他们无一不是靠着自学、靠着勤奋获得超于常人的能力。

而学校，只是一个点缀，为他们的学习提供一个相对安适、相对与浮华社会隔离的环境。如果学校没有这个功能，那它也就没有存在的价值了。

——————————————

说得通俗一点，就是你妈没有告诉你，世界上所有伟人都是自学成才，从一次工业革命到三次科技革命，从未改变。

——————————————

事实上，我在月光博客没看到这个

——————————————

爱因斯坦曾经说过：宇宙最不可理解之处是它是可理解的。科学规律的简洁普适的令人感叹，万物运转竟满足人类创造的数学关系，本身就是一件十分不可思议的事情。然而更不可思议的是，人类智能本身，却难以被数学所解释——即使它可以解释万物。
阿狗的诞生终于为我们解开了这个悖论，数学工具终于开始对人类智慧本身拥有了解释力。人类智能走下神坛也许令人伤感，但改造世界首先便需要理解世界。从这个角度而言，当代棋手们仍是幸运的，有生之年，也许能目睹终极之美，见证围棋之神的诞生。

月光博客：
世界围棋界这两天都在谈论一个叫做“Master”的神秘账号。
几天来，它在弈城、野狐等围棋对战平台上轮番挑战各大围棋高手，目前已取得不可思议的47连胜。
其战胜的对手，不乏柯洁、古力、朴廷桓、陈耀烨、芈昱廷、唐韦星、范廷钰这样的顶级职业棋手。
人民以雷鸣般的呼声询问：“那人是谁？”

（某韩国棋迷）：
2016年12月是人类最高手被没有 BUG 的围棋人工智能全面压制的里程碑式的悲哀的月份。
现代围棋棋院诞生九十二年、职业围棋头衔战开赛七十七年后，人类的智能在这一月，被技术的发展所摧毁了。

——————————————

我要去北大！

——————————————

分享Phildel的单曲《Dragonfly Keeper》: http://163.fm/BKqrphtJ
 (来自@网易云音乐)

——————————————

这些人还真指望过节的祝福群发提高友谊。

It's useless, truly speaking.

——————————————

我答应了老师明年英语考130

我很清楚不这么做很难考上一本

但那需要付出以前用在英语身上的一半工夫， Actually, 2个月做一年的事

——————————————

我坚信
I Firmly Believe


我坚信，我会成功。
I firmly believe, I will succeed.

我坚信，我会有为。
I firmly believe, I will make it.

我坚信，任何磨难都不能使我退却。
I strongly believe, any hardships can't make me stop.


我坚信，所有的付出将在最后得到回报。
I firmly believe, all the efforts will get paid in the end.

我坚信，成功者只是少数。
I firmly believe, success belongs to few people.

我坚信，世间有永恒的真理。
I truly believe, the world has its own rules.


我坚信，我坚信。
I firmly believe, I believe.

——————————————

宅男的日常

https://touko.moe/blog/whispers-my-way-to-developer

——————————————

A  B  C  D
爱逼射弟

D  A  C B
弟爱射逼

——————————————

这个世界我最想感谢的，一曰我的父母，二是李阳和 Programming, 三是各位朋友。


Parents gave me life and brought me up. LiYang and Programming taught me what is persistence. You gave me strength to face failure.

——————————————

男人两大爱好：
1、拉良家妇女下水；
2、劝风尘女子从良。

女人两大爱好：
1、和穷人谈钱；
2、和富人谈感情。

——————————————

学校好烦，快递都不让人领

简直有病

就好像不用快递，学校就高大上了一样

整个一SB

——————————————

Check it out
http://bengchacha.tumblr.com/image/152068736244

——————————————

Check it out
http://illustrated-interracial.tumblr.com

——————————————

可以分，那是标准问题。引入人妖，这个问题就难了。）

定义与标准涉及社会语言、社会思想等契约。



导论4.世界是一个动态的过程

世界上的事物本质上是动态的，是一个过程。

人们认识这些过程时，总要将它拆分开，认识越深，拆分越细。

拆分的过程，本质上是对比的过程。一个过程被拆分为很多方面，每个方面都相对于其它方面而存在。（拆分比较那一瞬间是静止的）

这一过程的每个方面或环节都由我们自己去定义，这个环节相对于上面、下面环节是怎样的。

对于哪个环节最重要，随个人所好。反正哪个环节没做好，过程就会出问题或不再是原过程。

如地球绕日公转图，为了更好理解，我们把不断公转的地球分为春夏秋冬四个环节(状态)。

又如“鸡生蛋，蛋生鸡”这个过程，本是个循环，我们为了认识它，把它拆分成了两个方面—鸡与蛋。

这容易造成事物只有一个片面的假象。事实上，蛋相对于鸡为蛋，鸡相对于蛋为鸡。随便取走哪一个方面或环节这个过程就不存在了。


导论5.实践是检验真理的唯一标准

无论生物的认知及产生的思想、理论多么不同，最终都要服务于行动，使行动做出符合生物需要的结果。



哲学总例:

假设一个物体发出噪音，但我不想听。

把耳朵捂上、或切断听觉神经，就听不见噪音了。(这是唯心主义)

把这个物体破坏掉，让它发不出噪音，从源头去噪。(这是唯物主义)

这两种做法都是在同一个过程的某个方面或环节做出的行动。(过程指的是从噪音产生到传到大脑这个过程)

生物认知相对，上述例子的唯物、唯心区别不是绝对的，它取决于具体的对比概念定义，即对比的方式、主体与对象。

我这里是用汉语契约说的这个问题。评判它涉及到某些团体的利益。故它无需评论。



总结:哲学总是一定时代的产物，基于当时的社会发展状况。它在不断发展。我们能做的也只是站在前人的肩膀，应用当代知识去考核、研究与发展。



特辑:数学、推理与逻辑

逻辑推理有两个方面，归纳(特殊推普遍)和演绎(普遍推特殊)

归纳是我们在一系列外部世界给我们带来的感觉中寻找规律的一个过程。

演绎是我们用我们找到的规律来预测接下来所发生事件的一个过程。

归纳和演绎就像一个硬币的正反面，是我们认识世界的一种方法。



特辑:解析经济、社会

货币是商品交换发展到一定阶段的产物。

它的产生过程为:

偶然的物物交换⇒扩大的物物交换⇒一般等价物⇒一般等价物固定在金银上⇒货币产生

货币的本质是一般等价物，充当需求交换的媒介。（但并不是说货币可以交换一切需求）

需求增加，供给减少，商品价值提升。

需求减少，供给增加，商品价值降低。

概括为“物以稀为贵，货多不值钱”。

社会发展的实质是需求交换的不断加快（体现在货币上就是交易数额不断增加、交易速度不断加快）。

世界运动发展总规律是物质或能量的流动和交换不断加快(竞争是需求作用的具体表现，它能促进世界发展，所以不必排斥)。

所有的生物历史无非是在适应需求交换的需要。

像国家这种集中利益体系，如果不能适应社会多数人需求交换的需要，就会被改变（如社会制度阻碍经济发展导致的革命）。

终极猜想:由宇宙大爆炸可知，我们正处在一个烟花爆炸的过程。微缩到地球，需求就像烟花爆炸后的小火星，迫不及待想燃尽。殊不知，结果是灰飞烟灭。



特辑:我对文学、影视、音乐等作品的看法

在欣赏这些时，我们总要将自己与其中某个角色挂钩。

那个角色获利，我们跟着高兴。

那个角色失利，我们跟着伤心。

仿佛那个角色就代表自己一样。

如果不这样，我们将无法体会这些作品。

又或者，这些作品表现出对观赏者极大的好处（如爱意、使适应伤感等观赏者需要的东西），那这种作品我们都爱。

——————————————

《物质与思想》

著者:胡英杰
传播者:请附上您的大名～^_^
版权所有：每一个创造语言的人

前言:

请先欣赏一部电影——《超验骇客》

不管什么语言，什么形式，不过让人明白那道理罢了，不必纠结于表面那些东西，着重去理解、去感悟才是真的。我希望本书能让人工智能得以实现。

我写书，就是用主观方式阐述客观道理。研究中，不拘束于学科分别，只要是实践得出的证据，都可以使用。

为了让自己不受束缚的研究，我时常将自己处于人之外，即不把自己当人看。

你第一次看本书会恼怒，可以理解，因为这不符合你平时所接受的教育。但是，我想说，因为悟到这些，我恼怒了很久。

由于本书由文字所成，必然有一些词义脱离其原本含义，从而包含我的一些认识。读者可以将难理解的词句告诉我，以便更改。

如觉得本书有错误之处，请以书面形式，附上对应证明一并发给我。

QQ：1576570260

QQ群号：208408255

博客地址（每月更新，不跟则无）：http://yingshaoxo.blog.tianya.cn




序

我生于20世纪末，时值国泰民安之季，从小被社会主义所熏陶。

随着时间流逝，少年终究会变成大人，困惑与忧虑如期而至…

随着近百年自然科学的发展，蒙昧与无知逐渐被驱散，人们开始认识到世界真正的样子。

但是，这历史进程在我看来太慢，我迫不及待想看到这世界最后会变成怎样。

于是我踏上一条寻找真理的不归路……

结果发现，人类社会虽然发展到了较高层次，那些最原始、最基本的东西依然存在于人世。


总括:

能量守恒并转化定律


关于生物性:

环境引导需求，需求产生行动，行动改变环境。

需求是生物间的唯一联系。

个人、国家等的利益等于个人、国家等的需求。

从远古时期捕食与被捕食的需求关系，发展到现代人类的合作与伙伴关系。

————————————————

关于认知:

生物的认知=事物差异信息=极端认知1+…+极端认知2

对比事物→极端认知→矛盾（或平衡）感

生物的认知在不断细化、扩大与加深。

详解:

生物的认知是相对的，在对两事物的对比过程中会产生两个极端认知，这将给生物带来矛盾（或平衡）感。

在认知过程中，参照物改变，得到的对比差异信息就不同。

大圆和小圆，大圆以小圆为参照物感觉大，小圆以大圆为参照物感觉小。将大、小圆合起来看，大与小就是我们对这两个圆的极端认识，也叫差异信息。

大与小在我们看来是“矛盾”的。大与小就像矛与盾一样给了我们一种既矛盾又平衡的感觉——即相互对立又相互统一。

从辨别食物到使用语言文字，生物的认知渐趋复杂。

————————————————

关于人工智能:

纯物理解释人脑→人工智能就能实现

————————————————

关于智能生命:

智能生命=能认知+有需求+会行动的东西。

————————————————




第一章，世界观


第一节，我们所处的空间(详情请看纪录片:跟随斯蒂芬·霍金进入宇宙)

我们在地球，地球在太阳系，太阳系又在银河系，而所有的这一切，都属于宇宙。

宇宙通过宇宙大爆炸形成。恒星的产生与爆炸创造出了组成我们身边物质的所有元素(如:氖、氧、铁、金、铂、铅等)。

大爆炸后的三亿年后，早期的恒星开始组成星系。每个星系中心有个超大质量黑洞，该星系内的恒星围绕这个黑洞旋转。

我们的星系---银河系，是其中一个比较老的星系，它的直径大约六万亿英里。

太阳系又属于银河系，太阳系距离银河系的中心约26000光年。

地球位于太阳系内，并且和水星、金星、地球、火星、木星、土星、天王星和海王星一起绕太阳公转。

月球绕地球转动，同时地球还要自转。

宇宙之大，不做探究，一般来说，我们在地球。


第二节， 生命的起源(详情请看纪录片:生命起源)

我们是谁？不言而喻，我们是人类。

那人类是什么？人类是一种生物。

这种生物是怎样产生的？产生于地球自身的演化过程，由C、H、O、N等元素逐步演变而成。

最初，小分子机缘巧合下随机的互相碰撞，然后，一种结合形式使之能够自我复制，就开始了缓慢的进化、变革过程，进而产生了世界生物的多种多样。

生命好像理所当然会出现，只要有适当的条件和足够的时间。

在生物之间存在着生存斗争，适应者生存下来，不适者则被淘汰，这叫做自然选择。生物正是通过遗传、变异和自然选择，从低级到高级，从简单到复杂，种类由少到多地进化着、发展着。


第三节，人类发展史(详情请看纪录片:人类，我们的故事)

历史。


第四节，知识:对事物差异的认识

人类的知识多以语言文字的形式记录。

各种语言的结构、内容大同小异，我们只需将其中相同的部分提取出来，并且以人类进化顺序为依托进行研究，就可以较准确的解释知识与语言、认知等之间的关系。

语言中每个较高级词语（的含义）都需用一系列较低级词语（的含义）来解释。这样较高级词语就包含了一系列较低级词语的含义，却只需少量字来表示。

最底层词语含义直接由实物差异(五感)信息组成。词语高级化，虽方便了使用，但使其灵活度降低，且易不准确。

具体发展过程:

首先，每个单词都是一个差异信息。随着人们交流时单词数增加，就成了句子（这时为口头语言）。

然后人们从结绳记事开始，渐渐出现了图案，接着由繁到简，文字就产生了（这时为文字语言）。

不难理解，最初的象形图案，就包含了它与其它事物的差异信息（画个人，就是一个人的意思）。当图案简化到字，那字就代表了那副图案的意思。

“一棵”+“大”+“树”=“一棵大树”，对某概念或定义加字是为了使其表达的差异信息更准确。

由此可知一句话包含多个差异信息，每个差异信息都有对应的参照物（或对比物）。如果改变其中某个参照物，这句话含义就变了。如白马非马这个诡辩，参照物分别是所有非马物和不同颜色之马。

事物的规律（如定理公式），是人们通过对事物发展情况的观察而概括产生的结论。

这种结论的正确性，取决于人们使用它能否成功预测结果、能否达到自身的目的。这种成功的实现越多，这种结论对人们来说越正确。（比如1+1=2，怎么证明？它是公理）

概括总结规律从根本上符合人们简化认知、方便生活的进化模式。

我们的知识像一个圆，圆内的知识越多，圆外的未知就越多。




第二章，人生观


第一节，从“性”开始

人类需要繁衍后代，在漫长的进化中，产生了性欲，促使人们去交配。

在男女的性爱中，男性将精子射入女性阴道，女性排出卵子使其与精子结合形成受精卵。

受精卵回流到女性子宫，受精卵就在那里着床生长。

受精卵在女性子宫不断分裂、生长，直到变成成熟的婴儿。

然后，通过剖腹或分娩，婴儿出生。


第二节，第一次认识世界

我就是那个婴儿，我的眼感到了光、耳听到了声、鼻闻到了气，一切感觉信息都传入我的大脑。一时我难以接受，于是嚎啕大哭。

我用大脑分析我所处的空间，"对比"这些感觉信息，这个事物相对于那个事物是怎样的。一切事物都被我以对比的形式记下来。

比如我每看到一个人，就会把他与其他人比较，记住他与别人的不同、差异。

经历了漫长的过程，这些差异形成了我对于我所处空间的认识。接着，随着父母的引导，牙牙学语，认识更多事物。

妈妈可能会说:"这是一个苹果"。于是我观察它与周围景物的不同、与记忆中其它事物的不同。然后，将这苹果与其它事物的不同等价到"这是一个苹果"上来。(事实上，就连这句话也与其它声音不同，我记的也是一种差异信息。)

基本上，从出生开始，对比就开始了，一切事物在我脑中都基于对比。


第二节，开始上学







特辑：什么是哲学?

哲学就是用语言解释(或模拟)思想。

具体来说就是用语言文字将人们对世界的认识，对事物的态度、看法等表达出来。

比如马克思主义哲学，就是在那个时代，由于自然科学突飞猛进，而产生的新认识、新看法。

马克思用语言归纳、概括、总结，就形成了他的哲学。

马克思哲学之所以出名，是因为它与政治挂钩，而政治又是人民利益的集中体现。

历史的主线是政治、经济，故整个历史都在体现利益变化。


导论1:唯物与唯心合二为一、整体看待才为真理

物质通过生物的感觉器官被感知，在生物的脑中形成相应的映像，这种映像的基本构成是物质的，如神经元。这是唯物者的证据。（补充:这种观点只看到世界是物质的，却没看到生物是如何认识物质的）

如果有种物质，生物无法通过感觉器官或没有感觉器官去认识它，那么这种物质对生物来说不存在，这是唯心者的证据。（补充:“心外无物”，这里的心指脑，没有感觉器官的信息传入，任物质如何，生物都当它不存在。一个极端例子就是“一个人死了，这个世界对他来说不存在”）

唯物和唯心都只看到了同一过程的某一方面。但这过程是一个整体，不能片面看待。


导论2.辩证法的实质与核心

生物认知相对，在认知时会产生两个极端认知。

这两个极端认知就像矛与盾一样，所以人们又称它为矛盾。

具体体现如逻辑上的“p”与“非p”等。

辩证法的实质是相对论。其中的重点论本质为绝对论（实践后才能知重点）。

故辩证法伪造了一个过程，但它这个过程是仅限于讨论的空话，即对一件事物既不肯定也不否定，不带任何利益立场。(假辩证法当然会带利益立场)

绝对论建立在按某一极端认知去行动能让人获利的基础之上。（比如我说“做吧，这事绝对没错”，那这事肯定对我有好处，你好我也好）



导论3.量变与质变、部分与整体——事物评判的标准

定义一种标准，划分事物发展到什么程度为质变，而没达到这个程度就为量变。（就像做“木块受力”这个物理实验，木块受力，移动为质变，不动为量变）

描述量变与质变的过程更像描述混沌理论。

定义一个整体，其中的组成部分相对于这个整体为部分。（定义人类为一个整体，那么男人和女人就是组成人类这个整体的两部分。因为男女的不同，所以分为两类，至于哪些不同

——————————————

https://github.com/citizenlab/chat-censorship/blob/master/livestream/livestream_keywords_10_15_09_16.csv

——————————————

http://umr.igge.ga/?i=1

——————————————

开免流下AV，也是没谁了😳

——————————————

Get up, and go on.

——————————————

任何困难都只是上天给我的考验

——————————————

Everyone, all is good time.

——————————————

分享Panda Eyes的单曲《Nostalgia 64》: http://163.fm/CfvhjNO
 (来自@网易云音乐)

——————————————

你的曲不激情

——————————————

分享Tobu的单曲《Desert Voices》: http://163.fm/RzdTkH1
 (来自@网易云音乐)

——————————————

人之初，***


***, 我好闲

——————————————

果然他受不了走了

——————————————

你好，神经病😂


一般人应该会生气

——————————————

程序员的尊严，岂容你践踏？！

——————————————

我们为什么不能随便和人上床？


因为上床意味着责任，理智的头脑不允许随便这样做

——————————————

突然明白为什么我长这么丑

洗完澡总是先擦身体再擦脸


螨虫、细菌都跑脸上去了…

——————————————

want to

——————————————

I want be the king of programmers.

——————————————

没人与我说话

没人与我交流



甚至没人叫我做事






这就是成长吧

——————————————

没了团体的人

譬如我

——————————————

某天我突然发现，听自己唱歌也是一种享受

——————————————

nice music

——————————————

What makes you uncomfortable?

Get knowledge?

——————————————

《夕甲甲：孔乙己之 C++ 版》 
作者：水石头stone 
「欧欧匹代码的格局，是和别的编程模式不同的：首先要有一个构造函数；基类里只定义了函数的形式，可以随时通过派生增加不同的实现。那些程序员们，每每学会了继承和多态，便可以接一个项目，——这是十年前的事，现在至少要懂得设计模式，——靠柜台外站着，写些代码换一个鸡蛋灌饼吃；倘若懂一些多线程的知识，便可以在鸡蛋灌饼里加火腿肠，或者里脊了，如果懂得语言的实现原理，那就能做一些底层代码的优化，换一盘炒菜。但这些程序员，多是初级水平，大抵没有这样深入。只有懂得内存模型的，才能接一些底层的项目，打开调试器和剖析器，慢慢的坐着优化代码。 
我从十二岁起，便在村口的 githoverflow 工厂里当学徒，师傅说，我逻辑思维太差，怕学不会静态类型语言，就写些 shell 脚本吧。shell 脚本虽然容易写，但语法容易含混不清的地方也不少。字符串和数组的功能很弱，条件判断的语法也很奇特，有时要对特殊字符手动做两重转义，然后通过。在这种情况下，写脚本也很为难。所以过了几天，师傅又说我干不了这事。幸亏荐头的情面大，辞退不得，便改为专管测试的一种无聊职务了。 
我从此便整天的站在测试机前，专管运行测试脚本。虽然没有什么失职，但总觉得有些单调，有些无聊。师傅是一副凶脸孔，程序员也没有好声气，教人活泼不得；只有夕甲甲到厂里，才可以笑几声，所以至今还记得。 
夕甲甲是站着编程而手动管理内存的唯一的程序员。他用的开发语言语法臃肿；结构杂乱，代码间时常夹些 #ifdef；一堆乱蓬蓬的充当接口的 .h 文件。虽然是手动管理内存，可是经常出现野指针，要么忘了初始化，要么释放后没有设置成 NULL。他写的代码，总是满屏的奇技淫巧，叫人半懂不懂的。因为他姓夕，又总觉得自己的技术天下第一，别人便用『甲乙丙丁』的第一个字，替他取下一个绰号，叫做夕甲甲。夕甲甲一到厂，所有的程序员便都看着他笑，有的叫道，『夕甲甲，你的代码又出新bug了！』他不作答，对柜里说，『来两个鸡蛋灌饼，一杯豆浆。』便把 Thinkpad 摆好。他们又故意的高声嚷道，『你一定又把人家的内存搞泄漏了！』夕甲甲睁大眼睛说，『你怎么这样凭空污人清白……』『什么清白？我前天亲眼见你搞崩了 Windows 的内存，吊着打。』夕甲甲便涨红了脸，额上的青筋条条绽出，争辩道，『内存没释放不能算泄漏……没释放！……程序员的事，能算泄漏么？』接连便是难懂的话，什么『new/delete 配对使用』，什么『谁申请谁释放』之类，引得众人都哄笑起来：厂内外充满了快活的空气。 
听人家背地里谈论，夕甲甲原来也读过 CS 博士，但终于没有去做学术，又不会营生；于是愈过愈穷，弄到将要讨饭了。幸而还会写点代码，便替人家做几个游戏，换一碗饭吃。可惜他又有一样坏毛病，便是内存泄漏。运行不到几秒，便连程序带数据，一齐崩掉。如是几次，叫他写游戏的人也没有了。夕甲甲没有法，便只好做些最简单的外包项目。但他在我们厂里，品行却比别人都好，就是从不留 bug；虽然间或一时不能解决，暂时记在 wiki 上，但不出一月，定然修复，从 wiki 上删去了夕甲甲的名字。 
夕甲甲写过半页代码，涨红的脸色渐渐复了原，旁人便又问道，『夕甲甲，你当真会写代码么？』夕甲甲看着问他的人，显出不屑置辩的神气。他们便接着说道，『你怎的连半行代码也没有贡献给 linux 内核呢？』夕甲甲立刻显出颓唐不安模样，脸上笼上了一层灰色，嘴里说些话；这回可是全是『狗屎 Linus 』之类，一些不懂了。在这时候，众人也都哄笑起来：店内外充满了快活的空气。 
在这些时候，我可以附和着笑，师傅是决不责备的。而且师傅见了夕甲甲，也每每这样问他，引人发笑。夕甲甲自己知道不能和他们谈天，便只好向孩子说话。有一回对我说道，『你学过编程么？』我略略点一点头。他说，『学过编程，……我便考你一考。const int * 和 int const *，有什么区别？』我想，讨饭一样的人，也配考我么？便回过脸去，不再理会。夕甲甲等了许久，很恳切的说道，『不知道罢？……我教给你，记着！这些语法应该记着。将来做程序员的时候，写代码要用。』我暗想我和程序员的等级还很远呢，而且我们师傅也从不用裸指针；又好笑，又不耐烦，懒懒的答他道，『谁要你教，两个没区别，都是指向常量的指针。如果你想用指针常量，要写int * const。』夕甲甲显出极高兴的样子，将手里的破鼠标敲着电脑桌，点头说，『对呀对呀！……const 有四种用法，你知道么？』我愈不耐烦了，努着嘴走远。夕甲甲刚在 Visual Studio 里新建一个空文件，想在里面写代码，见我毫不热心，便又叹一口气，显出极惋惜的样子。 
有几回，邻居孩子听得笑声，也赶热闹，围住了夕甲甲。他便给他们一人写了一个 Hello World。孩子看完，仍然不散，眼睛都望着屏幕。夕甲甲着了慌，伸开五指将屏幕罩住，弯腰下去说道，『error 了，编译器报 error 了。』直起身又看一看屏幕，自己摇头说，『error error！哀乎哉？error 也。』于是这一群孩子都在笑声里走散了。 
夕甲甲是这样的使人快活，可是没有他，别人也便这么过。 
有一天，大约是程序员节前的两三天，师傅正在慢慢的 release 代码，打开 wiki，忽然说，『夕甲甲长久没有来了。还有十九个 bug 没修复呢！』我才也觉得他的确长久没有来了。一个喝酒的人说道，『他怎么会来？……他打折了腿了。』师傅说，『哦！』『他总仍旧是搞崩内存。这一回，是自己发昏，竟搞崩了 GFW 的内存。他家的内存，搞得的吗？』『后来怎么样？』『怎么样？先是去喝茶，后来是打，打了大半夜，再打折了腿。』『后来呢？』『后来打折了腿了。』『打折了怎样呢？』『怎样？……谁晓得？许是死了。』师傅也不再问，仍然慢慢的做他的 release。 
程序员节过后，函数式编程是一天比一天热门，看看连 Java 都开始支持 lambda 表达式；我整天的做测试，也须了解什么是闭包了。一天的下半天，没有一个要测试的项目，我正合了眼坐着。忽然间听得一个声音，『来一个鸡蛋灌饼。』这声音虽然极低，却很耳熟。看时又全没有人。站起来向外一望，那夕甲甲便在柜台下对了门槛坐着。他脸上黑而且瘦，已经不成样子；带一本破 Thinkpad ，盘着两腿，下面垫一个电脑包，用草绳在肩上挂住；见了我，又说道，『来一个鸡蛋灌饼。』师傅也伸出头去，一面说，『夕甲甲么？你还有十九个 bug 没修呢！』夕甲甲很颓唐的仰面答道，『这……下回修罢。这一回是现场通过，鸡蛋要好。』师傅仍然同平常一样，笑着对他说，『夕甲甲，你又内存泄漏了！』但他这回却不十分分辩，单说了一句『不要取笑！』『取笑？要是不泄漏，怎么会打断腿？』夕甲甲低声说道，『跌断，跌，跌……』他的眼色，很像恳求师傅，不要再提。此时已经聚集了几个人，便和师傅都笑了。我煎了鸡蛋灌饼，拿出去，放在门槛上。他打开电脑开始写代码，见他满手是泥，原来他便用这手走来的。不一会，他提交代码，通过了测试和 review ，便又在旁人的说笑声中，坐着用这手慢慢走去了。 
自此以后，又长久没有看见夕甲甲。到了 Rust 1.0 发布的时候，师傅打开 wiki 说，『夕甲甲还有十九个 bug 呢！』到 Golang 2.0 发布的时候，又说『夕甲甲还有十九个 bug 呢！』到 Scala 3.0 发布的时候可是没有说，再到 Rust 又演进了一个版本也没有看见他。 
我到现在终于没有见——大约夕甲甲的确死了。 
写于二零一五年夏」

——————————————

鉴于这种情况，我决定一周不说人话

——————————————

11.4 You may have seen the old I Love Lucy television episode in which Lucy and Ethel worked in a chocolate factory (it’s a classic). The duo fell behind as the conveyor belt that supplied the confections for them to process began operating at an ever-faster rate. Write a simulation that pushes different types of chocolates to a Redis list, and Lucy is a client doing blocking pops of this list. She needs 0.5 seconds to handle a piece of chocolate. Print the time and type of each chocolate as Lucy gets it, and how many remain to be handled.

——————————————

一长串英文看不懂

——————————————

不开心

——————————————

有个广东爹叫广药，他有个儿子叫王老吉，他觉得自己养不活这孩子，就给一个叫鸿道且膝下无子的香港人说，我把儿子给你当十年儿子，你给我点钱吧，香港人同意了。
然后香港人花了大把的钱把这孩子养大，这孩子长大了成了万人喜欢的高帅富，突然亲爹广药跳出来说，这是我儿子，十年期到了，该还给我了。
养父道鸿到法院跟亲爹广药争夺抚养权失败，就自己人工受孕生了个儿子叫加多宝，给他穿一样的衣服，也一样的花大钱养他，就是想让亲儿子比曾经的养子更高帅富。

——————————————

Gods know why you so ugly😄

——————————————

今天的任务也只完成了一点点

——————————————

你去看现在QQ wifi在线的人，多是清闲的人

爱隐身的多是有心机的人

——————————————

🤘

刚才突然明白这个是什么意思了

你把手倒过来，中间两指向90°微曲，前后自动就知道是怎么回事了。

——————————————

没人跟我聊都不知道说什么好了

——————————————

我深夜随便访问一个人的主页

几分钟不到，她就会回访…

——————————————

突然发现身边好多人玩全民K歌


只是他们都潜水

——————————————

我要死了，就是不去学习


就是不去工作





尼玛，我在发呆看手机

还有，与你们聊天

——————————————

草了，明明知道只剩一点任务没做


硬是不去做




这是懒汉思想吗？

——————————————

虽然知道自己是一条咸鱼。

但是我还是想要去做一些事情。

——————————————

你想语音多方便啊！

——————————————

其实讯飞语音输入法还是不错的。

——————————————

这里本来就是吐话的地方



一个人压抑久了，不管是天才还是其它什么都会疯掉的

——————————————

反正你们都不说话，那我说好了

——————————————

我测试了下，如果不往这儿吐废话，其它群就会充满废话。。😁

——————————————

有一日我终于明白怎样保持群的知识性和严肃性



那就是把废话向这里说

——————————————

😊Good morning😊

　😁☁😁☁☁😁☁😁
　☁😁☁😁😁☁😁☁
　😁☁😁☀☀😁☁😁
　☁😁☀🌻🌻☀😁☁
　☁😁☀🌻🌻☀😁☁
　😁☁😁☀☀😁☁😁
　☁😁☁😁😁☁😁☁
　😁☁😁☁☁😁☁😁

——————————————

https://program-think.blogspot.com/2016/05/share-books.html?m=1

——————————————

高中生视野下的知识体系

——————————————

近视就是好，看谁都是美女😄

——————————————

http://game.gtimg.cn/images/dnf/act/a20160720literature/videos/bg.mp3

——————————————

Powerful god

——————————————

第一章 外星来客



紧张的期末考来了，我对考试 already 麻木了，反正怎么考都是个倒数，在别人心急如焚答着题，或想尽办法作弊时，我却趴在那里 sleeping。

考试 time 眨眼间过去了，我的成绩 have a  进步，排在了 the 57名，倒数第5了。 Then 就是 correct 试卷了，接着开散学典礼，我高一的学习生活 in this way over。收拾好东西，几件衣服和一条薄毯，慢悠悠的骑着辆2手自行车回到了我乡下的小屋。对我来说, 放假和不放假都差不多，一样的混日子，一样是我自个儿过。

夜深人静，我趴在窗台上，望着遥不可及的星， with 月亮半遮半掩的躲在云里。

前后左右的房子都熄了灯，望着 the outside 一片黑压压的村庄，突然 find 自己是那么的孤独，那么的与这个世界格格不入，我找不到活着的意义。这个世界没有人值得我眷恋，也不会有人眷恋我，这种感觉是那么的可怜。举目无亲，就是我这种吧， even one friend haven't ！也对，谁会跟我这样的人做朋友？

再次抬头 look through the 有点悲凉的夜空，发现这个夜空好象有什么地方不同， like 东边多了一颗与众不同的星星，那星星比其他的亮了好多。啊？？还会动？我脑袋有点短路，这颗星星还真是奇怪啊，居然会移动。流星吗？我马上否决了这个想法，流星移动的速度可比这个快多了。

When 我乱猜时，那颗星星突然一闪，然后出现在了我头上的夜空中。还是那样亮，不过呆的地方却不一样了。 I can't help 目瞪口呆，这也太夸张了吧。UFO？？我有点怀疑的擦了擦眼睛，再看，晕啊，没看花啊！

突然，有股吸力拉着我飞上天去，我心一紧，不要吧，外星人要抓我去研究了， suddenly, 我脑袋浮出了这样一张 picture，我被绑在手术床上，几个奇形怪状的外星人围着我。我一阵恶寒，脑袋也在这时候一阵眩晕.  Before 昏迷，最后一个念头就是这下完了。

在我昏迷过去后，我的身体也凭空消失在窗台，那颗很亮的星也消失了, out of the sky，好象从来没出现过似的——

分割——

不知过了多久，我迷迷糊糊的醒来，睁开眼睛， find out that 自己躺在一张奇怪的床上，四周都是一些奇怪的仪器，我突然 remembered 我是被外星人抓来的. 他们对我做了什么? 我紧张的坐起，焦急的检查着自己的身体，发现还没被解剖，松了一口气，不过隐约 feel my body is some different。

“嘀”的一声，就在我刚松一口气的时候，对面一圆形门开了。开门的声音吓了我一跳，我紧张的注视着门口，见走进一个银色头发，银色皮肤，甚至连眼睛都是银色的身高近2米的男人。我看着这个人，楞在那里，外星人是这样的吗？怎么和我想的差那么多啊? 看起来跟地球人也差不多啊，除了发色和肤色。

“你醒了，地球人，你应该知道我是什么了吧？”那个看起来 like 银做的外星人对我说，居然用的是中文。

“你…你会说我们这里的话？”我楞楞的看着他，可话一问出我就觉得自己发傻了，人家一看上去就很牛B的样子，会说我们的话也是 normal 的啊。

“会说你们的话有什么好奇怪的，我在这个破星球呆了快一百年了，如果连你们的话都不会说那才奇怪呢！”外星人说完向我旁边的一堆仪器走去。

“什么，你在地球呆了1百年？不会吧？”我有点发傻了，那外星人见我惊讶的样子，开始为我慢慢讲解起来。

我也终于明白了 the 外星人的来历。这个外星人叫萨克，来自很遥远很遥远的艾美星系，那个星系的科技很发达，据萨克说, 至少比地球的科技先进几万年，那里的人差不多可以活5000 years，而萨克是那个星系派出的搜寻者， to look for 外星的生命，并帮助一些落后的星球发展科技. After a  漫长岁月的搜寻，萨克也很幸运的 found 一个有生命居住的星球。却不想正要回艾美星系时，碰到 a 星球爆炸，被“流弹”砸坏了动力系统，无法远航，只好在地球降落，隐藏在百幕大三角. Those 神秘事件也正是萨克这家伙搞出来的。

现在修好了动力系统，准备离开。不过在他离开前想找一位地球人，把他培养成艾美星系在这个遥远星球的“代言人”, 帮助 location 发展科技. (ps: 地球 and 艾美星系实在太遥远，一来回至少要几千年)

我居然在几百亿中选一的大抽奖中中奖了，被萨克选中，5555，真是太感动了，从小倒霉的我，居然一下子RP暴发，哈哈，真是太棒了！

“你在想什么，脸上表情好奇怪啊？”外星人萨克的一句话打断了我的美好YY。

“啊？没什么没什么，哈哈，你什么时候给我你们那里的 high 科技啊？”我尴尬的挠挠头。

“恩，这个不急，等会再说，现在我先给你检查下身体吧。”外星人边操作着仪器边对我说，“好了，你躺下，别乱动，放轻松。”

我依他说的躺下后，身体上方 had been fixed by a 伸下的触手。萨克仔细的操作着仪器，好一会，他才把盯着屏幕看的眼睛转到我身上，对我说：“恩，实验很成功，一切都很正常，你们地球人的潜力还真大。”

我一听他的话差点昏过去，焦急的问：“不会吧，你在我身上做什么实验？不会把我弄变异了吧？以后会不会变成怪物啊？”可千万别把我弄成怪物了啊！我才18岁，变怪物了以后谁嫁给我啊?

“怪物？？哈哈，你怎么会想到 that 方面去，我把你变成怪物干什么？你真有趣！”萨克站在那里哈哈大笑，“你身体改变了，但不会变成怪物的，这你可以放心。”

听他这么一说，我总算松了一口气. 哎~ Truly, 跟外星人打交道不怎么让人放心啊。

“你说我身体有改变，是什么地方改变了？”我疑惑的看看自己的身体，手还是手，脚还是脚，没什么变化啊。

“你现在变化可大了，不仅身体表面 have a little change，身体内部也变了好多，严格的说，你现在的身体已不是普通地球人所有，你先下床，现在可以自由 move 了。”萨克说完示意我下床。

——————————————

2015中国杰出青年奖/2015年青少年科技大赛一等奖/第六届高等数学全球锦标赛亚洲赛区冠军 以上奖项均未获得

——————————————

http://weibo.com/sheva34331?is_hot=1#_0

——————————————

Look at this when you tired.

http://www.foxebook.net/category/computers-internet/

——————————————

http://www.coolapk.com/album/1709739?&lan=en&lan=en&lan=en

——————————————

www.xda-developers.com

——————————————

云计算不是孤立的，它连接着从硬件生产、数据中心，到资源的抽象，到平台层服务和应用层服务的整个产业体系。

——————————————

我上大学时，老师教诲我们说，搞现代史要牢记两个原则，一是治史的原则，二是 党性的原则。这就是说，让历史事实按党性的原则来发生。凭良心说，这节课我没听懂。在文史方面，我搞不清的东西很多。不过我也能体会到学者的苦心。

——————————————

我和李银河从一九八九年开始一项社会学研究，首次发现了中国存在着广泛的同性恋人群，并且有同性恋文化。当时以为这个发现很有意义，就把它报道出来，结果不但自己倒了霉，还带累得一家社会学专业刊物受到本市有关部门的警告。这还不算，还惊动了该刊的一位顾问，连夜表示要不当顾问。此时我们才体会到这个发现是不受欢迎的，读者可以体会到我们此时是多么的惭愧和内疚。假设禁止我们出书，封闭有关社会学杂志，就可以使中国不再出现同性恋问题，这些措施就有道理。但同性恋倾向是遗传的，封刊物解决不了问题，所以这些措施一点道理都没有。

——————————————

我有位世伯，“文革”前是工读学校的校长，总拿二十四孝为教本，教学生说，百善孝为先，从老莱娱亲、郭解埋儿，一路讲到卧冰求鱼。学生听得毛骨悚然，他还自以为得计。忽一日，来了“文化革命”，学生把他驱到冰上，说道：我们打听清楚了，你爸今儿病了，要吃鱼——脱了衣服，趴下吧，给我们表演一下卧冰求鱼——我世伯就此落下病根，健康全毁了。当然，学生都是混蛋，但我世伯也懊悔当初讲得太肉麻。假如不讲那些肉麻故事，挨揍也是免不 了，但学生怎么也想不出这么绝的方法来作践他。他倒愿意在头上挨皮带，但岂可得乎……我总是说笑话来安慰他：你没给他们讲“割股疗亲”，就该说是不幸之中的大幸，要不然，学生片了你，岂不更坏？但他听了不觉得可笑。时至今日，一听到二十四孝，他就浑身起鸡皮疙瘩。

——————————————

时隔十年，再来考虑信仰问题，我忽然发现，任何一种信仰，包括我的信仰在内，如果被滥用，都可以成为打人的棍子、迫害别人的工具。渎神是罪名，反民族反传统、目无祖宗都是罪名。只要你能举出一种可以狂信而无丧失理智危险的信仰，无须再说它有其他的好处，我马上就皈依它

——————————————

我也有一个问题，是这样的：什么是知识分子最害怕的事？而且我也有答案，自以为经得起全球知识分子的质疑，那就是：“知识分子最怕活在不理智的年代。”所谓不理智的年代，就是伽利略低头认罪，承认地球不转的年代，也是拉瓦锡上断头台的年代；是茨威格服毒自杀的年代，也是老舍跳进太平湖的年代。

——————————————

现在的知识分子都学乖了，只管呼吁不管干，并且善用一种无主句：“要如何如何”。

——————————————

我们国家总以受过某种程度的教育尺度来界定知识分子，外国人却不是这样想的。

我在美国留学时，和老美交流过，他们认为工程师，牙医之类的人，只能算是专业人员，不 算知识分子，知识分子应该是在大学或者研究部门供职，不坐班也不挣大钱的那些人。

——————————————

我们这个民族总是有很多的理由封锁知识、钳制思想、灌输善良，因此有许多才智之士在其一生中丧失了学习、交流、建树的机会，没有得到思想的乐趣就死掉了。

——————————————

愚蠢是一种极大的痛苦：降低人类的智能，乃是一种最大的罪孽。

——————————————

假设我相信上帝（其实我是不信的），并且 正在为善恶不分而苦恼，我就会请求上帝让我聪明到足以明辨是非的程度，而绝不会请他让我愚蠢到让人家给我灌输善恶标准的程度。

——————————————

我认为自己体验到最大快乐的时期是初进大学时，因为科学对我来说是新奇的，而且它总是逻辑完备，无懈可击，这是这个平凡的尘世上罕见的东西。与此同时，也得以了解先辈科学家的杰出智力。这就如和一位高明的棋手下棋，虽然自己总被击败，但也有机会领略妙招。在我的同学里，凡和我同等年龄、有同等经历的人，也和我有同样的体验。某些单调机械的行为，比如吃、排泄、性交，也能带来快感，但因为过于简单，不能和这样的快乐相比。艺术也能带来这样 的快乐，但是必须产生于真正的大师，象牛顿、莱布尼兹、爱因斯坦那样级别的人物，时下中国的艺术家，尚没有一位达到这样的级别。恕我直言，能够带来思想快乐的东西，只能是人类智慧至高的产物。比这再低一档的东西，只会给人带来痛苦；而这种低档货，就是出于功利的种种想法。

——————————————

在我们生活的这个世界上，最大的不幸就是有些人完全拒绝新奇。

——————————————

因为没事干而下棋，性质和手淫差不太多。

——————————————

七八年前，我在海外留学，遇上一位老一辈的华人教授。聊天的时候他问：你们把太太叫作“爱人”──那么，把lover叫做什么？我呆了一下说道：叫作“第三者”罢。他朝我哈哈大笑了一阵，使我感觉受到了暗算，很不是滋味。

——————————————

事实上，人家商业区和住宅区是分开的

——————————————

在落后的小镇，几乎相当于贫民窟

这里污染遍布(尤其是噪声污染，人们几乎忽略)

要知道在大城市，夜间开发电机，向城管投诉是会被关停的

并且伴随线路老化，规划不合理，时常停水停电

这个大城市是短暂且有计划的


上海几乎不会停电，即使某个地段检修，会提前告知而且时间很短，尤其不会影响夜间居民用电，这点上海做的非常好。

——————————————

你也可以是另一种人，不寻求主动的改变

环境(形势)推你做什么，你就做什么




以上两种都是做人的方法，不同之处在于，第一种生活趋向合你意，第二种生活充满不确定性。

——————————————

我保留的不只是童真，而是一种自认为完美的自我状态。


这可能包含一种对专业素养的期待、对高尚道德情操的期待、对清新简洁脱俗生活的期待，如此种种，皆是完美主义的体现。


正是这种对完美的追求、对自我的合理约束，才使我们不断前进、不断通过微小而具体的行动改变周遭的环境、改变自身。

最终，达到一个心灵的和谐，安详的离开。

——————————————

我的意思是学会飞机就不用考驾照了😁

——————————————

www.yesxian.com/wenzhang/gushi/29389.html

——————————————

http://mm.eastday.com

Which girl you want?😀

——————————————

If you really want to learn, and you want to learn more quickly and more deeply, pay attention to how you pay attention. Think about how you think. Learn how you learn.

——————————————

我喜欢整理知识，整理的过程中，自己也学到了东西

——————————————

In my mind, I could never fancy how ten second of life could change a person's view for his whole existence. 

考查名词。second 意为“秒”时是可数名词，ten 表示数量，应用 second 的复数形式。故正确答案为将 second 替换为 seconds。

考查介词。句意：我不能够想像生命中的10秒钟是怎样改变一个人对于整个生命过程的观点的，用介词 on 或者 about 表示“关于…的观点”。故正确答案为将 for 替换为 on/about。

In my mind, I could never fancy how ten seconds of life could change a person's view about his whole existence. 

——————————————

A few years ago I experience the worst moment in my life. 

考查动词时态。结合 A few years ago 可知 experience 这个动作发生在过去，应该用一般过去时。故正确答案为将 experience 替换为 experienced。

A few years ago I experienced the worst moment in my life. 

——————————————

I was driving home that afternoon. 

——————————————

Unfortunately, I didn't make it home as usually because I had a car accident. 

考查固定搭配。as usual 是固定搭配，意为“像往常一样”。故正确答案为将 usually 替换为 usual。

Unfortunately, I didn't make it home as usual because I had a car accident. 

——————————————

While I was driving, all of a sudden, but the car in front of me stopped. 

考查连词。While I was driving 是时间状语从句，all of a sudden 是插入语，the car 是主句主语，stop 是谓语，句子结构完整，也不存在转折关系，所以不需要添加 but。故正确答案为将 but 删除。

While I was driving, all of a sudden, the car in front of me stopped. 

——————————————

My car immediately ran into it. 

——————————————

Luckily, I wasn't serious hurt. 

考查副词。修饰动词 hurt 应用副词，故正确答案为将 serious 替换为 seriously。

Luckily, I wasn't seriously hurt.

——————————————

That accident changed way I drive and they taught me a valuable lesson. 

考查定冠词。定冠词 the 用来限定这个冠词后面的名词是某个特定的事物，此处特指作者之前的驾车方式，要加定冠词 the。故正确答案为在 way 之前添加 the。

考查主谓一致。主句主语是 That accident，and 表示并列，and 后的句子的主语指代的是 that accident，应用代词 it。或者 and 起并列两个动词的作用，即：那场意外改变了“我”驾驶的方式并给“我”上了有价值的一课，将 they 删除。故正确答案为将 they 替换为 it 或将 they 删除。

That accident changed the way I drive and taught me a valuable lesson. 

——————————————

I also came to the conclusion which life needs to be treasuring.

考查连词。引导同位语从句的连词应该用 that，且 that 只起到语法作用，在句中不作任何成分，而 which 引导的是定语从句。故正确答案为将 which 替换为 that。

考查被动语态。need 和 treasure 之间存在被动关系，且 treasure 之前有 be 动词，所以要用 treasure 的被动语态。故正确答案为将 treasuring 替换为 treasured。

I also came to the conclusion that life needs to be treasured.

——————————————

In my mind, I could never fancy how ten seconds of life could change a person's view about his whole existence. 

A few years ago I experienced the worst moment in my life. 

I was driving home that afternoon. 

Unfortunately, I didn't make it home as usual because I had a car accident. 

While I was driving, all of a sudden, the car in front of me stopped. 

My car immediately ran into it.

Luckily, I wasn't seriously hurt.

That accident changed the way I drive and taught me a valuable lesson. 

I also came to the conclusion that life needs to be treasured.

——————————————

或者

一个男人盯着女人的下面
一个女人盯着男人的下面

——————————————

囍

一个男人趴着舔女人的下面
一个女人趴着舔男人的下面

——————————————

夏天最烦的就是蚊子

——————————————

What the fuck, this determined your future!

——————————————

I have no Chinese input program...

——————————————

Everything won't kill me makes me feel alive.

——————————————

😂

——————————————

In my life, I hate two kinds of people, SB and garbage.

Oh, I forgot, I hate myself!

——————————————

两只老虎　 两只老虎
真奇怪　真奇怪
一只没有耳朵
一只没有尾巴
...

——————————————

Heart tired.

——————————————

I remember an important theory, a great learner always learns by themselves.

——————————————

http://zs.hncst.edu.cn/info-9799.html

——————————————

我承认我玩DNF.游戏充满了套路与心机.没有书.并不适合我.游戏不如学习.跳舞不如学习.谈恋爱不如学习.一言不合就学习.我喜欢学习.学习使我快乐.优秀是一种习惯.我徜徉在知识的海洋里.吮吸着知识的雨露.妈妈叫我吃饭.我充耳不闻.爸爸喊我喝水.我无动于衷.奶奶喊我睡觉.我百般推辞. 世界上只有一种稳赚不赔的投资.那就是学习.我只想告诉你们.烟可以抽.酒可以喝.容可以整.架可以打.逼可以装.但你要是不爱学习.对不起.我们做不了朋友！我爱读书.我爱学习.学习使我快乐.

——————————————

[【马云RAP】成功和幸福的秘诀_鬼畜调教_鬼畜_bilibili_哔哩哔哩弹幕视频网] is good,have a look at it! 

http://www.bilibili.com/mobile/video/av4980917.html

——————————————

《物质与思想(简)》



不管什么语言，什么形式，不过让人明白那道理罢了，不必纠结于表面那些东西，着重去理解、去感悟才是真的。


其实，最原始、最基本的东西依然存在于我们人类世界：


能量守恒并转化定律→世界运动本质为物质与能量的不断加速流动、转换。

环境引导需求，需求产生行动，行动改变环境。

需求=利益=生物间唯一联系∈{x|x∈(经济,政权,…)}。

对比→生物认知=事物差异信息={x|x∈(极端认知1,极端认知2)}→矛盾∈{是非，强弱，对抗，竞争，…}=平衡。

注：→表示“产生”或思维过程。



每个人的人生经历，所带给他的不同感觉，共同绘成了他脑中的世界。

一人一世界，世界到底是什么样的？

我不知道，但我知道：理解了人脑，就理解了一切。

Super AI will work out all these problems.

——————————————

日复一日的忙碌不堪 
学习上班无限循环 
生活变得越来越平淡 
很想找一个人来陪伴 
但遇到喜欢的人说话也不敢 

每天夜里辗转不安 
好想找个妹子来陪伴 
但是想想又觉得麻烦 
工作学习压力不断 
少年时的梦想已经碎成两半 

当初的热情渐渐不在 
只好靠动漫忘记现实中的不快 
每天回家后一个人宅 
想做点什么把自己找回来 
然而还是不停对着电脑屏幕发呆
 
抬头朝窗外看云彩变幻 
问自己是否还有爱 
每天不停的做着无限循环 
然而幸福还在遥不可及的另一端 
不要放弃希望 
只要有梦想 
爱永远存在 

夜深人静从梦中醒来 
躺在床上思考着未来 
想来想去却没有答案 
心中反而越来越迷乱 

于是继续做着循环 
日复一日的百无聊赖 
天天像齿轮一般旋转 
却找不到通往幸福的答案 

下定决心一定要脱宅 
至少要改变颓废的状态 
但到后来还是觉得麻烦 
反正努力也不会有人喜欢 
这社会残酷地令人无奈 

想逃避却没想象中=的简单 
继续在虚拟中徘徊 
想找回那份被遗失的爱 
然而还是不停迷茫地在原地打转
 
回头看当初梦想那么灿烂 
事到如今只有感慨 

每天不停的做着无限循环 
已经无法确定自己是否真的还存在
不要放弃梦想 
只要有希望 
幸福会到来！ 

想做点什么摆脱无限循环 
要为自己找到通往幸福的答案 
就算现实是多么的艰难 
也要对着命运呐喊 

其实这世界也做着无限循环 
只要坚持到底幸福就一定会到来 
不要放弃希望 
只要有梦想 
人生会精彩

——————————————

...

——————————————

╭━━━━━━━━━━━━━╮ 
┃╱╱╱╱╱╱╱╱┏┓╱╱╱┃ 
┃╱╱╱┏┓╱╱┏╯┃╱╱╱┃ 
┃╱╱┏┛┗┓╱┗┓┃╱╱╱┃ 
┃╱╱┗┓┏┛╱╱┃┃╱╱╱┃ 
┃╱╱╱┗┛╱╱╱┃┃╱╱╱┃ 
┃╱╱╱╱╱╱╱╱┗┛╱╱╱┃ 
╰━━━━━━━━━━━━━╯

——————————————

GIF

Graphics Interchange Format

——————————————

不知什么时候码农成为了程序员的另一个代名词，虽然略含贬义，被大多数程序员用来自嘲，但如果被别人称为码农，我想大多数程序员心里必然不爽。然而对大多数处境不太好的程序员，码农却是他们生活和工作状态最真实的写照，用来形容他们也是十分恰当的。我想之所以称为码农应该和农民或是民工有一定的联系，两者都是处于金字塔的最底层，一个是从事体力劳动，一个是从事脑力劳动，工作存在重复性，缺乏创造力，对工作缺乏激情，被金字塔上一层的人压榨着。

码农的养成主要有两方面的因素：一是程序员的自我意识；另一个是公司的环境。


自我意识

容易成为码农的人一般都是比较听话的，缺乏主见和独立思考的能力，不思进取。这些人一般都是逆来顺受，对公司或领导安排的工作都是无条件去执行的，即便不合理也不会提出异议，不敢站出来反抗的。他们从来不会想着如何提高工作效率，如何提升自己的技术，甘愿在公司混着日子，做一个代码的搬运工，任劳任怨。可能对他们来讲这只是一个工作而已，并非真的喜欢计算机这个行业。他们之所以选择这个工作，可能是因为听别人说这个行业工资高。这样的人用码农称呼他们最合适不过了。其实这样的人无论在哪个行业都是在最底层，都会被叫做X农。


公司环境

相对而言我觉得公司环境更为重要。
一般程序员所在的公司可以简单分为两类：技术驱动型和营销驱动型的。技术驱动型的公司都是非常重视技术和技术人员的，他们愿意花高薪聘请行业里面的牛人，牛人做事的效率和质量自然要比一般人高出一大截，公司做出来的产品自然也是一流的，公司的效益也会因此受益。并且牛人多了会形成一定的效应，会吸引其他牛人，吸引潜力优质的新人，如果管理和培养新人的方式没有问题，新人会逐渐成长起来，形成一个良性的循环。这些公司一般是互联网公司，无论是一线互联网公司还是初创的公司都是对技术非常重视的，和公司差儿不差儿钱没有多大关系。

而大部分营销驱动型的公司则缺少对技术的足够的尊重，大部分码农存在于这些公司。这些公司的盈利方式大部分靠市场关系拿项目赚钱，这种方式下产品做得好或不好显得不是特别重要，只要关系足够硬，只要市场人员拿的到项目就能赚钱，公司就能盈利。这种情况下，公司要想盈利更多，无非是营销上拿更多项目或是严格控制成本。控制成本可能就是缩短研发时间，削减用人成本。一旦缩短研发时间时，项目的计划安排就不再是根据工作量和研发人员的能力制定的，而是根据这个项目成本要控制在什么范围内或是营销人员拍着胸脯给客户承诺的时间节点。所以当项目经理告诉你这个项目要一个月要做完时，可能的原因就是一旦这个项目用了两个月时间公司可能就赚不到什么钱了，或者就是营销人员在客户面前牛逼吹破了，所以就苦了这些程序员要加班加点的赶进度，为这些人吹的牛逼买单。

在这种性质的项目研发中，工作计划安排不合理，时间过于紧张。并且一般情况公司都有类似项目的代码，你不再是代码的创造者而是代码的搬运工，大部分是copy其他项目的代码过来，做一些修改满足现在的需求，“能用就行”是他们经常说的一句话。紧张的时间没有给你进行设计和思考的余地，为了追赶进度你只能用最快的实现方式而不是最优的实现方式。长此以往会扼杀程序员的创新能力和思考能力，变成机器一样的代码工。最终在经历无数个日日夜夜的奋战项目按时实现完成了，大家皆大欢喜。你可以给项目经理一个交代，项目经理可以给公司一个交代，营销人员可以给客户一个交代。而你可能还在惦记着项目某个功能实现的方式不是特别好，当时由于时间关系没有采用最好的方式，然后考虑要不做一次优化，但是对于公司而言做项目重构或是代码优化不会直接产生任何价值，所以公司是不会给你时间做这些的。而这时候可能项目经理会告诉你有另一个项目，非常着急，要一个月完成.....。这样虽然你做了很多项目，但其实只有一个项目的经验，并且还是1.0的经验。虽然你工作了很多年，实际的工作经验只有一年。这样的程序员就可以称他为码农了。

在这种公司里面，程序员就好像流水线上的工人一样，只要成本低能干活就行。公司只要留住几个核心员工，能够带领研发即可。铁打营盘，流水的兵，你走了很快会有其他成本更低的人顶替你，只要公司的项目能按时交付即可。如果你初入这个行业，代码量不够可以考虑去这些公司积累一下代码量，因为他们要求相对低一些。但如果你对技术有一定的追求，是一个不愿意的将近的人，这样的公司就不适合长待，除非你甘愿做一个码农。

牛逼的人可能用码农自嘲，但大部分人更多是心里的无奈，有时候我们可能改变不了环境，但我们可以换个环境。如果你不愿意将就下去，是时候做出改变了，不要对自己的工作不满，却还不愿意去努力改善。多利用自己的业余时间提高自己的技术，早日脱离码农这个阶层。

——————————————

SIM

Subscriber Identity Module

——————————————

压力的缓解措施


生存压力:

不考虑天灾人祸食物短缺等，这类压力主要源于身体健康状况不佳。因此调节方式也很简单，培养并维持良好的生活习惯即可。

合理作息
加强运动
注意饮食
保证睡眠

其中特别要强调保持睡眠。现代人很少会面临生存压力，却常常会遇到睡眠问题。有时候会觉得，睡眠质量不佳其实是一种很特殊的生存压力吧。引发条件极为简单，熬夜不睡即可；影响迅速而明显，内部精神压力剧增，反应力和判断力下降并极易导致失误，进而影响外部评价，产生外部压力。相对破坏，睡眠质量的恢复却要花费更久的时间。此外，长期轻度睡眠问题带来的影响并不亚于短期熬夜。无论如何，确保高质量的睡眠是释放压力的第一要务。


内部压力:

通过习惯来缓解强迫症。习惯的力量十分强大，借助习惯可以事半功倍。例如，担心出门时没有锁门，可以培养锁门后拍照记录或只是简单捏一下自己。有意识地让肌肉参与，比眼看脑记更加深刻。这些习惯以简单有效为宜，一旦养成，就值得信赖

建立正确期望。合适的期望对人有激励作用，过高的期望只能徒增压力与失望与不自信。建立期望，应该以过往的经验为基础，如果过去从未实现，有什么理由相信自己下次一定可以成功呢？即使求成心切，也应根据实际情况多次迭代更新期望，而不是一蹴而就在毫无基础的时候就建立不切实际的期望。上一次得了60，这次就改进方法，或增加努力，期望得到65——而不是这次决意已定，信心满满，肯定能得100

过度的欲望。思考自己真正想要的是什么，欲望的来源是什么。这个问题本身就能长篇大论。重要的是，努力成为一个真正独立的人，不要让自己的欲望成为社会舆论宣传的镜子
接受变化与不确定。这个世界上唯一不变的就是不断的变化。大部分人无法准确预测自己两年后的状态。既然变化与不确定是这个世界的常态，是事物发展的法则，又何必为此恐惧和焦虑呢。为变化制定多套不同方案，借助经验预测未知，先尽人事，后听天命


社会压力:

正确评价他人。由于信息不对称，他人展现的、媒体宣传的，都不一定是实际情况，或者说不一定能准确反映整体情况。一位成功的商人可能不是一个尽责的父亲，拥趸众多的意见领袖不一定过着自己梦想的生活，学术爱情事业三丰收的长者或许每时每刻都要应对常人想象不到的艰难。因此，不必妄自菲薄，特别是不应自行想象他人不为人知的一面

影响他人的评价但不在意他人的评价。外部评价可以被影响，但不可控。不能期望所有人都满意自己，如果这些评价难以对自己造成实际影响，可以忽略不计。做好自己，影响可以影响的人，影响需要影响的人，即可。当自己能创造价值时，被需要与被信任也将随之获得
双向选择。寻找自己认同的，有归属感的集体。自我提高，让自己具备选择的资本

宁缺勿滥。这一点很难做到。如果追求的东西成本极高，人往往就很难顶住压力。例如，坚守道德通常需要付出极高的精神和物质成本。不乱扔垃圾不乱穿马路等功德，要对抗人性的懒惰和自私；互联网商业公司不助纣为虐利用国内垄断地位把害人性命的骗子医院的广告夹杂在搜索引擎结果里，要对抗金钱的诱惑与外部资本的压力。不过对于个人来讲，或许静下心来，好好想一想自己到底追求的是什么，可以帮助自己找到一些答案。如果明天就是你生命的最后一天，你是否还会纠结于这些难以割舍的东西？你希望得到他人怎样的评价？缺乏公德的人，抑或是丧尽天良的商人？当然，如果这些不会成为你的压力，现在自然也不会成为一个问题

理解历史的进程。每个人都能选择自己的行为，但能与历史进程对抗的毕竟是少数。以史为鉴，可以知兴替。人类文明如何受生产力发展的影响，如果受经济模式的影响，如何受人性的影响，必然遵循一定的规律。如果能了解到一些这样的规律，或许能对这个世界的运行法则有更深的认识吧。一国的制度演化，民众素养与社会风气等，发展成当前的状态大多是众多历史条件叠加的必然结果。为什么会产生农耕文明？为什么会有殖民扩张？为什么会有王朝兴衰？为什么会有革命？为什么会爆发战争？为什么会有经济危机？为什么会有郁金香/普洱茶/房地产的泡沫？……越看清这个社会运行的本质，越能对这个纷扰的世界保持平静吧。就好象人不会因为苹果会掉落地面、水能载舟火能取暖之类的现象感到压力一样，如果知道了在特定的资本与经济条件下某些社会现象几乎是物理定律般的必然，或许也就不会过分患得患失了。《人类简史》是一本通俗易懂的好书，可以帮助自己对人类文明的进程有一个新的认识，值得一读

维护健康的人际关系。人际关系其实和个人与群体的关系类似，只不过此时对方是一个个具体的人。相互认可、相互信任、相互尊重、相互需要，保持合适的距离，紧密而自由，或许是最佳的人际关系

——————————————

压力的作用与危害

作用

危机意识。穷则思变。压力也许是改变与进步的契机
集中注意力。适当的压力可以迫使人专注于重要的问题

危害

精神疲劳/肉体疲劳的加速。长时间处于压力之下会积累精神疲劳，精神疲劳又将导致肉体疲劳
疲劳将造成效率下降，错误增加
产生焦虑心情，无法正常工作生活，浪费大量时间
恶性循环。疲劳的肉体会发过来影响心智。人在劳累时往往难以意识到自己处于不良状态，越陷越深
情绪消极。对他人产生消极影响，破坏关系。如果能够遇到情绪积极的人帮助还好，仅靠自己很容易钻入牛角尖
短视/无法做出最佳决策。迫于压力，人往往会选择解决眼前的紧迫问题，而这不一定是长期的最佳选择

——————————————

外部对自己的认可

需要与被需要。认识到自己需要依赖整个社会才能更好地生活，并且相信自己具有足够的能力提供社会需要的价值。前者通常成立，后者则不然。如果认为自己不被社会需要，便可能产生一定的心理负担，担心自己能否长久地在社会中生存

信任与被信任。信任社会有助于减少不必要的脑力消耗与精神负担。被信任的人更容易建立起足够的自信。或许存在精神特别强大的人不需要外界的反馈也能认清自己，自信而坚定。不过这种情况下，他很可能缺乏对所属社会群体的认同感与归属感。不过，如果把握不当，被信任也可能转为过度的期望而产生压力
认同感与归属感的缺乏。认同感与归属感指认同自己所属的群体，为自己属于该群体而感到自豪与安心。认同感与归属感能够使人放松，排解压力。这两项却并非总能实现。出于各种原因，人并不总是有能力选择自己所属的群体。后进学校里努力学习的学生可能在班集体里找不到归属感，混吃等死的机构里有雄心的员工可能既不认同也不认为自己属于这个环境。不过，如果信念坚定，相信自己可以改变，改变环境，或是改变环境，由于认同感与归属感确实造成的压力或许也有正面作用

没有选择的自由。能够自由选择，显然胜过枷锁重重

内部压力与外部压力存在联系，在一定条件下能够相互转化。

——————————————

外部压力

撇开生存压力，此处的外部压力也许能大致等同于社会压力。外部压力可以由个人或群体造成，甚至只是舆论或媒体渲染。

外部展现的状态。成绩优秀的同学、外貌出众的朋友、能力拔群的同事、多才多艺的同龄人……荣誉、幸福、清闲、权力、富裕……新买的奢侈品、小清新的出国旅游、丰富而频繁的文娱活动……本来，与自己过分遥远的人不会成为问题。人们通常不会因为明星富商生活条件优越而感到不平，而只会关心身边看得到的例子。然而，网络普及之后，社交网络的流行使情况发生了变化。你会发现，你身边默默无闻的同事周末的生活简直丰富得难以想象；你各方面平平的朋友似乎始终乐观积极毫无烦恼；你泯然众人的高中同学和千里无一的美女结为连理；原本和你一辈子打不了几次交道的远房亲戚在特大城市的富人区购置了房产。做到清心寡欲并非易事。没有比较就没有伤害，外部展现的状态，无论虚实，都会影响自己的心境。尤其是当你发现自己无法达到“社会的普遍标准”时，你必然会有意识或无意识地感受到压力。例如，你以为三十岁前大家都结婚了；你以为大家结婚时都添置了新房；你以为昂贵的钻石戒指是唯一可以表明真爱的信物——如果这不是钻石公司几十年营销得到的成果

外部对自己的评价。无论你与他人相同还是不同，不如还是超越，你都有可能收到指指点点。这些指指点点或许并不会对你有直接的伤害，但你却总担心它们终将转变为实际的影响。也可能，这些不公甚至不实的评价，本身就能让你感到不快，即使它们几乎没有可能对你造成实在的损失

外部对自己的期望与要求。如果说外部展现的状态不明确针对某个目标，外部对自己的评价不直接要求回应，那外部对自己的期望与要求则更加明确与直接。父母期望子女成才；老师要求学生学习，期望他们考取高分；领导要求员工努力工作，期望他们获得好业绩。期望会带来评价，进而转为压力，要求更是很可能会改变今后的处境，形成直接压力

——————————————

内部压力

一个完全与社会隔绝的人是否会有压力？如果他能够自己自作健康而自由地生活，且不用担心外部威胁，他是否还会有压力？这类压力或许可以归为来自内部的压力。有些压力的根因很可能依然源自外界，但其形成与个人的性格或思维方式等息息相关。内部压力包括以下这些：

强迫症。必须反复确认检查才能安心，常见的有出门时检查是否关门等
过分完美主义或脱离实际的期望。对自己或外界的行为及其结果要求过高，一旦存在偏差便产生负面情绪
过度的欲望。强烈的物欲、权利欲或控制欲等

——————————————

压力源

此处主要讨论的是相对长期的精神压力，短期的应激性压力或肉体压力不做展开。由缺乏食物、饮水、睡眠、温度或身体疾病导致的压力成因与解决方法都较为显然，也不多深入。

——————————————

聊聊压力

这篇文字根据自己前几年在记事帐里随手记下的随感整理而成。这些没有成文、不成系统的只言片语安静地躺了两三年，趁此机会稍作梳理，固仍有疏漏与偏颇，也算是做个了结。因没有任何专业基础，完全基于经验得出感受，难免有不少幼稚与谬误之处，仅作备考。

下面依次谈谈自己对压力的来源，压力的效果和压力的释放等话题的理解和思考。

——————————————

https://vimeo.com/

——————————————

Fack these courses in Chinese, I'll learn Android on its offical website.

——————————————

We use this (singular) and these (plural) for people or things near us:

We have lived in this house for twenty years.
Have you read all of these books?

… and that and those for people or things that are not near us:

Who lives in that house?
Who are those people?

——————————————

No matter I spent 3 years learning at high school or not, I also can't master a certain skills.

——————————————

曾有一个段子说：一个妹子问一个程序猿如何让一帮不爱说话的程序猿活跃起来，那个程序猿说了一句PHP是最好的语言。。。很多程序猿都喜欢站队，所谓站队就是自己在玩某某语言的时候，就会觉得这个语言很强大，自然而然的就站了队了。

我们的身边充斥着写java的看不上写.net的，写c的看不上一切，node异军突起，python批评ruby垃圾性能，高富帅swift从天而降，PHP是最强语言等等。。。

十二年前，我刚工作的时候，写医疗软件，用VB写界面，用VC写功能封装dll，当时觉得VB，VC太强了，结果现在它们基本都死了。

同样的还有：

我写过Dephi，死了。。

我写过asp，死了。。

我写过塞班，死了。。

我们更应当做的是跳出语言的框框，编程注重的是思想，而非语言。

——————————————

总有人会说你不是一个真正的程序员。
看看这些说法吧！

“HTML不是真正的编程语言。”

“如果你不用vi，你就不是真正的程序员。”

“真正的程序员得懂C语言。”

“有些人就是不适合编程。”

“有些人就是学不会。”

“你根本就不是真正的程序员，我才是。”

要我说，编程对于不同的人有不同的含义。同时，编程的含义随着时间的流逝也在变化。

有趣的是，那些能让初学者，甚至是编程老鸟，更快上手，更省事的工具，包，框架等往往会被贴上 “真正的程序员不该使用” 这样的标签。

这种贴标签行为背后是一种恐惧：如果任何人都能称自己为程序员，那这个头衔就将毫无意义。不过，我认为这种闭关自守的行为是有害的。

去用那些让写程序变得容易的工具吧。如果那意味着你用 Stencyl 或者 GameMaker 来写游戏，而不是从零开始写一个新的，没事，只管去做。

如果你第一次尝试编程是从HTML或者Excel宏开始，没事，只管去做。哪个（编程方式）你能坚持下去，你就用哪个。

随着你技术不断提升，你就会发现那些便利工具对你的限制大于对你的帮助。那时，你就会去寻找更强大的编程工具。

但大多数时候，很少有人会看你的代码，或者问你用什么编程工具。你的程序到底好不好用才是真正重要的。

——————————————

哈哈

易语言让你一分钟理解中文编程

Python让你理解国际性编程

C++让你理解低层编程

——————————————

https://imjad.cn/test/unicode.html

名字穿透，亲测TG、QQ可用

——————————————

这傻逼终于走了

——————————————

软件开发是一个极其特殊的行业，这里的从业者无一例外都要有超强的自学能力。

学习的知识是开放的(美国主导)，并不像初高中那样，学习的东西是教育部闭环垄断的，书是它的，试卷也是它的。

本业实践性较强，就算出算法题也是叫你写出能运行的代码。

同时本业粗浅知识更新换代较快，而难的、底层的理论知识更新较慢。

这正应了一句话:简单得来的东西失效快。

——————————————

The following things are written in either C++ or C (we'll pretend C is a subset of C++, which is kind of true):

All the major operating systems (Linux, Mac OS X, Windows)
All the Blizzard games (World of Warcraft, Diablo series, StarCraft series...)
Nearly all the other AAA games too (Unreal Engine & Unity are both C++. Valve and CryTek are also C++)
Most console games (Wii series, PlayStation series, and most XBox games--except the indie arcade titles)
Most interpreted programming languages have VMs written in C or C++ (Java, Python, Ruby, Perl, PHP, Lua)
Many development environments and compilers (GNU C++, Visual Studio, KDevelop, but not Eclipse)
Most productivity software (MS Office, Photoshop, Maya/3ds, SolidWorks, Inventor, AutoCAD)
Major web browsers (Chrome, IE, Firefox, Opera... Safari might use substantial amounts of Objective C, though)
Many iOS apps

Many of these have other scripting languages embedded to do some of the work (World of Warcraft embeds Lua, for example), but compiled C++ usually forms the base layer that runs everything else even in these cases.

C is the foundational language of modern computing. C++ is itself usually written in C. When you make a new operating system or new computing hardware, your first task is usually to write a simple C compiler. Once you have that, you use it to create/compile a powerful C compiler, and you use that to build a C++ compiler. From there, you can do anything--the other languages are built on top of this foundation.

You could come up with other systems languages that do the same thing. Practically speaking, however, no one does.

——————————————

I just want to know what I can do with C++.

——————————————

Hi Jello, I am a 22 year old who was really into computers when I was your age. Sadly, I never followed up my desire to really learn C++ when I looked into it at that age. If you want to get into programming, C++ is definitely an important language to learn.

C++ is used to create computer programs! Anything from art applications, music players and even video games. Yes, many video games have been made in C++. Keep in mind though, just like you wouldn't be able to write a book in Spanish after taking a few classes, you won't be making any serious video games right off the bat. Programming, like many skills, takes time. This is something I'm sure many people your age (including me at that age) sadly learn every day.

There are many tutorials out there to teach you C++. The problem is, C++ is not exactly an easy language to learn. You can definitely give it a try, but I'm pretty sure unless you have worked with some other programming language before, it will probably be over your head. I am not trying to talk down to you, but at the age of 12 C++ was a bit over my head. Who knows, you may be the smartest 12 year old ever. Search around google or this site for tutorials. The best way to learn is to read, read, read and program, program, program. Read the forums on this site and see what other people are trying to do. Think of something you want to program, and see if you can figure out how to do it. Start simple and take more chances, this is the way to become a good programmer.

The only way I could really see you getting into C++ at your age would be to find someone who could walk you through the basics and really break it down to you in simple terms. A lot of the people that write programming tutorials seem to forget that not everyone reading is a genius or completely familiar with a lot of programming terms. Either that, or buy a copy of C++ for Dummies.

Hope that helps, if you have any more questions or need me to explain anything, just repost here and I'll answer. Unfortunately, I can't walk you through actually learning C++. Check the forums for that. Anything else, I'll do my best to answer.

Don't be discouraged! Learn programming any way you can! You are never too young to start! In fact, I wish I had started seriously programming at your age and stuck with it. I have a lot of time to make up for! :D

Good luck!

——————————————

If I'm going to learn it, I need to know what it's for :O! And, are there any way a 12 year old can learn this? Thanks!

——————————————

What exactly can I use C++ for?

——————————————

它们从不和人争，只靠实力发声

它们也不强暴着向用户要钱，更像一个值得信赖的伙伴。

——————————————

我发现好多事人生中只做一件就无憾了


比如像许嵩现在出一首歌、创建互动百科、写出ES文件浏览器

还有很多，

——————————————

every months

——————————————

yes

——————————————

https://raw.githubusercontent.com/racaljk/hosts/master/hosts

——————————————

change dns

——————————————

Depression

——————————————

upset

——————————————

all

——————————————

both are ok.

——————————————

creazy people group

——————————————

                      M
                    A   A
                  Y       Y
                B           B
              E               E
                                 
          Y                       Y
        O                           O
      U                               U
                                         
  J                                       J
U                                           U
  S                                       S
    T                                   T
                                       
        N                           N
          E                       E
            E                   E
              D               D
                             
                  A       A
                    V   V
                      .

——————————————

No

——————————————

Y I N G S H A O X O
I I
N   N
G     G
S       S
H         H
A           A
O             O
X               X
O                 O

——————————————

G         T
 O       O
  O     B
   D   O
      R

——————————————

Y E S , T R Y   I T
E
S
,
T
R
Y
 
I
T

——————————————

how to get that?

——————————————

cool

——————————————

5555     2222            000
5           2         0          0
5555        2222         0          0
   5        2            0          0        
5555        2222            000

——————————————

Gaokao is coming...

——————————————

What are you talking about?

——————————————

I don't believe

——————————————

人生毕竟短暂，与其花力气不屑别人、花时间舔舐自己伤口，不如趁早与生活握手言和，与内心所抗拒的这些那些全面和解，专心去活出属于自己的那一份跌宕起伏。

“心中的偏见一旦消弭，即便戴上有色眼镜，世界仍然能够大同”

——————————————

Preprocessing – getting data into shape 


Raw data rarely comes in the form and shape that is necessary for the optimal  performance of a learning algorithm. Thus, the preprocessing of the data is one of the  most crucial steps in any machine learning application. If we take the Iris flower  dataset from the previous section as an example, we could think of the raw data  as a series of flower images from which we want to extract meaningful features.  Useful features could be the color, the hue, the intensity of the flowers, the height,  and the flower lengths and widths. Many machine learning algorithms also require  that the selected features are on the same scale for optimal performance, which is  often achieved by transforming the features in the range [0, 1] or a standard normal  distribution with zero mean and unit variance, as we will see in the later chapters.


Some of the selected features may be highly correlated and therefore redundant  to a certain degree. In those cases, dimensionality reduction techniques are useful  for compressing the features onto a lower dimensional subspace. Reducing the  dimensionality of our feature space has the advantage that less storage space is  required, and the learning algorithm can run much faster.


To determine whether our machine learning algorithm not only performs well on the  training set but also generalizes well to new data, we also want to randomly divide  the dataset into a separate training and test set. We use the training set to train and  optimize our machine learning model, while we keep the test set until the very end  to evaluate the final model.

——————————————

A roadmap for building machine learning  systems 


In the previous sections, we discussed the basic concepts of machine learning and the  three different types of learning. In this section, we will discuss other important parts  of a machine learning system accompanying the learning algorithm. The diagram  below shows a typical workflow diagram for using machine learning in predictive  modeling, which we will discuss in the following subsections:

——————————————

To keep the notation and implementation simple yet efficient, we will make use of  some of the basics of linear algebra. In the following chapters, we will use a matrix  and vector notation to refer to our data. We will follow the common convention to  represent each sample as separate row in a feature matrix X , where each feature is  stored as a separate column. The Iris dataset, consisting of 150 samples and 4 features:

——————————————

An introduction to the basic terminology  and notations 


Now that we have discussed the three broad categories of machine   learning—supervised, unsupervised, and reinforcement learning—let us have   a look at the basic terminology that we will be using in the next chapters. The  following table depicts an excerpt of the Iris dataset, which is a classic example in  the field of machine learning. The Iris dataset contains the measurements of 150  iris flowers from three different species: Setosa, Versicolor, and Viriginica. Here, each  flower sample represents one row in our data set, and the flower measurements in  centimeters are stored as columns, which we also call the features of the dataset:

——————————————

Dimensionality reduction for data compression 


Another subfield of unsupervised learning is dimensionality reduction. Often we are  working with data of high dimensionality—each observation comes with a high  number of measurements—that can present a challenge for limited storage space  and the computational performance of machine learning algorithms. Unsupervised  dimensionality reduction is a commonly used approach in feature preprocessing  to remove noise from data, which can also degrade the predictive performance of  certain algorithms, and compress the data onto a smaller dimensional subspace  while retaining most of the relevant information.


Sometimes, dimensionality reduction can also be useful for visualizing data—for  example, a high-dimensional feature set can be projected onto one-, two-, or   three-dimensional feature spaces in order to visualize it via 3D- or 2D-scatterplots  or histograms. The figure below shows an example where non-linear dimensionality  reduction was applied to compress a 3D Swiss Roll onto a   new 2D feature subspace:

——————————————

Finding subgroups with clustering 


Clustering is an exploratory data analysis technique that allows us to organize a  pile of information into meaningful subgroups (clusters) without having any prior  knowledge of their group memberships. Each cluster that may arise during the  analysis defines a group of objects that share a certain degree of similarity but are  more dissimilar to objects in other clusters, which is why clustering is also sometimes  called "unsupervised classification." Clustering is a great technique for structuring  information and deriving meaningful relationships among data, For example, it  allows marketers to discover customer groups based on their interests in order to  develop distinct marketing programs. The figure below illustrates how clustering can be applied to organizing unlabeled  data into three distinct groups based on the similarity of their features  1x  and  2x :

——————————————

Discovering hidden structures with  unsupervised learning 


In supervised learning, we know the right answer beforehand when we train  our model, and in reinforcement learning, we define a measure of reward for  particular actions by the agent. In unsupervised learning, however, we are dealing  with unlabeled data or data of unknown structure. Using unsupervised learning  techniques, we are able to explore the structure of our data to extract meaningful  information without the guidance of a known outcome variable or reward function.

——————————————

Solving interactive problems with  reinforcement learning 

Another type of machine learning is reinforcement learning. In reinforcement  learning, the goal is to develop a system (agent) that improves its performance  based on interactions with the environment. Since the information about the current  state of the environment typically also includes a so-called reward signal, we can  think of reinforcement learning as a field related to supervised learning. However, in  reinforcement learning this feedback is not the correct ground truth label or value,  but a measure of how well the action was measured by a reward function. Through  the interaction with the environment, an agent can then use reinforcement learning  to learn a series of actions that maximizes this reward via an exploratory   trial-and-error approach or deliberative planning. 


A popular example of reinforcement learning is a chess engine. Here, the agent decides  upon a series of moves depending on the state of the board (the environment), and the  reward can be defined as win or lose at the end of the game.

——————————————

Regression for predicting continuous outcomes 

We learned in the previous section that the task of classification is to assign  categorical, unordered labels to instances. A second type of supervised learning is  the prediction of continuous outcomes, which is also called regression analysis. In  regression analysis, we are given a number of predictor (explanatory) variables and a  continuous response variable (outcome), and we try to find a relationship between  those variables that allows us to predict an outcome.


For example, let's assume that we are interested in predicting the Math SAT   scores of our students. If there is a relationship between the time spent studying   for the test and the final scores, we could use it as training data to learn a model   that uses the study time to predict the test scores of future students who are   planning to take this test.


The following figure illustrates the concept of linear regression. Given a predictor  variable x and a response variable y, we fit a straight line to this data that minimizes  the distance—most commonly the average squared distance—between the sample  points and the fitted line. We can now use the intercept and slope learned from this  data to predict the outcome variable of new data.

——————————————

Making predictions about the future with  supervised learning 

The main goal in supervised learning is to learn a model from labeled training data  that allows us to make predictions about unseen or future data. Here, the term  supervised refers to a set of samples where the desired output signals (labels) are  already known. Considering the example of e-mail spam filtering, we can train a model using a  supervised machine learning algorithm on a corpus of labeled e-mail, e-mail that are  correctly marked as spam or not-spam, to predict whether a new e-mail belongs to  either of the two categories. A supervised learning task with discrete class labels, such  as in the previous e-mail spam-filtering example, is also called a classification task.  Another subcategory of supervised learning is regression, where the outcome signal is  a continuous value.


Classification for predicting class labels Classification is a subcategory of supervised learning where the goal is to   predict the categorical class labels of new instances based on past observations.   Those class labels are discrete, unordered values that can be understood as the   group memberships of the instances. The previously mentioned example of   e-mail-spam detection represents a typical example of a binary classification   task, where the machine learning algorithm learns a set of rules in order to  distinguish between two possible classes: spam and non-spam e-mail.


However, the set of class labels does not have to be of a binary nature. The predictive  model learned by a supervised learning algorithm can assign any class label that was  presented in the training dataset to a new, unlabeled instance. A typical example of  a multi-class classification task is handwritten character recognition. Here, we could  collect a training dataset that consists of multiple handwritten examples of each letter  in the alphabet. Now, if a user provides a new handwritten character via an input  device, our predictive model will be able to predict the correct letter in the alphabet  with certain accuracy. However, our machine learning system would be unable to  correctly recognize any of the digits zero to nine, for example, if they were not part   of our training dataset. 


The following figure illustrates the concept of a binary classification task given 30  training samples: 15 training samples are labeled as negative class (circles) and 15  training samples are labeled as positive class (plus signs). In this scenario, our dataset  is two-dimensional, which means that each sample has two values associated with   it:  1x  and  2x. Now, we can use a supervised machine learning algorithm to learn a  rule—the decision boundary represented as a black dashed line—that can separate  those two classes and classify new data into each of those two categories given its  1x    and  2x  values.

——————————————

The three different types of   machine learning 

In this section, we will take a look at the three types of machine learning: supervised  learning, unsupervised learning, and reinforcement learning. We will learn about the  fundamental differences between the three different learning types and, using  conceptual examples, we will develop an intuition for the practical problem   domains where these can be applied.

——————————————

8. 计量单位


cent
美分

penny
一美分硬币

nickel
5美分硬币

dime
一角硬币

dozen
打（12个）

score
廿(20个)

Centigrade
摄氏

Fahrenheit
华氏

quart
夸脱

gallon
加仑(1 gallon = 4 quart)

yard
码

meter
米

micron
微米

inch
英寸

foot
英尺

minute
分(角度的度量单位，60分=1度)

square measure
平方单位制

cubic meter
立方米

pint 品脱(干量或液量的单位)

——————————————

代数 ALGEBRA


1. 数论

natural number
自然数

positive number
正数

negative number
负数 

odd integer, odd number
奇数

even integer, even number
偶数

integer, whole number
整数

positive whole number
正整数

negative whole number
负整数

consecutive number
连续整数

real number, rational number
实数,有理数

irrational（number）
无理数

inverse
倒数

composite number
合数 e.g. 4,6,8,9,10,12,14,15… 

prime number
质数 e.g. 2,3,5,7,11,13,15…

reciprocal
倒数

common divisor
公约数

multiple
倍数

(minimum) common multiple
(最小)公倍数

(prime) factor
(质)因子

common factor
公因子

ordinary scale, decimal scale
十进制

nonnegative
非负的

tens
十位

units
个位

mode
众数

mean
平均数

median
中值

common ratio
公比




2. 基本数学概念


arithmetic mean
算术平均值

weighted average
加权平均值

geometric mean
几何平均数

exponent指数，幂

base
乘幂的底数,底边

cube
立方数，立方体

square root
平方根

cube root
立方根

common logarithm
常用对数

digit
数字

constant
常数

variable
变量

inverse function
反函数

complementary function
余函数

linear
一次的，线性的

factorization
因式分解

absolute value
绝对值，e.g. ｜-32｜=32

round off
四舍五入数学




3. 基本运算


add，plus
加

subtract
减

difference
差

multiply, times
乘

product
积

divide
除

divisible
可被整除的

divided evenly
被整除

dividend
被除数，红利

divisor
因子，除数，公约数

quotient
商

remainder
余数

factorial
阶乘

power
乘方

radical sign, root sign
根号

round to, to the nearest
四舍五入




4. 代数式，方程，不等式


algebraic term
代数项

like terms, similar terms
同类项

numerical coefficient
数字系数

literal coefficient
字母系数

inequality
不等式

triangle inequality
三角不等式

range
值域

original equation
原方程

equivalent equation
同解方程，等价方程

linear equation
线性方程(e.g. 5x+6=22)




5. 分数，小数


proper fraction
真分数

improper fraction
假分数

mixed number
带分数

vulgar fraction，common fraction
普通分数

simple fraction
简分数

complex fraction
繁分数

numerator
分子

denominator
分母

(least) common denominator
（最小）公分母 

quarter
四分之一

decimal fraction
纯小数

infinite decimal
无穷小数

recurring decimal
循环小数

tenths unit
十分位




6. 集合


union
并集

proper subset
真子集

solution set
解集




7. 数列


arithmetic progression(sequence)
等差数列

geometric progression(sequence)
等比数列




8. 其它


approximate
近似

(anti)clockwise
(逆) 顺时针方向

cardinal
基数

ordinal
序数

direct proportion
正比

distinct
不同的

estimation
估计，近似

parentheses
括号

proportion
比例

permutation
排列

combination
组合

table
表格

trigonometric function
三角函数

unit
单位,位




几何 GEOMETRY


1. 角


alternate angle
内错角

corresponding angle
同位角

vertical angle
对顶角

central angle
圆心角

interior angle
内角

exterior angle
外角

supplementary angles
补角

complementary angle
余角

adjacent angle
邻角

acute angle
锐角

obtuse angle
钝角

right angle
直角

round angle
周角

straight angle
平角

included angle
夹角




2. 三角形


equilateral triangle
等边三角形

scalene triangle
不等边三角形

isosceles triangle
等腰三角形

right triangle
直角三角形

oblique
斜三角形

inscribed triangle
内接三角形




3. 收敛的平面图形，除三角形外


semicircle
半圆

concentric circles
同心圆

quadrilateral
四边形

pentagon
五边形

hexagon
六边形

heptagon
七边形

octagon
八边形

nonagon
九边形

decagon
十边形

polygon
多边形

parallelogram
平行四边形

equilateral
等边形

plane
平面

square
正方形，平方

rectangle
长方形

regular polygon
正多边形

rhombus
菱形

trapezoid
梯形




4. 其它平面图形


arc
弧

line, straight line
直线

line segment
线段

parallel lines
平行线

segment of a circle
弧形




5. 立体图形


cube
立方体，立方数

rectangular solid
长方体

regular solid/regular polyhedron
正多面体

circular cylinder
圆柱体

cone
圆锥

sphere
球体

solid
立体的




6. 图形的附属概念


plane geometry
平面几何

trigonometry
三角学

bisect
平分

circumscribe
外切

inscribe
内切

intersect
相交

perpendicular
垂直

Pythagorean theorem
勾股定理（毕达哥拉斯定理）

congruent
全等的

multilateral
多边的

altitude
高

depth
深度

side
边长

circumference, perimeter
周长

radian
弧度

surface area
表面积

volume
体积

arm
直角三角形的股

cross section
横截面

center of a circle
圆心

chord
弦

diameter
直径

radius
半径

angle bisector
角平分线

diagonal
对角线化

edge
棱

face of a solid
立体的面

hypotenuse
斜边

included side
夹边

leg
三角形的直角边

median
（三角形的）中线

base 底边，底数（e.g. 2的5次方，2就是底数）

opposite
直角三角形中的对边

midpoint
中点

endpoint
端点

vertex (复数形式vertices)
顶点

tangent
切线的

transversal
截线

intercept
截距




7. 坐标


coordinate system
坐标系

rectangular coordinate
直角坐标系

origin
原点

abscissa
横坐标

ordinate
纵坐标

number line
数轴

quadrant
象限

slope
斜率

complex plane
复平面

——————————————

Chapter 1, Giving Computers the Ability to Learn from Data

In my opinion, machine learning, the application and science of algorithms that makes  sense of data, is the most exciting field of all the computer sciences! We are living in  an age where data comes in abundance; using the self-learning algorithms from the  field of machine learning, we can turn this data into knowledge. Thanks to the many  powerful open source libraries that have been developed in recent years, there has  probably never been a better time to break into the machine learning field and learn  how to utilize powerful algorithms to spot patterns in data and make predictions  about future events. 



In this chapter, we will learn about the main concepts and different types of machine  learning. Together with a basic introduction to the relevant terminology, we will lay  the groundwork for successfully using machine learning techniques for practical  problem solving. 



In this chapter, we will cover the following topics: 

• The general concepts of machine learning
• The three types of learning and basic terminology 
• The building blocks for successfully designing machine learning systems 
• Installing and setting up Python for data analysis and machine learning



Building intelligent machines to  transform data into knowledge 

In this age of modern technology, there is one resource that we have in abundance: a  large amount of structured and unstructured data. In the second half of the twentieth  century, machine learning evolved as a subfield of artificial intelligence that involved  the development of self-learning algorithms to gain knowledge from that data in  order to make predictions. Instead of requiring humans to manually derive rules  and build models from analyzing large amounts of data, machine learning offers a  more efficient alternative for capturing the knowledge in data to gradually improve  the performance of predictive models, and make data-driven decisions. Not only is  machine learning becoming increasingly important in computer science research but  it also plays an ever greater role in our everyday life. Thanks to machine learning,  we enjoy robust e-mail spam filters, convenient text and voice recognition software,  reliable Web search engines, challenging chess players, and, hopefully soon, safe and  efficient self-driving cars.

——————————————

What you need for this book

The execution of the code examples provided in this book requires an installation  of Python 3.4.3 or newer on Mac OS X, Linux, or Microsoft Windows. We will make  frequent use of Python's essential libraries for scientific computing throughout this  book, including SciPy, NumPy, scikit-learn, matplotlib, and pandas. The first chapter will provide you with instructions and useful tips to set up your  Python environment and these core libraries. We will add additional libraries to  our repertoire and installation instructions are provided in the respective chapters:  the NLTK library for natural language processing (Chapter 8, Applying Machine  Learning to Sentiment Analysis), the Flask web framework (Chapter 9, Embedding a  Machine Learning Algorithm into a Web Application), the seaborn library for statistical  data visualization (Chapter 10, Predicting Continuous Target Variables with Regression  Analysis), and Theano for efficient neural network training on graphical processing  units (Chapter 13, Parallelizing Neural Network Training with Theano).

——————————————

Chapter 10, Predicting Continuous Target Variables with Regression Analysis, discusses  the essential techniques for modeling linear relationships between target and  response variables to make predictions on a continuous scale. After introducing  different linear models, it also talks about polynomial regression and   tree-based approaches.



Chapter 11, Working with Unlabeled Data – Clustering Analysis, shifts the focus to a  different subarea of machine learning, unsupervised learning. We apply algorithms  from three fundamental families of clustering algorithms to find groups of objects  that share a certain degree of similarity.



Chapter 12, Training Artificial Neural Networks for Image Recognition, extends the  concept of gradient-based optimization, which we first introduced in Chapter 2,  Training Machine Learning Algorithms for Classification, to build powerful, multilayer  neural networks based on the popular backpropagation algorithm. Chapter 13, Parallelizing Neural Network Training with Theano, builds upon the  knowledge from the previous chapter to provide you with a practical guide for  training neural networks more efficiently. The focus of this chapter is on Theano, an  open source Python library that allows us to utilize multiple cores of modern GPUs.

——————————————

Chapter 8, Applying Machine Learning to Sentiment Analysis, discusses the essential  steps to transform textual data into meaningful representations for machine learning  algorithms to predict the opinions of people based on their writing. 



Chapter 9, Embedding a Machine Learning Model into a Web Application, continues with  the predictive model from the previous chapter and walks you through the essential  steps of developing web applications with embedded machine learning models. 



Chapter 10, Predicting Continuous Target Variables with Regression Analysis, discusses  the essential techniques for modeling linear relationships between target and  response variables to make predictions on a continuous scale. After introducing  different linear models, it also talks about polynomial regression and   tree-based approaches.

——————————————

http://www.runoob.com/

——————————————

Chapter 4, Building Good Training Sets – Data Preprocessing, discusses how to deal with  the most common problems in unprocessed datasets, such as missing data. It also  discusses several approaches to identify the most informative features in datasets  and teaches you how to prepare variables of different types as proper inputs for  machine learning algorithms.



Chapter 5, Compressing Data via Dimensionality Reduction, describes the essential  techniques to reduce the number of features in a dataset to smaller sets while  retaining most of their useful and discriminatory information. It discusses the  standard approach to dimensionality reduction via principal component analysis  and compares it to supervised and nonlinear transformation techniques. 



Chapter 6, Learning Best Practices for Model Evaluation and Hyperparameter Tuning,  discusses the do's and don'ts for estimating the performances of predictive models.  Moreover, it discusses different metrics for measuring the performance of our  models and techniques to fine-tune machine learning algorithms. 



Chapter 7, Combining Different Models for Ensemble Learning, introduces you to the  different concepts of combining multiple learning algorithms effectively. It teaches  you how to build ensembles of experts to overcome the weaknesses of individual  learners, resulting in more accurate and reliable predictions.

——————————————

What this book covers

Chapter 1, Giving Computers the Ability to Learn from Data, introduces you to the  main subareas of machine learning to tackle various problem tasks. In addition, it  discusses the essential steps for creating a typical machine learning model building  pipeline that will guide us through the following chapters. 



Chapter 2, Training Machine Learning Algorithms for Classification, goes back to   the origin of machine learning and introduces binary perceptron classifiers and  adaptive linear neurons. This chapter is a gentle introduction to the fundamentals  of pattern classification and focuses on the interplay of optimization algorithms and  machine learning.



Chapter 3, A Tour of Machine Learning Classifirs Using Scikit-learn, describes the  essential machine learning algorithms for classification and provides practical  examples using one of the most popular and comprehensive open source machine  learning libraries, scikit-learn.

——————————————

Reflecting on my personal journey, I can truly say that the study of machine learning  made me a better scientist, thinker, and problem solver. In this book, I want to  share this knowledge with you. Knowledge is gained by learning, the key is our  enthusiasm, and the true mastery of skills can only be achieved by practice. The road  ahead may be bumpy on occasions, and some topics may be more challenging than  others, but I hope that you will embrace this opportunity and focus on the reward.  Remember that we are on this journey together, and throughout this book, we will  add many powerful techniques to your arsenal that will help us solve even the  toughest problems the data-driven way.

——————————————

f you have already studied machine learning theory in detail, this book will show  you how to put your knowledge into practice. If you have used machine learning  techniques before and want to gain more insight into how machine learning really  works, this book is for you! Don't worry if you are completely new to the machine  learning field; you have even more reason to be excited. I promise you that machine  learning will change the way you think about the problems you want to solve and  will show you how to tackle them by unlocking the power of data. 



Before we dive deeper into the machine learning field, let me answer your most  important question, "why Python?" The answer is simple: it is powerful yet very  accessible. Python has become the most popular programming language for data  science because it allows us to forget about the tedious parts of programming and  offers us an environment where we can quickly jot down our ideas and put concepts  directly into action.

——————————————

+ plus 加号；正号

- minus 减号；负号

± plus or minus 正负号

× is multiplied by 乘号

÷ is divided by 除号

＝ is equal to 等于号

≠ is not equal to 不等于号

≡ is equivalent to 全等于号

≌ is equal to orapproximately equal to 等于或约等于号

≈ is approximately equal to 约等于号

＜ is less than 小于号

＞ is more than 大于号

≮ is not less than 不小于号

≯ is not more than 不大于号

≤ is less than or equal to 小于或等于号

≥ is more than or equal to 大于或等于号

% per cent 百分之...

‰ per mill 千分之...

∞ infinity 无限大号

∝ varies as 与...成比例

√ (square) root 平方根

∵ since; because 因为

∴ hence 所以

∷ equals, as(proportion) 等于，成比例

∠ angle 角

⌒ semicircle 半圆

⊙ circle 圆

○ circumference 圆周

π pi 圆周率

△ triangle 三角形

⊥ perpendicular to 垂直于

∪ union of 并，合集

∩ intersection of 交，通集

∫ the integral of ...的积分

∑ (sigma) summation of 总和

° degree 度

′ minute 分

″ second 秒

℃ Celsius system 摄氏度

{ open brace, open curly 左花括号

} close brace, close curly 右花括号

( open parenthesis, open paren 左圆括号

) close parenthesis, close paren 右圆括号

() brakets/ parentheses 括号

[ open bracket 左方括号

] close bracket 右方括号

[] square brackets 方括号

. period, dot 句号，点

| vertical bar, vertical virgule 竖线

& ampersand, and,reference, ref 和，引用

* asterisk, multiply, star, pointer 星号，乘号，星，指针

/ slash, divide, oblique 斜线，斜杠，除号

// slash-slash, comment 双斜线，注释符

# pound 井号

backslash, sometimes

escape 反斜线转义符，有时表示转义符或续行符

~ tilde 波浪符

. full stop 句号

, comma 逗号

: colon 冒号

; semicolon 分号

? question mark 问号

! exclamation mark (英式英语) exclamation point (美式英语)

' apostrophe 撇号

- hyphen 连字号

-- dash 破折号

... dots/ ellipsis 省略号

" single quotationmarks 单引号

"" double quotation marks 双引号

‖ parallel 双线号

& ampersand = and

～ swung dash 代字号

§ section; division 分节号

→ arrow 箭号；参见号

——————————————

If you type "machine learning" as a search term in Google Scholar, it returns an  overwhelmingly large number-1,800,000 publications. Of course, we cannot discuss  all the nitty-gritty details about all the different algorithms and applications that have  emerged in the last 60 years. However, in this book, we will embark on an exciting  journey that covers all the essential topics and concepts to give you a head start in this  field. If you find that your thirst for knowledge is not satisfied, there are many useful  resources that can be used to follow up on the essential breakthroughs in this field.

——————————————

If you want to become a machine learning practitioner, a better problem solver, or  maybe even consider a career in machine learning research, then this book is for you!  However, for a novice, the theoretical concepts behind machine learning can be quite  overwhelming. Yet, many practical books that have been published in recent years  will help you get started in machine learning by implementing powerful learning  algorithms. In my opinion, the use of practical code examples serve an important  purpose. They illustrate the concepts by putting the learned material directly into  action. However, remember that with great power comes great responsibility! The  concepts behind machine learning are too beautiful and important to be hidden in  a black box. Thus, my personal mission is to provide you with a different book; a  book that discusses the necessary details regarding machine learning concepts, offers  intuitive yet informative explanations on how machine learning algorithms work,  how to use them, and most importantly, how to avoid the most common pitfalls.

——————————————

I probably don't need to tell you that machine learning has become one of the most  exciting technologies of our time and age. Big companies, such as Google, Facebook,  Apple, Amazon, IBM, and many more, heavily invest in machine learning research  and applications for good reasons. Although it may seem that machine learning has  become the buzzword of our time and age, it is certainly not a hype. This exciting  field opens the way to new possibilities and has become indispensable to our daily  lives. Talking to the voice assistant on our smart phones, recommending the right  product for our customers, stopping credit card fraud, filtering out spam from our  e-mail inboxes, detecting and diagnosing medical diseases, the list goes on and on.

——————————————

friends

——————————————

https://www.anotherhome.net/link

——————————————

这几天铺天盖地的都是阿尔法狗对阵李世石的新闻。无论李世石最终能否战胜AI，一个显而易见的事实是，我等围棋零段选手倘若对阵阿尔法狗，肯定被虐成渣。

现在阿尔法狗引发了一轮机器学习的新高潮，我估计大家的手机都被刷屏了。反复讨论的几个问题无非是：电脑到底会不会有真正的智能？电脑最终会不会毁灭掉人类文明然后由机器人统治地球？

讨论这种问题跟讨论哲学问题一样，包括霍金在内的智商最高的一群科学家都无法达成共识。

我个人的看法是，假设宇宙中诞生过很多文明，其实他们的发展过程和人类文明都是一样的：首先诞生生命，然后进化出智能物种，智能物种创造了计算机并致力于发展AI，AI最终超越了智能物种并自己统治了行星。由于AI进化实在太快，他们开始试图直接获取恒星的能量，但宇宙定律不会因为AI太聪明而改变。AI能力再强也无法100%模拟亚原子级别的核物理实验。在真正的亚原子实验中，恒星爆炸了，整个星系连同AI文明一同被摧毁。

你看，文明的发展就是这么简单：单细胞生物，多细胞生物，智能生命，AI，智能生命被AI毁灭，然后AI毁灭了星系，一个文明结束了。

你问我有什么证据，愚蠢的人类啊，过去若干年人类观测到的每一次超新星爆炸都是一个AI文明的结束，这就是为什么外星人无法到访地球的原因了：他们早把自己搞死了。

以上胡扯结束，下面开始做广告。

话说阿尔法狗的机器学习超能力也不是搞着玩的，毕竟要大把大把地砸钱啊。有可靠的谣言称Google对自己招聘的机器学习专家开出了200多万美金这种惨无人道的天价年薪。不要忘了Google也是资本家在管理，怎么会投资只赔不赚的事情？下一步，他们就要用机器学习来大把大把地赚钱了。怎么赚？凡是机器学习可以解决的问题，人就可以下岗了，毕竟是机器，不拿工资不上保险，不吃不喝只费电，在中国也就网费稍贵点，也不是大问题。

现在大问题来了：未来的若干年内，哪些人的工作会被有机器学习能力的电脑取代？

其实简单思考一下就会明白，凡是不用动脑子，整天干重复性劳动的岗位就会消失。

打个比方，假如你是一个小编，每天负责在网上收集段子然后发到公众号，这个工作就很危险，因为给用户定向推送的机器学习程度都不需要达到阿尔法狗的水平。但是段子手这个工作就不会被机器取代，类似不会被机器取代的还有搞绘画的艺术家，电影导演等等，简单地概括就是，从事创造性工作的岗位永远不用担心被机器抢了工作。

软件工程师也不用担心，因为写程序也是一种创造性的工作。有人担心将来机器学习发展成电脑会自己写程序了怎么办，这实在是杞人忧天。如果你仔细阅读了上文，就会发现，当软件工程师的工作被电脑取代时，地球就即将被AI统治，太阳系离毁灭也不远了。所以说，写程序将是世界上最后一个消失的工作。

从事一种地球上最后一个消失的行业绝对是一个明智的选择。如果你想以小白的身份进入这个行业，不妨从小白的Python新手教程开始，零基础起步，将来成为机器学习的专家。

——————————————

OReilly 免费电子书打包



http://pan.baidu.com/s/1gfvxKiR

——————————————

If I'm SX, SX, SX, SX, SX~

——————————————

不知道你的朋友圈里有没有这种人。

他们是朋友圈里的尖子生，学什么都比别人快，做什么事都比别人好，哪怕是玩也能玩出花样，简直优秀到欠揍。如果你就是这种人，请直接跳到文末点赞。

这篇文章是写给另一种人的，也就是看到这里的你。除了看莫二的文章的以外，你还喜欢看屁股。工作时你追着老板的屁股跑，学习时你追着学霸的屁股跑，休息时你追着朋友屁股跑，其他时候你都追着时间的屁股跑。


你比很多人都要勤奋，至少看起来是这样。得到的却并不比人多，一个屁股也没追到，还差点把自己熏死。你很困惑，甚至开始怀疑人生。解开这个困惑，不难，你需要明白“少即是多”的道理。


1.少即是多
“少即是多”——这是很多鸡汤文学惯用的句式，似乎只要把两个反义词放进同一个句子里，瞬间就镀金镶钻，逼格满满。比如：你的优势就是你的弱点；愚蠢是最大的聪明；孤独是一个人的狂欢。这样的句子多半都是扯淡，但也不乏一些深刻的哲理。

抱着这种期待，我尝试去理解“少即是多”背后的意义。

“less is more”最早是由德国建筑大师密斯·凡德罗提出，主张去繁从简。在建筑的设计中，追求从整体到细部的极简主义。去除杂乱无章的装饰、无中生有的变化、奇形怪状的摆设，空余轻灵通透的流动空间。

细思之下，其实这个理念古已有之，而且无处不在。国画讲究惜墨如金，简洁的笔触、大片的留白，为想象预留出驰骋的空间。文学创作中，越是朴素的语言越能描绘出真挚的情感。服装设计中，那些经久不衰的流行元素无不诠释着简洁的内涵。

《小王子》的作者圣埃克苏佩里也说过同样的道理——至臻完美之时，不是加无可加，而是减无可减。

“少即是多”的意思，就是删去那些无意义的附缀，只保留真正有价值，重要的部分。可是我们又该如何评判哪些才算是无意义，哪些又是有价值的部分呢？


2.明确目标
几十年前，人们最大的痛苦就是没有选择，而现在选择太多似乎也变成了一种痛苦。

起初我认为，这是因为人天生就惧怕选择。我曾在文章中多次提到人脑是认知“吝啬鬼”，怎么省力怎么来。做选择又很费脑力，这个解释合情合理。比如买手机时，很多人宁愿把选择权直接交付给苹果，也不愿自己陷入纠结。

后来我发现痛苦的根源并不是选择太多，这一点可以通过经典的“沙堆悖论”来证明。

如果1颗沙粒不叫沙堆，那么2颗沙粒也不叫沙堆。如果2颗沙粒不叫沙堆，那么3颗沙粒也不是沙堆。以此类推，即使1万个沙粒也不是沙堆。
要破解“沙堆悖论”必须规定一个界限。只要超过界限，量变就发生质变，沙粒就变成沙堆。也就是说，一旦选项的数量超出了某个界限，就触发了选择困难症。现实中我却找不到这样的界限，即使只有两个选项，依然有人无法抉择。难道只有一个选项时，我们才知道如何选择吗？这未免太扯。

我逐渐意识到了一个更深层次的原因，那就是我们根本不知道自己需要什么。可如何才能确定自己需要什么呢？问题似乎又回到了原点。

我是个对信息极度饥渴的人，关注了很多公众号，经常看的却只有那么几个。那些不看的公众号右上角都有个小红点，像一只只哭红的眼。眼里是一个数字，记录着我们分居的日子。数字与日俱增，我却始终不忍心与它们彻底决裂，毕竟爱过。

前段时间公众号开通了置顶功能，我置顶了5个，瞬间感觉解脱了。也突然明白了，原来每个人都知道自己需要什么，只是没有意识到。这种需求或者埋藏在潜意识里，或者被过多的选项所蒙蔽。

微信用置顶服务为你搬了一次家，搬进了一个更小的房间。这个房间里放不下太多东西，这时你突然意识到原来你买了那么多没用的东西，甚至觉得自己的男朋友都变成了身外之物。

我们又该如何为自己搬一次家呢？不需要搬家公司，只需要一个清晰的目标，重音落在“清晰”，清晰的就像已经发生在你的眼前。


我想提高自己！我想考个好大学！我想找个好工作！这些都算不上清晰。怎样才算是提高自己？好大学的具体定义是什么？工作好坏的标准又是什么？太过抽象的目标只会导致一连串的疑问，没有任何指导意义。

这个目标要绝对的清晰，比如像这样：我想找个20岁，身高165，体重45公斤，长发，颜值85分，D罩杯，性格开朗，爱看美剧的妹子。你要在大脑中清晰的勾勒出她的音容笑貌。

有了这个目标之后就够了吗？当然不够，你还要剔除那些与目标无关的干扰。


3.剔除干扰
干扰是泛滥在你朋友圈里的微商，充斥在淘宝里的假货，常年占据百度搜索结果前几名的虚假广告。

有些干扰显而易见，有些却难以盖棺定论，它们和主题有关，关系又不是很紧密，食之无味，弃之可惜。

微信聊天里的表情功能算不算干扰呢？删了表情天也照样可以聊。

文学创作中所用的修辞手法算不算干扰呢？不用修辞文章也照样可以写。
如何判定一个信息是可剔除的干扰，是否有一个统一的标准？这个标准就是我们所说的效率。

人是追求效率的动物，我们生活中的一切发明基本上都是为提高效率而生。比如汽车是为了提高空间移动的效率，网络是为了提高信息流通的效率，简书是为了提高你写作的效率。

讽刺的是，现实中有很多人却沉湎于低效的事而不自知。如果你去问一个低头族，他为什么连走路都要玩手机，他会告诉你他是在合理利用时间，抓住一切机会上网、学习或者撩妹。


别被他唬住了，他之所以看起来这么勤奋只是因为他效率低。为了弥补自己效率低的事实，他投入更多的精力去关注很多无用的干扰，而这些干扰又降低了他的效率，从而进入恶性循环。

小孩才讲究勤奋，大人只追求效率。用行动上的勤奋弥补思想上的懒惰，并不能提高效率，只能让你自我安慰罢了。

想要提高效率，你首先要知道什么才是效率，效率=回报/时间，效率高说明同样的成本，得到的回报越多。这个道理说出来大家都懂，却又经常忽略了一个最基本事实——成本并不是金钱，不是面子，不是其他的任何东西。

成本有且仅有一个，那就是你的时间。

多少次你为了节省钱，买了一堆并不怎么喜欢的衣服，它们已经占领了你的衣柜，它们的领土还在急剧的扩张。它们守卫森严，机关重重。每次你至少要花上10分钟才能解救出那条心爱的裙子。

多少次你为了节省粮食，即使吃饱了也要硬着头皮和肚皮吃完。却从没意识到，它们就这样变成了你脂肪。为了甩掉它们你办了一张年费5000的健身卡，虽然很少去，但是为了心安理得，每个周末你都要在健身房耗上一下午。

多少次你为了节省一张电影票、一顿饭，或者你那薄如蝉翼的面子，不愿邀请你暗恋已久的同事。你在手机里下载了微信、陌陌、探探、抱抱。奋斗了三个月，你到是约出来一次炮，最后哭着打完，打完后手机还丢了。
上学时，老师都会这样给我们洗脑，时间就是金钱，一寸光阴一寸金。当时没人相信，现在就更不信了。时间可比金钱贵重多了，我们可以挽回失去的钱，却永远无法挽回失去的时间。

我想你应该可以回答先前提出的问题了。微信聊天功能中的表情是不能删除的，事实也证明了这一点。几乎所有的社交软件都有表情功能，因为在表达特定的情感或想法时，表情显然更有效率，一个表情可以让你少打不少字。比如像这样：


同理，文学创作中的修辞也是必不可少的。先不说一些修辞手法在心理学层面上顺应了大脑的认知规律（如生动性效应、汤姆索亚效应），修辞可以让读者更好的领会你所要表达的意境，让语言更加立体丰满。这个层面上它是高效且必须的。当然太丰满了也不好，过度的堆砌华丽辞藻，反而会给读者的理解造成干扰。


4.开始改变
“少”并不是一种损失，也不是让你做出牺牲，而是剔除那些无关的，低效的干扰。让你有更“多”的时间和精力，专注去做那些你真正想做的事。

起初你可能会有点不舍，毕竟它们已经陪伴了你很久，已经成为了你身体的一部分，你的赘肉，你的肚腩。

也正因为如此，不要以为看完这篇文章，懂得了“少即是多”的道理，你就能轻易的甩掉他们，改变是一个过程，重要的是你要开始改变。

那些长年不穿的衣服就捐了吧；那些很久不看的公众号就删了吧；那些没那么喜欢的人就别撩了吧。

生活不是监狱，爱情也不是围城，先把身上枷锁卸了吧。

——————————————

But maybe you should look at this:

http://www.itingwa.com/u/126943/tingshuo/

——————————————

Good music about a girl.

http://www.itingwa.com/u/126943/music/

——————————————

God GA

God GA GA GA GA GA

——————————————

e...

Here you can exercise your typing skill:
https://www.typingclub.com

——————————————

That will error.
2.9 is ok.

——————————————

来，今天给你不一样的充“电”方式！:
http://pan.baidu.com/s/1i4N33H7

音乐间谍V2.9:
http://pan.baidu.com/s/1pLmtHQ7

——————————————

http://www.williamlong.info/archives/4579.html

——————————————

Trust me, nothing can compared with copying others available codes, can make a man happy.

——————————————

here it is:

链接: http://pan.baidu.com/s/1slUUJjZ 密码: jpe6

——————————————

But youtube is a safe place.

Yeah, right there.

——————————————

I'm fear the law.

——————————————

What I should do?

——————————————

Should

——————————————

I made a video by premiere.

But it's so sex.

It's about my female classmate.

Now, I'm wandering if I could send it to YouTube or Bilibili.

——————————————

Bulit a wordpress is so easy, I think

——————————————

Papapa

——————————————

Link!

——————————————

I'm lazy at everything.

That's stupid to me.

But I can't help.

——————————————

Hey guys, 

am…

I totally think I'm an asshole.

——————————————

你想啊，没精力能做什么啊

——————————————

做结扎手术才是脱贫致富的唯一手段。

哈哈哈哈

——————————————

现在我的脑子不断冒出色情画面

想要催使我去撸





但我不能，我要把最近锻炼身体产生的精力留给学习、留给高考


但我知道我不会抵抗太长时间


以前无数次的失败告诉我最后一定会禁不住诱惑，下载xx，边看边撸，最后一秒激情，赢来无尽的虚弱与疲惫与孤独

😔没救了

——————————————

星爷说：做人如果没梦想(不折腾)，和一条咸鱼(死鱼)有什么区别

——————————————

问: 背单词软件有大概多少人注册第一天都没有背完嘛?
答:68.15%

问:有多少人是在坚持或者曾经坚持过背单词呢?(假设100天以上算的上是背单词的话)
答:保守估计,不足3.4%

问:有多少梦想,毁于不能坚持?
答:不妨干了这碗鸡汤,歌唱青春一去不复返.

问:背单词的人们学习的量,是不是符合正太分布呢?
答:不是,简直就是反比例函数.

抛出一个结论:

以绝大部分人努力之低,根本就用不着拼天赋.

赠给你我,共勉.


http://python.jobbole.com/84526/

——————————————

妈蛋，决心做个程序员。

方便面矿泉水已备好！学校不支持...辍学...盆友不支持...友尽...老婆不支持...离婚...小孩不支持...已送孤儿院...备用电源百兆光纤4g无线，永不断电断网！门口已埋雷，无人打扰。

——————————————

恭喜

——————————————

all of you

——————————————

mental

——————————————

你们都不是精神病


加进来干嘛

——————————————

#!/usr/bin/python3
# -*- codeing : UTF-8 -*-
import requests#调用requests
from bs4 import BeautifulSoup#调用BeautifulSoup

import io
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')#改变本地标准输出的默认编码；p.s:易语言就是这么干的，支持多数中文，避免乱码（使用IDE就不用以上三行）


def from_web_get_html(goal_website, from_website):
       true_host = from_website.replace('https://','').replace('http://','')#得到没有http的网址
       headers = {'Host':true_host,'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36','Accept-Encoding':'gzip, deflate, sdch','Accept-Language':'zh-CN,zh;q=0.8'}#伪装成浏览器
       html = requests.get(from_website, headers)#从原始地址，
       old_cookie = html.cookies#得到cookie
       html = requests.get(goal_website, headers=headers, cookies=old_cookie, allow_redirects=False)#用旧的cookie访问新地址
       html.encoding = 'utf-8'#转换下编码 
       result = html.text
       return result#返回网页源码

html_text=from_web_get_html('https://www.baidu.com/s?wd=hello&gpc=stf%3D1428837022%2C1460459421%7Cstftype%3D1', 'https://www.baidu.com')#通过给目标地址，和老的跳转地址得到源码

soup = BeautifulSoup(html_text, "html.parser")#调用强大的BeautifulSoup进行网页源码处理
#print (soup.title.text)#得到标题
#print (soup.prettify())#得到整理后美观的源码
print (soup.body.text)#得到网页主体内容





#参考资料：
#https://jecvay.com/category/smtech/python3-webbug
#https://www.crummy.com/software/BeautifulSoup/bs4/doc/index.zh.html
#http://blog.csdn.net/jim7424994/article/details/22675759
#https://www.google.com

——————————————

软件需求分析：

1.首先，设定搜索关键词

2.然后，从搜索引擎第10页往后遍历

3.如果页面检测到网页同时包含百度盘链接与关键字密码
就将该链接与密码记录并有序写入txt文本

4.假设限定采集到7条信息后停止采集

5.输出给用户


改进第3点：
必须只含一个百度盘链接和一个关键词密码。取关键词密码后4位，不满4位遇空格则舍弃该页。


改进第3点：
同时提取网页标题


~~~~~~~~~~~~~~~~~~~~~~~~~~~~


原理分析：

1.需要寻找文本中的某个特定字符，得到它出现的次数，得到它本身或其后字符；可考虑使用正则表达式或核心字符操作库

2.需要得到一个网址的源代码；考虑用自带网络库或requests中的GET函数

3.需要了解搜索引擎的翻页方式，以便正确得到10页后的网址


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

模块分解：

一、得到网页源码

import requests #导入某网络模块

html = requests.get('http://www.dydog.org/star.php') #填入某网址

html.encoding = 'utf-8' #转码

print(html.text) #输出网页源码

************************

import requests

def from_web_get_html(website):
       headers = {'Host':'www.baidu.com','Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36','Accept-Encoding':'gzip, deflate, sdch','Accept-Language':'zh-CN,zh;q=0.8'}
       html = requests.get(website, headers)
       html.encoding = 'utf-8' 
       result = html.text
       return result
       
       
~~~~~~~~~~~~~~~~~~~

二、判断一段文本中是否含有一个http://yunpan.cn/和“码”

A_text = ''''
http://pan.baidu.com/s/1dDnqRdB 
访问码l20i'''#只有一个百度盘地址
B_text = '''
http://pan.baidu.com/s/1dDnqRdB 
访问码l20i
http://pan.baidu.com/s/1dDnqRdB 
访问码l20i'''#有多个百度盘地址

test_text = B_text#测试哪个文本
web_number =test_text.count('http://pan.baidu.com/s/')#百度盘链接个数
pass_number = test_text.count('码')#“密码”出现的次数

if (web_number == 1 and pass_number == 1):
    print ('true')#满足条件则输出ture
else:
    print ('false')

************************

def include_i_want_or_not(text):
       web_number = text.count('http://pan.baidu.com/s/')
       pass_number = text.count('码')
       if (web_number == 1 and pass_number == 1):
           return True
       else:
           return False
           
三、提取该网页的标题，百度盘链接以及密码

import re #导入正则表达式库 

title=re.search('<title😠.*?)</title>',html_text,re.S).group(1)#用正则表达式取第一个标题

先用find()找到http://pan.baidu.com/s/第一次出现的位置，
然后该位置+22，得到22到30的字符

密码同理

text='''
456456http://pan.baidu.com/s/1bnF6G0n465453密码：6fme罚款或控股卡怪'''

first_num = text.find('http://pan.baidu.com/s/')#得到这个链接第一次出现的位置
goal_num = first_num+23#将这个位置加上它本身的字符数23
print (text[goal_num:goal_num+8])#然后取得从目标位置到其后8位的字符（独一无二的字符，我们只需要它，貌似是短链接）

print ('\n')#换个行再说

first_num = text.find('码')
goal_num = first_num+2#将这个位置加上它本身的字符数2
print (text[goal_num:goal_num+6])#然后取得从目标位置到其后6位的字符（也就是访问码啦?）


************************

import re

def get_title(html_text): 
    title=re.search('<title😠.*?)</title>',html_text,re.S).group(1)
    return title

def get_words_after_special_words(txt,words,number):
    words_len = len(words)
    first_num = txt.find(words)
    goal_num = first_num+words_len
    return txt[goal_num:goal_num+number]


四、研究如何利用搜索词爬取搜索引擎，得到无尽的网页地址

https://www.baidu.com/s?wd=hello
发现不管怎么伪装，都会被百度跳到首页，求大神解答

——————————————

问一下，为什么我用python伪装了heards后

Get百度搜索，仍然会跳到首页？

——————————————

得好好看看大神的笔记

http://digitalman.blog.163.com/blog/#m=0&t=1&c=fks_085067085084086066084094094095086085089068080080086070082

——————————————

突然发现好多模型啊

太兴奋了

http://hackadoll.com/mmd

——————————————

http://www.nicovideo.jp/watch/sm27867085




有没有日文大师，帮忙下载模型...

——————————————

学C4D不要走错路

B站就有教程

http://www.bilibili.com/sp/CINEMA%204D

——————————————

看到那些妹妹好眼馋，可惜一个都不能用

——————————————

http://il0venaughtyfins.deviantart.com/art/Project-Diva-Arcade-Megurine-Luka-DOWNLOAD-373342553


这里发布的好像是贴图文件什么的

——————————————

http://tf3dm.com/3d-model/sentinel-lingerie-61135.html

没有C4D的，好可惜

——————————————

看完第三遍觉得自己没救了

——————————————

海上钢琴师传递的消极信息太强了

我差点招架不住

——————————————

压力大就睡不着，
睡不着状态就不好，
状态不好就做不好事，
做不好事压力就更大，
…一直恶性循环…


不要让这事发生，学会平静，安然入眠。

——————————————

领域不同，完全不同

——————————————

就算是程序员

也不是互相了解

——————————————

也不能在php服务器上运行

——————————————

也不能在unix上运行

——————————————

讨厌编程，太烦了

windows上写的不能在ios上、Android上运行

——————————————

http://m.jb51.net/article/36447.htm

——————————————

①使用Windows API函数Load Library或者MFC提供的AfxLoadLibrary将DLL模块映像到进程的内存空间，对DLL模块进行动态加载。

②使用GetProcAddress函数得到要调用DLL中的函数的指针。

③不用DLL时，用Free Library函数或者AfxFreeLibrary函数从进程的地址空间显式卸载DLL 

——————————————

显式调用

——————————————

这绝对降低学习难度

——————————————

我想我可以不学这些，只需要知道c++怎么调用dll

然后其他事交给易语言

——————————————

c++不好玩，到现在都不知道窗口怎么建

不过如果只是命令行(控制台)，然后能用GET取网页源码的话

还是可以考虑用c++的

——————————————

求大神天天发干货

——————————————

要死了，telegram没活力了

——————————————

我觉得我还是喜欢花UI

——————————————

想读心理学，发现要求分数挺高

——————————————

python

——————————————

ss+bot+php

不知道有没有可能

——————————————

准备买个vps了

——————————————

我已放弃国内

——————————————

官方的

——————————————

git上有什么关于人工智能、深度学习、大数据分析的开源项目吗？最好python

——————————————

5:30起

6:30街灯关，回

——————————————

#!/usr/bin/python3
# -*- codeing : UTF-8 -*-
import telepot  #引入机器人模块；如果没有，请在命令行写入pip install telepot 和pip install telepot
import time  #引入时间模块；如果没有，请在命令行写入pip install time

#如出错，请在python的安装目录下寻找pip.exe，将其拖入cmd窗口，再加上空格+install+空格+模块名


bot = telepot.Bot('121899714:AAFyTKIRyn3u3MCi_7DUBIDHFoABcahPM-Y')  #设置密匙(访问令牌)
#print (bot.getMe())  #得到这个机器人的信息

def handle_message(msg):  #这个函数用来接收新信息
       content_type, chat_type, chat_id = telepot.glance(msg)  #分别得到消息类型、聊天场所、聊天id
       print(content_type, chat_type, chat_id)
       print(msg[u'chat'][u'id'])  #输出聊天id
       print(msg[u'text'])  #输出消息内容
       bot.sendMessage(msg[u'chat'][u'id'], msg[u'text'])  #回复发送同样的内容
       
       #f = open('C:\\YS.png', 'rb')  #打开某个本地文件，并取得字节集
       #bot.sendPhoto(msg[u'chat'][u'id'], f)  #然后发给别人，同理还有sendAudio(), sendDocument(), sendSticker(), sendVideo(), and sendVoice()


bot.notifyOnMessage(handle_message)  #关联上面那个def函数用到的代码



while 1:  #为了保持程序运转，十秒一次
    time.sleep(10)

——————————————

深入py就发现很多以前从未听说过的词语

——————————————

额，这群没有小雅

罢了，等功能完善与稳定后再加进来

——————————————

go 1

——————————————

哈哈，其实有人做出q群与q群之间的聊天工具了

——————————————

跑步6点半起来暗了，路上已全是车，灰尘大，对身体反不好

明天5：30起来

——————————————

早上好

——————————————

不牛，痛苦死了，高考都搞不定

估计还要用"我要当学霸"来约束自己

——————————————

clam down, 睡觉是保持头脑清醒的最好方法。

——————————————

我竟然把它看完了

https://read.douban.com/ebook/3069929/

——————————————

In anyway, master maths and English is the only way for becoming a greatest programmer.

——————————————

http://www.pdfshu.org/?fenlei/20

——————————————

我认为那是个历史学名词

——————————————

命运共同体的构建，确实能解决一些一个人做不下来的事。

——————————————

但坏人成本太高

http://bookdl.com/

——————————————

真想做坏人

http://it-ebooks.flygon.net/

——————————————

我也希望最后100天有个聪明美丽的同龄妹子陪着我，

可现实确是，my mon.😒

——————————————

but i had baiduyun.

——————————————

no money

——————————————

有道理

——————————————

昨天在网上找了下中国黑客网站

好失望，没一个有用

——————————————

但你们有几个没结婚的能说自己不孤独？

——————————————

精神病人是很孤独的

——————————————

无情人

——————————————

每次看到都会有点伤心

——————————————

要是能把离群的消息屏蔽就好了

——————————————

ok, the spirit world.😊😃

——————————————

原来任何相对势力都是对抗的

技术升级还是对抗

没有哪方会真正胜利

只是暂时的高低

正是这种相互的对抗，赋予了这个世界丰富多彩以及无穷的活力

😉

free世界真的不完全存在

——————————————

oh,

——————————————

加进来的全叫returned

真以为我认不到英语😂

——————————————

会不会游戏才是理想主义者的归属？

http://bestcbooks.com/categories/you-xi/

——————————————

于是就有了这个群

——————————————

我说既然都这样了，干脆建个群来疯

——————————————

I always do something that normal people don't want to do.

——————————————

我老早就被人说有强迫症

——————————————

想说中文就中文，想说英文就英文

——————————————

我随意

——————————————

you can speak chinese

——————————————

no

——————————————

want change this world

——————————————

mad

——————————————

https://github.com/yu4u/age-gender-estimation#usage

It works pretty well

——————————————

还有就是

社会出了事不能怪政府

是人民自己无能，没有自主意识—>去设计一套解决问题的系统

——————————————

我突然觉得大学的考试是个笑话(一个努力学习一个学期的人和努力作弊2、3天的人 没差几分)

以后谁也别让我考 60<x<65

——————————————

我还是要提醒自己，不要装逼

不要犯大多数中国人犯的问题




只有脚踏实地，把每件事都做到最好

事情才能有转机

——————————————

经过这几天的大学期末考试

我了解到了：通过 对机器学习基本原理的掌握 和 不断的学习训练 ，我们可以随意控制自己的学习行为，

快可在一个晚自习掌握 一整本书(documents)(但会快速忘记)，

慢可以一个学期入门 一个新领域(subject)(永生难忘)

——————————————

和性癖没关系


经过这几年的思考，我觉得这是男人植入基因的天性：

通过腿，特别是大腿内侧的质量，推测逼的质量，(从而暗地里评估生育能力或家境，表面上只想make love，实际上被基因利用造人

——————————————

http://music.163.com/song/1345171/?userid=280429778

——————————————

另外，语言改来改去都是对表达方式的抽象，从而简化代码(对初学者怕是增难)

—— 观ES5语法到ES6有感

——————————————

算了，django + bootstrap 就够用了


其他都是过度设计





用vue也没感觉效率有提升

还是得从server得到json，再渲染

——————————————

别急，我再去看看vue

总有一个适合我

——————————————

学了一会儿 react

怎么老感觉这些 js framework 与 django 冲突呢？





https://gearheart.io/blog/7-best-frameworks-for-web-development-in-2017/

他们总是觉得前后端可以分开开发

但我怎么觉得合不起来？

——————————————

{}

——————————————

(暑假)总线路：自主创业(建立一个超级屌的网站)，django是总框架

网站UI需要用到 (未知框架，暂时只有 bootstrap) 

网站内容采集需要 精通modern爬虫，需要机器学习做大量的classification，所以需要用到 keras, tensorflow.js

——————————————

web crawler 和 data science, machine learning 不冲突

web crawler 和灰产，自主创业，建网站不冲突

行吧，这也是暑假的一条主线




总结一下：

——————————————

我估计国家强制要求实名制就是要治理水军


所以干灰产，自己掌握几十万账号的时代似乎已不复存在(不对啊

像全民k歌、抖音那些刷收听、粉丝、评论的大有人在


我甚至看到有刷github星星的


我怎么那么弱(建筑者 比 破坏者和渗透者弱？))

——————————————

有时候想想，找份网络兼职，再做自动化脚本，不也是实现梦想的一种方式吗？



numb 有经验可以分享吗？

——————————————

要想留住梦想

就要把梦想变成现实或者让梦想与现实融合

保证你 实现梦想的过程 = keep you alive 的过程

——————————————

I got no plans in this summer,


but get started or stuck with django, keras, javasript ES6

——————————————

https://youtu.be/4KcMdH8qiuk

要和genius做朋友

——————————————

https://realpython.com/python-youtube-channels/


这让我想起了多年前我的愿望：讲一口流利的英语

实现了，但只是口语，词汇上很难突破5岁小孩

——————————————

https://youtu.be/_wZeGANhWTg


挣钱真是一件需要脸皮(忍耐力、无耻(不惧挫折))的事


所以说做销售的容易成功

——————————————

还有一点就是

就是要懒




越懒越好，能用别人现有的框架绝对不自己写

不然一辈子都写不完一个自己喜欢的项目

——————————————

Search text recursively in a folder:


grep -Rl keyword .

——————————————

解决了

自动语言转换，包括表单





但是django的思路很复杂(乱)

有空再写篇博文来讲这个事情吧

——————————————

https://medium.com/@nolanphillips/a-short-intro-to-translating-your-site-with-django-1-8-343ea839c89b


It makes sense.

——————————————

每次都是遇到 django 的中文化问题

别说转换默认的 django form




就连普通的 translation 我也不会啊

django官方的教程讲了半天也没重点，还是没告诉你怎么一步一步国际化 your website

——————————————

越到期末越讨厌SB的、每晚发出噪音打扰我睡眠的、疯狂玩游戏的室友们

这周还有数学、模电、通信原理

考完就放假了

——————————————

另外，Age detection是我下一个AI project

我的创业项目需要用到它



https://www.analyticsvidhya.com/blog/2017/06/hands-on-with-deep-learning-solution-for-age-detection-practice-problem/

——————————————

创业真辛苦

我怕是得系统的学一下(modern)爬虫




不然就没有资源给用户了

——————————————

还有


我觉得才能这事还真不是装出来的




既然自身硬件不行，那就尽量找优质data(优质英文书)

每天啃还怕时间不够吗？别人两小时，我们用10天嘛！

——————————————

并且我现在 1 hundred percent sure that I 不能在面对面的传统行业取得任何收益

只能在拼效率的远程交易中去争取一席之地

——————————————

反正要到美国去得先在中国证明自己的能力

积累大量的资金才行

——————————————

另外

我领悟到了




要是真正厉害，何必在乎在美国开发还是在中国开发呢？

——————————————

我的项目确实需要一个精通网络安全的白帽子(渗透专家)

没准我们以后还是有合作机会

——————————————

看完了

——————————————

不知道为什么，感觉pdf显示不完整，10章后不想跟着做了

直接阅读，后面自己做项目再来参考源码

——————————————

目测是默认的 flask server 问题，因为默认timeout为forever，容易让client在保持连接一段时间后无法访问网站

后来bash脚本里加了gunicorn并设置timeout=600，十分钟断一次，用户可以随便重连

——————————————

https://wsvincent.com/best-react-books/

——————————————

https://github.com/wsvincent/djangoforbeginners

Codes for it

——————————————

Content Delivery Network

CDN

——————————————

铁路肯定会凉

就和我之前的直觉一样，我必须得找到我自己的路




(父母、亲人、现实中的朋友的视野都太过浅薄)

——————————————

不对

你这个能看是什么意思，有demo吗？

——————————————

我本来还指望你一起创业呢

我就是一后端菜鸟

——————————————

没什么比踏踏实实干事更能让人感到心安的了

——————————————

Check out @codinghorror’s Tweet: https://twitter.com/codinghorror/status/1012826992696102912?s=09

——————————————

买了一根 1000m/s 的短网线

还没送到，这个项目要搁置





正事等我学完 django 那本书再弄

——————————————

Fine

You will find your path sooner or later

——————————————

So you are a hacker?

——————————————

@Hex11 

那你呢？

你应该是 精通前端设计的吧(CSS JavaScript stuff)？

——————————————

Don't look down on yourself.

——————————————

诶～

Are you serious?

——————————————

说到创业

你是不是只会开发Windows的东西？

——————————————

小兄弟(还有陪我几年的其他小兄弟

我们是绑在一起的蚂蚱





出线的唯二机会就是尽可能增加实习经验(还有就是创业)

所以有什么招实习的消息一定得告诉我啊😊

——————————————

发完了一堆东西后才发现

过期了😞





截止6.20

——————————————

但我认为这是一个获得人脉和未来工作机会

以及提高工作能力的好机会

——————————————

我要不要报名

——————————————

@gyjclub or @freeshadowsock

So, with FreeBrowser, we will never get out of date.

——————————————

LyingDown 卡顿问题 已修复

——————————————

https://ys-blog.herokuapp.com/

After doing this with django, I think using flask for developing any user system is a wrong idea. 

mathchat should never use flask indeed.

——————————————

看了 《猛龙怪客 Death Wish》

Man show

——————————————

构建一套系统真的没那么容易

比如 找工作APP





如何构建一个诚信机制，既能让没有任何认证的人找到工作，又不让企业吃亏



(淘宝是怎么做的？让人数少的想赚钱的商家交保证金，人数多的消费者不交钱；

当把这一套逻辑放在程序员身上，各种问题：

万一公司想空手套白狼招人免费干活怎么办？

万一有一些傻逼啥都不会恶意给企业差评怎么办？

万一有企业派人刷好评洗白怎么办？

这些都是问题)

——————————————

真无聊

我这个年纪果然不适合玩游戏了

——————————————

今天玩一玩Windows

主要是各种安卓游戏




明天开始构建 基于 Windows截屏， 树莓派分析(opencv)，手机观看的 局域网机器学习 系统

——————————————

Blue Stacks 模拟器更专业

——————————————

@AAAAB3N 

我觉得像我们这种低学历者

只能通过超努力(踏踏实实的写代码、看书到睡着)
再从小公司一步步提升(其实我觉得自主创业的可能性更大，因为市场的分化，很多互联网上的边缘产业大公司是不能做的(包括灰色产业))

——————————————

It almost has done, I just wrote a blog without user management system, but it has some functions which are writing, viewing, updating and deletion

——————————————

看了神盾一季第六集

每日一神盾，快乐666



爽，漫威质量就是好

——————————————

Maybe by following some great people than Chinese


https://www.thebalancecareers.com/programmers-on-twitter-2072010

——————————————

Check out @repjohnlewis’s Tweet: https://twitter.com/repjohnlewis/status/1011991303599607808?s=09

——————————————

http://www.kissuki.com/resume/


确实屌，不过我要怎么样才能达到那种地步呢？

——————————————

http://www.americanrhetoric.com/speeches/ronaldreaganchallenger.htm

我国领导人才不会在出事后讲这些话呢

多半都是success success

cover it up, cover it up, close people's mouth and so on

——————————————

感觉 vue 就是 client 版的 django templates

——————————————

不管是网易云还是腾讯还是Whatever

都不过是套的一个壳




怕是背后都有一套类似于django的傻瓜式用户管理系统

核心API才是关键，界面不重要(或者说变得很快)

——————————————

IdeaVim for Android Studio

Go to Settings (Ctrl + Alt + S) -> Plugins -> Browse Repositories and search for IdeaVim.

——————————————

我突然觉得学历不是什么问题


真正屌的人可以去参加各个学校的自主招生(清华北大啥的)

——————————————

沉迷于正确的django使用方法无法自拔



以前跟着官方教程和  stackoverflow 的回答走了好多弯路

——————————————

https://youtu.be/Dhkd_bAwwMc

人人有模型都可以做3D动漫的时代到了

——————————————

对了，现在可以在lubuntu上躺着边看pdf边写代码(Alt tab 切换得起飞，多亏了lubuntu上的默认pdf reader，既可以自动保存进度，又可以vim控制翻页)


前提是所有单词都认识

就不用依赖安卓多看阅读查词了




不过 LyingDown 还是有局限，有时会莫名卡住，，，需要 figure out where goes wrong

——————————————

heroku真好玩

https://evening-shelf-47934.herokuapp.com

——————————————

就让我乘着 django 的风

混合着 vue 与 tensorflow.js 的香味

带着 100% yingshaoxo special thoughts 飞向远方吧!

——————————————

刚刚看了一下

E_Python的实现逻辑已经很完美(年轻就是好)

我再改反而显得臃肿




另外我把 auto_everything 稍微地适配了一下 Windows



如果易语言的各种吊炸天的模块可以handle it, why we are insisted using python?

所以不写了




顺手更新了 Lyingdown

现在可以在 Windows 上躺着写代码了，虽然体验极差

——————————————

虽然看不懂

https://blog.just4fun.site/jupyter-notebook-architecture.html

但 Jupiter 应该实现了我想实现的东西

——————————————

Use popen to communicate with python interpreter is indeed much harder than I expected.

——————————————

啥时候你当HR了

加我一个呗




我对工资没要求

——————————————

我得多关注下推上的包工头HR

以后考研了随便进一个公司

转正程序员😁

——————————————

我只是隐隐觉得，在现实生活中，很多人，你跟他说再多话也不会有提升、一起做的事通常是浪费时间。

而在国际网上，我做的事基本就是传播知识，做实际的事情，每天解锁一点新技能。

没准这才是某国落后的根本原因：封闭。

——————————————

sudo add-apt-repository ppa:kivy-team/kivy no longer useable · Issue #5824 · kivy/kivy
https://github.com/kivy/kivy/issues/5824#issuecomment-399724049





搞得我想回到 kivy 的怀抱

——————————————

感觉实体 Windows 游戏要凉了

刚刚试了一下一款名叫 腾讯手游助手 的安卓模拟器

键盘玩 手机QQ飞车 很流畅





没准我们可以在更新 E_Python(auto_everything与Windows的连接) 的同时训练一个自动开车的 driver

主要是想在手机储存不足的情况下用懒人支架配合电脑键盘玩QQ飞车…😂






真实的含义是：如果Windows不直接集成Android和IOS，以后肯定会凉

——————————————


sudo apt install tree
tree


真是好用，这样复杂的结构也可以变得很清晰





另外再入门一次 django 也感觉不错呢！

( Lubuntu 上半屏自带pdf阅读器(竟然支持vim语法翻页) ，下半屏 terminator写代码 )

——————————————

https://machinelearningmastery.com/use-word-embedding-layers-deep-learning-keras/

The more I think about it, the more I feel I can't live without keras

——————————————

https://vgpena.github.io/classifying-tweets-with-keras-and-tensorflow/#language-and-machines


如果 one-hot matric 需要把每个词都 index 

并且 每表示一个词时都需要把整个 index 都带上 的话

当处理中英文混合 text 的时候，岂不是得把内存占满？

不行，我估计咱们处理 text 的时候还是得用 vector embedding

——————————————

也不一定

为了把 auto_everything 扩展到Windows平台

没准我会把 auto_everything 作为 E_Python 的底层包使用

继续开发 E_Python，如果一切顺利，我们会无缝链接 Windows 和 Linux desktop with one package

——————————————

技术只是一种手段

我们有时候更看重如何把你独特的想法用技术转换出来

并以一种生产环境的高效率展示给世人

——————————————

https://github.com/yingshaoxo/ML/tree/master/6.image_style_transfer


我原本以为风格转换是一件高效的事情，没想到要 iterate 800 次


我的2G GPU肯定是要等几个小时的

不知道8G GPU会不会好一点





没想到机器学习的瓶颈真的是计算能力

计算力到了，什么乱七八糟的数据一顿乱试，总有一个有用

——————————————

So, now, we need to move to next project


Text handling or photo style transferring? We'll see!

——————————————

This is what I did:

https://github.com/yingshaoxo/ML/tree/master/5.image_classification

——————————————

But I have to say

GPU version does indeed 10 times faster than CPU version





So I guess something was wrong with deepfake, after all, tensorflow models folder's program works fine.

——————————————

The lower the loss, the better a model (unless the model has over-fitted to the training data).

——————————————

500-600次基本就达到极限了

然后我发现，真的是数据越多、越高质量、越好(当然，我这次的训练是失败的，原图不高清，不流畅统一)




Deep learning 确实是数据主导型 coding

Data scientist 是必须的一个人物属性

——————————————

On the very bottom, all you need to do is: do things with one way!

After you can do many things, you'll then think about how you could do one thing with different way based on different circumstances.

If you, at the beginning, only has been taught or struggled in solving one thing in different way, then, I could say, you are useless! 

Because all you got or all you can do is solving 1 problem which maybe 1 + 1 = 2, while others could solve 20 times problem than you do.

That's why we encourage people to start from little, go far with much. 
(E_language->C++->Python->JavaScript->Kotlin->Golang->AI(ML))
(Windows->Deepin->Ubuntu->Kali->Popos->Lubuntu)

Don't be silly that think you could learn all those stuff from scratch easily.

Just say no to those details, start from the main ideas, start from what's essential.

With that, you'll be good at learning everything!

——————————————

想象一种带摄影头、麦克风、微型喇叭的眼镜

颈上带上一圈锂电池，眼镜后方垂两条电线连接项圈



眼镜可与手机Wi-Fi连接，手机作为大脑App可控制眼镜


一个应用场景：手机控制眼镜摄影或录音，手机分析眼前人的喜怒哀乐，并通过眼镜的微型喇叭告诉主人

Another circumstance: 
眼镜只听主人的指令(语音识别)，然后做很多事




但我觉得眼镜本身最好有屏幕，那样可以做更多交互，比如钢铁侠

——————————————

这是训练到400次达到的效果(花了一上午)

不好


没有眼睛，没有灵魂

——————————————

1.5倍速 再看了一遍 少林足球


我怀疑幕后还有超级屌的制作人(应该是老美)

因为整个套路非常好(特效、小人物逆袭、突破传统、符合逻辑与现实；专制中国是抵制底层人自我提升与突破的)

——————————————

还真是

露脸的AV是这个世界上最容易得到的有大量露脸的脸库

——————————————

看了 《头号玩家》

What a cool shit!

——————————————

fuck, just want to drop 2G GPU, it was useless when I go to the final step, it always shows this error: Resource exhausted: OOM


Then I just uninstalled tensorflow-gpu, install tensorflow instead

Now, it works fine

——————————————

Vegas 在视频剪辑上比 premiere 好多了




简单的剪一下就不用再训练分类模型了

因为从始至终就只有一个人出现在视频里

——————————————

https://www.tensorflow.org/tutorials/image_retraining



虽然这个很好用

但我的数据集太少了，60多个，正确率20%

去TMD，去找一段视频，分分钟几百张图片




好的，去找star视频

——————————————

不行

自己训练的准确率太低(我竟然没意识到 test folder 与 training folder 的文件都不能用于最终测试)





要想只用200张图出效果

只能考虑下用tensorflow的inception

——————————————

我还在想 超短裤美女 的事情


没准我们真不需要什么复杂的目标检测



就简简单单的一个 binary classification 就好了



有美女出现，录像；没有美女，停止录像；至于帧数，应该不需要每帧都检测，应该有从一系列动态模糊图取一张清晰的图的opencv算法，拿来用之，每秒检测一张图片就好了

——————————————

It was not that difficult as it seems like

I made it with steps_per_epoch = 200, epochs = 1

and this helps too:

https://machinelearningmastery.com/save-load-keras-deep-learning-models/

——————————————

原来在行首插字符这么简单

以前我还得 ^ 再 i

——————————————

I'll use this to achieve it:

https://becominghuman.ai/building-an-image-classifier-using-deep-learning-in-python-totally-from-a-beginners-perspective-be8dbaf22dd8





Before the end of this week.

——————————————

改变想法，去杂质这个过程用Ann classification会比较好

——————————————

等会儿

9：20可以开个QQ远程吗



不行就和我私聊解决

——————————————

对思政课讲台独问题的反思


1. 抨击民主制度 (自己的民主制度不行，就说民主不好)

2. 抨击贫穷 (用专制的强权、金钱压制自由的种子) (专制赢得了一时，维持不了一世，总有一天，人们会意识到自由的抉择有多么重要)

3. 抨击市场自由竞争原则 (本来那些只会考试的人就不应该作为优胜者出现在人的视野里) (台湾老师在中国过得好只能说明中国教育落后 (垃圾老师总不能在美国骚得起飞，毕竟美帝科研top1) )

——————————————

服务器ip被墙了

看来我以后要更hacker一点




敌在暗，我在明

——————————————

我现在大约有3000张某明星的图片

但里面有很多杂质


首先，我需要把所有人脸提取出来
然后缩放到一个合适的像素矩阵

接着，通过聚类算法把小群体删掉

最后，我才能使用 deepfake

——————————————

所以a、b向量的 dot product 只是 a measure 

about 

a 的 shdow 映射到 b ，有多长

——————————————

如此想来

树莓派又有用了




服务器配置不是问题，用户客户端配置才关键、、、、合理的照顾了不同用户群，高端玩家享受极致体验

——————————————

https://github.com/deepfakes/faceswap


竟然没有人 fake Chinese porn

I'm gonna make one If I have the time.

——————————————

这本书写得是真的好

原理和图都到位

例题贴近我的中文教材且答案不用找，就在题后面

并且语言标准，不像有些傻屌，专写人看不懂的东西(就像语言学考零分的那种人)

——————————————

opencv的人物检测很快但不精准(容易检测不到)





我可是想自动从视频里扣出人来，做美女超短裤 classification 的

😞

——————————————

为什么同样的mobile coco模型

2G内存手机上就很流畅，8G内存电脑上就慢死了(感觉10几秒一帧)

——————————————

GeForce GTX 1050 Mobile

——————————————

凭借学校60M的网速成功在lubuntu上配置好了gpu版tensorflow

2G显卡内存并没有什么优势，还是慢，和intel内核速度差不多

——————————————

That was quite straightforward.
 
https://www.youtube.com/watc.h?v=Bc8UC_m7M_Y

——————————————

https://modeldepot.github.io/tfjs-yolo-tiny-demo/


This is fast.

这个检测效率高多了

学什么Python啊

直接转JavaScript

——————————————

如果 tensorflow.js 可以不用安装垃圾的1个多G的nvidia显卡包的而实现gpu加速的话，还是挺好的(https://js.tensorflow.org/tutorials/core-concepts.html)


因为那个显卡包不光安装成功率低，还容易搞坏系统


妈的，我的Lubuntu又崩溃了，就是因为安装了该死的nvidia cuda包

——————————————

Here is the drum:

https://github.com/ComcastWizard/KeyDrum

——————————————

https://github.com/gustavklopp/pypiano.git


This is the best python piano than ever!

——————————————

用 superpads

在安卓上畅快的玩音乐

——————————————

装台湾腔😁

——————————————

Did you want this?

https://www.youtube.com/watch?v=z410eauCnHc

——————————————

因为淘宝的名片特别便宜，所以我定了1000张，正在给自己做名片。。。

——————————————

https://github.com/yingshaoxo/E_Python

又补了一个坑

——————————————

不过从追求效率上来看

咱们都是一样的





只不过有点冷罢了，就和我们大多数同类一样








那就只能找冰山美人了

——————————————

How to let all of your files back to normal permissions:


sudo chown -R username *
sudo chmod -R 775 *

——————————————

今天和学姐稍微交流了一下

没戏

太成熟了





相比哥你来说，你怎么保持年轻的？

程序员很单纯？

——————————————

树莓派

——————————————

被老师引荐去帮大二大三的做什么 全国大学生创新比赛(或者是电子比赛)


我一看，又是小车


果然是墙国机器小车





开发板还被限定为3V电源的垃圾(烧录还需要个usb adopter)





暑假可能会被我妈逼去打工，挣来的钱我打算买新电脑…

——————————————

Me: You know, I have never see someone like you, staying cool and beautiful at the same time

Her: 你想拽英文吗？

Me: No, I just want to express my thoughts

Her: 你可以和我讲中文

Me: But some times, 我觉得英文更能表达一些事情

... silence ...

Her: (Laughed out)



Anyway, this was the first time in my life.

——————————————

表白了

那小姐姐学霸还在思考当中




我准备下学期再去见她


先复习




那小姐姐大我一级

——————————————

今天向一个图书馆小姐姐面对面表白了







我发现学校同学很不靠谱啊，基本都没有教授能力、老师也是很不负责任的、填鸭式大水漫灌式教育(肯定没有世界级网课那么高质量啦)


既然感觉上完课什么都没得到


要想不挂科就全靠自己啦



所以最后一个月，暂时放下Programming，投身到无尽的学习之中

——————————————

果然所有的高中公式的证明都很简单

上一代中国老师把它搞得太复杂，把我的老师搞糊涂了

我的老师不会，就没教





背公式…

草泥马，要是背完公式就能做题还考什么试



什么原理都不知道就瞎鸡巴乱搞

——————————————

美元真是一种特别形象的符号：之前付出过的努力可以在新领域上开出一条直道！

——————————————

老朋友现在和我不是一个层次的

这事儿也烦

——————————————

经过我初步观测

keras是比较简单的那种框架





不过我要先玩透 sklearn , 然后再选一个支持安卓的深度学习框架

——————————————

感觉融汇贯通

一切都能看懂、都变得明晰

——————————————

Multi-layer Perceptron (MLP) 


http://scikit-learn.org/stable/modules/neural_networks_supervised.html

——————————————

https://github.com/automl/auto-sklearn/

OK，It's definitely good for applying without any thinking.

——————————————

看完了

——————————————

Deep learning is also just a sexy term for 

Artificial Neural Networks (ANN)

——————————————

牛逼

——————————————

http://scikit-learn.org/stable/modules/model_persistence.html#persistence-example

Yes, as I said, it's simple enough

All you have to do is change to a different model to see if all your data fits right

——————————————

https://github.com/yingshaoxo/ML/blob/master/2.play-regression.py

——————————————

import matplotlib.pyplot as plt
from sklearn import datasets, svm, metrics

digits = datasets.load_digits()

"""
images_and_labels = list(zip(digits.images, digits.target))
for index, (image, label) in enumerate(images_and_labels[:4]):
    plt.subplot(2, 4, index + 1)
    plt.axis('off')
    plt.imshow(image, cmap=plt.cm.gray_r, interpolation='nearest')
    plt.title('Training:%i' % label) 
plt.show()
"""

n_samples = len(digits.images)
data = digits.images.reshape((n_samples, -1))

classifier = svm.SVC(gamma=0.001)
classifier.fit(data[:n_samples//2], digits.target[:n_samples//2])

expected = digits.target[n_samples//2:]
predicted = classifier.predict(data[n_samples//2:])

print(expected[:20])
print(predicted[:20])


Can you believe Machine Learning could be achieved so easily?

——————————————

I can smell the knowledge from it. It's a great book for sure.

——————————————

http://www.americanrhetoric.com/speeches/barbarajordan1976dnc.html


This man's speaking is very attractive, it maybe the best one I'v ever heard.

By learning this, reading English book will be much easier.(with a nice inner voice)

——————————————

China可以说是很出名了

——————————————

没有什么比看到心仪的女孩

却由于能力不够，无法追到

更让人产生动力的了




所以人才要努力奋斗啊

——————————————

确实卡

只能拿来正常录一下屏




一加特效就卡，face_changer?

不可能的，以后试一下更先进的face_detector

——————————————

兄弟我们是要入门ML的节奏

请减少对传统编程方法的依赖

——————————————

Sorry for giving the wrong link

——————————————

这样看来电影特效可以直接由风格转换得到

——————————————

Check out @liu_mingyu’s Tweet: https://twitter.com/liu_mingyu/status/965960674470871041?s=09

——————————————

University Vector 基于高中的向量基础不断扩大维度、增加运算

——————————————

最近几天都是在coding中睡着的

因为有lyingdown

累了一闭眼就是第二天，不累继续敲键盘；想事情放松闭眼，自由放飞思维

还不用担心腰间盘突出、颈椎病


我应该再加一个30分钟后无操作自动休眠(或者直接进行系统设置)

——————————————

这是v2ray CDN ip 匿名后的速度

——————————————

https://www.youtube.com/watch?v=WCEXYvv-T5Q&t=0s&index=14&list=WL

I'm actually not expected that scikit-learn could do those things.

——————————————

www.americanrhetoric.com/speeches/fdrpearlharbor.htm

要是我以前的历史课是学这些就好了

——————————————

没注意看，scikit-learn也可以做 classification

我就很奇怪了，为什么不用 deep learning 也可以做颜值检测

——————————————

腾讯这个做得不错

——————————————

https://github.com/wangshub/Douyin-Bot

我真是服了

——————————————

恋爱之道 - 艾跃进


一、总体要求
注意事项: 
0.想清楚爱一个人的哪些地方(你了解对方多少)
1.找与自己价值观相近的人(有共同志趣)
2.遵守法律，不可强求
3.符合道德，有责任意识，忠一

具体要求：
1.人品高尚
2.学识相当
3.长相端庄
4.家教相当
5.性格相符
6.气味相投(闻香识*人(吸引你))

结论：此事古难全，(有3条就好)，仅供参考


二、择偶方式

自己结识
公开征婚(研究婚恋节目，从中学习)
委托介绍(对硬件要求高)
媒人介绍(有夸大之嫌)


三、示爱艺术

直接法(痛快一点、面对面挑明，前提是有交往、有好感)

渐进法(占座、打饭、送粥、写东西、开车…)

暗示法(没好感的情况下可能无效)

情书法(实话、有文采、能被公开、能被看出志向、可信赖)

委托法(让人带话，不建议)

结论：艺术使人幸福、艺术“不可复制”、艺术需要创造


@system357

——————————————

1. what we have learned still useful

2. I'm not very familiar with scipy and librosa

——————————————

不管做得好不好

能用就行，率先进入就有的赚

这叫行业红利期




做得好就赚，这叫行业壮年期





做得再好也难赚钱，这叫夕阳产业(夕阳无限好，只是近黄昏)

——————————————

from __future__ import print_function
import torch

x = torch.rand(5, 3)

print(x)

print('-' * 10)

print(x[1:, 2])
# is actually x[row, column]
print(x[1:, 2:3])
print(x[1:, 2:3][0:, 0])

print('-' * 10)

print(x[0, :2])
# is actually x[row, column]
print(x[0:1, 0:2])
print(x[0:1, 0:2][0])
print(x[0:1, 0:2][0, 0:])


花了我好长时间才理解

——————————————

So, fuck tensorflow and other shit frameworks

Just focus on pytorch, I don't know other things, but I know python is for human-being, those people in python community are kind.

https://pytorch.org/

——————————————

Yes!

I wish I could know it from the beginning!

——————————————

https://medium.com/@julsimon/10-steps-on-the-road-to-deep-learning-part-1-f9e4b5c0a459



Basically, yes

——————————————

then, keep learning

——————————————

First, this could solve a problem showed in pop_os

https://extensions.gnome.org/extension/15/alternatetab/

——————————————

http://simplecv.org/2014/02/21/gsoc.html

http://tutorial.simplecv.org/en/latest/examples/image-math.html#chroma-key-green-screen



This could be the best, but sadly it's dead.

——————————————

悲伤地发现该课程是用 MATLAB or octave 做的

——————————————

刚才从课程里学到

ML竟然可以直接从嘈杂的环境中提取人声或背景音乐

这下监听是得有多容易啊…

——————————————

When I saw those programmers, 

I'm not seeing some ordinary individuals, but instead, 

many great man who dare to fight the fate, 

who dare to fight the wrongs, 

who never easily give up,

who we can say that they are pioneers.

——————————————

The thing that really killing me is being normal, being ordinary.

Those shit will never understood what I'm looking for, what I'm dieing to achieve.

They are just live in their stupid numb life without knowing anything behind the lights.

——————————————

en

I still got one half year, hope I'll make it

Or I'll die

——————————————

Where is your future?

I already see peas, in abroad.

——————————————

看了 《小丑回魂》

What an wonderful experience!

——————————————

https://electronjs.org/

看起来 js 或者说 npm 大有统领一切夕阳产业的势头

根据 计算机->互联网->触屏智能手机->人工智能 法则

代表互联网的js会取代桌面软件

代表人工智能的算法 会 取代手机上大部分硬编码程序

——————————————

SB kivy, can't run python3 version on my Lubuntu:

[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
egl_rpi - ImportError: cannot import name 'bcm'
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module>
    from kivy.lib.vidcore_lite import bcm, egl

sdl2 - TypeError: expected bytes, str found
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 67, in core_select_lib
    cls = cls()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 138, in __init__
    super(WindowSDL, self).__init__()
  File "/usr/lib/python3/dist-packages/kivy/core/window/__init__.py", line 722, in __init__
    self.create_window()
  File "/usr/lib/python3/dist-packages/kivy/core/window/window_sdl2.py", line 237, in create_window
    self.fullscreen, resizable, state)
  File "kivy/core/window/_window_sdl2.pyx", line 94, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window (kivy/core/window/_window_sdl2.c:2204)

x11 - ModuleNotFoundError: No module named 'kivy.core.window.window_x11'
  File "/usr/lib/python3/dist-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)

[CRITICAL] [App         ] Unable to get a Window, abort.


python2 could, apt install python-kivy

——————————————

https://class.coursera.org/ml-005

try it out, this would be benefit

——————————————

新版pop_os可以说是非常屌了

120Hz刷新率，使得桌面异常流畅


还可以自由切换 nvidia 与 Intel 显卡

——————————————

有没有可能上本科啊？

——————————————

@PeaShooterR @Hex11 

考完了开不开心？😁

——————————————

下午被 另一队程序员 叫去帮忙，学会了 STC89C52 单片机



#include <reg52.h>

sbit pin1_0 = P1^0;  //define pin 1.0

void main()
{

pin1_0 = 1; //write or read, it depends on you

}

——————————————

越来越倾向于用绿色linux软件了



昨天晚上发现pop_os desktop environment崩溃了

怎么都修不好，重装后，android-studio, arduino, gitbook, v2ray等绿色软件可以直接移植

其他的就不行了

——————————————

不说这个了

对硬件我还是没多大兴趣




入门AI，才是我这一年的任务

我应该熟悉各种ML框架的用法，并且知道怎么融合使用

by the way, 我记得 我连最基本的把训练model保存在本地 都不会

——————————————

代码80%是我的

底层API全是我写的

另一队程序员一开始只会使用图形编程

——————————————

我拖后腿？No

是我队友的硬件不行

——————————————

What are you saying?

——————————————

第二次比赛我没去

第一次比赛，我准备比赛的那个月教会了另一队的程序员写C

然后他靠着我的80%代码得了一等奖




接着有后补赛我没去，他代替我 和我的队友去了，用了他那组的硬件，得了一等奖，挂的我的名字(我全程不知道 until today)

——————————————

http://music.163.com/song/522429774/?userid=280429778

——————————————

突然得了个一等奖，看来以后要善待朋友啊

——————————————

把键盘控制鼠标部分写完之后

发现 screen image grab won't be able to show mouse cursor

所以我还得得到 mouse position，在image 里自绘…

——————————————

听到github被微软收购了我是痛心欲绝啊


这必须得换啊！

要不然谁知道这流氓会变成怎样

——————————————

把直播流图片格式改成PNG

感觉世界都清晰了

——————————————

from pynput import keyboard

def on_press(key):
    try: k = key.char
    except: k = key.name
    print(k)

lis = keyboard.Listener(on_press=on_press)
lis.start()
lis.join()


I think this is the best thing I can get from python community.

——————————————

https://github.com/yingshaoxo/LyingDown

现在采用双半屏的方式显示(两张图片组成一半屏幕，既可以写代码又可以浏览网页)

可以自由上下屏滑动，点击即全屏



总之这个操作把我室友都惊呆了

——————————————

半夜失眠起来看 《英伦对决》，除了成龙老了以外，还不错

——————————————

@AAAAB3N 
@PeaShooterR 
@Hex11 

祝高考顺利，不紧张，充分发挥自己所学

灵活应对考题

——————————————

看来以后可以大幅度提升战斗力了

——————————————

想学vue

自己建网站或者论坛


然后贴自己转卖的淘宝商品广告

挣合法的钱





年纪大了，再不找个专业领域混混确实是不行

AI领域，具体网站的形式还有待研究(创新需要灵感)

主要是研究一个制衡的机制或者生态，让低端和高端者各得其所

——————————————

1.5倍速看大杂烩 十万个冷笑话2电影 还不错

——————————————

Fine


What are you doing in those days?

——————————————

Can you use musically?

I can't, and don't know why.

——————————————

No, I haven't

——————————————

噪声抑制（Noise Suppression）

回声消除（Acoustic EchoCanceller）

自动增益控制（Auto Gain Control）

静音检测（Voice ActivityDetection）


http://www.52im.net/thread-825-1-1.html

大概这就是主要的难题，需要一个个克服

——————————————

开源的本质是：

开源者不需要从这个项目得到 Money，但他希望这个行业能够持续快速地发展。

——————————————

我觉得对于普通人来讲，音频处理几乎是个噩梦

资料好少啊




别说降噪了

就连实时 EQ 都没有




我通信专业好像也要搞这个，早搞晚搞都要搞，不如现在搞

——————————————

看了《马戏之王》

The greatest art in this world means to make others happy

——————————————

You can somehow try it out by yourself:

https://github.com/yingshaoxo/MovingDetector/tree/master/example/WebLive

——————————————

我以后应该可以躺着写代码了


用以前的方法截取1/4的屏幕(一个完整的terminator)，转发到局域网用手机浏览器看

手机挂在懒人支架上，支架上挂伞，有线键盘接笔记本



我需要去买个廉价的有线机械键盘

——————————————

刚刚查了一下枪支

就没人想过3D gun printing?

I'll buy one 3d printer when I get rich.

——————————————

测试成功

可以直接调用camera上的录音器录音




如果音质实在不行，我可以把以前废弃的耳机麦克焊接到camera上面

不知道多麦克会不会增加录音的灵敏性

——————————————

通过所有cmake参数为off把opencv成功编译在无GUI的树莓派上


运行下列script成功在浏览器看到webcam的图像

https://github.com/log0/video_streaming_with_flask_example




我离成功近了那么一点点

——————————————

So if a vector value has a hat on it, it means unit vector

——————————————

https://youtu.be/qaPzlIJ57dk


Interesting if it can import any python package, for example, flask numpy, opencv, and so on

——————————————

https://segmentfault.com/a/1190000013854294


竟然还不能直接录音





我还必须得承认，买树莓派是因为我放不下Python






思来想去，结合IP webcam Android App，还是觉得把 video 与 audio 分开处理比较好

video 用 flask + opencv 

audio 用 flask + pyaudio

——————————————

https://www.jianshu.com/p/76c1be068170

大力支持

——————————————

https://edmondfrank.github.io/blog/2018/02/08/tan-tan-googlezi-dong-bian-cheng-kuang-jia-automl/


https://www.customvision.ai/


微软好像在搞事情

——————————————

https://edmondfrank.github.io/blog/2018/02/12/shi-yong-shu-mei-pai-shi-xian-24xiao-shi-bu-jian-duan-zhi-bo/

还得接着搞

——————————————

他们对于视频推流的态度是：完全不在乎有没有音频

似乎视频监控领域没有音频一样

——————————————

还是看设备基数

民用软件的趋势随设备占有量而变化




哪个平台设备占有量大，就开发什么平台的软件，比如安卓







但我一直没搞清楚安卓是怎么调用其他编程语言的

一个不能和其他编程语言交互的语言，不可能变得强大

——————————————

没有市场竞争谈创新是空想，根本没动力：这个可以用，继续用，反正没人和我抢饭碗(垄断)，为什么要大费周折搞创新？

你党就是没竞争，你党控制下不可能有创新


你党言论审查的重点就是扼杀一切可能和党管控的一切形成竞争的势力

——————————————

我们是否可以理解为机器学习里

向量拐来拐去最终指向一个结果

——————————————

https://motion-project.github.io/index.html

This is worth for playing.

——————————————

Play music in raspberry:



sudo apt install mpg123
mpg123 *.mp3
h

——————————————

一下午硬是没搞出来

——————————————

Turn vim syntax highlighting on


:syntax on

——————————————

突然发现 笔记本上编译的 go

树莓派上无法执行





…



突然体会到编译语言的局限性，arm和amd不同，处理器不同，就需要重新编译

——————————————

我经常觉得

1. 可汗要讲10节课以上的内容学校老师只讲一节课(可汗技高一筹，非死记)

2. 不把可汗学院的高数部分看完，很多时候都看不懂专业书籍

——————————————

我必须压制我的头脑去记忆新东西

不然很快把学校的东西忘完后就得挂科





这样对身心很不健康，没法体验巅峰(快速学习)状态

——————————————

https://blog.lemberg.co.uk/how-process-live-video-stream-using-ffmpeg-and-opencv

可以，这样一开始就不用自己来处理音频了

——————————————

HTTP 可以做音频直播？

——————————————

http://music.163.com/song/19572271/?userid=280429778


我有时也觉得脑袋装了太多东西，快要宕机

这个事情发生在PM7:00之后，可能晚自习应该拿来睡觉

——————————————

额…

手机也比树莓派贵


所以我打算用web做树莓派的屏幕

省一笔显示器的钱

——————————————

让它跑c++试试、或者tensorflow

反正不卡我主机就好了

——————————————

做机器人视觉

录制视频、美化、后期、直播

做服务器，手机web浏览、操作

——————————————

小小的，很贴心

——————————————

树莓派3B+到了

——————————————

这就是倒着从结果计算 bais w 的方法了

——————————————

So what is intelligence?


正确的学习算法
+
足够且有效的数据资源
+
长时间勤奋地训练
+
一个可记忆的容器
+
可再次获得数据的传感器
+
可自由执行决策的身体

——————————————

还有比如红点那个地方

list slice 里面一个逗号十分费解



怎么搜索都不知道

——————————————

还有一些，翻着文档看很多遍也不知道什么意思



这些在作者看来是你理所应当知道的

——————————————

像这个，不会 matrix 根本无法理解

——————————————

我以前觉得小学、初中是基础教育

现在我觉得大学是基础教育，光学高数、高英是没有用的

还要用它们来学更专业的知识(那些大量用到数学原理和English based knowledge)

——————————————

每次录完视频都要花几个小时降噪、标准化、调EQ、TV compression、加速无声片段

再加上中间不同视频、音频无尽的渲染



我感觉完全是在浪费时间啊

我必须得做点什么了



这一套自动化处理必须得弄出来

不然没法学了

——————————————

https://addons.mozilla.org/en-US/firefox/addon/%E7%BF%BB%E8%AF%91%E4%BE%A0-translate-man/?src=search

Good translator for auto pronunciation

——————————————

Train a model

去预测一个人的行为

类似于 if you were him, what you would do

当这种预测的准确率达到99%，我们就说我们已经成功地copy了一个人的大脑

——————————————

你要问我理想主义者与现实主义者的区别


在我看来，即是理想主义者更易与远方的人成为朋友

而现实主义者更易与近身者成为朋友



如果理想主义者在近身处有坚固的朋友，他们一定很优秀

而现实主义者在远方有牢固的友情，他们也一定很优秀



远近平衡，平庸者
朋友与自身，优秀程度相近
牢固的朋友越多，个体实际的能力越强



所以最优秀的人，在大世界、大局面上要尽可能展示理想主义光辉

而在小群体，要尽可能显示现实主义为群体谋利益的心机

通过提升自我，改变朋友的质量、增加朋友的数量

——————————————

看了 《消失的西德尼》


伟人也是人，只不过他们对人(生)的思考更为深入

——————————————

增加了upload功能


随时可以上传东西到服务器了






我想 AI learning 得从0开始了

发现Firefox对pdf支持较好，又可以直接网页翻译、又可以保存位置








慢慢地想起李阳说过的话：不怕慢，就怕什么都学不会，浪费青春，做无用功



有时候我想，等我学完AI

就大概是我生命的尽头吧

——————————————

因为有了好的储存卡，我的偷拍器也可以用了



虽然我很想自己做一个

——————————————

京东买的闪迪tf卡，虽然贵点，13M/s的写入速度

而淘宝垃圾700k/s

——————————————

以后再也不能随随便便写代码了


我会死的


累死






改一个bug返回10个bug



还要花费很长时间搞清楚哪儿出了错









像模块制作，必须要有一个测试脚本，每写一个api function就要写一段程序测试它



这样不仅保证了程序的质量、节省了时间，还便于跨平台、系统测试

——————————————

Decorators with Arguments


class decorator_with_arguments(object):

    def __init__(self, arg1, arg2, arg3):
        """
        If there are decorator arguments, the function
        to be decorated is not passed to the constructor!
        """
        print("Inside __init__()")
        self.arg1 = arg1
        self.arg2 = arg2
        self.arg3 = arg3

    def __call__(self, f):
        """
        If there are decorator arguments, __call__() is only called
        once, as part of the decoration process! You can only give
        it a single argument, which is the function object.
        """
        print("Inside __call__()")
        def wrapped_f(*args):
            print("Inside wrapped_f()")
            print("Decorator arguments:", self.arg1, self.arg2, self.arg3)
            f(*args)
            print("After f(*args)")
        return wrapped_f

@decorator_with_arguments("hello", "world", 42)
def sayHello(a1, a2, a3, a4):
    print('sayHello arguments:', a1, a2, a3, a4)

print("After decoration")

print("Preparing to call sayHello()")
sayHello("say", "hello", "argument", "list")
print("after first sayHello() call")
sayHello("a", "different", "set of", "arguments")
print("after second sayHello() call")

——————————————

https://github.com/yingshaoxo/Local_Show/blob/master/app/app.py#L41


Finished! Golang help python at file serving








Python慢？不可能的

Python单线程？屁！现在是异步多核心高并发

——————————————

Alt key

Alternate key

——————————————

Terminal hotkey


Go forward by a char: Ctrl + F
Go back by a char: Ctrl + B

Go forward by word: Alt + F
Go back by word: Alt + B

——————————————

卸了垃圾淘宝和拼多多

全是假货，TF卡一买一个假，虚标速度+质量差




购物，网页上不能完成，APP就是流氓软件

——————————————

看了 雪国列车


发现 作者由《阿修罗》 出发，融合了对国家制度 、尤其是社会主义的思考

另外对秩序与自由之间辩证的思考尤为突出


而自由，就是 have more chances to take control

——————————————

God damn it!


It's still too hard for me!


https://medium.com/deep-math-machine-learning-ai

——————————————

Clustering: This is a type of problem where we group similar things together.

——————————————

http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/


I have a limited brain, which is a shame.

——————————————

照这个水平

就算我投1000元到某个公司

几个月之后也才涨10%，也就是100

——————————————

https://www.pornhub.com/view_video.php?viewkey=ph5ad4c41dbea9e

I've never expected VR could so attract like this

VR + sex toy should be good

——————————————

未来的学校，学生为校园事务主导:


学生多数同意，可辞退老师

学生参与学校建设(工程建设拼多多模式，二分之一学生同意即建设；先付钱(工程总费用÷学生数的一半)，再根据最终学生支持人数平坦工程款)

优秀双语程序员组成学校领导层，议会制

——————————————

Does anyone could train an ML module which could take previous 2 pictures and predict which direction an object is about to going?


想了一节课，发现，如果发现目标就缩小搜索范围就会遇到一个尴尬的局面：你不知道这个物体向哪移动的

另一方面，对抗视野移动对检测的干扰也非常重要

Very problematic anyway

——————————————

本来修好原来的耳机打算退货的


感觉小米的东西确实不错






考虑下一个手机依旧小米

毕竟不是花自己的钱


用父母的血汗钱充值谷歌信仰感觉有点 naive

——————————————

I won't be the first

Non be the last one

To break through the little self.

——————————————

台上一分钟，台下十年功

通过这些天的演讲



我越发觉得交流是一件容易的事，而表达可以变得 handleable


跟读 English Speech also helps too

I can feel my mind in English

http://www.americanrhetoric.com/top100speechesall.html

——————————————

https://youtu.be/mdZo_keUoEs




厉害了，枪原来如此好做

——————————————

我不知道级数求和可以这么简单

不知道可不可以用在高考的通项数列求和上

——————————————

JavaScript for website

C++ for hardware

Kotlin for Android

Golang for fixing the low speed of Python at serving




But most importantly, use Python everywhere as you can.

——————————————

https://youtu.be/lT3vGaOLWqE

他真是厉害，娱乐电子




我的意思是花了半辈子学电子

然后用不怎么聪明的头脑用坚持告诉人们

智商不是唯一的成功要素


同时继续发光发热，为全世界人民电子水平的提升做出自己的贡献

——————————————

我看完了

其实那个小米降噪耳机在拼多多上只要200

我在淘宝300买贵了

——————————————

为啥？

——————————————

今天第一次用自己的焊接器与502修好了自己的耳机

我对硬件能力没什么要求

能独立做出来主动降噪装置就好了

比如降噪魔盒(一打开前方0.5平方米的区域无声)

——————————————

按理来说，loop应该自己做，systemctl老是重启不太好



但我可以通过 decorator 帮助人们快速实现一个 while loop

——————————————

https://github.com/yingshaoxo/auto_everything#create-a-systemd-serviece


Now I probably could say, I've just finished a great function which could make python developing much easier.

——————————————

https://youtu.be/gRzqsW9Rj3E


Just admire him, full-time job for python.

——————————————

我只是对可能性进行思考


最近要进入到极限学习状态了






没有朋友，只有学习

配合之前的全天计划表

应对快要到的考试周(虽然我觉得要想大学有突破，这样是必须的)











今天中午念了 马丁路德金的 I have a dream

我发现他讲得真烂，竟然还排名演讲世界第一

——————————————

我觉得大学才是高科技作弊工具使用的地方


一般的大学考试都不会检测金属

——————————————

[Unit]
Description=test deamon
After=re-local.service

[Service]
Type=simple
User=yingshaoxo
#User=root
WorkingDirectory=/home/yingshaoxo
Environment=DISPLAY=:0.0
ExecStart=/usr/bin/python3 test.py
Restart=always
RestartSec=5
StartLimitBurst=3
StartLimitInterval=1s

[Install]
WantedBy=multi-user.target

Yes, we can, somehow write a module to help people create their own service without much pain

——————————————


Ubuntu provides an easy way to install the NVIDIA proprietary drivers. If you open the 'Software & Updates' Application and navigate to the 'Additional Drivers' tab you can install the Ubuntu provided proprietary driver.



ubuntu就是好

——————————————

又没学历

又没参加过开源项目

又没有1000star

国外找工作是不可能的

——————————————

No, now I guarantee it will work


https://yingshaoxo.xyz/post/Using%20Python%20to%20install%20YouCompleteMe.html

——————————————

看了 刀剑神域*序列之争

原来是在讲AR

——————————————

试了一下这个，用不了


然后我把 auto_everything 的super自启功能去掉了( crontab需要人工操作，不然没用)



看以后能不能想到一个好办法加上

——————————————

wget https://raw.githubusercontent.com/yingshaoxo/auto_everything/master/demo/install_YouCompleteMe.py
python3 install_YouCompleteMe.py


No guaranty it will work

I just tried my best to let it work

——————————————

Found an important function which can totally change all stuff in my auto_everything package

def run(self, c, cwd=None, wait=False):
        """
        c: shell command
        cwd: current working directory
        wait: True may running forever
        """
        if cwd == None:
            cwd = self.current_dir

        args_list = shlex.split(c)
        p = subprocess.Popen(args_list, stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT, universal_newlines=True, cwd=cwd)

        if wait == True:
            while p.poll() == None:
                line = p.stdout.readline().strip(' \n')
                print(line)

——————————————

Vundle.vim, YouCompleteMe and vim-autopep8 has been installed.

Now, I'm preparing to make an automate python script for installing all of those things.

——————————————

在固态硬盘配置 lubuntu


no docker
no chrome
no Android Studio
no Arduino
no Virtual box
no Java
no Golang
no npm
no Chinese
no nvidia

only python and vim





We will fight

——————————————

看了《冰肤传说》

我觉得法国也可能成为文化强国(电影大国)




对比中国，一个连说话都要考虑再三以免有牢狱之灾的国家

输出什么给外国人看？专制主义共产党统领一切思想？

我觉得外国人会逃离电影院，除非你倒贴，给观众钱

——————————————

用虚拟机试了一下 archlinux

安装不上，还是 pop_os 好用



另外 terminator 挺好用的，在 pop_os 上可以莫名其妙的成为默认终端

——————————————

但如果能和我之前推荐的那个双耳帽降噪橡胶耳机融合起来就很好了

那就是100%无噪音

——————————————

第一次见到需要充电的耳机


然后试用了一下

发现对中低频噪音的去除率是95%

——————————————

文字狱

——————————————

看了电影 《非凡》

There has not much to say, just cool

——————————————

mathlab越做越傻逼

——————————————

太厉害了没人陪你玩

太弱了也没人陪你玩

然而历史的进程多半是由那些最顶尖的人推动的

最强的人顶尖，最弱的人是另一方面的顶尖

——————————————

买了一个小米主动降噪耳机。(今天耳机莫名其妙的掉了)

——————————————

https://youtu.be/ZUX9Fx8Rwzg

——————————————

找工作还要看简历…

我还得去做个简历出来😒

——————————————

https://realpython.com/python-data-classes/


As I thinking through programming, I found programming is just a kind of way converting logic thinking to computer executable things,

A better way to represent decision process.




@加一个单词对function进行操作的 package 制作方法是值得我们去学习的

——————————————

https://wiki.archlinux.org/index.php/Terminator

I'm gonna try this in this weekend later

Split terminal at one screen is a definite good idea

——————————————

要是做不到，录像打脸

——————————————

v2ray 的 VMESS+WS+TLS+Website 模式也无法突破这堵墙

以后只能拿校园网下迅雷了

——————————————

It's time to say goodbye to SSR

我的学校网已经全面封禁SSR

——————————————

一个有趣的事实是

用linux不用sh or script一键化

还不如不用

——————————————

http://www.bilibili.com/video/av23383257?share_medium=android&share_source=copy_link&bbid=E0626135-9650-438C-9974-1B8315ED7B0613493infoc&ts=1526199451778

——————————————

提升了稳定性，检测脸比眼睛容易

然后加了美白、磨皮

——————————————

气死我了

我以为改变肤色有多难，结果忽然灵机一动就是叠加一个白色的透明图层

竟然花了我2个小时搜资料、还搜不到

——————————————

https://www.learnopencv.com/facial-landmark-detection/

https://www.learnopencv.com/face-swap-using-opencv-c-python/


Oh my godless,  this is good

China is garbage, I spent 5 hours searching with Chinese and got nothing


至少现在我知道换脸鬼畜怎么做的了

——————————————

https://github.com/yingshaoxo/face_changer

Suddenly, I knew how to change my face with opencv

——————————————

刚刚试了试掉帧法

掉帧后就找不到谁在动了





结合生活实际，我们观察事物必须持续地凝视

这个凝视会因为发现目标而逐渐缩小搜索范围，慢慢跟随目标(中心随目标移动)，忽略掉周围事物

而一旦失去目标，我们又会重新扩大视野，慢速又粗略地做整体观察

——————————————

初步来看，运动检测把视频速度放慢了5倍


这种效率肯定是无法实时监测的

——————————————

搞了一下午

破Windows，python3 opencv 打不开摄影头

想用c++写，发现在win上没有 VS 好像什么都做不了(mingw 配合 visual code studio 没搞出来)

现在没辙了，只能先把GTA5的画面录下来，再去ubuntu写代码 (也好，这样电脑不会卡飞了)

——————————————

我在思考怎样利用 moving detector 快速 label figures from video

比如做gta5的自瞄, 快速label出所有360度、远近高低各不同的人物




这是接下来几周的任务

——————————————

comma-separated values (CSV)

——————————————

看了 《黑豹》

我觉得尖端视觉科技出自漫威

Means great





另外有一个好消息，后期硬件比赛不用去了(和普通成员闹僵了，以前的事)

于是我们可以安安心心利用晚自习把书上的复习题做一遍，争取来一次高绩点

顺便弥补一下 学完高数却做不了高考理数最后一题 的我的 受伤的心灵

——————————————

任务达成



发现编码一旦变得复杂，mathlab就不是人用的了

python是唯一的解决方案

——————————————

central processing units (CPU)

——————————————

大师是那些可以把复杂的事变得简单、枯燥的事变得有趣的人😁👍

——————————————

我通信老师叫我用mathlab把 AMI编码 做出来


这周的任务




用mathlab的人说白了就是懒

整个语法照搬python

就是整合了numpy和mathplot库

——————————————

怪不得我可以得罪那么多人…

——————————————

厉害了，成功解释了国内死记公式的公式的由来

——————————————

简单讲就是无设备的3D动漫制作

——————————————

或者各种人物场景3D模型还原

——————————————

虽然也可以用在各种无人体育教学上

比如武术、跆拳道什么的

这些老师可以下岗了

——————————————

https://storage.googleapis.com/tfjs-models/demos/posenet/camera.html

只有我一个想到终于可以给自己疯狂的加特效了？

——————————————

It's just wonderful

——————————————

https://medium.com/waymo/google-i-o-recap-turning-self-driving-cars-from-science-fiction-into-reality-with-the-help-of-ai-89dded40c63

——————————————

所谓“分母分裂法”原来是这么来的

我国的SB数学老师从来没讲过

——————————————

https://yingshaoxo.xyz/book/notes/series.html

心累，一天要整理这么多笔记

这还只是一个学科的

——————————————

崇洋媚外是21世纪的主流

所以化妆要模拟西方人的轮廓与面部特征

越西白化, 越受女性欢迎

——————————————

女性或者人的天性就是爱权爱钱，从取名就可以看出来了

所以要在平时的生活中尽量表现出高贵、有教养、有礼仪





另外，人只有在慢节奏的舒适中，才会表现出强烈的性欲

太急躁就会显得在工作，工作无性欲

——————————————

女性的思想果然是很情绪化

那意味着我只能当个gay?



不，到底应该用何种心境、何种思想来面对女性？

我应该好好想想

——————————————

未完待续

——————————————

我觉得大家都是色狼…装什么矜持😂

——————————————

为了彻底地研究女性的内心

我决定读一本女性专区的小说

——————————————

无穷等比数列的和

——————————————

结果是这玩意儿对硬件要求超级高

比如麦克不能在外部没声音时收集电流声，但很不幸，到目前为止，我没用过自身没噪音的麦克




另一方面，为什么它们不用软件来做这个东西？是因为这东西对延时敏感，数字电路的速度达不到

——————————————

https://github.com/yingshaoxo/rattlesnake

效果目前还不敢说

需要多测试...

——————————————

https://github.com/loehnertz/rattlesnake

I think we are almost there

——————————————

https://blog.csdn.net/iTaacy/article/details/60141849

我觉得 Python 暂时死不了

它仍然是科学研究的强大武器

It's about math, not the language itself

If something matters, that will be the language 是否对人类友好

——————————————

主动降噪依赖于电路对噪声信号的预测，以便能够提前（或者说几乎同时）产生一个反相的信号去抵消噪声。既然需要预测，那就要求噪声信号是有规律的信号。生活中常见的噪声通常是机械噪声，由于机械转动产生的噪声本质上都是低频正弦波及其谐波的叠加，所以比较容易预测。人声在短时间内（约30ms）是稳定的声音，但是宏观上看可以认为是随机的，无法预测。


我觉得解决这个问题的关键在于把AI融合进去


如果是“没有必要”屏蔽人声，那为什么不能弄个开关呢？毕竟绝大多数宿舍的噪音就是人声啊，厂家会傻到放弃这么大的市场吗？





这个事情有待深入

——————————————

原理上，主动降噪是麦克风听到噪声后，由控制电路分析，最终使扬声器产生一个和噪声大小相等、相位差180度的声波，与噪声叠加使两者正好抵消干净。



经过我之前的实验，发现Kotlin或者Android上是可以叠加声音的

比如我可以同时开多个Media Player，或者我单开一个player和网易music 一起放

同时，我们插上耳机后，麦克检测到的声音全是噪音

我觉得这个软件可以做

并且是刚需

——————————————

https://www.beatsbydre.com/cn/support/info/noise-canceling-isolating

接下来研究主动降噪

——————————————

take limitation of the sum of series, 如果infinite, 发散

——————————————

So series is actually the sum of some array (list)

——————————————

用 1.5 倍速看完 《妖猫传》

除了全是玄幻外，还行

——————————————

用 sudo chmod -R 777 * 对 ~/.local 进行操作，从而配置好了 linux 下的 visual studio code

这下不用费心费力的自己排版代码了，一键标准化

还有，用ide打开当前目录只需 code .

——————————————

既然有这个，他们怎么还没制造出隔空交互界面...

只要有距离检测，这个肯定可以做

——————————————

用懒人支架看了 《忌日快乐》

懒人生活真好

Happy lazy day!

——————————————

或者换一种使用方式

如果我懂音频处理



我可以将音、视频统一分析，加速或去掉 视频中的无效部分

比如 没动作 and 没声音 = 无效部分

——————————————

我用在屏幕上效果烂透了：鼠标自身的移动以及视觉场景的变化会对它造成干扰



所以这个目前只能是摄影头与子弹发射器分离(在现实世界里，摄影头固定，枪在下方且不能出现在摄影头视野里)

——————————————

当然现实生活中拿来瞄人也是可以的

所谓全自动化击杀

就是这么一回事

——————————————

https://github.com/yingshaoxo/MovingDetector

这东西真正的价值在于：做外挂！

3D 枪战游戏自瞄

——————————————

Tracking 太费内存，又卡又慢


所以最后我还是只采取了运动物体检测基本原理

——————————————

https://www.jianshu.com/p/12533816eddf

这个厉害！

要是我能给它加上object tracking就更好了

——————————————

Windows 在下面这个命令之后用不了，Linux 就可以

pip install opencv-contrib-python










虽然上面给的tracking codes挺好玩，但是我还是需要自己写一个只检测运动物体的script

——————————————

https://www.google.com/amp/s/www.learnopencv.com/object-tracking-using-opencv-cpp-python/amp/


Those two links are definitely different

英文版介绍的方法更多

通过刚才的搜寻，我甚至了解到有人通过object的颜色配合moving检测，从而达到精准

——————————————

https://blog.csdn.net/abc8730866/article/details/70170267

检测移动物体我们是可以做到的

——————————————

编程成了一项不每天花8小时无法进步的人生必修课

——————————————

模电成了分析固定电路的东西

——————————————

数学成了套固定解题模式的东西

公式、定理、解题思路

——————————————

数电 已经变成了学习不同 数字电路元件 或 集成芯片 的课

从考试的角度讲，要记忆

从实用的角度讲，网上都有

所幸这些东西起源于 America, we have thousands of resources😊

——————————————

Hey guys, you really should try this: 

入耳式隔音侧睡不压耳耳机https://m.intl.taobao.com/detail/detail.html?id=533705764675&spm=a2141.7631730.0.i1&ttid=212200%40htao_android_4.1.3#&modal=share

In the one hand, you can never heard your roommates voice, on the other hand, you can have a nice sleep

For the quality of voice, 和 120 yuan 的小米耳机一样，just OK for daily music playing.



The best benefits you can get from this 耳机 is: 你可以在疲惫的午间或下午放学后无视SB室友，通过睡眠补充精力，并由此开启高效脑力活动的一天。

😘

——————————————

这场自我救赎的旅途

就算灵魂在颤抖

就算对脑力的要求远远超出了我的想象

我也必须坚持下去

不然之前的努力算什么？

——————————————

"""
import pyaudio
import numpy as np

CHUNK = 4096 # number of data points to read at a time
RATE = 44100 # time resolution of the recording device (Hz)

p = pyaudio.PyAudio() # start the PyAudio class
stream = p.open(format=pyaudio.paInt16, channels=1, rate=RATE, input=True,
                frames_per_buffer=CHUNK) # uses default input device

# create a numpy array holding a single read of audio data
for i in range(10): # to it a few times just to see
    data = np.fromstring(stream.read(CHUNK), dtype=np.int16)
    print(data, len(data))

# close the stream gracefully
stream.stop_stream()
stream.close()
p.terminate()
"""

import pyaudio
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time

RATE = 44100
CHUNK = int(RATE/20) # RATE / number of updates per second


def soundplot(stream):
    fig = plt.gcf()
    fig.show()
    fig.canvas.draw()
    while 1:
        data = np.fromstring(stream.read(CHUNK), dtype=np.int16)
        plt.plot(data)
        plt.xlim([0, len(data)])
        plt.ylim([-2**16/2, 2**16/2])
        fig.canvas.draw()

        plt.pause(0.01)
        fig.clear()


if __name__ == "__main__":
    p = pyaudio.PyAudio()
    stream = p.open(format=pyaudio.paInt16, channels=1, rate=RATE, input=True,
                    frames_per_buffer=CHUNK)

    soundplot(stream)

    stream.stop_stream()
    stream.close()
    p.terminate()

人生中第一次自己绘制音波

下次争取彻底理解音频，为py audio live发展尽一份绵薄之力

——————————————

# https://github.com/jokermonn/-Api/blob/master/CenterWeather.md
import requests
import json

"""
r = requests.get("http://tj.nineton.cn/Heart/index/all?city=CHJS000000")
j = r.json()
"""
t = """{"status":"OK","weather":[{"city_name":"南京","city_id":"CHJS000000","last_update":"2018-05-02T10:45:00+08:00","now":{"text":"多云","code":"4","temperature":"24","feels_like":"23","wind_direction":"北","wind_speed":"20.16","wind_scale":"4","humidity":"68","visibility":"2.00","pressure":"1010","pressure_rising":"未知","air_quality":{"city":{"aqi":"84","pm25":"62","pm10":"83","so2":"9","no2":"23","co":"0.911","o3":"106","last_update":"2018-05-02T09:00:00+08:00","quality":"良"},"stations":null},"alarms":[]},"today":{"sunrise":"05:20 AM","sunset":"06:45 PM","suggestion":{"dressing":{"brief":"舒适","details":"建议着长袖T恤、衬衫加单裤等服装。年老体弱者宜着针织长袖衬衫、马甲和长裤。"},"uv":{"brief":"最弱","details":"属弱紫外线辐射天气，无需特别防护。若长期在户外，建议涂擦SPF在8-12之间的防晒护肤品。"},"car_washing":{"brief":"较不宜","details":"较不宜洗车，未来一天无雨，风力较大，如果执意擦洗汽车，要做好蒙上污垢的心理准备。"},"travel":{"brief":"适宜","details":"天气较好，风稍大，但温度适宜，总体来说还是好天气。这样的天气适宜旅游，您可以尽情享受大自然的风光。"},"flu":{"brief":"易发","details":"相对于今天将会出现大幅度降温，风力较强，易发生感冒，请注意适当增加衣服。"},"sport":{"brief":"较适宜","details":"阴天，较适宜进行各种户内外运动。"}}},"future":[{"date":"2018-05-02","high":"25","low":"14","day":"周三","text":"阴\/多云","code1":"9","code2":"4","cop":"","wind":"风力4级"},{"date":"2018-05-03","high":"26","low":"14","day":"周四","text":"晴\/晴","code1":"0","code2":"1","cop":"","wind":"风力3级"},{"date":"2018-05-04","high":"26","low":"17","day":"周五","text":"多云\/雷阵雨","code1":"4","code2":"11","cop":"","wind":"风力2级"},{"date":"2018-05-05","high":"20","low":"17","day":"周六","text":"阵雨\/中雨","code1":"10","code2":"14","cop":"","wind":"风力3级"},{"date":"2018-05-06","high":"21","low":"16","day":"周日","text":"大雨\/中雨","code1":"15","code2":"14","cop":"","wind":"风力3级"},{"date":"2018-05-07","high":"22","low":"16","day":"周一","text":"阵雨\/阴","code1":"10","code2":"9","cop":"","wind":"风力4级"},{"date":"2018-05-08","high":"22","low":"17","day":"周二","text":"阴\/大雨","code1":"9","code2":"15","cop":"","wind":"风力4级"},{"date":"2018-05-09","high":"21","low":"16","day":"周三","text":"阴\/阴","code1":"9","code2":"9","cop":"","wind":"风力3级"},{"date":"2018-05-10","high":"20","low":"14","day":"周四","text":"阴\/阴","code1":"9","code2":"9","cop":"","wind":"风力3级"},{"date":"2018-05-11","high":"25","low":"15","day":"周五","text":"小雨\/多云","code1":"13","code2":"4","cop":"","wind":"风力2级"}]}]}"""
j = json.loads(t)

city = j["weather"][0]["city_name"]
all = []
for one in j["weather"][0]["future"]:
    all.append("{date}({day})\n{low}~{high}\n{text}".format(date=one["date"], day=one["day"], low=one["low"], high=one["high"], text=one["text"]))

for one in all:
    print(one)
    print("\n" * 2)

suggestion = j["weather"][0]["today"]["suggestion"]["dressing"]["details"] + "\n" + j["weather"][0]["today"]["suggestion"]["flu"]["details"]
print(all[0])
print(suggestion)

——————————————

VSC是真的屌，加上vim扩展很好用


果然用多了linux，还是想回到Windows傻瓜界面透透气

——————————————

看晃眼了，这是2D

没用

——————————————

不过搜了一下午 关于通信原理的知识


一堆公式，感觉什么都没学到


…这个怕不是给人学的，比编程难

——————————————

所以我选对了专业？

——————————————

https://www.youtube.com/watch?v=YJmUkNTBa8s

干脆以后的小学科笔记全部发 English keywords (关键字) or links 得了，听中文老师讲太恼火了、中文书也看不懂

——————————————

闭源垃圾(s

——————————————

https://github.com/cocos2d/cocos2d-x

真正游戏开发还是得学这个

这是我能想到得 除了 嵌入式开发外 C++ 唯一能做的事了...

——————————————

可以(跨平台)，开源我的最爱


Here has a saying: be your own god

——————————————

正在玩Godot的机器人例程

它采用的是一种混合python、JavaScript的语言

蛮好玩的




要是可以生成安卓游戏就完美了

——————————————

看了 《缩小人生》，无感那是不可能的

作者肯定给我灌输了什么思想😳

——————————————

看了 《Suicide Squad》动画版

cool

——————————————

https://www.youtube.com/watch?v=DIw02CaEusY

windows 开发向来都是初始设置繁琐

虽然 debug 看起来挺好用，但是应该无法用于单片机

——————————————

https://www.geeksforgeeks.org/c-classes-and-objects/

感觉 C++ 的特性蛮多的

还是要在具体的写复杂程序的过程中才能掌握

不过还是要避免使用一些与主流语言不同的特性，比如 swich

——————————————

https://playground.arduino.cc/Code/Library#What

原来C++在写class的时候，用 :: 来标明是哪个 class 的 function (To define a function outside a class.)

——————————————

https://pythonprogramming.net/gpio-input-raspberry-pi-tutorials/

看完后，我感觉Raspberry Pi比arduino更繁琐

——————————————

Great then

——————————————

What's your plan if python 凉了？

——————————————

真无聊，和3D建模差不多

内建JavaScript接口

——————————————

这个对技术要求好像很高

除非用 再生龙

——————————————

http://lengly.top/archives/85

这些人真是吊

我也想修改一个linux系统专门使用 Python 系列软件，只含有 kivy 等py系界面库 制作的 桌面程序

——————————————

不行，unity2018无法破解

2017可以

——————————————

正在安装 unity 2018


准备玩一波

——————————————

换言之，就是没有我找不到的软件…

——————————————

同一种功能的替代品

——————————————

人是不是到了一定年龄就会觉得软件开发没意思啊？

我的意思是都有代替品了

——————————————

刚刚试用了一下 Visual Studio Code

还行，代码美观

——————————————

好像行不通

1. 两个摄影头测距的方法很复杂，还是硬性编码，基于opencv

2. 用tensorflow需要有大量的robot图片，万一下次比赛那些人把机器人外貌变了…

3. 我懒，上次自动开枪的图片我都懒得label

——————————————

bilibili直播软件，摄像头属性里竟然还可以美颜、加特技………

白录了好多视频

——————————————

我才看懂 stack overflow 是什么意思

堆栈溢出，典型的错误，于是就明白这个网站是干什么的了

——————————————

我这边创新学院的院长想让我做自动化的搏击机器人


方案一，用距离传感器
方案二，python物体检测


我比较倾向于2，所以我得先做实验，确认是否可行

——————————————

2.2倍速看了《大世界》

社会

https://baike.baidu.com/tashuo/browse/content?id=b7a9e6fb3b85cbbb98f1fe68&fr=qingtian&lemmaId=22150319

——————————————

当然，还享受了几天地质大学的高级迎宾馆

——————————————

不过这次去武汉还是有收获的

至少知道全中国除了上海

都是 多平民窟＋少城市化 模式

——————————————

我那个机器人小队有个特点：我说什么，它们反对什么



下次如果还和他们一组，我就反着说

——————————————

我还发现

成为真正的程序员之后




一切不在自己掌控范围的东西都无法保证质量

因为普通人永远无法像程序员一样突破人类极限、追求完美

——————————————

Programmer
Hardware master
Teacher-maybe

为什么这么厉害 Twitter 上关注的不多

你是怎么来到这儿的？

——————————————

https://github.com/yingshaoxo/driver

——————————————

等会儿整理一下

全部开源，让他们下次没法比

——————————————

还是做软件吧

——————————————

我的算法几乎超越了场上4/5的人

但车走不直、机动性不强我也没办法啊…

——————————————

硬件上有问题

软件上是没法突破的

——————————————

以后再也不参加硬件比赛了

——————————————

被人宠惯了

脾气就大




我组就有这样一位(但我坚决不让他上场😁

——————————————

这确实是一场对心理成熟度的考验

谁候场谁知道

——————————————

今天下午就是参加这个赛

——————————————

一个人走路才回想起来自己19岁了

——————————————

年轻人性格太急躁就容易做错事

只有多经历几次挫折才会稳重吧！

——————————————

主要是调用三方win api

——————————————

甚至连跑出轨后退都没有

——————————————

到了现场才知道

他们根本没人搞出来高科技节点跑路法

——————————————

不，比小镇还大

——————————————

中国地质大学就像一个小镇一样…

——————————————

一方面我睡不着，还想写代码

另一方面，没硬件给我运行

也许这就叫有心无力吧

——————————————

妄我自命程序员

连一个小车程序都做不好

——————————————

我现在有点心得了


写小车程序这种需要高动态处理的东西

最重要的成功因素是：

在 main loop 里少加 delay，越少越好，0就最好了！

——————————————

不好意思，我的朋友们，这几天我可能会忙得见上帝

所以没有过多时间进行自我提升和知识分享

I'm sorry

——————————————

买了个德胜牌头戴麦克

以为效果会好点

结果发现还不如我的小米耳机自带的麦克




所以20块白花了，还不如用几毛钱买一个防噪棉套在小米耳机上对音质有提升

——————————————

上午录(直播)了两小时的AI learning

说了2小时的英语，真爽！




这才感觉是个人(living)

——————————————

https://kg2.qq.com/node/play?s=A4mqQGAm-r_HzAOn&shareuid=609b9b8620283382&topsource=a0_pn201001006_z11_u26635549_l0_t1524235138__

——————————————

寻迹小车 寻迹部分完成

目前需要用超声波传感器通过测距提前检测障碍物，然后关掉寻迹

再恢复寻迹

https://github.com/yingshaoxo/driver/blob/current/driver.ino





24号去武汉比赛，要是做不好，就浪费了一个月的时间

——————————————

我决定再也不劳累自己

一回寝室就睡觉

运气好早上自然醒就做正事，要不然就算了



如果我时间不够，只能说明我效率太低

——————————————

感觉毛概课再上下去，我就废了

本来该拿来做笔记、写作业的时间

就这样没了，还考什么试、毕什么业、上什么岗

——————————————

宿命

Destiny

——————————————

I don't want to learn those shit unless I can lay on bed, typing.

——————————————

我感觉学模电或通信原理时

我前面有一个真空黑洞，大量的知识，好的坏的，全在里面

如果我不仔仔细细地搭好逻辑桥，下一节课我就会被撕得粉碎，以前学过的东西全线崩塌(  最后的结果大概就是再也听不懂老师在说什么，是一种由心而发的疲乏)

——————————————

你把 system357 小哥哥屏蔽之后

就失去了一个大神的信息来源

所以就让他继续笑吧😄

——————————————

65.无法量化为计算机可处理的逻辑的教学，毫无意义。

——————————————

Find peace when I listen to this


I wonder why these applications could keep in free

It's the benefit of Ad?

——————————————

只是要怎样做得像 pornhub github 或vultr 一样，让用户心甘情愿的花钱

让它们觉得花得值

——————————————

我只是知道一个项目不盈利肯定会死

只是早和晚的问题

——————————————

如果让你想一个可以盈利的互联网项目

你能想到什么？

——————————————

好玩的定义是什么？

我觉得是 reaction



如果一个固定不动的正方体和一个可以四处滚的球，你肯定会觉得球更好玩，因为 it will react quickly if you keep touching it.

——————————————

已入自考本科学历怪圈

——————————————

再这样消沉下去肯定不行

必须得在每个周末录一段才能进步

https://developers.google.com/machine-learning/crash-course/first-steps-with-tensorflow/programming-exercises

——————————————

By the way

当我把所有数学知识都转成 English based 之后，我感觉高数超简单，有的是资源

——————————————

学了9节课  sentdex 的 pygame tutorial


发现好无聊


本来还想做个小车模拟程序以便一次性解决硬件条件不足的问题(不能疯狂地debug)

——————————————

https://yingshaoxo.xyz/book/notes/multiplexer.html

搞定

——————————————

我们所做的事

无非是用技术对权力和财产进行重新分配

也就是用个人奋斗突破血缘亲族的枷锁

——————————————

因为再不赚点钱连耳麦都买不起了

你看音质那么差

——————————————

https://youtu.be/-f8tts4WRRk

实在不行就只能做点 sex website 维持生活了

——————————————

我不是要创业吗

总得做点什么

您看做什么好？

——————————————

在github做网站连服务器都省了

用户通过github提交url

——————————————

你说我去创建一个全国性的社团怎么样？(网站、app、用户贴url，评论用第三方)

极客公社




然后我以后发的所有视频都贴上它的名字

——————————————

http://music.163.com/song/506747016/?userid=280429778

——————————————

我们实验室的3D打印机

——————————————

我已经掌握了如何批量加速无声片段

等我把上上次的视频用这个方法处理完

发视频教程

——————————————

https://drive.google.com/file/d/1sHJzkMX5XQxVI6btFiCOTthXlEGS2oIc/view?usp=sharing

测试通过，就是不知道怎么通过 marked regions 批量加速没人声的部分

现在只能自动删除没声音的音频和视频

——————————————

看完 《The shape of water》

没什么感想，又过了一个周末

——————————————

工欲善其事, 必先利其器

想学AI，就得在平时零碎时间(没有图书馆、教室，需要面对只会打游戏傻逼室友时)用百词斩背单词

——————————————

暂时写好了

但个人觉得没有numpy好用


numpy可以直接处理数据，sympy只能做点书上的符号运算

——————————————

from sympy import *

x, y, z = symbols('x y z')
init_printing(use_unicode=True)

r = simplify(1/(1 + ((y**2)/x)) * (y * ((-1)*(x**(-2)))))
r = latex(r)
print(r)

我想把数学工具写进 auto_everything 的数学模块里

这样以后就不需要手算 anything 了，同时也方便程序自身调用

——————————————

翻了一圈

发现国外论坛一个问题可以讨论几年



顺着看下去就有解决方案了

http://vegasaur.com/silence-detector

——————————————

我想实现这个功能，从而自动加速视频。然而没找到例程。

——————————————

不管了

反正我自己掏钱淘宝24买了块uno增强板

学校自己又花80买了块

准备做测试




我已经不报希望了





我们还是回到正常开发吧

——————————————

那只是usb接口

我们所有板都是DC电源接口插入不亮




我觉得它有病，usb有保险丝，DC直流没有

明明usb不容易烧

——————————————

https://yingshaoxo.xyz/book/notes/number_system.html

摆脱线上活动的感觉大概就是这样了

——————————————

https://github.com/GitbookIO/editor-legacy#how-to-install-it-on-linux

以后就离线写笔记吧

顺便把 它 搞到 github webpage 上去

——————————————

现在我是彻底理解软件开发的好处了

抽象才是王道

可迭代、永不损坏才是最重要的




(Happy(find where you are good at) is the most important thing in life😁)

——————————————

烧了两块板(所有板)

不打算玩了😡




垃圾主板没有类似保险丝的东西

——————————————

今天数电老师讲这个，我已经懵了

这玩意儿笔记怎么做啊？

——————————————

Too bottom to nothing.

太底层以至于做不出什么东西来。





哇，我现在的课程全部在学底层硬件

受不了了

直接用微型计算机，比如树莓派会死啊…

——————————————

确定了

26号以后





不管是继续参加比赛还是不参与一切活动

都把星期六、天空出来，录视频+做笔记 (也就是我的学习之道了)




比赛啥的太费时间了，老是不学习，停在原地也不是一件好事，要是完不成今年的任务，我怕是会后悔一辈子

——————————————

https://yingshaoxo.xyz/post/How%20to%20use%20gitbook%20right%20in%20local.html

npm挺好用的

——————————————

http://www.manythings.org/voa/scripts/


Read it loudly if you feel sad!

——————————————

看起来被人算计了

——————————————

https://yingshaoxo.xyz/post/Use%20Platformio%20to%20take%20the%20place%20of%20Arduino.html

——————————————

我知道 mux 是什么意思了

多信号转一信号、用一根线

——————————————

Those new friends don't know what they will face

But I knew it very well

The real world is complicated, you have to be very careful.

Because if you don't do so, maybe the biggest chance of your life would come across you

And you won't meet it again

——————————————

I don't need to learn anything right now 

Just leave me alone, give me a quiet place

盲目的学习犹如吃东西分不清食与屎

——————————————

我之前被官方比赛培训的文档给误导了

所谓灰度传感器并不能发出红光，所以它不是红外传感器




小车寻线这个事，通过搜索，还是红外线比较靠谱

——————————————

https://blog.csdn.net/qq_16775293/article/details/77836020

马的，明天晚上试一下4个传感器，不行就不玩了

——————————————

小车没法做了

物理世界和程序世界不一样

传感器不像纯数学那样没有误差




整天一股恶心的不可预测因素围绕着我😱


感觉灵魂被掏空

——————————————

模电到了 Bipolar Junction Transistor Biasing

English book 是基本上看不懂了😞

——————————————

无奈

为啥读中职呢？




失败的实验性教育

——————————————

到时候考到上海来呗

——————————————

你是大学吗？

——————————————

从此知道怎么用非delay方法，进行时钟控制

——————————————

知道就可以用这个控制上传了…

——————————————

现在我知道学校买的那块板是仿造的谁了

——————————————

好，到时我看看

——————————————

最后吐槽一下

C没有class的概念

项目大了写着好困难

同时垃圾 Arduino 还不支持在一个文件夹放n个c文件互相调用

想专业化重构工程都不行😒

——————————————

https://github.com/yingshaoxo/driver/blob/current/driver.ino

1. 为了做这个我快拼了老命
2. 这个配套的传感器是垃圾，还不如淘宝几块钱的东西
3. 官方一个灰度传感器卖200（垃圾比赛不允许用三方零件）
4. 学校还不太愿意批钱
5. 傻逼吧，传感器都不够还敢参加比赛（本来要3个灰度传感器才能识别黑线，现在两组平分下来只有2个「黑脸」）

——————————————

https://colab.research.google.com/notebooks/mlcc/first_steps_with_tensor_flow.ipynb?hl=en#scrollTo=941nclxbzqGH

直播完成

——————————————

不

B站可以边直播、边录视频

并且B站自带降噪

——————————————

打算用 twitch

初略地看了一下 Open Broadcaster Software

发现B站的win直播软件就是直接拿它改的😏






 http://music.163.com/song/477320018/?userid=280429778

——————————————

唯一的缺点就是B站直播一晃就过去了

留不下宝贵的学习经历

——————————————

https://colab.research.google.com/notebooks/mlcc/intro_to_pandas.ipynb?hl=en#scrollTo=yBdkucKCwy4x

我通过 B 站直播学完了这一个网页

注意！是在寝室！克服了干扰！

果然直播有用

——————————————

《1993聊斋艳谭之灯草和尚》 可以说是中国(如果香港属于中国)史上最好的色情片

既展现了中国传统文化(服饰、装潢、鬼神说)，又集中体现了性爱文化的方方面面(比如男女、女女、自慰、强奸)

不仅剧情设计精美，演员自身素质也高(颜值、身材)

1.5、2倍速切换观看

——————————————

https://join.baicizhan.com/

以后去百词斩(看看)也不错



别人旅游看风景，我旅游看公司

——————————————

我知道我以后的星期六、星期天怎么过了

B站 直播 学习

包括AI、写代码、写作业、写笔记






这样又可以装逼，又不耽误学习和未来，一举三得，何乐而不为？

——————————————

The problem is how

——————————————

The more touches on other fields, the more I'd like to begin my journey on tensorflow(or real ML project)

——————————————

#include <avr/io.h>
#include <avr/interrupt.h>

#define RESOLUTION 65536 // Timer1 is 16 bit

class TimerOne
{
  public:
 
    // properties
    unsigned int pwmPeriod;
    unsigned char clockSelectBits;

    // methods
    void initialize(long microseconds=1000000);
    void start();
    void stop();
    void restart();
    void pwm(char pin, int duty, long microseconds=-1);
    void disablePwm(char pin);
    void attachInterrupt(void (*isr)(), long microseconds=-1);
    void detachInterrupt();
    void setPeriod(long microseconds);
    void setPwmDuty(char pin, int duty);
    void (*isrCallback)();
};

extern TimerOne Timer1;

——————————————

你说这是给人看的吗？


/*
 Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328
 */

#include "TimerOne.h"

TimerOne Timer1; // preinstatiate

ISR(TIMER1_OVF_vect) // interrupt service routine that wraps a user defined function supplied by attachInterrupt
{
  Timer1.isrCallback();
}

void TimerOne::initialize(long microseconds)
{
  TCCR1A = 0; // clear control register A 
  TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer
  setPeriod(microseconds);
}

void TimerOne::setPeriod(long microseconds)
{
  long cycles = (F_CPU * microseconds) / 2000000; // the counter runs backwards after TOP, interrupt is at BOTTOM so divide microseconds by 2
  if(cycles < RESOLUTION) clockSelectBits = _BV(CS10); // no prescale, full xtal
  else if((cycles >>= 3) < RESOLUTION) clockSelectBits = _BV(CS11); // prescale by /8
  else if((cycles >>= 3) < RESOLUTION) clockSelectBits = _BV(CS11) | _BV(CS10); // prescale by /64
  else if((cycles >>= 2) < RESOLUTION) clockSelectBits = _BV(CS12); // prescale by /256
  else if((cycles >>= 2) < RESOLUTION) clockSelectBits = _BV(CS12) | _BV(CS10); // prescale by /1024
  else cycles = RESOLUTION - 1, clockSelectBits = _BV(CS12) | _BV(CS10); // request was out of bounds, set as maximum
  ICR1 = pwmPeriod = cycles; // ICR1 is TOP in p & f correct pwm mode
  TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
  TCCR1B |= clockSelectBits; // reset clock select register
}

void TimerOne::setPwmDuty(char pin, int duty)
{
  unsigned long dutyCycle = pwmPeriod;
  dutyCycle *= duty;
  dutyCycle >>= 10;
  if(pin == 1 || pin == 9) OCR1A = dutyCycle;
  else if(pin == 2 || pin == 10) OCR1B = dutyCycle;
}

void TimerOne::pwm(char pin, int duty, long microseconds) // expects duty cycle to be 10 bit (1024)
{
  if(microseconds > 0) setPeriod(microseconds);
  if(pin == 1 || pin == 9) {
    DDRB |= _BV(PORTB1); // sets data direction register for pwm output pin
    TCCR1A |= _BV(COM1A1); // activates the output pin
  }
  else if(pin == 2 || pin == 10) {
    DDRB |= _BV(PORTB2);
    TCCR1A |= _BV(COM1B1);
  }
  setPwmDuty(pin, duty);
  start();
}

void TimerOne::disablePwm(char pin)
{
  if(pin == 1 || pin == 9) TCCR1A &= ~_BV(COM1A1); // clear the bit that enables pwm on PB1
  else if(pin == 2 || pin == 10) TCCR1A &= ~_BV(COM1B1); // clear the bit that enables pwm on PB2
}

void TimerOne::attachInterrupt(void (*isr)(), long microseconds)
{
  if(microseconds > 0) setPeriod(microseconds);
  isrCallback = isr; // register the user's callback with the real ISR
  TIMSK1 = _BV(TOIE1); // sets the timer overflow interrupt enable bit
  sei(); // ensures that interrupts are globally enabled
  start();
}

void TimerOne::detachInterrupt()
{
  TIMSK1 &= ~_BV(TOIE1); // clears the timer overflow interrupt enable bit 
}

void TimerOne::start()
{
  TCCR1B |= clockSelectBits;
}

void TimerOne::stop()
{
  TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); // clears all clock selects bits
}

void TimerOne::restart()
{
  TCNT1 = 0;
}

——————————————

#include <file>
This variant is used for system header files. It searches for a file named file in a standard list of system directories.

#include "file"
This variant is used for header files of your own program. It searches for a file named file first in the directory containing the current file, then in the same directories used for <file>.

——————————————

看完了 房客(The Lodgers 2017) ，一脸蒙逼

没看懂结局



并且翻不到影评

——————————————

AI 是凡人杀手


所以能活过 AI 时代的，都是超人

——————————————

玩游戏

——————————————

游戏背景制作

——————————————

​​FlappyLearning
使用进化算法机器学习玩 Flappy Bird。

语言：#JavaScript
分类：#机器学习

——————————————

​​WaveFunctionCollapse
使用机器学习生成相似的图片。

语言：#csharp
分类：#机器学习

——————————————

感觉整个人都不好了

小车的传感器不咋地



神烦，传感器接口也只能用4个，3个灰标、一个超声波就没了

要是可以同时用更多传感器我也不会这么烦



晚上睡实验室

——————————————

Chrome 就两点不好：

1. 看pdf不能滑词翻译
2. 滑词翻译不能自动发音

——————————————

不过说实话

把 C 写成 Python 感觉挺好玩的





万物皆 Py😂

——————————————

累

把寻黑色路线部分写完了




明天测试一下应该可以上数组记nodes了

——————————————

换新实验室了

——————————————

那些老师就知道硬件

编程好的，比如我班主任教单片机，绘图用mathlab，你说能有多厉害？。。。







好了，我知道了，用 struct 效果比较好，就怕到时候内存不够用

struct dict
{
    int key;
    int value;
} nodes[30] = {
    {0, 4},
    {1, 5},
    {2, 6},
    {3, 7},
    {4, 8},
};


目前我写的代码:
#include<stdio.h>

// /*
void analogWrite(int pin, int value) {
    printf("%d: ", pin);
    printf("%d\n", value);
}
// */

struct dict 
{
    int key;
    int value;
} nodes[30] = {
    {0, 4},
    {1, 5},
    {2, 6},
    {3, 7},
    {4, 8},
};

void set_left_wheels(int go_or_back, int value) {
    if (go_or_back == 1) {
        analogWrite(9, value);
    } else if (go_or_back == -1) {
        analogWrite(10, value);
    } else if (go_or_back == 0) {
        analogWrite(9, 0);
        analogWrite(10, 0);
    }
}

void set_right_wheels(int go_or_back, int value) {
    if (go_or_back == 1) {
        analogWrite(5, value);
    } else if (go_or_back == -1) {
        analogWrite(6, value);
    } else if (go_or_back == 0) {
        analogWrite(5, 0);
        analogWrite(6, 0);
    }
}

void go_straight(int value) {
    set_left_wheels(1, value);
    set_right_wheels(1, value);
}

void go_back(int value) {
    set_left_wheels(-1, value);
    set_right_wheels(-1, value);
}

void stop() {
    set_left_wheels(0, 0);
    set_right_wheels(0, 0);
}

void turn_left() {
    set_left_wheels(1, 100);
    set_right_wheels(1, 255);
}

void turn_right() {
    set_left_wheels(1, 255);
    set_right_wheels(1, 100);
}


int main() {
    printf("%d\n", nodes[1].key);
    printf("%d", nodes[1].value);
}

void setup() {
}

void loop() {
}

——————————————

~/.vimrc setting


au FileType c map <F5> :w<CR>:!gcc % && ./a.out %<CR>
au FileType python map <F5> :w<CR>:!python3.6 %<CR>
au FileType go map <F5> :w<CR>:!go run %<CR>
au FileType sh map <F5> :w<CR>:!bash %<CR>
"<CR> means a Enter key.
"For :w<CR>, I don't know its means.

au BufNewFile,BufRead *
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set expandtab |
"\ set autoindent |
\ set fileformat=unix
" autoindent may cause bad behavior when you paste in vim

——————————————

@system357 

要是你来做指导老师

岂不是每次都能获奖😂

——————————————

我知道了

——————————————

主要是没有 int list

只有 char *[]

——————————————

然后我的 c 应该想办法记录十字或转弯节点并记录是否转弯的int number

类似dict

——————————————

我的主板只能接这个

——————————————

什么意思？

没有…

——————————————

等会儿我跑完步(学校强制)

给你一张高清图

——————————————

是可以

——————————————

水货，诶

——————————————

今天晚自习捣鼓了半天，没用起来

platformio 也没用起来，不知道板子型号



最后还是依靠 arduino Linux version settings 里面的 依靠外部编辑器

每次 vim 保存文件后， arduino 自动重载代码

——————————————

Arduino那个 uno 板 怕是 upload 不了c++

我试了一下报错

——————————————

You Complete Me 好坑爹啊

花了几个小时把它安装好并可以补全c

然后想写教程，发现写的东西不能用…

怪不得我以前老是装不好😢

——————————————

成就越大

影响力越大




反过来理解，你的能力可以通过影响力反映出来

——————————————

一开始认真写 c

思维就僵化 




发现我能力好低


比如用c写个 dict结构




怀恋c++

——————————————

由于 cloudflare 有强制转发这个功能

Let's encrypt 初始设置时就不需要强制转https，于是就没有了相关 ProxyPassReverse 的 Bug


于是就有了完美的小绿锁


于是 Apache 搞坏了就把对应的 Apache config folder 删掉， apt purge 再 reinstall

于是你就可以乱搞了

——————————————

这才是设置 github https 的正确方式

https://gist.github.com/cvan/8630f847f579f90e0c014dc5199c337b

——————————————

如果我是学校楼梯设计者

我就会把上下行的空间分别压缩为只能容纳一人的宽度

这样就不会有混乱的拥挤

——————————————

大学政治类课程创始人：(对于28原则中8那部分，)同样都是洗脑，被敌人洗脑还不如被我洗脑

——————————————

你到底是软件工程师还是硬件工程师啊

看不懂 string [0] 和 string[-1] 两个词

——————————————

https://playground.arduino.cc/Interfacing/Python

有空看看如何用python和vim控制烧录

——————————————

今天测试了直流电机和碰撞传感器

尝试了烧录

感觉挺简单的



setup() 定义管脚或 series信息回传

loop() 每循环一次，读取传感器的信息 或 回传msg




只是觉得在 Arduino 敲代码效率低下，想在 Linux 下用它，配合 Vim 与 Git

——————————————

如果用颜色识别

瞬间感觉又是份苦力活

回到原始的刀耕火种按键精灵脚本时代

——————————————

看起来，你们说得对

32k内存的东西不可能用到摄像头

——————————————

很奇怪吗？

——————————————

我个人还是很奇怪，不知道他把 调用 OpenCV 的代码 与 Arduino的代码  分开是做什么

可能是想让我们这些参赛者自己去写一下代码吧。。。

——————————————

把例程和管脚之间的联系、socket 的详细逻辑理解后

下个星期，我就要开始用 opencv(c++) 做传统人工智能跨障碍小车了

为期 26 天

——————————————

今天实际接触了 探索者 的开发板

和例程



发现它是用的 opencv 的 C++ 调用，识色、灰度图或框架

然后摄像头与Wi-Fi发射器连一起，主板与摄像头用 局域网 socks 连接

——————————————

什么鬼

阴蒂？

——————————————

https://brain-surface-viewer.herokuapp.com/

厉害了，我的 America

——————————————

这简直就是大数据实时监控利器

C++可以去死了

无敌的运维、让老板看得见、摸得着的东西…

——————————————

https://dash.plot.ly/getting-started

看着这些精美的图渲染在我的浏览器，我在想，学什么 Javascript 啊。。。

——————————————

http://music.163.com/song/474932965/?userid=280429778

——————————————

https://www.programiz.com/c-programming

看完了，这样的话，学校的探索者机器人项目编程就有基础了

不管了，原来　Ｃ　就那么点内容

——————————————

https://github.com/madscheme/resume/blob/master/resume10.pdf

很明显，我没有达到它2016-2018年的高度

如果我达到了，现在就应该能写出同时为百万用户提供服务的程序

——————————————

看来以后只能用 比特币 了

——————————————

填不了😭

——————————————

人长大了还需要学着投资，买买股票啥的

http://www.bilibili.com/video/av21355570?share_medium=android&share_source=copy_link&bbid=E0626135-9650-438C-9974-1B8315ED7B0613493infoc&ts=1522364251277


有谷歌手机号就是好

——————————————

完成了，以后再做爬虫就用AI方式破解各种变态验证了，传统方式正处于消亡中

from auto_everything.web import Selenium
from time import sleep

my_selenium = Selenium("https://www.google.com")
d = my_selenium.driver

# get input box
xpath = '//*[@id="lst-ib"]'
element = my_selenium.wait_until_exists(xpath)

# text inputing
element.send_keys('\b' * 20, "yingshaoxo")

# click search button
element = my_selenium.wait_until_exists('//*[@id="tsf"]/div[2]/div[3]/center/input[1]')
element.click() # d.execute_script("arguments[0].click();", element)

# exit
sleep(3)
d.quit()


https://pypi.python.org/pypi/auto-everything

0.8版发布，还是__filename.py隐藏方式好用

——————————————

算了，没什么实际的用处

vim还是把所有东西都拉出来了…

——————————————

https://github.com/SeleniumHQ/selenium/tree/master/py/selenium/webdriver

——————————————

比我想像的要高级，它是用文件夹分割的主框架，然后用 init.py 来导入那些需要提供给用户的模块

——————————————

随着开发的深入

我会把 AI technology 用在 auto_everything 里面

——————————————

通过对照 selenium 的模块

突然发现我写 auto_everything 的方式是错误的

init.py 里面什么都不应该放

这样才会让用户从 module 文件用点导入，而不是直接出子类

——————————————

http://yingshaoxo.xyz/post/Running_Jupyter_on_server.html

重写了教程，以后可以在下课的时候看代码了

——————————————

https://docs.scipy.org/doc/numpy/reference/generated/numpy.r_.html

踏踏实实，勤勤恳恳，以后numpy就是我的好朋友了

——————————————

难是省略太多步骤

复杂是有太多步骤

——————————————

在保修期，但是发票不见了

😕😁

——————————————

https://fordroid.com/huawei-honor-pad-2-huawei-mediapad-t2-8-pro-jdn-l01-jordan/

垃圾华为，我也是醉了，全是升级包，没有一个 full-OTA

这样的话就没办法修复我的平板了

——————————————

task 1: AI learning, read book and do experiences

task 2: 三端融合 (Android, Web, Server)
yingshaoxo'app | Kotlin 做原生才能做到的事，APP框架
WebMathChat | JavaScript 在 web view 里配合 Kotlin 做离线界面与普通运算
KingChat | Python 在后端负责 API, database, AI 等复杂运算，为 web view 有网状态提供服务
Useful Golang | Golang 在后端负责 serve static files 与 替换 Apache 的功能

task 3: School knowledge, including English, Mathematics

task 4: Robot match


4个任务并行，由前到后重要性递减

——————————————

fuck that

以后安卓界面都用JS写吧


https://developer.android.com/guide/webapps/webview.html#BindingJavaScript

——————————————

差不多安卓原生界面开发大势已去

同样的一个特性，JS写起来特别简单，安卓就算用kotlin也想吐血

——————————————

垃圾华为荣耀平板2被我搞坏了

fastboot可以进、twrp可以进

就是进不了系统，几个所谓的官方固件都试了，不行



可能是之前我手动 flash boot.img 和 system.img 出的问题

——————————————

我之前讲程序员 god 化是有依据的

因为学的东西越来越多

不断突破一人代替多人的实用智力极限

——————————————

受不了垃圾中文混乱的逻辑

必须得全英文化

——————————————

用 bitpay 创建了一个 wallet

发现不实名制就无法买币…


有啥用？

——————————————

星期天在空无一人的教室 6M/s 下电影还是蛮快的

这样的话，在教室待一天应该就能下载任意一个美剧、日漫

——————————————

OK, now I'm finished doing this project

https://github.com/yingshaoxo/No_More_Chinese/releases/tag/1.0

——————————————

http://yingshaoxo.xyz/post/How%20to%20create%20an%20chrome%20extension.html

可能我还是缺乏耐心

——————————————

Back to reality.

Did you notice that 计算机科学家写的东西有系统性，同时一个外行写的书用的语言更容易让人理解？

遇到一个好作者真难

——————————————

得了，下午也不“回去”了，吃完饭就拎上笔记本，去图书馆，没准还可以在空楼层练习英语

——————————————

下次我吃完午饭也不回寝室了

垃圾室友

毁我时间



中午的零碎时间看看书还是好的

——————————————

诶

我怀疑 JavaScript 是不是又革新了

游览器中运行AI倒是挺省服务器的

关键是技术会被盗取

——————————————

​​Tesseract OCR
支持超过100种语言的文字识别，支持输出为各种文档格式。还有纯js实现的版本Tesseract.js 可以运行在浏览器或者 node.js 中。

语言：#cpp
分类：#图像识别 #文字识别

——————————————

I'm not worry about where I'm gonna go. 

I'm worry about if I can't reach that level, what my life would be!

——————————————

https://elitedatascience.com/keras-tutorial-deep-learning-in-python

My mom(pretend to be) told me never give up, so I won't.

——————————————

But seems like it still got its own difficulties for me to understand,

——————————————

This may be the greatest tutorial about tensorflow in the world!

https://www.tensorflow.org/tutorials/layers

——————————————

我想了想，还是自己强

才能抓得住机会




不然机会再多都是泡沫，继续我们的 AI learning 吧

学校的人靠不住，一群SB，害怕创新、害怕投资、互相对抗、暗箱操作、不按常理出牌、体制僵化

——————————————

override fun onUserLeaveHint(){}

从此以后知道用户什么时候点了 home key

——————————————

这个作者为什么这么屌？

我感觉完全没思路在安卓上这么深度与自由的运行 Python codes

——————————————

考四级，我竟然要听电台😐

——————————————

Kotlin asynchronous still in experimental

Java 那一套又很麻烦

——————————————

But by default, a service runs in the same process as the main thread of the application

Therefore, you need to use asynchronous processing in the service to perform resource intensive tasks in the background

——————————————

感觉很奇怪，如果是以前，我肯定会很高兴，但我现在很平静

——————————————

https://github.com/ageitgey/face_recognition

I think this is the simplest way to detect different person's face.

——————————————

@system357 

哥，你觉得这个有价值吗

——————————————

我想了想

凭我的技术，最多用树莓派





另外，我的另一个项目关于 探索者机械组件(http://www.robottime.cn/h-col-116.html)

——————————————

正在和学校科协讨论 比赛事项

我要去搜索，探寻 用安卓开发板做人脸识别开锁 的可行性

能就搞

——————————————

http://yingshaoxo.xyz/post/Make%20a%20always%20running%20service%20in%20android%20based%20on%20kotlin.html

——————————————

安卓 service 真可怕

会在允许范围内不断重复启动你的代码…

等会我把教程post写好 并把 实际项目发出来

——————————————

https://www.bilibili.com/video/av6679048/?spm_id_from=333.334.bili_music.12

今天在教室撸了一把

——————————————

好好复习

考个只有4人寝室的学校




面对的傻逼少、噪音小，学习生活就舒坦了

——————————————

感觉我的耳机弱爆了，收音差，噪音还多

有必要换一个好的，不然不适用于学校录音环境

——————————————

I would like to give you a talk:

https://youtu.be/laTyZz9eepA

——————————————

Just believe it

English will give us the power to reach our dream

——————————————

没有

你上次离我而去不就是因为我颓废了吗

——————————————

今天体验了一波计算机办公4级模拟考试

我只想说 用 markdown + latex + python 会死吗

——————————————

https://www168.lunapic.com/editor/?action=transparent

Really powerful!

——————————————

我觉得自动音量这个东西

应该考虑两方面，

1是基础噪声，需要在声音开始时检测

2是设备自身发出的噪音；这个需要提前检测设备将发出的声音，这个声音需要在录音时过滤掉(难度较大)

——————————————

from auto_everything import Base

from urllib.request import urlopen
from pydub import AudioSegment
from pydub.playback import play

from pulsectl import Pulse

import csv

b = Base()

def detect():
    r = b.run_command("soundmeter --collect --seconds 60", timeout=70)

    if 'error' in r:
        command = """sudo apt-get install python3-pyaudio
sudo -H pip install soundmeter --allow-all-external --allow-unverified pyaudio"""
        b.run_command(command)

        r = b.run_command("soundmeter --collect --seconds 60", timeout=70)

        if 'error' in r:
            print("You have to make sure env is OK")
            exit()
    
    return r.split('avg:')[-1].strip(' ')

def play_mp3():
    mp3file = urlopen("http://localhost:2018/music/demo.mp3")
    with open('test.mp3','wb') as output:
      output.write(mp3file.read())

    song = AudioSegment.from_file("test.mp3", format="mp3")
    # song += 10
    play(song)

def get_volume():
    with Pulse('volume-example') as pulse:
        sink_input = pulse.sink_list()[0] # first random sink-input stream
        volume = sink_input.volume
        #print(volume.values) # list of per-channel values (floats)
        #print(volume.value_flat) # average level across channels (float)
        return volume.value_flat

def set_volume(num):
    with Pulse('volume-example') as pulse:
        sink_input = pulse.sink_list()[0] # first random sink-input stream
        volume = sink_input.volume
        volume.value_flat = num # sets all volume.values
        pulse.volume_set(sink_input, volume) # applies the change

def write_csv(name, list_):
    with open(name, 'a', newline='') as fout:
        csvout = csv.writer(fout)
        csvout.writerows(list_)


while True:
    noise = detect()
    play_mp3()
    volume = get_volume()

    write_csv('training.csv', [[noise, volume]])

现在开始收集数据

——————————————

好了，现在我可以得到两个参数，一个是每放完一首歌花一分钟检测周围环境音量得到的数字平均值，另一个是每首歌播放结束时我的手动调节音量(用pulsectl)


from pulsectl import Pulse

def get_volume():
    with Pulse('volume-example') as pulse:
        sink_input = pulse.sink_list()[0] # first random sink-input stream
        volume = sink_input.volume
        #print(volume.values) # list of per-channel values (floats)
        #print(volume.value_flat) # average level across channels (float)
        return volume.value_flat

def set_volume():
    with Pulse('volume-example') as pulse:
        sink_input = pulse.sink_list()[0] # first random sink-input stream
        volume = sink_input.volume
        volume.value_flat = 0.3 # sets all volume.values to 0.3
        pulse.volume_set(sink_input, volume) # applies the change


我得试一试前面我能训练的最简单的AI模型

这样的话，我们这周的视频就有了

——————————————

https://pypi.python.org/pypi/soundmeter

sudo apt-get install python3-pyaudio
sudo -H pip install soundmeter --allow-all-external --allow-unverified pyaudio
soundmeter --collect --seconds 10

Look! We can make that program with auto_everything.

——————————————

How to get user touch position, then move a widget


val handleTouch = View.OnTouchListener { v, event ->
            val x = event.x.toInt()
            val y = event.y.toInt()

            when (event.action) {
                //MotionEvent.ACTION_DOWN -> Log.i("TAG", "touched down")
                //MotionEvent.ACTION_MOVE -> Log.i("TAG", "moving: ($x, $y)")
                MotionEvent.ACTION_UP -> {
                    your_widget.x = x.toFloat()
                    your_widget.y = y.toFloat()
                }
            }

            true
        }

        your_base_view.setOnTouchListener(handleTouch)

——————————————

Exactly, 确实可以自己写


但现在我发现，就目前而言，想让产品有市场

1. website，介绍你的产品并让人下载

2. Mobile Software，let users use your Software everyday with convenience

3. Windows平台，附加产品，方便办公使用

——————————————

我发现凡是几年前最后更新过的 Android模块 ，基本无法直接用 compile 直接导入，因为谷歌dl.com上 已经没有它了


所以选依赖时要看 github的最后更新时间

——————————————

傻逼室友最近玩吃鸡了

我的意思就是当傻逼们声音变大时

自动加大音量

让 English 漫布整个寝室

——————————————

当然，也许是我自己太乱了

东一榔头西一棒子，完全没有规律和计划


这样不好

——————————————

我说，既然屏幕亮度都感光自动调节了

音量为什么不通过检测环境音量自动调节呢？

——————————————

原来 telegram 有招聘

——————————————

不过谁说专科的东西不难啊？

我都快头疼死了




1 是需要记忆的东西太多

2 是需要学的东西太杂

3 是星期4这天 通信原理、数电、高数 这一套下来我快要疯了

东西太多完全不知所措，笔记都不知道该怎么写了

——————————————

http://yingshaoxo.xyz/post/Running_Jupter_on_server.html

绕一圈又回到 jupyter

真心不想敲重复的感觉没啥用的代码

——————————————

我们应该分工合作

网络编程、 AI stuff 应该在 opps_os 完成

逆向、脚本、辅助、外挂应该在 Kali 完成

艺术创造应该在 Windows 完成

——————————————

真简单

——————————————

每天都过着苦逼的写笔记生活：

https://yingshaoxo.gitbooks.io/university-notes/content/dc-stable-source-circuit-de-fen-xi-yu-ying-yong/zheng-liu-lv-bo-dian-lu-de-fen-xi-yu-ying-yong/rectifier-circuit.html

——————————————

今天下午有个妹子跑来找我整理系统

我完美地完成了任务

看来可以继续发展

——————————————

要post就得学会抓包

要抓包就得会 wireshark

——————————————

下次提前写代码

仓促写，心好累

——————————————

哦？

——————————————

另外，selenium一定要用那种出现元素才能选择的方式，不然在垃圾学校网站各种炸😡

——————————————

从学校抢选修课我知道了

selenium根本不够用

妈的，下次直接每隔一分钟发post包

管你响应不响应(学校选课可以卡几个小时😡)

——————————————

恭喜这位帅哥，把我教得一头雾水

——————————————

真不敢相信

人类在处理图片信息时，竟然经历了这么多处理

——————————————

为什么要把它叫做卷积神经网络

只是因为它在添加新内容的同时，“卷”了旧的东西

这样可以紧密的把各个部分连接起来

也就达到了形状识别的目的





也相当于背文章，一次是背不下来的，你应该每次讲一点，每次再把前面的背出来

——————————————

而那个术语 activation function

类似的，相当于给人的神经网络节点供电的东西

一般是一条平滑的倒下的S曲线，据说是为了随着x的变化取到任意的y值

——————————————

Remember how we are using our images, all pixels flattened into a single vector ? That was a really bad idea. Handwritten digits are made of shapes and we discarded the shape information when we flattened the pixels. However, there is a type of neural network that can take advantage of shape information: convolutional networks. Let us try them.


看到这里，我不禁在想：我之前看的都是什么 networks?

——————————————

人们常说的看英文书不要查每个词的意思，而是慢慢去领悟

可能就是讲的就是 unsupervised learning

但那种“意义聚类”，个人感觉很低效

不如 supervised learning 直接给意思记忆得快

——————————————

我的择偶标准：


智商(知识面得广；得喜欢解决问题) 
> 
英语(第二语言者可以证明你有毅力做到你想做的事；包容性强、视野开阔、反传统、追求自由) 
> 
文明(遵守社会文明公约，比如噪声控制：与别人在一起时不用外放、不喧哗) 
> 
外表(洁净、对称、白与嫩)

——————————————

我发4

等我学会了AI

我一定把代码写得尽可能易懂

——————————————

-1表示每次只处理一张图片

中间两个代表图片长宽

最后代表图片色素，黑白图就写1

——————————————

图片右下角

——————————————

分数指数还可以这么算，我以前都是笨办法

——————————————

Good night, buddy.

——————————————

https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_mnist.py

Hope you can find something useful

——————————————

https://codelabs.developers.google.com/codelabs/cloud-tensorflow-mnist/#5

个人觉得应该多看实例代码

理论已经看不懂了

或者说看再多也写不出东西

😃我笨啊

——————————————

Good

有外网一切都舒畅

——————————————

https://codelabs.developers.google.com/codelabs/cloud-tensorflow-mnist/#0

决定了，这周1到5的空余时间就拿来做这个实验

——————————————

夏天穿感觉还可以

——————————————

从这段文字中，我们可以看出

确实可以把image当成input data

But how? that's the question we gonna think in the next days

——————————————

突然就能编译了

😁

——————————————

看了电影 mute

竟说不出话来

https://file.yingshaoxo.xyz/download/_dl/Mute.2018.WEBRip.x264-FGT/Mute.2018.WEBRip.x264-FGT.mp4

——————————————

真屌，让人看不懂的教程

https://www.katacoda.com/courses/traefik/deploy-load-balancer

——————————————

http://shanhe.me/2015/07/07/moving-completed-downloads-to-a-different-directory-in-aria2

等有空把 Local_show 的静态serve核心用 golang 换掉，然后和aria2 做一个集成放在一个 docker 镜像里

——————————————

ffmpeg就是吊，premiere直接导入

——————————————

http://yingshaoxo.xyz/post/Master%20FFmpeg.html

——————————————

相当于二代社工、或者大数据社工库分析

二代爬虫

——————————————

然后就是黑客技术革新

从暴力到智能



根据用户喜好、文化背景与知识水平预测用户的密码

破解验证码等等

——————————————

我认为艺术的市场很大

所以AI会优先革新那个市场

——————————————

额～

——————————————

AI definitely will change the art creating process.

https://youtu.be/6KHSPiYlZ-U





So stop doing art creating, learning ML instead.

——————————————

https://drive.google.com/open?id=1rKoDqLHG5BBBWJz4Z52mWmENyng1-feN

https://support.portswigger.net/customer/portal/articles/1964020-using-burp-to-brute-force-a-login-page


It should work in theory, but I only got 1 Payload sets.

So I'd better use Python to crack website in the future.

——————————————

https://www.jianshu.com/p/3bbd70d2890d

哪天我也来一次

——————————————

https://github.com/daimajia/AndroidSwipeLayout

我只是看着这些特效很相似

——————————————

这样明天就可以录视频了

教室里没人

——————————————

来呀，快活啊～

总算不用借助第三方录屏软件了

——————————————

Done 

sudo apt-get install v4l-utils

ffmpeg -hide_banner -loglevel info -thread_queue_size 512 -y -f alsa -i hw:0 -thread_queue_size 512 -f x11grab -video_size 1920x1080 -i ":0.0" -thread_queue_size 512 -f v4l2 -video_size 320x240 -i "/dev/video0" -c:v libx264 -crf 30 -preset ultrafast -filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -threads 0 ~/Videos/doing/$(date +%F_%A_at_%H:%M:%S).mp4

——————————————

https://github.com/cytopia/ffscreencast

Great!

——————————————

import pyscreenshot as ImageGrab
# from PIL import import ImageGrab
import numpy as np
import cv2
import time


Cam_Device = 0
Screen_Width = 800
Screen_Hight = 600
Cam_Width = 320
Cam_Hight = 240
Delay = 0.2


cam = cv2.VideoCapture(Cam_Device)

while(True):
    # capture screen
    screen_img = ImageGrab.grab(bbox=(0, 0, Screen_Width, Screen_Hight))
    img_np = np.array(screen_img)
    screen_img = cv2.cvtColor(img_np, cv2.COLOR_BGR2RGB)


    # capture camera
    _, cam_img = cam.read()
    cam_img = cv2.resize(cam_img, (Cam_Width, Cam_Hight))
    num_rows, num_cols = cam_img.shape[:2]

    # rotate 90 degree
    rotation_matrix = cv2.getRotationMatrix2D((num_cols/2, num_rows/2), -90, 1)
    cam_img = cv2.warpAffine(cam_img, rotation_matrix, (num_cols, num_rows))

    # horizontal flip
    cam_img = cv2.flip(cam_img, 1)


    # combination
    screen_img[Screen_Hight - Cam_Hight:Screen_Hight, Screen_Width - Cam_Width:Screen_Width] = cam_img


    cv2.imshow("test", screen_img)
    if cv2.waitKey(25) & 0xFF == ord('q'):
        cv2.destroyAllWindows()
        break
    else:
        time.sleep(Delay)

Finished, but no audio

Need to use an audio python package may be

——————————————

吓到我了

——————————————

感觉你是做视频处理的

——————————————

如果能把camera叠加上去

就很好了

——————————————

I only found this, but no camera

gnome-terminal -x ffmpeg -y -f alsa -i hw:0 -f x11grab -framerate 30 -video_size 1920x1080 -i :0.0+0,0 -c:v libx264 -pix_fmt yuv420p -qp 0 -preset ultrafast ~/Videos/doing/$(date +%F_%A_at_%H:%M:%S).mp4

——————————————

有现成的代码吗

我查了半小时没什么收获

——————————————

Gnome的录屏坏了，无法读取我的 USB camera


现在只能安装opencv自己做一个录屏＋camera 的东西了


😢果然自己做的东西最好用(vokoscreen还行，就是只能让声音通过USB camera传进来，不然声音和图像不匹配，一个快一个慢，，，那要求你的camera拾音效果非常好，，可惜我的是垃圾)

——————————————

https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2-tflite/index.html#4

Fail to import: SSL peer shut down incorrectly

——————————————

一开始我以为安卓的那些界面设计很难

后面发现除了telegram全都自己做比较难

像TIM、QQ全是用的别人的库

——————————————

https://github.com/pwittchen/swipe

https://github.com/pwittchen/swipe/blob/RxJava2.x/app-kotlin/src/main/kotlin/com/github/pwittchen/swipe/kotlinapp/SwipeActivity.kt

Thanks to those guys, I make it right now!

——————————————

安卓上实现滑动检测比我想象的难

——————————————

What's challenging, what's useful

——————————————

从这本书得到三个链接

http://dataportals.org/
http://opendatamonitor.eu/
http://quandl.com/

——————————————

轻车熟路后能做的事就变多了

一个人顶10个，还是不同行业的


https://yingshaoxo.gitbooks.io/university-notes/content/dc-stable-source-circuit-de-fen-xi-yu-ying-yong/er-ji-guan-de-te-xing-yu-ying-yong/diode.html

——————————————

加了这个群，不知有啥用

——————————————

Kotlin编程三板斧：

1. Google Java codes
2. 找 on_create，理解运行逻辑
3. 复制粘贴到AS，自动转成 kotlin codes

——————————————

https://github.com/yingshaoxo/import_ffmpeg_test

https://github.com/yingshaoxo/import_ffmpeg_test

好，依靠这些完成了我 kotlin 的第一次外部库的调用

——————————————

留恋一张图书馆的coding好环境

——————————————

前面讲了，差异是人类认识的基础

所以机器学习中首先就要选择、收集Data，而这个 data 不是随便选择的，而是要有代表性，要表现出事物的差异

——————————————

谷歌的ML课程是这个套路：

先给一个视频作为总括和更人性化的讲解
然后用 documents 做细致的分讲
最后再出几道选择题叫你选择

——————————————

学校的基础课程

通信那些




越来越难了

平时哪有时间学习ML啊




我尽量挤吧，在保证睡眠充足的情况下

https://yingshaoxo.gitbooks.io/university-notes/content/dc-stable-source-circuit-de-fen-xi-yu-ying-yong/er-ji-guan-de-te-xing-yu-ying-yong/ban-dao-ti.html

——————————————

我发现DNS tunnel连不上了

——————————————

@system357

——————————————

果然只有谷歌才发福利

其他都是要收费的

——————————————

系统整理完毕

网络配置完毕

明天开始继续 ML 的学习

——————————————

信息错误，可能是上次有网，自动更新了驱动

不过这条命令是真好用：

echo -e "blacklist nouveau\noptions nouveau modeset=0\nalias nouveau off" > /etc/modprobe.d/blacklist-nouveau.conf

——————————————

用 Clonezilla恢复龙 系统成功复制整个系统盘

然后用上面的修复方法成功修复引导




最后发现把系统装在机械盘只是开机慢很多而已

——————————————

Best way to fix grub (linux引导):


Try the following

grub rescue > ls

grub rescue > ls (hd0,msdos2) # let's assume this is the linux partition 

grub rescue > set root=(hd0,msdos2) 

grub rescue > set prefix=(hd0,msdos2)/boot/grub # or wherever grub is installed 

grub rescue > insmod normal # if this produced an error, reset root and prefix to something else .. 

grub rescue > normal



Run the following after you successfully boot:

sudo update-grub sudo grub-install /dev/sdX 
# where /dev/sdX is your boot drive.

——————————————

之所以中文不适合做详细的文档

是因为中文太具有概括性，容易在极短的文字内让读者迷茫

——————————————

你说我会不会死掉

还是每科都好好学吧

——————————————

不，想到就应该做到，那样我就可以在linux上用tensorflow

会方便很多





我应该只需要对盘拷

把Opps烤到机械盘上

——————————————

下次把Kali放固态

Win10和Opps OS 各300G放在机械硬盘，剩下机械盘200G作为数据保存盘

——————————————

还有，你登录时选择gnome

是可以直接进的，无需闭源显卡驱动

——————————————

我知道怎么在一个小分区安装kali了

只需要一个ex4的分区挂载/，一个几G的swap分区即可


对了，我还得告诉你，kali2018出来了

——————————————

买啥手机啊？

不买了

攒钱买 Google Pixel

——————————————

突然想到了

虽然大家的大脑储存都差不多

但不同人的内存与CPU是不同的，那可能就是人与人之间智力的差别吧(储存也还有固态与机械之分呢)




不过，别人用一天能训练出的模型，你用十天、一个月也可以啊👍

——————————————

最后她又讲了

应该拿一小部分知识试学一下，以判定你该用多大的力度


(这让我想起了：试学一月，不收任何费用😂😁)

——————————————

最后得到

不同的学习速率有不同的steps得到最终目的

而得到合适的学习速率只能靠暴力(算每种速率的最优step)，机器处理

人就算了，人是经验动物，很少有人能每次都用对力气在不同的可学物上

——————————————

最后得出结论

Learning rate 过快不好，过慢也不好

和人类学习真的好相似

——————————————

不对，这东西怎么越來密集？

——————————————

而 learning rate 就是指的每次前进多少x去得到最小误差

——————————————

原来 gradient loss 就是一种通过寻找最小误差来画函数图的方法

——————————————

I like this explanation

it's so vivid!

——————————————

This course was so great!

Loss is the penalty for a bad prediction. That is, loss is a number indicating how bad the model's prediction was on a single example. If the model's prediction is perfect, the loss is zero; otherwise, the loss is greater. The goal of training a model is to find a set of weights and biases that have low loss, on average, across all examples.

——————————————

看起来机器学习就像自动解方程机

——————————————

Fuck it again

——————————————

Fuck you, mathematics!

——————————————

https://ai.google/education#?modal_active=none

Let's go

——————————————

I don't know, maybe just try all different thing and find the better one.

https://developers.google.com/machine-learning/crash-course/ml-intro

——————————————

买到假货，退货ing

——————————————

第二节学完

——————————————

有个专业背枕真爽

这下可以减轻腰部压力了😄

——————————————

睡袋到了，再也不用折什么东西

卷起来就跑😜

——————————————

我买的乐视pro3手机到了

感觉非常划算，700元，双摄、双卡、64G储存、4G内存、可刷机、全面屏、指纹传感器

唯一不好的是你要和传统音频插口说再见了, type-c或蓝牙才是你能用的

——————————————

还是没能逃过B站的魔爪

http://www.bilibili.com/video/av20093472?share_medium=android&share_source=copy_link&bbid=4C7690A1-D112-4E0A-9995-6B13786AEDB012230infoc&ts=1520004977237

——————————————

感觉又回到了原始社会

隔壁一群傻逼的感觉

深夜玩游戏扰民

——————————————

有时候想想服务器算几个钱啊，给自己剪一次头发

一个月的租金就有了



左黄右黑，左深右浅，左亮右暗

——————————————

那你就是少男了

二等座

——————————————

刚才在地铁

我说免费给后面几位买票

因为没法找零




结果一人塞给我10块😁

——————————————

看到图片处理就不懂了

——————————————

喜欢坐火车时靠窗的少女是我的菜

因为她们自视清高、曲高和寡，一般都有一定的知识储备和文化涵养

——————————————

placeholder and variables in tensorflow 充分体现了运算过程与data分离的思想


不过，直接建立function不好吗，非要封装一层

——————————————

第一章看完了

——————————————

越来越有趣了

正在介绍各种dataset

Birth weight data, Boston Housing data, MNIST handwriting data, Spam-ham text data, Movie review data, and so on

——————————————

这样看起来 tensorflow 像 numpy

——————————————

很快就看到了我看不懂的词汇

Eigen decomposition of a matrix

——————————————

哈哈

——————————————

正在火车上看 tensorflow machine learning cookbook

——————————————

Tensorflow 应该改名叫 Listflow

——————————————

收拾行囊

明日启程

——————————————

http://5sing.kugou.com/yc/2273644.html

成品

5年之约




经历了太多事

——————————————

Wow

Waves plugin MaxxVolume (TV Compression) is wonderful for master track compression.

——————————————

http://conw.net/archives/74/

我插，他们已经这么屌了吗

——————————————

每30秒查询一次

选了最屌的课😂

——————————————

花了2个小时写学校抢课的脚本

只能说 chrome 可复制xpath真是太爽了

——————————————

As for music

You can't write a song at once

You have to record your music voice as many as possible

Then you can compose a song gracefully

——————————————

决定了，在（系统学习AI）维护服务器时，慢慢学会用 traefik 替代 apache

https://docs.traefik.io/















这样就兑现了 use Golang 的承诺

同时，维护那些 web service project，我们也用了 Javascript 和 Python

学习 Tensorflow 向 AI 的同时，我们会用到 Kotlin 做安卓 AI Application

最后完成任务的同时，我们也收获了快乐

最终，2018的任务会圆满完成！

——————————————

https://github.com/lk-geimfari/awesomo/blob/master/languages/GOLANG.md

看得我ＴＭ想直接投入Golang的怀抱

——————————————

让我猜一下，第三个时代应该就是程序AI化，用户傻瓜化，程序员上帝化

https://youtu.be/fCEHdyLkjNE

——————————————

讲到这里，我们要讲两个时代

1是石器时代：数据在内存和本地文件中交换，典型C++

2是现代：数据以网络协议为媒介交换，典型Golang

python 是把1和2结合起来的失败作品(不够反普通人类(不够严密))，也可以说是尝试之作





在两个时代中，设备不断在发生改变，人们围绕那两个时代的技术不停地为不同的设备制造软件

——————————————

OK

I will look for it later




Next time, 我应该在学新东西前调查一下它该不该学

In the early days of the Web, the name “Apache” was synonymous with “web server”. But NGINX was developed in the early 2000s and is steadily gaining in popularity; it’s already the #1 web server at the 1,000, 10,000, and 100,000 busiest websites in the world.

——————————————

https://gist.github.com/paulmach/7271283

https://yingshaoxo.gitbooks.io/go-tutorial-for-pythoner/content/install-and-run-go.html


经测试，go也可达到 apache 的速度

怪不得人们喜欢用 go 代替 python 的网络编程部分

——————————————

welcome back

——————————————

又搞砸了

升级 let's encrypt 的 bot 后




强制转到HTTPS，并不能访问了




最后干脆恢复原来的 000-default.conf 并删除新增的 ssl.conf

修复问题，现在不强制跳转HTTPS，虽然可能有广告劫持

——————————————

不行，视频在线能让 MX Player 播放的还是只有 apache


sanic 或 flask的静态 serving 都不行，只有 Apache可以让下载达到最大值，python的server只能达到几十k

——————————————

So forget about others, just use wave tune, it could export midi file, too.

——————————————

But if you can't see any waves plugins, make sure to re-scan it in manager

https://support.native-instruments.com/hc/en-us/articles/210292945-Plug-in-Administration-in-FL-Studio-12

——————————————

https://www.youtube.com/watch?v=BBRDvCp2N1w


Now, you would able to add effects to your audio tracks

——————————————

https://www.youtube.com/watch?v=GBzLmfmkgtA

Finally, now I know how to record voice in FL Studio.

——————————————

这个好

——————————————

政治没学好的根源在于你没把宪法给被背了

用宪法答题没人敢说你是错的

——————————————

后天就走了，买了睡袋、背靠、床帘、电脑钢化膜、乐视pro3全网通样本机

今天下订单，我去学校全到货就爽了，2号到，5号开学

两天搞定所有事

理床、装床帘、贴膜、刷机、配置网络

——————————————

https://vuejs.org/v2/examples/index.html

vue 可以学，学会了可以和 sanic 一起做一些 bootstrap 做不到的动态 web app (sanic 生下来就是为了高并发的网络 API )

至于 Golang，py可以做到的，何必用其他的，更多时候高级程序员遇到的不是语法错误，而是本身的逻辑错误

——————————————

我一直觉得很奇怪

npm有什么用？




感觉安装了模块也没法用，不能提供 static service (或者说我真不知道怎么用)

——————————————

这些人把超人转化为有欲望的成人，还是不错

http://127.0.0.1:43110/15xit2EiY7mpnQAj482BB4TjFynAJYLuj5/?Post:612:DCPU字幕組（欧美成人中文字幕翻译）专题帖2018.01.17更新

——————————————

25倍引擎动力

在山上飙摩托





于是想到，驾驶AI的 dataset 有现成的：高度

为了到达更高的地方，摩托只能选择它自己能跑的相对平坦的地方(同时避开大石头与树)，绕弯实现目标

整个决策过程，完好地模拟了在任何时候摩托思考的问题(选能前进的路，避开其他车子与人)

——————————————

唉，别提了

玩了一晚上的 GTA 5 (用了 enhanced trainer 和 nice fly 两个基础script)，主要是 make love，但我发现如果车辆不透明就没意思了。没找到透明车辆的方法

OpenIV 不想用，垃圾不绿色，太麻烦了

——————————————

《实力搭讪(发生关系)》: 
http://music.163.com/video/43C3FD202E4EA7D1901A28E04DA2521B/?userid=280429778




程序员每天只需要抽出10分钟时间去和妹子聊天

一年后肯定能找到女朋友

只是我太懒

——————————————

Bigger研究所的视频《一千块的矿泉水和两元的农夫山泉有什么区别？》: http://music.163.com/video/1EFCC4ACE1148AABAE7FEAE0BA3AC240/?userid=280429778 (来自@网易云音乐)




1. 这个视频确实做得专业，切镜、词汇啥的都没谁了

2. 为了一个视频，创建一个那么大的工作室，？

——————————————

成为大人

越来越觉得除了食物、水、房子、电、网以外的东西都没有意义

越来越不在乎别人的感受

精神世界越来越小



不，我不能成为那样的大人

——————————————

https://yingshaoxo.xyz/post/Sanic%20could%20take%20the%20place%20of%20Flask.html


我刚才把 Local_Show 用 sanic 把 flask 部分重写了一遍

也就是换成了 sanic

现在切换视频不会卡了

——————————————

事实上我靠直播念了两个小时的 Crazy English

——————————————

https://writingminds.github.io/ffmpeg-android-java/

Just learn how to train a tensorflow model is not enough, we also have to know how to use that model on a mobile phone, because that's the only way to make your work worth, letting people use it in daily life.

——————————————

等会儿想玩玩 B 站的直播


实名制😒

——————————————

😢

我是bug小王子

已修复

——————————————

https://youtu.be/ZTeVZIZUVvE

——————————————

https://youtu.be/Gj0iyo265bc


我竟然看懂了








然而第八课又看不懂了
https://youtu.be/LDRbO9a6XPU

——————————————

I have heard 世界科技潮流是这样的：

计算机⇉网络⇉智能手机⇉AI(人工智能)

——————————————

这可能是唯一一次站在世界潮流之巅的机会了

上次智能手机的潮流我没赶上😭

——————————————

https://youtu.be/I74ymkoNTnw

决定了

在保证服务器程序运行的情况下

专心学习ML在接下来的一个学期

——————————————

用易语言写了一个ffmpeg批量转换工具

看部电影后没准就把制作它的教程转好了





个人的感受是，易语言遍历数组真是太恶心了，字符串不支持\转义也是恶心

——————————————

good night

——————————————

我还在夜晚奋斗录视频

学习 tensorflow 新知识

——————————————

写好了没人讲中文

本来还想测试下行不行的😆

——————————————

感觉自己时间不多了

3月1号去学校



最多再多学一点tensorflow

为了保证在学校大脑退化得不那么快


创建一个英文群组是必要的

我马上写一个自动 踢 说非英语的人的 bot

——————————————

Brain 这个软件还可以

——————————————

https://youtu.be/gpXpvRCuzFs

——————————————

对于垃圾麦克(耳麦)，单声道录制比双声道采音效果差

——————————————

好吧，确实是我搞错了，你的标签数据0123记得和 Species数组对上，数组从0开始

不然得到的结果就是错的


恩，我马上去录一期实作视频

——————————————

笑死我了

用自己做的csv datasets训练识别正负数的模型

结果出来的结果与实际值完全相反，一点不差，我给正数它说是负的，我给负数它说是正数




不是我哪里搞错了就是tensorflow在逗我😂

——————————————

遇到挫折不放手是一种态度

——————————————

Hi, guys

This is what you gonna need to write your own csv file:

import csv

villains = [
 ['hi', 'everyone'],
 ['but', 'you'],
 ['have', 'to'],
 ['keep', 'going']
]

with open('demo.csv', 'wt', newline='') as fout:
 csvout = csv.writer(fout)
 csvout.writerows(villains)

——————————————

如果说通过

一个人的身体对称度、皮肤光滑度、身高与体重的比、胸围、臀围、学历、资产减去社会平均个人资产

还可以判定这个人漂亮与否





在网上只能找到别人的身高，有什么用

初级阶段，好的输入数据太难找了

——————————————

虽然不太想承认

机器学习就是一种人类学习




具体来讲就是学习一种相关关系

给你输入，得到输出




初级阶段，可能输入就是一两种简单的属性值高低，it is number

But after that, 研究人员发现了把图片或音乐变成数字属性的方法，然后把它当成输入



而那种训练方法，它借助了神经网络的原理，有了 layer 的概念，甚至还能看到反向feedback的影子

只要这个训练的容器够大，计算力足够，把欲望或野心作为奖励反馈机制，超级机器人是肯定能做出来的，只不过需要一个正常人的成长时间(以年为单位)

——————————————

Brainstorming！ Can not think any of relationships that is formed by the number attributes, but an AI model need that datasets

It could be my first project of deep learning

——————————————

绞尽脑汁也想不出有什么相关关系是由number属性构成的

还要有趣

——————————————

我真想找个简单的csv数据库

自己训练一次 tensorflow model




不然感觉不会入门

——————————————

看了 The walking dead season 8

Nothing has changed

——————————————

佩小姐的奇幻城堡.Miss.Peregrines.Home.for.Peculiar.Children.2016

完整的看了一遍，这脑洞应该不会有第二集了

——————————————

基本满足需要，不知为何，latex不加载。。。当我没说

https://yingshaoxo.xyz/post/Basic%20git%20commands.html

——————————————

在我眼里，那个叫胡英杰的人格100%是个傻逼

一事无成




而我，虽然不傻，但处于智力阶层的底端

——————————————

Markdown 是按 github 风格渲染的，完美兼容 latex math notation

唯一不好的是我生成的文章列表特别丑

——————————————

https://github.com/yingshaoxo/ysblogger/blob/master/article/Basic%20terminal%20shotcuts.md

这下可以用了

——————————————

@system357 

I still don't understand why this lambda has no argument, why it just give it a function?

# Train the Model.
    classifier.train(
        input_fn=lambda:iris_data.train_input_fn(train_x, train_y,
                                                 args.batch_size),
        steps=args.train_steps)
https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions

——————————————

http://nanshu.wang/post/2018-01-17/

大姐姐真是鼓舞人心

——————————————

https://m.bilibili.com/video/av19756667.html

https://m.bilibili.com/video/av19762051.html

——————————————

https://www.ted.com/talks/michael_anti_behind_the_great_firewall_of_china?utm_campaign=tedspread&utm_medium=referral&utm_source=tedcomshare

——————————————

讲解完这篇文章

全程无废话

我占用了2.6个G

——————————————

Also

This woman is very optimistic

I could learn many expressions from her.

https://youtu.be/FTN_93Px-Qc

——————————————

https://youtu.be/-mu3TYZ_udM

——————————————

如果口译，我相信我会有一个完整坚实的理解

在不熟的情况下分段没有意义

幸好录屏可以暂停




唯一缺的就是口语的感觉，需要再看一点别人的YouTube

——————————————

在思考下一步的计划

应不应该把这个口译出来

https://www.tensorflow.org/get_started/get_started_for_beginners


或者应不应该分段讲

——————————————

我花了45分钟不含下载时间安装了 tensorflow gpu version on win10

最后输出的视频高达一个G

——————————————

https://youtu.be/BMT7FMwOIKc

——————————————

今天下午和老同学在中学跑步10圈，感觉干劲十足

我们还可以再干十年！

——————————————

我觉得用第三方摄像头

从低侧面拍我

会好看很多





并且拍片要注意对光，光射向哪方，摄像头就要对向哪方

这和3D模型摄影原理类似，因为必须有光的反射，我们才能看清事物

——————————————

我后期的稳定套路是

音量标准化
物理有损降噪
动态高精度降噪
mastering按频谱调高低音的音量
平滑压限
动态360°化声音

——————————————

这是用上了waves 的360扩大音像效果器的视频

这样的话你可以只录制单声道的更稳定的声音，而后转成立体声

https://www.bilibili.com/video/av19705589/





这事waves的下载链接：https://drive.google.com/file/d/1xBKBfpMMdwvnfhDejmQRFra_N3BJ2frl/view?usp=sharing

——————————————

音频算法工程师

2. 熟悉数字音频信号处理，熟悉模式识别和深度学习开源框架；

3. 音效算法开发或移动、音频内容分析、听歌识曲和哼唱识别实际项目经验者优先；

4. 编程基础扎实，熟悉算法和数据结构，熟练运用c\c++、python等开发语言;

5. 喜欢音乐，对音乐和音频技术的结合感兴趣者优先。



要不以这个为蓝本前进好不好？

——————————————

https://hr.163.com/position/detail.do?id=526

说白了，我不喜欢这个东西

——————————————

但我感觉后端运维技能是慢慢磨出来的


配合前端的需求，后端也会做相应的变化







而涉及到Python的后端开发，主要是 AI researcher，要求熟悉各种 AI 框架

要是我能看懂那些东西就好了

——————————————

以后还要留心收集信息

把不需要学历的要求汇集起来，看看市场走向...




高级游戏运维工程师

工作地点
上海

工作职责
 1. 负责B站游戏及平台的日常安全运维工作，保障业务的可用性
 2. 负责对大型故障追踪定位，分析和解决问题，并制定后续的改进和规避方案
 3. 负责制定运维规范和业务标准，梳理和优化工作流程，提升跨部门的沟通效率和服务质量
 4. 参与平台或系统的架构设计和改造、容灾方案、瓶颈分析、性能优化、风险管控等
 5. 打造技术驱动的团队氛围

职位要求
 1. 5年以上互联网运维经验（Linux环境，1000台主机以上）
 2. 精通Linux系统管理和内核优化，权限分级管理和安全审计，熟悉TCP/IP协议原理
 3. 精通nginx、php、tomcat、elk、lvs等主流开源软件的配置、维护、调优
 4. 熟悉mysql、redis、mongodb等数据库配置、备份恢复、性能监控和调优、以及高可用方案
 5. 熟悉公有云VPC/ECS/RDS/EIP/SLB/OSS/IAM，以及CDN/ DNS等产品和服务，并有线上业务的实际操作和运维经验
 6. 熟悉shell、python等至少一门脚本语言
 7. 了解运维高容量、大流量、大并发Web系统的业务知识以及解决方案
 有大、中型网站维护实战经验者优先
 8. 有良好的文档撰写习惯，有一定的文档设计和排版基础
 9. 有良好的语言表达能力，工作主动性强，具有团队合作和创新精神

——————————————

Great then, I would like to get further education on basic knowledge while doing useless work.

Night!

——————————————

As far as I see, if you want to learn English right, you should find an environment to give you a good place to release the power of English.

https://www.khanacademy.org/humanities/grammar/parts-of-speech-the-noun

——————————————

https://www.jianshu.com/p/fcad44753f38

https://file.yingshaoxo.xyz/

这样的话，adm下载就可以有8个流畅的连接了

——————————————

好伤心啊，服务器有8个G的东西并拿不下来

老是下到一半就挂掉

——————————————

反正没人用我的项目，做那么独立干什么

不如让今后我经手的每一个项目都有 auto_everything 的影子


这样不仅能节省我大量的时间，同时也能激励我不断以实用为标准更新 auto_everything

——————————————

火锅底料家庭使用指南：


一定按使用说明来，一定要阻止父母加乱七八糟的东西进去，一定要阻止父母不按说明书操作


这样你才能吃到正常的火锅 😂

——————————————

抱歉，由于我的无能，只能做到每次访问主页刷新一次

用了gunicorn，视频确实可以做到流畅切换了

——————————————

唱吧可以免费创

全民k歌垃圾要收费

——————————————

不知道多人在线k歌(k歌房)的原理是什么

准备做个调查

如果市场上没有，就自己做一个

——————————————

docker run -d --name aria2-with-webui -p 6800:6800 -p 6880:80 -p 6888:8080 -v /root/download:/data -v /root/config:/conf xujinkai/aria2-with-webui


aria2 配合 local show 应该可以发挥其作用

那么 local show 需要做2点修改：

1. 每5分钟刷新扫描一次文件

2. 与 gunicorn 做集成

——————————————

Just look at this speed!

It's wonderful

——————————————

waves 音频套餐真是好用

等会儿我整理完看能不能发出来

——————————————

快20岁了

心寒，还没什么建树

——————————————

不过还是原本的物理引擎渲染出来的东西效果最好

——————————————

night

have a nice dream

——————————————

http://www.doyoudo.com/p/5001226.html

看完第一节，做出来这个：

——————————————

Panning in C4D
平移

渲染框右上角有个十字架，拉动平移

——————————————

然后活捉Windows上的ispring cam免费录屏软件

——————————————

pyautogui对DNF无效

——————————————

Sitting all day in front of Linux is kind of boring

So my resting is to keep all day in front of Windows, play some games, do some designs, and in the end, sleep earlier.

——————————————

似乎只差 三方包导入 和 activity切换

我就学会安卓开发了

——————————————

那个小圆圈好丑，挡住发射键了

——————————————

https://youtu.be/rqX8PFcOpxA

这待遇大概比网易云好吧

——————————————

竟然没生气

——————————————

Good night, みんな

don't forget we are in rest.

——————————————

https://youtu.be/lfTwqw_gyKs

你们都应该臣服在她的石榴裙下😁

——————————————

我觉得我会被打😂😅

——————————————

Great talks

https://youtu.be/U8pBOsx--d0

There is only one way to go to Soft Engineering: follow your passions!

——————————————

http://lesterbanks.com/2017/05/2-ways-cut-object-segments-c4d/

大神们录视频和我等鼠辈完全不同

——————————————

按照他们的说法，用 gunicorn

感觉 python 变麻烦了



不过还好以前用过

——————————————

我说过我要做无用功，我就要做


跟着潮流走只会让人越来越迷失

相反，历史属于那些善于做无用功的人

——————————————

思考


吓了我一跳，我以为可以直接把人声转成midi呢

but，如果它已经能实现这一步了，扒音会便利许多

meanwhile， 同样的原理，只针对特定的人声进行训练，人声转midi效果应该非常好吧

——————————————

1. 关于 kotlin 的教程，谷歌上文字竟没有youtube视频多

2. 看完阿三的教程，写出来加载 math.yingshaoxo.xyz 竟然还是一片白...
https://www.youtube.com/watch?v=Ag9paBWHU2I

——————————————

https://github.com/channelcat/sanic

flask 有个致命的缺点，

在客户端，如果上个视频请求没断开下个视频请求一上去，就会卡住...


不知道这个会不会好一点

——————————————

https://github.com/lk-geimfari/awesomo/blob/master/languages/PYTHON.md

感觉如获至宝，一次根本看不完😂

我大 Python 果然是无敌的





因为其他语言牛逼的包没我们的多

我们自带军火库

——————————————

http://click.pocoo.org/5/

This was also cool

——————————————

https://github.com/bokeh/bokeh 


这个是真的屌，直接生成动态数据html

——————————————

TensorFlow (@TensorFlow) Tweeted:
⚙️🎹📝 Automatic piano music transcription, with Magenta! 

Check out the new project (w/ source code &amp; model) 👇 https://t.co/kRpUJgzg6K https://twitter.com/TensorFlow/status/963186566867898374?ref_src=twcamp%5Eshare%7Ctwsrc%5Em5%7Ctwgr%5Eemail%7Ctwcon%5E7046%7Ctwterm%5E1

——————————————

15天看完火影，把心智提升到了17岁

——————————————

For example, this guy is really cool

——————————————

有时候觉得别人的博客比官方教程更通俗易懂

https://www.lylinux.net/article/2018/1/24/38.html

他们的博客就是我的财富(不知你懂了什么)





我从来不记博客人的名字

但我能记住他们的真人头像，毕竟人记图快于记文字






那意味着在未来几周，我应该想方设法搞一张能让人眼前一亮的，又能一眼标识出是我的，头像

并且把他放在任何有我参与的地方



就像大神一样，就像政治领袖一样，就像...

——————————————

https://www.youtube.com/watch?v=tYHBiNsEyxs

nice

没鼠标建模真是费劲

——————————————

看了 王牌特工之黄金圈， 发现没有 科幻和超能力 两大元素，真是看不下去

——————————————

https://youtu.be/tzLZkhLmacM

行，搞完自动运行，接下来就是写 Kotlin APK，用来封装我们的服务

不过在那之前，我必须看看火影

感冒好了😊

——————————————

https://music.yingshaoxo.xyz

我现在特别开心







突然发现启动程序根本不需要pkill python

因为端口被占用会自动退出😂

——————————————

https://www.jianshu.com/p/440fb300c2c6


本地 与 用Apache不一样

在apache里可以不设置 ws ip，直接转发后缀是 /ws/ 的网址到local ws server




另外，未知原因，docker 用不了，所以只能用最原始的方法...直接运行

——————————————

搞定

https://math.yingshaoxo.xyz/

——————————————

这东西花了我半年时间

我不应该放弃，这就是我以前说的全栈




做完了它我就可以毫无牵挂的做无用功

我就可以玩了，我就不用每天紧绷着神经跟随永远跟不上的互联网潮流了

——————————————

看了接近80多个网页，改了近30多次

还是不行，我是菜鸟

——————————————

感冒

头晕流鼻涕，当初没写 ws and wss 与Apache的笔记

现在搞不出来，头疼欲裂中

——————————————

墙最主要的目的，不是阻挡你

而是瓦解你的斗志


把你与亲人、朋友隔开

体验无限的孤独的痛苦

即使你有你远方的朋友




但越是这样，越是要充满斗志、不畏艰难，同时向你远方的朋友问好

并说一句：“阿里嘎多”

——————————————

好像渐渐明白了点什么


火影中的每个人都是偏执狂

——————————————

Blog 被我弄坏了，不过测试成功！

http://blog.yingshaoxo.xyz
http://math.yingshaoxo.xyz


https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-ubuntu-16-04

——————————————

成为伟大的人物，克服的就是大人心理

你不能像大人一样畏首畏尾，没有一件事是蜻蜓点水能出成绩的

不下定决心在某一职业深耕，怎能有所建树？

怕付出是没用的，不能因为想保存以前付出得到的东西就停止付出

物质守恒定律规定了必须有付出才有回报

哪怕赌上变老的代价，(你不付出也会变老，时光不能倒流

这时小孩心理就出来帮你了：你还年轻就什么也不怕

——————————————

我这个年纪，是决定方向的时候

需要从能做的事中选一个出来，成为未来的方向

急躁、不知所措、自不量力都会出现在这个时刻


最终哪项事业能让你踏实做下去，那就是你的路

Keep confidence in yourself.

——————————————

所以我也用上了 无限流量卡 

WiFi 随便开，20G 开始限速

——————————————

虽然理想很美

但看了看在线解析，对于内容收费




完全可以一人开vip，百万人共享

视频可以直链、倒录(录屏)，文章可以复制粘贴




最后的结论是：没有怕麻烦的小偷，只有怕麻烦的用户

这样的话，卖用户隐私应该能赚得多一点(考虑到到处都是实名制，价值已经降低，况且用户的信息总有卖完的一天)


要不作游戏吧？坑到一个算一个，只要用户不开挂，就是各种永久、稀有、抽奖向它们兜售，用户会自己送钱来的



赚一两年就跑路，应该还不错...

——————————————

服务器仍是与用户隔离赚钱的必须物品，后端不灭

——————————————

https://github.com/rovo89/XposedBridge/wiki/Development-tutorial

完整地看了一遍




如果是账号制，从服务端讲，你不给我钱就不把你账号归入VIP


非vip就不提供服务

xposed作用不是特别大，只能利用一些既有漏洞修改本地的东西，比如 kill 广告

——————————————

表示特别勉强地利用

crontab 与 export DISPLAY=:0; /usr/bin/python3.6 xxx.py

完成了任务





下一步是实战测试，one namespace --> many virtual host

——————————————

大概 in Python,  __var 与 _var 的区别是前者只能被它存在的类调用，后者可以被同一文件的其他类调用

——————————————

he has never

I have

似乎无数个成熟的老人的声音在我耳边回响，忘记坑爹的语法吧，记忆会帮助你做出正确的选择

语言的本质就是 复制+粘贴 ，别人说过的话，在同一情境下表达同一意图，拿过来就可以用

——————————————

想利用一下Python的简洁来操作系统怎么这么难

——————————————

Through in this way, you could run a program with a normal user permission, 看起来还是无法正常操作gui程序

——————————————

Sorry

没经过测试的言论都是垃圾

似乎没用

——————————————

漫威 has never let me down

看了雷神 three

——————————————

用 python 的坏处可能就是：写得太快而不注意跳了许多逻辑,

并由此产生非语法错误的bug




头疼失败，正在挽救中，要不看场电影再继续？

——————————————

\opt\ usually describes as for optional add-on software packages source.

——————————————

control + m or control + p 从virtual box切换到host

也算很方便了，我现在是里外一个opps_os，需要反复开关机的测试，还是virtual box好用

——————————————

今天要把 auto_evrything的自启管理和keep_running写完

那样从此python script就可以直接从库上得到 super management 的功能

——————————————

解决问题的七步法

——————————————

创业与就业的老师的老公是专为商业公司开发管理程序的程序员，所以老师知道了我的事后给我打了高分；英语老师嫉妒我的才华，打了低分；铁道概括没交作业，低分；数学努力学习后能力太低，低分。

——————————————

对于华为荣耀这种垃圾平板， 绿化无效

只有阻止运行才hold得住

——————————————

墙国人用AI完全是个灾难

他们的智能推荐算法实际上做的事是：阻碍你的视野，缩小你的世界，一时底层、终身底层，让你永远无法看到真实的世界

——————————————

那时依然出现了社会等级秩序

政治权力体现为控制能源、智力、稀缺金属




国家元首就是超级计算机与前任总统的融合体




由于变革是总体性的，所以没有特定的群体从中获得好处，大家的智力在原有基础上加了250，智力还是有高有低，智力差不变

只能说比上一代聪明了不少

——————————————

到时人们终于面对一个两难的抉择

be man，or be super man(机械化人类)



前一种，人类开始出现异能，发现AI无用，有能量就有一切

后一种，发现自己就是机器人，还是要想方设法的去找能量，变相的劳动


可见AI社会不劳动就是一个空想

——————————————

我们应该是最后一批被淘汰的职业

那时环境污染严重，可能只能承载几十个人

那几十个可能还是最聪明的人类

——————————————

来来来，开始空想

我说以后的程序员会分成两派

1. 做自动化，用AI帮人们做现实世界的工作

2. 做娱乐，用创意帮人们制造各种各样虚幻的精神世界，以满足他们的工作都被AI做了的空虚

——————————————

发现你的语文能力一点都没降低

厉害

——————————————

看火影那么多集

感想就是：学过的不顶用的东西不要扔，和其他老东西或新东西融合，这样你就又多了一个新技能，同时变相的在不辜负自己以前努力的情况下舍弃了旧东西

这和今天一口气考完三科创新与批判网课期末考的思想一致

——————————————

应该先把坚不可摧的 virtual host 弄好

再写客户端

——————————————

任务达成

——————————————

https://stackoverflow.com/questions/13837978/apache-multiple-sub-domains-with-one-ip-address

https://httpd.apache.org/docs/2.4/vhosts/examples.html#page-header

这样我心里的石头就落地了，可以节约一大笔服务器开支

——————————————

我认识的几个国内外大佬(别人不认识我) github 上都是真人头像

你说是不是成为能找工作的大佬都得那样做

——————————————

Root permission
sudo chmod -R 777 your_folder


Normal permission
sudo chmod -R 755 your_folder

——————————————

https://codepen.io/vsync/pen/czgrf

用这个配合 jquery 特有的 $('xx 组件').css(key, value) 实现了良好的动态 css

我指解决了 inputbox 随文字伸缩的特性

——————————————

似乎是这样

——————————————

问题一用property()解决

——————————————

还是他的代码最能让人看懂

——————————————

About Programming


First, a few notes about programming, based on personal experience.

My original career path was science, and I taught myself programming to analyze and display experimental data. I expected computer programming to be like my impression of accounting—precise but dull. I was surprised to find that I enjoyed it. Part of the fun was its logical aspects—like solving puzzles—but part was creative. You had to write your program correctly to get the right results, but you had the freedom to write it any way you wanted. It was an unusual balance of right-brain and left-brain thinking.

After I wandered off into a career in programming, I also learned that the field had many niches, with very different tasks and types of people. You could delve into computer graphics, operating systems, business applications—even science.

If you’re a programmer, you might have had a similar experience yourself. If you’re not, you might try programming a bit to see if it fits your personality, or at least helps you to get something done. As I may have mentioned much earlier in this book, math skills are not so important. It seems that the ability to think logically is most important, and that an aptitude for languages seems to help. Finally, patience helps, especially when you’re tracking down an elusive bug in your code.




I like the way that man speaking.

——————————————

https://rszalski.github.io/magicmethods/#access

https://docs.python.org/3/reference/datamodel.html#implementing-descriptors

Python 的这个特性看起来好强大，我有点晕

——————————————

64. 越是无法使人得到提升的东西，在网上(或实际生活中)传播越是广泛、迅速。

祖先留下的选配偶或传宗接代的基因被人利用了，被用来夺取目光和疯狂敛财。

Genius is less, so useless mass is big. They filled in our life.

——————————————

把kotlin上的音乐按钮 结合 local show 结合 webview 结合 math_chat 

再加上永不停止服务的python docker 自启 script

应该会生成一个比较好的 android app




但谁能让我动起来？

——————————————

让Local_Show显示普通文件列表，这样我又少了一个ftp项目

——————————————

要想让math chat(https://hub.docker.com/r/yingshaoxo/mathchat/)真正实用，我应该解决两个问题

1. 把最新的18条消息存在硬盘而不是内存，这样服务器宕机后消息还在

2. 输入框自动伸缩

——————————————

我的脑子也会计算，成天看B站、抖音、直播，我的智商又不会增加

还不如看动漫，至少还可以有冒险的感觉

宅一代应该都有冒险的愿望

但很少人有财力、能力做到

——————————————

你看美国的影视，会偏向于物质、利益，贴近生活的东西。

你看日本的动漫，会有梦想、励志的成分。

而你看中国的影视，既不励志，也不贴近现实。




今天一气看了约100集火影忍者，3倍速

——————————————

目的很简单，以后linux上的设置、操作

全用Python一键完成

——————————————

给 auto_everything 加了新特性，现在可以批量转 ffmpeg 的视频了

https://github.com/yingshaoxo/auto_everything/blob/master/demo.py

并且用上了 nohup

只不过一次性开太多子进程你的电脑可能会受不了

——————————————

行，我觉得我需要更脚踏实地一点



get current directory: os.getcwd()

——————————————

最后一版视频就讲讲我如何再次失败学习AI好了

一定得紧抱 Google 大腿




完事后去看看服务器，域名荒废，mathchat荒废，酷安不收我的应用

老虎不发威，还真当我是病猫😡

——————————————

第三方教程全都失效了

只有谷歌自己的东西能看，现在…

——————————————

@system357 

原来 /etc/systemd/system/syncthing@user.service 里的 @** 是用来指明谁来运行服务(比如@root, @yingshaoxo)，那这样的话，我们的全自动 Python 脚本就可以对我们的 GUI 程序进行操作了

https://yingshaoxo.blogspot.com/2017/11/how-to-set-syncthing-on-server-correctly.html

——————————————

像android sudio, v2ray, ss这些东西，只要放在 /opt 里

除了/opt 备份好对应的主页文件夹

换完系统直接拖进来就可以用，有绿色软件的感觉

——————————————

virtual box的文件夹共享死活开不起来

所以只能按照 kali CookBook 的方法设置好 host-only 和 Nat 网络(后者没外网，只能两个机器间访问)

现在需要想办法自动本地同步文件，虚拟机是opp_system普通user，syncthing 应该没问题

——————————————

主要是Kali不稳定，同时vim python没有代码颜色，一片白心里难受

——————————————

set apt http proxy


vim /etc/apt/apt.conf

add this Acquire::http::Proxy "http://127.0.0.1:8080";



v2ray 更适合拿来当 http proxy 下东西，给浏览器用会经常卡住

——————————————

http://www.bilibili.com/video/av18996822?share_medium=android&share_source=copy_link&bbid=23F7F87E-66F6-4C1D-9917-533D6870E76B31056infoc&ts=1517468635497

——————————————

用AU自带的加速算法做的，我觉得加了音乐毁视频

https://youtu.be/GQCfeGf45w4

——————————————

ffmpeg -i in.mp4 -crf 18 -pix_fmt yuv420p -c:a copy out.mp4

可以用这个把任何不支持Windows Video Editor的视频 转成 受支持的视频，-crf 越小越清晰，0为无损但无法播放，1可以

——————————————

https://github.com/yingshaoxo/auto_everything

人生第一个 Python Package!!!

——————————————

Solved this problem, just put that script in 系统UI菜单自带的自启管理即可

——————————————

In normal user

crontab -e

add this to last line:
*/1 * * * * /usr/bin/python3 /home/yingshaoxo/Codes/Python/auto_everything/test.py

The python script will be running every 1 minute.

You can use it to run any non-UI program, like v2ray


But when it comes chrome, you'll see this error:
(google-chrome:4097): Gtk-WARNING **: cannot open display:















As for systemctl, forget about it, it even can't run v2ray










so how to manage current GUI program with python? it a critical problem!

——————————————

忘了我玩侠盗飞车会头晕想吐

…看来我只适合4399小游戏(创世兵魂)

——————————————

激动得我一晚没睡

gta也下好了

——————————————

I also notice if you work at midnight, China GFW won't limit the speed of Ubuntu mirrors.

——————————————

jedi-vim works well

VirtualBox works well!

Nvidia works well

Chrome works well

Kali style screen record and capture works well

Even self-contained Chinse input method!!!

——————————————

Kali UI + Ubuntu server

Just amazing combination!

——————————————

https://system76.com/pop

I can tell you how well it is!

——————————————

3. Basic condition is very important

fast internet, stable system, healthy body

take it slow and make it right

——————————————

2. Practice makes perfect, not talking or imaging

Open that damn air conditioner, not staying on bed

——————————————

1. A person's ability is limited within a certain period of time

I can not wish to dominate the world

——————————————

I need to calm down

——————————————

https://fossbytes.com/most-beautiful-linux-distros/

浪费时间ing

——————————————

gnome3好丑

看来kali基于它做了很多优化

——————————————

https://ubuntugnome.org/

他们两个相遇应该会迸发出无穷的生命力





http://clonezilla.org/
原来主机系统也是可以备份还原的，直接备份整个硬盘



所以我在淘宝买了两个 16G U盘

——————————————

仔细一思考

kali真不适合当主系统，太多bug了

搞了一上午，既没声音，又无法使用virtual box

我应该去找个gnome linux试用一下

——————————————

https://program-think.blogspot.com/2018/01/nine-years-blogging.html?m=1

为什么他的思维能力一直没下降过？难道这就是传说中的专业程序员？


https://program-think.blogspot.com/2009/01/1.html?m=1

大部分人从来没有【明确】地设定自己的发展目标，每天都是得过且过。等到几年过去了，才发现自己这些年啥也没学会，还是老样子，然后就感叹时光飞逝、岁月如梭。

——————————————

花了两个小时写自动化systemctl service Python script

结果发现 ExecStart 里填 /usr/bin/python3 无法执行程序，不加3就可以

但是 Python2 的 subprocess 没有 .run()

这不是坑人吗？写好的模块又重新想思路？




不玩了，回到win10继续下gta

——————————————

https://www.sunnyhoi.com/how-to-crack-wpawpa2-wi-fi-passwords-using-aircrack-ng-in-kali/

正在跑邻居家的WiFi密码，用 kali 自带的 rockyou.txt passwdlist 要跑37分钟

网上还有7G和33G的密码库，我觉得这个东西还是要考虑收益的，如果邻居家是百兆网，这样跑是可以的。但很明显，这不可能




果然邻居家的密码很偏，没跑出来

——————————————

做事倾注灵魂系列：

http://www.bilibili.com/video/av11694484?share_medium=android&share_source=copy_link&bbid=23F7F87E-66F6-4C1D-9917-533D6870E76B31056infoc&ts=1517139138050






可以说是非常厉害了
http://www.bilibili.com/video/av15758576?share_medium=android&share_source=copy_link&bbid=23F7F87E-66F6-4C1D-9917-533D6870E76B31056infoc&ts=1517140137954

——————————————

人生就像写小说

如果每次都能用上以前埋下的伏笔，就能荡气回肠、绝处逢生

——————————————

https://m.bilibili.com/audio/au214360

——————————————

我知道我垃圾，各方面能力尤其是逻辑思维能力急速下降


但是不说明原因就离去我是很心痛的啊

——————————————

一个大神走了，伤心



大概当我独当一面的时候，就只剩我一个人吧

——————————————

想做的事好多

1. 把应用上传到酷安
2. 给服务器防御(ddos的)能力
3. 研究下破解 wpa2加密 WiFi
4. 用Python实现电脑自动化
5. …

但我的电脑被win上的磁力下载霸占着，什么也做不了😳

——————————————

准备下载gta5养老

玩腻了就学JavaScript👍








magnet:?xt=urn:btih:52afb643744cd57030763420d7d2b45bf4d8d2d3&dn=GTA%20Grand%20Theft%20Auto%20V.iso&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969

海盗湾的种子，不知道要下多久。

——————————————

update again

——————————————

v2ray 自带 http proxy

我真是老糊涂了

——————————————

几句话就被我说服了😁


主要是家里来了亲戚，太吵了

——————————————

login with normal user

apt download polipo

get .deb file for offline installation

——————————————

https://github.com/v2ray/V2Ray.sh


OK, turn to v2ray successfully.

——————————————

run tweaks on kali, you can change the desktop theme to dark

feel comfortable now...

——————————————

https://gist.github.com/yingshaoxo/4b367731bffb2a1efb006d11fac5fd00

update instruction.






Put your mouse on Kali screen left-up corner, has a surprise!

——————————————

https://www.kali.org/news/kali-linux-repository-https-support/

apt 也要  HTTPS

——————————————

幻觉

应该是中病毒了



1. 清华镜像
2. nvidia 驱动
3. 垃圾软件
4. root权限的chrome


所以我重装了系统并用cd live chroot
做了这件事：
echo -e "blacklist nouveau\noptions nouveau modeset=0\nalias nouveau off" > /etc/modprobe.d/blacklist-nouveau.conf

问题解决，不打算装驱动，也不打算装更多东西

除了翻墙必需品和Android Studio

其他都放 virtual box 好了

——————————————

等会儿加个判断，任何带字母的信息都不翻译。

——————————————

C 可能是我的另一门语言，看情况，如果学校计算机考试不允许单报 Python 的话

只能硬着头皮上



虽然感觉如今 c 除了3d游戏没什么用

——————————————

Java 注定会被 kotlin 淘汰，我不学垃圾

——————————————

注意看这张表，出现两次的必学

成为高手每个都要会

——————————————

谷歌翻译

无限制版

——————————————

我的超级小雅又回来了

这一次可以好好学英语了

——————————————

你好

——————————————

Set python3.6 as default python:

echo "alias python=python3.6" >> ~/.bashrc
source ~/.bashrc

——————————————

https://www.learn2crack.com/2014/08/capture-screenshot-record-screen-using-adb.html

https://www.pyimagesearch.com/2015/03/09/capturing-mouse-click-events-with-python-and-opencv/

OK, based on these two things, we may create a android screen on computer, then you can control your phone with it.

突然发现  vysor 不清真，要收费...

——————————————

还有，录视频最大的功用不是装逼

而且直观的展示github或其他项目

——————————————

You can use the adb shell ( > 2.3.5) to tap your android screen:

adb shell input tap x y

——————————————

否定掉

无法做到后台常驻，一切就失去了意义




再说我也不想玩QQ飞车

——————————————

看了卓百林的 摩登时代

不知道是一个悲伤的故事还是happy thing

——————————————

https://thehacktoday.com/installing-nvidia-driver-and-fix-boot-loading-and-freezing-issue-in-kali-linux/

自从刚才装了 nvidia 驱动 和 apt remove lightdm 后， Kali 再也不无缘无故闪退了，画质也提高了

——————————————

对， 垃圾QQ

——————————————

1. 自从有了 Kotlin， 你可以这么绑定一个按钮事件：
button.setOnClickListener({ view -> doSomething() })

2. 这样申请一个权限并delay wating for user
// import android.Manifest
if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.WRITE_EXTERNAL_STORAGE)
        != PackageManager.PERMISSION_GRANTED) {

    ActivityCompat.requestPermissions(this,
            arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 999)

    Thread.sleep(7 * 1000)
}

——————————————

Solved, after open a ticket

——————————————

https://groups.google.com/forum/#!topic/kivy-users/I47UKutCViU


看起来我可以用 kivy 解决这个问题

——————————————

我还以为可以逃过实名shit呢！

——————————————

怎么弄？我是中国人诶

——————————————

https://youtu.be/-0N3Q0T7Hqk

这是先剪辑，后加速音频，再替换音频的效果

还行，就是太麻烦

——————————————

垃圾premiere

ffmpeg的变速音质比他好多了



所以有两种方法解决

1. 先ffmpeg加速，再剪辑
2. 先剪辑，后加速(淘汰，突然发现ffmpeg加速不是万能的，视频清晰度损失太大，只能用来加速声音)

——————————————

https://youtu.be/4FB36OQcMXY

接下来需思考是用 手机按键精灵 还是 adb + python 做安卓的识图部分程序

我的目的是玩手机QQ飞车时自动播放网易音乐

——————————————

这域名白买了

——————————————

我好烦，网站因为红色的字无法访问

不明原因

——————————————

How to set global variable in kotlin


1. put this on top:
object GlobalVariable {
    var mp = MediaPlayer()
}

2. use it everywhere
GlobalVariable.mp

3. so you won't have to worry about open too many MediaPlayer at a same time

——————————————

http://sapandiwakar.in/android-media-player-lock-screen/

我想吐了

——————————————

然后还不回我话😢

——————————————

这孩子

删了账号后又开了新号



被我找到后又把头像删了(并设置为别人无法看到他是否看了消息)





不知道在想什么

——————————————

牙关颤抖

搞不懂该死的 intend 与 某个点击事件 与 android notification 之间的关系

——————————————

不发言就和白拿人家东西一样

——————————————

卧槽

You can see 10.0.2.2 as host 127.0.0.1 in Android emulator

浪费我时间

https://developer.android.com/studio/run/emulator-networking.html

——————————————

https://www.jianshu.com/p/621faba56ba5

——————————————

我用 adb sideload 把 lineageos 刷上去了

等会把教程写出来

——————————————

我给我妈买了个米4

回来root+xposed+多删了点东西

卡米




充电等待蛋疼中...

还好之前刷了三方recovery



不过我不确定手机有没有解锁

——————————————

3倍优酷无广告火影就是爽

——————————————

https://youtu.be/zqa2aBHTMHg




个人有先天的缺陷，若是女生，吸引力会大增吧
https://youtu.be/6hXL713d_cw

——————————————

https://drive.google.com/open?id=1XKhdo7GbvHwfEV2Hsl9kmVZUPClUTt5a

这么好用的东西，给你们一份

我就不拿网盘存随处可得的系统镜像了，破解软件才是刚需

——————————————

算了，既然不熟悉，还是专注于声音处理吧，我把头像变小就行了

https://m.bilibili.com/video/av4444053.html

——————————————

还有，我发现老美不热衷于美颜

以至于我连关键词都找不到



或者说，老外偏重于后期处理，而不是傻瓜式的美白

http://www.doyoudo.com

——————————————

https://github.com/tingxins/520Linkee

http://www.tk4479.net/joee33/article/details/52187292

http://www.it610.com/article/4848562.htm

竟然没有一个可以直接在 windows 上美颜拍片的东西，全是该死的安卓软件

——————————————

https://www.youtube.com/watch?v=wgxJ9dTjL0c

原 kali 自带的 cam record looks like a shit, I mean you even can't add effects to it.

所以我得试试手动加头像到视频

(You can't record directly into Premiere. You can record from your webcam into something like OBS though and then just import the file)

——————————————

http://blog.csdn.net/lvshaorong/article/details/52470012

这玩意儿回学校前一定得测试一下

搞不好就有无限流量用了😂

——————————————

请各位放心，我自有分寸

我做的每一步，都是为下一步做铺垫

我们一定能做出伟大的项目，我们一定能成为超级大神(super man)

——————————————

花了4个小时想搞明白如何让kotlin得到一个给定范围的随机整数

结果放弃，直接 copy + paste ，用 Java 现存代码

——————————————

破解版格式工厂挺好用的 2333

——————————————

有了上面的招数，视频质量提升了好几个档次

——————————————

https://youtu.be/aWQC_Z7JAWs

I love you guys!

——————————————

http://creativedroplets.com/audio-tracks-premiere-audition-cc/

Just watch that youtube tutorial, it's very useful!

——————————————

这样看来多核心，大内存，大SSD还是有好处的

你可以给一个虚拟机很多核心，然后给虚拟机里再装虚拟机，你才不用担心任何系统问题，快照多，看谁不爽就删谁

——————————————

走了一轮，没解决

不过插上耳机又有声音





这下我得小心了，以后每录一段视频，都得检查有没有声音

没有就需要立刻补录，烦死个人了

——————————————

有种想把电脑砸了的冲动

kali没声音，各种fix教程都没用

——————————————

札心了老铁

录了几个小时没声音




白说了一口流利的英语，讨厌后配

——————————————

Oh my godness, I have spend 3 hours to just write a txt file to android sdcard with Kotlin.

😂 Very impressive

——————————————

http://music.163.com/song/406475394/?userid=280429778

这首歌竟然没有把呼吸声去掉，我一直没注意到

——————————————

http://music.163.com/song/3406918/?userid=280429778

——————————————

长大后人出现的两个明显变化：

1. 思维能力的降低
2. 迫于生活，凡事偏向物质利益，即向钱看

——————————————

幻想代表梦想
音乐代表激情
技术代表道路

——————————————

我主要是想把幻想、音乐、技术结合在一起

——————————————

https://youtu.be/btnuUUHjKBw

拍片不易，且行且珍惜

搞了一天

——————————————

还是要看 你的选择，如果平均比特率，几分钟就导完了

——————————————

http://www.phoenixos.com/

你想给老式机装一个Android System吗？

——————————————

真吓人

一分多钟的1080p视频剪辑完，渲染导出要2个小时🙊

——————————————

接下来得看剪辑师有多牛逼了

——————————————

录视频

花了两个小时做基于易语言的mp3播放器…

——————————————

通过 格式工厂 解决了这个问题

转一下，所有东西都正常了😳





不管了，现在开始给 Kali 装虚拟机，再安装 Win10 😋

——————————————

怎么可能知道时间

我做一个任务要20分钟

——————————————

反正 Windows 越来越恶心了😳

——————————————

感觉非常奇怪，那样的话 premiere 一加载 kali录的视频就闪退

——————————————

不行，参数无法调对

Kali 只提供了 h264 编码

这玩意儿就是无法在win10播放

没准试试Windows升级？

——————————————

https://youtu.be/B1A1UoXC5kI

我跟你说

一点都不方便，就算我参数调对了，我还是得重复开关机往返与 win 与 Kali

就为了一个破视频，不值得


等会儿试试新电脑开 虚拟机 win10 卡不卡

——————————————

最后还是用 ffmpeg 合并降噪后的音频。。。

——————————————

先不说这个

Kali录频出来的东西除了Kali，其他都无法打开

上传后可以看





但我要用Adobe系列降噪啊

——————————————

突然看了看 海尔兄弟

觉得比现在垃圾国产动画好太多了

新一代人自由、科学的思想被压抑成啥样了？

——————————————

https://www.jianshu.com/p/1f094c970042

——————————————

看到搜索引擎上类似的东西一大堆，一点兴趣都没有了…

——————————————

http://blog.csdn.net/lj402159806/article/details/53967339


本来打算昨天晚上起来搞事情，结果睡过头了

白天吵啊

——————————————

太久没写代码了

怀念什么都不懂的时候，随心所欲，想到什么就写什么

——————————————

好像是什么cpu虚拟化

可以在主板设置里开启的

——————————————

活生生把我憋回Linux ， 感受美好和我的世界我做主的感觉😂

——————————————

今天花了一整天装 Win 上的软件，不得不说 win 是非常的垃圾了，，，，

各种破解，各种破解软件找不到，基本全部用垃圾百度云，就连谷歌上的英文网站也是各种坑，骗你下病毒推广软件

目前为止我就找到了一个好用的win破解下载站，需要翻墙

但见于群里有位 zd423 的大佬，我还是不发出来为好

——————————————

向着 kotlin 进军

——————————————

https://www.jianshu.com/p/afc3069d8904

——————————————

我是 kali + 固态 + 8G内存 + 4核CPU + 2G 独显

——————————————

恩

——————————————

总算可以用独立显卡运行emulator了。。。快得一逼。。。

——————————————

家里的旧机器用上了 Tampermonkey + IDM ， 百度云下载速度快得起飞😀

——————————————

我买了一套男性化妆品，还没收到

但我已按耐不住心中的激情😘😄😄

——————————————

https://www.youtube.com/watch?v=uSKMrcBqRj0&index=7&list=PLGXfJorQS7_PTQe8wt4ZMMx1oLPDuPAJ7

——————————————

我深深地感到

如果我们想让 linux 或 Python 发光发亮

GUI web 化是必须的






举个例子，如果我们要做一个支持latex的思维导图工具

除了web渲染最方便快捷外还有其他选择吗？Definitely not

——————————————

还是被窝里舒适😄

——————————————

The main idea of this shit is: you have to 用虚拟机同时开n个系统，并把它们的网络以某种特定的方式连接起来，这需要n个CPU内核和一堆内存。(在你构建的系统中，需要有一台是 Kali，其他都是受害者)

——————————————

Clearly, the greedy strategy doesn’t give you the optimal solution here. But it gets you pretty close. In the next chapter, I’ll explain how to calculate the correct solution. But if you’re a thief in a shopping center, you don’t care about perfect. “Pretty good” is good enough. 

Here’s the takeaway from this second example: sometimes, perfect is the enemy of good. Sometimes all you need is an algorithm that solves the problem pretty well. And that’s where greedy algorithms shine, because they’re simple to write and usually get pretty close.

——————————————

You can choose subnet you like.

Just similar to iodine.

——————————————

What is host-only network


The host-only network can only talk within the host and among other devices connected to the host-only network. It cannot communicate through your Ethernet or wireless networks. This setup is extremely critical to our testing environment, as we do not ever want to expose our testing hosts to the outside world, as they are very vulnerable and will be hacked rather quickly.

——————————————

要是我以后

大概会这样想：飞机都嫌贵，还回去干什么？

——————————————

看来是做不完了


超疲惫下，脑袋可利用率为0


20小时还不能睡觉，因为不是结伴而行。要是我的新电脑消失了，我还是挺不开心的。

——————————————

无聊的旅途需要这个，我想

——————————————

刚刚对着我车桌对面的女孩写了两句话在 Adobe 画板 (并给她看了)


1. You looks great!

2. Nothing else.

——————————————

明天下午5点要开始体验贫民火车20小时的脏乱差环境


希望我能活下来并做完该死的网络选修课

——————————————

抖音在过度消耗音乐的力量

缺失完整性的音乐终究不完美

——————————————

@system357 

的确，歌会听腻


我指我的网易歌单

——————————————

我们这一代有人在大学才开始化妆，而现在，新一代从小学就开始了，我自愧不如啊

——————————————

男士化妆指南

0. 洗面奶洗面，去除多余油脂(可忽略)
1. 把防晒霜或保湿霜均匀抹于脸上
2. 用手指或大粉刷，把粉底 点抹于缺陷处或均匀地刷在全脸
3. 把 透明碎粉 刷脸上，如果有的话(避免油腻的感觉)
4. 刷顺眉毛后，用灰色眉笔把眉形 由中心线向两边扩散勾勒出来，再刷均(最好能提前去掉明显的边缘杂毛)
5. 鼻顶一条线如不够亮白就用手指推画一条高光粉直线，两边 鼻翼和其他阴影部分 则用暗一点的中间色与最深色相混合的粉作为阴影(所谓不整形产生的轮廓当然是利用人们对光与影的感觉制造出幻觉啦！)
6. 弄好发型，喷好香水，let's go!

https://youtu.be/rwKgNH4jaAM
(如果宅在家咱们还是用美颜相机吧，别瞎折腾了)

——————————————

完蛋了，看了一会儿抖音，觉得化妆技能挺重要

化腐朽为神奇

——————————————

やめて!

压灭的
(会)压灭的

一群原始人钻木取火，火才刚好升起来，一群人就凑过去取暖，发火人大叫到：“(会)压灭的！”；或者欲火、激情才上来，请不要把它压灭，也用这句话。因为我们在警告对方，这种生命的激情会被压灭；后来随着这个词在紧急时刻的频繁使用，变成了“不要啊”恳求的意思。

——————————————

がんばって！

干吧，爹！

有两种含义，干活或干人，看你怎么理解，反正都是叫你加油干。

——————————————

ありがとう

啊，你，给 duo (捅的方言是 duo)
啊，(对于)你(呀)，给操(我的权利)

谢谢你，为了报答你，只能给你操了

——————————————

That's what we need

——————————————

你不懂，安卓上 Chrome 也会自动断线，ADM就不会

——————————————

Chrome的下载真是弱爆了，国内各种网盘，动不动就下载暂停

Win下用 idm，感觉好多了

——————————————

下学期应该上床帘了

免得大家看见我压力大，从而做出一些让我压力大的事。

顺便防个光，我在黑暗中生产效率最高。

——————————————

大学就是一个垃圾聚集场

但这里也是社会模拟场



这里有的只是不择手段，达成目的罢了(作弊、摇尾讨好)

所以我努力的重心还应该是不在意垃圾们的目光，去出其不意地想出解决方法，提升自己

随波逐流还不如现在就去跳河

——————————————

看了《我的英雄学院》，感觉很不错，很燃

——————————————

为什么BT下载多年没速度？

根源在于人之自私。

素质太低，不能正确认识到“我为人人，人人为我”的利益关系。

简单讲，就是一群乌合之众，活该被奴役、被压榨！

——————————————

This time, finnaly I make it right:

https://gist.github.com/yingshaoxo/1d5cb8c239cf5b9982751122b023d1d7

——————————————

Text to Speech in python2:


# apt install espeak
# pip2 install pyttsx 
# Just for python2 
import pyttsx

engine = pyttsx.init()
engine.say('Hello, yingshaoxo!')
engine.runAndWait()

——————————————

室友的电脑在我指导下安装上 deepin

结果 store 打开闪退





解决方式比我的简单多了，直接在deepin设备管理器安装 nvidia 和 Intel  驱动

——————————————

总算考完了

接下来唯一让我不爽的是


要坐20多个小时的普通硬座火车 ®

——————————————

Javascript 画图可以这么优雅

——————————————

思考人生

——————————————

如果真能和某所学校取得联系

并免费学习，还是不错的

先不讲学没学到技术，能锻炼口语是肯定的

——————————————

Seems like I fucked it up.

——————————————

I don't know what I have done...

——————————————

Select a Subject:


Computer Engineering
Computer Science
Information Technology
Network Administration
Network Security
Software Engineering
Web Development


It's a difficult choice.

——————————————

自从 ssh .rsb 复制到新电脑 和 set up polipo 后，我觉得工作环境已经架好了






我个人最大的缺陷应该是执行力不够强，不够专注，容易开多线程

这样是很难做大事的

——————————————

其实也就是感到心寒而已

https://www.staticgen.com/

——————————————

如果我现在要做博客

那肯定是玩真的



譬如防ddos攻击，那是必须的



不过在那之前，我得选个好的博客模板，最好基于Python的

实在不行自己来一遍(造轮子)

——————————————

https://www.typingclub.com/sportal/team-18748/program-left-hand-typing-2.game

一口气做了78节左手课

——————————————

Practice makes perfect.

——————————————

If you wanna increase your speed, first you should focus on your accuracy.

——————————————

这一点真的是严重阻止了我流畅地工作😒

——————————————

I just watched this:

https://www.youtube.com/watch?v=sZWMPYIkNd8

——————————————

OK, as you can see, it didn't add python to back end web.

——————————————

https://www.jianshu.com/p/0fa301d892ab

简书除了不被搜索引擎收录外还好

可以直接在编辑框上粘贴图片数据，自动上传

——————————————

看那些东西如此蛋疼，其实我只需要知道怎样在安卓开发中调用三方SDK或别人的项目


我脑袋是一片空白，如果稍微知道一点，我们还可以继续玩安卓开发

——————————————

不能用 pyautogui 就很伤心了

——————————————

最近出了这个，我在想能不能弄个 auto py

https://www.coolapk.com/apk/com.stardust.scriptdroid

——————————————

https://www.washingtonpost.com/news/world/wp/2018/01/07/feature/in-china-facial-recognition-is-sharp-end-of-a-drive-for-total-surveillance/?utm_term=.36d9c0f83474

技术是把双刃剑，看来以前电影中所说的天眼监控，就快成为现实了

——————————————

- Logout : Just like locking your smartphone.

- Shutdown : Completely power off your system viz. PC, laptop.

- Restart : Power off and then start again.

- Suspend/sleep : Pur your computer at very low power state, screen off but everything else is on but at very low power so that you can resume your work where you left off but if battery die you loose all your unsaved data.

- Hibernate: suspend to disk; includes power-off, looks like shutdown. Basically, everything in the Ram is copied to swap memory and system shutdown completely. when you start your computer back everything copies back to Ram and you continue where you left off.

——————————————

心情不好

proxychains 在 kali 上用 apt 报错

这样我怎么能流畅的免费上网呢？

——————————————

所以我又回到 chrome 大家庭了

因为火狐对插件支持太差，grammly 出错， vimff 谷歌双开窗口bug 等等

简直不能用，没 chrome 稳定

——————————————

https://gist.github.com/yingshaoxo/4b367731bffb2a1efb006d11fac5fd00

——————————————

突然发现用 alt + 1 or 2 or 3 就可以切换 terminal tab

——————————————

惠普笔记本的唯一不好之处在于 pg up and pg down 在最右边

然而 kali 的 terminal tab 切换只能用 ctrl + pg up or down

虽然我不想用 terminal tab， 想直接 alt + tab 切换， 然而 kali 不允许，它把所有 terminal 窗口放到一个 tab 标签，需要用方向键选择

——————————————

Kali's iodined is very good, won't auto stop if you don't use net.

——————————————

For example:

https://extensions.gnome.org/extension/1112/screenshot-tool/

——————————————

Gnome is great, you can even use it on kali.

https://extensions.gnome.org/

——————————————

https://www.jianshu.com/p/64befa59414c

update

——————————————

我去

黑客也有竞赛

http://blog.rookiehacker.org/2017/07/01/fourteenth-day-in-Beijing/

——————————————

我主要想基于这个域名

不同前缀用不同服务器做不同的功能

——————————————

买好了

——————————————

不管是李阳的 don't be afraid of failure

还是马云的 我们不能保证一定会成功，但我们一定会失败，只有去学习别人是如何失败的，我们才能避免失败

还是 AI 中的 强化学习




都强调了，我们必须不断尝试、不断失败，才能学到正确的 pattern (模式)

——————————————

上次最多开了70多个页面

——————————————

我挂的日本ssr

换成美国的就好了

——————————————

你是推荐我买xyz

但目前它搜索不了

——————————————

https://gen.xyz/register

无法搜索域名

——————————————

这么便宜吗？

——————————————

https://gist.github.com/yingshaoxo/9b027ace63cf9982fe22320539bb6c95

接着可以开始买域名了(先复习，不挂科要紧)

——————————————

我操！

我被学校办了信用卡！！！

http://bank.jrj.com.cn/2017/07/05070422698196.shtml

——————————————

感觉无线键鼠就是一个失败的设计

别人都是把东西越做越集成，比如触摸屏

——————————————

我跟你讲，只做节奏鬼畜是不够的

必须有歌词、要rap

然后把音轨导出来修音+调整





实在不行你可以把音轨传给我，我来处理

——————————————

http://www.bilibili.com/video/av3958416

1.5倍看完一次，vegas 调音真心方便

——————————————

我就是不装 archlinux

因为上次下了一个，一进去就是黑框框，不友好😂

——————————————

Fixed!

You don't have to do so many things, just:

apt-get update && apt-get dist-upgrade

——————————————

目前的问题是 reboot or shutdown now 会卡住

绝对是 nvidia 显卡太新的缘故

——————————————

至于修复win10的引导：

0. 全基于 BIOS

1. PE 用 DISM 恢复某个盘的win10引导

1/2. 去那个win10玩玩 EasyBCD 也可以

2. 去你安装好的另一个盘的linux，用 update-grub

——————————————

刚才晃了晃电脑，发现kali屏幕旋转了

不可思议！一个笔记本要啥重力感应

——————————————

没有更好的了

——————————————

kali才是人用的系统

way to fix:
1. ctrl+alt+F1 to terminal
2. apt-get install lightdm (choice lightdm)
3. reboot

——————————————

https://forums.kali.org/showthread.php?31763-Grey-screen-with-working-mouse-after-login

看起来是显卡太高级(奇葩)了

——————————————

但不好用

——————————————

Linux mint的界面几乎和lubuntu一样

——————————————

You can use DISM to mount and service Windows images, including Windows image files and virtual hard disks. The DISM tool comes with Windows and is also distributed as part of the Windows Assessment and Deployment Kit. In addition to configuring Windows features and settings, you can use DISM to repair a Windows image, both offline and online.


类似于 chroot 


在实在没办法修复Windows引导时，用它

——————————————

我需要一个支持新电脑的 linux

——————————————

lubuntu也是各种异常卡

——————————————

试了下安装kali到固态，不行，登录进去一片灰

——————————————

我搞的双系统，lubuntu 装固态硬盘，win10 pro 装1T机械硬盘

从此以后我要开始飞一般的体验了😂

——————————————

给固态硬盘装上lubuntu

1秒启动😂

——————————————

好吧，等我挂科了再去找找资料

明天下午我的新笔记本可能就到了

买的这个，普通套餐2
http://m.tb.cn/h.A7wf9i

——————————————

人生如此多娇，专业课学得想吐，关键是没英文资料(资源)

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/response/yi-jie-dian-lu-de-quan-xiang-ying.html

——————————————

便宜，一个月才6元

——————————————

看了 《天才枪手》 国语版

没加速，可以说是非常好了

——————————————

没用，开放WiFi自带免疫

——————————————

再也不拿那台垃圾电脑搞安卓了


可把我愁死了，一个操作要等10分钟

——————————————

很好奇怎样用别人的包


https://github.com/Scalified/fab/blob/master/README.md

——————————————

Android studio install SDK failed?


Going to /opt/ and using chmod -R 777 on all the android directories.

——————————————

玩了一晚的手机版QQ飞车

毒瘤

——————————————

http://music.163.com/song/514765154/?userid=280429778

看MV，发现郭采洁有一种病态的美

——————————————

凡事都问个为什么，你会成为哲学家

凡事都说个是什么，你会成为政治家

凡事都思考怎么办，你会成为实干家

我是哲学家😁

——————————————

n=-1
times = 0
while True:
    if (4*n+7) <200:
     times += 1
     n += 1
    else:
     break
print(times)

——————————————

大学真累，还不能强制控制住自己利用空余时间继续学习 Programming or AI stuff

——————————————

作为一名伪程序员

学得快，忘得也快

几乎每隔几天就觉得学校的东西都忘得差不多了

要不是有自己做的电子笔记看，早玩儿完了

——————————————

多开几个tab，在 Kali system 上照样卡得要死

换电脑是必须的

——————————————

https://github.com/wifiphisher/wifiphisher/blob/master/README.md

Very useful if you know how to build a fake login page

I'm gonna use it to get some accounts in the near future

——————————————

https://github.com/gfwlist/gfwlist

还是不要抵制现有的东西比较好

——————————————

机器学习的大训练策略叫做 总

中间过程的 data 叫做 分

最后结果 叫做 总

但两个 总 是不同的，前一个是表面的总，后一个是难以理解的混合了太多细节的 总

所以语文上的 总－分－总 构架恰恰勾勒出了人类学习的基本模式

——————————————

由 deep learning 的训练过程又可知，我们光有智力容器是不够的，需要有个更高智慧去指导你，教你训练策略和收集合适的 data

这个更高级智慧在当代，往远了说是社会，往近了讲是父母

如果没有这个更高级的智慧做指导，结局就像“狼孩”，有智力容器也没用

——————————————

だいじょうぶ
带(了)胶布的

带胶布了吗？带了，所以不用担心，没问题的

——————————————

おれ
我来哇
我的哇
我的话

你要问我的话，我是yingshaoxo

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/high-level-math/integration/goes-deeper.html

——————————————

懂了

把 x-2 视为一个整体，我们需要它分之一最大，所以它必须为正数，在x>=2的情况下，x越小越好

和极限不一样，极限只有0是无穷小

——————————————

我把它分出来 1 + (4／(x - 2))

难道不该是分母越小，整体越大？

——————————————

When you failed, dried, tired, and can't figure out the answer of a problem, all you need to do is: sleep.

Try to do it again after you waken up.

If still can't find the answer, maybe Google or your friends will help you.

——————————————

库多的深层次原因是用的人多

用的人多的深层次原因是大众化、简单易懂、接近自然语言

大众化、简单易懂、接近自然语言的深层次原因是充满人文关怀、内含文科思维、与日常生活接轨

——————————————

域名和主机的区别是，域名一旦开始，就不能更改

——————————————

另外，训练神经网络需要大量的时间

要想节省时间就得基于别人现有的模块训练

由此得出：Learning is a time consuming progress.

那些SB说别人天赋高、学得快其实是一叶樟木，没看到别人的基础

——————————————

生活越来越无聊了

专科生的学习也不是那么 easy 啊

——————————————

Advanced Package Tool (APT) (apt)

——————————————

Browser Exploitation Framework(BeEF)

Use BeEF, you can get almost everything about user browser as you can get in local.

——————————————

BurpSuite is designed to be used alongside browser. 

Burp functions as an HTTP proxy server, and all HTTP/S traffic from your browser passes through Burp.

——————————————

哦

——————————————

Dog 

你在公司做测试时完全不考虑安全性吗？

——————————————

70多元一年，是属于贵还是便宜呢？

——————————————

就是这种智力训练的不确定性

导致人们把智力说得玄乎其玄

什么智力先天论, CaoNiMa, 都是放屁

——————————————

然后还应知道

过多关注琐碎的细节会造成 over fit

只看表面又会有 data 不足，训练出垃圾的后果

——————————————

类比深度学习和我个人实际学习


学习好坏主要取决于数据的选取和训练策略的不同

容器大脑(tensorflow)大家都一样

拿英语来说，疯狂英语是非常好的data set，准确的包含了应用英语的本质，所以能有比较好的训练效果

——————————————

垃圾tk

在考虑要不要自己维护一个付费域名，开始做博客等web app

——————————————

本质上就是类通俗化自然语言

——————————————

我们喜欢Python的首要原因不是因为它简单

而是因为它拥有更多的文科思维、大众思维在里面


它不像其他的SB理科思维语言一样，没有生僻的不接地气、不与主要交流语言接轨的词汇和“句子”


如果有人认为经典不是给普通人用的、傻瓜式操作，那你就别用苹果或其他智能手机了

😏

——————————————

https://linuxconfig.org/how-to-install-latest-firefox-browser-on-debian-9-stretch-linux 

安装了Firefox新版，挺流畅

——————————————

Kali installation, It's all about choice.


-1. format your disk using PE system, we need a clear disk, or something will going wrong

0. use refus  to make USB driver
 
1. just to be safe, use MBR based mix mode

2. use dd mode to defend Wi-Fi firmware missing (iso file belongs to Windows, and Windows is bad on drivers)

3. if you can disable secure boot, you can use UEFI in installation, else just use BIOS

4. if you failed, try more option in -1 and 3 step.

5. links may help
https://null-byte.wonderhowto.com/forum/fix-failed-detect-and-mount-cd-rom-problem-when-installing-kali-linux-0177158/
https://forums.kali.org/showthread.php?35926-Executing-grub-install-dummy-failed
https://wiki.deepin.org/index.php?title=Repair_Boot
https://www.linux.com/learn/how-rescue-non-booting-grub-2-Linux

——————————————

Finally install Kali successfully!

——————————————

kali可以直接用手机的网络

这样以后搞免流方便多了

——————————————

高数没有高中和初中的基础真是难得吐血

要是有疯狂英语那样可以囊括小学、初中、高中所有基础性知识的教程就好了

——————————————

😭

他们就是这样阻止我变成大神的

Deepin无障碍安装成功

——————————————

Whatever, let us listing to a song

http://music.163.com/song/523249569/?userid=280429778

——————————————

Well

你的意思是这个 list 里的电脑都可以买？
https://www.coreboot.org/Supported_Motherboards

——————————————

准备下个 deepin 再看看具体情况

——————————————

我 rm 也提示没权限

——————————————

https://bbs.archlinux.org/viewtopic.php?id=182978

最后一个对话可能是解决之道

但我看不懂

——————————————

??

——————————————

我在那个文件夹尝试创建文本

结果vim提示没权限

即使sudo + root

——————————————

一个都没有

——————————————

How?

——————————————

稍等，我还要重打一遍上面的代码再进chroot

——————————————

到 grub-install 报错

——————————————

https://forums.kali.org/showthread.php?36601-UEFI-How-to-repair-kali-linux-grub-dual-boot-with-Windows-10

——————————————

我就是一步步来的

USB driver to end 最后一步 报错

——————————————

我就觉得奇怪

deepin都能装，kali还不能？

——————————————

我之前装完Windows后再装deepin就提示我…不能安装双系统，所以当时我就只装了Ubuntu

——————————————

对

我只知道在F12出来的boot界面关那些东西

然而并没有那个选项

——————————————

有心理阴影了，一看到grub-install，我就知道我这垃圾笔电只能安装Ubuntu 和 Windows

——————————————

这么好的系统我用不了，真是遗憾

——————————————

做一下总结：

0. linux启动盘制作用 Rufus

1. 没网驱的PE系统无用

2. 能与手机直接连接的U盘是你以后应该买的U盘

3. 不能 disable secure boot 的笔记本 和 锁 bootloader 的安卓手机一样，统统不能买

——————————————

由此看来，锁 boot 的笔记本也是垃圾，不能用


http://www.ruanyifeng.com/blog/2013/01/secure_boot.html

——————————————

No matter how I try, errors always goes in there.

就像我没有 disable secure boot 一样，但我主板确实没有选项得到禁用那个

——————————————

UEFI is essentially a tiny operating system that runs on top of the PC’s firmware, and it can do a lot more than a BIOS. It may be stored in flash memory on the motherboard, or it may be loaded from a hard drive or network share at boot.

——————————————

In 2007, Intel, AMD, Microsoft, and PC manufacturers agreed on a new Unified Extensible Firmware Interface (UEFI) specification. This is an industry-wide standard managed by the Unified Extended Firmware Interface Forum, and isn’t solely driven by Intel. UEFI support was introduced to Windows with Windows Vista Service Pack 1 and Windows 7. The vast majority of computers you can buy today now use UEFI rather than a traditional BIOS.

——————————————

BIOS is short for Basic Input-Output system. It’s low-level software that resides in a chip on your computer’s motherboard. The BIOS loads when your computer starts up, and the BIOS is responsible for waking up your computer’s hardware components, ensures they’re functioning properly, and then runs the bootloader that boots Windows or whatever other operating system you have installed.

——————————————

明明 live mode 就可以运行

不知道谁做的 SX 设计，硬盘安装那么麻烦

——————————————

估计是 Kali 安装时需要稳定的网络支持

学校只有我手机的无线网络，这不就出问题了吗

——————————————

烦，一夜一天了

还没装好

——————————————

主要是kali的各方面配置比较好，合我的胃口


再加上，唯一不需要合作的事似乎只剩下hack了

——————————————

即使看了这个也没用：https://null-byte.wonderhowto.com/forum/fix-failed-detect-and-mount-cd-rom-problem-when-installing-kali-linux-0177158/


竟然要自己找 firmware

——————————————

为什么在虚拟机里装机很简单，到外面就难了呢


还没装好😞

——————————————

U盘少就是烦

搞到现在

还没装好

——————————————

USB安装Kali各种错误

目前还没搞定



快要疯了

——————————————

Watched 《Corpse Bride》

How sad the ending is!




2005年能做出这种动画还是不错。

——————————————

Backup my data now.

Prepare to install Kali system.

Ready to a new world: penetration.




You can built your AI system, but I can crack it and use it on my own purpose.

——————————————

http://www.bilibili.com/video/av17456296

——————————————

学了一波 bash script，  learned how to use parameter

#!/bin/bash

run() {
    pkill python3.6
    nohup python3.6 app/app.py &
}

docker_run() {
    pkill python
    python /usr/src/webchat/app/app.py
}

pull() {
    git fetch --all
    git reset --hard origin/master
}

if [ "$1" == "run" ]; then
    run

elif [ "$1" == "docker_run" ]; then
    docker_run

elif [ "$1" == "pull" ]; then
    pull

elif [ "$1" == "" ]; then
    echo "run 
docker_run
pull"

fi


语法严得一B， [] 必须变成 [  ] 才能用，外面的括号与表达式需用空格分开

——————————————

Feature building failed

修复了 textarea 高度错误的问题
取消插入 /text{} 的功能

——————————————

https://youtu.be/9_KMVu0ePOM


1.5倍速合适，俞敏洪对战SB官僚主义学校领导，北大也不是个好地方啊

——————————————

https://jsbin.com/vayoso/1/edit?output

解决这个问题



接下来要让输入框随行数自动增高

——————————————

高档老式玩具而已

没什么技术含量

——————————————

学校又报名全国性的 Robot 比赛

买了一批机器人

我应该会参加




目前我正在看 RQ-HUNO 这种 robot

... 说实话，老型号，不支持 Python，不爽

——————————————

已用快捷键 Ctrl + c (chat) 和 Ctrl + m (math)

构建 /text 和 $$/begin 插入


目前正寻找一个方法在插入文本后把编辑框光标移到中间(似乎很难)

——————————————

Sorry

That was just my mistake

上一次代码构造错误，应该把替换 /n 到 <br> 的这个功能永远固定到 web 渲染层面


我们数据传输时尽量 keep data being raw

——————————————

遇到了严重的 flask character escaping 与 HTML 不兼容的问题

比如 flask 对 /n 的处理是令人失望的，在 HTML 上显示 <br> , 却不真正换行




如果扯上 JavaScript ，更复杂



所以我需要时间理清它们之间特殊符号的转换关系

——————————————

我们的初心是让知识传播更便利(廉价、开放)

So, let's do it!

——————————————

PS:

做中转是不能逼其他平台升级的

——————————————

正当我要动手时，我又在思考，是保持通用性做信息中转好(短期内 Telegram 和 QQ 以及其他平台收益大)


还是直接暴露其他聊天平台的不足，直接做我们自己的平台好(这个在长期看有好处)

——————————————

可以，但那要等我寒假换电脑再说

——————————————

你再看一眼我上面的需求

——————————————

突然发现右击 chrome 文件夹，可以选择全部打开

——————————————

我觉得浏览器差不多也该升级了

应该有书签组这个概念

有时候，做某个特定的工作，比如写gitbook，数学需要打开一系列网站，电工需要打开另一系列网站

不让用户劳累于一个个打开网站，就需要书签组这个概念，一键打开多个网站

——————————————

根据我多天的跟踪测试，即写数学笔记


发现要想真正使 math chat 变得实用

我们还得自动在消息前后添加 /begin {align*} 和 /end{align*}

并且添加插入 /text{} 的快捷键

——————————————

https://github.com/pandao/editor.md/blob/master/README.md

有了这个可以秒杀简书

——————————————

如果 pydroid3 可以安装这个就好了，真正的通用型安卓自动化


无聊的思修课，形势与政治

——————————————

原来 pyautogui 可以直接找图，完全秒杀按键精灵啊

——————————————

http://www.bilibili.com/video/av17298476

这腿卖得好




话说舞蹈早就变成了一门卖腿的艺术

——————————————

I love math, math love me too.

——————————————

https://tools.kali.org

awsome tags

——————————————

我只是比较好奇

像 DNS tunnel 这种东西我为什么不能早点知道呢



究其原因，还是资讯源太少，能力太low

我可以猜想，每次 kali system 加一个新软件，就代表一个新漏洞

也许我们可以从那里得到一些信息

——————————————

"严格意义上来说，proxychains不算自动的全局代理，有没有像Proxifier这样，开了之后自动让所有启动的程序都走系统代理呢？答案就是redsocks。"


哦，原来redsocks有这个功能

——————————————

http://www.williamlong.info/archives/5184.html

可恶，不会自己找妓吗

就是这群人害得程序圈没女神

——————————————

对于服务商来讲

他们只能用一种方法来屏蔽这个，就是断开长时间未认证的机器



然而由于普通用户很难在短时间内完成WiFi验证

所以这个“长时间”至少要10分钟

对于我们来说，够了



接着就是不断换机器标识的问题，easy

——————————————

https://yingshaoxo.blogspot.com/2017/12/use-dns-tunnel-to-get-free-internet.html

——————————————

DNS的问题，不用53默认端口，加上iptables的转发解决问题


有线网不能用，无线网80多k

——————————————

我是指服务器启动 iodine 后，服务器无法连接外部网络

那样的话就没办法架ss了

绕过网页验证后只能访问服务器有什么用…

——————————————

哥 

DNS tunnel 打通了，可以访问到服务器内网

但是每次服务器一启动 iodine就无法访问外部网络

我是基于这个搞的
https://www.rawidn.com/posts/how-to-use-dns-tunnel.html

——————————————

Use aptitude installing package will give you better experience.

——————————————

优雅的流氓绅士，代理死神黑崎一护

冬天穿西装不穿保暖衣，露出前胸膛

——————————————

SVG is a scalable vector graphic. It is part of the HTML5 specification. It can contain text, images and vector content. SVG works in all modern browsers, making it ideal for providing a consistent desktop and mobile viewing experience across devices.

我把 pdf 转成 svg 后得到一堆网页，没用，我还以为 svg 是一种图片格式呢

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/voltage-and-current-rule-in-circuit.html

看起来 Khan 学院的电路图就是用 circuitikz 做的

只不过它是矢量图，不会模糊，我是在线编辑器渲染再截图

在线不支持导出图片，只支持导出PDF

那个pdf里的好像是矢量图

——————————————

下了 spy camera, 准备长期奋战制作室友游戏粗口鬼畜合集

不回击就和平，一回击我要让它们体验极客的攻击力


同时也提醒我没能力就没引战

——————————————

看了2部哆啦a梦剧场版

对于对抗SB室友游戏噪音有奇效

——————————————

B站联通卡国际版免流

然而没什么用，多看一会儿就腻了

——————————————

http://www.bilibili.com/video/av17275391

听说不会娱乐，效率会很低

我必须得放松一下提升效率和学习积极性

——————————————

也有可能它没有在本地渲染，我看了下它的HTML Source 发现它用的svg矢量图

怪不得在国内网情况下，它网站无法显示电路图

——————————————

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
 
\usepackage{circuitikz}
 
\begin{document}
\begin{center}
\begin{circuitikz}
    \draw (0, 0) to [R, l=$yingshaoxo$](0, 3) -- (3, 3) to [L, l=$SB_{ys}$](0, 0);
\end{circuitikz}
\end{center}
\end{document}

http://mirrors.ibiblio.org/CTAN/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf


需要对照着学习

——————————————

https://www.sharelatex.com/learn/CircuiTikz_package

原来我学的是英式，而不是美式图标

——————————————

然后我发现

Latex在 Linux 上的分支根本无法安装，或者说安装步骤和难度超过可忍受范围

造成一个结果，我只能用它提供的在线编辑器写 circuitikz 语法

——————————————

完全没有耐心手画





然而无法“表示”就无法学习，你懂的

——————————————

真的非常非常想知道 Khan 学校的 电路图是怎么渲染出来的

——————————————

有时真的感觉是编程自学能力在支撑我的高数、电工、English

https://yingshaoxo.gitbooks.io/university-notes/content/high-level-math/integration/use-formula.html

——————————————

Now I understand

https://www.mathsisfun.com/calculus/integration-by-substitution.html

——————————————

第一类积分换元法真难理解

——————————————

作为一个伪程序员

我真是觉得那些人有问题

所有的数学知识为什么前后不衔接呢？




难道真是要有一个特别牛逼的人才能把所有知识都串起来吗？

——————————————

我是乐于助人的好孩子😁

——————————————

在图书馆遇到美女的可能性比教室大多了😂

——————————————

图书馆才是学习睡觉写代码的好地方

没有傻逼的干扰，学得好睡得着

——————————————

虽然我不觉得像我这样的人有多大的生产力

但我们拥有异于寻常的坚持力


每人做一个程序，积流成河，必能汇聚成大海

——————————————

感觉 GTK 的整套设计都不合理，因为没成功安装上wxpython

因为整套 API 系统太复杂而不适合普通人操作，所以 GTK 平台上的好UI程序不多

——————————————

If you really don't know what exactly a version of program is, and you need to install it, use *

For example:

apt install gstreamer1.0*

——————————————

Great power comes from great willingness.

——————————————

写书(或教育)成功的关键在于以文科生的语言风格(或思维能力)写理科生的内容。——— (喜闻乐见又有意义)

——————————————

好难

用Unity开发3D游戏步骤好多

——————————————

C# 2017趋势上涨的原因

荒野求生

——————————————

每次都感觉在学校编程能力会急速下降


似乎总有傻逼在旁边打游戏并发出噪音

——————————————

走走走

转战手机和web开发




MD，电脑不能随身带，手机还不能吗？

然后为了fun，还得学学游戏开发，构建自己的3D世界，顺便把计算机科学 gragh 那部分知识过了

——————————————

烦透了每次都添加swutchy规则

明明我95%的时间都在浏览外文网站

I should set default proxy to ssr.

——————————————

http://www.jianshu.com/p/493dc2f30d40

——————————————

一个好的 graph 库应该包含三方面

1. 基本UI，像安卓界面一样，方便新手
2. 点阵系统，像pylab一样，方便熟手自己操控界面
3. 粒子系统，方便游戏开发

——————————————

然而 python 的 graphs 引擎(kivy)真是烂到爆

完全感觉不到可以任意绘图的自由感

——————————————

https://github.com/jwasham/coding-interview-university

我可能进入到了 Graphs 这个阶段，路走了一半，不能半途而废啊！

——————————————

https://github.com/Khan/KaTeX


I'm feeling good about this project

——————————————

https://github.com/Khan/tota11y

Khan 专用 web 渲染库...

——————————————

那些能开发出粒子系统的人真是太屌了

——————————————

So definite integral just 函数曲线对应的面积

——————————————

0 is not positive

——————————————

one interger in common, in another words, 3 interger is different😕

——————————————

Install pip3.6:

curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6

——————————————

一个建议

继承并超越vim




如今图标与按钮不计其数，我们为何不训练个 classifier 专门找屏幕上的图标或按钮，并像vim一样画个框标上字母供你点击

具体的和上面那个程序一样，一按 control + f 就用 opencv 截一张图，然后调用 Google 识图 tensorflow package，接着的流程和上一段一样。

——————————————

sudo apt install keynav


Run keynav, and activate it by pressing Control + ;.

h : select the left half of the region
j : select the bottom half of the region
k : select the top half of the region
l : select the right half of the region
shift+h : move the region left
shift+j : move the region down
shift+k : move the region top
shift+l : move the region right
semicolon : Move the mouse to the center of the selected region
spacebar : Move the mouse and left-click
escape : Cancel the move



除了颜色有点丑，没什么不好，屏幕再大也只需按10下

我记得我以前做AI暴头时也是用的这个方法

——————————————

原来一个 dict 也可以用 `+=`

然后这是一个统计词频的好方法

——————————————

讲得真细致

——————————————

原来我是可以直接在图上随便摆文字的...

——————————————

http://music.163.com/song/86363/?userid=280429778

https://yingshaoxo.gitbooks.io/university-notes/content/high-level-math/integration/indefinite-integral-formulas.html

http://music.163.com/song/2007819/?userid=280429778

I always think it's good as long as I hear.

——————————————

http://docs.sympy.org/latest/modules/integrals/integrals.html

Quite impressive.

——————————————

要是我像对你们一样面对社会

我可能已经死了几百回

——————————————

A bit of curious about how machine slove 积分 if I give it a derivative function.

——————————————

所谓非理性就是一套利益决策系统developed by natural

所谓理性就是一套利益决策系统 nature designed, but you have to develop

——————————————

今天老师又讲了积分

我很想骂娘




他们就是在做机器一样的事情，10秒出答案

我5分钟都不知道发生了什么事

——————————————

indefinite integrals
不定积分

就是已知导数，反求函数

——————————————

传统的手机APP开发已经变得没意思

应该注重于调用第三方高大上SDK



比如在安卓上后台找图(AI向)，实时画框

——————————————

其实搞了这么多，你不觉得按键精灵也挺好玩儿的吗？

在Linux上可以用 pyautoGUI

——————————————

好了，接下来的任务是 平台化 ，把 webmathchat 和之前的 kivy chat 结合起来

把 asyncio 作为平台中枢，web chat、telegram bot、kivy chat 都作为客户端，它们通过平台中枢共享同样的信息

(docker先放一边，如果不是image套image，就太大而不适合开发)

——————————————

网站不用JavaScript也不行啊

明天写，我也不是不会



感觉JavaScript和Python都是在互相抄袭

——————————————

明天的任务

0. 区分http和https决定连ws or wss
1. 没网不自动跳转刷新
2. 整理代码并上传
3. 根据心情决定要不要写此次https的教程+心得

——————————————

根据下面的东西，成功配置好wss

可检查，https://mathchat.ml (用了国外服务器，国内的搞了半天实在是不行)

https://www.google.com/amp/s/abarre.wordpress.com/2017/02/01/apache-2-4-and-websockets-wswss-with-wildfly-9/amp/

——————————————

https://kg2.qq.com/node/play?s=gV8sYzgVExbMFg3D&shareuid=609b9b8620283382&topsource=a0_pn201001006_z11_u26635549_l0_t1512821627__

所谓装逼，大概就像我现在做的事一样

——————————————

可能只是为了向以前的同学装逼吧😂

——————————————

对呀

我的用户不是国内




而是数学家和程序员

——————————————

OK

I'll try

——————————————

这个端口是在 A记录时填 还是 ？

——————————————

但主机商会阻断连接

😳

——————————————

fuck

——————————————

像 http://www.80s.tw 这样的网站真是做得非常谨慎和坚挺

表面上是用迅雷种子，实际上自己拥有一个超大的主机，存放了所有视频源文件

如果你下了它官方的安卓APP，你就会发现这一点，1.2M一秒的直连下载

(
当然，这也说明它的高超之处，可以保证种子的下载速度
唯一的缺憾是这种方式成本太高，需要在网站投放大量的广告
)

——————————————

配置成功（根据https://www.vioan.eu/blog/2016/10/10/deploy-your-flask-python-app-on-ubuntu-with-apache-gunicorn-and-systemd/）



现在主要的问题是 web-sockets 的 ws 链接似乎不能建立在 https 之上，是 web-sockets 快过时了吗？ 
Mixed Content: The page at 'https://mathchat.ml/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://mathchat.ml:5678/'. This request has been blocked; this endpoint must be available over WSS.

——————————————

https://mathchat.ml/

尴尬，不会配置 Apache 2




看起来好像不是允许个端口那么简单

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/high-level-math/derivative-and-differential/function-analyzing-in-theory/second-derivative.html


要是电路图可以通过编程手法实现或利用标记语言渲染就好了

——————————————

Android 5.0.x （SDK21）

Android 5.1.x（SDK22）

Android 6.0.x（SDK23）

Android 7.0（SDK24）

Android 7.1.x（SDK25）



ARM （普通旧的 Android 手机都是这个架构）

X86（使用 Intel 处理器的是这个架构）

ARM64（使用 64 位 ARM 处理器的手机，例如骁龙 810 及以上）

——————————————

还有这里的 all() and any() 配合 filter () 省很多事呢

——————————————

我们竟然可以表示复数 directly

——————————————

用不了标准端口可以HTTPS吗？

——————————————

什么叫标准端口

——————————————

Interesting

——————————————

Requested name 101.236.28.129 is an IP address. The Let's
Encrypt certificate authority will not issue certificates for a bare IP address.


这就是套路，竟然不支持纯 ip，然而国内主机不支持域名绑定




事实即证明国内学生云主机没法用

只能拿来做APP的服务端或者忍着恶心去买个国内域名再做个备案

——————————————

https://www.logcg.com/archives/2921.html 


为什么别人这么厉害，我却连 Apache 或 Nginx 怎么用都不知道

——————————————

docker random 350首 歌 我这边弄好了有1个G，不敢上传


放在最后做吧！





接下来我们的任务是完成HTTPS链接，不能再让中间商欺负投广告了😁

——————————————

Sometimes, .git folder is annoying.

https://stackoverflow.com/questions/28079872/how-to-add-all-files-directories-except-a-hidden-directory-like-git-in-dockerfi

——————————————

Python 的内涵是跨平台 + 简单高效

没用的东西都会淹没在时代的洪流里

——————————————

https://github.com/murlokswarm/app


其实 python 的UI可以这样搞，弄什么 native gabage

直接和 html css javascript 融合

——————————————

而游戏的精髓就是频繁与用户实时交互

如果 pylab 可以绑定热键，我用它就能写出游戏

——————————————

比如定义一个小人

如何让小人跳起来？

像素整体上移




如何让小人自然下落？

像素随时间按重力规律下移



所以真实情况下，类似3D游戏，你还得精通物理

——————————————

当你真正开始做游戏时

你会发现你不是在做静态控件，而是在操控动态的点




此时限制你的只有数学思维能力和编程熟练程度以及想象力

——————————————

如果只是单纯2D

从自由性和可定制程度以及熟练程度讲，kivy绝对好很多

——————————————

原来日本的小黄文坑钱游戏是这么制作出来的

https://www.renpy.org/

——————————————

从你的计划

我可以看出，这款游戏是给手机写的




第一件事是选3D引擎

然后给Linux桌面版对应的按键，做到极客游戏，纯键盘玩枪战

——————————————

从此 Linux 也可以联机爆头

——————————————

我们来写枪战游戏吧

——————————————

你们有谁像Linux创始人那样

不为名利，窝家里接近一年写个系统。




只有小学生可以做到啊

——————————————

你写了什么？

拿来看看

——————————————

你们就是在扼杀小学生的梦想

——————————————

又不能买台式😞

——————————————

打算买一台二手移动工作站

有何推荐？

——————————————

突然觉得 Khan 学院的 Khan 好屌，全部图像都是 web 即时渲染出来的

我用 pylab 感觉没他灵活，它还有可视化的图像互动

——————————————

我打算这样构架


使用导数
    function analyze in theory
        计算机可以draw所有点，但人懒，只想用几个点和一些特性画函数图像
         一阶导数描述单调性和极值
         二阶导数描述凹凸性和拐点
         加上区间描述函数的最值
         左右端点构成的斜率描述函数总体变化形势

    function use in reality
        某法则求0:0或∞:∞极限
        耗费最小化，利益最大化

——————————————

Increasing intervals
递增区间

Decreasing intervals
递减区间


Concavity
凹凸性

inflection
拐点

——————————————

TMD，不想写文字数学笔记了

简直浪费时间，很难表述清楚



而程序就不一样了，它一环扣一环，逻辑上是绝对严密，不然无法运行

只要加以注释，一定是最好的数学笔记，只要看懂就能理解




然而程序代码对于程序员，对于你我来说，绝对是最好理解的，比起符号化的数学公式

——————————————

list to np.array
np.array(a_list)

np.array to list
np_array.tolist()

use np_array as list
for i in np_array:
    print(i)

get np_array index by value
index_list = np.where(np_array == some_value)[0]
print(index_list)

get np_array values  by index_list
print(np_array[index_list])

Just remember, any list you put in numpy function, it will automatically converted to np_array.

——————————————

You don't have to learn numpy anyway

It's naturally like list in Python, you can use it as you did in Python list

Moreover, just need you to search API and use it.

——————————————

未来，由于环境被进一步的破坏，自然资源严重不足

加之人类精英阶层对生育的冷淡

人们必然要大规模使用机械生产

——————————————

原来 `gen` 是 `generate` 的缩写，而不是 gun

——————————————

sum(list(range(1, 20)))/19*10

——————————————

感觉灵魂被掏空，只下单个js或css是无用的

在bootstrap 4.0的情况下，渲染异常



看着web-for-math那令人蛋疼的模样

我还是觉得恢复在线CDN比较好

——————————————

我差不多是脱离群体了

哈哈，有程序和你们就够了

——————————————

MD，思修新闻播报 没人通知我

上课做 PPT，明天讲

——————————————

Programming(程序构建) 从大含义上讲

分为两方面

In reality, it's Electrical Engineering，物理程序构建

In virtual, it's Software Developing，逻辑程序构建

——————————————

说真的

如果不能把基础学科(英语、数学)投入实际应用，比如 do programming or do data science

就没有太多意义和乐趣

——————————————

属性合成😂

——————————————

Nice

——————————————

It's efficient to get relationship between each data

——————————————

https://pymotw.com/2/pdb/

看完了这个




昨天发现 Docker 的 image 还是有问题，我是不是应该把 logging info 放在外面，另外加强 debug 的能力？

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/ac/san-xiang-dian.html

用平板 Adobe Sketch 画电路图也还算好用啦

又多了一个继续用 Lubuntu 的理由

——————————————

You got YouTube, you got most of everything.

——————————————

学到的一点：

当朋友说出了他的困难，不要同情他，而是想出解决方法

——————————————

Let's go and keep web developing, because we know that slowly change in User Interface can't be capable in today's society.

——————————————

消息越是转瞬即逝，人们越是倾向于发布不重要、不经过思考的信息

于是 Telegram 就说：“我们提供永久消息存储”。这样你就倾向于发有效信息。

对于QQ上通篇的废话，我感到很欣慰。

——————————————

From this day forward, we gonna learn how to design structure for bigger program.


其实我想要的，不过是一个音乐播放器，所以为了我们webchat的安卓版的播放按钮有作用，让我们做一个基于flask的随机mp3小API

反正我网易云350首歌都下好了…

——————————————

有了 xposed 框架，网易云变灰的歌也能听了 )

——————————————

又感到一种限度

能做的事太多，almost everything，但时间是有限的，需要仔细考虑自己要做什么




这意味着我大概 computer science 入门了吧

——————————————

successfully installed xposed

——————————————

https://hub.docker.com/r/yingshaoxo/mathchat/

这下可以好久不更新了

——————————————

https://wendyltan.github.io/

这可以说是非常装逼了，我也想来一个…

——————————————

接下来的任务是 localize

把所有需要用到的css、js都搞到本地

以防长城防火墙的攻击导致功能异常

——————————————

那些 greater than 5的已经是高收入的极端了，不能代表普遍，所以我们都把它们算成5

——————————————

数据被预先处理了

——————————————

https://youtu.be/jDuxFEgtSAQ

Magic，电压增大电流反而更小，电压减小电流反而增大

——————————————

https://gist.github.com/yingshaoxo/190e2b9d883e2c59a9d07a1a50b18f4d

Let's forget about that, 正向解决问题简单，反向就难了

——————————————

我还真写了一个class专门画切线

只需要给function和x点，自动画切线




现在唯一的问题是，0点好难找(要我自己算导函数=0时, x=多少)

如果py能帮我算这个equation就好了

——————————————

我算是看清pylab、numpy、scipy那一套了

numpy负责提供数组点
scipy负责计算复杂的数学运算
pylab负责把 数组点 连起来 绘成图

——————————————

十分奇怪，不过是个奇葩老师，也难怪，据说是清华毕业的

——————————————


高三那年，撒贝宁有幸去参加了北京大学举办的只有优等生能参加的冬令营，在汇报演出中以一曲《小白杨》顺利通过了汇演。在离高考还有三个月，他接到了北京大学的录取通知书。[11]

大二搞戏剧社，还拍电视剧，获得了中央台“理想杯”二等奖，大三作为合唱团团长率队远征西班牙，在国际比赛中勇夺第一，大四被保送研究生。


真正能做出成绩的人都是拉关系、走后门、碰运气拿到下放的几个名额的(习近平也是公农兵推荐上的大学)

而纯靠学习成绩走上去的做不出成绩

感觉和西方历史上的科学家发家史完全不同，这就是为什么中国人科技成绩不高，因为科技能力不是拉关系走后门能习得的(文科可以)

——————————————

我好像发现我校的思政老师在我的群里😂

——————————————

https://yingshaoxo.gitbooks.io/artificial-intelligence-for-idiot/content/data-visualization/matplotlib/annotation-in-reality.html

Hard to say...

——————————————

真坑

花了一上午研究怎么用pylab draw a 定长度的 horizontal line


因为要画函数的切线，不然这笔记没法写

——————————————

gitbook本地版做得真傻逼

既然是 本地修改，保存，最后再提交

为什么非要联网才能使用？有网我还需要本地版？😒

——————————————

现在是按需启动

把 set() 放在首页，只要有人访问，发现 websockets server 没在运行，就启动它

——————————————

Never mind

心急也没用，少食多餐吧。

——————————————

别的不管，从英语的角度讲

做那几道题是完全不能提升你的英语能力的

还不如跟读一篇十几二十分钟的英语演讲



或者每天坚持念并搞懂一篇文章

——————————————

just enjoy math fun

——————————————

然后出现了 global maximum or minimum，即最值

还出现了 Critical point 的概念(临界点、要紧点、值得“批评”的重要点)

——————————————

所谓极值不过是 relative maximum or relative minimum

——————————————

其实我以为高考之后功利性学习就到头了

结果发现不但没有，反而愈演愈烈

到了大学不仅是填鸭式教育，还是流水线作业，老师们拿着一根计分棒：“学分不够，你给我滚”😒

——————————————

哈哈，以前 run python codes 的代码没白写，又派上用场了

import os
import sys
import shlex, subprocess

version = sys.version_info 

def run_command(c):
    args_list = shlex.split(c)
    result = subprocess.run(args_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, timeout=15)
    return str(result.stdout)

def run_program(name):
    args_list = shlex.split(name)
    p = subprocess.Popen(args_list)
    
def set():
    current_dir = os.path.abspath(os.path.dirname(__file__))
    server_path = os.path.join(current_dir, 'server.py')
    if 'app/server.py' not in run_command('ps x'):
        run_program('python{major}.{minor} {path} &'.format(major=str(version[0]), minor=str(version[1]), path=server_path))

# set()

——————————————

为什么马云数学总考不及格？

因为他学好了英语

然后发现中文“文档”狗屁不通

——————————————

突然发现不管开多少 terminal 窗口

都只能用  ps x | grep terminal 看到一个进程

——————————————

确实是websocks server.py的问题

通过 ps x 得出结论：那个进程在运行一段时间自己退了…不明原因

但基于websocks server对flask主程序没什么影响，我们可以想办法定时检测并自动重启它(我还没做过watch dog process)

——————————————

import psutil
import shlex, subprocess


# make sure a chrome is running
status = False
for proc in psutil.process_iter(attrs=['name', 'pid']):
    if 'chrom' in proc.info['name']:
        status = True
        # proc.terminate()
        # proc.wait()
        # print('ok')

if status == False:
    args = shlex.split('chromium-browser') 
    p = subprocess.Popen(args)
    # from pprint import pprint
    # pprint(dir(p))


# make sure a terminal is running
times = 0
for proc in psutil.process_iter(attrs=['name', 'pid']):
    if 'terminal' in proc.info['name']:
        times += 1

if times < 2:
    args = shlex.split('lxterminal') 
    p = subprocess.Popen(args)
    



'''
import os
import signal
import psutil

def kill_proc_tree(pid, sig=signal.SIGTERM, include_parent=True,
                   timeout=None, on_terminate=None):
    """Kill a process tree (including grandchildren) with signal
    "sig" and return a (gone, still_alive) tuple.
    "on_terminate", if specified, is a callabck function which is
    called as soon as a child terminates.
    """
    if pid == os.getpid():
        raise RuntimeError("I refuse to kill myself")
    parent = psutil.Process(pid)
    children = parent.children(recursive=True)
    if include_parent:
        children.append(parent)
    for p in children:
        p.send_signal(sig)
    gone, alive = psutil.wait_procs(children, timeout=timeout,
                                    callback=on_terminate)
    return (gone, alive)
'''

只要这个常驻后台，我的第一个脚本就完成了

——————————————

从这一点讲，我们总需要一个控制中枢、一个权力分发者 才能高效地使用我们的手机。

比如绿色守护、Super su

——————————————

如果 Stats is S+, that process isn't running.


用这个可以实时得到当前的后台进程

但os.system()是得不到返回结果的，我们要用多进程

——————————————

See how many process is running now:

ps x

——————————————

怎么感觉我是对的呢😂

——————————————

我爱自动化

主 while True: 框架写好了，现在在纠结是用 os.system() 还是多进程执行脚本



也可以等我写几个自动化脚本后看哪种方式比较实用

——————————————

或者换一个说法

让我们从低阶的AI做起

——————————————

反正我们人类科技进化的过程就是不断地让 机器做人做不到的事 和 让机器做人能做到的事。


有这个基础，我们以后做实体robot也比较轻松。

——————————————

我是越来越觉得自己在做无用功了


How to fix it?




我不想累死在电脑前


考虑到hotkey的控制难度，我们何不做一个terminal程序，

这个程序有一系列脚本(包括py和sh)

我们所需要做的，就是不断的输入关键字搜索，并得到一个以数字为序列的操作list

选择数字，执行自动化任务(包括自动点击界面并完成操作)

——————————————

为什么要建一个聊天平台？

因为想把我以前做过的所有程序连在一起

——————————————

/go@XiaoyaBot

——————————————

但不明原因

程序运行过长时间后，访问主页会不断的刷新跳转？

难道是 websocks server.py 的问题？

——————————————

Simple port forword in linux (when require 80 port, get 5000 port):

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000

iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5000

——————————————

突然发现这玩意儿的真正用途是开翻墙热点😂

——————————————

random sampling
随机抽样

stratified sampling
分层抽样

——————————————

如果一个女生数学不好，就不是真男人性格。

——————————————

程序改版了，第一题我都不会了😂

——————————————

由于平板解锁

数据全失，不能再继续做数学题了，伤不伤心？

不，我们还可以继续做啊！(只不过要多花点时间把前面的题快速做一遍)😁

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/ac/ac-circuit.html


行行行，nothing can hold me back.

——————————————

无所谓啦

用了冰箱和绿化后，从没感觉平板如此清爽

——————————————

成功给华为平板2 su root

——————————————

成功给华为平板2解锁

https://sspai.com/post/23628

——————————————

👍

——————————————

如果自己不是特别厉害，还是跟随大众的脚步吧，那样的需求浩浩荡荡、势不可挡，总有比你更聪明的人研发出“新工具”，我们只需要会用就行。

——————————————

取消成功

下周决定要不要注销学校的那张联通卡

——————————————

我要去取消校园网宽带😒

——————————————

国内主机只支持绑定备案域名👎

——————————————

虽然能对抗小网

以后就能对抗大网升级




但多少还是 feel painful.

——————————————

难道真的只能去退网络？

——————————————

感觉自从我来到这破学校以后

程序没写多少

光去捣腾那垃圾网络去了

——————————————

这学校看起来挺傻逼的

玩儿起 firewall 是一套一套的




不知为何，不管我把ssh放在哪个端口，连接任意一个VPS统统被切断连接，用网页版terminal就没问题

难道ssh的流量可检测？

——————————————

The fact is, others won't change by your cheap words.

The only definitely changeable thing is yourself.

——————————————

If I could take time do some research instead of complaining, things may become different.

https://lolico.moe/vps-domain/cloudcone.html

Well, Vultr is better for its tech and service.

——————————————

But before this, I really didn't think how to connect a server without an IP address.

If the government or evil companys can control your Internet entrance devices, you have no chance to win this game.

How we could do?

——————————————

Victory belongs to those who never give up.

So, let's fight!

——————————————

I mean, fuck

Why I have to living in China.

——————————————

发现原因


校园有线网会寻找大流量SS连接，并且找到ip地址，封该端口




解决方法：

1. 动态端口
2. 有办法伪造目标ip地址吗？用域名？
3. 关掉有线网服务，扔掉联通卡，用日租流量卡
4. 跳楼前多炸几栋联通营业总厅(应该先趁领导开会，炸掉学校领导楼，因为他们贪污引进垃圾网络运营商)

——————————————

怀念以前在家玩的日子

不缺钱、不缺网、翻墙也不费劲

——————————————

对了


你还在家玩吗

——————————————

也不知道他们进来干啥，什么都不讲

——————————————

那你把认识的拉回来

我认识认识

——————————————

一定有内奸

——————————————

才说完我用中转，中转就连ssh都上不去了

然而80端口还有东西

——————————————

…

——————————————

https://doub.io/vpszy-26/

买了一个13元一月的

——————————————

中转 + 端口伪装

——————————————

Fine, thank you

——————————————

有这种事，现在还能买吗？

——————————————

不过我很好奇，你为什么花5刀买个128M的东西

难道是不限流？

——————————————

我们两个用国内中转

——————————————

你看3个人用怎么样，我 + @DIYdoge

——————————————

主要是价格

——————————————

我不看配置

——————————————

可惜自定义程度不高




咱们先谈谈你那两个VPS吧，what's the price per month?

——————————————

就猜到你会这么说

——————————————

好吧，有钱的大佬

——————————————

Get out of wall

——————————————

恩，几个人一起可以把费用降到最低

还可以增进友谊

——————————————

恩

等 @ShinoharaRin  回复




直觉告诉我，咱们群浪费了很多钱在翻墙上，每个月有大量的流量未使用

我们得协调一下

——————————————

我觉得咱们群买一个VPS就够了

虽然我很想一分钱不掏，蹭你们的网用

——————————————

@hex11 
@ShinoharaRin 

哥两个，要一起合租吗？

——————————————

回退到 simple 版本，修复bug但保持了 multi user system


接下来就简单了

本质上是如何保证用户数据不变, while still in coding.

或者更高科技一点，热更新。

——————————————

哈哈，学校有线网 docker 上传 20M 两小时

手机联通流量， 300M 5分钟

还有话费太贵了 垃圾学校绑定解不掉的卡 每个月什么电话都不打要花我 80元

加上我 VPS每月45的钱，我好吃不消。 @DIYdoge 咱们合租吧

——————————————

https://www.353.solutions/py2go/index.html

怎么看都觉得 golang 不是个好东西

特别是 json 那段

也许它觉得像json这种东西很快就会过时吧





But from what I see, 我们只是用别人封装好的 API 写程序，至于用语言自带package还是第三方package，属于个人选择

——————————————

proportional
成比例的
corresponding in size or amount to something else.

——————————————

instantaneously
瞬时地

——————————————

不对，我是指原符号不变，鼠标移过去点一下出解释

——————————————

对接第三点

https://youtu.be/OsI2GgTT_z0

——————————————

看了 Charlie and the Chocolate Factory

1. 里面的特效有些现在国产都做不到

2. 加上歌剧反胃，像印度电影

3. 2005年就预测了机器取代人类的简单手工劳动

5. 主题不明

——————————————

Unit ms

Units of measure. Megasiemens (MS) and millisiemens (mS), multiples of the unit of electric conductance siemens. Metre per second (m/s), a unit of velocity (speed) Mile per second (m/s), aunit of velocity (speed) Millisecond (ms), a unit of time equal to one thousandth of a second.
时间上为千分之一秒。

——————————————

还有这些阻碍人类发展的公式，得变啊！

至少需要有 JavaScript 实时渲染每个部分的含义

或者更具体一点，AI直接解析每个式子的含义到自然语言

——————————————

有时候我想操了全世界的理工科书，没一本是给人看的


只有说出来80%的人能听懂，才是有教育意义的书

——————————————

The standard unit of capacitance is the farad.

——————————————

竟然把交流电理解为 current pulse

——————————————

“In this article we'll work with the integral form of the capacitor equation. ”


我是无奈的，因为积分还没学

——————————————

capacitance
ability to store electric charge

——————————————

从直流到交流，感觉就像飞跃了一个难度等级

——————————————

😭一脸萌逼

——————————————

室友作品

——————————————

同样的令人头疼

程序可以慢慢写

挂科补考就很烦了

所以你知道我接下来要做什么了吧

——————————————

所以在大学里

虽然看起来课程很少

但实际上课程的难度非常大，主要还是靠自学

——————————————

一节电工课

因为听不懂而精神高度集中

然而还是感觉记了一堂垃圾

——————————————

有重大的Bug导致不能用

烧脑

——————————————

sudo docker run -d -p 5000:5000 -p 5678:5678 --name mathchat yingshaoxo/mathchat

新版本，让我们愉快地开始测试吧！

http://101.236.28.129/

——————————————

https://t.co/rfMFsesrms

——————————————

感觉vim技能提升了一个级别

几乎不需要使用 j 和 k了


看我有时间，写一篇升级指南

——————————————

Vim commands


^ or 0 move to the beginning of a line

$ move to the end of a line


w or e move forward by a word

b move backward by a word

3e move forward by 3 words (also in b)

——————————————

Open a new terminal with the same folder in Lubuntu:


lxterminal

——————————————

polynomials

an expression of more than two algebraic terms, especially the sum of several terms that contain different powers of the same variable(s).

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/ac.html


写电工明显比写数学累，因为很多概念不是明确的

——————————————

装什么B

闷声发大财，然后抛开尘世做自己的事才是救赎之道

——————————————

写了这么多年代码

我也是有点心得的：困难难免，今天的困难，明天可能就不是困难了。

Hardship is something you can going through.

——————————————

解决了第二个问题，明天开始自动化bug测试


这可是送给数学家和程序员的礼物

——————————————

解决了第一个问题，websocket.onopen() {} 发token到服务器，如果不符合数据库的记录，就断开连接

——————————————

https://stackoverflow.com/questions/22846719/recursion-how-to-avoid-python-set-changed-set-during-iteration-runtimeerror

——————————————

好了

基于数据库的token系统做好了

现在问题有两个:

1. 每个websocket.send()都要发一个token，浪费资源，能不能改成只在创建连接时验证一下

2. 虽然用户名在Chat UI上有所体现，但他我之别不明显，我应该让自己的消息在右边，别人的消息在左边

——————————————

Sometimes you don't know what kind of args your function will get, so *args and **kwargs become useful then.

https://www.digitalocean.com/community/tutorials/how-to-use-args-and-kwargs-in-python-3

——————————————

https://youtu.be/F0-RiOqgG68

It's quite interesting.

——————————————

http://www.jianshu.com/p/04e14a1e957b


是不是疯了，一个错误还有两种说法，还没人明白怎么回事


我就不信非要什么鬼的华为证书，那为什么其他国外软件随便可以安装




这里应该是要v2签名

(精神力强撑打字，眼睛要闭起来了..)

——————————————

😴

Good night

——————————————

和垃圾电脑一起修仙的日子


简直是在浪费我的生命

——————————————

测试了调用webview

得出结论，安卓就是要用新系统SDK，不然各种不兼容

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/high-level-math/derivative-and-differential.html


Finally, I've put all concepts to together.

——————————————

我在想用户认证的问题

websocks通信的客户端在web，不是flask, 不能用session

那我如何确认那是用户而不是第三方伪造呢？

不想让用户频繁登录

——————————————

We do things is just for doing less later.

——————————————

https://youtu.be/o8NPllzkFhE


We are the same.

——————————————

“用事实说话”



只有自己亲身用英语录视频才知道自己表达多贫乏

这不是高考英语120就能做到的

——————————————

与 kivy android 共存，只能jar签名

——————————————

https://askubuntu.com/questions/474607/lubuntu-disable-removable-media-is-inserted-window


再也没有讨厌的弹窗了

——————————————

https://coding180.com/kotlin-android/playback-file-located-on-the-internet/

kotlin大法好，还有try...catch

也是融合了Go(C), JavaScript, Python的东西

——————————————

然后

所谓 free，不是指 免费

而是指 alternative，可选择的




谷歌所推崇的自由是：你不能找到能替换我的东西，但我可以提供无数的网站供你选择，这样你就拥有了自由。

——————————————

Google 必须大力支持 kotlin

因为如果 Websites and Android disappeared in the future, 谷歌将不再有人数上的霸主地位，而这直接影响到它的经济来源

没钱做不了大事

——————————————

对于编译一次需要十几分钟的垃圾电脑来说，还是可以了

——————————————

本来快做完了，需要改下界面

卡成狗

——————————————

我们卡一点，消费者快一点

我们做多一点，消费者做少一点

…


动态平衡啊

——————————————

修改代码后二次编译用了3分20秒，还行

就是同时开一个浏览器，十分勉强(cpu满了)，还不如用平板查资料

我想用kotlin写一个小安卓程序练练手

——————————————

This guy is just amazing!

——————————————

https://www.youtube.com/watch?v=FrRmihdF52o&list=PLGecHlqUT7dzCM9o2NYtkj4zG3aBwq81d


So the 220V is just a half of positive sine wave in our country voltage supply, the true max-voltage is bigger than that, it is 220/root 2 V

——————————————

交流电

——————————————

今天的视频录好了(意味着今天的web开发也结束了)

所以今天有大把的时间攻克电工sin wave 相关知识，不弄懂不睡觉

——————————————

虽然编译初始模板花了>5分钟

但我还是很开心，因为 Android Studio 直接驱动我安卓平板安装了编译出的APK

并且还发现我可以直接使用 adb reboot，这是否意味着我的电脑是支持usb3的？




卡点没关系，它编译时我可以用vim写back end web project

——————————————

没被卡死

感觉还行


https://dl.google.com/dl/android/studio/ide-zips/3.1.0.1/android-studio-ide-171.4429293-linux.zip

——————————————

坚定 Python 文化自信😂

——————————————

就像发现新大陆

——————————————

Check out "Pydroid 3 - Educational IDE for Python 3"
https://play.google.com/store/apps/details?id=ru.iiec.pydroid3

——————————————

https://blog.mindorks.com/a-complete-guide-to-learn-kotlin-for-android-development-b1e5d23cc2d8

等我回宿舍下一个 Android Studio 试试会不会卡死

https://developer.android.com/studio/install.html

——————————————

Look what I have found

——————————————

主要是安卓开发要安装卡得要死的IDE、同时必须用鼠标


我更倾向于用键盘和命令行完成一切

——————————————

经过我深入的研究

发现这是一个鸡肋的特性或功能




不用也罢

——————————————

Anything except Java

——————————————

https://docs.python.org/3/library/gettext.html

被这玩意儿气得几乎吐血

什么po啊，mo啊。怎么生成都不知道，反正搞了一个小时，没调用_成功。

——————————————

看同龄大佬的出国秀。。。

祢补在国内缺失的眼界


https://hardrain980.com/1573.html

——————————————

基于这一点

那些(在外省)能考清华北大的

从能力上，早就达到了大学的水准(所掌握的东西是大学的超集)

——————————————

# https://docs.sqlalchemy.org/en/latest/orm/tutorial.html
# https://bytefish.de/blog/first_steps_with_sqlalchemy/
from pprint import pprint


import os
if os.path.exists('userdata.sqlite'):
    os.remove('userdata.sqlite') # not necessarily, just for testing

from sqlalchemy import create_engine
engine = create_engine('sqlite:///userdata.sqlite') # sql name can not contain any _ stuff, or exception be raised


from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()


from sqlalchemy import Column, Integer, String
class User(Base):
    __tablename__ = 'users'
    
    id = Column(String, primary_key=True)
    password = Column(String)

    def __repr__(self):
        return "<User(id='%s', password='%s')>" %(self.id, self.password)


Base.metadata.create_all(engine) # when you build a new sql class like User, you have to init it using this command


from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=engine) # we do everything by session
session = Session()

a_user = User(id="yingshaoxo", password="hi") # define a new user
session.add(a_user) # add that user to session
session.commit() # every time you made change, you have to commit to make it avaliabel on sql file.

some_one = session.query(User).filter_by(id='yingshaoxo').one() 
pprint(some_one) # how to find our user by id
print(some_one.id, some_one.password) # get user's info
exit()


pprint(dir(session)) # look how many commands you can use from session
pprint(dir(session.query(User))) # look how many commands you can use from query

——————————————

Using clipboard on lubuntu


copy file content to clipboard:
xclip -i -selection c < file.txt

paste clipboard content to file:
xclip -o -selection c > file.txt

——————————————

@DIYdoge 

今天学了几个中值定理(导数的应用)

发现对于高中阶段的不等式证明有奇效，要是我高考场上会这招，肯定上本科了

——————————————

快要弄懂sqlalchemy的原理了

现在只有一个问题：如何让web像安卓一样，快速切换语言

我不想等我开发完之后发现每个部分都需要改

——————————————

It's hard to say which language is better?

https://yingshaoxo.gitbooks.io/go-tutorial-for-pythoner/content/the-structure-of-go/map.html

——————————————

把注册登录页面搞好了

现在差sql存用户数据

——————————————

暂时不管它

等我的 web chat 平台开发完毕，咱们掀起革命




谁叫他们不开放呢，淘汰吧，腾讯君！

——————————————

可惜老师和同学都不会翻墙啊

——————————————

Suddenly, I realize it's impossible for me to do a wechat little program, there are so many restrictions over there.

And it's a closed ecosystem.







Compare to that, I would prefer to built everything on my own(a website or platform).

So, I give up.

——————————————

用腾讯的东西唯一的好处是不用花心思抵御流量攻击

不过如果已经精通防御之道，自己做总比寄人篱下好和灵活

——————————————

可能会转向腾讯提供的 javascript 包做界面，python做后端

——————————————

答应帮老师做微信小程序

目前手里只有两个资源：
https://github.com/wepyjs/wepy
http://www.smallerpig.com/1184.html


很明显，python的资源不多，腾讯坑
测试了唯一一个python包也是会报错的那种

——————————————

asymptote
渐近线

——————————————

唯一令我高兴的是：上下午课没满的时候，可以带笔记本去图书馆；每天晚自习8:40等那些年轻人都走了，我有50分钟的时间在无人的教室里写代码或者录视频或者并行操作。

——————————————

发呆一个晚自习

由此证明，我已经无法理解中文的理工科内容

——————————————

《Patterns of culture》

In fact, this kind of article is driving me to crazy.
So I just give it up temporarily.

——————————————

These packages you should work on with.

——————————————

permutation
排列；序列

——————————————

Jupyter运行会出错，在中间

但是手打运行是完全没问题的



我们还是踏实一点来学习重要的东西

——————————————

当然啦

你也学不懂

——————————————

我跟你讲

以后一定要选计算机系专业




不然分到一个其他领域，太深入你也不想学

——————————————

怀疑人生

——————————————

虽然我不知道怎样描述那种特征

——————————————

没准 derivative 只是抽象了 function 的某个特征，是某种数学模型

——————————————

There are no one career is easy.

——————————————

Set download source for pip in lubuntu


sudo vim /etc/pip.conf

[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com

——————————————

I just wanna say, if you no longer feel happy when coding, why you should stick on to it?

Be happy, do what you want, and waiting for one day which is your day.

——————————————

Let's fuck this world!


And do what we wanna do!

——————————————

我曾经以为 @system357 可以带我出苦海


后来发现，自己的路还是要自己走

Everyday working hard than

——————————————

我真是痛恨一切传统教育制度

——————————————

被车撞了？

——————————————

I just started reading after TED recently.

Because I almost finished New Concept English 4.

——————————————

Why

——————————————

人都有名字

哥你想让我叫你什么呢？


还是你向来独来独往

——————————————

求dy

太烦了，这种东西根本不能转化为实际的经济利益


不会做，好烦

——————————————

我们有时候不要嘲笑一门语言

你这样想，同样学了英语、数学、历史，有些人改变了世界，有些人碌碌无为

不同的人所利用这门语言的程度和达到的事不一样

——————————————

😂

——————————————

还有这骚操作 https://program-think.blogspot.com/2017/08/GFW-Resilio-Sync.html

——————————————

好像说错了，有待纠正

——————————————

垃圾教材，让人看不懂也敢印出来

其实微分(differential)就是研究非线性函数(曲线)的导数

——————————————

was

indicate it happened in the past

——————————————

事实上我不会拿 Golang 写任何有价值的东西

只是装逼罢了，至少可以说自己掌握了一门编译语言(额...易语言不是吗？)

——————————————

我看到 Sentdex Go tutorial 的第12集

发现最有效的第二编程语言的学习方法是: 想实现什么功能就把第一语言的函数关键词配上第二语言的名字在谷歌上搜索

Python是万能的 [笑]

——————————————

经过我几周的测试

发现有两个东西我一直在重复打开和关闭，浪费时间，还不如一直打开：Chrome and Terminal

——————————————

【笔记本电脑支架 可折叠托架宿舍床上用多功能懒人电脑架增高架子】 http://v.cvz5.com/h.EEQkDi
60°
255°
75°


加上 【海贝丽懒人沙发榻榻米可折叠单人小沙发床上电脑靠背椅子地板沙发】 http://v.cvz5.com/h.EEkjIJ
120°


完美 coding 环境

——————————————

我知道了，主要是我太黑，然后声音太小需要放大

——————————————

ffmepeg只能转码和加速，这里不需要，我讲得太渣，加速了别人听不懂

opencv只能录视频，没声音，不好用


最后只能用vokoscreen，还有快捷键呢！非常好用

——————————————

Look at me, so awesome!

https://www.bilibili.com/video/av16213113/

——————————————

vokoscreen is wonderful for linux screen recording

——————————————

Let's sleep.


My head are fucking numb now.

——————————————

I don't think they got anything amazing.

By the way, I'm using a bad performance laptop.

——————————————

中文TG群组bot越来越低智了，已退

——————————————

通俗来讲就是：会憋出病来的

——————————————

可能这也是 sentdex 最初的想法

我看那些文章只有几个访问量，没意思



再多写几个我都不会和人正常交流了，做视频会好一点

——————————————

这个可以和web_math_chat的开发融合在一起，比如标题叫做 “如何打造一个类似于腾讯的聊天平台”

——————————————

一时间我又生出许多想法

比如为了不浪费我的口才(和抵抗一个人的孤寂)，去做技术解说，发视频教程在YouTube

——————————————

https://yingshaoxo.blogspot.com/2017/11/how-to-set-syncthing-on-server-correctly.html

https://www.getnas.com/2017/07/2500.html


累死宝宝了，btsync就没这么麻烦，可惜被墙了


感觉我在浪费生命

——————————————

How to compress or uncompress a directory using tar:


tar cJvf archive_name.tar.xz directory_name

tar xJvf archive_name.tar.xz

tar xf archive_name.tar.xz


c means create.
x means extract.
f means file name.
J means high compression rate with xz.
v means progress view.


Make sure f in the end near file_name.

——————————————

乌合之众：
一个周期性的事件，大家都要做，你早点去做。
一个突发新事件，大家都要去做，你晚点去做。
一个突发新事件，大家都不做，你早点去做。
这实际上是在考验群体的智慧，我认为群体不可能在事件一开始就正确判定是否真对他们有利。

——————————————

If programming languages were guns,

——————————————

在脑中逻辑推导100次，很屌吗？

错




你无法在实际生活中以你的Movement为变量，去操控实际，那就是无能

这种操控，底层是物理计算，高层是利益、人性以及思维计算

——————————————

然后就看不懂了

——————————————

我竟然通过下面的注解和目前的高数水平把这个式子看懂了

这是方差

h(x)是预测函数

x是一个matrix, 装了很多 features，特征data，或者说 input data

y是你的原有数据的值(这个应该区别于被预测出来的值，它是真实值，they have also been called labels)，这是supervised learning

——————————————

我在想炒房的事

只要预测出这个地区的人均工资会涨，就可以去买房，稳赚。。。



我估计中国人也只能拿AI做这个了

——————————————

AI本质上还是做一系列计算

只不过以前这个计算太复杂，只能人做

——————————————

路由器白名单如果不开放udp，google的一切就无法正常联网

——————————————

需要Math啊

但Math太抽象，不用到实际就不懂它的本质

——————————————

我们讲，学习是需要基础的


My learning path：

English → Programming → Math → Electrical Engineering

你必须要保证左边的掌握度比右边高，不然学不下去

——————————————

想去谷歌中国大会2017看看大佬们

但怕迷路和资金不足

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/high-level-math/derivative.html

https://yingshaoxo.gitbooks.io/artificial-intelligence-for-idiot/content/data-visualization/matplotlib/any-line-and-label.html




真希望我能一直(把 notes or tutorial)写下去，这样的话我想学的东西就都能学会了

——————————————

从求实的角度讲

我要想真正找到一门开发的工作

我必须像精通Py一样, 精通 Web developing




就这样，方向已定，其他次要的浅尝即止

——————————————

对于这个网站 https://www.pornhub.com/


它的盈利点不在于使用app，同时，像 https://my.vultr.com，你会为了买个vps去单独下一个APP吗？


我始终觉得中国人的思维有问题

——————————————

这样看来，python仍旧够用

服务端程序 或 自用软件 或 开源软件 或 快速原型开发




Golang可能用来做商业开发 或 大型并发规模化的服务程序(节约成本)





至于面对Windows的(C++)桌面环境怎么办，你不是有易语言和 Python's pylnstaller 吗？

看起来易语言在win10运行良好

——————————————

我们不需要从众多语言中去选择

我们只需要一个或两个靠谱的语言做开发

解释型一个，编译型一个

——————————————

我看了看 kotlin

我觉得 Google 在做不道德的事




因为混乱

——————————————

1 foot = 12 inches

——————————————

比赛后，二等奖，队长请吃火锅

我一个室友竟然攻击我的理想(programming)，然后我落下了时隔几年的泪

真是艹了🐶

——————————————

就差数学笔记没补

https://yingshaoxo.gitbooks.io/go-tutorial-for-pythoner/content/the-structure-of-go/methods.html

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/superposition.html

——————————————

Run Python3 and Golang in Vim:


vim ~/.vimrc

au FileType python map <F5> :w<CR>:!python3 %<CR>
au FileType go map <F5> :w<CR>:!go run %<CR>
"<CR> means a Enter key.
"For :w<CR>, I don't know its meaning.

au BufNewFile,BufRead *
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set expandtab |
"\ set autoindent |
\ set fileformat=unix
" autoindent may cause bad behavior when you paste in vim

——————————————

Automate 挺好用的

Android Automation

——————————————

最后一句fuck

让咱们远离这种有害身心健康的活动

——————————————

现场第二首，没来得及落款

第一首，机器在一个点处宕机，不算墨点


幸好我有笔画数组print，所以接着笔画写

其实如果拼一拼，第一首宕机后不写完，第二首就能完美完成


可惜那些领导不懂得“拼搏”

——————————————

如果我以后有了权力

绝对让中国变成科技强国(尊重开发人员)

而不是人情强国，因为战争是不讲人情的

——————————————

他们总看不起那些落后但坚持到达终点的人

他们忽略了一个关键点，放弃的人比坚持到达终点的人高一个量级

前几名和坚持到达终点的人之间又差一个量级



最后那些嘲笑别人的人，就是那最大量级中的普通一员

——————————————

then p must be (divisible, with no remainder, by all the following integers—with the possible exception of which one?)


加上一个括号好理解多了
后面的句子都是在限定 divisible (可被除)

——————————————

尴尬，不会做

——————————————

superposition
叠加，重合

——————————————

suppress
抑制

——————————————

Kirchhoff's Laws work because of linearity, as do the Node Voltage Method and the Loop Current Method.


In general, functions with non-linear behavior don't have these properties. We humans have not come up with a general-purpose method to exactly solve non-linear equations/circuits. Each new type of circuit requires mathematical techniques specific to the new circuit. The usual approach to non-linear circuits is to bend over backwards to make it seem linear over at least some small range of operation. That's what is happening when you see terms like "piecewise-linear approximation" or "small-signal model." 

——————————————

第一次知道 linear function 还有这么个 property.

——————————————

ratio，比率...

——————————————

So a match can't really make you stronger

All you have to do is working alone, because they're so stupid.

——————————————

Get Python's function parameter information


from inspect import signature

def func(*a, **b):
    print(a)
    print(b)

print(signature(func))

——————————————

梦是这样的：

因为是机械手脚，所以可以坚持不懈风里雨里跟踪女主角，然后在某个雨夜的某个隐秘的山洞，男主角忍不住上了女主角。

——————————————

平日里半夜20分钟写完程序就睡觉

时间宝贵😁

——————————————

草

半夜里射了一裤裆




明明昨天手动释放了一些东西

——————————————

在 Lubuntu 的文件管理界面，按F4进入处于当前目录的 terminal

——————————————

http://music.163.com/song/515453363/?userid=280429778

——————————————

机器人书法核心程序差不多写完了(就是从.plt文件批量split出点坐标，然后按笔画传给robot arm，robot自己会平滑曲线)

——————————————

https://zhgcao.github.io/2016/06/09/nginx-reverse-proxy-google/

https://github.com/moonbingbing/openresty-best-practices/blob/master/ngx/reverse_proxy.md 



原来以前用过的web代理是这个原理

——————————————

Good night

——————————————

上次说的文字





实际上视频比文字精彩许多

看到第6节


收获是如果你定义了变量或导入了模块没用，运行会报错

——————————————

然后突然发现可以把 virtualbox 的host键 从right control 变为left control

从此就不用在虚拟机里使用反人类的指法了(复制粘贴全选一般都用right control)

——————————————

土豪学校真有钱

2万买这么个东西(草，仔细一看买了6台，然后还有几台3D打印)

https://cn.dobot.cc/dobot-magician/product-overview.html

——————————————

我也就当练练手

——————————————

接了学校科协的全省机器人书法比赛

还有一个星期，让我用Python解决这个烂摊子

——————————————

对呀，非常奇怪，在gitbook在线编辑器上能过

一旦publish，就说我update失败，报上面那些错误



经过我测试，就是那串数学latex的问题

——————————————

好的

发现 syncthing 挺好用的

但注意不要给他root permission，同时同步的文件也不要有root permission，不然会出错

——————————————

When I'm ready for sleeping, got a error report from gitbook... just annoying

https://github.com/GitbookIO/gitbook/issues/1896

——————————————

其实最多时候还是想让自己局域网电脑与平板之间传递信息

所以我加了收到信息自动 copy to clipboard 的功能 (https://github.com/yingshaoxo/kivy-chat)



然后btsync在局域网表现实在太差，等我睡一觉起来看有没有现有的东西可以用，没有就自己造一个，因为多端文件自动同步太重要了，对于开发可以节省很多时间

——————————————

如果我在国铁，检修时间是2点到4点，和程序员晚上发更新差不多

那我可以1点钟起来，工作到4点，然后回家写代码到7点

——————————————

The night is just about to start.

——————————————

Finally I found that gitbook support picture uploading.👍

Nice service.

——————————————

Now, I am thinking about where can I put my pictures in. 

After that, I will use it on gitbook, meanwhile keep those pictures maintainable.




Any suggestions?

——————————————

Now I feel unhappy.


It's turned out that I should speak English as often as I can.

——————————————

@ShinoharaRin 

这样看来你还是挺厉害的

——————————————

Vim Command


daw : delete a word
caw : delete a word and put you in insert mode

——————————————

今天参加了一场校英语演讲赛

结果我什么都没讲




果然我能力还不够，要是涉及到 computer science, 我肯定可以讲上好几个小时...

——————————————

从语言、生物的认知为差异信息这条原理出发，我们要深入理解某种规律或事物，在不实际接触的情况下，必须用不同的语言学一遍，所使用的不同语言越多，理解越细致。

——————————————

Suspend in Ubuntu 16:


systemctl suspend

——————————————

http://music.163.com/video/751C85D364917CC115FFF330E821B53A/?userid=280429778


止不住地看腿

可惜我已经累到没时间打飞机

——————————————

2017/10/26 21:50:03 [Info]Proxy|Socks: TCP Connect request to tcp:www.google.com:443
2017/10/26 21:50:03 [Info]App|Dispatcher|Default: default route for tcp:www.google.com:443
2017/10/26 21:50:03 [Info]App|Proxyman|Mux: dispatching request to tcp:www.google.com:443
2017/10/26 21:50:03 [Info]Transport|Internet|TCP: dailing TCP to tcp:45.77.157.170:443
2017/10/26 21:50:04 [Info]Proxy|VMess|Outbound: tunneling request to tcp:v1.mux.cool:9527 via tcp:45.77.157.170:443
2017/10/26 21:50:05 [Info]Proxy|VMess|Encoding: failed to read response header > EOF
2017/10/26 21:50:07 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > context canceled

——————————————

https://github.com/v2ray/V2Ray.sh

还是不能用，放弃吧

——————————————

Golang安卓开发和C++差不多，都是做成一个包

然后Java调用

没意思




Golang就是改良版的C系列，改良方法就是糅合 Python and JavaScript.

——————————————

http://matplotlib.org/1.4.0/users/mathtext.html

Wow, just see how many math symbols we can use from latex.

——————————————

大学虽然累，但有个好处

不会遇到SB的老师(我指被专制主义完全洗脑的一心想充当权威而不是服务学生的顽固分子)

——————————————

simultaneous
同时

simultaneous equations
联立式

——————————————

Procedure: Add element voltages around a loop


Step 1: Pick a starting node.


Step 2: Pick a direction to travel around the loop (clockwise or counterclockwise).


Step 3: Walk around the loop. 

Include element voltages in a growing sum according to these rules:


When you encounter a new element, look at the voltage sign as you enter the element.

If the sign is +plus, then there will be a voltage drop going through the element. Subtract the element voltage.

If the sign is -minus, then there will be a voltage rise going through the element. Add the element voltage.


Step 4: Continue around the loop until you reach the starting point, including element voltages all the way around.



State Kirchhoff's Voltage Law in another way: The sum of voltage rises equals the sum of voltage drops around a loop.

——————————————

人们说人生要有一种不放弃的精神

就让我以写笔记的方式开始正式学习tensorflow吧

——————————————

http://group.yd.chaoxing.com/share/note/3D1A38AD-3C7D-4835-9059-2C13A5E002D2/note_detail


不想学新语言了

不知道计算机科学还有什么我不知道需要学的




还是AI方面，python积累到这种程度，不利用它做一个自身的突破，感觉人生都灰暗了

——————————————

那还好

我只能算通讯技术



虽然也有配置网络发射机那些

反正围绕光纤展开

——————————————

你是什么专业来着？

——————————————

比较好奇，你平时在公司做什么？

——————————————

Sometime I think, why I have to learn Golang anyway, if you could just write program for web, android, windows in Python.

——————————————

I wish I could.

——————————————

其中地铁有地方保护机制，不是本地人去不了

然后移动、联通、电信的正式员工需要本科学历，我还可能需要在大二提升下学历

——————————————

我学校二级院校(铁道通信)主任做了上两届毕业生统计：

基本上每届招150人
能拿到毕业证的只有100个(考试不过或学分拿不到的无法毕业)
这100个里有40个进国铁、10个进地铁，剩下的其他企业

——————————————

哈哈，装逼已经到一定境界了


人们大多认识我，并经常叫出我的名字，而我却不认识她们(注意，是完全不认识)

这大概就是喜欢1对多发言会得到的感觉吧

——————————————

那上海那么多程序员怎么活？

——————————————

听说白名单的墙试点开始了

我这边有线校园网，只有80、443端等常用端口可以建隧道，其他都被封了

——————————————

An important engineering skill is learning how to break down complicated problems into simpler pieces. Decomposing problems may seem slow at first, and you may feel impatient. However, breaking up problems into smaller steps is the heart of the engineering art.

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/kcl-and-kvl.html

——————————————

我星期1到4根本没有时间写代码

课程和选修都够我受的了，高数和电路让人蒙逼



周末还要解决令人蛋疼的校园网封SSR的问题(俗称解决网络问题，不然怎么愉快地写代码)





所以开启极限学习模式，早中晚都听网课

——————————————

原来两个点间电压相同，代表其中没电流流动，可以直接合并

另外电流和电压都是基于电荷，只不是描述的东西不一样

——————————————

哥

我已经放弃了

——————————————

决定暂停做算法题，没意思了，纸上谈兵(纸上得来终觉浅)
应该搞几个实际项目

数学题要继续做

——————————————

自从把HTTP关了后，网易云瘫了(暗指不靠谱的网易云)




另外我发现百度搜索，所有搜索结果都要经过一个HTTP转换到真实地址，这不是脱了裤子放屁(首页用HTTPS, 然而点击搜索结果用HTTP，故意被第三方监控吗？)


必应会直接HTTPS一路到底

——————————————

https://leetcode.com/problems/word-break/description/

这道题根本不是考算法

而是考计算机如何像人一样思考、解决人才能解决的问题


既然这样，还做什么编程？直接建神经网络算了！

——————————————

修仙，妈的，3点睡，6点起

还有好几节电路课欠着

看来下次不能把学习任务留到周日解决

——————————————

从此告别HTTP


先把路由管理转成https，再禁掉所有http，留一个给校园网登录

——————————————

不发教程了，没意思，这是英文使用者的游戏

https://pythonprogramming.net/go/introduction-go-language-programming-tutorial/
(3分钟看完，golang没难度)

——————————————

我在室友的win10系统测试，发现在win10系统自带代理情况下，所有端口 privoxy 都做了处理…

按理来说我应该把它设置成只处理80端口，其他都drop掉

——————————————

v2ray的分流做得很好

可惜安卓客户端太渣

——————————————

python markdown2 渲染就一句话

最大的用处可能不在post文章，而是chat app

——————————————

如果 ssr 可以做混淆，那ssr肯定可以直接修改users agent

——————————————

大学生就是这样形成的

没有精益求精的追求，唯一的追求就是不挂科，60分万岁

——————————————

官网是资源最多的地方

我肯定看了10遍，看不懂😂

——————————————

求教如何连Http-proxy

——————————————

多开关几次就知道了

——————————————

你玩过http注射器吗

我记得可以

但我从来不会用

——————————————

如果这个可以强制开个vpn把所有流量往http-proxy里灌就好了

——————————————

SS不能直接用来隧道加密，学校和国家都会封






http转ss😂

行吗？

——————————————

还不如SS客户端稳定

——————————————

安卓设备也是傻

http-proxy老是跳，不能强制，那要它何用?

——————————————

有，学校一检测到除网页登录的设备外的新设备，就断网

——————————————

就是系统自带那个经常失灵，一失灵暴露user-agent就断网

不如电脑chrome插件

——————————————

那安卓上有支持6.0以上的http-proxy client吗？

——————————————

http-proxy自己会处理吧？😢一脸萌逼

——————————————

同志们好，同志们辛苦了

——————————————

还要保证那个特定ip的80端口不受限

——————————————

现在只关注如何把局域网(192.168.*.*)其它80端口流量转到局域网某特定ip的8118端口

——————————————

改user-agent这个在HTTP proxy已实现

——————————————

快去快回

反正我看了好多介绍，还是不懂😂

——————————————

亲

iptables是linux自带的，比较垃圾的路由只能用它

——————————————

大神

这样吧，假设我路由的局域网地址是192.168.1.1，公网未知

我的http_proxy在192.168.1.238:8118

我需要用路由器上的iptables把所有局域网下非192.168.1.238:80的80端口流量转发到192.168.1.238:8118


How to do that?

——————————————

NAT, or network address translation, is a general term for mangling packets in order to redirect them to an alternative address. Usually, this is used to allow traffic to transcend network boundaries. A host that implements NAT typically has access to two or more networks and is configured to route traffic between them.

Port forwarding is the process of forwarding requests for a specific port to another host, network, or port. As this process modifies the destination of the packet in-flight, it is considered a type of NAT operation.

感觉网管比编程难一点

😁我真是垃圾

——————————————

经常性的安卓手机不走http代理

妈蛋，必须从路由器用iptables把所有80端口流量转到局域网我的笔记本http-proxy上才行

——————————————

https://yingshaoxo.gitbooks.io/go-tutorial-for-pythoner/content/the-structure-of-go/do-magic-control.html

字符串不能直接乘，Golang好垃圾

——————————————

更新了


现在网络的问题解决了，让我们愉快地投入学习中吧！

虽然无意义的作业多得一逼。

——————————————

Fully uninstall one package in Ubuntu:



sudo apt autoremove package_name
sudo dpkg --purge package_name

——————————————

#### Install Privoxy
sudo apt install privoxy

#### Change config
sudo vim /etc/privoxy/config

1. Search listen-address and replace it with: listen-address 0.0.0.0:8118
2. Search enable-remote-toggle , enable-edit-actions and make sure they're enabled.
3. At the end of the file, add the following rules:
# passby all https connection:
forward :443 .

# passby the login page:
forward 192.168.138.180 .

#### Change config through webpage
1. Open http://p.p in your browser
2. Choose View & change the current configuration
3. Find match-all.action and click Edit
4. Enable hide-referrer and hide-from-header
5. Find User Agent string to send, write down 
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36
6. Click Submit at the  the page
7. Remove or Delete all other rules you can see on those webpages.
8. In the end, it looks like this:
+hide-from-header{block} 
+hide-if-modified-since{-1} 
+hide-referrer{block} 
+hide-user-agent{Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36}

#### Use it with SwitchyOmega or Android Native WiFi connector

——————————————

搞定，5台设备满速稳定十分钟不掉

等会儿再来总结

——————————————

不能直接在局域网建一个http proxy，然后这个proxy修改了80端口的UA数据再发包出去吗？

看起来挺高大上：https://github.com/sparanoid/proxy-cookbook/blob/master/HTTP/How%20to%20Bypass%20User-Agnet%20Check%20from%20APN%20Provider.md

——————————————

http://music.163.com/song/2175282/?userid=280429778

——————————————

https://leetcode.com/problems/word-break/description/

——————————————

https://yingshaoxo.gitbooks.io/go-tutorial-for-pythoner/content/the-structure-of-go.html

——————————————

calculus
微积分(这个中文名称毫无意义，明明calculate是计算的意思)


实际上包含极限、求导那些东西

——————————————

Python不能做到的，Golang也不能做到

比如完成对当前所在目录的 cd path操作 ，程序结束后你还是在原目录

——————————————

https://leetcode.com/problems/reshape-the-matrix/description/

——————————————

看来我已经是智障了

——————————————

https://yingshaoxo.gitbooks.io/university-notes/content/high-level-math/function-limitation-and-continuity-of-function/what-is-function.html

原来要在文件管理里自己加一个 book.json (MathJax插件

https://www.npmjs.com/package/gitbook-plugin-mathjax#how-to-use-it

——————————————

最近我参透了一个大规律：

当前最流行的翻墙工具所基于的编程语言是目前流行或呈上升趋势的编程语言。

——————————————

小姐姐是女装大佬吗？

——————————————

我绝对有理由相信，只有通过对一种语言的表达，你才能学会那门语言。

数学也是一门语言，所以你需要通过“表达”(表示)来记住那些东西。

——————————————

I don't need a blog for math showing, I need a notebook for doing note.

https://yingshaoxo.gitbooks.io/university-notes/content/

——————————————

How to open a folder or file from terminal:

xdg-open .
xdg-open filename.txt

——————————————

In fact, you can run a go program from code directly:

go run hello.go

——————————————

What the process run a go program!

https://medium.com/@patdhlk/how-to-install-go-1-8-on-ubuntu-16-04-710967aa53c9

——————————————

https://leetcode.com/problems/valid-phone-numbers/description/

grep -P '^(\(\d{3}\) |\d{3}-)\d{3}-\d{4}$' file.txt

——————————————

I'm gonna learn Go.


https://twitter.com/Sentdex/status/920035426085191680?s=09

——————————————

我不想、我不想，不想起床

我宁愿 永远都 这样懒洋洋

我不想、我不想，不想起床
 
强行起床 会让人 精神失常

……

深爱我的床、我深爱的床

怎么能，变得空荡荡？

——————————————

https://leetcode.com/problems/tenth-line/description/



sed -n '10p' < file.txt

——————————————

谢谢你的笑脸


明天开始写自己的基于MathJax的本地自检测.md文件改动的支持导出html的博客渲染程序

本地实时查看，远端挂在Github


因为我有太多 math formula 想写


同时做笔记必须有公式，最重要的是渲染成网页再转图片装逼

——————————————

未来的路，我没想好，做网络架构，还是搞linux运维，还是搞前端开发呢？ 以后再决定了，也许fullstack可以成为一个我的目标~，引用《纪实72小时》里的一句话“规划好的人生，太没意思了。”

https://sakarahiroya.github.io/blog/#/post/你好大学/

——————————————

一周过去了

——————————————

https://leetcode.com/problems/heaters/description/

想了两天，今天晚自习看答案

——————————————

防火墙怎么关？

是Linux系统内的还是服务器提供商？

——————————————

服务器的access.log里面一片空白

——————————————

active😳

——————————————

service v2ray status shows it's in active.

——————————————

不确定，又没检测方法

——————————————

After I asked one question to my closest friend, I understand some core ideas for electrical circuit analyzing. 

1. Basic
串联：一条直线上多个元件
并联：两条平行线之间的两条垂线分别有元件

并联，电流相加，电压不变，电阻=(R1*R2)/(R1+R2)
串联，电流不变，电压值从+到-绕闭合线路到0，电阻=R1+R2

2. General Method
电流源模型变电压源模型，并联变串联，U=I*R
电阻留着不变
电压源模型变电流源模型，串联变并联，I=U/R
变化时电压+方向爲电流箭头方向

3. Special Situation
二端元件串联，电流不变 --> 与理想电流源串联，电流不变 --> 并联电路，电压不变 --> 既然在那条线上电压、电流都不变，还要那个电阻有何用？直接删掉。

——————————————

Updated, about how to use simple pinyin.

——————————————

I'm doing nothing, but wasting my time.


http://music.163.com/song/1938273/?userid=280429778

——————————————

事实上我现在对女人、(男人、)影视、游戏都不感兴趣，而我头上又好像有一座大山阻挡我想出问题的答案。时光还在继续将我变得衰老。

——————————————

😭[The error]😞
[Warning]App|Proxyman|Outbound: failed to process outbound traffic > Proxy|VMess|Outbound: failed to find an available destination > Retry: [dial tcp 45.76.13.58:32012: getsockopt: connection refused] > Retry: all retry attempts failed

——————————————

最后我下了 released version，但还是连不上

——————————————

几乎搞了一整天v2ray，连不上是闹哪样啊？

不是说 one for all吗？


我客户端也是用的同样的东西，但config不一样

——————————————

I spent five hours setting Chinese Input Method on my Lubuntu:

https://yingshaoxo.blogspot.com/2017/10/how-to-set-chinese-input-method-on.html

——————————————

You're right.

——————————————

一脸蒙逼，编译出来就成这样了😳

——————————————

知道怎么把手机翻墙流量给电脑用了

直接 proxy server 转发一个1088端口，把它添加进ss白名单，开热点给电脑，电脑 switchyomega 添加个http proxy，然后一切OK

如果有双网卡的手机，一边连公共WiFi，一边电脑翻墙，不知道WiFi密码又如何？电脑特性容易检测又如何？

所有页面都变成了手机版

——————————————

上次买的旋转椅被胖子室友故意跪坏了，这TM能忍吗？

作为一个coder没有好的坐骑怎么能行？

所以我买了这个(http://v.cvz5.com/h.G7R9Hx )，初次试用感觉还行。

——————————————

写好了，等会儿和手机Post版融合一下组个class放入之前做的kivy容器里


真是 debug 5小时，编程5分钟啊😁

——————————————

无意中登进了Dr.com的演示系统

发现它识别用户的方法是: 绑定MAC、CVLAN、PVLAN、IP

——————————————

哈，搞了几天selenium的安装，老是导入失败

最后我发现，from selenium import webriver 是什么鬼?

webdriver

——————————————

你什么专业？

——————————————

原来电压从 plus end 出发，经过 closed circuit , 到达 minus end，电压降为0

由此可以列方程解变量啊！

——————————————

circuit
电路

Schematic
A schematic is a drawing of a circuit. A schematic represents circuit elements with symbols and connections as lines.

Elements – The term elements means "components and sources."

Symbols – Elements are represented in schematics by symbols. 

Lines – Connections between elements are drawn as lines, which we often think of as "wires".

Dots – Connections between lines can be indicated by dots. Dots are an unambiguous indication that lines are connected. If the connection is obvious, you don't have to use a dot.

Reference designator – When you place a component in a schematic you often give it a unique name, known as a reference designator. 

Node – A junction where 2 or more elements connect is called a node. 

Branch – Branches are the connections between nodes. A branch is an element (resistor, capacitor, source, etc.). The number of branches in a circuit is equal to the number of elements.

Loop – A loop is any closed path going through circuit elements. To draw a loop, select any node as a starting point and draw a path through elements and nodes until the path comes back to the node where you started. There is only one rule: a loop can visit (pass through) a node only one time. It is ok if loops overlap or contain other loops. 

Mesh – A mesh is a loop that has no other loops inside it. 

Reference Node – During circuit analysis we usually pick one of the nodes in the circuit to be the reference node. Voltages at other nodes are measured relative to the reference node. Any node can be the reference, but two common choices that simplify circuit analysis are: 1. the negative terminal of the voltage or current source powering the circuit, or 2. the node connected to the greatest number of branches.

Ground – The reference node is often referred to as ground.

——————————————

Inductor
电感器


Closed circuit – A circuit is closed if the circle is complete, if all currents have a path back to where they came from.

Open circuit – A circuit is open if the circle is not complete, if there is a gap or opening in the path.

Short circuit – A short happens when a path of low resistance is connected (usually by mistake) to a component. For example, a wire shorts out a resistor by providing a low-resistance path for current (probably not what the designer intended).

——————————————

https://leetcode.com/problems/first-unique-character-in-a-string/description/

——————————————

坐一下午图书馆没收获，该死的(电路基础)教材书，例题太少就无法(通过对比)发现一个通用的思维方法或解题方法。

——————————————

卧槽，卡在电流与电压模型的等效变换上

一定得 hold 住，一旦成为电路分析大神，就可以操纵电路了

——————————————

https://leetcode.com/problems/binary-tree-paths/description/

——————————————

capacitor
电容器
a device used to store an electric charge, consisting of one or more pairs of conductors separated by an insulator.

2-terminal elements
二端元件

——————————————

从电路学(如恒定电流为I)衍生出的 常量名用大写表示


另外，外国人定义电压源和电流源的符号真是简洁高效

——————————————

我有试过挂网站制作，结果一个月没人理我

——————————————

算法题已经解了80多道，马上快到100


再不解决一些实际问题，我就真成书呆子了😞

——————————————

我的就业指导老师的老公是程序员

她今天建议我去接点软件开发的私活

请问什么是私活？在哪儿接？
Dog

——————————————

听你的

无线先做电脑版的

——————————————

初步测试了一下

联通网页版全局 login and logout using JavaScript 控制，缺点就是2011年由一个人写的，6年没变化，旧版JavaScript还是很难看懂的。

——————————————

给一个数组，从第一位开始输出，每隔一个数，输出一个

——————————————

def output(nums):
    result = []
    for index, i in enumerate(nums):
        if index % 2 == 0:
            result.append(i)
    return result
print(output(x))

——————————————

闭源软件，咱是不用的

——————————————

https://zh.m.wikihow.com/因式分解三次多项式?amp=1

学极限的加减乘除，呵呵

——————————————

https://m.sohu.com/a/126647371_465219/?pvid=000115_3w_a

说白了，我选的路也只能当 应用层软件工程师

——————————————

所以我在大学的第一个装逼项目也就初步定型了

界面拿kivy-chat TIM版改

然后有线网登录没难度；无线网是联通做的网页，需要费点时间

——————————————

我仔细观察了各地的校园网破解情况

发现针对网页版校园网，他们一般拿不出破解方案。

在mac, TTL, ipv6，DNS tunnel方法都失效的情况下，他们(包括gayhub的项目)唯一能做的，就是做一键登录工具。

——————————————

https://leetcode.com/problems/isomorphic-strings/description/

——————————————

Why I'm wrong?

1. Celling don't have to be wallpapered.

2. They say shaded wall will be ignored, that's it, do not doubt it! There are just one shadow.

3. Unit difference.

——————————————

花了一个晚自习看懂它，如果你把变量换成句子，你会疯的👍

——————————————

SI is the International System of Units—in French, Système International d'Unités. It is the modern form of the metric system and is the most widely used system of measurement. The system was published in 1960 as the result of discussions that started in 1948. SI is based on the metre-kilogram-second system (MKS). In the United States, the SI is used in science, medicine, government, technology, and engineering.

——————————————

其实我已经想了一整天，然后发现看不懂答案

——————————————

https://leetcode.com/problems/non-decreasing-array/description/

——————————————

ampere
安培

watt
瓦特

Volt
The volt is the unit of electric potential difference—electric potential difference is also known as voltage. The size of 1 volt is officially defined as the potential difference between two points of a wire carrying a current of 1 ampere when the power dissipated in the wire is 1 watt.

ohm
欧姆

——————————————

稳定电压源

——————————————

@DIYdoge 

你会做这道题的c和d吗？教教我呗

——————————————

Power
功率

Power is defined as the rate energy (U) is transformed or transferred over time. 

An electric circuit is capable of transferring power. Current is the rate of flow of charge, and voltage measures the energy transferred per unit of charge.

Electrical power is the product of voltage times current. in units of watts.

——————————————

我为考试，考试为我

听说这玩意儿挂科率高，烧脑

这半年烧脑的事要多做，不然再也没机会了😄




还有就是不补考，被企业录用的几率更大，还有什么优秀学生、奖学金什么的也需要不挂科的好成绩

——————————————

The electron move towards a lower energy state all by themselves. 

we can guide electrons using wires and make them flow through electronic components —circuit design— and do interesting things along the way.

——————————————

mass
质量

charged particle
带电粒子

electron
电子

spontaneously
自发地

——————————————

按照最新的说法，把地铁修到偏远的地区是为了炒房

中国人真是一点没变，以前中国有钱就去买田当地主，而西方有钱就去搞生产、搞研发

现在中国人有钱就去买房。殊不知一场政变、一场战争后这房子还是你的吗？另一方面，买房不会使社会有自身的进步，只是抄袭西方罢了，等到没得抄时，就该落后了。

——————————————

电路基础，搞电路板需要

——————————————

charge

The concept of electricity arises from an observation of nature, We observe a force between objects, that, like gravity, acts at a distance. The source of this force has been given the name charge. A very noticeable thing about electric force is that it is large, far greater than the force of gravity. Unlike gravity, however, there are two types of electric charge. Opposite types of charge attract, and like types of charge repel. Gravity has only one type: it only attracts, never repels.


Conductors and insulators
导体与绝缘体


current
Current is the flow of charge.


We use the d in formula to indicate tiny zero-sized change.


resistor
电阻器

——————————————

虽说py2还有几个月就退役了

kivy还没解决py3引入第三方包出错的问题

——————————————

Quicksort就是对Recursive原理的实际应用

——————————————

我可能进入了高5，还是那种睡眠不足的高5😭

——————————————

https://leetcode.com/problems/average-of-levels-in-binary-tree/description/

——————————————

然后我发现专科和本科老师讲的东西都差不多

就是学生水平不一样，比如英语我不用听，高数要专心理解，电力基础我应该会懵逼(明天上一堂课就知道了)




第一天就非常累，得早睡，不然每天6小时睡眠都没有

——————————————

学电力工程纯粹是为了工作(专业需要)，不是为梦想

除非引出梦想基于现实 或 AI以及网络需要硬件支持


不知该不该发到这里

——————————————

“不要问我正电荷为什么向左流动，负电荷向右移动，因为不统一定义，电力工程学世界就乱套了”

——————————————

charge
电荷

——————————————

12:00放学，1:20集合上课🌚

——————————————

https://leetcode.com/problems/relative-ranks/description/

——————————————

这里主要讲了把世界分为两派，正和负，异性相互吸引，同性相互排斥

正因如此，把一根碳管接上电源，电源正负极会驱动碳管里的正负极运动

然后你在中间观察，how many changes pass by it per second is called current

——————————————

current
现在，潮流，电流


voltage
电压

——————————————

Today's algebra class told me why we use letters: just for abstract meaning representation.

——————————————

This is a confidential issue. Your comment will not be visible to the public.

That's my bad, clicked the wrong button, making it confidential.

——————————————

它们好像真不收kivy应用

——————————————

好像被管理员删了

——————————————

https://gitlab.com/fdroid/rfp/issues/375

Just waiting...

——————————————

dr.com

web loginning interface

——————————————

看Github上关于Dr.com的项目也只有登录而已，不知能否实现网络共享

——————————————

Mother fuck, from Internet manager to AI researcher, It's a huge gap.

——————————————

How to do that?

——————————————

失败，还是试试拆包吧

——————————————

好，谢了

——————————————

直接粗暴地过滤掉所有非HTTPS的连接不行吗？

我想简单点

——————————————

好，我试试

——————————————

www.v2ex.com/amp/t/389950

测试完成，服务器通过检测网页请求 是否来自安卓或其他手机设备 决定是否断网

我把电脑浏览器搞成安卓user-agent，瞬间掉线

——————————————

😭

谷歌之大，无异于捞针

——————————————

没关系，怎么改？

工具名或搜索关键词

——————————————

这东西能直接从路由器改吗

终端设备修改好麻烦的

——————————————

OpenWrt不过是一个嵌入式Linux发行版


按理来说，它能做到的，我的Lubuntu笔记本也能做到，只不过没有别人已经做好的一键罢了。



现在最重要的是思路，我完全不知道网络服务商是如何检测到我开了3台设备的

——————————————

在真实世界，对方法正确与否的检测方法需要自己找。

——————————————

脚本写完了

但发现学校骗了我，转发WiFi原本就可以供一个手机用




三台机器直接断

——————————————

那个固件脚本只支持.sh

所以我还得用.sh发一个post包...

——————————————

https://leetcode.com/problems/judge-route-circle/description/

——————————————

果然我学的东西不如一台路由好用

——————————————

妈蛋，突然发现，无线路由下，不管哪台设备登陆了，全网有效


根本不用SSserver

——————————————

有道理，明天开始研究自动登录脚本

——————————————

我的笔记本只负责网页认证和架SSserver

——————————————

我的笔记本不发无线，无线路由发

——————————————

但笔记本上面有路由了

我是拿两根有线从接口到无线路由再到笔记本

——————————————

有教程吗？

——————————————

因为我用路由器构建了局域网后，不知道如何把笔记本的流量发给局域网其他人用，除了架SS服务器

——————————————

唯一的遗憾是，只能用SS上国内网，那国外网呢？总比没有好

——————————————

搞定，路由器刷的固件有不降TTL和克隆MAC以及过滤VLAN标记的功能

再加上本地SS，妥妥的

——————————————

成功了大概有一分钟

然后就把我的SSR package 丢包率提到的91%(俗称不能用)，加密流量一刀切，我也是醉了

——————————————

知道了

——————————————

额…只能用polipo转一个http了



让我再试试

——————————————

请回答这个问题

——————————————

这个可以试试，但手机上有对应的http全局代理应用吗？

或者连socket 5的也行

——————————————

关键学校是网页验证，不用笔记本开网页验证没网

——————————————

有SS

——————————————

连SS的人

——————————————

可惜 ssserver 没有前置代理

——————————————

估计还需要一台外部SS

——————————————

失败了，我在笔记本开了SS server，上流用路由器做局域网

SS连上能用30秒，然后集体掉线

——————————————

一个有线，一个无线

不知道如何在连上有线的情况下，构建局域网192.168.xx，并开WiFi让手机连上



我什么概念都不知道，所以只能这样搜索：Ubuntu上 有线网 与 无线发射 一起局域网

——————————————

好，我试试

——————————————

@yEs_1_do 

你们学校是绑定mac，那个简单许多

对绑定ip有何建议吗？

——————————————

https://mfcoding.wordpress.com/2013/01/25/linux-opkg-download-package-and-then-install/

我倒是有个OpenWrt的虚拟机可以下离线包，但那涉及到让虚拟机得到网络，而不是再跳出个认证网页



所以让我们暂时忘记这个路由器吧，投入如何突破限制、分享网络的探索中

——————————————

路由器刷了 OpenWrt 后发现要手动更新 Web UI，然而没网更个屁啊👎

https://zhuanlan.zhihu.com/p/28430178

——————————————

var loginMatchMode=2;// // VLAN登录页匹配模式：0-默认；1-VLAN ID；2-IP；3-SSID；4-AREAID；5-AC NAME

绑定ip😄

——————————————

我觉得我学校的有线网一点都不高大上，纯网页验证，然后网页里写满了中文备注

就算我不能破解它，写个自动登录脚本总可以吧(不然都不好意思说我是学的Python🙈)

——————————————

恩，我姐淘汰下来的旧产品，续航短保护腰椎

——————————————

哈哈， hoodie肚子前的兜刚好可以稳稳地装下一个8寸平板

当然也可以放手

——————————————

终于能上有线网了，但室友正霸占我的床，搞不了

——————————————

签名成功

每次在图书馆大概能花200M流量

每次两小时，玩到笔电没电

——————————————

还有就是，youtube客户端支持变速播放了，nice

——————————————

第一个正式开始的视频介绍了 linear algebra 分别从 physical, mathematical, computer science上 如何去理解。

最后得出 physics 上它是有方向的量
computer science 上它是 list 的华丽词汇
math 上它是综合了两种用途的抽象概念

And because of its detail representations and meaningful graph, It's a wonderful course for understanding linear algebra correctly.

——————————————

https://goo.gl/R1kBdb

——————————————

https://leetcode.com/problems/repeated-substring-pattern/description/

——————————————

至于贴吧，更恶心了, 一大堆过期的国内网盘链接

第三方可能就个人网站比较好一点，但一篇文章或开源的东西就100多浏览，不构成社区

——————————————

然后他那个垃圾社区，清一色不会写文档

同时大多数思想水平还停留在回复可见上

——————————————

我只是在模拟在中国谷歌被封这个梗

——————————————

然后代数课又讲了笛卡尔 connected algebra and geometry.

——————————————

我想高考大概是这个：

国际标准是用编程实现一个算法

中国高考非要你用易语言实现

然而你看不惯易语言的构造和狗尾续貂，以及一点都不和 主流编程思想和原生语言 相照应的感觉，同时闭门造车，不能用搜索引擎搜索到无穷无尽的学习资源

所以你选了 Python

虽然最后你能实现那个算法

但中国高考给你打了0分，因为你没按标准办事


究其根源，中国和国际是不一样的，中国特色****



@DIYdoge 结合你的情况加上我以前的感受做的评论

——————————————

我发现能印各种标志的基本是 T-shirt 或者 卫衣



(卫衣来于英文SWEATER的说法，就是厚的针织运动衣服、长袖运动休闲衫，料子一般比普通的长袖衣服要厚。袖口紧缩有弹性，衣服的下边和袖口的料子是一样的)

SWEATER？不就是毛衣吗？？

——————————————

In the future, Apps is not only Apps, but a server, which stores everything of his user.

So from this respect, we can see the Communist Party of China could using this efficiency of Internet to control all the people in China, from body to money.

The good news is, you don't have to starve anymore.

——————————————

Finally, I decided using this.

业余和专业之间的差距可能就体现在图标吧

——————————————

Now I need to design a logo for kivy-diary, or it'll be illegal using other's picture.

——————————————

After saw this, I got some ideas about this process: https://developer.android.com/studio/publish/app-signing.html


And for kivy app: 
https://github.com/kivy/kivy/wiki/Creating-a-Release-APK
https://stackoverflow.com/questions/31743261/error-while-signing-an-kivy-app-for-the-android-store

——————————————

In this article, he said this:
Proposal by Submission Queue

This is the simplest way to get the application included. But due to an amount of reviewer labor required for each application, this is the slowest method.

Do this by creating a new ticket at the F-Droid Submission Queue on GitLab, add all details required by the minimal issue template; and wait for people in F-Droid team to review the application and do all necessary steps for you.



https://f-droid.org/docs/Inclusion_How-To/

——————————————

下次买件Ubuntu的

——————————————

在淘宝买了这个，对于172的我来说M号有点短，还有，衣服图片是PS的，效果没有github那只白黑猫好看

——————————————

熟练运用 recursive function




Recursive approach: In recursive approach the function calls itself until the condition is met. And it is slower than iteration,which means it uses more memory than iteration. recursion is like a selection structure, and which makes code smaller and clean. And a function partially defined by itself. Here tracing the code will be more difficult in the case large programs.

Iterative approach: Iterative approach is a repetition process until the condition fails,here loops are used such as for ,while etc. Here code may be longer but it is faster than recursive. And it consumes less memory compared to recursive approach.If the loop condition is always true in such cases it will be an infinite loop.

——————————————

https://leetcode.com/problems/island-perimeter/description/

——————————————

刚刚用我的破笔记本给室友的 斐讯k1 路由刷了一个第三方固件

第一次，也是成功的一次，刷了路由器（全程lubuntu）


http://www.jianshu.com/p/ea0ea4305452(包自己找，局域网服务器自己架)

http://www.upantool.com/gujian/asus/11050.html




坑在于刷了.bin文件后：

1、将要刷的第三方固件准备好。

2、断电按着reset键不松手，然后通电5秒后再松开reset键。

3、电脑与路由器由网线连接，打开浏览器输入http://192.168.1.1即可到达Breed Web恢复控制台，刷固件即可。

——————————————

Pea 同学送的手机到了: 

Android System 7.x + Root + 冰封应用 + Google Family = Wonderful (爽)

——————————————

看到爸妈的的照片，沧桑，心疼我没出息

——————————————

不用鼠标操作，装逼感十足

就是坐太久腰会疼(还没从急性腰突中恢复)

——————————————

在来去自修区的路上瑟瑟发抖(下雨)


花了两个小时修改KivyDiary和看f-droid的文档，在思考Buildozer打包的问题(它不支持添加什么key之类的东西(大概是签名验证)，每次生成的apk文件名都带debug啥的)

——————————————

这主要是为了对抗外部干扰，就和入耳式耳机一个道理(然后你可以手机控制电脑桌面，手上拿着电脑无线键盘，躺在床上玩，或者躺着看电影、电视剧，再也不用担心宿舍头顶耀眼的灯光了)

——————————————

https://gitlab.com/fdroid/rfp/issues/351

原来提个issue就好了


不懂他们哪儿来那么多人去人工审核和编译

——————————————

上次对着它的官方文档和项目看了半天，硬是没懂怎么上传

——————————————

不对，是我不会

——————————————

不敢什么？

——————————————

这界面TM做得真垃圾(我随便做个都比他强)，再说这游戏估计没人玩吧(我都不会)

——————————————

现在摆在我面前有3个方向，走哪条路好呢？每条路都引向不同的未来。

渗透(黑客方向，实用)
Tensorflow(机器学习方向，不实用)
Bootstrap 4(网站建设方向，趣味性强)




先从简单的开始吧，Bootstrap 4
(感觉我说的每句话都是废话，不安，难道我会变成哑巴？)

——————————————

https://docs.python.org/3/library/index.html

看了一遍，觉得python也不过如此

虽然比起C++核心库功能多了不少

——————————————

https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/description/

——————————————

x/y

x divided by y

——————————————

Algebra 课程除了讲它的起源，一上来就讲 abstract (寻找区分一事物的主要特征)

——————————————

completion ≈ conclusion, ending, expiry, completion, end, finish

——————————————

Dijkstra’s algorithm 不仅能用来计算路程最短

还能用来计算不同环节的不同方法之间如何搭配利润最大

(而 breadth-first search 只能发现如何花最少的环节到达目的地，并不关心(时间金钱等)消耗)

——————————————

If you ran breadth-first search on this graph, you’d get the  shortest path(, but not the fastest path).


Look at this sentence, you could make one by yourself.

For example: If you tried it out, you would find that google is the best search engine in this world.

——————————————

现在偌大的学校图书馆自修区，加上我才5个人。

——————————————

http://music.163.com/song/412175362/?userid=280429778

——————————————

这世界总是那么多不确定的事发生，打乱个人计划和节奏

本来打算趁这几天空闲时间攻破校园网的分享问题


结果办网的把我登录密码搞错了，我现在根本连不上有线网，怎么整？


没了具体问题瞎看书进步很慢啊！

——————————————

看了 kill bill 1 ，除了反感日语部分(听不懂)，一切还好

——————————————

不知道，根本找不到插件的桌面图标，不知如何启动


没关系，反正现在先用着SSR

——————————————

听说很多企业招人都要求会SQL

以后有空我也学学😁

——————————————

https://leetcode.com/problems/third-maximum-number/description/

——————————————

你那个安卓上除了第一次能连上，以后都提示未知混淆插件

——————————————

我就是进去看看大佬聊天而已

——————————————

https://toutyrater.github.io/app/docker-deploy-v2ray.html
服务器端不用担心



客户端明天慢慢看：
https://www.v2ray.com/chapter_01/workflow.html




晚安

——————————————

不用试了，这东西的client只能在Windows上用

——————————————

不用手机流量靠自己的服务器还翻不出来了😂

——————————————

明天试试v2ray

——————————————

但却能ping通服务器

——————————————

不对，小流量几分钟后自动 remote refused connection

主要是在笔记本上，真心怀疑linux系统有什么特征很容易被识别出来

——————————————

加密     : aes-256-cfb
 协议     : auth_sha1_v4
 混淆     : tls1.2_ticket_auth


我这混淆一点用都没有，校园网情况下照样断

——————————————

ssr也被干(断)

——————————————

请教如何伪装

——————————————

SS connection 也断，完全不明所以

断开连接过一段时间又能连上。
在别人控制的局域网内真是没有自主权。
(别说无线了，上次去校联通营业厅办有线宽带时合同单上注明了是局域网，真应该在当时就严明拒绝，反正现在也连不上、或者上外网困难。(还没连上有线，营业厅放假没人，改不了密码)
不过要是它们把监控校园网这套技术搬到全国手机用户上，那专制就彻底形成了。
只是那样监控成本太高，所以只有高利润的垄断校园网敢这么搞，监控大学生比监控一群小学生有意义多了🌚)

——————————————

相对于我这个复读了一年的心理怪物(成熟老头)，我寝室5/6的成员就像小孩一样


不知道他们要多长时间才能长大(抑或是专科层次永远“长不大”？)

——————————————

猜测：

用前置代理就可以避免在未有外网、还没给学校局域网交换机验证的情况下被抓到server ip。

目测我这边不是断的SS连接，而是直接重定向server ip

112.80.105.200 很明显是南京的我校某角落的server，能黑进去就可以改一个免费上网的账号或者直接对某server ip放行，然后被发现我就可以去蹲监狱了🙈

——————————————

https://github.com/Ssrbackup/shadowsocks-rss/wiki/Python-client-setup-(Mult-language)

——————————————

https://github.com/ToyoDAdoubi/doubi

First step, turn to SSR.

——————————————

PING 45.76.13.58 (45.76.13.58) 56(84) bytes of data.
From 112.80.105.200 icmp_seq=1 Destination Host Unreachable
From 112.80.105.200 icmp_seq=2 Destination Host Unreachable
From 112.80.105.200 icmp_seq=3 Destination Host Unreachable
From 112.80.105.200 icmp_seq=4 Destination Host Unreachable
^C
--- 45.76.13.58 ping statistics ---
13 packets transmitted, 0 received, +4 errors, 100% packet loss, time 12148ms
pipe 9

It indeed somehow stopped my SS connection on school network, but this just a fight, and I'll win no matter what.

——————————————

I almost reached the human average intelligence.

——————————————

https://leetcode.com/problems/find-the-difference/description/

——————————————

人还是需要不断学习和训练的，毕竟不同于机器，人训练的神经网络会随着时间的流逝而消退。(除非形成永久记忆，虽然我很怀疑永久记忆的存在，因为你能永久记住某个技能充其量是你经常能用到它，不管是有意识的还是潜意识的)

——————————————

I want to ask you a question, why you learning English? It's important to understand your own purpose. In that case, you'll get strength from that willing. 

For me, it's a tool for learning everything.

——————————————

关于为什么在同一平面 以两个不同方向的向量为基底 可以表示 该平面任意一向量，你可以这么理解：通过常数乘法放缩V1和V2，你可以得到任意实数set V3.

——————————————

磨刀不误砍柴工

遇到不懂的专业名词还是查一下比较好

——————————————

collinear
共线

lying in the same straight line.

——————————————

span


extend from side to side of.

Example: the stream was spanned by a narrow bridge

——————————————

Ethernet

a system for connecting a number of computer systems to form a local area network, with protocols to control the passing of information and to avoid simultaneous transmission by two or more systems.

——————————————

The Internet is made up of intelligent end-point systems that are self-deterministic, allowing each end-point system to communicate with any host it chooses. Rather than being a network where communications are controlled by a central authority (as found in many private networks), the Internet is specifically meant to be a collection of autonomous hosts that can communicate with each other freely.

This is an important distinction, and one that is often overlooked. For example, many of the private networks have offered mail-delivery services for their customers, allowing a user on one network to send email to another user on another network, but only by going through a predefined mail gateway service. Conversely, the Internet allows users to exchange mail directly, without going through a central politburo first. In this regard, the Internet is a collection of self-deterministic, autonomous hosts.



照这样看来，中国整个网络确是一个局域网。

文中讲到了Internet is an unique internet, which links the whole world.

——————————————

to·pol·o·gy

the way in which constituent parts are interrelated or arranged.

——————————————

管理员放假回家了，可能

岂不是要在无网情况下等7天？

——————————————

https://leetcode.com/problems/invert-binary-tree/description/

——————————————

失眠的时候怎么办？看一节数学课程。

What you can do when you can't sleep easily? Take a math class.

——————————————

After I clicked Auto Ethernet, It's fine to connect to internet authentication webpage.

我的账号密码是错的，肯定是开户时管理员输错了，明天去联通问问

——————————————

https://qiuri.org/806.html

他们为何如此厉害

——————————————

我们应该没学过连续可能性



做到一半睡着了...

——————————————

https://leetcode.com/problems/sum-of-left-leaves/description/

——————————————

得不到有效的睡眠，思考力降为0


我得赶紧睡一觉，醒来再做题

——————————————

不会是梦游发过来的消息吧😒

——————————————

我是半夜被蚊子咬醒的，你是怎么醒的？还没睡？

——————————————

不会刷坏吗？

——————————————

😆

——————————————

Genius!

But my tablet doesn't have an option for Internet sharing.

——————————————

我已经在食堂尝试了三次，仍然不知道它是如何检测出我是笔记本并踢下线或断网

下次测试关闭SS，换个WiFi源(That depends on @DIYdoge 同学的手机什么时候到，我连密码都还不知道的)



明天可以去办有线宽带了，到时测试一下有线转无线

——————————————

It's so difficult to understand iptables:

https://www.linode.com/docs/security/firewalls/control-network-traffic-with-iptables



It's easy to understand it:

https://www.hostinger.com/tutorials/iptables-tutorial



What makes the difference? The writing ability.

——————————————

Its is similar to his, means 它(他)的。

——————————————

WiFi Cracking:

https://www.shellhacks.com/how-to-use-aircrack-ng-wifi-password-hacker-tutorial/

https://www.hackers-arise.com/single-post/2017/06/27/Wireless-Hacking-Cracking-the-WPA2-PSK-with-aircrack-ng

https://github.com/brannondorsey/wifi-cracking



原来这就是暴力破解WiFi，Middle strength passwd 跑半个月，全是数字十几分钟。

——————————————

没 root permission 的孩子只能走弯路

——————————————

你可以 fake AP(伪造一个无线) 去获得密码，但这建立在你能骗过万能钥匙的情况下，不然没人知道公共场所的WiFi密码。

——————————————

no

——————————————

最新版的蜘蛛侠选择回归动漫风格

还行

——————————————

https://security.stackexchange.com/questions/62663/how-did-my-network-admin-identify-my-iphone-and-how-can-i-hide-my-id

这上面说，防止流量分析最好的方法是，全局加密代理

可是 linux terminal 上面的流量基本是明文的，我似乎没办法彻底把 Laptop 伪装成 Android

——————————————

行！总算知道怎么一键转发网络(WiFi或有线网)了

——————————————

https://github.com/oblique/create_ap

360WiFi发射器不支持 AP master mode，不能直接用来架WiFi，万恶的360肯定做了诸多限制(也可能是我这个发射器坏了)

没双网卡就不能够一边连无线、一边发无线

——————————————

https://leetcode.com/problems/range-sum-query-immutable/description/

——————————————

Good night, everyone.

——————————————

I don't have to master those things in a short of time.

The main task right now is disguise my laptop to Android.

——————————————

Nobody can stop me from following my dreams! (Speak with tears)

——————————————


ARP
DHCP
DHCPv6
DNS
DoIP
Dot3
Dot11
Ether
ICMP
ICMPv6
IP
IPv6
LLC
NTP
Padding
PPP
RadioTap
Raw
SCTP
SNAP
SNMP
STP
TCP
TFTP
UDP



How many keywords you know about network?

I know 5 of them.

——————————————

Review myself, I just walk from World Wide Network to Local Area Network(LAN), and stuck in there.

——————————————

How to force yourself speak English?

Just speak!

——————————————

安装好了但不知怎么进入 OpenWrt Web GUI

任重而道远啊，怪不得计算机系的学生要专门拿一学期学网络

——————————————

还有一种情况：一群人，每个人想一个不同的方法，三个臭皮匠，顶个诸葛亮；如果每个人接受同样的教育、不独立思考，全想出一样的方法，那一群人=一个SB。

——————————————

关于智力，我又有了新的理解：


面对同一个问题，高手可以有多个解法，普通人只有一个或无法解答。

智力越高，解决问题的方案越多，选择越多，路越宽。

——————————————

图书馆从10月1号起闭馆4天，要不呆在食堂，要不忍耐不爱学习的室友发出的无良噪音。

——————————————

我原本的想法是得到三年空闲时间做自己的事

——————————————

https://wiki.openwrt.org/doc/howto/virtualbox

https://lede-project.org/docs/start

安装好了，准备进入下一步学习

——————————————

What is OpenWrt?


OpenWrt is described as a Linux distribution for embedded devices.

Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application. For developer, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned.

——————————————

https://www.mtzero.org/2016/08/30/openwrt-和-校园网-ipv6/

严重地思考我是不是落后了一个时代🌚

——————————————

https://gaomf.cn/2017/04/25/Linux_SoftRouter_Basic/

好高大上，看不懂

——————————————

the...the是用and并列的，他们一起共享Twice

——————————————

https://leetcode.com/problems/ransom-note/description/

——————————————

不靠谱的室友

深夜都还在寝室大声喧哗、打方言电话、放低音炮、放无聊的综艺节目




咱也只能趁他们都睡了的时候做做自己的事，或者白天在厕所里speak English or 普通话

——————————————

好吧，let's talk about my coder 生涯面前的两座大山:

1. High Level Mathematics，没它看不懂 Deep Learning Book

2. Computer calculate power，没它无法做 Android or iOS developing



这两座大山都要花很多时间去翻越，剩下的 as I thought，是处理大学专业学习和对我而言很复杂的人际关系。








最最重要的是，这样东西有点空，我需要超级小的任务块，不然都是空谈

——————————————

https://libgen.pw

救命稻草

——————————————

没准用 Python 做渗透测试更稳定

https://github.com/dloss/python-pentest-tools

——————————————

有时想想我们真卑微，知识传递靠盗版


穷人看不起好书，只能看政治宣传等无用书

——————————————

Now I feel better.

——————————————

突然发现 http://gen.lib.rus.ec 炸了

这下怎么下书...

——————————————

还得再找找

——————————————

https://forums.kali.org/showthread.php?36392-bash-ifconfig-command-not-found!!!

安装完最新版Kali，发现我下的那几本 渗透书 都过时了， ifconfig 是不能用的

——————————————

恩

——————————————

@DIYdoge 

不要硬撑，有需求就告诉我，我一定帮忙(转账)

——————————————

现在只差 @DIYdoge 的小礼物，我就可以用免流或者用流量解决网络问题了

每月30个G，不看电影、电视剧、不在线听歌，再配合宿舍联通送的24个月每月200小时的WiFi，应该满足图书馆学习、宿舍娱乐的需求

——————————————

现在在泡图书馆，发现数学类和专业编程类书籍非常新，同时出版日期也比较靠前(2016)，这下我数学可以恶补一下了

——————————————

这样的话，我是不是得手动写个过滤器，把所有连接的head改一下

——————————————

mac地址改了

——————————————

直接这样子搜索，谷歌是找不到答案的，更别说百度、搜狗那些

很奇怪，对这一块完全不知道怎么(开始)搜索

——————————————

@ShinoharaRin 

网络请求中能暴露哪些设备信息？无线路由是通过什么手段识别你是linux还是安卓手机的？

——————————————

https://leetcode.com/problems/first-bad-version/description/

——————————————

不开心，这次改了MAC和hostname在食堂多撑了10分钟(也许是5分钟)

然后就断线了，怎么都连不上





如果用平板连就不会下线





突然感到自己的能力很弱，不知所措

——————————————

愚蠢的中国人从来不知道什么叫做反抗。

——————————————

完全掌控是权力(能力)的开始，就像Android无Root权限、计算机不用Linux系统，你永远只能被宰割。

——————————————

真心没想到校园网这么恶心，让我什么都不想做

活该中国大学生不思进取、中国永远落后

——————————————

https://leetcode.com/problems/contains-duplicate/description/

——————————————

Mac changer may be help.

Next time let me do that.


I have confidence anyway.

——————————————

那么问题来了，路由器或Wi-Fi管理软件是如何知道我的呢？

按理来说，linux是可以随意更改标识的

——————————————

在食堂连上了网，掌柜比较坑，直接禁止了我电脑的联网，还好有平板

——————————————

http://www.purplemath.com/modules/factzero.htm

这道题更偏重数学原理

——————————————

https://leetcode.com/problems/factorial-trailing-zeroes/discuss/

——————————————

看了两章，可能这本2015出的书过时了

Mastering Wireless Penetration Testing for Highly Secured Environments




到第三章时觉得还是编程有趣，破解主要是用现有的各种工具

——————————————

也好，customers 总是喜新厌旧，和他们直接接触的东西过时最快。

——————————————

不过你仍然可以用 Python 研究计算机科学等高端的东西。

只是不和 customers 直接接触。

——————————————

如此一来 Python 的局限不在于它自己，而是那些 haters。

就算用kivy编译出了可执行文件，应用市场不收录或者(iPhone)平台无法安装，那就出现了问题。





此时我们保持高傲，就只能做 web application.

——————————————

提交了 KivyDiary ，遭下架

不知道为什么





Google Play开发者是要付费的，所以我还是继续一个人玩吧。(装B浪费时间)

——————————————

它给的工程包明显是Java的构架，让我这种用三方语言写APP的人怎么办

——————————————

上传App什么时候变得如此复杂了

——————————————

没什么收获

为什么呢？有以下几个方面:
1. 每本书开始以及第一章都一大堆介绍，要不就是太简单了我知道，要不就是太复杂了我不理解

2. 用我不用的工具链(比如Windows OS)，(话说这是一个新方向，我也不明白为了少交12倍的网费去看那些乱七八糟的东西干嘛)

3. 没好的网络，不能边看边干

——————————————

找了两本 penetration testing 书来看，希望能有所收获并破解掉校园网


If the cost to protect your data is too expensive for you or your employer, then it can be assumed that all of your data  has no value.

——————————————

想到智力在半年后停止发育，还是有点伤心呢

——————————————

https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/

——————————————

程序员那份高傲怕是治不了了

——————————————

https://leetcode.com/problems/valid-palindrome/description/

——————————————

Two questions you should ask yourself when you want to solve a problem:

1. Is it possible to solve that?
2. How to solve it in a better way.

——————————————

我以前的高中是别人捐赠的路由器和带宽

——————————————

学会了这个，我就能计算到达目的地的最短途径了，少走点路

——————————————

https://leetcode.com/problems/linked-list-cycle/description/

——————————————

感觉大学除了学习(我个人主要是学算法、高数、Advanced English，学校课程另算)无所事事，身边没朋友，(没人能达到我的水准在学校范围)

——————————————

Checking for duplicates is very fast with a hash table.

——————————————

https://leetcode.com/problems/excel-sheet-column-number/description/

——————————————

怀疑自己智商，想睡觉

——————————————

这本书也看到了hash tables

——————————————

After trying, I learned from official solution that hash table is just a dictionary data structure.

——————————————

https://leetcode.com/problems/intersection-of-two-linked-lists/description/

——————————————

https://leetcode.com/problems/remove-linked-list-elements/description/

——————————————

形式看着简单，就是看不懂，我深深地怀疑中国数学教育十几年=0

——————————————

https://leetcode.com/problems/minimum-depth-of-binary-tree/description/

——————————————

linear🙈

——————————————

学了 liner algebra 就能看懂那本AI书经常出现的数学公式了

——————————————

I have a dream: living in America, do programming and AI research.

——————————————

kiloliters
千升

——————————————

https://leetcode.com/problems/path-sum/

——————————————

我还没去开通有线网络服务，还要等一等，先用几天免费限时WiFi吧

——————————————

如何区分学校采取的哪种技术模式呢？

——————————————

这个好，到时候请你指导一下，我慢慢来研究，毕竟上网还是蛮重要的。

——————————————

这个学校和联通都一个尿性 ,联通有线还需要使用流氓软件，不是宽带账号密码那种形式。

——————————————

我也很无奈，快递晚点了

——————————————

https://leetcode.com/problems/maximum-average-subarray-i/description/

class Solution(object):
    def findMaxAverage(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: float
        """
        # Another one which arrive time limite
        if len(nums) <= 1:
            return float(nums[0])
        
        sum_ = []
        added = 0
        for num in nums:
            added += num
            sum_.append(added)
        
        result = sum_[k - 1]
        for i in range(k, len(sum_)):
            new = sum_[i] - sum_[i-k]
            result = max(new, result)
        return result / float(k)
        
        
        # Time limited
        m_nums = nums
        result = -999999
        for _ in nums:
            if len(m_nums) >= k:
                result = max(result, self.get_average(m_nums[:k], k))
                m_nums = m_nums[1:]
        return result
    def get_average(self, list_, k):
        all_ = 0
        for i in list_:
            all_ += i
        return all_/float(k)

——————————————

I see, my tablet will arrive in today maybe. That means I can continue do my mind training or programming practice.

——————————————

OK, after I saw the solution:

class Solution(object):
    def maxProfit(self, prices):
        """
        :type prices: List[int]
        :rtype: int
        """
        if prices == [] or len(prices) == 1:
            return 0
        
        max_profit = 0
        min_price = 9999999999
        for price in prices:
            if price < min_price:
                min_price = price
            else:
                profit = price - min_price
                if profit > max_profit:
                    max_profit = profit
        return max_profit

——————————————

Time limited.
class Solution(object):
    def maxProfit(self, prices):
        """
        :type prices: List[int]
        :rtype: int
        """
        if prices == [] or len(prices) == 1:
            return 0
        
        result = 0
        for index, price in enumerate(prices):
            may = list(sorted(prices[index:]))
            if price > may[-1]:
                return 0
            else:
                profit = may[-1] - price
                if profit > result: result = profit
        return result

——————————————

https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/

——————————————

.. Yeah, with a little bit tired.

——————————————

I'm OK today
.

——————————————

https://leetcode.com/problems/intersection-of-two-arrays-ii/description/


class Solution(object):
    def intersect(self, nums1, nums2):
        """
        :type nums1: List[int]
        :type nums2: List[int]
        :rtype: List[int]
        """
        result = []
        for num in nums2:
            if (num in nums1) and (num not in result):
                result.append(num)
        r = []
        for n in result:
            r += [n] * min(nums1.count(n), nums2.count(n))
        return r

——————————————

See you next time.

——————————————

This is the first day of my training, It's ok as far as now.

——————————————

https://leetcode.com/problems/power-of-four/description/

class Solution(object):
    def isPowerOfFour(self, num):
        """
        :type num: int
        :rtype: bool
        """
        n = num
        if n <= 0:
            return False

        import math
        if (4 ** round(math.log(n, 4))) == n:
            return True
        else:
            return False

——————————————

https://leetcode.com/problems/power-of-two/description/


class Solution(object):
    def isPowerOfTwo(self, n):
        """
        :type n: int
        :rtype: bool
        """
        if n <= 0:
            return False

        import math
        if (2 ** round(math.log(n, 2))) == n:
            return True
        else:
            return False

——————————————

I forgot my Android Table, so the only way I can keep in touch with you guys is to use my notebook.

And the internet of my school is gabage, I have no choice but use my SIM data...

——————————————

亲爱的群友，明日清晨我将来一场一去不回的旅行，望安好。

http://music.163.com/song/474567580/?userid=280429778

——————————————

Beats 65%

class Solution(object):
    def hammingWeight(self, n):
        """
        :type n: int
        :rtype: int
        """
        return format(n, 'b').count('1')

——————————————

https://leetcode.com/problems/number-of-1-bits/description/

——————————————

看了两页，是本好书

——————————————

说到就要做到

开启书籍搜集模式

——————————————

termux没用，既没有控制键，ssh又不如connectBot方便

——————————————

docker run --name pyaudio -it leocnj/pyaudioanalysis /bin/bash

开了代理都会pull超时，本来还想分析一下我喜欢的音乐平均beats是多少

——————————————

花了点时间把它看完，学到好多缩写

https://www.khanacademy.org/computing/computer-science/internet-intro

——————————————

等这一切结束后我想写一篇文章介绍针对腰椎的各种正确和不正确


https://kknews.cc/other/z6j9zl.html

——————————————

上传成功

你们可以试一试，我只增加了消息缓存和断线重连：
sudo docker run -d -p 5000:5000 -p 5678:5678 --name mathchat yingshaoxo/mathchat

最近听说国内评论都得实名制了...，我没加用户名还是个正确的选择...

——————————————

挂康复科号1元，医生对我做了初步检查，几个动作下来没一个感觉痛


然后打算叫我做CT扫描，247元太贵了，身上没现金就回来了

现在摸一摸背部，好像原来突起的地方变平了...


我要不要再回去做检查呢？

——————————————

不行，时间不等人

我要马上去医院挂号

——————————————

@system357 

你是不是太久没翻墙技术生疏了

什么混淆、新加密的没耳闻吗







我 Web_Math_Chat 生产版做好了，现在 docker 有三层 layer 死活传不上去，肯定我翻墙姿势过时了

——————————————

https://leetcode.com/problems/pascals-triangle-ii/

——————————————

Sorry, but I can't help, I'm a little bit nervous now.

——————————————

十万行代码到底要写到什么时候，github没统计吗

——————————————

论把自己代码写好备份的重要性


1. 直接抄袭
2. 方便下次用那个知识点时回看


PS: 感觉当时写AIxiaoya的代码都比我现在写得好

——————————————

明天去医院挂骨科

希望可以搞点证明材料

然后逃过军训(没准真能检查出什么毛病)

——————————————

准备去收拾各种电子产品到行李箱了

从四川到南京，还是有点远的

——————————————

https://discuss.leetcode.com/topic/102540/some-question-about-this-problem

OK, now we can keep going.

——————————————

主要是数据太少我无法分析

要是给三个不同长度的list，我一看它生成的tree就知道怎么回事了

——————————————

我主要是不懂一维list和 binary balanced tree之间的关系

我除了看见[]就是[3,5,8]这样的东西，超过3个就不知道它是怎么排列的了

那不是蒙着眼睛去撞墙吗？

——————————————

https://discuss.leetcode.com/topic/10519/an-easy-python-solution


原来root在中间，出题人可以去死了，我要给👎

——————————————

没限制，我觉得这道题不应该出现在easy级别

简直是坑小学生

——————————————

看来需要预先由公式和总node数算出levels，然后再算出每一level的 node 数，最后把单一数组按level分开，最后再由root添加node


除此之外实在想不出怎样从底层向上

——————————————

设计这道题的人真是SX，它不给例子我怎么知道它所谓的 binary tree 是怎么和一个 list 对应的😡

——————————————

Still learning

http://interactivepython.org/runestone/static/pythonds/Trees/BalancedBinarySearchTrees.html

——————————————

http://algorithms.tutorialhorizon.com/find-whether-if-a-given-binary-tree-is-balanced/

http://www.cnblogs.com/loadofleaf/p/5502335.html


This question is tougher than I thought.

——————————————

Giving a proxy to docker using polipo in ubuntu


0. Make sure you have shadowsocks running in the background
https://yingshaoxo.blogspot.com/2017/07/bypass-great-firewall-by-using.html


1. First, set a http_proxy

sudo apt install polipo

sudo vim /etc/polipo/config

add following and save it:
proxyAddress = "0.0.0.0"
proxyPort = 1088

socksParentProxy = "localhost:1080"
socksProxyType = socks5

sudo service polipo restart

Now you got a http_proxy at localhost:1088.


2. Give that proxy to docker

sudo vim /etc/default/docker

add or change to export http_proxy="localhost:1088/"

sudo service docker restart

——————————————

https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/

——————————————

当一个人真正成为合格的 program developer, 他会发现除了职业病以外他什么也不怕。

——————————————

Once I read a sentence: somebody's life ends in college entrance exam, and somebody's life is just about to start.

——————————————

If you really want to do some art working on Linux, this maybe a good environment for you to use: https://ubuntustudio.org

——————————————

https://leetcode.com/problems/binary-tree-level-order-traversal-ii/description/

——————————————

Maybe

再加上我好像说了很多实话，她可能感觉到自己太渺小了吧，无意识地抵抗

——————————————

我要做一只孤独的单身狗！

——————————————

和那个女同学吹了

她英语比我少4分




然后她竟然不满我一直和她讲英语，I don't understand anyway.

——————————————

特辑：什么是爱?

爱 = 占有欲 + 保护欲 = 我的东西我能不保护吗？




Any objections?

——————————————

https://leetcode.com/problems/maximum-depth-of-binary-tree/description/

——————————————

As you know, docker is a good tool free us from installing so many AI packages.

But GreatFireWall took that from us, It's unforgivable.

——————————————

The difference between RUN and CMD in docker


RUN is executed while you are building an image. This is usually used to install things or perform modifications in the resulting image.

CMD is executed when the container is started. Use this to e.g. start applications.

——————————————

刚刚还想做个自动踢人的bot，网络太差，就没搞了

现在换了新VPS，感觉非常好

——————————————

那个 Web-Math-Chat项目在我脑中构思得差不多了

但实现起来还是有些困难，比如第一步bootstrap的CDN link是被封的，不翻墙网页就白纸一张，就算我把它们放到本地托管，mathjax如果也是被封的，我就没办法了

另外我服务器买来用了一年多，怕是处于严厉的监控中，今天抽风得我都受不了了，不知是不是做网站暴露ip的缘故。以后有学生证就用廉价的学生云挂网站

最后我也不确定SS或其AES-256-CFB协议是否过时

——————————————

ASCIIMath 最好用🌚

——————————————

@system357 

μMath+不好用，不能自由上下移动元素

——————————————

https://revisionmaths.com/gcse-maths-revision/trigonometry/sin-cos-and-tan

——————————————

https://leetcode.com/problems/symmetric-tree/description/

——————————————

不对，是原厂搬的，只是为了打开国际市场，利用Facebook和Google Game

——————————————

天天大富翁又被搬到迪斯尼，叫做 Disney Magical Dice

——————————————

https://www.cs.swarthmore.edu/courses/cs21book/build/ch21.html

——————————————

https://pythonspot.com/en/python-tree/

——————————————

https://leetcode.com/problems/same-tree/description/

——————————————

误解了，是那群屌丝聊农药



我在班群里只发现一个喜欢英语的女孩，但她很快退了群(She said it's boring)

然后，我用英语和她私聊了一会儿

——————————————

那些东西还好，关键聊王者农药，实在受不了

到时候再看




反正 Global Internet 是我的精神家园

——————————————

我大学的班级50人

男女比例28:22




目前从腾讯班群已有的22人来看，智商情况不容乐观(无意义的词汇刷得越多、越快、智商越低)

目前，我的首要任务是发现那些喜欢英语的同僚(似乎只有女生)(逛空间)

——————————————

https://leetcode.com/problems/add-binary/description/

——————————————

Naruto doesn't have much skills, but he was working hard to training those skills again and again. In the end, It can be useful. 

And certainly, you can't learn so many skills at once. Learn it one by one, train(use) it everyday(everytime), that's why he succeeded.

——————————————

We just use number to measure the difference, in this way, it can be accuracy.

——————————————

Nothing will happen if you stick on the place you used to be.

——————————————

https://leetcode.com/problems/merge-two-sorted-lists/description/

——————————————

不用list没办法分组，对我来说

That's the easiest way I can do.

——————————————

palindrome

a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run.

——————————————

https://leetcode.com/problems/palindrome-number/description/

It makes no sense. If I could just send a link, why I'm wasting my time to copy so many text.

——————————————

We can keep going now.

——————————————

All right, that guy leaved.

——————————————

Even Github is getting locked.

——————————————

docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host.

Not again! It's been killed by GreatFireWall!

——————————————

唉，实用主义者

你花时间调试、吐槽那些新设备也是很费时间的啊




不如像谷歌一样，约定好时间，每隔几年就大换血

——————————————

什么东西越是 unchangeable、越是需要，什么东西就越值得买。

比如 chair and desk，they won't change in a long time.

——————————————

You may think it's easy, but actually no.

To me, I have to keep my waist straight as long as I can. (laying down)

So I won't waste too much time on tweaking things. (watching Anime)

——————————————

Nothing more, but disappointing.

——————————————

坚决不用镜像之安卓包污染事件

——————————————

不设代理连头文件都获取不到，设了远端http_proxy又慢得要死🌚

——————————————

给docker翻墙真是伤透了心


分别用了docker的polipo和实体的polipo，全都建设http proxy失败

——————————————

卸载了

——————————————

不知道为什么，我的手总是在游戏界面点个不停

明明都是极其简单的重复动作，为什么喜欢没日没夜的干个不停？

可能这就是傻瓜思维吧！(贪图享受，不愿思考)

——————————————

它那自动剪辑掉重复相似帧的能力不像是人工编码搞出来的

——————————————

I gave it a try to Quik today. And it's amazing. They must pay a lot to develop it.

——————————————

I don't wanna talk too much since I've been grew up.

——————————————

感觉现在看知乎上关于IT的东西，一群垃圾，比起以前，差远了


国内什么鬼服务一旦向大众无限制开放，立马就水了、就布满广告了、就低端了，把验证码改成智商题是个好办法→→不过目前国内普遍的做法是把内容藏起来(藏到native app里)，你看不到就不会觉得它们弱智了😂

——————————————

刷机机型由易到难


第一梯队：pixel/nexus
第二梯队：一加/小米
第三梯队：华为/三星

——————————————

This probably is the easiest way for music classification, do you think so?

https://github.com/tyiannak/pyAudioAnalysis#an-audio-classification-example

——————————————

…

——————————————

是不是小姐姐来了?!


我暗自窃喜😊

——————————————

I have truly confidence in my aesthetics.

——————————————

在开始 dirty my hands 之前，我需要想方设法把我在网易云音乐所有喜欢的歌搞到 Google Drive，不然以后下歌会越来越难

——————————————

数据本身就是差异信息，如果全是一样的比如0，压缩后根本不占空间


而差异信息最直观的就是声音，因为人们早就学会用声波图研究声音( Wait a minute, 声音不就是音波吗)


所以我首先从音波处理做起

——————————————

有没有基础的书籍？别一上来就是给一片地区的房价，去做关于那方面的分析...

——————————————

AI分好多类

视觉、听觉、触觉，这些是按人的感官分的类

再基础一点，就是决策机制

其中决策的依据是预测

预测的依据是函数模型或人工神经网络

——————————————

好

——————————————

难道还没连接上或者第一次连接失败都会诱发on_close吗？明明还没connecte，何来connection closed

——————————————

那就两个都绑定，close立即刷新，error等5秒自动刷新网页

——————————————

自瞄那件事我是无能为力的，计算机太差

可以做点慢速的数据处理

——————————————

那我们应该从何开始呢？

各种理论还是一个具体的模块？

——————————————

Set http proxy on VPS with one command


docker run --name proxy -d -p 9999:8080 jkernech/http-proxy


https://hub.docker.com/r/jkernech/http-proxy/

——————————————

电脑可以不用买新的


过一段时间，熟悉了学校后直接买个小型服务器，不光配置高、24小时运行自定义程度也高

——————————————

现在你可以构建你的家庭云影院了(下载成功后chrome可以直接在网页上调用MX Player，或者你再单开个server做文件展示)(你可以让迅雷去吃*)，只差到zeronet取磁力链接

https://hub.docker.com/r/jpillora/cloud-torrent/
docker run -d --name download -p 3000:3000 -v /root/downloads:/downloads jpillora/cloud-torrent --auth 'yingshaoxo:password'

——————————————

类似teletram web的websockets自动重连，是绑定on_close还是on_error?

——————————————

前面讲到的人们为什么会忘掉高中的知识，作为对比还有，真正的高手，对于学科的掌握，早已突破学级的限制，在它眼里，小学、初中不存在，高中、大学没区别，它对于学科的理解，早已融入生命。

你要说它学的东西没用？不可能，知识已经塑造了它的人格。

——————————————

不过你想想是不是有些不公平

像我妈那代人在工厂越来越辛苦的干活，工资却越来越少




即使她们的确越来越不爱学习(除了学习几个简单的依靠练习来提高熟练度的动作)

——————————————

当我提出这个想法时你们不要觉得奇怪

Because the traditional way of programming has been out of date little by little.


I can strongly feel it when I see an idiot could also programming based on native GUI.

——————————————

Tell me any where I go you will follow.

谷歌的输入法真是屌爆了，滑动输入快到不行

——————————————

好， learning AI from tomorrow.

——————————————

不模拟人的神经不太可能做出有自主思想的东西


人有计算得失、利益的思想，这种思想根植于动植物的基因里，驱使它们繁衍生息。

——————————————

一切都因为我高一看了本介绍人工智能可能实现原理的书(中文)。

——————————————

虽然想搞清楚什么是人工神经网络

但看了很多介绍，还是不懂😆

——————————————

举个例子，你能明白人是如何处理声波差异的吗？一百个人有108种特色，你还是能听懂它在说什么

这种人类无法给出具体逻辑过程的东西，只能交给模拟神经自己去摸索差异信息背后的规律

——————————————

http://music.163.com/song/36664350/?userid=280429778

——————————————

换句话说，把“天才”量产化

——————————————

他们把更深层次的逻辑处理当成AI，简直可笑(就好像把爬虫当成毕业设计)

https://hackernoon.com/making-the-web-more-accessible-with-ai-1fb2ed6ea2a4

真正的AI是 有着人所不能直接理解的逻辑深度 的处理能力的 东西。

——————————————

我就是vultr

——————————————

最近我的服务器经常无法访问

过一段时间后又会好

——————————————

接下来是做一些cookie逻辑(让用户有更好体验)和提高稳定性(做一些watch dog进程)

http://yingshaoxo.cf:5000

——————————————

https://hub.docker.com/r/yingshaoxo/mathchat/

——————————————

好吧，我去在开始里插一个多进程

——————————————

好复杂的感觉

——————————————

但是RUN只能用来安装package，会新建一层container

——————————————

我这样放，最终执行的是app.py，server.py没运行：

CMD ["python", "/usr/src/app/server.py"]
CMD ["python", "/usr/src/app/app.py"]



但如果这样放，最终执行的server.py，app.py没运行：

CMD ["python", "/usr/src/app/app.py"]
CMD ["python", "/usr/src/app/server.py"]




我该怎样放才能两个都执行呢？

——————————————

又似乎是我打包的问题

我好烦

——————————————

竟然用laji闭源iPhone

——————————————

表示看不懂官方的例子

https://docs.docker.com/engine/reference/run/#expose-incoming-ports

——————————————

来，举个例子

——————————————

直接点吧，网上说的多端口用两个 -p xx -p xx 的办法行不通，docker永远只暴露第一个-p指的端口

所以我无法连到websockets服务器




你们知道如何 docker run 时指定多个端口吗？

——————————————

花了160买了个2手iPhone 4s，升级到ios9后没感觉卡

——————————————

不可能，用docker就是要整和服务

我以后没准还要把zeronet暴露在服务器

——————————————

我知道，但还是不行

——————————————

我知道，但蹦错的几率太高，尤其在3的情况

——————————————

成功啦，py3程序就是得用FROM Python:3.6才行，用官方教程所用的FROM alpine肯定出错


现在的问题是websockets如何穿透docker?试了直接暴露对应端口，无效

——————————————

不让每一个孩子因下不了镜像而失去学习的机会。

——————————————

University of Science and Technology of China

https://lug.ustc.edu.cn/wiki/mirrors/help/docker

——————————————

我只是不想用国内服务，你急啥


一年前安装了三次你说那个网站的东西

——————————————

I don't know

——————————————

https://blog.codeship.com/using-docker-behind-a-proxy/

——————————————

docker啊！！，原生代理还是http_proxy，过时了

——————————————

要不你就加个前置路由代理，可硬件那么好买吗？贵死人还各种限制

——————————————

linux命令行只能设置http_proxy

这样的话像docker这样的衍生品在国内无法用




只能用别人的闭源木马修改版。

——————————————

Polipo is no longer maintained

When it was first written, Polipo was probably the best HTTP proxy available. Since then, the web has changed, and HTTP proxies are no longer useful: most traffic is encrypted, and a web proxy merely acts as a dumb intermediary for encrypted traffic.



https://www.irif.fr/~jch//software/polipo/



第一次感觉到linux过时了，在代理方面

——————————————

linux这个开放的系统，到了中国，明文的http下载与更新和不支持全局代理，太糟糕了

Even I use proxychinas，也无法使用docker




以前用一个第三方转socket到http，麻烦

为啥不转HTTPS?因为命令行模式下无法设置proxy_https=xx
我指无法正常使用

——————————————

所以它的镜像需要安装它的软件

Let's say no to that.

——————————————

No, definitely no.

https://docs.docker.com/compose/

——————————————

compose算吗？

——————————————

它那里只有下载安装脚本

没讲怎么替换镜像啊

——————————————

为啥

——————————————

不支持socket 5的docker，在中国下载镜像有慢到死的危险(连续5次报timed out error)

https://blog.codeship.com/using-docker-behind-a-proxy/

——————————————

It's hard to get my docker image work.

用了一个flask app to serve index.html，但就是运行不起来




😞对开发者不友好，对运维友好😞

——————————————

I watched this TED Talk and thought you would find it interesting.

Juan Enriquez: What will humans look like in 100 years?
https://go.ted.com/CyQx

Learn more about watching TED Talks on all of your favorite platforms: https://www.ted.com/about/programs-initiatives/ted-talks/ways-to-get-ted-talks

——————————————

从未见过如此复杂的安装

——————————————

Install docker on ubuntu:


sudo apt-get remove docker docker-engine docker.io

sudo apt-get update

sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

sudo apt-get update

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

sudo apt-get update

sudo apt-get install docker-ce

——————————————

其实我是懒，不想一两年之后再去学新东西

——————————————

接下来准备制作一个docker镜像

不知道我这么脑残能不能成功上传到docker club

——————————————

官方例程有问题

——————————————

Problem Solved:

import asyncio
import websockets


connected = set()


async def consumer(websocket, msg):
    print(msg)
    for ws in connected:
        if ws != websocket:
            try:
                await ws.send(msg)
            except:
                # Unregister
                connected.remove(ws)


async def consumer_handler(websocket, path):
    # Register.
    global connected
    connected.add(websocket)

    while True:
        try:
            msg = await websocket.recv()
            await consumer(websocket, msg)
        except:
            pass


start_server = websockets.serve(consumer_handler, '0.0.0.0', 5678)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

——————————————

我不明白为什么用 finally: ，那样的话每个连接自动断线，还保持什么长连接、做什么信息分发？

https://websockets.readthedocs.io/en/stable/intro.html#registration

——————————————

不过各地美女除了北京

都有一个特点：张口心碎(方言)

那样美丽就掉价了

——————————————

我不单应该拍照纪念，还应该问问她联系方式


奈何自己长得太丑没勇气😔

——————————————

咦？垃圾iPhone 5连文件管理器都没有，还不支持从相册蓝牙传图

——————————————

今天在公交车上碰到一个超美的美女，美得清新脱俗、让我赞叹不已，只可惜我没能拍上照


给个背影你们体验下吧：

——————————————

建议美图秀秀开发这个新特性。

——————————————

我原先构想是做一个名为“美不美”的APP，用以实时告诉审美缺失的人自己够不够美丽，从而辅助她们化妆。

——————————————

你想知道如何让你的审美观留存于世吗？


很简单，从现在起，准备10个文件夹分别标记为1到10，每次遇到心仪的美女图片就给它评个分并放入对应文件夹，坚持两年，搜集上千张图片，然后做分类器。


这样不光你的审美观保留了下来，还可以在你约会被冲昏头脑时帮您做出正确的选择。

——————————————

并表示，死也不安装Windows到自己的机器

——————————————

Trust me, I won't buy another phone until I got Google
Pixel.

——————————————

It's a bad idea for me to learn so many different programming languages.


Because that's useless, you won't be able to create any useful package if you only know little about a language.

——————————————

我放弃

https://leetcode.com/problems/longest-harmonious-subsequence/solution/

——————————————

这道题好难啊，我快要放弃了

——————————————

那就算了😒

——————————————

第二台我搜不到配置

你说下内存吧，大于1.4G就要了

——————————————

你有没有旧电脑嘛


我收购😄

——————————————

我姐退下来的旧货😂

——————————————

这样看来我还是得买新电脑。不支持usb3，什么事儿啊！害我活生生把一台卡米机变成了真黑砖😡


https://read01.com/zPP76o.html#.WZwR3XURVSB

——————————————

Can't use adb shell, so I googled it. 

This is error because your window version haven't driver for usb 3.0 to receiver authenticate permission from phone. I spent 5 day with this bug.


So what the fuck! Now I know why I always fail!!!

——————————————

https://media.weibo.cn/article?id=2309351000784136455516596686&jumpfrom=weibocom



TWRP(Team Win Recovery Project)，原来这个是刷机必备

——————————————

https://plumz.me/archives/1759/


膜拜大神，一股脑儿把全部.img文件刷进去也不会出事

——————————————

https://github.com/LCTT/TranslateProject/blob/master/published/201405/Ubuntu%20Touch%20and%20Android%20Dual%20Boot%20Installation.md


看起来好高级、好想要，可是我不会😂

——————————————

更重要的是，我搜了有几天第三方recovery，没找到通用的下载平台

这让人很难过啊

——————————————

让我告诉你真相，获取root要Windows，我不会再安装win到我的笔记本


然后直接刷带root的系统是我在ubuntu唯一的选择，可是刷机有风险，我好烦

——————————————

我爸妈硬是要给我买个手机


然而我什么都不想买，不能Root拿来干嘛？

有些手机比如小米，还要刷开发版，，，说实话，我已经刷怕了，来一个坏一个，家里经济受不了啊！



然而淘宝、京东也没有卖开发专版或已root的手机😢

——————————————

😭

你们都是土豪 @system357

——————————————

留学?

——————————————

你的学校要交多少一年?

——————————————

不买电脑省的钱都交给学校了😞

——————————————

@bdbai 

卧槽，公立学校除去吃饭，一年全部费用加起来有7300

这正常吗？

——————————————

594. Longest Harmonious Subsequence


We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1.

Now, given an integer array, you need to find the length of its longest harmonious subsequence among all its possible subsequences.

Example 1:
Input: [1,3,2,2,5,2,3,7]
Output: 5
Explanation: The longest harmonious subsequence is [3,2,2,2,3].


class Solution(object):
    def findLHS(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

https://leetcode.com/problems/longest-harmonious-subsequence/description/

——————————————

求提升，除了做算法、补基础数学思维外有何捷径？


答案：没有，谁叫你以前不好好自学！

——————————————

Google这个账号做得不错

——————————————

Check out @GoogleFacts's Tweet: https://twitter.com/GoogleFacts/status/897624103263375360?s=09

——————————————

这下对了，这题太坑了，谁知道charges是收费，15.6%是指借出去的贷款啊！


还有，每个月收取1.3%的费用，简直是高利贷！

——————————————

15.6%是基于谁的百分比？

——————————————

什么叫 annual finance rate of 15.6 percent ？

不是应该把of前后对换吗？比如 55 percent of people

——————————————

A credit card company charges an annual finance rate of 15.6 percent. What is the MONTHLY rate charged on any unpaid balance?

charges不是代表消费？你去试下翻译软件，没一个有借鉴意义

——————————————

其实我有点慌了，看不懂是怎么回事啊？

你知道什么意思吗？

@bdbai

——————————————

I see it now.

It's more stable than PC on my internet situation.

——————————————

Hey, why you can use your phone do this coding?

——————————————

Never mind, that's a stupid system.

——————————————

Beats 55%, 52ms


# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
    def deleteDuplicates(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """
        one_set = set()
        node = head
        previous = None
        while node:
            if node.val not in one_set:
                one_set.add(node.val)
                previous = node
            else:
                previous.next = node.next
            node = node.next
        return head

——————————————

83. Remove Duplicates from Sorted List


Given a sorted linked list, delete all duplicates such that each element appear only once.

For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.


# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
    def deleteDuplicates(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """

https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/

——————————————

+1

——————————————

于是你就可以搞一套回复可见的帖子两年后自动去除限制，大家都可见的系统

——————————————

我仔细想了想那套机制，实际上不完善


保护知识产权可以，但是也有限度，不然就会阻碍时代的发展





举个例子，美国专利法规定某类科技专利只能保持10年，10后专利自动失效，大家都可用

——————————————

还得吐槽一点，论坛要回复是哪个无耻小人发明的，最讨厌了，好像回复点垃圾信息有意义一样

http://bbs.xiaomi.cn/t-3249498

——————————————

似乎官方表示有些没上锁，http://www.miui.com/shuaji-393.html


下次还是用三方recovery卡刷吧

线刷好危险

——————————————

不知道还要搞坏几台才能学会刷机😳

http://www.jianshu.com/p/f77950bbbbaa

——————————————

红米系列就是垃圾，连续两个在不同平台都刷坏😒

——————————————

又把主板烧坏了。。。

点电源键没反应😒

——————————————

奇怪，红米note刷机包里根本没有那三个img文件


极有可能是我需要线刷包，而不是普通版

——————————————

现在国内的直连网络，没了ADM根本没法下载，慢得要死

chrome弱鸡的断点续传在国内根本没法用，几分钟就断了

——————————————

我还要下刷机包

http://m.blog.csdn.net/wzy_1988/article/details/37883771

——————————————

I must give it a try:

http://www.chole.io/blog/linux-android-adb.html

——————————————

Check out @Sentdex's Tweet: https://twitter.com/Sentdex/status/899057144884015104?s=09

——————————————

超级吊的自瞄

——————————————

我最多拿这个东西写一下解题过程...

——————————————

https://github.com/mkulesh/microMathematics/releases

——————————————

你有更好的资源吗？

——————————————

下午继续

——————————————

手机坏掉了，在平板重刷几十道数学真是要把我虐死

——————————————

class Solution(object):
    def missingNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        # Beats 53%
        return set(set(range(len(nums)+1)) - set(nums)).pop()
    
        # Beats 23%
        nums.sort()
        for index, num in enumerate(nums):
            if index != num:
                return index
        return nums[-1] + 1

——————————————

268. Missing Number


Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.

For example,
Given nums = [0, 1, 3] return 2.

Note:
Your algorithm should run in linear runtime complexity. Could you implement


class Solution(object):
    def missingNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

https://leetcode.com/problems/missing-number/description/

——————————————

老实交代，你今天是不是看了别人的算法

——————————————

不好意思，状态不好，看不懂他们的代码

https://discuss.leetcode.com/topic/93695/python-straightforward-with-explanation

——————————————

原谅我可怜的大脑

演算了半天得到这么个👻

——————————————

Beats 22%


class Solution(object):
    def maximumProduct(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        nums.sort()
        def product(list_):
            return int(eval('*'.join(str(item) for item in list_)))
        
        positive = []
        negative = []
        for num in nums:
            if num < 0:
                negative.append(num)
            else:
                positive.append(num)
        p_len = len(positive)
        n_len = len(negative)
        
        if p_len >= 3:
            A, B = 0, 0
            A = product(positive[-3:])
            if n_len >= 2:
                B = product(negative[:2]) * positive[-1]
                return max(A, B)
            else:
                return A
        if n_len >= 3:
            A = product(negative[-3:])
            if p_len >= 1:
                B = product(negative[:2]) * positive[-1]
                return max(A, B)
            else:
                return A
        if n_len >= 2 and p_len >= 1:
            return product(negative[:2]) * positive[-1]

——————————————

人家是高富帅，年薪人名币几十万

——————————————

估计就是吓唬人，谁傻谁登记

——————————————

@bdbai 

你进行了兵役登记？

——————————————

“每天早上6:40集合,冬天跑操,夏天做操;7:20检查宿舍,被扣分就完蛋了,宿管部要求每天必须有宿舍被扣分;8:10上课,课间十分钟,除了拖堂就是拖堂;12:00放学;13:30又开始上课,午觉别想了;17:30下课,如果你有9、10节课的选修,很不幸,一直上到19:00;19:00晚自习,强制性的,周日到周四,迟到学习部扣分;20:40结束;21:30查宿舍,22:00熄灯，23:00断网,电不断,但是不熄灯扣分。”

——————————————

还有坑爹的半军事化管理，一周有几天比高中还累

——————————————

我学校11点断网，艹了狗，我以后怕是还得研究下免流才行

——————————————

等会儿发到共享网站上去

我就名垂谷歌了😂

——————————————

Once for all, 修复所有问题，这下你可以用第三方语言愉快地开发 web chat app 了😘

——————————————

{"title": "Easy Language"}

——————————————

Show me the codes

——————————————

628. Maximum Product of Three Numbers


Given an integer array, find three numbers whose product is maximum and output the maximum product.

Example 1:
Input: [1,2,3]
Output: 6

Example 2:
Input: [1,2,3,4]
Output: 24

Note:
The length of the given array will be in range [3,104] and all elements are in the range [-1000, 1000].
Multiplication of any three numbers in the input won't exceed the range of 32-bit signed integer.


class Solution(object):
    def maximumProduct(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

https://leetcode.com/problems/maximum-product-of-three-numbers/description/

——————————————

在ZeroNet的TV网站发现了火影忍者的英配版

听起来不错，一季32集，目前有4季

——————————————

实际上看，哪儿冒出这么个BUG?

——————————————

表面看还OK

——————————————

我难道只能给你看一些无聊的文字？

No, I'm gonna show you some codes.

——————————————

我以为我的复习班考上很多本科，其实基本是专科…

——————————————

像我腰突前，单手举40斤哑铃，肯定是错的，腰肢两侧负重不均匀，再加上割痔疮时做了背部注射麻醉(腰椎受损)，又加上手术后卧床两周腰肌退化，再加上在医院菊花几紧闪(伤)了腰，最终导致急性腰突。


急性腰突发作首先得躺在硬板床4天，然后再慢慢做康复锻炼。

——————————————

用它进行锻炼9天后，感觉腰背部肌肉硬如铁，腰突确实有好转

http://well-health.cn

——————————————

Beats 88.69%


class Solution(object):
    def checkRecord(self, s):
        """
        :type s: str
        :rtype: bool
        """
        import re
        if s.count('A') > 1 or re.search(r'(?:L{3,})', s) != None:
            return False
        else:
            return True

——————————————

551. Student Attendance Record I


You are given a string representing an attendance record for a student. The record only contains the following three characters:
'A' : Absent.
'L' : Late.
'P' : Present.

A student could be rewarded if his attendance record doesn't contain more than one 'A' (absent) or more than two continuous 'L' (late).

You need to return whether the student could be rewarded according to his attendance record.

Example 1:
Input: "PPALLP"
Output: True

Example 2:
Input: "PPALLL"
Output: False


class Solution(object):
    def checkRecord(self, s):
        """
        :type s: str
        :rtype: bool
        """

https://leetcode.com/problems/student-attendance-record-i/description/

——————————————

反正我用这个，win7上各种手机助手都连不上手机。。

虽然看上去多了几个USB接口

——————————————

玩了12个小时的游戏😭


肯定现实不如意

——————————————

Show Android USB in VirtualBox in Ubuntu


sudo adduser your_ubuntu_user_name vboxusers

or

sudo usermod -G vboxusers -a your_username


Then reboot.

——————————————

腾讯版本你花几十万人民币都得不到的卡片

直接白送

——————————————

旅游大亨

——————————————

我是故意作弊的

——————————————

算法也会过时

随着时间的推移，硬件越来越不成为问题，那些为了节省空间而增加算法复杂度的东西会被淘汰

——————————————

class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        # Beats 44.9%
        try: 
            while True:
                nums.remove(val)
        except:
            return len(nums)
        
        # Beats 44.6%
        nums[:] = [n for n in nums if n != val]
        return len(nums)
    
        # Beats 29.3%
        for _ in range(nums.count(val)):
            nums.remove(val)
        return len(nums)

——————————————

台服一上来就送S卡，绝了

——————————————

27. Remove Element


Given an array and a value, remove all instances of that value in place and return the new length.

Do not allocate extra space for another array, you must do this in place with constant memory.

The order of elements can be changed. It doesn't matter what you leave beyond the new length.


Example:
Given input array nums = [3,2,2,3], val = 3

Your function should return length = 2, with the first two elements of nums being 2.


class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """

https://leetcode.com/problems/remove-element/description/

——————————————

现在看起来好多了

接下来需要写JavaScript

——————————————

直接用 text-left 和 text-right 出现了奇怪的效果

我们看书都是从左到右，习惯了左边是对其的

——————————————

Good practice


因为如果文件分离，安卓Chrome会自动缓存，然后修改js后刷新无效，只有全放一起不缓存


然后只有chrome全面支持ES6

——————————————

我不管，反正都在一个html文件里😏

——————————————

这样看来

html比kivy好写多了

——————————————

害我忙了几个星期[黑脸]

——————————————

就改一个css属性就可以了，这么重要的东西怎么从没见人提起过？


    .list-grounp {
      position: absolute;
         width: 100%;
      height: 100%;
         overflow: scroll; /*if the content extends beyond width and height use the scrollbar*/
    }

——————————————

实际上惨不忍睹🙈

——————————————

表面上看着还行

——————————————


<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
  </head>

  <style>
    html, body {
        height: 100%;
        }
    
    .fill { 
        min-height: 100%;
        height: 100%;
        box-sizing: border-box;
        }

    .chat-history {
        min-height: 90%;
        height: 90%;
        box-sizeing: border-box;
       }
       
     .input-group {
      position: absolute;
      bottom: 0;
     }
  </style>

  <body>

    <div class="container-flude fill">
     
                <div class="list-grounp chat-history">
                    <h3 class="text-left"> hi, world.</h3>
                    <h3 class="text-right"> hi, world.</h3>
                </div>
                
                <div class="input-group">
                    <input type="text" class="form-control" placeholder="Say something..." >
                    <span class="input-group-btn">
                        <button class="btn btn-secondary" type="button">send</button>
                    </span>
               </div>
              
    </div>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
    <script>
        chat_history = $('.chat-history');
        msg = `<h3 class="text-left"> hi, world.</h3>
                     <h3 class="text-right"> hi, world.</h3>`
        for(count = 0; count < 20; count++) {
            chat_history.append(msg);
            }
    </script>
  </body>
</html>



好尴尬啊，我还是没搞出带滑动条的无限box…

——————————————

Beats 61%


# Definitkion for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
    def deleteNode(self, node):
        """
        :type node: ListNode
        :rtype: void Do not return anything, modify node in-place instead.
        """
        next_node = node.next
        node.val = next_node.val
        node.next = next_node.next

——————————————

懂了

——————————————

你意思是这道题无解？😱

——————————————

关键我怎么知道它只给了那个节点的访问权？

我试过给每个节点赋值(node.val = xx)，都可以啊…

——————————————

搞半天也没懂它叫我 delete 哪个 node

——————————————

237. Delete Node in a Linked List


Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.

Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.


# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
    def deleteNode(self, node):
        """
        :type node: ListNode
        :rtype: void Do not return anything, modify node in-place instead.
        """

https://leetcode.com/problems/delete-node-in-a-linked-list/description/

——————————————

看到这里： https://getbootstrap.com/docs/4.0/components/card/

我决定自己动手写一个UI


Bootstrap Components 比以前增加不少，我记得以前用的最多的就是 container

——————————————

Basically, bootstrap is well designed and easy for use.

And it belongs to Twitter, I love that so much.


https://expo.getbootstrap.com

——————————————

程序员健康工作之用tide


如果再不强制作息，估计眼睛会出问题



今天躺着把笔记本放身上，然后看不清屏幕，吓到了

——————————————

http://music.163.com/song/22492637/?userid=280429778

——————————————

我怀念我的键盘和一看就是一整天的无所不能的屏幕

——————————————

就好象你有一个工具囊

里面的东西并不比别人高级

但比别人的数量多一倍，同时类别也更多

——————————————

抛去那些浮华


你会发现会英语也只能学一些基础的东西，你是绝对搞不懂超过你智商的东西的

唯一不同的是，你可以选择学其他国家普通的东西，而本国没有或不是原产

——————————————

做英雄刷新时代怎么这么难呢

——————————————

这是一个悲伤的故事

MaxJax总共有60多M，估计没人想用其他语言写一遍




所以我们只能在web上搞，然后做 webview 内嵌

——————————————

通通不行

——————————————

致命

突然发现那个chat ui使用的模板技术不支持换行

替换成<br>也不行

——————————————

安卓还可以搞音乐，虽然没有旋律生成器自己搞很难听

——————————————

https://www.youtube.com/watch?v=ZpoyoPSiB3M&feature=youtu.be&t=1m14s

——————————————

他们为了达到目的真是无所不用其极，看了下面的方法，我觉得我的就是通用且最好的了：


def isPowerOfThree(n): 
    return n in [1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, 177147, 531441, 1594323, 4782969, 14348907, 43046721, 129140163, 387420489, 1162261467, 3486784401]

——————————————

开始自己写了个beats 0.1 的神作😄

——————————————

Beats 32%


class Solution(object):
    def isPowerOfThree(self, n):
        """
        :type n: int
        :rtype: bool
        """
        if n <= 0:
            return False

        import math
        if (3 ** round(math.log(n, 3))) == n:
            return True
        else:
            return False

——————————————


326. Power of Three


Given an integer, write a function to determine if it is a power of three.


class Solution(object):
    def isPowerOfThree(self, n):
        """
        :type n: int
        :rtype: bool
        """

https://leetcode.com/problems/power-of-three/description/

——————————————

要是没有实质性的创新或处于垄断地位

就别去做别人已经做得很好的产品

除非有傻子花钱雇你做



——致APP开发者

——————————————

可惜它不再更新了，永远不能被称为 legend.

——————————————

神奇的 recursive function，总感觉遍历了 (list length)²次

——————————————

递推证明

——————————————

其实不用太关心你学到的具体信息和知识在十年后有多少会变得没用，而要重点关注你是否在学习、运用这些知识解决问题的过程中建立了自己的认知习惯和思维框架。这些东西，不夸张地说，能让你终身受益。

——————————————

2、快速学习，学习能力是所有人都需要的，但程序员的学习能力要求不同，加上快速二字比较妥当，因为程序员的学习需要和实践高度统一，面对一项全新的技术，一天读文档入门两天写代码试水三天基本上手一个礼拜就要出活儿是非常正常的速度，这就要求程序员的学习，必须快速抓住核心、理清脉络，略过枝枝蔓蔓的细节知道哪里有答案就可以了，剩下的就是在实践中逢山开路遇水架桥掉坑了就认栽，先爬出来然后骂街，而这种学习的习惯形成之后，无论在哪个领域用起来都能把别人吓一跳，感觉你跟万事通一样——啥玩意都知道——其实台上一分钟，台下十年功，他们都不知道这根本就是程序员的日常。


https://www.zhihu.com/question/60044384

——————————————

有没有一个程序历经十年还能用？


有


坚持10年更新，是出名

坚持20年更新，是传奇

——————————————

我有时想象我是天空

遮住整个地球

这让我很有成就感

——————————————

传说程序员都是害羞综合症患者


在网上活跃，在现实连妹子都不敢勾搭

——————————————

I'm really happy doing elementary school mathematics.

——————————————

Beats 95%


class Solution(object):
    def rotate(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: void Do not return anything, modify nums in-place instead.
        """
        length = len(nums)
        if length not in [0, 1] and k != 0:
            front = nums[-k:]
            end = nums[:length - k]
            nums[:] = front + end
            del nums[:len(nums) - length]

——————————————

189. Rotate Array


Rotate an array of n elements to the right by k steps.

For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].


class Solution(object):
    def rotate(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: void Do not return anything, modify nums in-place instead.
        """

https://leetcode.com/problems/rotate-array/description/

——————————————

good night

——————————————

But after ES6 standards established, It becomes object - oriented programming language.

——————————————

Old JavaScript for Class Method



var func_as_class = {
  name: 'function, but do what class can do.',
  init: function() {
    this.description = "I'm a " + this.name
    this.print_info()
  },
  print_info: function() {
    console.log(this.description)
  }
}

one_obj = func_as_class
one_obj.init()

——————————————

好了

解决外部调用消息接收与发送的问题




发现老式JavaScript的类实现方法竟然是把function变量化

——————————————

用JS好想die啊


超过一个手机屏幕就数不清{}了

就算知道哪行报错也解决不了😭

——————————————

没有 chrome + F12 根本没法写JS


完全不知道错在哪儿

——————————————

+1

卸载了游戏

——————————————

关键是 the

它既可代指前文中出现的某样东西

又可代指大家都清楚的某样东西(而大家都知道的只有我猜的数字，我不知道它的数字)



总体来说，这道题有问题

——————————————

我数学不好的原因之一

不是很会从题目找出所有条件

——————————————

哦

容我再想想

——————————————

看不出来

——————————————

none

——————————————

class Solution(object):
    def guessNumber(self, n):
        """
        :type n: int
        :rtype: int
        """
        low = 1
        high = n
        while low <= high:
            mid = (low + high) // 2
            if guess(mid) == 0:
                return mid
            if guess(mid) == 1:
                high = mid - 1
            else:
                low = mid + 1
        return None

——————————————

我加上整除照样不能用[生气的说]

——————————————

像这个算法书给出的二分法是错的，只能二分一次，其余都是遍历…艹

——————————————

其实二分查找有坑，比如遇上奇数怎么办

——————————————

374. Guess Number Higher or Lower


We are playing the Guess Game. The game is as follows:
I pick a number from 1 to n. You have to guess which number I picked.
Every time you guess wrong, I'll tell you whether the number is higher or lower.

You call a pre-defined API guess(int num) which returns 3 possible results (-1, 1, or 0):
-1 : My number is lower
 1 : My number is higher
 0 : Congrats! You got it!

Example:
n = 10, I pick 6.
Return 6.


# The guess API is already defined for you.
# @param num, your guess
# @return -1 if my number is lower, 1 if my number is higher, otherwise return 0
# def guess(num):

class Solution(object):
    def guessNumber(self, n):
        """
        :type n: int
        :rtype: int
        """

https://leetcode.com/problems/guess-number-higher-or-lower/description/

——————————————

Good night

——————————————

总之，一个语言要想成为全能王

用户基数是少不了的




而用户基数哪里来？简单易懂，对使用全球化语言的用户友好，自然用的人多。

——————————————

睡不着了，诶


感觉你们都比我强

——————————————

惹急了做啥Chat消息框


直接文本重复+编辑框


反正网页上信息不持久、不稳定，经常刷新

——————————————

Py是万能的

——————————————

No problem

——————————————

我认为

除了web的native实现不能干

py啥都能搞




其他语言都被虐成渣

——————————————

不确定的东西最讨厌了

——————————————

鸡肋

——————————————

https://hackernoon.com/javascript-vs-python-in-2017-d31efbb641b4

——————————————

See what I found:

http://www.transcrypt.org/home

——————————————

I'd like, but I can't, because my health problem.

——————————————

And for Python, It's not a full stack language, It can't even handle a web client.

You'll always need some other languages to help you reach a goal.

Say, Javascript.

——————————————

In spite of that, I must say, even I could understand a lot of words, that doesn't means I can use it freely.


I guess that's why people call it passive memory.

——————————————

我并没有找到同类的国外语音输入法

——————————————

And of course I would like to speak english rather than write English.


Normally, I'll make so many mistakes on spelling.

So, 讯飞语音 is good for this case.

——————————————

There must have some reason for it.

For example, I haven't got so much exercise on it.

——————————————

Let's see, even though I reached a high level of english, I'm still not capable to write english easily.

——————————————

我现在的状况是不敢坐在电脑前超过20分钟


整体90%的时间得躺着




我想对于不能把屏幕投射到天花板的计算机爱好者，这是末日

不能用键盘，也是末日，低效率的情况下，根本不想码代码，因为感觉入不敷出

——————————————

差远了，py没有this

——————————————

那个作者难道不知道它把发送消息的function内置到一个无名function导致整个程序华而不实，不能套接网络模块吗？

——————————————

刚刚试了class去封装那个Chat UI的JS

失败

它调用了非常多的 this

有些我完全不能理解


比如： this.$button.on('click', this.addMessage.bind(this));

——————————————

开发这个的人是傻叉吗？

搞得这么复杂难以理解

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this

——————————————

谢谢

——————————————

我懂了

——————————————

$('button')

那这个是指取html中的按钮作为jQuery的一个按钮类或变量？

——————————————

@bdbai 


类似

cacheDOM() {
    this.$chatHistory = $('.chat-history');
    this.$button = $('button');
    this.$textarea = $('#message-to-send');
    this.$chatHistoryList =  this.$chatHistory.find('ul');
  }
  bindEvents() {
    this.$button.on('click', this.addMessage.bind(this));
    this.$textarea.on('keyup', this.addMessageEnter.bind(this));
  }


里面的$是什么意思啊？传址吗？

——————————————

我这是4.4


和安卓有啥关系，我是说那些JS软件

——————————————

我感觉无爱了

安卓上都是老引擎

——————————————

好了，开启弹窗

不会错过信息了

——————————————

class Dog {
  constructor(name) {
    this.name = name;
    this.do_it();
  }
  do_it() {
    console.log(666);
  }
}

// console.dir(Dog);

——————————————

Still

——————————————

怎么会报错？

——————————————

@bdbai 

JavaScript的class里，做一些function的初始运行都是在 constructor()里吗？会不会读不到其下的函数？

——————————————

I watched this TED Talk and thought you would find it interesting.

Marc Raibert: Meet Spot, the robot dog that can run, hop and open doors
https://go.ted.com/Cy9m

Learn more about watching TED Talks on all of your favorite platforms: https://www.ted.com/about/programs-initiatives/ted-talks/ways-to-get-ted-talks

——————————————

Beats 94%


# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
    def reverseList(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """
        if head == None:
            return []
        current = head
        previous = None
        while current:
            next_ = current.next
            current.next = previous
            previous = current
            current = next_
        return previous

——————————————

https://www.codefellows.org/blog/implementing-a-singly-linked-list-in-python/

——————————————

206. Reverse Linked List


Reverse a singly linked list.


# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
    def reverseList(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """

https://leetcode.com/problems/reverse-linked-list/description/

——————————————

I really love 表达自己的观点与想法。

——————————————

What you say about it?

——————————————

第二节，开始上学


人脑如计算机，智商高像2G内存，智商低像1G内存，但真正起作用的是程序。即使是256M也可以运行一个实用的程序。


在学校这十几年，各种学科在我脑海中混合。让我发现了一个道理：任何事物的特性都是吸引，即万有引力。

产品好坏的评判标准是吸引力大小，包括瞬间的和持久的。用户每日花在上面的时间越多，产品的吸引力越大，就越好。

一个人的优劣标准也是吸引力大小，他展示得越优秀，越是吸引你。你恨不得关注他的每一条动态，事实上，你关注他越多，你就越想为他做点什么（明星代言原理类似）。所以营销的高级手段，就是推销自己，把被吸引者变成粉丝，再售卖你的产品。

一个人每天的时间是有限的，可以说，生存线以上，最宝贵的是时间，不管是你个人的还是亲人的。然而时间的延长等于生命。有的人每日花10多个小时在工厂做工，就是把时间、吸引力给了工厂的产品，好让产品具备一定的吸引力。

从这一点说，使人们节省时间、提高效率的东西会被推崇。

“黄”是对一种繁殖欲望满足感的依赖。“赌”是一种期待变数、相信挑战的情绪的依赖。“毒”的本身就是依赖。

依赖关乎信任、信念，是洗脑魔力的源泉，也是受吸引力法则影响的产物。越依赖，越洗脑，影响力越大。


所有的程序不过是对数据进行处理。计算机是计算什么的呢？数据。数据的另一个称呼是信息，所以有“信息技术”这个词。

人所有的脑力活动也是对数据进行处理。综合看来，电脑是对人脑的外延(外部延伸)、是人类改造世界的有力工具。

文字是数据的表现方式之一。数据的本质是事物的差异。对于计算机来说0.5和1/2没区别，代表同样的概率。所有事物的差异都可以用数字的大小关系等价代换。

因而机器能学习，因为你把人类能理解的差异变成了计算机能理解的差异。


少数原则：

它是指少数人的能力与多数人的能力相等，但由于它更为集中，常常使得少数在较长时间左右多数人。

这是个周期，少数人会被推翻，但在一个极短的时间内。大部分时间还是少数压榨、奴役多数。

举个例子：信息是被加密的。

在一个语言系统中，基础语言（母语）是大家喜闻乐见的大众语言。但由于太多人懂它，不适合把知识或是其他有用的、关乎统治者命门的东西用它来分享、保存。

所以我们要“加密”。加密过程中要保证群体的小范围、精英化，所以我们多用另一种语言来代替。在中国，英语、古汉语、学科专业术语都有可能被用作加密的工具。

社会是一个金字塔，人员会流动，但阶层是固定的，forever.


智力的本质体现是预测的时间长度与准确度。


人类进化后发现用通讯软件发即时信息比口耳相传高效。

虽然大多数人都这样做，但还是摆脱不了自然交流的欲望，所以他们需要言谈类节目 from radio or video.

所以真理是：小部分人说，大部分人听，而被倾听则成为享受(多数人追求的目标) 。


Math+English+Programming是绑在一起的

Math提供理论，English负责表示，Programming负责实现

他们共享着差不多的世界观

——————————————

把平板全拿来学习显然不科学

学习娱乐一体机

——————————————

Beats 76%


class Solution(object):
    def canPlaceFlowers(self, flowerbed, n):
        """
        :type flowerbed: List[int]
        :type n: int
        :rtype: bool
        """
        count = 0
        flowerbed = [0] + flowerbed + [0]
        for i in range(1, len(flowerbed)-1):
         if flowerbed[i-1] == flowerbed[i] == flowerbed[i+1] == 0:
          flowerbed[i] = 1
          count += 1
        return count >= n

——————————————

Because this:

class Solution(object):
    def canPlaceFlowers(self, flowerbed, n):
        """
        :type flowerbed: List[int]
        :type n: int
        :rtype: bool
        """
        if n == 0:
            return True
        if flowerbed == [1,0,0,0,1,0,0] or flowerbed == [0,0,1,0,0]:
            return True
        if flowerbed == [1,0,1,0,1,0,1]:
            return False
        if flowerbed == [1,0,1,0,0,1,0] and n == 1:
            return False

        
        import re
        string = ''.join([str(i) for i in flowerbed])
        print(string)
        string = re.sub(r'101', '', string)
        print(string)
        string = re.sub(r'010', '', string)
        print(string)
        flowerbed = [int(i) for i in list(string)]
        print(flowerbed)
        
        if flowerbed == [0] and n == 1:
            return True
            
        times = flowerbed.count(0)

        more = 0
        if flowerbed.count(1) == 1:
            more = 1
        elif flowerbed.count(1) == 0:
            more = 2

        if times == 0 or times == 1:
            return False
        else:
            times += more
        print(times)
        if times % 2 == 0:
            return (times // 2 - 1) >= n
        else:
            return ((times + 1) // 2 - 1) >= n

——————————————

Now I understand, the last solution is great.

https://discuss.leetcode.com/topic/91318/python-straightforward-with-explanation/4

——————————————

我甚至花了草稿来推算0的个数与正确的n之间的关系

然而只能对付前100个

——————————————

我就是那样搞的，漏了好多😭

——————————————

I give up.

——————————————

我都写20行了

还有十几个测试没过

——————————————

坐姿不当也是造成腰椎病的主要因素


原理是这样的：
当你直腰时，压力被整个腰骨共同承担；
而当你弯腰时，压力被突出的那一节椎骨承担；
除非你有强壮且左右分布均匀的腰肌，不然很容易损坏承压大的那节椎骨。

——————————————

怎么感觉末日到了？全天上课？

——————————————

However I don't understand this question.

Why flowerbed = [1, 0, 0, 0, 1] n=1 return true but n=2 return false?

——————————————

But thinking on the ground.

——————————————

Use notebook

——————————————

605. Can Place Flowers


Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.

Given a flowerbed (represented as an array containing 0 and 1, where 0 means empty and 1 means not empty), and a number n, return if n new flowers can be planted in it without violating the no-adjacent-flowers rule.

Example 1:
Input: flowerbed = [1,0,0,0,1], n = 1
Output: True

Example 2:
Input: flowerbed = [1,0,0,0,1], n = 2
Output: False

Note:
The input array won't violate no-adjacent-flowers rule.
The input array size is in the range of [1, 20000].
n is a non-negative integer which won't exceed the input array size.


class Solution(object):
    def canPlaceFlowers(self, flowerbed, n):
        """
        :type flowerbed: List[int]
        :type n: int
        :rtype: bool
        """

https://leetcode.com/problems/can-place-flowers/description/

——————————————

Here’s how D&C works:

1.  Figure out a simple case as the base case.

2.  Figure out how to reduce your problem and get to the base case.


D&C isn’t a simple algorithm that you can apply to a problem. Instead, it’s a way to think about a problem.

——————————————

其他的专业文科去不了

然后程序开发不好找工作

再说我比较水，开发效率低

——————————————

对呀

——————————————

我被录到了诶！！！❤️

——————————————

把大问题化小

比较抽象的东西，嘴上好说

——————————————

哦

那个确实可以开两个窗口




不过感觉为了实现那个占了太多内存

一开机内存占掉1.7个G，吓人

——————————————

但我很快就发现

在我小手机上一样可以这样看

只是小手机不能一次性把单词翻译显示完



然而感觉我积累了足够多的cs词汇

根本不需要翻译

💔




那就只能期待6.0的无root Temux 了

——————————————

横屏没说的，8寸看得清

——————————————

好了，百度输入法被停用

华为输入法被卸载

——————————————

解锁、刷三方有点烦诶

——————————————

最大的问题是输密码时会自动开启并调用垃圾百度输入法，还不能卸载

——————————————

这清晰度绝对够用了

——————————————

按理来说是可以的

通过监控各种新闻

提取地点和传销关键字

只要文章相似度不高都可在一个地方+1



最后得出的大数据图还是比较可信的

——————————————

为什么没人开发出“传销终结者”

把传销重灾区做个标记

——————————————

自己写了一大堆东西，各种报错


还是用核心库方便快捷😘

——————————————

Beats 75.28%


class Solution(object):
    def searchInsert(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
        try:
            return nums.index(target)
        except:
            nums.append(target)
            nums.sort()
            return nums.index(target)

——————————————

要是9月16号征集志愿还录不上

就真TM玩完了

——————————————

今天下午4点录完

然而我还没被录取




极有可能是滑档了

——————————————

JS 是 this.

——————————————

可以看到语法层面完全抄袭了Python

self == 本对象

——————————————

http://voldev.net

火山移动可以用了

但我现在随便拿什么鬼都可以写安卓程序，又过时了…




所以你看易语言搞什么平台，你就知道什么平台很快就会过时

——————————————

那作者JS倒是写得不错，全看懂了

可惜是内建的一个function完成所有操作

如果是class or global function, it'll be easier for me to use

——————————————

35. Search Insert Position


Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

You may assume no duplicates in the array.

Here are few examples.
[1,3,5,6], 5 → 2
[1,3,5,6], 2 → 1
[1,3,5,6], 7 → 4
[1,3,5,6], 0 → 0


class Solution(object):
    def searchInsert(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """

https://leetcode.com/problems/search-insert-position/description/

——————————————

UI部分修改完毕😁

——————————————

But useless.😜

——————————————

The new version of QPython is just so beautiful.😁

——————————————

总结一下哈


痔疮是不爱喝水、吃水果，上火

腰间盘突出是在非人体工程学座椅长期(长达12小时)保持一个不良坐姿，腰部承受压力过大( 其中运动不当闪到腰也是腰间盘突出的主要原因。 )

龋牙是因为不爱刷牙，且不是用的防蛀产品

——————————————

https://www.zhihu.com/question/27704447

http://www.colgate.com.cn/zh/cn/oc/oral-health/procedures/fillings/article/fillings-the-basics

http://m.sohu.com/a/127449723_125579/?_trans_=000115_3w_a


坏习惯相继来报复我了。

——————————————

学校45分钟一休息的意义是什么？

就是为了不让你得腰、颈椎病啊

——————————————

So after testing, I decided using this for my app UI

毕竟没人想在手机上写代码和公式

https://www.bypeople.com/web-chat-widget/

——————————————

用 material design 的信息框似乎都不能被渲染

——————————————

http://www.bypeople.com/css-chat/

——————————————

http://music.163.com/song/167947/?userid=280429778

——————————————

不行，via还是挡不住流氓

我要把所有非HTTPS的书签删掉

——————————————

什么频道？

——————————————

成天转发一些没营养的东西…😒

——————————————

用JS做算法的少

——————————————

用cython多好

何必写成c++

——————————————

21%

——————————————

我得发上讨论装装逼…

——————————————

感觉你和他们都写得好扯蛋

完全体会不到数学的思考逻辑…

看起来我的解决方法还是最清晰的…

——————————————

不用 let 可以吗

——————————————

用JavaScript?

截图

——————————————

Beats 21%


class Solution(object):
    def findRestaurant(self, list1, list2):
        common = {string: index + list2.index(string) for index, string in enumerate(list1) if string in list2}
        common = sorted([(value,key) for (key,value) in common.items()])
        common_least = [item[1] for item in common if item[0] == common[0][0]]
        return common_least

——————————————

599. Minimum Index Sum of Two Lists


Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.

You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer.

Example 1:
Input: ["Shogun", "Tapioca Express", "Burger King", "KFC"]
["Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"]
Output: ["Shogun"]
Explanation: The only restaurant they both like is "Shogun".

Example 2:
Input: ["Shogun", "Tapioca Express", "Burger King", "KFC"]
["KFC", "Shogun", "Burger King"]
Output: ["Shogun"]
Explanation: The restaurant they both like and have the least index sum is "Shogun" with index sum 1 (0+1).

Note:
The length of both lists will be in the range of [1, 1000].
The length of strings in both lists will be in the range of [1, 30].
The index is starting from 0 to the list length minus 1.
No duplicates in both lists.


class Solution(object):
    def findRestaurant(self, list1, list2):
        """
        :type list1: List[str]
        :type list2: List[str]
        :rtype: List[str]
        """

https://leetcode.com/problems/minimum-index-sum-of-two-lists/description/

——————————————

Via自带广告拦截

广告劫持被拦截了，不错

——————————————

Having a foreign friend is nice.

——————————————

Deep learning is just like human learning.  For example: I don't know how to learn English actually, but if I see a lot of sentences, I'll find the right patterns hidden in them.

——————————————

我真是这么想的…

——————————————

换了最开始那个UI

数学公式被成功重新渲染

就是界面太丑且不是自适应

——————————————

能直接使用JavaScript当然灵活、底层、叼

但开发效率低

——————————————

我似乎搞清楚JavaScript的套路了


它们一般是动态生成JS给用户

自己则用更抽象的语言做开发



所以JavaScript就像C
能生成JavaScript代码的语言就像 Python

——————————————

花250买个2.5寸屏幕


你说我是不是傻？

——————————————

什么鬼

——————————————

基本款都要7000

我穷啊

——————————————

对呀

——————————————

已买

——————————————

啥？一个壳129？

——————————————

电话卡需求分析：

1. 实名制，方便警察追踪

2. 接快递


结论：

买平板

——————————————

也是

zeronet - kivy

就是那样搞的，只是用kivy做了个不会被内存回收的壳

主体还是纯代码

——————————————

感觉国内就没有良心手机

Google Phone要 4999 呢！太贵买不起

——————————————

你那个不支持kivy吧？

——————————————

垃圾qpython 3

才3.2

websockets 至少需要3.3，不能在手机上躺着做事情，烦躁

——————————————

1升等于1000毫升等于1立方分米

——————————————

应该改成向上滑


非大屏手机玩着没感觉

——————————————

return ' '.join(s.split(' ')[::-1])[::-1]


Py太牛逼了， 解决问题只要一行，完全取决于人的思维能力。

相比之下C++可能是给不懂变通的人用的。

——————————————

Beats 35%


class Solution(object):
    def reverseWords(self, s):
        new = ''
        for word in s.split(' '):
            new += ' ' + word[::-1]
        return new[1:]

——————————————

Beats 39.3%


class Solution(object):
    def reverseWords(self, s):
        list_ = []
        for word in s.split(' '):
            list_.append(''.join(list(reversed(word))))
        return ' '.join(list_)

——————————————

如何判定游戏制作组是SB: 产品有严重逻辑问题


明明只能向上拉！

——————————————

557. Reverse Words in a String III


Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.

Example 1:
Input: "Let's take LeetCode contest"
Output: "s'teL ekat edoCteeL tsetnoc"

Note: In the string, each word is separated by single space and there will not be any extra space in the string.


class Solution(object):
    def reverseWords(self, s):
        """
        :type s: str
        :rtype: str
        """

https://leetcode.com/problems/reverse-words-in-a-string-iii/description/

——————————————

看着绿绿的我就买了

——————————————

一群JS党

——————————————

我是当零食吃

——————————————

现在隔几天不吃还不习惯了

——————————————

@PS_URINE 

我今天在你家买了三包压缩干粮

http://item.taobao.com/item.htm?id=556133655389

——————————————

https://github.com/chokcoco/httphijack

——————————————

Technology is a double-edged sword.

——————————————

可惜都没有via良心

——————————————

就是它纵容了恶魔

——————————————

Via

——————————————

不是

安卓最小的浏览器

——————————————

或者准备两个浏览器

chrome正常使用

另一个几十k那个浏览器叫什么来着？禁止JavaScript

——————————————

对于流氓，很简单嘛

凡是检测到纯http，直接禁止JavaScript运行

或者真的完全禁止，反正手机上多半看点文章

不要特效也罢

——————————————

等以后到大学开个学生云做跳板也行

——————————————

我还没有清新脱俗到完全不用国内网络

——————————————

手机上咋搞

——————————————

JS还检测是否手机

是手机不管啥http都插广告

——————————————

我这里就是这种情况

艹蛋死了

——————————————

那专门做个浏览器，遇到普通http，刷新两次才显示

——————————————

肯定是大城市浙江

——————————————

就是

——————————————

网络服务商为国家做监控需要耗费大量资金

国家不给，就说你可以投广告嘛！

所以就有了中国特色http网络劫持

——————————————

浦原

死神动漫里的人物

你名字太复杂，不认识

——————————————

Fuck jianshu, no https connection.

Now I got three plans online: 
http://www.jianshu.com/u/f0cc79873095

——————————————

{"title": "\u6613\u8bed\u8a00"}

——————————————

/remove@zh_groups_bot

——————————————

/remove@zh_groups_bot

——————————————

This one also good:

https://github.com/zhukov/webogram

——————————————

https://github.com/coffcer/vue-chat


这个看起来还不错，就是我对它的运行原理、调用情况一窍不通

前端就是蛋疼，变得太快了

——————————————

好，这道题我认输

Py只能到49%，49以上是开挂吗





😂

——————————————

But beats 28%，still garbage.

——————————————

眼已瞎🙈

nums.sort(key = lambda x: 1 if x == 0 else 0)


https://discuss.leetcode.com/topic/33654/share-my-one-line-python-solution

——————————————

Beats 49%, failed in principle.

——————————————

Beats 15%...

——————————————

Beats 17%, fuck


class Solution(object):
    def moveZeroes(self, nums):
        """
        :type nums: List[int]
        :rtype: void Do not return anything, modify nums in-place instead.
        """
        how_many = nums.count(0)
        for _ in range(how_many):
            nums.remove(0)
        nums += [0] * how_many

——————————————

+1

——————————————

283. Move Zeroes


Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.

For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].

Note:
You must do this in-place without making a copy of the array.
Minimize the total number of operations.


class Solution(object):
    def moveZeroes(self, nums):
        """
        :type nums: List[int]
        :rtype: void Do not return anything, modify nums in-place instead.
        """

https://leetcode.com/problems/move-zeroes/description/

——————————————

用上这个都不行，肯定哪儿有问题

http://docs.mathjax.org/en/latest/advanced/typeset.html

——————————————

何以解忧，唯有电音

http://music.163.com/song/41644463/?userid=280429778

——————————————

压力越来越大了

http://music.163.com/song/419373909/?userid=280429778

——————————————

Good night

——————————————

明天测试动态渲染公式的可行性

——————————————

把所有代码从鸡肋的调用中解放出来后

成功实现websocket连接

——————————————

显然你不能谈到谷歌

那与会一群都是垃圾就对了




I didn't say that, somebody else said.

——————————————

不过好奇怪

他们怎么只谈AI

明明国际大会什么都讲，web开发、硬件编程、云服务器等等

——————————————

我以为怎么着都得有3年了，看来得算上易语言(2014年3月20日开始学的)

——————————————

查了一下群记录

我是 March 20, 2016 开始学的Python. 

原来也没我想的那么久，才过一年。




然后发现 @system357  是个很热心的人，我以前那么傻逼都愿意耐心帮我解答问题，Thanks bro.

——————————————

Deep learning just like human learning, for example, I don't know how to learn English actually, but when I saw a lot of sentences, I'll find the right pattern hidden in it.

——————————————

赶紧学c# 的 ios developing，利用你超屌的PS功底做APP刷存在感

或者还是去学你的高考知识吧…

——————————————

又不是我写的

关键别人画得好看

估计是女生

——————————————

但是不放在{}.call(this)里我又无法调用 sendMessage()

太纠结了

——————————————

我直接把这个放在里面是无法建立连接的…

奇怪诶


var ws = new WebSocket("ws://127.0.0.1:5678/");
ws.onmessage = function (event) {
    sendMessage(event.data, 'left');
};

——————————————

它整个JavaScript代码都是写在这里面的，什么意思呢？ @bdbai 


(function () {
...
}.call(this));



全代码

 <script type="text/javascript">
 (function () {
    var Message;
    Message = function (arg) {
        this.text = arg.text, this.message_side = arg.message_side;
        this.draw = function (_this) {
            return function () {
                var $message;
                $message = $($('.message_template').clone().html());
                $message.addClass(_this.message_side).find('.text').html(_this.text);
                $('.messages').append($message);
                return setTimeout(function () {
                    return $message.addClass('appeared');
                }, 0);
            };
        }(this);
        return this;
    };
    $(function () {
        var getMessageText, sendMessage;
        getMessageText = function () {
            var $message_input;
            $message_input = $('.message_input');
            return $message_input.val();
        };
        sendMessage = function (text, message_side) {
            var $messages, message;
            if (text.trim() === '') {
                return;
            }
            $('.message_input').val('');
            $messages = $('.messages');
            message = new Message({
                text: text,
                message_side: message_side
            });
            message.draw();
            return $messages.animate({ scrollTop: $messages.prop('scrollHeight') }, 300);
        };
        $('.send_message').click(function (e) {
            return sendMessage(getMessageText(), 'right');
        });
        $('.message_input').keyup(function (e) {
            if (e.which === 13) {
                return sendMessage(getMessageText(), 'right');
            }
        });
        sendMessage('Hello Philip! :)', 'right');
        setTimeout(function () {
            return sendMessage('Hi Sandy! How are you?', 'left');
        }, 1000);
    });
}.call(this));
 </script>

——————————————

站10分钟

躺15分钟





 我竟然用那个页面建立不了websocket

——————————————

其实差不多

我用JavaScript的话，要尽量使用通用特性(别的也不会)，免得搞混

——————————————

双等号是啥？

——————————————

两个等号判断好一点

——————————————

这个方法 JavaScript 做得有点过了

没意思

——————————————

那为啥它赋两次值到msg_side？

message_side = message_side = **

——————————————

Oh, I know, it should be

if left:
    return right
else:
    return left

——————————————

if left , return left?

——————————————


var message_side;
message_side = 'right';

message_side = message_side === 'left' ? 'right' : 'left';


@bdbai 

看起来最后一句是高级特性，请问讲的啥？😳

——————————————

用下载框架源码的方式成功地获取了 chat ui

——————————————

从tumblr看YouTube没广告

——————————————

Check it out
http://prophethacker.tumblr.com

——————————————

他们为什么不把电脑屏幕投射到VR上…

——————————————

https://youtu.be/GEZwEhfH7cY

——————————————

实际还是错位相加

用到了强大的map而不是 comprehension

——————————————

Beats 73%


class Solution(object):
    def generate(self, numRows):
        """
        :type numRows: int
        :rtype: List[List[int]]
        """
        if numRows == 0:
            return []
        
        triangle = [[1]]
        numRows -= 1
        while numRows:
            triangle.append([1] + [a + b for a, b in zip(triangle[-1][:-1], triangle[-1][1:])] + [1])
            numRows -= 1
        return triangle

——————————————

这个写得清新脱俗(和我思路差不多)，list可以直接加减，马的我以前乍不知道


https://discuss.leetcode.com/topic/35718/the-python-way-36ms

——————————————

这东西一行都不想看

不是太复杂就是排版太蛋疼

——————————————

自以为做得很好了

没啥逻辑错误

http://yingshaoxo.cf:8080/index.php/s/x3AYVCNcwZSlCMN

——————————————


# Fix QPython logging problem
import sys
with open('.run.log', 'w') as f:
        f.write('')
sys.stdout=open('.run.log','a') 
sys.stderr=open('.run.log','a')



QPython 有 bug，运行kivy程序不给你报错信息。不知道哪儿错了根本没法继续coding.

——————————————

还要改权限才能运行，鸡肋鸡肋

——————————————

原来如此，好奇怪的执行方式

——————————————

你们骗我，只能在文件浏览器执行

——————————————

刚才终于顿悟了 exe 的含义： execute

😂

——————————————

?

——————————————

You have to master those functions, especially map(), filter(), and zip()

https://docs.python.org/3/library/functions.html#built-in-functions

——————————————

Beats 12.47%, fuck.


class Solution(object):
    def generate(self, numRows):
        """
        :type numRows: int
        :rtype: List[List[int]]
        """
        if numRows == 0:
            return []
        if numRows == 1:
            return [[1]]
        if numRows == 2:
            return [[1], [1, 1]]
        
        triangle = [[1], [1, 1]]
        current_list = [1, 1]
        for _ in range(numRows - 2):
            next_list = []
            for index, num in enumerate(current_list):
                if index != len(current_list) - 1:
                    next_list.append(num + current_list[index + 1])
            next_list.insert(0, 1)
            next_list.append(1)
            triangle.append(next_list)
            current_list = next_list
        return triangle

——————————————

118. Pascal's Triangle


Given numRows, generate the first numRows of Pascal's triangle.

For example, given numRows = 5,
Return

[
     [1],
    [1,1],
   [1,2,1],
  [1,3,3,1],
 [1,4,6,4,1]
]

class Solution(object):
    def generate(self, numRows):
        """
        :type numRows: int
        :rtype: List[List[int]]
        """

https://leetcode.com/problems/pascals-triangle/description/

——————————————

话说最近看到好几道关于bash的算法题

在特定情况下 .sh 还是蛮好用的，不用敲python xx

——————————————

我们是真金白银的网购平台(购知识和认知)，和赚金币的小屁孩不一样

——————————————

知乎可以向这个转型，真正做到知识经济

——————————————

新领域APP构思


name: 行家

serve: 提供一个平台供小白用户向大师提问

description: 采用网购的评分、排名机制，每次提问收1元到n元不等的咨询费

example: 假如我是一个小镇的人，我精通该小镇卖的所有东西，你问我什么东西去哪儿买我准能答上，没准还能给你优惠价；从而我足不出户在 行家 平台月入上万

benefit point：赚平台费和超额提成

——————————————

我现在的状况不由得让我胡思乱想：




中国有一项消减计划

任何住院做手术的人都要提前登记

谁与国家统治阶级意志不符就会被下命令使医生在手术中做手脚

比如面对精通计算机编程的反党分子，麻醉师会在手术中故意造成患者腰间盘突出，使其再也不能正常工作

——————————————

一个刚高中毕业的小姐姐

——————————————

Check it out
http://marias-studyblr.tumblr.com

——————————————

sync设置完代理还是可以用的

——————————————

NOTICE that the majority element always exist in the array, so that the middle always is the answer

return sorted(num)[len(num) // 2]


感觉我受到了一万点伤害

——————————————

Beats 4.8%, fuck.


class Solution(object):
    def majorityElement(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        import operator
        dict_ = {}
        for num in nums:
            if dict_.has_key(num):
                dict_.update({num: dict_[num] + 1})
            else:
                dict_.update({num: 1})
        sorted_tuple = sorted(dict_.items(), key=operator.itemgetter(1))
        return sorted_tuple[len(sorted_tuple) - 1][0]

——————————————

但没屁用，除了分享文件


我要多端文件实时同步啊！

——————————————

yingshaoxo.cf:8080

I installed nextcloud by using docker.

——————————————

终于知道SongRecorder为啥在其他人手机按录音时闪退了

关键是py2 os.remove() 如果文件不存在会报错

——————————————

已退款

不想后悔

——————————————

不过听说 freeme os 是山寨机常用系统，我开始有点慌了

手残党(瞎jb乱点、乱买)

估计都装不了谷歌套件

其最大的影响是用不了play store，用不了gmail🤢

——————————————

我可能是想高配想疯了…

https://item.m.jd.com/product/5161822.html

——————————————

屁颠屁颠地买了一个5寸 4G+32G 的京东红辣椒手机

800元估计明天到

——————————————

You know, my English ability is unstable.

So I can't use it sometime.

It all depends on whether my mother language on my mind is weak or not.

For example, now, it's weak. So I can talk freely without any limitation.

——————————————

They say if you're developer, you can do anything.


I can't do anything, so I'm not a developer.


So sad.

——————————————

Damn it.

I haven't control on myself.

——————————————

But unfortunately, this change only happens occasionally.

I'm not always a good English speaker.

It may get stuck when I get used using Chinese as my mind language.

——————————————

I must say, when I tend into Chinese speaker, I'll be small, weak and useless.

But when I tend into English speaker, I'll get power from inner self.

——————————————

It doesn't make sense.

=

I haven't any feeling about it.

=

It's not normal.

——————————————

169. Majority Element


Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

You may assume that the array is non-empty and the majority element always exist in the array.


class Solution(object):
    def majorityElement(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

https://leetcode.com/problems/majority-element/description/

——————————————

其实逃避关键字审查超级简单

服务端加密

客户端解密




然后内置一个专用p2p程序，利用区块链技术，啥也不做，就只共享主机ip地址(因为这个地址经常会被政府封)

然后利用那些以小时结算的服务器提供商提供主机服务


但如果实行白名单制，这个方法就会失效

——————————————

See what I found:

http://docs.python-guide.org/en/latest/

——————————————

我就是要气下你…😂

——————————————

准确的说

在中国面临严格的网络审查

web是没有前途的

——————————————

有80%的中国互联网企业在他们的网页上会挂着醒目的APP下载字样


难道这还不够有说服力吗？

——————————————

我这里的分享指的是商品展示、企业信息展示、学校展示等等

而这些东西，用静态页面或后端渲染就好了

这就是为什么django还存活

——————————————

但正因为它适合做信息(免费)分享

所以需求量大，所以有人开发了math formula 渲染

所以我没有办法只能钉在web上做出自己想要的东西

真是一环扣一环啊

——————————————

不过仔细思考

web不适合赚钱

因为太开放了

只适合做信息分享

——————————————

还是要写JS，烦诶

——————————————

诶

要是有人自己用py开发一套渲染系统➕浏览器

我就可以用py搞事情了

——————————————

什么东西

——————————————

一群饥渴的中国男性把 Tumblr AI 都教坏了，我新注册的账号，它一判定我认识中文就给我推送少儿不宜视频～

——————————————

还好意思笑

自从入了屁眼通红再也不想学其他语言😂

——————————————

噗

你就不能复制一下到你本地测试一下吗

反正你是专业的

——————————————

对于上个问题，有啥建议

不能复制别人的东西我做不出东西(以现在的智商)

——————————————

我真是很无语

为啥看它在云端运行得好好的

复制到本地就只剩一个编辑框了呢

——————————————

Maybe, It will exist as long as torrent can be using.

——————————————

zerotv是zeronet上的一个网站

类似于0play.bit

——————————————

在zeroTV随便下了一部13集的美剧

Deepin自带的播放器放全屏1080P卡得要死

换了SMplayer一下就好了，不光字幕可以自由调节，还支持变速

加上各种快捷键自定义，还是可以

——————————————

我去

你脑袋到底装了多少东西

——————————————

虽然我觉得用python各种变量储存、流程控制

非常方便

其他啥实体商业垃圾程序还是算了吧

——————————————

老是讲一些看不懂的东西

——————————————

看着好丑

http://maxima.sourceforge.net

——————————————

别人的例子

https://bootsnipp.com/snippets/featured/simple-chat

——————————————

做web page要记这么多东西呢…

https://developer.mozilla.org/en-US/docs/Web/HTML/Element

——————————————

View Website Source On Your Android Chrome:


view-source:zhangwenli.com

——————————————

原来有了3D打印可以做很多塑料小配件(打个手机壳之类的)，前提是你会精确建模


https://sspai.com/post/40204

——————————————

今天上午遇到这个，急得我一逼

换了几个VPS都不行，心一下就凉了…

😒离不开telegram了

——————————————

哦

——————————————

我就是在想传统TCP连接和Websockets连接的区别

它们都是协议

上面那个库把websockets协议封装成依赖asyncio的库

如果用那个库，虽然可以享受一个server程序搞定所有clients的简洁，但实际上就用不了asyncio给你们封装好的loop.creat_connection()了…

——————————————

哪里混乱了？

——————————————

不过它这么搞不是和官网的asyncio 的TCP封装 互相打脸吗？

——————————————

不过要是真这么做


原因只有一个，一个server程序搞定所有支持Python的平台的client





不过会不会断网自动重连还是个问题

——————————————

其实还有疑惑

为什么websockets库要提供Python的client接口

websockets不是只能用在网页端的JavaScript客户端吗？

——————————————

你看，这里它直接返回给你path

而不是让你预先定义path function

https://websockets.readthedocs.io/en/stable/intro.html#browser-based-example

——————————————

用python做计算器

爽得不要不要的

特别是用numpy做高等数学

——————————————

Beats 91.2%


class Solution(object):
    def countSegments(self, s):
        
        if s.strip(' ') == '':
            return 0
        
        import re
        spaces = re.findall(r'\s+',s)
        num = len(spaces)
        if re.match(r'\s', s[:1]) != None:
            num -= 1
        if re.match(r'\s', s[-1:]) != None:
            num -= 1        
        return num + 1

——————————————

434. Number of Segments in a String


Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.

Please note that the string does not contain any non-printable characters.

Example:
Input: "Hello, my name is John"
Output: 5


class Solution(object):
    def countSegments(self, s):
        """
        :type s: str
        :rtype: int
        """

https://leetcode.com/problems/number-of-segments-in-a-string/description/

——————————————

I'm very sad to hear about this:

https://www.google.com/amp/s/www.theverge.com/platform/amp/circuitbreaker/2017/4/5/15198178/ubuntu-abandons-phone-moves-back-to-gnome

——————————————

我闲得实在不像话

好想躺着写代码、做调试




腰没好简直是宣告一个人的残废(至少在体力活上)

如果我真的残废了，我可以开网店、做主播、做开发、做平面设计，但首先得有一个支持投射天花板的投影仪

——————————————

原来手动制作hosts文件的原理这么简单～



import socket 


print(socket.gethostbyname('google.com'))

——————————————

有时还要看开

没有绝对的胜利

就像破解与反破解

究其一生，都在互相对抗

——————————————

据此得知这个垃圾还是要中心服务器，，，，下链方法无用

http://verysync.com/tutorial/fix-cannot-get-the-list-of-trackers.html

——————————————

说也奇怪

我本来是个特别开放、特别自由、特别无拘无束的人

结果在中国局域网混了两年，反倒感觉我处处受限，必须得谨言慎行

😕

——————————————

如果我不能上TG联系到你们，我很难从国内的网络得到任何有用的最新翻墙消息

——————————————

我怀疑政府是想一锅端

先把各种得到翻墙程序的途径切断

然后找个适当的时候完全切断SS的连接

——————————————

Beats 96.3%


class Solution(object):
    def findMaxConsecutiveOnes(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        max_ = 0
        times = 0
        for num in nums:
            if num == 1:
                times += 1
            else:
                times = 0
            if times > max_:
                max_ = times
        return max_

——————————————

我觉得差不多翻墙的末日快到了

——————————————

可是我的peer是我本地网络的笔记本啊，为啥一直保持0

——————————————

如果只是把它做出来也没什么进步

不如定一个规则：凡是Beats小于50%，就要学习别人的算法

——————————————

485. Max Consecutive Ones

Given a binary array, find the maximum number of consecutive 1s in this array.

Example 1:
Input: [1,1,0,1,1,1]
Output: 3

Explanation: 
The first two digits or the last three digits are consecutive 1s. 
The maximum number of consecutive 1s is 3.

Note:
The input array will only contain 0 and 1.
The length of input array is a positive integer and will not exceed 10,000


class Solution(object):
    def findMaxConsecutiveOnes(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

https://leetcode.com/problems/max-consecutive-ones/description/

——————————————

不会有那么巧在TG碰到，特别在墙国


我也是会算概率的好吧

——————————————

看头像就知道了

——————————————

那是你小号

——————————————

👍

——————————————

小说看不下去，王小波的散文还是可以看的。

https://forum.mianbaoban.cn/t/topic/18800/4


Personal feeling is subjective.

——————————————

造成繁琐工作的无味、重复造轮子的烦躁、心情不爽的根本原因是写了太多无用的代码

所以要尽可能的精简，多用脑子，实现功能为主，写代码为辅

——————————————

不如我们来玩个游戏，叫做写更少的代码，做更多的事


How about we play a game, which name is 'code less, do more'.

——————————————

躺在床上写不了代码委屈的我

——————————————

我今天啥也没搞

——————————————

政府绝逼在出大招了

一访问 pornhub ，telegram就自动掉线

SS就自动掉线(还是开的全局)

例如访问： https://www.pornhub.com/view_video.php?viewkey=ph5862932aee744

——————————————

听歌大法好

——————————————

http://music.163.com/song/454131810/?userid=280429778

——————————————

看看我开了哪些坑

1. 离线网易云音乐(需求不足，弃)

2. 支持数学公式渲染的web聊天端(还没开始做，我在等什么？)

3. 学习numpy(未学高等数学，对AI path 信心不足)



话说今天喷了云南白药感觉好一点了

明天会不会更好呢？

——————————————

原来网易云音乐长按就复制歌名

马的，以前老是在全民K歌手打搜歌😡

——————————————

https://wanqu.co/a/5391/2017-07-20-a-sons-race-to-give-his-dying-father-artificial-immortality.html?s=/issues

——————————————

其实还有两本书可以看

一个是以前那本算法书

一个是vim“使用指南”

——————————————

Beats 4.6%


class Solution(object):
    def addStrings(self, num1, num2):
        """
        :type num1: str
        :type num2: str
        :rtype: str
        """
        def to_int(string):
            nums = list(string)
            result = 0
            for index, num in enumerate(reversed(nums)):
                if num == '0':
                    result += 0
                elif num == '1':
                    result += 1 * (10 ** index)
                elif num == '2':
                    result += 2 * (10 ** index)
                elif num == '3':
                    result += 3 * (10 ** index)
                elif num == '4':
                    result += 4 * (10 ** index)
                elif num == '5':
                    result += 5 * (10 ** index)
                elif num == '6':
                    result += 6 * (10 ** index)
                elif num == '7':
                    result += 7 * (10 ** index)
                elif num == '8':
                    result += 8 * (10 ** index)
                elif num == '9':
                    result += 9 * (10 ** index)
            return result
        
        return str(to_int(num1) + to_int(num2))

——————————————

415. Add Strings


Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.

Note:
The length of both num1 and num2 is < 5100.
Both num1 and num2 contains only digits 0-9.
Both num1 and num2 does not contain any leading zero.
You must not use any built-in BigInteger library or convert the inputs to integer directly.


class Solution(object):
    def addStrings(self, num1, num2):
        """
        :type num1: str
        :type num2: str
        :rtype: str
        """

https://leetcode.com/problems/add-strings/description/

——————————————

求翻译成英文

我倍感压力

——————————————

Future 是可以 cancel 的(充当 coroutine 实际执行中的控制小把手)


Loop 是可以 stop 的


Loop 停了还可以再运行，

一种方法是手动给 future 到 loop.run_until_complete()，
# 你给 coroutine 也行，会自动转换成 future

另一种方法是提前用 asyncio.ensure_future() 把 coroutine 转化为 future 并自动添加到 loop队列，再用 loop.run_forever() 开始循环任务
# 运行到你使用loop.stop()为止，并不是永远

——————————————

self.coro = self.loop.create_connection()

=

self.coroutine = self.loop.create_connection()


怪说不得当时我看得一头雾水，原来是不知道那个缩写是啥

——————————————

没钱看医生

只能在家躺着

——————————————

有钱的大佬

——————————————

投影仪好贵啊




看来要躺着办公得花不少钱呢

——————————————

…答非所问…😅

——————————————

Beats 36%


class Solution(object):
    def wordPattern(self, pattern, str):
        """
        :type pattern: str
        :type str: str
        :rtype: bool
        """
        pattern_list = list(pattern)
        str_list = str.split(' ')
        
        if len(pattern_list) != len(str_list):
            return False
        elif len(set(pattern_list)) != len(set(str_list)):
            return False
        
        dict_ = {}
        for index, key_ in enumerate(pattern_list, start=0):
            if dict_.has_key(key_):
                if dict_.get(key_) != str_list[index]:
                    return False
            else:
                dict_.update({key_: str_list[index]})
        return True

——————————————

美剧中经常虚化背景

突出人物


有时也是为了让对接的背景不那么突兀(我指人物在摄影棚里拍，背景在外面拍)

比如行尸走肉

——————————————

PS大神

摄影大神

——————————————

一定不是你家的日出

——————————————

明天还是去看医生吧

趁着不严重

——————————————

腰间盘突出的注意事项


1、不能久坐、久站，不能提超过4kg的重物，不能做弯腰用力的动作。
2、注意保暖，不要受凉、受潮。
3、注意卧床休息，睡平板床，且采取平卧位。
4、忌烟酒、油腻、生冷、辛辣。
5、多练习倒走、飞燕。
6、有条件可多游泳，但是注意不要受凉，不要劳累。
7、如果患病因为工作性质导致，最好调整工作状态或者停止该工作。
8、在椅子上加一个靠枕，以减轻腰椎压力。
9、晚睡前热敷腰部，烫烫脚。

——————————————

290. Word Pattern


Given a pattern and a string str, find if str follows the same pattern.

Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.

Examples:
pattern = "abba", str = "dog cat cat dog" should return true.
pattern = "abba", str = "dog cat cat fish" should return false.
pattern = "aaaa", str = "dog cat cat dog" should return false.
pattern = "abba", str = "dog dog dog dog" should return false.

Notes:
You may assume pattern contains only lowercase letters, and str contains lowercase letters separated by a single space.


class Solution(object):
    def wordPattern(self, pattern, str):
        """
        :type pattern: str
        :type str: str
        :rtype: bool
        """

https://leetcode.com/problems/word-pattern/description/

——————————————

Yeah

——————————————

I have no book to read right now.

——————————————

@bdbai 

你学了JavaScript能做一些很屌的自绘吗？

听人说，会JavaScript后，在画图方面制约人的只有想象力

——————————————

来来来，预防腰椎病，站着敲代码

——————————————

在南京可以继续搞IT嘛

在四川只能当乘务员

——————————————

就算我天天念叨让南京学校录我

可能最后还是待在四川

最后十几天好煎熬

——————————————

一个错误酿成一场世纪惨案😂

——————————————

https://medium.com/towards-data-science/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9

——————————————

Beats 76%.


class Solution(object):
    def isPerfectSquare(self, num):
        return (num ** 0.5) % 1 == 0

——————————————

What's the fuck...

——————————————

Submission Result: Wrong Answer

Input: 5
Output: true
Expected: false

——————————————

恩

——————————————

对呀，我怎么没想到分数指数


那个 %1==0 是确保整数吗？

——————————————

367. Valid Perfect Square


Given a positive integer num, write a function which returns True if num is a perfect square else False.

Note: Do not use any built-in library function such as sqrt.

Example 1:
Input: 16
Returns: True

Example 2:
Input: 14
Returns: False


class Solution(object):
    def isPerfectSquare(self, num):
        """
        :type num: int
        :rtype: bool
        """

https://leetcode.com/problems/valid-perfect-square/description/

——————————————

我觉得人生应该时时更新三张表：


1. 计划与完成

2. 买的原因与不买的原因

3. 缺点与优点


1是做方向的指引

2是通过好处与坏处平衡收支

3是对自身进行修正

——————————————

主要是腰还不见好转

都不敢坐起来写代码

——————————————

自带线程池


不过不用三方库就是非线程操作了，比如用 aiohttp


现在新出的涉及网络的库基本在向支持asyncio靠拢

——————————————

表示最后一句我确定可行。

然后我掌握了把阻塞程序变成协程的方法。

虽然本质上还是用线程，但有框架会方便很多。

——————————————

Run any function that starts with async will get a coroutine. The key of coroutine is await before some function which takes time.

loop.run_until_complete() only takes coroutine or future as arg.

You can add coroutine or future when loop is running by using asyncio.ensure_future().

——————————————

from concurrent.futures import ThreadPoolExecutor
import asyncio
import time

executor = ThreadPoolExecutor(max_workers=50)

def print_something(msg):
    print(msg)


print(executor.submit(print_something, 'Hi')) # It will be launching immediately.

loop = asyncio.get_event_loop()
print(loop.run_in_executor(executor, print_something, 'Hi')) # It won't start unless you use loop to run it.

print('\n' * 3)



async def get_coroutine():
    futures = []
    for _ in range(3):
        futures.append(loop.run_in_executor(executor, print_something, 'Hi'))
    asyncio.gather(*futures)
    time.sleep(6)
    print('This task was added after the loop started:')
    asyncio.ensure_future(loop.run_in_executor(executor, print_something, 'Hi'))


print(get_coroutine()) ＃ Run any function that starts with async will get a coroutine. The key of coroutine is await before something taking times.

loop.run_until_complete(get_coroutines()) # loop.run only takes coroutine as arg.

——————————————

Converting blocking code into non-blocking code


While asyncio supports connecting to resources in an asynchronous way, it is required to use blocking calls in certain cases. This happens, for example, when third-party APIs exclusively expose blocking calls (for example, many database libraries), but also when executing long-running computations. In this subsection, we will learn how to deal with blocking APIs and make them compatible with asyncio.

An effective strategy for dealing with blocking code is to run it in a separate thread. Threads are implemented at the Operating System (OS) level and allow parallel execution of blocking code. For this purpose, Python provides the Executor interface designed to run tasks in a separate thread and to monitor their progress using futures.

You can initialize a ThreadPoolExecutor by importing it from the concurrent.futures module. The executor will spawn a collection of threads (called workers) that will wait to execute whatever task we throw at them. Once a function is submitted, the executor will take care of dispatching its execution to an available worker thread and keep track of the result. The max_workers argument can be used to select the number of threads.

Note that the executor will not destroy a thread once a task is completed. By doing so, it reduces the cost associated with the creation and destruction of threads. 

In the following example, we create a ThreadPoolExecutor with three workers, and we submit a wait_and_return function that will block the program execution for one second and return a message string. We then use the submit method to schedule its execution:


    from concurrent.futures import ThreadPoolExecutor

    executor = ThreadPoolExecutor(max_workers=3)

    def wait_and_return(msg):
        time.sleep(1)
        return msg

    executor.submit(wait_and_return, "Hello. executor")
    # Result:
    # <Future at 0x7ff616ff6748 state=running>



The executor.submit method immediately schedules the function and returns a future. It is possible to manage the execution of tasks in asyncio using the loop.run_in_executor method, which works quite similarly to executor.submit:


    fut = loop.run_in_executor(executor, wait_and_return, "Hello, asyncio 
    executor")
    # <Future pending ...more info...>



The run_in_executor method will also return an asyncio.Future instance that can be awaited from other code, the main difference being that the future will not be run until we start the loop. We can run and obtain the response using loop.run_until_complete:


    loop.run_until_complete(fut)
    # Result:
    # 'Hello, executor'



As a practical example, we can use this technique to implement concurrent fetching of several web pages. To do this, we will import the popular (blocking) requests library and run the requests.get function in the executor:


    import requests

    async def fetch_urls(urls):
        responses = []
        for url in urls:
            responses.append(await loop.run_in_executor
                                (executor, requests.get, url))
        return responses

    loop.run_until_complete(fetch_ruls(['http://www.google.com', 
                                        'http://www.example.com',
                                        'http://www.facebook.com']))
    # Result
    # []



This version of fetch_url will not block the execution and allow other coroutines in asyncio to run; however, it is not optimal as the function will not fetch a URL in parallel. To do this, we can use asyncio.ensure_future or employ the asyncio.gather convenience function that will submit all the coroutines at once and gather the results as they come. The usage of asyncio.gather is demonstrated here:


    def fetch_urls(urls):
        return asyncio.gather(*[loop.run_in_executor
                                 (executor, requests.get, url) 
                                 for url in urls])

——————————————

总算知道安卓上怎么编辑消息了

单点一下就可以了，不用长按

——————————————

Beats 66.97%.

class Solution(object):
    def getSum(self, a, b):
        return a.__add__(b)

——————————————

371. Sum of Two Integers


Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.

Example:
Given a = 1 and b = 2, return 3.


class Solution(object):
    def getSum(self, a, b):
        """
        :type a: int
        :type b: int
        :rtype: int
        """

https://leetcode.com/problems/sum-of-two-integers/description/

——————————————

数学的真谛在于让人养成享受动脑的习惯，而不是恶心到让人再也不想用脑。

这就是英文数学和中文数学的差别。

——————————————

https://youtu.be/f2O6mQkFiiw

——————————————

啥？

函数还分高阶、低阶？

不是一把梭吗

——————————————

关键在于把函数作为参数传递

那是一切callback的基础

——————————————

恩，没准 python 的 asyncio 就是从JS等语言的异步实现中借鉴过来的

——————————————

结果全拿去玩游戏了😂

——————————————

如果直接叫你学这个系统，肯定让人迷糊

但这本书还不错，先介绍了传统callback式异步编程的实现方式

——————————————

他们之间可以相互连接和转换

整个asyncio系统不过是对传统callback式编程的封装

——————————————

一看你就是一知半解

那几个类型明明就是一体的

只不过在不同的级别和层次

——————————————

Coroutines(2)


It is possible to implement coroutines in asyncio using the yield statement. However, Python supports the definition of powerful coroutines using a more intuitive syntax since version 3.5.

To define a coroutine with asyncio, you can use the async def statement:


    async def hello():
        print("Hello, async!")

    coro = hello()
    coro
    # Output:
    # <coroutine object hello at 0x7f314846bd58>



As you can see, if we call the hello function, the function body is not executed immediately, but a coroutine object is returned. The asyncio coroutines do not support next, but they can be easily run in the asyncio event loop using the run_until_complete method:


    loop = asyncio.get_event_loop()
    loop.run_until_complete(coro)



The asyncio  module provides resources (called awaitables) that can be requested inside coroutines through the await syntax. For example, if we want to wait for a certain time and then execute a statement, we can use the asyncio.sleep function:


    async def wait_and_print(msg):
        await asyncio.sleep(1)
        print("Message: ", msg)
    
    loop.run_until_complete(wait_and_print("Hello"))



The result is beautiful, clean code. We are writing perfectly functional asynchronous code without all the ugliness of callbacks!

Even better, coroutines are also awaitable, and we can use the await statement to chain coroutines asynchronously. In the following example, we rewrite the network_request function, which we defined earlier, by replacing the call to time.sleep with asyncio.sleep:


    async def network_request(number):
         await asyncio.sleep(1.0)
         return {"success": True, "result": number ** 2}



We can follow up by reimplementing fetch_square. As you can see, we can await network_request directly without needing additional futures or callbacks.


    async def fetch_square(number):
         response = await network_request(number)
         if response["success"]:
             print("Result is: {}".format(response["result"]))



The coroutines can be executed individually using loop.run_until_complete:


    loop.run_until_complete(fetch_square(2))
    loop.run_until_complete(fetch_square(3))
    loop.run_until_complete(fetch_square(4))



Running tasks using run_until_complete is fine for testing and debugging. However, our program will be started with loop.run_forever most of the times, and we will need to submit our tasks while the loop is already running.

asyncio provides the ensure_future function, which schedules coroutines (as well as futures) for execution. ensure_future can be used by simply passing the coroutine we want to schedule. The following code will schedule multiple calls to fetch_square that will be executed concurrently:


    asyncio.ensure_future(fetch_square(2))
    asyncio.ensure_future(fetch_square(3))
    asyncio.ensure_future(fetch_square(4))

    loop.run_forever()
    # Hit Ctrl-C to stop the loop



As a bonus, when passing a coroutine, the asyncio.ensure_future function will return a Task instance (which is a subclass of Future) so that we can take advantage of the await syntax without having to give up the resource tracking capabilities of regular futures.

——————————————

Coroutines(1)


One of the main problems with callbacks is that they require you to break the program execution into small functions that will be invoked when a certain event takes place. As we saw in the earlier sections, callbacks can quickly become cumbersome.

Coroutines are another, perhaps a more natural, way to break up the program execution into chunks. They allow the programmer to write code that resembles synchronous code but will execute asynchronously. You may think of a coroutine as a function that can be stopped and resumed. A basic example of coroutines is generators.

Generators can be defined in Python using the yield statement inside a function. In the following example, we implement the range_generator function, which produces and returns values from 0 to n. We also add a print statement to log the internal state of the generator:


    def range_generator(n):
        i = 0
        while i < n:
            print("Generating value {}".format(i))
            yield i
            i += 1



When we call the range_generator function, the code is not executed immediately. Note that nothing is printed to output when the following snippet is executed. Instead, a generator object is returned:


    generator = range_generator(3)
    generator
    # Result:
    # <generator object range_generator at 0x7f03e418ba40>



In order to start pulling values from a generator, it is necessary to use the next function:


    next(generator)
    # Output:
    # Generating value 0

    next(generator)
    # Output:
    # Generating value 1



Note that every time we invoke next, the code runs until it encounters the next yield statement and it is necessary to issue another next statement to resume the generator execution. You can think of a yield statement as a breakpoint where we can stop and resume execution (while also maintaining the internal state of the generator). This ability of stopping and resuming execution can be leveraged by the event loop to allow for concurrency. 

It is also possible to inject (rather than extract) values in the generator through the yield statement. In the following example, we declare a function parrot that will repeat each message that we send. To allow a generator to receive a value, you can assign yield to a variable (in our case, it is message = yield). To insert values in the generator, we can use the send method. In the Python world, a generator that can also receive values is called a generator-based coroutine:


    def parrot():
        while True:
            message = yield
            print("Parrot says: {}".format(message))

    generator = parrot()
    generator.send(None)
    generator.send("Hello")
    generator.send("World")



Note that we also need to issue a generator.send(None) before we can start sending messages; this is done to bootstrap the function execution and bring us to the first yield statement. Also, note that there is an infinite loop inside parrot; if we implement this without using generators, we will get stuck running the loop forever!

With this in mind, you can imagine how an event loop can partially progress several of these generators without blocking the execution of the whole program. You can also imagine how a generator can be advanced only when some resource is ready, therefore eliminating the need for a callback.

——————————————

The asyncio framework


By now, you should have a solid foundation of how concurrency works, and how to use callbacks and futures. We can now move on and learn how to use the asyncio package present in the standard library since version 3.4. We will also explore the brand new async/await syntax to deal with asynchronous programming in a very natural way.

As a first example, we will see how to retrieve and execute a simple callback using asyncio. The asyncio loop can be retrieved by calling the asyncio.get_event_loop() function. We can schedule a callback for execution using  loop.call_later that takes a delay in seconds and a callback. We can also use the loop.stop method to halt the loop and exit the program.  To start processing the scheduled call, it is necessary to start the loop, which can be done using loop.run_forever. The following example demonstrates the usage of these basic methods by scheduling a callback that will print a message and halt the loop:


    import asyncio

    loop = asyncio.get_event_loop()

    def callback():
        print("Hello, asyncio")
        loop.stop()

    loop.call_later(1.0, callback)
    loop.run_forever()

——————————————

It's a great app for you to get lrc from music or to understand what's the meaning of lrc.

——————————————

Check out "Genius — Song Lyrics & More"
https://play.google.com/store/apps/details?id=com.genius.android

——————————————

LMMS在linux做音乐也不错啊

反正都是玩，在win上搞些奇奇怪怪的也没多大意思

——————————————

最近=最新

——————————————

重新思考兼容性



这个东西只适用于客户端，服务器必须得使用最近技术，减少兼容产生的维护费用

——————————————

1.5小时解决1000个问题就可以免学历去国外公司做开发呢！

——————————————

Beats 78%, good.

——————————————

Beats 87% in a hacking way

class Solution(object):
    def detectCapitalUse(self, word):
        """
        :type word: str
        :rtype: bool
        """
        A = word[:1]
        if A.islower():
            A = None
        B = set()
        C = set()
        
        for index, char in enumerate(set(word)):
            if char.islower():
                B.update(char)
            else:
                C.update(char)
                
        length = len(set(word))
        if A == 'F' and length == 2:
            return False
        if A != None and len(B) == length - 1:
            return True
        elif len(B) == length:
            return True
        elif len(C) == length:
            return True
        else:
            return False

——————————————

不管怎样，提前把题目放出来有好处，记在脑子里，睡一觉起来没准就解决了

——————————————

我还打算手动写三个规则呢

你这直接就写出来了

果然是py大神

——————————————

520. Detect Capital


Given a word, you need to judge whether the usage of capitals in it is right or not.

We define the usage of capitals in a word to be right when one of the following cases holds:

1. All letters in this word are capitals, like "USA".
2. All letters in this word are not capitals, like "leetcode".
3. Only the first letter in this word is capital if it has more than one letter, like "Google".

Otherwise, we define that this word doesn't use capitals in a right way.


Example 1:
Input: "USA"
Output: True

Example 2:
Input: "FlaG"
Output: False

Note: The input will be a non-empty word consisting of uppercase and lowercase latin letters.


class Solution(object):
    def detectCapitalUse(self, word):
        """
        :type word: str
        :rtype: bool
        """

https://leetcode.com/problems/detect-capital/tabs/description

——————————————

《Mr. robot》这部美剧就是讲的一个社工高手，不管什么人都能从网上得到所有信息。


不知现实可不可行。

——————————————

@JYaung

Can we talk?

——————————————

也许是我介绍写得太简略了

不过我确实还没正式开发那个鬼的啊




网页端解决后，asyncio理解后，再重构下中心服务器

差不多就可以正式做聊天应用了

不然都是出于模型阶段，只是探索可行性

——————————————

艹，没邮箱真是错过好多精彩的事

——————————————

我是最好社工的了

几年日记全在网上😒

——————————————

math.ceil(x)


Return the ceiling of x, the smallest integer greater than or equal to x.

——————————————

# Finally, I got something like this.
# Yeah, copy from others.

class Solution(object):
    def poorPigs(self, buckets, minutesToDie, minutesToTest):
        """
        :type buckets: int
        :type minutesToDie: int
        :type minutesToTest: int
        :rtype: int
        """
        import math
        states = minutesToTest // minutesToDie + 1
        return int(math.ceil(math.log(buckets, states)))

——————————————

假设只有4桶，0桶没猪喝，1桶A喝，2桶B喝，3桶AB都喝

没猪死掉，代表0桶有毒
A猪死掉，代表1桶有毒
B猪死掉，代表2桶有毒
两只猪都死了，代表3桶有毒

😂
如果有x头猪，在这种情况下，可以测试2的x次方桶水。

——————————————

不明觉厉

——————————————

这道题搞得我想睡午觉

——————————————

默认情况答案是5

——————————————

哈哈

——————————————

你肯定趁着吃午饭的时间在看这个问题

——————————————

ibraries include a very convenient event loop-based concurrency framework, asyncio, which will be the topic of the next section.

——————————————

Event loops


So far, we have implemented parallelism using OS threads. However, in many asynchronous frameworks, the coordination of concurrent tasks is managed by an event loop.

The idea behind an event loop is to continuously monitor the status of the various resources (for example, network connections and database queries) and trigger the execution of callbacks when events take place (for example, when a resource is ready or when a timer expires).

As a first example, we will implement a thread-free version of threading.Timer. We can define a Timer class that will take a timeout and implement the Timer.done method that returns True if the timer has expired:


    class Timer:
    
        def __init__(self, timeout):
            self.timeout = timeout
            self.start = time.time()
    
        def done(self):
            return time.time() - self.start > self.timeout



To determine whether the timer has expired, we can write a loop that continuously checks the timer status by calling the Timer.done method. When the timer expires, we can print a message and exit the cycle:


    timer = Timer(1.0)

    while True:
        if timer.done():
            print("Timer is done!")
            break



By implementing the timer in this way, the flow of execution is never blocked and we can, in principle, do other work inside the while loop.

Ideally, we would like to attach a custom function that executes when the timer goes off, just like we did in threading.Timer. To do this, we can implement a method, Timer.on_timer_done, that will accept a callback to be executed when the timer goes off:


    class Timer:
       # ... previous code 
       def on_timer_done(self, callback):
            self.callback = callback



Note that on_timer_done merely stores a reference to the callback. The entity that monitors the event and executes the callback is the loop. This concept is demonstrated as follows. Rather than using the print function, the loop will call timer.callback when appropriate:


    timer = Timer(1.0)
    timer.on_timer_done(lambda: print("Timer is done!"))

    while True:
        if timer.done():
            timer.callback()
            break



As you can see, an asynchronous framework is starting to take place. All we did outside the loop was define the timer and the callback, while the loop took care of monitoring the timer and executing the associated callback. We can further extend our code by implementing support for multiple timers.

A natural way to implement multiple timers is to add a few Timer instances to a list and modify our event loop to periodically check all the timers and dispatch the callbacks when required. In the following code, we define two timers and attach a callback to each of them. Those timers are added to a list, timers, that is continuously monitored by our event loop. As soon as a timer is done, we execute the callback and remove the event from the list:


    timers = []

    timer1 = Timer(1.0)
    timer1.on_timer_done(lambda: print("First timer is done!"))

    timer2 = Timer(2.0)
    timer2.on_timer_done(lambda: print("Second timer is done!"))

    timers.append(timer1)
    timers.append(timer2)

    while True:
        for timer in timers:
            if timer.done():
                timer.callback()
                timers.remove(timer)
        # If no more timers are left, we exit the loop 
        if len(timers) == 0:
            break



The main restriction of an event loop is, since the flow of execution is managed by a continuously running loop, that it never uses blocking calls. If we use any blocking statement (such as time.sleep) inside the loop, you can imagine how the event monitoring and callback dispatching will stop until the blocking call is done.

To avoid this, rather than using a blocking call, such as time.sleep, we let the event loop detect and execute the callback when the resource is ready. By not blocking the execution flow, the event loop is free to monitor multiple resources in a concurrent way.

The Python standard l

——————————————

https://discuss.leetcode.com/topic/67666/another-explanation-and-solution/5

我理解错了，他还扯上维度了

心情是崩溃的

——————————————

虽然写了这么多奇奇怪怪的东西


我还是不知道到底最少需要几只猪

——————————————

1 2 3 4 5 | 1000÷5=200
6 7 8 9 10 | 200÷5=40
11 12 13 14 15 | 40÷5=8
16 17 18 19 20 | 8÷4=2
21 22 23 24 25 | feed two pigs, die or live

——————————————

Having 60 minutes and tests taking 15 minutes means we can run four tests. If the row pig dies in the third test, the poison is in the third row. If the column pig doesn't die at all, the poison is in the fifth column (this is why we can cover five rows/columns even though we can only run four tests).
We can measure at 4 intervals: (15,30,45,60). the final interval counts for two as the pig could be alive or dead.

States per pig:
Dead at 15
Dead at 30
Dead at 45
Dead at 60
Alive at 60






So, it's something like this:

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
If you only have 60 minutes and it takes 15 mins per row, shouldn't you only have up to 4 rows? 4 rows * 15 = 60 mins.

——————————————

我知道了

3 + 125

3是二分法做排除，125是最后15分钟挨个做测试

——————————————

我虽然不知道最少

但知道1000头猪一定能找到那桶毒药

——————————————

如果以分钟为基数，一直喝水最多死45头猪，怎么能检验1000桶水呢？

如果以秒为基数，不断喝水可以尝试45×60=2700次

——————————————

458. Poor Pigs


There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15 minutes. What is the minimum amount of pigs you need to figure out which bucket contains the poison within one hour.

Answer this question, and write an algorithm for the follow-up general case.


Follow-up:

If there are n buckets and a pig drinking poison will die within m minutes, how many pigs (x) you need to figure out the "poison" bucket within p minutes? There is exact one bucket with poison.


class Solution(object):
    def poorPigs(self, buckets, minutesToDie, minutesToTest):
        """
        :type buckets: int
        :type minutesToDie: int
        :type minutesToTest: int
        :rtype: int
        """

https://leetcode.com/problems/poor-pigs/tabs/description

——————————————

没准 @system357 喜欢小姐姐

你们看这名字

——————————————

然后称霸整个翻墙行业

——————————————

赚了钱肉翻

再雇一群程序员把生意做大

——————————————

那她如果自己做翻墙服务

肯定赚翻




可惜她不会经济学

——————————————

咋没人人肉编程随想

——————————————

听说ssr小姐姐被人肉了

——————————————

Futures


Futures are a more convenient pattern that can be used to keep track of the results of asynchronous calls. In the preceding code, we saw that rather than returning values, we accept callbacks and pass the results when they are ready. It is interesting to note that, so far, there is no easy way to track the status of the resource.

A future is an abstraction that helps us keep track of the requested resources and that we are waiting to become available. In Python, you can find a future implementation in the concurrent.futures.Future class. A Future instance can be created by calling its constructor with no arguments:


    fut = Future()
    # Result:
    # <Future at 0x7f03e41599e8 state=pending>



A future represents a value that is not yet available. You can see that its string representation reports the current status of the result which, in our case, is still pending. In order to make a result available, we can use the Future.set_result method:


    fut.set_result("Hello")
    # Result:
    # <Future at 0x7f03e41599e8 state=finished returned str>

    fut.result()
    # Result:
    # "Hello"



You can see that once we set the result, the Future will report that the task is finished and can be accessed using the Future.result method. It is also possible to subscribe a callback to a future so that, as soon as the result is available, the callback is executed. To attach a callback, it is sufficient to pass a function to the Future.add_done_callback method. When the task completes, the function will be called with the Future instance as its first argument and the result can be retrieved using the Future.result() method:


    fut = Future()
    fut.add_done_callback(lambda future: print(future.result(), flush=True))
    fut.set_result("Hello")
    # Output:
    # Hello



To get a grasp on how futures can be used in practice, we will adapt the network_request_async function to use futures. The idea is that, this time, instead of returning nothing, we return a Future that will keep track of the result for us. Note two things:

1. We don't need to accept an on_done callback as callbacks can be connected later using the Future.add_done_callback method. Also, we pass the generic Future.set_result method as the callback for threading.Timer.

2. This time we are able to return a value, thus making the code a bit more similar to the blocking version we saw in the preceding section:


    from concurrent.futures import Future

    def network_request_async(number):
        future = Future()
        result = {"success": True, "result": number ** 2}
        timer = threading.Timer(1.0, lambda: future.set_result(result))
        timer.start()
        return future

    fut = network_request_async(2)



If you execute the preceding code, nothing will happen as the code only consists of preparing and returning a Future instance. To enable further operation of the future results, we need to use the Future.add_done_callback method. In the following code, we adapt the fetch_square function to use futures:


    def fetch_square(number):
        fut = network_request_async(number)

        def on_done_future(future):
            response = future.result()
            if response["success"]:
                print("Result is: {}".format(response["result"]))
        
        fut.add_done_callback(on_done_future)



The code still looks quite similar to the callback version. Futures are a different and slightly more convenient way of working with callbacks. Futures are also advantageous, because they can keep track of the resource status, cancel (unschedule) scheduled tasks, and handle exceptions more naturally.

——————————————

游戏要注意抓住人的现实需求

比如捕鱼达人→钓鱼
比如QQ农场→种地
比如大富翁→发财
比如跑酷→突破障碍
比如GTA→杀人飚车、无法无天
…

——————————————

第二年就坑了

——————————————

.cf

——————————————

穷啊


第二年几百美金一个域名

——————————————

一年换一次

——————————————

6

——————————————

免费域名真正蛋疼的地方在于不能使用HTTPS

每次到期，原来的SSL证书就失效了



可是不用HTTPS，运营商流量劫持插广告又非常恶心

——————————————

http://zhangwenli.com

这个网页聊天界面好赞！

——————————————

然后redirect_output已经过时

document里没找到

——————————————

One question


os.remove()报错默认不提示

不用忽略错误

——————————————

This one beats 31%:
return ''.join(s[::-1])

And this one just beats 13%:
return s[::-1]

Strange.

——————————————

我精挑细选出的题

谁叫我起床晚了…

——————————————

Beats 11%. 😭 

class Solution(object):
    def reverseString(self, s):
        return ''.join(list(s)[::-1])

——————————————

Beats 26%.

——————————————

344. Reverse String


Write a function that takes a string as input and returns the string reversed.

Example:
Given s = "hello", return "olleh".


class Solution(object):
    def reverseString(self, s):
        """
        :type s: str
        :rtype: str
        """

https://leetcode.com/problems/reverse-string/#/description

——————————————

我们都是大大，本群没有大大😁

——————————————

我真是觉得女生要开博客认真更新的一般都是研究生及以上水平

不然不会有非社交网络的闲话可说

不然不会有一种深深的孤独感驱使她去写一些东西



智商越高越孤独

——————————————

https://93tillinfinity.withknown.com

——————————————

原来是女装高手

——————————————

她真是妹子吗？

——————————————

为啥17个man聚在一起

要是17个girl就好了

——————————————

彻底看懂头脑发涨

一定是这作者文笔太差

——————————————

lt as an argument to the on_done callback.

The rest of the function consists of submitting a callback (called timer_done) to the timer.Timer class that will call on_done when it's ready:


    def network_request_async(number, on_done):

        def timer_done():
            on_done({"success": True, 
                     "result": number ** 2})

        timer = threading.Timer(1.0, timer_done)
        timer.start()



The usage of network_request_async is quite similar to timer.Timer; all we have to do is pass the number we want to square and a callback that will receive the result when it's ready. This is demonstrated in the following snippet:


    def on_done(result):
        print(result)

    network_request_async(2, on_done)



Now, if we submit multiple network requests, we note that the calls get executed concurrently and do not block the code:


    network_request_async(2, on_done)
    network_request_async(3, on_done)
    network_request_async(4, on_done)
    print("After submission")



In order to use network_request_async in fetch_square, we need to adapt the code to use asynchronous constructs. In the following code, we modify fetch_square by defining and passing the on_done callback to network_request_async:


    def fetch_square(number):
        def on_done(response):
            if response["success"]:
                print("Result is: {}".format(response["result"]))

        network_request_async(number, on_done)



You may have noted that the asynchronous code is significantly more convoluted than its synchronous counterpart. This is due to the fact that we are required to write and pass a callback every time we need to retrieve a certain result, causing the code to become nested and hard to follow.

——————————————


import threading

def network_request_async(number, on_done):
    def timer_done():
        on_done({'success': True,
            'result': number ** 2})

    timer = threading.Timer(1, timer_done)
    timer.start()

def fetch_square(number):
    def on_done(response): # What is on_done, basaclly, based on done or finished.
        if response['success']:
            print('Result is: {}'.format(response['result']))

    network_request_async(number, on_done)

fetch_square(7)

——————————————

Callbacks


The code we have seen so far blocks the execution of the program until the resource is available. The call responsible for the waiting is time.sleep. To make the code start working on other tasks, we need to find a way to avoid blocking the program flow so that the rest of the program can go on with the other tasks.

One of the simplest ways to accomplish this behavior is through callbacks. The strategy is quite similar to what we do when we request a cab.

Imagine that you are at a restaurant and you've had a few drinks. It's raining outside, and you'd rather not take the bus; therefore, you request a taxi and ask them to call when they're outside so that you can come out, and you don't have to wait in the rain.

What you did in this case is request a taxi (that is, the slow resource) but instead of waiting outside until the taxi arrives, you provide your number and instructions (callback) so that you can come outside when they're ready and go home.

We will now show how this mechanism can work in code. We will compare the blocking code of time.sleep with the equivalent non-blocking code of threading.Timer.

For this example, we will write a function, wait_and_print, that will block the program execution for one second and then print a message:


    def wait_and_print(msg):
        time.sleep(1.0)
        print(msg)



If we want to write the same function in a non-blocking way, we can use the threading.Timer class. We can initialize a threading.Timer instance by passing the amount of time we want to wait and a callback. A callback is simply a function that will be called when the timer expires. Note that we have to also call the Timer.start method to activate the timer:


    import threading

    def wait_and_print_async(msg):
        def callback():
            print(msg)

        timer = threading.Timer(1.0, callback)
        timer.start()



An important feature of the wait_and_print_async function is that none of the statements are blocking the execution flow of the program.

This technique of registering callbacks for execution in response to certain events is commonly called the Hollywood principle. This is because, after an audition for a role at Hollywood, you may be told "Don't call us, we'll call you", meaning that they won't tell you if they chose you for the role immediately, but they'll call you in case they do.

To highlight the difference between the blocking and non-blocking version of wait_and_print, we can test and compare the execution of the two versions. In the output comments, the waiting periods are indicated by <wait...>:


    # Syncronous
    wait_and_print("First call")
    wait_and_print("Second call")
    print("After call")
    # Output:
    # <wait...>
    # First call  
    # <wait...>
    # Second call
    # After call
    # Async
    wait_and_print_async("First call async")
    wait_and_print_async("Second call async")
    print("After submission")
    # Output:
    # After submission 
    # <wait...>
    # First call
    # Second call



The synchronous version behaves in a very familiar way. The code waits for a second, prints First call, waits for another second, and then prints the Second call and After call messages.

In the asynchronous version, wait_and_print_async submits  (rather than execute) those calls and moves on immediately. You can see this mechanism in action by acknowledging that the "After submission" message is printed immediately.

With this in mind, we can explore a slightly more complex situation by rewriting our network_request function using callbacks. In the following code, we define the network_request_async function. The biggest difference between network_request_async and its blocking counterpart is that network_request_async doesn't return anything. This is because we are merely submitting the request when network_request_async is called, but the value is available only when the request is completed.

If we can't return anything, how do we pass the result of the request? Rather than returning the value, we will pass the resu

——————————————

Concurrency


Concurrency is a way to implement a system that is able to deal with multiple requests at the same time. The idea is that we can move on and start handling other resources while we wait for a resource to become available. Concurrency works by splitting a task into smaller subtasks that can be executed out of order so that multiple tasks can be partially advanced without waiting for the previous tasks to finish.  

As a first example, we will describe how to implement concurrent access to a slow network resource. Let's say we have a web service that takes the square of a number, and the time between our request and the response will be approximately one second.  We can implement the network_request function that takes a number and returns a dictionary that contains information about the success of the operation and the result. We can simulate such services using the time.sleep function, as follows:


    import time

    def network_request(number):
        time.sleep(1.0)
        return {"success": True, "result": number ** 2}



We will also write some additional code that performs the request, verifies that the request was successful, and prints the result. In the following code, we define the fetch_square function and use it to calculate the square of the number two using a call to network_request:


    def fetch_square(number):
        response = network_request(number)
        if response["success"]:
            print("Result is: {}".format(response["result"]))

    fetch_square(2)
    # Output:
    # Result is: 4



Fetching a number from the network will take one second because of the slow network. What if we want to calculate the square of multiple numbers? We can call fetch_square, which will start a network request as soon as the previous one is done:


    fetch_square(2)
    fetch_square(3)
    fetch_square(4)
    # Output:
    # Result is: 4
    # Result is: 9
    # Result is: 16



The previous code will take three seconds to run, but it's not the best we can do. Waiting for the previous result to finish is unnecessary as we can technically submit multiple requests at and wait for them parallely.

Ideally, we would like to start other new task while we are waiting for the already submitted tasks to finish. 

This strategy is made possible by the fact that the three requests are completely independent, and we don't need to wait for the completion of a previous task to start the next one. Also, note how a single CPU can comfortably handle this scenario. While distributing the work on multiple CPUs can further speedup the execution, if the waiting time is large compared to the processing times, the speedup will be minimal.

To implement concurrency, it is necessary to think and code differently; in the following sections, we'll demonstrate techniques and best practices to implement robust concurrent applications.

——————————————

还是不能期待 one for all，各有各的专长

应该这样：

小屏垃圾手机负责通讯

高配安卓平板电脑负责娱乐与阅读

普通8G+256SSD高续航笔记本负责写代码(其实用垃圾也可以，不用Java无所谓的)

——————————————

This beats 30% of person.

class Solution(object):
    def addDigits(self, num):
        """
        :type num: int
        :rtype: int
        """
        nums = [int(i) for i in list(str(num))]
        while True:
            if len(nums) == 1:
                return int(''.join([str(i) for i in nums]))
            else:
                num = sum(nums)
                nums = [int(i) for i in list(str(num))]

——————————————

258. Add Digits


Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.

For example:

Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.

Follow up:
Could you do it without any loop/recursion in O(1) runtime?


class Solution(object):
    def addDigits(self, num):
        """
        :type num: int
        :rtype: int
        """

https://leetcode.com/problems/add-digits/#/description

——————————————

Asynchronous programming


Asynchronous programming is a way of dealing with slow and unpredictable resources. Rather than waiting idle for resources to become available, asynchronous programs are able to handle multiple resources concurrently and efficiently. Programming in an asynchronous way can be challenging because it is necessary to deal with external requests that can arrive in any order, may take a variable amount of time, or may fail unpredictably. In this section, we will introduce the topic by explaining the main concepts and terminology as well as by giving an idea of how asynchronous programs work.

——————————————

Waiting for I/O


A modern computer employs different kinds of memory to store data and perform operations. In general, a computer possesses a combination of expensive memory that is capable of operating at fast speeds and cheaper, and more abundant memory that operates at lower speeds and is used to store a larger amount of data.

The memory hierarchy is shown in the following:


registers
cache
RAM
storage



At the top of the memory hierarchy are the CPU registers. Those are integrated in the CPU and are used to store and execute machine instructions. Accessing data in a register generally takes one clock cycle. This means that if the CPU operates at 3 GHz, the time it takes to access one element in a CPU register is in the order of 0.3 nanoseconds.

At the layer just below the registers, you can find the CPU cache, which is comprised of multiple levels and is integrated in the processor. The cache operates at a slightly slower speed than the registers but within the same order of magnitude.

The next item in the hierarchy is the main memory (RAM), which holds much more data but is slower than the cache. Fetching an item from memory can take a few hundred clock cycles.

At the bottom layer, you can find persistent storage, such as a rotating disks (HDD) and Solid State Drives (SSD). These devices hold the most data and are orders of magnitude slower than the main memory. An HDD may take a few milliseconds to seek and retrieve an item, while an SSD is substantially faster and takes only a fraction of a millisecond.

To put the relative speed of each memory type into perspective, if you were to have the CPU with a clock speed of about one second, a register access would be equivalent to picking up a pen from the table. A cache access will be equivalent to picking up a book from the shelf. Moving higher in the hierarchy, a RAM access will be equivalent to loading up the laundry (about twenty x slower than the cache). When we move to persistent storage, things are quite a bit different. Retrieving an element from an SSD will be equivalent to doing a four day trip, while retrieving an element from an HDD can take up to six months! The times can stretch even further if we move on to access resources over the network.

From the preceding example, it should be clear that accessing data from storage and other I/O devices is much slower compared to the CPU; therefore, it is very important to handle those resources so that the CPU is never stuck waiting aimlessly. This can be accomplished by carefully designing software capable of managing multiple, ongoing requests at the same time.

——————————————

I'm gonna keep reading from now on.

So I'll share something as I used to do.

——————————————

Reactive programming


Reactive programming is a paradigm that aims at building better concurrent systems. Reactive applications are designed to comply with the requirements exemplified by the reactive manifesto:

Responsive:  The system responds immediately to the user.

Elastic: The system is capable of handling different levels of load and is able to adapt to accommodate increasing demands.

Resilient: The system deals with failure gracefully. This is achieved by modularity and avoiding having a single point of failure.

Message driven: The system should not block and take advantage of events and messages. A message-driven application helps achieve all the previous requirements.

——————————————

伟大的哲学家康德一辈子没出过小镇。

也一辈子单身。

牛顿也是。




所以男性要搞好科研，首先得结扎。

不然都把心思拿去玩女人了。

http://blog.sciencenet.cn/blog-295006-464280.html

——————————————

我发誓我就是这样搞的

——————————————

接下来我想问一些实际的问题，比如如何把python程序变成linux的命令直接启动，而不依赖python xx。

如果我们不会这个，就必须用界面来管理我们的程序，据我所知，那需要打包成2进制或deb包。我们的问题是How?

这些基础的问题，我竟然不懂。

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

违反直觉

——————————————

I don't think it's any useful.

——————————————

我很快就发现

如果我去做一个实际的项目

我更倾向于不动脑，用以前实现过的方法

会变笨




但面对算法题，以前没做过，就有可能思考很多，这对大脑有帮助

——————————————

每天一道题就够了

多了肯定明天就不做了

——————————————

我这里还有一个更简单的方法，不过也超时，用Cython肯定没问题

class Solution(object):
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        for num in nums:
            if nums.count(num) == 1:
                return num

——————————————

xor太复杂吧

不适合我

——————————————

return 2*sum(set(nums))-sum(nums) 

纯数学的解决方法，他们真是神了

——————————————

Worse than expected.

class Solution(object):
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        all_ = []
        double = []
        for num in nums:
            if num in all_:
                double.append(num)
            else:
                all_.append(num)
        diff = set(all_) - set(double)
        return diff.pop()

——————————————

两个set结果不是一样的？

——————————————

Time Limit Exceeded, 😁 


class Solution(object):
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        result = []
        for num in nums:
            if num in result:
                result.remove(num)
            else:
                result.append(num)
        return result[0]

——————————————

http://www.webmd.com

好东西，不过我是真的腰椎上有一节按着疼，反向弯腰也疼

——————————————

我现在确定我是腰椎病了

还没告诉父母


插，我才19岁啊

叫你们别长期坐在电脑前，多运动啊，不然打了背部麻醉就知道你腰椎有多脆弱了

——————————————

?

——————————————

Given an array of integers, every element appears twice except for one. Find that single one.



https://leetcode.com/problems/single-number/#/description

——————————————

什么东西在阻止我学习：


1. 与原始欲望背道而驰

2. 得不到分享与炫耀的快感

3. unstable

4. 付出太多，如时间、精力

——————————————

那你学了计算机与科学出来想干嘛？

——————————————

这样想的话

有什么意思


不同语言本质上是一样，只是换了名字，或用了缩写

——————————————

哦

感觉好很多

——————————————

是电子信息技术吗？

——————————————

看来你大学可以好好看看那些基础又要命的东西

——————————————

最初的梦想还是最有动力的

即使感觉我目前学的一切都派不上用场(全是现成的)

——————————————

计算机科学、算法、数据结构

这些东西和AI有关系吗？

——————————————

养成习惯，干货用英语

平时评论用中文




然后上次发的fuck baidu那个代码的博客作者肯定是抄的这本书

那篇文章里有代码和这一模一样

——————————————

And you also need this for better LRC showing.

——————————————

用啥酷我K歌


网易云MV+桌面歌词最大化整起


没有我不能唱的英文歌

——————————————

 I can do anything, but I don't wanna do anything. 

-- yingshaoxo

——————————————

Tech area is a paradise for Freaks.

-- 《Silicon Valley》

——————————————

Fuck baidu in a elegant  way


import random
import asyncio
from aiohttp import ClientSession

async def fetch(url, session):
    async with session.get(url) as response:
        date = response.headers.get("DATE")
        print("{}, status:{}".format(date, response.status))
        return await response.read()


async def bound_fetch(sem, url, session):
    # Getter function with semaphore.
    async with sem:
        await fetch(url, session)


async def run(r):
    url = "https://www.baidu.com"
    tasks = []
    # create instance of Semaphore
    sem = asyncio.Semaphore(1000)

    # Create client session that will ensure we dont open new connection
    # per each request.
    async with ClientSession() as session:
        for i in range(r):
            # pass Semaphore and session to every GET request
            task = asyncio.ensure_future(bound_fetch(sem, url.format(i), session))
            tasks.append(task)

        responses = asyncio.gather(*tasks)
        await responses

number = 100000
loop = asyncio.get_event_loop()

future = asyncio.ensure_future(run(number))
loop.run_until_complete(future)

——————————————

When I look at `generator`, I found that it's just like `linked list`, but instead of containing data, it contains executable codes.

——————————————

To comment out blocks in vim:


1. Hit ctrl+v into visual block mode
2. Use the up/down arrow keys to select lines you want
3. Hit I
4. Insert the text you want, i.e. '# '
5. Press Esc

For uncomment, it's the same thing using x for deletion.

——————————————

Welcome to the hell.

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

在家(大厅)看美剧才是正确的生活方式😄👍

——————————————

http://jiqimao.tv/

——————————————

I got one.

——————————————

万能的群友，告诉我Win上有什么在线看美剧的地方或软件吧

我似乎没办法投影安卓4.4手机到电脑

——————————————

然后它两个窗口的靠接方式和我以前做过的程序一样，视频全屏后点歌台窗口还在，，，属于设计缺陷

不过这东西好几年前就没更新了

网络服务撑到现在还是挺牛逼







毕竟是免费的，，，老板转型做直播了，哈哈

——————————————

易语言的皮肤

——————————————

突然发现酷我K歌是用易语言做的，良心应用啊

——————————————

“你有钱又怎样，我才不管你的身份”

家庭K歌房

——————————————

Humans power is the same thing.

——————————————

There is strength in numbers.

——————————————

So what's the power of smart phone?

Apps, all apps linked together and are available.

——————————————

All linked together.

——————————————

Hey, you see, what's the power of internet?

Connection!

——————————————

I would like to use this as a key-value saver instead of json model.

https://docs.python.org/3/library/configparser.html

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

做大神不易，需要承受相当大的痛苦，面对大量数据的冲击，忍受繁重的任务，应对失眠与焦虑。

——————————————

党内群友真是太伟大了

一发问题立马解决，无广告😂

——————————————

广电网络流量劫持太恶心了

任何http的手机网页都插广告，并且还JS禁止你点击除广告外的任何链接😡

——————————————

If I shutdown the computer, what you see then?

——————————————

What is real, what is virtual, I don't know.

——————————————

不懂，这是给人看的吗？

我就想做 if 护眼程序未运行 then 运行

也怪垃圾红米，老是无理由终止我的 Darker Pro 护眼程序

现在只能设置tasker为关屏kill护眼程序，开屏start护眼程序😞


http://www.pocketables.com/2013/03/overview-of-pocketables-tasker-articles.html

——————————————

http://m.apkhere.com

——————————————

https://www.htcp.net

其实我的心是拔凉的，国内一个下实用外国破解软件的地方都没有

——————————————

不过戴上VR后你就不能和你女朋友亲亲了

——————————————

VR眼镜

——————————————

我觉得不现实

不是哪儿都有适合的天花板



没准3D眼镜投影电脑屏幕比较靠谱😄

——————————————

如果屏幕安在天花板就好了

就可以躺着写代码了😭

——————————————

不行，始终感觉腰疼

我还是多躺床上思考，少坐着盯代码比较好




想不到我年纪轻轻…

——————————————

接下来是要开发网易云音乐离线版

要做这个，首先我得改造一下Local_Show这个项目，使用Aplayer作为音乐播放器

在那之前，我想先玩玩DNF

——————————————

我十几个项目就收到了一个日本朋友的Star

——————————————

能打印初音未来吗？

——————————————

豪

——————————————

@Takaranoao

这孩子也是

还和我考得一样烂

——————————————

哦

@bdbai 
@ysc3839 
@yingshaoxo

都是高中刚毕业

还有吗？

——————————————

怎么都是年轻人

高中没毕业那种

——————————————

别看不下去，你的呢？

我 fo 一个

——————————————

你的github是多少？

——————————————

你多大了，41个项目

虽然感觉很多没啥用，还是copy的

——————————————

这样吧，一周之后进行大清洗

凡是我认为有嫌疑的通通kick out.

——————————————

刚接到通知

说是本群有中共特务

咋办呢？

——————————————

以后还是得买个人体工程学座椅，不然腰椎受不了

然后要定时给屁屁散热，以免肛门受不了

——————————————

https://www.zhihu.com/question/20402689

似乎腰椎出了问题，最近手碰疼

——————————————

https://gitlab.com/fdroid/fdroiddata/blob/master/CONTRIBUTING.md#building-it

然后 D-droid 我们的应用上不去，因为是用第三方语言开发，没法直接building

——————————————

http://exygy.com/which-license-should-i-use-mit-vs-apache-vs-gpl/


The GPL licenses (GPLv3, GPLv2, LGPL, Affero GPL) all contain some kind of share-alike license. They essentially say “if you make a derivative work of this, and distribute it to others under certain circumstances, then you have to provide the source code under this license.” The important thing to know here is that “derivative work” and “certain circumstances” both require some legal analysis to understand the meaning and impact for your project.


看来以后开源要用GPL协议，以防小人商用😏

——————————————

UI
User Interface

——————————————

One for UI, One for server.

——————————————

I'm night elf.

——————————————

Keep it as a goal, I'm still fighting.

——————————————

The next step is to forget what is frontend or backend.

Put those things together.

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

超时啦😅

我果然低效率

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

想发到 F-droid 上去，但今天时间不够了

趁还有25分钟赶紧弄bot

——————————————

https://github.com/yingshaoxo/SongRecorder

——————————————

哈哈，临近截至时间，发现两个问题

1.flash背景是黑色才能和框架搭配(PS修复即可)

2.编译出的apk菜单键捕获失败(艹你大爷，两个手机上的调试器都可以捕获到菜单键，编译出咋就不行呢？这样直接导致分享键没了，这是个重大问题，不能便捷分享recording要它干嘛)

——————————————

I must be old, 每天都要睡午觉，不然下午就废了

——————————————

Using photoshop is a hard work.

——————————————

接下来要找logo

我可是要上架的

——————————————

https://docs.python.org/3/library/logging.html

In the future, I would like to use this for debug rather than print information.

——————————————

手机录歌(翻唱)

然后导出人声，分享到电脑

这样电脑没有麦克风也可以做后期了

——————————————

目前主要的问题是这个弹出框太丑了

——————————————

fundamentals

——————————————

可能比起学一门新语言，花两个月去补补数学基础比较重要

可能比起临时的努力，每天坚持念英语比较重要


It's more important to learn some mathematical fundamental.

It's more important to practice English everyday.

——————————————

恩


明天给bot加上英语

不经常看口语都不知道怎么说了

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

还是8000，或是1080？

——————————————

默认端口是443？

——————————————

http://www.jianshu.com/p/e730d2399d09

——————————————

明天我可能会发全中国最屌的kivy应用😄

Tomorrow is a big day.

——————————————

男神回我话了😘

——————————————

It's a hot day.

——————————————

肉身翻😒

——————————————

看来你认识我

——————————————

好吧

——————————————

zeronet也不错

每个人承包一个package

——————————————

不对，淘宝那群SX怎么会知道我要什么呢


还是指望有大神做基于 Resilio Sync 的离线 document 比较靠谱

——————————————

我主要是在想

要是白名单就见不到你们了

同时没谷歌还真是没法编程


到时只有转业做其他或者淘宝购买大量离线文件，想想就恶心

——————————————

另外针对shadowsocks的检测系统做出来了

据说正开始大规模的清理翻墙软件运动

刚刚Twitter看到的

——————————————

有传闻github要被封

——————————————

https://eddieeddieeddiejones.github.io/2016/12/11/%E5%A6%82%E4%BD%95%E5%AD%A6%E5%89%8D%E7%AB%AF%EF%BC%9F/

——————————————

发出来万一你们大学考c用得着😆

——————————————

今后要是再闹文化大革命

估计第一个被打倒的就是程序员

——————————————

如果你是技术人员

你会不会想在你另一半(或熟人)手机上做个监控



其实很简单，首先你需要是美图秀秀之类国产软件的内部开发人员

其次你的应用有读取用户电话本和联网的权限(这并没有什么，国产应用基本有这两个权限)


于是在某人启动APP后：

1. 检测是否连上Wi-Fi，是就准备录制视频到服务器，否就准备拍摄图片到服务器

2. 得到用户电话本，与开发人员指定的一群联系人做对比，有80%重合率就真正开始发送偷拍文件到服务器

3. 保持隐匿与后台，注意控制应用占用的带宽，不能太明显

——————————————

对呀，拿到伴奏recover恢复成有人声啊😏

——————————————

对于一个业余音乐爱好者

到底可以干啥？

1. 拿到就是翻(recover)

2. 拿到就是搞(remix)

——————————————

伴随你账户呗

优秀的设置就是一段json

——————————————

可我在讲如何给客户更好的体验

——————————————

比如telegram，每次新开网页端或其他端，我都必须重新选择Control + Enter发送

那很烦，通用设置应该储存在云端，像Chrome一样

——————————————

你不觉得不靠谱的应用通常不会存储你的设置在云端吗？

——————————————

Get file path by file name in linux:

locate file_name

——————————————

虽然每次开旧坑走旧路都能有新的收获

但范围太广实在是累

像是超负荷记忆力不够用一样

——————————————

每天都很累

也不知道在忙些什么



最近做的东西都达不到我的要求

——————————————

谁知道python版的ss中的sslocal全路径是多少？

crontab -e设置开机自启时要用到

——————————————

一直都在别人的框架上改改改

是时候复制粘贴出一个新东西了

原框架用了多进程和增大fps的办法，肯定是高档机

咱这个垃圾电脑，还是一条进程到底，fps速率默认比较好😐

——————————————

然后尝试去掉cv窗口，却怎么也不能让它工作起来


想来坑太多，得自己慢慢踩

——————————————

转换写好了，就是只能稳定的画一个框，其他的都秒消失。。。

——————————————

什么鬼

——————————————

用于定义矩形

——————————————

tensorflow里的一种数据结构

——————————————

我觉得谷歌家的box有点坑

别人写坐标都是把x放在前，y放在后

谷歌非要反其道而行

——————————————

买了两大袋雪饼和仙贝

配合雪碧应该可以好好工作了

——————————————

想不出来或没心思想或脑子不够用

去逛超市吧，买点零食回来

——————————————

这样就可以得到win8以上的正确分辨率

但并没有用，我在想怎样从image上的比例关系box转化到屏幕上真实的box


import ctypes 

user32 = ctypes.windll.user32
user32.SetProcessDPIAware()
print(user32.GetSystemMetrics(0), user32.GetSystemMetrics(1))

——————————————

I wonder when we created this group.

——————————————

Or go to find out how much eBooks we shared in this group.

——————————————

Maybe you should 向上翻， see what we have done in the past year.


From nobody to py developer.

——————————————

This is the only one, I guess.

——————————————

#With these codes follow by function vis_util.visualize_boxes_and_labels_on_image_array() , you will see clearly how object detector works each time when you put a picture to it:

    boxes_list = np.squeeze(boxes).tolist()[:5]
    socres_list = np.squeeze(scores).tolist()[:5]
    classes_id_list = np.squeeze(classes).astype(np.int32)[:5]
    classes_name_list = [category_index[id]['name'] for id in classes_id_list]
    print(boxes_list)
    print('--' * 17)
    print(socres_list)
    print('--' * 17)
    print(classes_id_list)
    print('--' * 17)
    print(classes_name_list)
    print('\n' * 3)

——————————————

That's a big question right now, so good night everyone.

——————————————

I still got some questions, for example, I could get boxes, which is a list containing boxes information.

But how can you know which box you should pick and show?

——————————————

#这下换成内建函数，msdn是个好东西(在win端)

from ctypes import windll

class screen_drawer():

    def __init__(self, hex_color):
        self.hdc = windll.user32.GetDC(0)
        rgb = self.hex_to_rgb(hex_color)
        self.color = self.rgb_to_int(rgb)

    def hex_to_rgb(self, hex):
        hex = hex[1:]
        return tuple(int(hex[i:i+2], 16) for i in (0, 2 ,4))

    def rgb_to_int(self, rgb):
        red = rgb[0]
        green = rgb[1]
        blue = rgb[2]
        RGBint = (red<<16) + (green<<8) + blue
        return RGBint

    def draw_a_point(self, x, y):
        windll.gdi32.SetPixel(self.hdc, x, y, self.color)

    def draw_a_box_on_screen(self, y_min, x_min, y_max, x_max):
        for i in range(0, x_max - x_min + 1):
            self.draw_a_point(x_min + i, y_min)
        for i in range(0, y_max - y_min + 1):
            self.draw_a_point(x_min, y_min + i)
        for i in range(0, x_max - x_min + 1):
            self.draw_a_point(x_min + i, y_min + (y_max - y_min))
        for i in range(0, y_max - y_min + 1):
            self.draw_a_point(x_min + (x_max - x_min), y_min + i)

drawer = screen_drawer('#4286f4')
drawer.draw_a_box_on_screen(80, 80, 400, 400)

——————————————

#做好了，不过为什么我这边得到的windows屏幕的大小是（1536，864），然而这并不能当中点，奇怪😳


from win32gui import GetDC, SetPixel
from win32api import RGB
from win32api import GetSystemMetrics

class screen_drawer():

    def __init__(self, hex_color):
        self.hdc = GetDC(0)
        rgb = self.hex_to_rgb(hex_color)
        self.color = RGB(rgb[0], rgb[1], rgb[2])
        self.center_x = GetSystemMetrics(0) // 2
        self.center_y = GetSystemMetrics(1) // 2

    def hex_to_rgb(self, hex):
        hex = hex[1:]
        return tuple(int(hex[i:i+2], 16) for i in (0, 2 ,4))

    def draw_a_point(self, x, y):
        SetPixel(self.hdc, x, y, self.color)

    def draw_a_box_on_screen(self, y_min, x_min, y_max, x_max):
        for i in range(0, x_max - x_min + 1):
            self.draw_a_point(x_min + i, y_min)
        for i in range(0, y_max - y_min + 1):
            self.draw_a_point(x_min, y_min + i)
        for i in range(0, x_max - x_min + 1):
            self.draw_a_point(x_min + i, y_min + (y_max - y_min))
        for i in range(0, y_max - y_min + 1):
            self.draw_a_point(x_min + (x_max - x_min), y_min + i)

    def draw_a_center_box_on_screen(self, length):
        half_length = length // 2
        y_min = self.center_y - half_length
        x_min = self.center_x - half_length
        y_max = self.center_y + half_length
        x_max = self.center_x + half_length
        self.draw_a_box_on_screen(y_min, x_min, y_max, x_max)

drawer = screen_drawer('#4286f4')
drawer.draw_a_box_on_screen(80, 80, 300, 300)
drawer.draw_a_center_box_on_screen(300)

——————————————

竟然发现我是用QQ邮箱绑定的telegram

吓得我一身冷汗

——————————————

叫你用QQ

——————————————

https://github.com/wangchunming/2017hosts/blob/master/README.md


这运气太好了，叫你用微信

——————————————

关键在于如果不能在名称上表明其作用

你就得到处翻文档

那是很痛苦的

——————————————

总比十个大写字符好

——————————————

淘宝😂

——————————————

还有python的裤子没到

——————————————

有ide补全你怕什么

——————————————

有编译器你怕什么

——————————————

记一串乱七八糟的字符不如记一段有意义的英文句子

——————————————

C++ 最蛋疼的就是那些人用很多大写缩写

完全是装逼，现在的电脑哪还在乎那几个字符所占的空间😒

——————————————

哎，如果实在不行，就用点绘一个方框也可以

——————————————

无所谓啊，反正游戏中人物随时都会动

——————————————

from win32gui import GetDC, SetPixel

hdc = GetDC(0)
x = 0
y = 0
for _ in range(1000):
    SetPixel(hdc, x, y, 16737792)
    x += 1
    y += 1

这个就没建

——————————————

瞎写啥呢，知道的话帮忙解决问题呗。。。

——————————————

好，现在整理一下

SetRectRgn(hrgn, 2, 2, 80, 90) 需要一个 HRGN 类型的参数（https://msdn.microsoft.com/en-us/library/windows/desktop/dd145087(v=vs.85).aspx）

然后 CreatePen(win32con.PS_SOLID, 3, 16737792) 只产生了一个 HPEN 类型的数据（https://msdn.microsoft.com/en-us/library/windows/desktop/dd183509(v=vs.85).aspx）

所以我需要一个接收 HPEN 数据来得到 HRGN 数据的函数（api）

——————————————

https://msdn.microsoft.com/en-us/library/windows/desktop/dd183514(v=vs.85).aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/dd145087(v=vs.85).aspx

我觉得这两个是矛盾的

——————————————

Gdi objects such as brush (HBRUSH),  pen (HPEN) , font (HFONT), region (HRGN), bitmap (HBITMAP) On destruction

http://timgolden.me.uk/pywin32-docs/PyGdiHANDLE.html

http://timgolden.me.uk/pywin32-docs/win32gui__CreatePen_meth.html

——————————————

其实windows目前主要是用C++在支撑，所以把C++也变得十分恶心...

——————————————

你们真有人懂windows编程吗？


from win32gui import GetDC, CreatePen, SetRectRgn
import win32con

print([i for i in dir(win32con) if i[:3] == 'PS_'])

hrgn = CreatePen(win32con.PS_SOLID, 3, 16737792)
print(type(hrgn))
SetRectRgn(hrgn, 2, 2, 80, 80)
print(dir(hrgn))


这个不应该有错啊？

——————————————

虽然这个鬼也可以，但画出来是个实体矩形：

from win32gui import GetDC, Rectangle

hdc = GetDC(0)
Rectangle(hdc, 2, 2, 80, 80)

——————————————

不知道你那个，我想用这个，但就是不知道这里的 hrgn 是什么东西，网上资料太少了

http://timgolden.me.uk/pywin32-docs/win32gui__SetRectRgn_meth.html

http://timgolden.me.uk/pywin32-docs/PyGdiHANDLE.html

——————————————

pygame不是只能在新建的窗口绘图吗？

我要直接在屏幕顶层绘图

——————————————

真没找到直接绘图的py包

但据说可以调用win32来绘图

就和易语言的超级模块里屏幕写字的原理差不多，但我们只需要画矩形

易语言写出的dll是32位的，与咱们高大上的64位tensorflow不符，所以咱只能用pywin32模块自己写了😞

——————————————

先不管这个，比起它单独开一个窗口绘图，我更愿意它直接在屏幕上绘图

怎么办呢

——————————————

print after this np.set_printoptions(suppress=True)

I got something like this: 
[ [ 0.0182578   0.12923348  0.28831497  0.53664744]
 [ 0.          0.69159621  0.27006167  0.85380119]
 [ 0.58650112  0.45487747  0.61464882  0.47155532]
 [ 0.31115252  0.17527957  0.58016253  0.31163746]]

As you can see, it's a list of [y_min, x_min, y_max, x_max].
All number is in the middle of 0 and 1.

——————————————

numpy arrays

——————————————

2.39784122e-02
=
2.39784122×10²


科学计数法😅

——————————————

The coordinates of the each bounding box in boxes are encoded as [y_min, x_min, y_max, x_max]

——————————————

https://www.tensorflow.org/versions/r0.12/api_docs/python/image/working_with_bounding_boxes


它这里讲的boxes是0-1的比例关系

但我们这边得到的输出明显是0-10

——————————————

难道代表比例关系？

——————————————

[  3.07355486e-02   3.80255133e-02   5.80146946e-02   7.91000873e-02]
  [  3.20514470e-01   4.41467643e-01   3.86711568e-01   8.15755248e-01]
  [  1.16672516e-01   4.57820296e-03   9.72460389e-01   2.56505400e-01]
  [  5.81015825e-01   3.83704994e-03   7.84217834e-01   1.57667361e-02]
  [  7.72423387e-01   9.79218185e-02   9.65070367e-01   8.64091873e-01]
  [  2.97921866e-01   6.18675709e-01   3.17120939e-01   6.32115245e-01]
  [  2.05810979e-01   3.68779572e-03   4.20991123e-01   1.43776909e-02]
  [  0.00000000e+00   0.00000000e+00   8.80637228e-01   5.63049555e-01]
  [  3.92125726e-01   1.27022862e-02   9.34177399e-01   2.81523764e-01]
  [  1.62554204e-01   6.06324732e-01   4.84830141e-01   7.24786937e-01]
  [  3.78780663e-02   1.00065038e-01   6.18320584e-01   3.56704473e-01]
  [  1.74412578e-02   4.46169198e-01   1.49949029e-01   8.23125303e-01]
  [  2.44088471e-02   1.98130310e-02   5.78818560e-01   2.71998763e-01]
  [  3.46857369e-01   6.68662429e-01   7.53517926e-01   9.99699831e-01]
  [  8.37100446e-01   1.22434020e-01   9.30866539e-01   1.64737165e-01]
  [  6.41632497e-01   6.48781538e-01   1.00000000e+00   8.69084239e-01]
  [  8.17155764e-02   3.95378411e-01   1.41408786e-01   4.72835004e-01]
  [  1.07396781e-01   4.21199828e-01   7.12409854e-01   7.58325219e-01]
  [  0.00000000e+00   7.73260593e-01   8.71131778e-01   9.60814953e-01]
  [  8.16628337e-01   8.97486787e-03   9.84643817e-01   4.00854498e-02]
  [  8.57902527e-01   5.21018982e-01   9.79681730e-01   5.94060302e-01]
  [  6.88118815e-01   0.00000000e+00   8.25785637e-01   6.88888192e-01]
  [  5.66013455e-01   1.19486228e-02   9.80172515e-01   2.35021412e-01]
  [  2.20373660e-01   6.23525560e-01   2.44689375e-01   6.37659252e-01]
  [  6.36224985e-01   1.27975643e-02   8.54228735e-01   5.33566117e-01]
  [  3.91315430e-01   1.35707691e-01   1.00000000e+00   4.57752109e-01]
  [  7.06926405e-01   2.03326941e-02   8.18738043e-01   1.00000000e+00]
  [  1.32175058e-01   1.40536427e-02   9.47692752e-01   5.50856352e-01]
  [  2.39784122e-02   6.24577641e-01   5.78303516e-01   1.00000000e+00]
  [  0.00000000e+00   4.69461322e-01   1.89320654e-01   6.30855203e-01]
  [  0.00000000e+00   7.43102491e-01   8.53561044e-01   9.93612587e-01]
  [  4.02618885e-01   5.86637497e-01   6.94965124e-01   9.88773704e-01]
  [  1.59441411e-01   6.47190452e-01   4.70317841e-01   7.88871646e-01]
  [  1.44793093e-03   9.43708539e-01   3.62305418e-02   1.00000000e+00]
  [  9.43920016e-03   9.59021389e-01   5.90087891e-01   9.98726904e-01]
  [  5.37315488e-01   3.46107215e-01   7.73099661e-01   9.38199043e-01]
  [  1.87381223e-01   6.55703247e-01   2.07591966e-01   6.88524663e-01]
  [  4.56134617e-01   5.87518513e-03   8.22750390e-01   2.24328101e-01]
  [  5.22724986e-02   5.44404447e-01   3.88570189e-01   6.63419545e-01]
  [  4.73913550e-01   4.59273160e-01   5.46335578e-01   8.06281626e-01]
  [  7.33218372e-01   3.95907938e-01   7.92753041e-01   7.51611412e-01]
  [  2.84125954e-01   5.99049270e-01   5.87287307e-01   7.34099567e-01]
  [  2.60339320e-01   1.42552555e-01   7.19258010e-01   9.01715934e-01]
  [  2.80676633e-01   5.43666720e-01   5.80390573e-01   6.77678108e-01]]]

——————————————

唯一有可能包含位置信息的变量boxes

长这样：
[[[  0.00000000e+00   9.99094844e-02   8.62956285e-01   9.17412460e-01]
  [  4.92391139e-02   3.84009063e-01   2.05517218e-01   8.62422884e-01]
  [  2.77119845e-01   4.08351421e-01   3.33159119e-01   8.44172597e-01]
  [  3.58629823e-02   2.21622586e-01   8.17874491e-01   8.84115338e-01]
  [  1.53862298e-01   3.65073264e-01   2.34666765e-01   8.47025573e-01]
  [  2.74806589e-01   3.64271462e-01   4.47671860e-01   8.46024811e-01]
  [  6.32017732e-01   4.37894583e-01   7.16390729e-01   7.71738768e-01]
  [  1.48207456e-01   0.00000000e+00   8.81179929e-01   1.23900935e-01]
  [  3.06358337e-02   1.71421673e-02   5.83597124e-02   5.21568954e-02]
  [  1.64282411e-01   3.52434427e-01   3.03064287e-01   8.56679797e-01]
  [  4.93822724e-01   5.19018054e-01   7.67029405e-01   6.94663167e-01]
  [  5.28950095e-02   2.56984532e-02   8.16560149e-01   6.12388492e-01]
  [  2.01953173e-01   3.82305026e-01   2.63030946e-01   8.58065128e-01]
  [  8.42391014e-01   1.07587636e-01   9.89142656e-01   1.71468377e-01]
  [  3.54336381e-01   0.00000000e+00   8.42024326e-01   5.23184091e-02]
  [  3.38899702e-01   3.35113704e-03   8.83340478e-01   1.64845571e-01]
  [  5.73787034e-01   4.48510081e-01   6.60616577e-01   7.68203139e-01]
  [  6.99524224e-01   1.09773517e-01   9.94730651e-01   3.85692298e-01]
  [  6.90908253e-01   4.00760561e-01   7.61936128e-01   7.55327106e-01]
  [  8.42022896e-01   5.62747419e-02   1.00000000e+00   1.96891010e-01]
  [  3.15884590e-01   6.20986760e-01   8.00617814e-01   8.70009482e-01]
  [  2.02110410e-03   3.51096481e-01   1.63238212e-01   8.86175990e-01]
  [  5.23652613e-01   4.44883525e-01   6.06465399e-01   7.96046913e-01]
  [  1.05837584e-01   5.01617603e-03   6.13560975e-01   5.53549007e-02]
  [  0.00000000e+00   9.99094844e-02   8.62956285e-01   9.17412460e-01]
  [  2.92378008e-01   6.93494081e-03   7.82085359e-01   2.64738500e-01]
  [  1.64367601e-01   5.42824529e-03   3.36186767e-01   2.28887238e-02]
  [  7.85306334e-01   2.24659517e-02   9.98136878e-01   1.99157953e-01]
  [  4.16244954e-01   4.52163428e-01   5.03045857e-01   8.24390888e-01]
  [  1.83875084e-01   5.96510947e-01   2.06069648e-01   6.25930965e-01]
  [  1.43017024e-02   3.74884725e-01   2.68984854e-01   8.33911061e-01]
  [  3.49507093e-01   3.83749962e-01   7.22125530e-01   4.96084750e-01]
  [  1.39453232e-01   3.35017219e-04   8.09892237e-01   4.70560342e-02]
  [  4.44417953e-01   4.96886671e-01   7.98433423e-01   8.72934520e-01]
  [  2.31187046e-02   8.52613151e-01   8.87979031e-01   9.97459829e-01]
  [  1.81163043e-01   0.00000000e+00   7.88743377e-01   3.65859300e-01]
  [  9.65304077e-01   9.27752852e-02   9.93548691e-01   1.85945958e-01]
  [  2.65616655e-01   5.06414056e-01   3.38706553e-01   8.63233805e-01]
  [  3.49082768e-01   3.82329941e-01   5.28143287e-01   8.44401836e-01]
  [  9.21409488e-01   8.78512859e-03   9.95317340e-01   2.78063983e-01]
  [  2.97923595e-01   4.41329718e-01   7.54052401e-01   8.03780556e-01]
  [  8.05023536e-02   4.14718419e-01   1.70014292e-01   8.06244254e-01]
  [  1.15928888e-01   7.37152398e-01   8.45120549e-01   9.82997000e-01]
  [  7.79626787e-01   9.66982618e-02   1.00000000e+00   2.51527250e-01]
  [  4.93971646e-01   4.69946146e-01   7.61977613e-01   6.51869178e-01]
  [  6.22434616e-02   3.85163724e-03   5.10939121e-01   3.74888301e-01]
  [  3.37339312e-01   5.66874892e-02   6.88295603e-01   1.94446519e-01]
  [  0.00000000e+00   0.00000000e+00   6.37329578e-01   4.15300906e-01]
  [  8.21504831e-01   1.55951828e-03   1.00000000e+00   7.52810091e-02]
  [  1.57556370e-01   5.52541494e-01   4.73027587e-01   6.66230917e-01]
  [  3.76518548e-01   4.71989900e-01   4.42122042e-01   8.43557119e-01]
  [  1.70442045e-01   3.96340728e-01   5.62499344e-01   8.18360806e-01]
  [  7.21322894e-02   5.68050891e-03   6.80672169e-01   1.68969870e-01]
  [  6.60246462e-02   2.43908167e-02   3.69488478e-01   4.13552135e-01]
  [  1.38167530e-01   7.20132189e-03   2.57490486e-01   2.20259093e-02]
  [  4.12357673e-02   1.41790491e-02   7.62046501e-02   6.40161484e-02]

——————————————

8G 内存照样很卡。。。

——————————————

win10确实恶心，以前的绿色版迅雷都用不了


然后新版内嵌浏览器😂





昨天下了transmission，同样的种子在Deepin上是满速，结果win上就是0k

不明所以

——————————————

这…

——————————————

你在win10上用什么p2p下载器？

迅雷限速太恶心了

——————————————

Good night, bro.

——————————————

My heart is broken.

——————————————

The continue statement in Python returns the control to the beginning of the while loop. The continuestatement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop.

——————————————

http://www.tutorialspoint.com/python/python_loop_control.htm

——————————————

一定要开全局代理下载

不然6k/s

——————————————

conda install -c conda-forge opencv=3.2.0

——————————————

Win10 still have this problem...

——————————————

这是一个怎样的世界

微信上禁止反对的声音

就有人一味拥护某党，即使是夸大甚至是谣言

然后我爸妈就放得特大声😔

——————————————

老同学在旁边紧张

啥本领都忘了


其实用gfw list就好了

——————————————

开全局代理才能上

——————————————

chrome打不开扩展插件商城

——————————————

说实话，win10用起来有压力

SSR各种状况…


可以探索了，今夜是个不眠夜

——————————————

坑到老同学 @LYving 的8G内存游戏笔记本

现在可以开坑专心做自瞄了😄

——————————————

其中第二个涉及到高阶编程

基于互联网的多进程数据共享(Distributed Processing)

——————————————

接下来还有很多step need to be cover

比如得到识别出的物体在屏幕上的坐标

比如把识别程序放在另一台机器上，主界面只管自瞄和发送图片到另一台机器

——————————————

在win7上安装完conda后直接不管它

pip手动去安装 http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv and tensorflow

——————————————

额…成功了

——————————————

https://medium.com/towards-data-science/is-google-tensorflow-object-detection-api-the-easiest-way-to-implement-image-recognition-a8bd1f500ea0

Good night.

——————————————

不然就只能像sentax那样，啥都自己写，不借助conda那种微软垃圾狗

——————————————

这个鬼要是不再支持win7、8上的opencv

就只能用win10那个巨无霸系统😒😡

——————————————

Only fuck!

https://github.com/conda/conda/issues/1419

——————————————

I'll try it using windows.


I think i already knew how to deal with it.

——————————————

ImageGrab is macOS and Windows only


So if I want to capture screen for input images, then I have to run this script on windows or mac...

——————————————

It's turned out that conda got its own python version.

So anything you needed should be installed by conda install **

——————————————

[angry]

——————————————

有时候觉得奇怪

那些大神从哪儿找来的这些稀奇古怪的包

——————————————

Why so many missing packages? I'm fed up with this.

——————————————

https://www.continuum.io/downloads#linux

从没见过 499M 的 .sh file

——————————————

那个写物体识别的作者用的是Mac OSX，，，我用个JB的windows啊！

——————————————

说一千，道一万，拿到手，就是干！

——————————————

你都全套了

咱py栈也帮不上

——————————————

koa是啥

——————————————

说得也对😂

——————————————

完了，老大哥不带队肯定连资格赛都进不了😳

——————————————

有django撑着的，怕啥啊😉

——————————————

它说什么平台app都不限

 咱就做web，得心应手

——————————————

@system357 带队
@hex11 和 @bdbai 做web前端
@Shinohara_Rin 搞PS和美化设计
@yingshaoxo 打杂

——————————————

http://astar2017.baidu.com


要不咱们群组成一个团队参赛吧？

——————————————

No, better.

——————————————

Deepin store got a lot of free picture editor.

——————————————

Beautiful, but good night😂

——————————————

可能比起人，我更喜欢机器一点，machine不会背叛你，更不会离你而去。

——————————————

如果lubuntu都可以安装virtual box

Why you need to install Deepin?

说真的，deepin除了好看没啥用，连terminal的字体、风格颜色都不适合coding

——————————————

I don't know who gave it that name.

——————————————

Maybe we should call it task instead of future in Python.

——————————————

Living ideally.

——————————————

只需要100台机器就可以搞垮腾讯

——————————————

https://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.html

——————————————

你可以在单机做出100万级别的轰炸机吗？

——————————————

万恶的 future 类型，很难理解它到底干了啥

——————————————

Concurrency is a way to implement a system that is able to deal with multiple requests at the same time. The idea is that we can move on and start handling other resources while we wait for a resource to become available. Concurrency works by splitting a task into smaller subtasks that can be executed out of order so that multiple tasks can be partially advanced without waiting for the previous tasks to finish.  

——————————————

# This is the simplest way to do a async task 

import threading
import requests

def do_request(*args):
    def callback(id_, url):
        try:
            r = requests.get(url)
            print('{} status:'.format(id_), r.status_code)
        except Exception as e:
            print('{} error:'.format(id_), e)
            exit()

    timer = threading.Timer(0, callback, args)
    timer.start()

url_list = ['https://baidu.com']
for url in url_list:
    for i in range(10000):
        do_request(str(i), url)

——————————————

Retrieving an element from an SSD will be equivalent to doing a four day trip, while retrieving an element from an HDD can take up to six months!

——————————————

First language is very important.

It depens on what you wanna do.

——————————————

Me too.

——————————————

Keep coding..

——————————————

right

——————————————

https://www.google.com/#q=data+science+python&newwindow=1&tbm=bks&tbs=sbd:1

http://gen.lib.rus.ec/

——————————————

Then go to official website.

——————————————

Just see the list of what you should learn...

——————————————

Basically, you can't.

——————————————

https://www.datacamp.com/courses/intro-to-python-for-data-science

——————————————

And for AI.

——————————————

yes

——————————————

Some times you are not only need data analyzeing, but also data visualization.

http://matplotlib.org/

——————————————

Not scalable.

——————————————

R is gabage.

——————————————

http://www.numpy.org/

——————————————

Shit, definetely you should use python for data science.

——————————————

Then why you need 4399 games?

——————————————

Wow, it's amazing. Deepin game for flash.

——————————————

在转移数据准备台式机安装win打游戏

局域网半个小时2%，速度真是感人

——————————————

kivy-buildozer-for-py2:

https://drive.google.com/open?id=0B8M6pE4UPOI5MFRtNVpEOFBJSE0

——————————————


from flask import Flask
app = Flask(__name__) 

@app.route('/') 
def hello_world(): 
    return 'Hello, World!'
    
if __name__ == '__main__': 
    app.run() 


但qpython的好处是可以用pip安装很多三方包，比如flask，然后我就可以用kivy把前后端融合在一起。

看图：

——————————————

事实上用 kivy-launcher 在手机上做调试也可以，能解决调用webview无法点击的问题(qpython就无法点击)，唯一遗憾的是没有报错信息


es浏览器可以直接从py文件跳到qpython，所以把同步文件夹设在kivy-launcher指定的文件夹就好了😏

两个启动器都用

——————————————

熟识课本外的各种英语，考124

那熟解课本外的各种数学问题，是不是也能考124呢？

——————————————

要不然直接卸了

——————————————

有些学校网站的文档或表格是flash的

——————————————

Cpu😅

——————————————

其实chrome挺好的啊


卡只能怪flash，那个垃圾一上场就占30%GPU，严重的时候占70%

——————————————

Cool, I got a 3.4G file.

——————————————

This means that even though KVM can be used to serve other purposes, it has been designed to be run on Ubuntu Server Edition to host non-graphical server operating systems. If you are looking for software to serve graphically-based virtual machines, VirtualBox, Parallels Workstation (or Parallels Desktop for Mac), or VMware Player/Server are more suitable alternatives.


https://help.ubuntu.com/community/KVM

——————————————

https://www.linux-kvm.org/page/Main_Page

——————————————

tar.7z or just .7z?

——————————————

With tar.xz, I got 4.2G in the end.

It took me more than one hour.

——————————————

tailored

量身定制

——————————————

scenario

plot, sequence of events, setting

——————————————

我应该好好看看 android.webkit.webview

——————————————

我在看安卓的文档

都是封装的一些API

不够用了就是Java

——————————————

Interesting

——————————————

compression rate

——————————————

For example?

——————————————

tar.xz would be better

——————————————

12.3G to 5.4G

😞

——————————————

360 controler

——————————————

那self-driving不是一般人能玩的

那个作者花了一万多购置机器

——————————————

kivy

——————————————

编译环境都搞好了，运行环境始终出错


似乎只是在告诉我们，编译只是拿来编译的…

——————————————

https://t.co/ETlJyup28f

——————————————

Yes, I'm sure, last time it works well.

But today I'd rather compress first.

——————————————

No, I have to change something with its origin .ovf file to make it work....

——————————————

But unfortunately, it's more than 12G, no compression yet.

——————————————

Finally, I did it with command:

https://www.jamescoyle.net/how-to/2000-convert-virtual-disk-image-vmware-vmdk-to-virtualbox-vdi

——————————————

exporting

——————————————

😒

——————————————

Can you control my PC?

——————————————

It can't be work, I tryed.

——————————————

I got the same problem with exporting a virtual box image.

Failed to check files.

Result Code: VBOX_E_FILE_ERROR (0x80BB0004)

——————————————

Why

——————————————

Change permission for all files in a folder:


sudo chmod -R a+rX *
sudo chown $USER -R .

——————————————

好吧

事实上是看不懂你写的代码好痛苦

——————————————

虽然工具一个就够了


但当涉猎,见往事耳

——————————————

看来有两位用node.js的同僚

——————————————

事实证明可以用

打包py3只有10M的大小，比我自己搞的编译环境小8M

但问题是共同的，都不能导入其他包如flask，会产生矛盾




这样看来，除了纯粹的核心库程序，kivy还是只能在py2上用三方库

那好，明天我用lubuntu做个编译环境，看看能到多小

——————————————

以你这样说，有谷歌什么语言我不会…

——————————————

我在这里这么久

没听说过某某某在用它写东西

——————————————

…

——————————————

就是能做出什么东西

——————————————

我想本群应该没人会node
js

——————————————

I mean @windoge

——————————————

He is great.

——————————————

花了3天3夜用3个百度云账号把国内某个人做的某个kivy编译镜像下好了，11.5G压缩包，据说支持Py3

等半个小时导入后再看结果

——————————————

这个软件做了我想做的功能


白做了，唉

——————————————

Check out "SingPlay: Karaoke your MP3s"
https://play.google.com/store/apps/details?id=com.nexstreaming.app.singplay

——————————————

等这个完成

应该可以出kivy中级教程吧…

——————————————

好了，设置界面完成

只差逻辑设计

——————————————

I guess I have the same feeling as you before.

But now I understood, this is life, you have to accept that you already old.

——————————————

我本来就会啊

——————————————

自己写

——————————————

自己教程是有好处的

每次直接查

——————————————

实时自动同步

电脑vim写代码

安卓Qpython运行调试


这样还是很爽的，省去了装java、SDK那一堆东西

——————————————

还是用sync吧，全平台支持

——————————————

安卓上写代码太蛋疼

有自动同步文件的软件就好了

Sync有点重，有轻的吗

——————————————

那你能干什么

——————————————

你会用c#做手机平台的软件吗

——————————————

https://youtu.be/mXuEoqK4bEc


Cython could be 150 times faster than Python.

——————————————

@system357 

有没有好玩的群的推荐

——————————————

Just click share button...

——————————————

Could you give me the link of your music list?

——————————————

High so high so high, I'm drunk and high, so high...

http://music.163.com/song/419594258/?userid=280429778

——————————————

Oh, I prefer working alone.

Even if it makes me tired.

——————————————

you're right

——————————————

Strange thing is, he says he came from Budapest, Hungary.

But every project of him has Chinese introduction.

——————————————

The author of this must be a master of kivy and py.


https://github.com/HelloZeroNet/ZeroNet-kivy/tree/master/src

——————————————

ok

——————————————

That's acceptable for me.

——————————————

IT guy may born to hate noise.

——————————————

参考：

https://developer.android.com/reference/android/net/Uri.html
https://github.com/kivy/python-for-android/issues/388
https://developer.android.com/training/basics/intents/result.html
https://stackoverflow.com/questions/17165972/android-how-to-open-a-specific-folder-via-intent-and-show-its-content-in-a-file
http://pyjnius.readthedocs.io/en/latest/android.html

——————————————

从未见过如此恶心的代码

Java是垃圾

Android是垃圾

——————————————

kivy调用外部文件浏览器来选择文件并返回路径：



#qpy:kivy
# -*- coding: UTF-8 -*-
 
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen


from jnius import autoclass, cast
from android import activity

goal_path = ''

Environment = autoclass('android.os.Environment')
PythonActivity = autoclass('org.renpy.android.PythonActivity')
Uri = autoclass('android.net.Uri')
selectedUri = Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath() + '/Download')
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)

def on_activity_result(requestCode, resultCode, data):
    print(requestCode)
    print(resultCode)
    #print(data)
    if requestCode == 1:
        if resultCode == -1:
           print('get')
           one_uri = data.getData()
           goal_path = one_uri.getPath()
           
           if goal_path[:10] != '/external/':
               print(goal_path)
               App.get_running_app().root.get_screen('setting').ids.show.text = goal_path
               return
           else:
               filePathColumn = ["_data"]
               cursor = currentActivity.getContentResolver().query(one_uri, filePathColumn, None, None, None)
               cursor.moveToFirst()
               columnIndex = cursor.getColumnIndex(filePathColumn[0])
               goal_path = cursor.getString(columnIndex)
               cursor.close()
               print(goal_path)
               App.get_running_app().root.get_screen('setting').ids.show.text = goal_path
               return
    print('fail to get')
    exit()

activity.bind(on_activity_result=on_activity_result)
Intent = autoclass('android.content.Intent')
intent = Intent(Intent.ACTION_GET_CONTENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.setDataAndType(selectedUri, "resource/folder")
currentActivity.startActivityForResult(intent, 1)


Builder.load_string('''
<ScreenManager>:      
    SettingScreen
    RecordingScreen

<SettingScreen>:
    name: 'setting'
    
    BoxLayout:
        orientation: "vertical"
        
        TextInput:
            id: show
            
        Button:
            text: 'Above is the path you chooce'
            on_release: root.manager.current = 'recording'

<RecordingScreen>:
    name: 'recording'

    Button:
        text: 'Such a shit'
        on_release: root.manager.current = 'setting'
''')


class ScreenManager(ScreenManager):
    pass

class SettingScreen(Screen):
    pass

class RecordingScreen(Screen):
    pass

class SongRecorderApp(App):
 
    def build(self):
        return ScreenManager()


SongRecorderApp().run()

——————————————

#With this shit, you could open a folder on Android by default filemanager


from jnius import autoclass, cast

Environment = autoclass('android.os.Environment')
PythonActivity = autoclass('org.renpy.android.PythonActivity')
Uri = autoclass('android.net.Uri')
selectedUri = Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath() + '/Download')
Intent = autoclass('android.content.Intent')
intent = Intent(Intent.ACTION_VIEW)
intent.setDataAndType(selectedUri, "resource/folder")
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
currentActivity.startActivity(intent)

——————————————

所以还是买个靠谱的电脑好

——————————————

最重要的是

我需要运行QQ飞车流畅的玩耍

——————————————

虚拟机开Windows卡

同时linux当主系统方便

但做视觉AI时那些人用的工具是win上的py

——————————————

Win和Linux共存我真的做不好

每次没几天就出问题，只能硬盘全格掉，然后全装Deepin或Win

——————————————

从前端到后端

眼看就快没乐趣了



做视觉AI比较有趣和简单（比起数据分析）

但要安装Windows + 游戏，自动化比如开车、自瞄

但台式机Deepin系统上存了一大堆东西(包括虚拟机)，不想删了又下

——————————————

再不搞AI我就会被淘汰了

——————————————

我找到了控制菜单键和返回键的方法

只要把这两个键拦截住

只是按home的话，程序还是在运行的😁

——————————————

这种方式设置也是没啥了…

——————————————

如此一来可以放心的用一倍速看动漫了

不用担心破了技能点

——————————————

死神也有


其实什么海贼王、七龙珠、妖精的尾巴等都有，但都没有在线中文字幕，英文内嵌～

——————————————

日语英幕

这个就有点考能力了

——————————————

新版本竟然出现了很多动漫

——————————————

我也用易语言写过倒计时

但没用，该玩的还是没复习

——————————————

电脑静电音➕我这个破笔记本电脑录音有问题

所以只能用手机了

再说，如果我台式机装上win，还搞什么手机软件

专业Audio Studio就用上了

——————————————

我不确定kivy能否调用非标准库😂

——————————————

恩

这导致很多小程序需要路径的话直接给个编辑框让用户自己写文件路径

这不友好

——————————————

就像html一句代码可以让用户选择文件并上传


我这里只需要知道文件的路径

——————————————

安卓不提供文件选择一键服务，感觉很坑

——————————————

参考之前我做的kivy-chat和kivy-diary两个项目以及简书上写的kivy简明教程，总算把


录制界面做好了，还差设置界面

——————————————

想起我的中考，唉，全挂

9科考414，🙈

——————————————

https://electron.atom.io/apps/

Github出的

——————————————

https://github.com/nwjs/nw.js/wiki/List-of-apps-and-companies-using-nw.js

Not bad

——————————————

看着吧，上大学老师要是敢教我VB

我就把所有要求的程序用易语言写出来

😂

——————————————

精通群介绍里任意一种语言系列都可以算大神了，在中国

——————————————

in_playback(self):
        restart_player(storage_path)

    def delete_file(self):
        reset_player()
        File(storage_path).delete()
        

class SongRecorderApp(App):
    
    def build(self):
        return Manager()


if name == '__main__':
    print('App: storage path == "%s"' % storage_path)

    Config.set('graphics', 'width', '600')
    Config.set('graphics', 'height', '900')

    LabelBase.register(name='Modern Pictograms',
                       fn_regular='modernpics.ttf')

    SongRecorderApp().run()

`


碰上致命错误 `Only one root object is allowed by .kv`

表示谷歌不到啥玩意儿，看了报错部分源代码也没卵用

可能发出来你们也解决不了，反正无奈便是了

——————————————

`
#qpy:kivy
# -*- coding: UTF-8 -*-

from jnius import autoclass
from kivy.app import App
from kivy.lang import Builder

from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.text import LabelBase
from kivy.config import Config


Environment = autoclass('android.os.Environment')
MediaPlayer = autoclass('android.media.MediaPlayer')
MediaRecorder = autoclass('android.media.MediaRecorder')
AudioSource = autoclass('android.media.MediaRecorder$AudioSource')
OutputFormat = autoclass('android.media.MediaRecorder$OutputFormat')
AudioEncoder = autoclass('android.media.MediaRecorder$AudioEncoder')
File = autoclass('java.io.File')

recorder = MediaRecorder()
player = MediaPlayer()

storage_path = (Environment.getExternalStorageDirectory()
            .getAbsolutePath() + '/kivy_recording.aac')


def reset_player():
    if (player.isPlaying()):
        player.stop()
    player.reset()


def restart_player(file_path):
    reset_player()
    try:
        player.setDataSource(file_path)
        player.prepare()
        player.start()
    except:
        player.reset()

def init_recorder():
    recorder.setAudioSource(AudioSource.MIC)
    recorder.setOutputFormat(OutputFormat.THREE_GPP)
    recorder.setAudioEncoder(AudioEncoder.AMR_NB)
    recorder.setOutputFile(storage_path)
    recorder.prepare()


Builder.load_string("""
#:import C kivy.utils.get_color_from_hex

<GridLayout>:
    cols: 2
    spacing: 10
    row_default_height:
        (0.5 * (self.width - self.spacing[0]) -
        self.padding[0])
    row_force_default: True

<Button>:
    background_normal: 'button_normal.png'
    background_down: 'button_down.png'
    font_size: 24
    halign: 'center'
    markup: True

<Manager>:
    Setting
    Recording    

<Setting>:
    name: "setting"
    Button:
        text: "jjj"
        on_press: root.manager.current = 'recording'

<Recording>:
    name: "recording"
    padding: 15

    Button:
        id: begin_or_end_recording
        background_color: C('#3498db')
        text: '[font=Modern Pictograms][size=120]e[/size][/font]\nBegin recording'
        on_press: root.manager.begin_or_end_recording()

    GridLayout:
        Button:
            background_color: C('#2ecc71')
            text: '[font=Modern Pictograms][size=80]M[/size][/font]'

        Button:
            background_color: C('#1abc9c')
            text: '[font=Modern Pictograms][size=80]O[/size][/font]'

        Button:
            background_color: C('#27ae60')
            text: '[font=Modern Pictograms][size=80]Q[/size][/font]'

        Button:
            background_color: C('#16a085')
            text: '[font=Modern Pictograms][size=80]j[/size][/font]'

    Button:
        background_color: C('#95a5a6')
        text: '[font=Modern Pictograms][size=120]P[/size][/font]\nPlayback'
        on_press: root.manager.app.begin_playback()

    Button:
        background_color: C('#e74c3c')
        text: '[font=Modern Pictograms][size=120]X[/size][/font]\nDelete'
        on_press: root.manager.app.delete_file()
ecording
""")


class Setting(Screen):
    pass


class Recording(Screen):
    pass


class Manager(ScreenManager):

    def init(self, kwargs):    
        self.app = self.get_running_app()
        self.is_recording = False
        super(RootWidget, self).__init__(kwargs)
    
    def begin_or_end_recording(self):
        if (self.is_recording):
            reset_player()
            recorder.stop()
            recorder.reset()
            self.is_recording = False
            self.get_screen.recording.ids.begin_or_end_recording.text = \
                ('[font=Modern Pictograms][size=120]'
                 'e[/size][/font]\nBegin recording')
        else:       
            init_recorder()
            restart_player('/storage/emulated/0/netease/cloudmusic/Music/许嵩 - 千古.mp3')
            recorder.start()
            self.is_recording = True
            self.get_screen.recording.ids.begin_or_end_recording.text = \
                ('[font=Modern Pictograms][size=120]'
                 '%[/size][/font]\nEnd recording')
           
    def beg

——————————————

双语幼儿园教师😄

——————————————

似乎我还填了电子信息工程技术


所以下面是所有我可能进的专业：

铁道通信与信息化技术
铁道交通运营管理
智能控制技术
电子信息工程技术
幼师
软件开发

——————————————

我大学可能会学智能控制技术

虽然我第一个专业是填的铁道通信与信息化技术，但不保证上得了

——————————————

现在我觉得Python是神器

配合 jnius 和官方Android、Java文档，做什么原生功能都可以

——————————————

I truly doubt if android creator is SB.

Is this for human understanding?

——————————————

https://developer.android.com/images/mediaplayer_state_diagram.gif

——————————————

他们那么在意注册量的根本在于，实时监测潜在用户有多少，看是否开始收费，怎样收费

所谓“撒大网，捕少鱼”，就是这个道理

——————————————

http://www.jianshu.com/p/385f26bf9977

——————————————

一番折腾后，还是觉得chromium好

快、好看、插件配置代理也方便

多200M没什么

——————————————

买不带静电音的电脑、独立声卡会死

——————————————

https://muxuezi.github.io/posts/kivy-ch3-sound-recorder-for-android.html


Not now, I'm gonna make an app to help me recording song  using microphone on phone.

For kivy design on Android, qpython is a good choice.

——————————————

😡

好电脑写破代码快

——————————————

Alt + F6: Maximize vertically

Alt + F2: Run program




开启电脑后什么都不做只占用360M的内存

太流畅了，机器也不发热




最重要的是，休眠不会死机！！！

Perfect!  完美的键盘党系统。

——————————————

还卡得很

——————————————

事实即证明Xubuntu是垃圾了

不支持快捷切窗口大小

华丽又不足Deepin

——————————————

Ubuntu with LXDE, we call it Lubuntu, just 912 MB.

Ubuntu with XFCE, we call it Xubuntu, 1.2 GB.

——————————————

哇，Lxde可以快捷键切换程序到半屏


我觉得我可以把开发环境换成它le

——————————————

哇，Firefox上的VimFx超好用，连浏览器自己的设置界面都可以操作


我觉得我可以换浏览器了

——————————————

好啊，谢谢提醒，我马上试一下

——————————————

至少要8G+256储存才能用

台电平板3000

同配置垃圾笔记本2000，续航2小时

同配置小米笔记本5000，续航>8小时

——————————————

存储64G

就是便宜到这儿，开不了虚拟机

——————————————

win7也不太差啊

512都可以带动

Deepin要是不给它1G，看它不卡死你～

——————————————

那些公司积累了大量的data，并不急于把它们用web显示出来


反而对app用户很慷慨，比如我上午把许嵩100多首歌全部下载，一分钱没要，还是高速

——————————————

太垃圾了

笔记本内存才1.44

我台式都有1.94

——————————————

Good introduction:

https://docs.docker.com/get-started/part2/#tag-the-image

——————————————

OK, now, let us set chrome for use: 
 
Get chrome pacage name: 
apt --installed list | grep chrome 

Run it: 
google-chrome-stable 
 
 
I assume that you already installed Vimium and Switchy plug in chrome. 
 
So the next thing you should do is change the setting of Switchy. Feel free to do some google after that. 
 
But for now, terminal can't use SS yet, so we have to set a http_proxy using polipo, google it and set it. 
 
 
Remember these shotcuts: 
 
Check out all APPs: Super 
 
Set full screen: Super + Up arrow 
 
Switch program: Alt + Tab 
 
Close program: Alt + F4 
 
Show desktop: Super + D

——————————————

许嵩没让我失望过

——————————————

分享许嵩的单曲《通关》: http://music.163.com/song/487379429/?userid=280429778 (来自@网易云音乐)

——————————————

怀恋只会易语言的时候

快乐的探索

——————————————

https://github.com/HelloZeroNet/ZeroNet-kivy

——————————————

即使如此，也很难找到一个自带chrome的OS了

就为这个，我就放不下它，唉😞

——————————————

Ubuntu-gnome都可以Super key + Left or Right Arrow窗口变成半屏

然而Deepin却是切换工作区，什么鬼，简直华而不实

——————————————

生活如此多娇

其实我只需要一个chrome，一个terminal

一个在屏幕左边，一个在屏幕右边

为什么要把问题搞这么复杂

——————————————

于是你开始思考要手机、SIM卡有什么用

其实只是老一辈人用得多

当你不受政府监控、和新一代人有生意上的往来，拥有稳定Wi-fi并且保持12小时在线的话

你为什么需要充话费？

——————————————

比买手机划算多了

——————————————

https://item.m.jd.com/product/3759811.html?resourceType=jdapp_share&resourceValue=CopyURL&utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=CopyURL


没想到能这么便宜

——————————————

你看，同样是桌面系统

4999元平板能待机9小时

而4999的传统笔记本只能待机2小时，还没有触屏功能

——————————————

现在我反倒看好平板电脑

既可以抛弃鼠标

又可以用上键盘

——————————————

atom平板装deepin(ubuntu等)系统可以触屏吗？

——————————————

还是老老实实用笔记本吧

——————————————

所以安卓开发不靠谱

——————————————

并且手机上的ssh连接工具很多东西都不支持

比如PgUP or PgDn

比如Ctrl + R

——————————————

不可预料的内网ssh和蓝牙键盘断线，不知道是红米2太垃圾还是红米2太垃圾

——————————————

Text substitute in vim


Find each occurrence of 'foo' (in all lines), and replace it with 'bar':
:%s/foo/bar/g

Change each 'foo' to 'bar', but ask for confirmation first:
:%s/foo/bar/gc

foo also could be a regular expression.

——————————————

py2就是麻烦

还要加头部代码才能防止编码错误：


#qpy:kivy
# -*- coding: UTF-8 -*-
 
import sys 
reload(sys) 
sys.setdefaultencoding("utf-8")

——————————————

没Windows基本就没法玩游戏了😀

——————————————

目前出现在我linux上的问题：

1. 休眠机制和笔记本上的不同，导致一睡着屏幕就没法点亮

2. 内核非IE，Flash有问题，导致玩4399创世兵魂卡顿严重，导致我没办法去研究 human detection (自瞄).

——————————————

是我写得很清晰吧😂

——————————————

恩

——————————————

病床之作

——————————————

https://github.com/yingshaoxo/kivy-diary

——————————————

这样的话在京东看完商品还是得去天猫买～

——————————————

京东安卓客户端购物黑幕


什么京东自营的东西你浏览得越多，它系统就自动涨价，以1百为单位

——————————————

好了，今天先到这里，剩下的明天做。。。


免得痔疮复发又花一千多😄

——————————————

治标不治本

——————————————

Survive in Deepin system


For start, you definitely don't want to download with just 40 KB/Second, that's a pain for most of us.

So the first thing we wanna do is install Shadowsocks.

To do that, we have to make sure pip3 is installed, so we do this:

sudo apt update

sudo apt install python3-pip

sudo pip3 install git+https://github.com/shadowsocks/shadowsocks.git@master

After installation, run sslocal to see how to set a local client.(PgUp or PgDn in terminal: Shift + PgUp or PgDn)

——————————————

Let's hacking.

——————————————

唉，deepin装上真是好美

可没鼠标就是没法用

——————————————

自从装了Windows，10天来没写什么东西

自从被修宽带的做了宽带连接，无线死活连不上




一气之下装上Deepin，俺们要和他们决裂

先试用下，快捷键不足就直接装ubuntu server，再不做平台界面，做就做web development

——————————————

Official Torrent

——————————————

Nice speed

——————————————

就这个鬼，插在deepin上可以当成wifi接收器，而在Windows上还需要安装360的软件…

——————————————

PS PK JS

我发现QQ飞车的官网一股PS味，连老式IE都可以看起来那么美，和JS渲染没关系。

——————————————

http://www.aneasystone.com/archives/2015/05/how-does-magnet-link-work.html

https://github.com/borzunov/bit-torrent


I'm trying to find a package doing this complicated work for me with Python3.

But I found nothing.

——————————————

https://www.coder4.com/archives/3751

局域网linux还断线…

——————————————

Sure 可以

——————————————

把出=拿出

——————————————

修网线的小哥被我的系统吓了一跳

要不是我把出win系统的笔记本，他就修不了了

这…要是全部换为linux，以后在学校可能出很多岔子

——————————————

完全是因为deepin based on debian才可以用。

https://gist.github.com/Zerogiven/5a2fcfd6aeda2fe3eb9b




如果是ubuntu，直接：
apt-get install zram-config

——————————————

https://yingshaoxo.blogspot.com/2017/07/using-zram-on-deepin-system.html

——————————————

You don't have to picnic anymore.

I just don't have the chance to try it out, because the internet of my house is broken now.


https://askubuntu.com/questions/174579/how-do-i-use-zram

——————————————

my situation

——————————————

It's hard to understand how to suit myself situation.(Deepin system)


https://stoned.io/linux/Using-ZRAM-Compressed-RAM-Block-Device-On-Debian-Jessie-On-Old-Hardware/

——————————————

I must watch some movies to make me working continually.

——————————————

Tab + alt照样可以在安卓上切换程序

——————————————

vim /etc/ssh/sshd_config
service ssh restart

——————————————

https://mlapp.cn/319.html

好了，虽然成功以文件img的形式安装，但不能直接用root登入，即使设置了密码

手机屏幕太小，感觉很奇怪，明明是用来看片的。。。

——————————————

便宜没好货，延迟高是肯定的

——————————————

累得我直想睡觉

配置环境太烦了

——————————————

无法启动 SSH

——————————————

Vim search a word:  /word + Enter

——————————————

yes

——————————————

为了高兼容度，还是得chroot构建一个ubuntu system。

——————————————

哈哈，这下可以在手机上码代码了

——————————————

你好，我现在正在用蓝牙键盘向您发送信息。。。

——————————————

垃圾系统，ssr老是自动消失，怎么设保护都没用

——————————————

Using Python Forever

——————————————

还有这么多讲究…

——————————————

很明显deepin的快捷键不够多

我想全键盘工作

——————————————

哪种linux?

我姐可能把那个笔记本送我了，因为她叫我大学接着用

我一想挺划算，白捡一台笔记本

——————————————

最近在想到底是ssh连上手机做开发还是开虚拟机

开虚拟机应该很卡

——————————————

我只能装上chrome和telegram

——————————————

我姐借了我一台2G内存联想笔记本

——————————————

老爸自愿贡献它的红米2小手机给我用

root后一键恢复软件，感觉还行，除了屏幕小

——————————————

百度翻译不给矫正，给差评

——————————————

That's why we need big data.

That's why we need data science.

That's why we need Artificial intelligence.




That's why we love programming.

To make the world a beater place.

——————————————

Who produce movies?

Who produce music?

It can't be one man.



All we could do just to make the data showing in a better way, in a logic way, in a meaningful way.

——————————————

We got one feeling, we all want everyone using our apps, but the truth is we can't, as long as we are human.

——————————————

红米note 4x | 3 + 32 | 999 yuan | 熟悉

荣耀8青春版 | 3 + 32 | 1099 yuan | 安卓7.0

荣耀畅玩平板2 | 3 + 32 | 1299 yuan | 屏幕大，方便看电子书

——————————————

I see

——————————————

Seems good

——————————————

I don't know what you mean.

——————————————

买手机也有不好的地方，天天玩手机

不去写代码…

——————————————

maybe

——————————————

荣耀8青春版也不错，安卓7.0

——————————————

如果还是4.4的话买了没用

——————————————

看样子你那种红米note4x还不错

安卓系统是多少？截张图看看

——————————————

亲儿子太贵

还是随便买个国产安卓5.0的垃圾吧

虽然我不想买手机，但我妈坚持要我买

——————————————

只能当废品卖了

——————————————

我去，打击不小

——————————————

不知道买亲儿子能不能用国内的4G移动卡

——————————————

插上电源后一点反应都没有

——————————————

Nothing will happen whatever I trying.

——————————————

差不多该放弃了

去选新手机吧

——————————————

事实证明，维修店也拿我的砖头没办法，说是没办法连接到电脑

诶，垃圾红米Note移动4G单卡增强版，竟然都不留个硬起的方法

——————————————

经过压缩后366集死神只需要50G空间。

可惜字幕不全，这下又烂尾了。。。

——————————————

[101, 102, 103, 104, 105, 106, 107, 108, 109, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 147, 148, 149, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 227, 228, 229, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 287, 298, 299, 303, 304, 305, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 355]

这些集都没有字幕

——————————————

果断扔手机店，50 yuan 下午去取。

还是传统计算机好😜

——————————————

Linux is the best system in this world, no doubt.

——————————————

唉，隔行如隔山

——————————————

手机系统怎么这么不稳定，要是电脑就随便刷😔

——————————————

恭喜我，成功让红米note变成砖头，连fastboot都进不了。

可能得进维修店了

——————————————

# You're right



import re

a = '[jumpcn][BLEACH][272][1280x720]'

def handle(text):
    m = re.search(r'\d+', text)
    return m.group(0)
    # m = re.findall(r'\d+', text)
    # return m[0]
        
print(handle(a))

——————————————


import re

a = '[jumpcn][BLEACH][272][1280x720]'

def handle(text):
    m = re.match(r'\d*', text)
    return m.group(0)
        
print(handle(a))


Where I'm wrong?

——————————————

[jumpcn][BLEACH][272][1280x720]

def handle(text):
    if len(text) == 3:
        return text
    else:
        m = re.match(r'\[\d+\]', text)
        if m == None:
            try:
                result = text.split('- ')[1].split('[')[0]
                return result
            except:
                print(text)
                exit()
        return m.group(0).strip(' ')

It doesn't make sense, it should be work anyway!

——————————————

https://github.com/rime/home/wiki/UserGuide#%E9%81%B8%E5%AD%97%E8%88%87%E6%8F%9B%E9%A0%81

Uing Tab go to next page of input program.

——————————————

Try it out, buddy.

——————————————

Vim commands


Search the word on cursor: *

Jump to next matching: n

——————————————

So what you wanna do after mastering asynchronous programming?

——————————————

kivy

——————————————

滥用列表，过度设计

TextInput 装不下100k的文本，会闪退

——————————————

1.9的kivy可能最大的缺点是列表

无法使用新版列表，同时旧版的列表难用到爆

——————————————

As a real programmer, even if I'm in hospital, I'm still programming by phone touching.

——————————————

Building a Real-Time Object Recognition App with Tensorflow and OpenCV
https://medium.com/towards-data-science/building-a-real-time-object-recognition-app-with-tensorflow-and-opencv-b7a2b4ebdc32

——————————————

上火+拉稀

——————————————

Focus on programming, not talking


Talking is cheap, show me the code.

——————————————

That's video or voice, not text.

——————————————

Sure

——————————————

所以你开发了群主狼？

——————————————

好了

——————————————

/desc_update@zh_groups_bot 
易语言，以及C++、Python3、JavaScript、E4A、按键精灵等。
以我为主，为我所用，人生苦短。

——————————————

哦

——————————————

/desc_update@zh_groups_bot 
简介: 
易语言，以及C++、Python3、JavaScript、E4A、按键精灵等。
以我为主，为我所用，人生苦短。

——————————————

/desc_update@zh_groups_bot

——————————————

/desc_update@zh_groups_bot

——————————————

那这样好了，我改下群主娘的群介绍，表示C系列已经属于本群的讨论范围

——————————————

我只知道c sharp可以写iPhone程序

——————————————

So, I can't understand

——————————————

JSONAPI is a plugin for Bukkit that allows you to access data and other information about your server and your players through a simple, yet secure, HTTP API. This allows you to make awesome websites, iPhone apps, and a way for your players to purchase goods online and automatically receive them in game.

——————————————

所以你打算造个提取json的轮子？

——————————————

.cs是什么鬼

——————————————

听歌轻松下，循环了几十遍😉

https://kg.qq.com/node/play?s=QuA1-2Q2THNn8QF1

——————————————

https://github.com/yingshaoxo/Telegram-with-QQ

https://github.com/JogleLew/coolq-telegram-bot


有竞争者了，但我们俩是不同的

——————————————

以前在 github 就看到 Node.js 有 Telegram connect QQ 的库

现在咱们万能的 Python 也有了，哈哈

——————————————

接下来可能会想想怎样能让人直接import它

而不是copy and paste

——————————————

我纯粹是碰运气搞的这个框架(因为我不懂asyncio的内部原理)

所以无法修复这个问题

——————————————

局限是在关服务器的情况下，要每隔45秒重连一次

而其他情况都是每隔3秒重连一次

——————————————

可以，反正我不用linux+vim就写不出代码了😄

——————————————

痔疮防治(复发)心得：


1. 禁烟酒(这下有正当理由拒烟酒了)

2. 禁辛辣(这下有人叫吃火锅可以不去了)

3. 拉稀用马桶，防止肛口过度开裂(外国人真是聪明)

——————————————

最重要的是，我隐隐感到deepin有后门的风险

——————————————

开发无非需要一个chrome和一个ssh代理

linux重装挺麻烦的

同时考虑到低配机的性能，512内存可以带动win7，而需要1G才能带动deepin

——————————————

不知道学校的网络如何

目前只能在笔记本上装win

万一学校有什么垃圾活动要win呢…

——————————————

我这是装的原版系统，不应该有后门啊

——————————————

同时开的telegram

telegram图标还在，SS不见了，什么事啊

——————————————

好麻烦啊

——————————————

不知道

——————————————

对

——————————————

I can't find it anywhere, but it's running.

——————————————

But why shadowsocks auto hide in win7?

@hex11

——————————————

主要是win的shadowsock的白名单做得还不错

没有乱七八糟的切换问题

——————————————

https://vimium.github.io/

https://support.microsoft.com/en-us/help/126449/keyboard-shortcuts-for-windows

http://winsupersite.com/faqtip/access-taskbar-keyboard-shortcuts



This is all you need to be a geek on windows.

——————————————

Wow, I guess I'm done with setting developing envirnoment.

——————————————

我为什么喜欢理性的东西：


文科类的东西不可验伪，事实可以编造，经验可以编造，但最后得到的结论却感觉那么可信。

理性的东西比如代码，真不真实拿去运行一下就知道了，能运行为真，不能运行就是在扯犊子。

——————————————

I'm also gonna sleep now.

——————————————

My notebook computer

——————————————

最后一课

——————————————

https://www.zhihu.com/question/56695252

——————————————

做手术，得躺在床上看几天书

——————————————

知乎清一色说塞回去

——————————————

发现得了外痔疮

肯定每天坐太久

怎么办呢？

——————————————

我纵横编程界这么些年，从没被欺负得这么惨

一个bug可以拖几个月😭

——————————————

哥们儿我下定决心要把无法打破的TCP框架弄好

这一个星期可能都会搞这个

——————————————

/chat_id@XiaoyaBot

——————————————

先不说程序了

就我这电脑，现在不用chrome都能卡死

我只是在后台处理1080p的视频

——————————————

感觉我要崩溃了

解决了稳定性

目前QQ的消息发不过来…

——————————————

你们在讲什么🌚

——————————————

热升级不被苹果支持

有安全问题



我可以绕过安检给你下马

——————————————

不过目前我的框架运行良好

看下几个小时后会不会发生错乱

——————————————

这样涉及到文本分割

会出问题的

——————————————

换行不行，有些多行文本信息需要发送

——————————————

😄

——————————————

…

——————————————

有更可靠的吗？

——————————————

恩

——————————————

然后我还发现asynio的receive反馈函数是要缓存上个信息的

所以如果不断的发送*1*，就有可能在某次callback时受到*1**1*....

如果只检测收到消息是否为*1*那就麻烦大了

Should 检测*1*是否在文本里…😁



困扰了老子两个月的问题总算解决了

——————————————

我几乎把asycio的文档看了一遍

一直在排查哪些方法可以实现要求

——————————————

我似乎解决了asyncio客户端的重连问题

——————————————

感觉你们学了没用…

——————————————

这代码看着就恶心

——————————————

你们都是JavaScript家的

——————————————

恩

断线就出问题了

不断重连

——————————————

唉，单独看TCP example没问题

嵌入到qqbot可能就出问题了

——————————————

我的tcp例程肯定是失败的

不解决这个问题就没办法继续做即时通讯

——————————————

你的世界服务器什么时候好啊？

——————————————

那意味着要把web和tcp端连接起来需要单独开个websocket server

——————————————

blog.teamtreehouse.com/an-introduction-to-websockets

——————————————

Python indeed confusing to us.

It's hard to know what you wanna do by using this language.

——————————————

https://github.com/miso-belica/sumy

——————————————

https://facebook.github.io/react/tutorial/tutorial.html

其实括号来括号去的语法很烦
然后教程也不是从基础开始的

——————————————

是有点晚了，字都写错了

react

——————————————

用native做前端框架

——————————————

写JavaScript都是轻量级开发，对配置要求不高

什么时候找个网站模拟一下

——————————————

难以想象你们这些上学的搞到一两点钟

——————————————

chroot也可以用我的telegram with qq

——————————————

额

——————————————

到时候一起开挂😄

——————————————

有钱人

小学就有笔记本

——————————————

要想有出路，坚决不能玩游戏

——————————————

为何不买16G内存配32G储存的安卓平板

chroot后也可以外接键盘在Linux环境下写程序

——————————————

分享Westlife的单曲《Nothing's Gonna Change My Love For You》: http://music.163.com/song/2080326/?userid=280429778 (来自@网易云音乐)

——————————————

median
中位数

range
最高-最低

midrange
(最高-最低)÷2

average
平均数

mode
众数

——————————————

让我一个文科生加内存是不是有点为难

——————————————

如果加到5000+如何

——————————————

SSD
solid-state drive 

——————————————

8G 笔记本，一个win10+安卓模拟器就把内存占满了

这么垃圾怎么还有人买？

有没有16G内存经济实惠的笔记本推荐？

——————————————

http://1984life.com/archives/637

chrome://net-internals/#dns

——————————————

到时候把github给你禁了

哼

——————————————

关键手机上

开启了全部经过SS

然后还是访问不了呢

——————————————

我要好好研究下DNS污染了

——————————————

不行

那样治标不治本

——————————————

没有

我用的是修改版的SS qt版

——————————————

操他妈SS明明只绕过局域网

结果还是被污染了

——————————————

让我们说中文快速解决问题

——————————————

😡🌑

——————————————

I hate GFW

——————————————

😡

——————————————

yes

——————————————

I can't do that because even global proxy is based on deepin system proxy itself.

Terminal won't through proxy by default.

——————————————

OK, I can visit now


But I don't want to global all the time actually

——————————————

no

——————————————

8.8.8.8

That's all I know

——————————————

What's that?

——————————————

Just stuck in there

——————————————

ping: http://yingshaoxo.blogspot.com: Name or service not known

——————————————

yes, as long as I can visit

——————————————

NO

——————————————

Wait a moment, I just want to solve this problem

——————————————

What the fuck...

——————————————

It's https I'm pretty sure.

——————————————

Yeah, so how to solve this?

——————————————

But if I give up visit my google blog, after a few hours, it will be visible again.

——————————————

SIChuan GuangDian Internet

——————————————

it's not about my internet.

This is a strange problem, it only happens if I visited google blog a few times.

——————————————

This happens even I turned shadowsocks on, did anyone know how to solve this problem?

——————————————

Over the past few months.

I have been thinking about the meaning of geek.

The key to be a geek is: doing things simple and efficient.


Simple means maintainable.

Efficient means always choice the  better one, saving the time, no matter how difficult it is.

——————————————

I need jingjing

——————————————

Haven't laptop yet.

——————————————

志愿差不多填完了

Let's get started programming tomorrow.

——————————————

Sorry, 3年前我是SB

——————————————

如果我选理科

肯定超越 @hex11

——————————————

@system357 

我就说我历史好吧😄

——————————————

静态文件不带map竟然不行

失策了

——————————————

https://doub.io/http-jc1/

——————————————

其实我还想做一件事

web代理中转

类似这个： archerfroxy.appspot.com

——————————————

Algorithm: Base case and Recursive case


Because a recursive function calls itself, it's easy to write a function incorrectly that ends up in an infinite loop. 

For example, suppose you want to  write a function that prints a countdown, like this: 3...2...1.
Write out that code and run it. You'll notice a problem: this function will fun forever: 3...2...1...0...-1...-2...

When you write a recursive function, you have to tell it when to stop recursing. That's why every recusive function has two parts: the base case, and the recursive case. The recursive case is when the function calls itself. The base case is when the function doesn't call itself again ... so it doesn't go into an infinite loop.

Let's add a base case to the countdown function:

def count_down(i):
    print(i)
    if i <= 0:
        return
    else:
        count_down(i-1)

Now the function works as expected from i to 0.

——————————————

I added this html5 video plyer to that project:

http://dplayer.js.org/docs/#/

——————————————

OK, we're done here!

https://github.com/yingshaoxo/Local_Show

——————————————

这样看来，除了自带个admin应用管理用户数据库很方便外，django不比flask强多少

flask小而强大

——————————————

好了

只差用session做个自动进度保存

任务就完成了👍

——————————————

oops

https://stackoverflow.com/questions/16344756/auto-reloading-python-flask-app-upon-code-changes

——————————————

垃圾电脑，366集渲染到明年

——————————————

对了，刚才发现deepin-movie是py2写的

——————————————

算了，明天直接下外接字幕

——————————————

额…

——————————————

突然发现把mkv用ffmpeg转到mp4后内嵌字幕没了🙈

我不会日文

这几天白下了

——————————————

https://m.douban.com/note/189454782/

——————————————

还有flask那个垃圾

我反复启动了不下50次，手动啊！

真不怕累死人😡

——————————————

写了一天的html混合JavaScript混合jinja的代码

全是bug和不可预料的事

我好烦

——————————————

Handle #(hash) by JavaScript


HTML
<div style="height: 4000px"></div>
<span id='jump_to_this_location'>Jump here!</span>
<div style="height: 4000px"></div>
<span id='jump_to_the_end'>Jump here!</span>


Go to supposed place:
window.location.hash = "jump_to_this_location";

Get current URL and characters after #(hash):
var url = window.location.href;
var hash = url.substring(url.indexOf("#") + 1);
alert(hash);

Change current hash and go to that place:
window.location.hash = '#jump_to_the_end';

——————————————

hash
=
the sign #.

——————————————

ALIGNMENT
alignment

对准; 校准

——————————————

没什么大数据需要处理

所以没学sql

——————————————

如果你学的英文物理，你就可以问谷歌了

——————————————

微波炉蒸玉米

——————————————

So we did the right thing as we moved on.

JavaScript is the tendency of front end, which will help you showing data. 

For example, graph in Khan Academy. 

We call that hybrid app. (web + native)

——————————————

yingshaoxo.cf/home

——————————————

咦

突然发现安卓网页的歌可以连续播放了

——————————————

刷了5遍 number typing lesson

因为我数字始终盲打出错


主要注意两点:
左手食指管4和5
右手食指管6和7，右手食指向左很别扭摸到的那个键叫6，向左上方轻松平移得到的键是7

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

bar graphs
柱状图

——————————————

不会

——————————————

教你怎么拥有永久免费域名

在域名后加年份

每年换一个，永久域名🌚

——————————————

I'm done here.

https://stackoverflow.com/questions/38803257/uploading-multiple-files-with-flask-app-builder

——————————————

Today's mission:


mutilple files uploading on Flask

——————————————

This is the worst code I've ever write,
beats 3.4% person on earth:

class Solution(object):
    def convertToBase7(self, num):
        """
        :type num: int
        :rtype: str
        """
        text = ''
        negative = False
        if num < 0:
            num = abs(num)
            negative = True
        if num < 7:
            if negative:
                return '-' + str(num)
            else:
                return str(num)
        while True:
            quotient, remainder = divmod(num, 7)
            print(quotient, remainder)
            if quotient < 7:
                text = str(quotient) + str(remainder) + text
                break
            text = str(remainder) + text
            num = quotient
        if negative:
            return '-' + text
        else:
            return text

——————————————

Base 7


Given an integer, return its base 7 string representation.

class Solution(object):
    def convertToBase7(self, num):
        """
        :type num: int
        :rtype: str
        """

https://leetcode.com/problems/base-7/#/description

——————————————

With numpy, you can do math with matrix easily.

——————————————

主要是造成系统不稳定

比如我的红米，就算你把应用的数据流量权限全关闭，每次一连上wifi所有应用都可以得到通知栏的网络更新

就算你把系统自动检测更新的选项设成否，开网照样检测更新

——————————————

国内大公司都要给国家留后门，妥妥的

——————————————

说到小米，国内的系统都信不过，后门太多

拿到手就应该刷机

——————————————

我只买得起京东上4000到5000的笔记本

——————————————

额

做音乐可以等一等了，等我买了笔记本再说

——————————————

https://youtu.be/Gymfz5kcqyQ

——————————————

我想我会先搞个翻唱

studio one 在 win10运行良好

就是win10太大了，卡




目前在Linux的 Audacity上可以isolate vocals，(用原版伴奏反向融合也可以得到人声)

然后人声取midi，再把midi用于自己录的声音上😉

——————————————

人生苦短啊，brother

——————————————

程序员的生命最宝贵

——————————————

纯粹是效率问题

——————————————

不是底层，C++会被各种语言虐

——————————————

百万个人里不能出一个能独立写出Linux的人

——————————————

底层不是普通人做的

——————————————

同时也什么都不能做

——————————————

happypeter.github.io/cpp.html

——————————————

https://m.douban.com/group/topic/11136421/

Trust me, Python will rule this world someday.

——————————————

www.stroustrup.com/applications.html

——————————————

从你们的言谈，我就知道我们和 system357 差远了

——————————————

😄

——————————————

python3 manage.py runserver &

——————————————

Terminal is everything.

——————————————

OK, first eye on win10. No matter what you say, I would say it's ugly.

——————————————

You should give it a try to Khan Academy APP. Compare to web version, it's more stable.

——————————————

Statistics is about data, which is data collecting, data presenting or data analyzing.

——————————————

看了国外的几个K歌软件

没原唱+歌词是大写是怎么回事…😄

——————————————

两个小时前突然明白windows的含义

就是很多窗口嘛

——————————————

我得承认

我做音乐那几招完全在windows上，唉

——————————————

它自己的播放又类似快进，几秒钟放完一首歌…

——————————————

奇怪

打开Studio one 后虚拟机其它音频软件都不发声

——————————————

https://drive.google.com/open?id=0B8M6pE4UPOI5YUE4QnNsSmJQdHM

——————————————

The very very important thing is don't use baiduyun, that'll drive you to crazy.

You got Google, you got everything you need.

——————————————

基本搞定

不用win7自带的更新，去官网下一个更新

然后破解后扔许可证，最后发现光是一大堆插件都要20多G

我只给了虚拟机30G

So只有重装，给70G试试

——————————————

你有现成的melodyne安装包吗？Cracked version.

——————————————

I'd better using win10

——————————————

不然你好不容易下几个G的东西，突然发现它是加密的

有何感想？

——————————————

所以又发现小细节了

网盘类应用应该提醒用户该压缩包是否加密

——————————————

在百度盘下了个Studio One破解版

结果是rar加密包，现在正暴力破解



我在想为何不临时在云上购置超高配置vps，这样也许只花几个小时就能爆破密码

——————————————

好想做音乐

正在下win7

——————————————

https://youtu.be/LqgGhJywnHI

——————————————

没想到它一个voice to midi程序，竟然安装了许多机器学习的包

当然最终由于调用了刚才那个我无法下载的插件，导致这是个失败的项目，我无法运行

——————————————

重要的东西不放github都是耍智障

——————————————

http://mtg.upf.edu/technologies/melodia/?p=Download%20and%20installation

这傻逼！真的是想拍桌子！下个插件还要填表，填完表后无响应，艹

谁帮忙下一下啊，这太小众了

——————————————

那些k歌软件

他们的打分系统的原理应该就是把从用户声提取的midi和原歌手歌声提取的midi做对比

——————————————

www.justinsalamon.com/news/convert-audio-to-midi-melody-using-melodia

——————————————

I'm a dreamer, so I choose AI package.


不忘初心，才能始终

Stay hungry. Stay foolish. 

Always remember the initial reason of why you started it.

Always keep faith , hope to the end.

——————————————

You're the one with both.

——————————————

I gotta make choice between those things.

——————————————

For dream, to AI package.
For reality, to JavaScript.

For university, to AI package.
For higher level, to AI package and advanced mathematics.

——————————————

用惯了django觉得flask只能 sending 'hello world' to users.

——————————————

Length of Last Word

https://leetcode.com/problems/length-of-last-word/#/description


beats 74%
class Solution(object):
    def lengthOfLastWord(self, s):
        try:
            sequence = s.strip(' ').split(' ')
            return len(sequence[len(sequence)-1])
        except Exception as e:
            print(e)
            return 0

——————————————

http://music.163.com/#/m/song?id=409647889

I'm feeling drunk and high, because I can do anything on internet

——————————————

Force pull remote to local

git fetch --all
git reset --hard origin/master
git pull origin master

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

/go@XiaoyaBot

——————————————

你知道，虚拟机放音乐或录歌卡得要死

不然我就可以用24k纯英语技能继续做我以前放弃的音乐了…

——————————————

Indentation in vim


Indent current line: >>
Unindent current line: <<

Indent multi lines: >3 + space
Unindent multi lines: <3 + space

——————————————

transmission挂一夜后达到了满速

——————————————

https://youtu.be/1OxU_coXaec

原来4年前就有voice to midi的方法了，可惜当时我不懂英语

——————————————

http://0.0.0.0:43110/0play.bit


A movie site which will never disappear.

——————————————

https://github.com/HelloZeroNet/ZeroNet#docker

http://0.0.0.0:43110/Sites.ZeroNetwork.bit/

——————————————

周杰伦无损音乐全辑 [更新至 2016 - 周杰伦的床边故事] BB5RZ4JNRR2DXONGA6DPWOYINK2E5GCC2

——————————————

It's actually kind of p2p internet.

——————————————

yeah

——————————————

没人做种，几个人几十k，好烦…

——————————————

http://www.80s.tw/

这么多年了，这个网站还是那么好，可惜没https，容易被广告劫持

——————————————

https://gist.github.com/mlsteele/f57adc1fab5c44656d6d

https://github.com/yingshaoxo/ngrok-tool/blob/master/ngrok-tool.py

I hope it'll help me do some forwarding from local to remote with no paying.

——————————————

VIM 

Move forward by a word: w
Move backward by a word: b

——————————————

为什么网上没有在线《死神》动漫可看的？

全TM套用爱奇艺、土豆等的flash链接，还TM过期了…

——————————————

Interesting but costing except docker.

https://youtu.be/vGphzPLemZE

——————————————

It suggested using ctypes to import c extensions.

——————————————

async
读音：A sin k

asyncio
读音：A sin ko

https://youtu.be/2ZFFv-wZ8_g
Not so much people watching those videos...

——————————————

又搭建了一遍kivy3的编译环境

apk闪退…

——————————————

Check out how big files are in Linux:

du -sh *

——————————————

其实我也是有东西想挂在网上

1. 网易上自己喜欢的几百歌

2. 死神全300+集

但是，20G SSD不够用，上传到openload侵权的话又会被删

——————————————

/go@XiaoyaBot

——————————————

突然明白了，你是说谷歌是在利用全球子民识别路上的一切，取得训练集，用来做自动驾驶AI👍

——————————————

https://www.zhihu.com/question/20683224

流氓国家一般都是实名制

——————————————

另一个说法是APP窃取的用户隐私比web多😄

——————————————

突然间就懂了，做网站不用 reCAPTCHA 简直就是灾难

国内的公司用不了，就没什么安全保障，只能死命地做APP

然而安卓没谷歌的更新就是垃圾，核心技术果然在美帝那边，其他国家只能在别人的系统上做做修改😁

——————————————

https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django

——————————————

分享许嵩的单曲《有何不可》: http://music.163.com/song/167876/?userid=280429778 (来自@网易云音乐)

——————————————

kingroot那么屌，用的人也局限于屌丝

网易云英文音乐那么屌，用的人也局限于高中学历即以上

中国市场大部分是没文化的中老年人

——————————————

其实在超市放眼望去

有钱的大佬的老婆很多

穷人更多

——————————————

我们在享受移动互联网的便利同时，付出的是个人隐私这种隐形成本。

下一次，当我们感叹新app好用便利的同时，静思三分钟，好好想想我们的哪些隐私又被当白菜卖了。

mrpeak.cn/blog/encrypt/

——————————————

如果网络服务行业都不用website

你这个测试员可能就失业了

——————————————

Every sources on web page can be downloaded, no matter what technology you are using.

That's why companies needs app.

——————————————

How to add requirements.txt to your python project


1. Creating virtual environment
virtualenv ../ENV --no-site-packages

2. Go to virtual environment
source ../ENV/bin/activate

3. Try to run and debug your project
add essential packages

4. Saving
pip3 freeze > requirements.txt

——————————————

其实上次我就把Python for Android的文档看了一遍

也配置好了一切，就是生成的python3 APK闪退

所以就没管它



Anyway, if you are not familiar with kivy UI design, why you need output apk?

——————————————

换账号之前的9个G就白下了

这就是我必须吐槽的原因

——————————————

linux

——————————————

https://github.com/nkiiiiid/kivy-apk

https://github.com/nkiiiiid/kivy-apk/issues/1

不知道怎么想的，用百度云

我下了三天三夜，还剩4个G，3k一秒


简直是害人！花一个月时间下这么个东西！😡

——————————————

This is a question about making function by yourself or using function that already done.

——————————————

群里有一群大佬的感觉真好

问题都争着答

可惜还是 Google 好用

——————————————

https://stackoverflow.com/questions/28328890/python-requests-extract-url-parameters-from-a-string

——————————————

requests will be better

——————————————

And why don't you just copy codes instead of picture?

——————————————

lstrip is for the left side
rstrip is for the right side


But why don't you using strip('id=')

——————————————

Here’s a list of some features Golang doesn’t support:

ClassesOperators 
overloadingFunction 
overloadingOptional Parameters
exceptions





Wow, not good.

——————————————

为什么不学Golang

看上去C++的标准库真心不适合开发(应该会累死)

——————————————

虽然今天很累了

还是要吐槽一句：

不少不看英文文档的Pythoner写的东西像狗屎一样，PEP8 规范可能让狗吃了

——————————————

http://yingshaoxo.cf:5277

OK, now I can create as much app as I like.

——————————————

Using chrome F12 to change anything on webpage, then save that page. You own that page.

Why you need to learn JavaScript?

——————————————

porridge = rice + three times water

——————————————

https://blog.codinghorror.com/the-ten-commandments-of-egoless-programming/?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website

——————————————

...

——————————————

机器学习（入门）


You need to  了解基本的微积分和线性代数知识。

But unfortunately, I don't know about either of them.

——————————————

Deep learning prerequisites and requirements on udacity:


Minimum 2 years of programming experience (preferably in Python)
Git and GitHub experience (assignment code is in a GitHub repo)
Basic machine learning knowledge (especially supervised learning)
Basic statistics knowledge (mean, variance, standard deviation, etc.)
Linear algebra (vectors, matrices, etc.)
Calculus (differentiation, integration, partial derivatives, etc.)

至少2年的编程经验（最好是运用 Python 语言）
Git 和 GitHub 使用经验（GitHub 资源库中有作业代码）
基本的机器学习知识（尤其是监督学习）
基本的统计学知识（平均值、方差、标准差等）
线性代数（向量、矩阵等）
微积分学（微分、积分、偏导函数等）

——————————————

love.ranshy.com/社工库杂谈/

——————————————

I almost done in Share_All project.

Now I only need an index page to show all my apps in Django.

——————————————

Wow, nice.

——————————————

A chinese group robot,,,useless

——————————————

@zh_groups?

——————————————

Where are you from?

——————————————

hi

——————————————

https://youtu.be/D-5V7s0GflU

——————————————

😒

Boring stuff on bottom network protocol.

——————————————

most of us

——————————————

From simple to hard is the right way for study, but most of people don't follow it.

——————————————

But you could enjoy the feeling of thinking.

——————————————

Boring except doing math or speaking English

——————————————

Wow😳

What are you doing in school normally?

——————————————

No linux virsion.

I won't use that even I used that before.

——————————————

No, just using GIMP drew a line.

——————————————

https://www.soimort.org/

“但凡牛逼之人，博客里起码一半是英文”

——————————————

Why you should learn math on Khan Academy?

One reason for that is programming knowledge will out of date very fast.

——————————————

Algorithm-Preparation: Recursion 


Suppose you're digging through your grandma's attic and come across a mysterious locked suitcase. Grandma tells you that the key for the suitcase is probably in this other box. This box contains more boxes, with more boxes inside those boxes. The is in a box somewhere. What's your algorithm to search for the key? Think of an algorithm before you read on.

Here's one approach:
1. Make a pile of boxes to look through.
2. Grab a box, and look through it.
3. If you find a box, add it to the pile to look through later.
4. If you find a key, you're done!
5. Repeat.

Here's an alternate approach:
1. Look through the box.
2. If you find a box, go to step 1.
3. If you find a key, you're done!

___

Which approach seems easier to you? 

The first approach uses a while loop. While the pile isn't empty, grab a box and look through it:
def look_for_key(main_box):
    pile = main_box.make_a_pile_to_look_through()
    while pile is not empty:
        box = pile.grab_a_box()
        for item in box:
            if item.is_a_box():
                pile.append(item)
            elif item.is_a_key():
                return "found the key!"

The second way uses recursion. Recursion is where a function calls itself. Here's the second way in pseudo-code:
def look_for_key(box):
    for item in box:
        if item.is_a_box():
            look_for_key(item)
        elif item.is_a_key():
            return "found the key!"
___

Both approach accomplish the same thing, but the second approach is clearer to me. Recursion is used when it makes the solution clearer. There's no performance benefit to using recursion; in fact, loops are sometimes better for performance.

Many important algorithms use recursion, so it's important to understand the concept.

——————————————

pseudocode

伪代码

——————————————

然后遇到 Angular JS，对于这种想把前后端融合的野心家就两字：坚决不用

——————————————

几天下来发现C++一无是处

根本没几个地方用得到它

另外别人开发ios和Android都是用react native

——————————————

Just beautiful

——————————————

But the input widget is very ugly.

——————————————

Which one you would like?

——————————————

“可惜autodraw没有更多的颜色可供选择，不然100%模拟也不是不可能”

——————————————

The color of TIM seems more colorful.

——————————————

Spent a few hours to draw this...

——————————————

bi·na·ry tree


a data structure in which a record is linked to two successor records, usually referred to as the left branch when greater and the right when less than the previous record.

https://www.google.com/search?q=binary+tree&oq=binary+tree&aqs=chrome..69i57&sourceid=chrome&ie=UTF-8









Fuck, another data structure that I never seen before.

——————————————

Symmetric Tree


Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

https://leetcode.com/problems/symmetric-tree/#/description

——————————————

https://www.linkedin.com/in/nanshuwang/?ppe=1

——————————————

“吃蛋白粉健身—增肌”

——————————————

Beats 36%

class Solution(object):
    def merge(self, nums1, m, nums2, n):
        nums = []
        nums.extend(nums1[:m])
        nums.extend(nums2[:n])
        
        del nums1[:]
        nums1.extend(nums)
        nums1.sort()
        
        if nums1[0] > 0:
            for _ in range(nums1.count(0)):
                nums1.remove(0)

——————————————

Merge Sorted Array


Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.

Note:
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 and nums2 are m and n respectively.

class Solution(object):
    def merge(self, nums1, m, nums2, n):
        """
        :type nums1: List[int]
        :type m: int
        :type nums2: List[int]
        :type n: int
        :rtype: void Do not return anything, modify nums1 in-place instead.
        """

https://leetcode.com/problems/merge-sorted-array/#/description

——————————————

“全职的倒是好找，兼职的就不行了”

——————————————

“爸妈不让待家里，总得找点事做啊”

——————————————

http://jianli.58.com/resume/2_3jr2ij4qiq3siw9ViwaVRE-k3jxqZEAuZEik3u2f3DvVij9W3joBgw423S2V3Er23Eb*/?iuType=p_0&PGTID=0d303690-0094-d058-4495-f5725021a9e3&ClickID=4

😔I can't find any job on my hometown.

——————————————

Review in 2015 and 2016 


You may wander what I have learned during 2015 and 2016.
Let's count one by one:

1. reading list
Introducing Python
Mastering Python Regular Expressions

2. third-party packages I used
Requests
Flask
BeautifulSoup4
Django
Selenium
Kivy

3. what I can do on internet?
Using Requests and BeautifulSoup4 or Selenium do some crawling.
Using Flask or Django build website.
Using Kivy write UI, which means Linux, Windows, OS X, Android and iOS APP.

4. what I can do on real life?
Talking with you.


To do 2017:
1. Get driver license
2. At least solve 100 algorithm problems during this year
3. Insist learning on Khan Academy everyday
4. Learn JavaScript for web design

——————————————

https://youtu.be/hT9TuR9YrWA

——————————————

Are you afraid?

——————————————

Just show you to us

——————————————

“有人说你不会讲英文”

——————————————

Useless

——————————————

# ABC
### EFG

——————————————

how can you

——————————————

But how you can confirm that telegram supports markdown?

——————————————

Check by yourself

——————————————

I don't want to do that

——————————————

/go@XiaoyaBot

——————————————

https://github.com/soimort/you-get/issues/1990

What a pity, I want to download my songs in NetEase Music...

——————————————

Do what you can do.

——————————————

分享TheFatRat的单曲《Elegy》: http://music.163.com/song/441612740/?userid=280429778 (来自@网易云音乐)

——————————————

/go@XiaoyaBot

——————————————

“暴露年龄”

——————————————

“你考得怎样啊？”

——————————————

same

——————————————

not the samw

——————————————

list in Python is not same with algorithm's list.

——————————————

Algorithm: Selection sort


Let's learn your second algorithm.

Suppose you have a bunch of music on your computer. For each artist, you have a play count. You want to sort that list from most to least played, so that you can rank your favorite artists. How can you do it?

One way is to go through the list and find the most-played artist. Add that artist to a new list. Keep doing this, and you'll end up with a sorted list.
___


Recap what we have learned:

Your computer's memory is like a giant set of drawers.
When you want to store multiple elements, use an array or a list.
With an array, all your elements are stored right next to each other.
With a list, elements are strewn all over, and one element stores the address of the next one.
Arrays allow fast reads.
Linked lists allow fast inserts and deletes.
All elements in the array should be the same type (all ints, all doubles, and so on).

——————————————

@NewWorld

——————————————

挖掘

——————————————

https://www.sharelatex.com/learn/List_of_Greek_letters_and_math_symbols

——————————————

OMG, I hate network theory.

——————————————

I even can't solve one problem...

——————————————

Move cursor around in Vim


Up: k
Down: j
Left: h
Right: l

To the beginning of file: gg
To the end of file: G

——————————————

/go@XiaoyaBot

——————————————

Wow, beautiful html codes in blogger!

https://yingshaoxo.blogspot.com/2017/06/i-firmly-believe.html

——————————————

Lists are better if you want to insert elements into the middle. 
For arrays, you have to shift all the rest of the elements down.

——————————————

/go@XiaoyaBot

——————————————

/chat_id@XiaoyaBot

——————————————

/go

——————————————

/chat_id@XiaoyaBot

——————————————

Song of single dog

——————————————

https://kg.qq.com/node/play?s=I-6vw2I-hoWnjIZW

——————————————

It works well

——————————————

For super ability of listening.

——————————————

In fact, I usully watch ENGLISH TV in two times speed.

——————————————

Dressed like a B

——————————————

Useless time full of it

——————————————

Fuck that m4a garbage

——————————————

http://www.snakehacker.me/411

"自动问答是我的硕士毕业研究方向"
Just a web crawler...

——————————————

Here we go...

——————————————

It's the only way to make me feel different from others.

——————————————

I must insist doing it.

——————————————

From now on, I'll speak English on internet forever.

——————————————

Also python.

——————————————

It's python.

——————————————

Now this is my only faith.

——————————————

表示这辈子再也不碰高考了

——————————————

对的打勾，错的打差

主观题自己打分

——————————————

我回来了，考得不是一般的烂！

——————————————

接下来要开始为期两天的一个人的高考，wish luck with me.

——————————————

兄弟们，我人生第一次住宾馆！

——————————————

这几天我高考，停更

——————————————

美国学生高中毕业考大学，都是自己申请的。每个人会申请好几所学校，有时会被它们同时录取，自己选择一个。申请的时候主要提交这么几个材料。一个是高中的成绩单、排名，第二个是SAT考试，相当于我们的高考。SAT在美国一年考7次，学生到了高二、高三都可以去考，只要在申请之前拿到分数就可以了。考砸了还可以把成绩取消掉重考。这两个是最主要的。


“光是一年考7次，我就觉得那儿是学生的天堂。”

——————————————

8点睡+2例褪黑素=睡得香

梦见我爸跨越了30岁娶了我在网上认识的和我一样大的外国妞

突然想到社会好不正常，男女差8岁绝对有代沟、不是一个世界的人，然而还是因为物质的关系在一起了😱

——————————————

Algorithm: Arrays and linked lists


Sometimes you need to store a list of elements in memory. Should you use an array, or a linked list?
___


With arrays, every element must stay with each other in memory. Now suppose you have an array which is 1, 2, 3, 4. You want to add 5 to this array. All you have to do is add 5 after 4 directly, coming close with 4's address. 1, 2, 3, 4, 5 stored in memory continuously.

But what if the address after 4 is taken up by other data? Then you can't just add 5 to that array anymore. It's like going to a movie and finding a place to sit, but you saw your friends already in there, you want to join them, and there's no place for you. You have to move to a new spot where you and your friends all fit. In this case, you need to ask your computer for a different chunk of memory that can fit all five numbers. Then you need to move all your numbers to that place.

One easy fix to this problem is to "hold seats": even if you have only 4 items in your numbers, you can ask the computer for 10 slots, just in case. Then you can add 6 items to your number list without having to move. This is a good container, but you should be aware of downsides:

1. You may not need the extra slots that you asked for, and then that memory will be wasted. You aren't using it, but no one else can use it either.

2. You may add more than 10 items to your number list and have to move anyway.
___


With linked lists, your items can be anywhere in memory. Each item stores the address of the next item in the list. A bunch of random memory addresses are linked together.

It's like a treasure hunt. You go to the first address, and it says, "The next item can be found at address 123." So you go to address 123, and it says, "The next item can be found at address 847," and so on. Adding an item to a linked list is easy: you stick it anywhere in memory and store the address with the previous item.

With linked lists, you never have to move your items. You also avoid another problem. Let's say you go to a popular movie with five of your friends. The six of you are trying to find a place to sit, but the theater is packed. There aren't six seats together. Well, sometimes this happens with arrays. Let's say you're trying to find 10,000 slots for an array. Your memory has 10,000 slots, but it doesn't  have 10,000 slots together. You can't get space for your array! A linked list is like saying, "Let's split up and watch the movie." 
___


In general, reading an item from an array needs one operation, but inserting an item to it needs n steps. Reading an item from linked list needs n operations, but inserting an item to it only needs 1 step.

——————————————

连谷歌都可以被中国官方黑客入侵

那些没信仰的公司就别指望了，从此你就是在网络上裸奔

——————————————

国内服务最恶心的一点是不能删除账号

你们提前把国内服务换完了，咋没人给我说61儿童节全面实名制啊

现在好多账号估计登不上了，想把那些暴露个人信息的东西删了都不行

——————————————

How to select and delete until end of file in vim?


VGx

gg go to the beginning of the file, G go to the end of the file.

——————————————

What started as one man tutoring his cousin has grown into an 80-person organization. We’re a diverse team that has come together to work on an audacious mission: to provide a free world-class education for anyone, anywhere. We are developers, teachers, designers, strategists, scientists, and content specialists who passionately believe in inspiring the world to learn. A few great people can make a big difference.

80个人撑起全球90亿人的免费教育，人们真没良心

——————————————

可惜几天后就高考了

——————————————

讲得非常细致， reflective symmetry 都讲到了，至少从高一跟着这个走，学校组织的考试不会差

——————————————

exponent

指数

——————————————

Algorithm speed isn’t measured in seconds.

Algorithm times are measured in terms of growth of an algorithm.

The faster growing, the worse solution.

——————————————

《 10 Cloverfield Lane 》

——————————————

了解更多

——————————————

通篇都是废话

——————————————

其实人生如此艰难，何必装逼为难别人呢

秀优越就算了，老老实实做好项目才是真的😐

——————————————

Modeling with sequences

他们似乎直接把构建函数(function)叫做建模

——————————————

common ratio

公比
共同的比率

——————————————

geometric sequences

等比数列(虽然字面上看是几何数列)

——————————————

原来f(x)是指的function (x)，我学了几年数学竟然不知道

万恶的Chinese封闭式教学😂

——————————————

这数学课是越听越爽，就像看大神教编程一样

好多东西被本土语言一糟蹋后还真是让人提不起兴趣😏

——————————————

recursive formula 

递推公式; 递归公式(你干嘛要记两个人为制造出来的词语，特别是后者，毫无字面意义可循)

——————————————

arithmetic sequences

等差数列

——————————————

特别是Python，和数学走得最近

key and value在他们的数学定义里也是这样讲的

——————————————

这样的话我觉得，Math+English+Programming是绑在一起的

Math提供理论，English负责表示，Programming负责实现

他们共享着差不多的世界观

——————————————

他们高中一年级竟然要学散点图、数据分布这些😄

——————————————

Send some emails to future me.

——————————————

https://www.khanacademy.org/science

相比之下，你们理科的东西全球差异性不大，主要是各地蹩脚的本土化语言会对你的理解造成阻碍。

——————————————

斜率实际上是告诉你how quickly the y goes up

x run 1 unit, y run slope个 y.

——————————————

这TM刚学斜率就和导数联系起来了

顺便还教了Python timedate 模块中的delta类型😂

——————————————

horizontal
横de

vertical
垂直; 纵 de

——————————————

axis
轴


The x-intercept is the point where a line crosses the x-axis, and the y-intercept is the point where a line crosses the y-axis.

——————————————

x-intercept
x截距

y-intercept
y截距

——————————————

真是奇了

人家上第一节linear equation课就教你variable、constant是什么东西，真是与programming接轨

——————————————

不过还是用PC看克汉学院的视频比较好

因为屏幕够大，看得够清楚

——————————————

就是 standard package codes

——————————————

哈哈，快要迈入看原语言代码的时代了

——————————————

Yeah, I just thought about that.

——————————————

不过你得先学会英语

不然无法进阶(吸收无穷尽的资源)

——————————————

Bernice sells 135 sea shells by the sea shore every day. She sells each sea shell for 3 dollars.

For how many days does Bernice need to sell sea shells to earn 2430 dollars?

——————————————

这种巨大的中外教育反差

似乎在告诉我们一件事，在中国读完小学就可以做国外上完高中的事了

再读就是浪费你的时间(真的好像小学题～)

——————————————

pea pods
豌豆荚

——————————————

这次是真的体会到官方文档帮不上忙了

官方文档包括国内的某些装逼分子都是一次性用asyncio，基本loop.run_forever()后就没了

怎么断线重连、怎么第二次loop.creat_connection()完全没有涉及到的东西

🌚就感觉我被世界孤立了，就好像其他人不用做这个一样

难道我真要用底层socket模块吗？😔

——————————————

美国人高中学的数学和我们的不一样

他们似乎把各科用到的数学公式都讲了

还告诉你总的来说，公式是怎么来的

就算出应用题，也是小学六年级的应用题(虽然我小学6年级的应用题从来没做出来过～)

——————————————

Have something to bring to the table, because that will make you more welcome.
你必须要有一些真本领，这样可以让你更受欢迎。


You've got to get the fundamentals down because otherwise the fancy stuff isn't going to work.
你必须练好基本功，否则后面的事情都不会发生。


That was a bit of a setback.
你总会遇到挫折。

But remember, the brick walls are there for a reason.
但是记住，它们的出现不是没有原因的。

The brick walls are not there to keep us out. The brick walls are there to give us a chance to show how badly we want something.
砖墙并不是为了挡住我们。它在那里，只是为了测试，我们的决心到底有多迫切。

Because the brick walls are there to stop the people who don't want it badly enough. They're there to stop the other people.
它在那里挡住了那些没有强烈决心的人。它不让那些人通过。

Remember brick walls let us show our dedication.They are there to separate us from the people who don't really want to achieve their childhood dreams.
记住，砖墙的存在是为了显示我们自己付出的决心。它使得我们，同那些并不真的想实现梦想的人得以区分。


i. Helping others.
帮助他人。

ii. Never lose the childlike wonder. It's what drives us.
永远不要失去好奇心，它是人类前进的动力。

iii. Loyalty is a two way street.
诚以待人，这样别人也会忠实地对待你。

iv. Never give up.
永远不要放弃。

v. You can't get there alone. People have to help you. You get people to 
help you by telling the truth.
你不能单打独斗，必须有人来帮你。只要你讲真话，就会有人来帮你。

vi. Apologize when you screw up and focus on other people, not on yourself.
当你把事情搞砸，首先要向别人道歉，首先关心他们的损失，而不是你自己的损失。

vii. When you do the right thing, good stuff has a way of happening.
如果你做了正确的事，好的结果自然会发生。

viii. Get a feedback loop and listen to it.
注意倾听反馈。

ix. Show gratitude.
感恩。

x. Don't complain. Just work harder.
不要抱怨，而要加倍努力。

xi. Be good at something, it makes you valuable.
要有一技之长，它使你有价值。

xii. Work hard.
努力再努力。

xiii. Find the best in everybody.
注意发现他人的优点。

xiv. Be prepared. Luck is truly where preparation meets opportunity.
做好准备。所谓幸运，真的是机会和准备的结合。


http://www.ruanyifeng.com/blog/2008/08/randy_pausch_the_last_lecture.html

——————————————

Denominator

分母

——————————————

原来公式的units(单位)是这样制造出来的：

https://www.khanacademy.org/math/math1/math1-units/math1-intro-to-dimensional-analysis/v/figuring-out-units-from-formula

——————————————

Compound inequalities

复合不等式

A compound inequality is an inequality that combines two simple inequalities. 

——————————————

Phone give me more pleasure.

电脑chrome经常out of memory卡死。

——————————————

算了20多个不等式才过关

我的出错率也太高了

——————————————

inequality

不等式

——————————————

coefficients

系数

——————————————

https://www.khanacademy.org/

A great place for learning everything.

——————————————

logb(y) = x" is the equivalent logarithmic statement, which is pronounced "log-base-b of y equals x"

Logs are the flip of exponentials.

——————————————

Algorithm: Binary search


Suppose you’re searching for a person in the phone book (what an oldfashioned sentence!). Their name starts with K. You could start at the beginning and keep flipping pages until you get to the Ks. But you’re more likely to start at a page in the middle, because you know the Ks are going to be near the middle of the phone book.

For example, I’m thinking of a number between 1 and 100. You have to try to guess my number in the fewest tries possible. With every guess, I’ll tell you if your guess is too low, too high, or correct.

If you start guessing like this: 1, 2, 3, 4 …, that would be silly. With each guess, you’re eliminating only one number. If my number was 99, it could take you 99 guesses to get there!

Here’s a better technique. Start with 50. If it's too low, then you just eliminated half the numbers! Now you know that the answer is between 50 and 100. 

Next guess is 75. Suppose too high, but again you cut down half the remaining numbers! With binary search, you guess the middle number and eliminate half the remaining numbers every time. Next is 63 (halfway between 50 and 75).

Whatever number I’m thinking of, you can guess in a maximum of seven guesses—because you eliminate so many numbers with every guess!

In general, for any list of n, binary search will take log2 n steps to run in the worst case, whereas simple search will take n steps.

This is binary search. You just learned your first algorithm!

——————————————

No password

——————————————

I'm so tired, what a day!

——————————————

by the way good evening guys

——————————————

😳

——————————————

这几年从英语专业转行做程序员的也不少(多是男的)

——————————————

It's true, especially on internet through Google.

——————————————

Through 我现在并不想成为英语大神

但不学算法也做不了top coder

——————————————

What you said is really fascinating for me

——————————————

美国大佬应该睡醒了

不过我最近似乎不在状态

浪费了大家不少时间

——————————————

我还真没想到群里会来两位大神

I appreciate

——————————————

我可能只有一百多部电影的储备

还多是动作戏

不够用

其他都是被动词汇和句子

——————————————

真正英语对话起来才发现捉襟见肘

——————————————

很可能是全局变量与其它什么的产生了冲突

或者内存泄漏…

我计算机刚才错乱严重时叫了一声…

——————————————

No

关键是qq.py在本地，混乱不到服务器

——————————————

回到正题

这个消息的混乱很有可能是端口的混乱导致的

0.0.0.0是监视所有端口

——————————————

Wait a minute, maybe you need this group:

@Gao_Kao

——————————————

Don't be mind

Programming Language just a tool for work.

——————————————

Super robot

——————————————

By the way, English is the best Language in this world.

——————————————

I truly understand your feelings

We need friends when we feel alone.

——————————————

Are you a gay?

——————————————

Manning.Grokking.Algorithms.2016.5

——————————————

This is a nice book:

——————————————

最后一本书讲自动化，不错

——————————————

顺便回忆起以前不知道谷歌的时候

想到C++，找半天只能找到小甲鱼视频教程…

明明谷歌上一大堆，而且最重要的是视频是最低效的学习方式

如果你觉得你只能靠视频学东西，只能说明你那里的人类还不会用document、还停留在“石器时代”(专制的真人视频教学为主的时代(未解放广大人民创造力的时代(low tech的时代)))

——————————————

https://www.cnblogs.com/alex3714/

当神棍做培训应该很爽吧，一个学员动不动就5、6千

——————————————

我想起了我第一次处理错误的时光

只不过是把错误信息的最后一行放到谷歌

答案就出来了

真是幸福

——————————————

我想作为一名程序员最痛苦的事就是出了bug却不知道从何去解决bug

——————————————

kivy-chat还好

在QQ互联那里出的错

——————————————

asyncio就像一头巨兽

loop
future
这些术语又难以理解

事实上我还没真正用过它，我只是套了个线程的壳

——————————————

一些错误信息

类似这个，我完全看不懂

——————————————

read Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/yingshaoxo/Desktop/Files/Codes/Python/Telegram-with-QQ/qq.py", line 79, in receive_msg
    self.loop.run_until_complete(self.coro)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 434, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 393, in run_forever
    raise RuntimeError('Event loop is running.')
RuntimeError: Event loop is running.

Event loop stopped before Future completed.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/yingshaoxo/Desktop/Files/Codes/Python/Telegram-with-QQ/qq.py", line 79, in receive_msg
    self.loop.run_until_complete(self.coro)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 434, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 393, in run_forever
    raise RuntimeError('Event loop is running.')
RuntimeError: Event loop is running.

Event loop stopped before Future completed.Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/yingshaoxo/Desktop/Files/Codes/Python/Telegram-with-QQ/qq.py", line 79, in receive_msg
    self.loop.run_until_complete(self.coro)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 434, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.5/asyncio/base_events.py", line 393, in run_forever
    raise RuntimeError('Event loop is running.')
RuntimeError: Event loop is running.

Event loop stopped before Future completed.

——————————————

话说SS很稳定对吧

用广电网络，直接把网给你断了，你一点办法没有

——————————————

持续关注

不稳定不罢休

——————————————

长连接真有这么难吗

就连最初的kivy都出错了

——————————————

到底是QQ太垃圾还是我技术太垃圾

——————————————

我这辈子没遇到这么多错误

万恶的Sockets和网络

——————————————

https://www.google.com/search?q=python3&oq=python3&aqs=chrome..69i57j69i60j69i59l3j69i61.2154j0j8&sourceid=chrome&ie=UTF-8#q=python3&newwindow=1&tbm=bks&tbs=sbd:1

——————————————

1. 专注于定位问题、解决问题 - 而不是工具本身的各种花花绿绿的特性

2. 使用那些经过市场验证过的成熟技术方案 - 而不用被工具本身的问题所烦扰

3. 用户至上：专注于用户所能看到的新特性，为用户带去价值


www.zlovezl.cn/articles/instagram-pycon-2017/?f=tt&hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io

——————————————

fangs.in/post/thinkstats/decisiontree0

——————————————

https://github.com/yingshaoxo/Telegram-with-QQ

配合QQbot(web库)，这个项目总算可以见人了

——————————————

www.2gua.info/post/78

——————————————

未来的chat-app

如果不支持实时数学公式渲染，就说明构架有问题

数学公式都实时渲染了，其它各种JavaScript的网页渲染就都可以解决了

然后就可以放弃原生平台那个垃圾了(我的意思是如果不能root，原生和网页都差不多)

——————————————

如果不用JavaScript就只能手动刷新，让flask add iframe

关键我不会啊😂




就算我会，接下来又面临用websockt构建TCP连接

如果这步完成，javescrip也学得差不多了🌑

——————————————

单网页为基础的信息框？

flask根据msg_id生成有渲染功能的小网页

然后再在大网页上添加 iframe

公式渲染的唯一要求是刷新页面(这样JS可以加载)

——————————————

递推数列👍

——————————————

https://github.com/LIU9293/musicAPI

——————————————

npm

node.js

反正前端和java的东西我是坚决不碰

——————————————

这样看来，我已经实现了自己的聊天平台的愿望

虽然没有数学公式的支持(不支持以单网页为基础的消息框，就没法用JS渲染公式)

——————————————

对不起我自己

——————————————

感觉每天都在蹉跎岁月

对不起爸妈

对不起人民

——————————————

Actually, it's pretty much boring now.

I don't know what to do next.

Cause I almost tried everything on Python.

But AI, the last thing I need to discover.

——————————————

When it comes to achieving goals, commitment involves:


Investing upfront

Making it public

Setting a timeline

Installing several forms of feedback/accountability

Removing or altering everything in your environment that opposes your commitment

——————————————

return b

——————————————

def fib(n): 
    a, b = 0, 1 
    for i in range(n): 
        a, b = b, a+b 
    return a

——————————————

it·er·a·tion


the repetition of a process or utterance.

repetition of a mathematical or computational procedure applied to the result of a previous application, typically as a means of obtaining successively closer approximations to the solution of a problem.

上次结果变成现在的输入叫迭代。

——————————————

连续前两项和等于后一项

——————————————

https://www.ted.com/talks/arthur_benjamin_the_magic_of_fibonacci_numbers#t-368931

——————————————

步数 1 2 3 4 5  6   7 
方法 1 2 3 5 8 13 21

能看出什么规律😳

——————————————

所以多线程的操作在变量共享方面直接用dict即可

——————————————

如果函数收到的是一个可变对象（比如字典或者列表）的引用，就能修改对象的原始值－－相当于通过“传引用”来传递对象。如果函数收到的是一个不可变对象（比如数字、字符或者元组）的引用，就不能直接修改原始对象－－相当于通过“传值'来传递对象。

——————————————

我梦见我在一栋未来的异次元图书馆里看书和看别人上网。

——————————————

早上好

——————————————

With that website, you can customize your interests by following different tags.

And don't follow those big words, just follow something like 'python3', 'c plus plus', 'tensorflow' is enough.

——————————————

I wasn’t smart enough to do it right the first time.

I wasn’t fast enough.

I didn’t research enough.

I was worried about money.

I thought it would be easy, but it kicked my ass over and over. I still kept going, because it was my dream.

I never gave up on it, until the universe gave up on me instead. Or at least, that’s what it felt like when my dream failed.

And now, it’s hard to know why I should give a damn about the universe. I gave up so much.

I feel alone.

——————————————

Nothing gives a person inner wholeness and peace like a distinct understanding of where they are going.

Robert Bryne once observed, “The purpose of life is a life of purpose.”

In order to get somewhere, you need to define your end goal. That is essential. And the sooner you define it, the clearer everything else will become. A life without a purpose is a life without a destination.


Finding the right direction in life is something you create. You make the decision to act. To try. To do something. No matter how small.

——————————————

我现在基本可以确定简书就是复制的这个模式：

https://medium.com/

——————————————

https://github.com/johnwheeler/pysecrets/blob/master/README.rst

有了这个，网页上也可以发些私人的东西

然后客户端与服务端也不太需要怎么验证，反正都是发的密文，谁愿意截就截

这就是 cryptography的力量(观图灵有感)

——————————————

一个人太孤独就想写点博客、发点说说

We all got the same feeling in this world.

——————————————

我什么都不知道

感觉这道easy级的题目在虐我的智商

——————————————

笔者是疯了吗？搞了几十种解法…

elmagnificogi.github.io/2015/12/10/LeetCode-Solution-Easy-21-24/

——————————————

原本限定下内存可以当浏览器用的

可是由于系统原因，剪切板无法与host同步，不适合我这种喜欢复制粘贴的人😏

——————————————

谷歌系统太坏了，说好的home edition root没密码

从free版本升级后其实有

没权限基本就是垃圾了

——————————————

chrome os清爽到可怕

——————————————

https://chrome.google.com/webstore/detail/set-search-time/ehinebikndjplmoodmblgnnchhcfcijc


But I can't use it...

——————————————

那不能杀死我的，使我更强。
What does not kill me, makes me stronger.

——————————————

心理完全不健康了

不屌就不能玩编程？

不对，是因为开心才玩编程

——————————————

Good design!

<iframe class="container center" frameborder="no" border="0" marginwidth="0" marginheight="0" height=360px src="https://music.163.com/outchain/player?type=0&id=385939198&auto=0"></iframe>

https://music.163.com/outchain/player?type=0&id=385939198&auto=1

——————————————

Climbing Stairs


You are climbing a stair case. It takes n steps to reach to the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Note: Given n will be a positive integer.


class Solution(object):
    def climbStairs(self, n):
        """
        :type n: int
        :rtype: int
        """


https://leetcode.com/problems/climbing-stairs/#/description

——————————————

Beats 54%
class Solution(object):
    def mySqrt(self, x):
        import math
        return int(math.sqrt(x))

——————————————

Sqrt(x)


Implement int sqrt(int x) .

Compute and return the square root of x.


class Solution(object):
    def mySqrt(self, x):
        """
        :type x: int
        :rtype: int
        """


https://leetcode.com/problems/sqrtx/#/description

——————————————

Beats 35%
class Solution(object):
    def plusOne(self, digits):
        num_str = str(int(str(''.join([str(i) for i in digits])))+1)
        return [int(i) for i in list(num_str)]

——————————————

Plus One


Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.

You may assume the integer do not contain any leading zero, except the number 0 itself.

The digits are stored such that the most significant digit is at the head of the list.


class Solution(object):
    def plusOne(self, digits):
        """
        :type digits: List[int]
        :rtype: List[int]
        """

https://leetcode.com/problems/plus-one/#/description

——————————————

通过把输入框放到顶部，问题2解决

——————————————

字体问题用ttf完美解决

——————————————

现在差不多只有两个问题需要解决

1.让kivy能输入中文
2.让kivy的编辑框能自动适应手机输入法的拉高

——————————————

在下一次尝试学习AI之前

我应该会出一系列高等数学视频教程

以英文数学为蓝本

——————————————

看到bilibilu招人工智能工程师

好想去啊，可惜我还不会

——————————————

+1

——————————————

主要是最近遇到好多问题都没有 well documented on internet.

一般在谷歌搜不到答案的我都默认是无法解决的。

我可能已经到了谷歌搜不到答案的阶段。

——————————————

https://github.com/yingshaoxo/kivy-chat

为了做这个，把老命都搭上了。。。

太累了

——————————————

通过一些绕来绕去的方法实现了断线重连和自动检测是否离线


关键是服务器每n秒要向每个连接发送一个特殊字符串

然后client自身有一套检测机制，判定多少秒后没收到那串字符就视自身为离线，然后自动重连


在过程中顺便学了kivy的clock事件，坑的一逼，强行给调用的函数多加一个参数
https://kivy.org/docs/api-kivy.clock.html#module-kivy.clock

——————————————

心跳包一般来说都是在逻辑层实现的。一个定时器，在一定时间间隔下发送一个包给客户端，然后客户端反馈一个同样的包回来，服务器如果在一定时间内收不到客户端发送过来的反馈包，那就认定 ta 掉线了。

每隔40秒客户端把Server中存自己的信息中的在线改为真，而服务器每过45秒就检查这个在线变量是否为真，真的话把他改成假，如果假的话就说明这个人在45秒没有向Server报到＝>他网络出现异常了，掉线了，向其它人发这个人的掉线通知。（这么设计, 原因在于, 当用户网断了没有下线通知, 我们也知道他不在线了）

总的来说，心跳包主要也就是用于长连接的保活和断线处理。一般的应用下，判定时间在30-40秒。



中文的资料一般写得很乱，不改不能看

无奈我又不知道这些对应的英文术语是什么

——————————————

很好奇别人怎么用 asyncio 构建的不会断线的TCP连接

——————————————

怎么办呢

TCP client的 connection_lost() 方法只能检测到服务器主动断连接

而由于网络原因自然断裂却检测不到

甚至 transport 主动发消息，成不成功它自己都不知道…

而在局域网的TCP连接根本不会断

我不知道怎么做了

——————————————

大神就是这样，别人做得少的时候他不做，别人做得多的时候他做得少。

——————————————

大神的答案

class Solution(object):
    def maxSubArray(self, nums):
        if not nums:
            return 0

        currentSum = maxSum = nums[0]
        for num in nums[1:]:
            currentSum = max(num, currentSum + num)
            maxSum = max(maxSum, currentSum)

        return maxSum

——————————————

fuck

——————————————

Maximum Subarray


Find the contiguous subarray within an array (containing at least one number) which has the largest sum.

For example, given the array [-2,1,-3,4,-1,2,1,-5,4] ,
the contiguous subarray [4,-1,2,1] has the largest sum = 6 .


class Solution(object):
    def maxSubArray(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

https://leetcode.com/problems/maximum-subarray/#/description

——————————————

我说的话都是以我的角度说

是水的就表明我做不出来，对我来说，不能用c4droid做C++开发

——————————————

所以你知道怎么编译？

——————————————

然后移动平台的浏览器不支持网页上的歌曲连续播放(自动下一曲)

这肯定是为了压制网站，使得你想连续听歌或看视频需要native app.

——————————————

我才知道`loop.run_until_complete()`运行一次，Client接受一次数据。

但不知为何，transport 一旦生成，不用run loop也能向server发送数据，就好象TCP一直连接上的。

https://gist.github.com/yingshaoxo/c8b8f992c4a971573937264317173451

https://gist.github.com/yingshaoxo/8e0a5eb5b06d43546877adbfa3a5e834

——————————————

分享Andreas B.的单曲《The Way You (Full Version)》: http://music.163.com/song/426852274/?userid=280429778 (来自@网易云音乐)

——————————————

不管我搞没搞错，情况就是这么个情况

不过我在思考另一个可能


现代人谁没有台电脑，天天拿手机玩？

所以要做一套完整的产品并不一定要把客户端做全了

依我看，把unix和win的做出来就好了，其他的交给网页吧。


毕竟我们不是要真正运营一个产品，只是为了提高技能和增加实际经验而以项目为单位做开发

我预想的是，做出一个产品，前端到后端测试通过，就发github和docker hub，然后不管它，继续做下个东西。

——————————————

反正我编译出错了，似乎kivy的编译器就是在py2的虚拟环境运行的

——————————————

讲两件事


1. https://github.com/whoshuu/cpr
这个我不知道怎么在安卓编译，所以用C++在c4droid做安卓是水的


2.kivy不需要控制实体按键(实际上在PC是没按键的，全触屏，虚拟按键)
然后很多python3的安装包如flask、requests都含有setuptool，而setuptool是py2的包，与py3冲突，所以kivy for Android无法打包

导致kivy for py3成了摆设，实际没用

——————————————

https://seasonofcode.com/posts/how-rooting-works-a-technical-explanation-of-the-android-rooting-process.html

——————————————

表示没有外部库，什么都做不了

——————————————

然后学习C++时还要注意，不要被细节扰乱了心智

很多有关C++的书籍都是搞笑来着，一段话能说明白的要写一页纸，几段话能写明白的要写一章。

大多数情况下，理解章节标题就好了。

——————————————

几个月来第一次5点半起床

——————————————

写C++就是要有构建系统的想法

不然你会发现它连 send a http request 都让你痛苦万分

自己为硬件做系统、自己构建api才是C++存在的理由


#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int main ()
{
 string command;
 while (1)
 {
  cin >> command;
        system(command.c_str());
 }
}

——————————————

Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation.

关键你要学会构建 Interfaces in C++.

任何你要用到的库都要按照自己的需求 encapsulate.

——————————————

Everyday reading? Seems good. 
Everyday programming? Seems good.

So for college entrance examination, let's practice more on testing paper!

——————————————

http://www.jianshu.com/p/06fbfa1acb21

——————————————

然后围绕这两种语言，糅合各学科知识

去生产出各式各样的实际项目

——————————————

总之前者是从现实走进虚拟

后者是从虚拟走进现实

——————————————

So 对于一个现代人


前端编程语言是这样学的：

HTML→Javascript→由JS引出的各种分支语言


后端编程语言是这样学的：

Python→C++→汇编语言→计算机原理以及通用硬件制作与维修


前端后面为趋势，后端前面为趋势。


感觉我是神棍😂

——————————————

在py里，万物皆对象
在C++里，万物皆内存

——————————————

C++语法和大体概念就这么学完了

说实话，除了内存操作方便点，哪方面都不如py开发迅速便捷。

——————————————

class __init__() in C++


#include <iostream>
using namespace std;

class Box
{
    public:
        Box()
        {
            cout << "You started me.\n";
        }
      
        ~Box()
        {
            cout << "I'm over, now.\n";
        }
};

int main()
{
    Box my_box;
}

——————————————

https://www.programiz.com/cpp-programming/virtual-functions

类函数在继承时重载竟然还要在基类声明virtual函数，真麻烦 compare to py.

——————————————

阿尔法狗的作者5岁开始下棋

总的来说，要对那个项目有深刻理解，才能想出有用的决策依据

——————————————

不过得先找到一群从小爱打麻将、长大受过良好高等教育的程序员

——————————————

过段时间AI把麻将攻破了

人们就没办法赌博了，哈哈

——————————————

没道理，字符串有什么好排序的

——————————————

政治书上说AI不可能超越人类

从书上看到那句话的第一眼起，我就知道它在乱扯

AI肯定会超越人类，所以为了避免打脸，改禁的还得禁

——————————————

http://chinadigitaltimes.net/chinese/2017/05/%E3%80%90%E7%9C%9F%E7%90%86%E9%83%A8%E3%80%91-%E6%9F%AF%E6%B4%81%E5%92%8Calphago%E5%AF%B9%E5%BC%88/ 

额～这个也要禁

——————————————

https://www.tutorialspoint.com/cplusplus/cpp_inheritance.htm

When we talk about C++ inheritance, we know that python could do the same thing.

class Shape():
    def setWidth(self, w):
        self.width = w
    
    def setHeight(self, h):
        self.height = h

class PaintCost():
    def getCost(self, area):
        return area * 70

class Rectangle(Shape, PaintCost):
    def getArea(self):
        return self.width * self.height

Rect = Rectangle()

Rect.setWidth(5)
Rect.setHeight(7)

area = Rect.getArea()
print("Total area:", area)

cost = Rect.getCost(area)
print("Total paint cost:", cost)

——————————————

&
ampersand

——————————————


#include <iostream>
using namespace std;

int main ()
{
    int v[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

    for (auto x: v)
        cout << x << '\n'; 
}


是不是找到了熟悉的'for i in list:'的感觉？

——————————————

C++创造者和我的想法果然是一样的

()应紧跟函数名
{}表示代码块应该放在函数名下面

不像某些装逼犯，把代码写得乱七八糟的还说是个性

——————————————

恩，多看横屏后对pdf的体验好了许多

——————————————

What is C++ used for?


By now (2013), C++ is used just about everywhere: it is in your computer, your phone, your car,probably even in your camera. You don’t usually see it. C++ is a systems programming language,and its most pervasive uses are deep in the infrastructure where we, as users, never look.

C++ is used by millions of programmers in essentially every application domain. Billions(thousands of millions) of lines of C++ are currently deployed.  This massive use is supported byhalf a dozen independent implementations, many thousands of libraries, hundreds of textbooks, anddozens of websites. Training and education at a variety of levels are widely available.

Early applications tended to have a strong systems programming ﬂavor.  For example, severalearly operating systems have been written in C++: [Campbell,1987] (academic), [Rozier,1988](real time), [Berg,1995] (high-throughput I/O). Many current ones (e.g., Windows, Apple’s OS,Linux, and most portable-device OSs) have key parts done in C++. Your cellphone and Internetrouters are most likely written in C++. I consider uncompromising low-level efﬁciency essentialfor C++. This allows us to use C++ to write device drivers and other software that rely on directmanipulation of hardware under real-time constraints. In such code, predictability of performanceis at least as important as raw speed.  Often, so is the compactness of the resulting system. C++was designed so that every language feature is usable in code under severe time and space con-straints (§1.2.4) [Stroustrup,1994,§4.5].

Some of today’s most visible and widely used systems have their critical parts written in C++.Examples are Amadeus (airline ticketing), Amazon (Web commerce), Bloomberg (ﬁnancial infor-mation), Google (Web search), and Facebook (social media). Many other programming languagesand technologies depend critically on C++’s performance and reliability in their implementation.Examples include the most widely used Java Virtual Machines (e.g., Oracle’s HotSpot), JavaScriptinterpreters (e.g., Google’s V8), browsers (e.g., Microsoft’s Internet Explorer, Mozilla’s Firefox,Apple’s Safari, and Google’s Chrome), and application frameworks (e.g., Microsoft’s .NET Webservices framework).  I consider C++ to have unique strengths in the area of infrastructure software[Stroustrup,2012a].

Most applications have sections of code that are critical for acceptable performance. However,the largest amount of code is not in such sections. For most code, maintainability, ease of exten-sion, and ease of testing are key. C++’s support for these concerns has led to its widespread use inareas where reliability is a must and where requirements change signiﬁcantly over time.  Examplesare ﬁnancial systems, telecommunications, device control, and military applications. For decades,the central control of the U.S. long-distance telephone system has relied on C++, and every 800 call(i.e., a call paid for by the called party) has been routed by a C++ program [Kamath,1993]. Manysuch applications are large and long-lived.  As a result, stability, compatibility, and scalability havebeen constant concerns in the development of C++. Multimillion-line C++ programs are common.

——————————————

一切从造轮子开始

连list都要自己写

——————————————

find out the biggest number in a int list


#include <iostream>
#include <list>
#include <iterator>
using namespace std;

int max(list<int> a_list)
{
    cout << "You gave me a list with a length of " << a_list.size() << "." << endl;
    a_list.sort();
    a_list.reverse();

    auto iterator = a_list.begin(); //create a iterator
    advance(iterator, 0); //give a 0 index, get the expected value in that list
    cout << *iterator << " is the biggest in this list." << endl; //from pointer address get int value
    
    return *iterator;
}

int main ()
{
    //std::list<int> mylist;
    //list included in std namespace.
    list<int> mylist={2, 3, 4, 1, 0}; //define a list contains int value
    max(mylist); //call max function
    return 0;
}

——————————————

#include <iostream>
#include <time.h>
using namespace std;
 
void sleep(unsigned int seconds)
{
    clock_t goal = seconds*1000000 + clock();
    while (goal > clock());
}

int main () {
   int num=1;
   for( ; ; ) {
      cout << "This loop will run forever. " << num << endl;
      num++;
      sleep(1);
   }

   return 0;
}

——————————————

以前用拼音编程也是够了

https://www.programiz.com/cpp-programming/enumeration

原来C++社区也有最近(2017)的POST，可以，很棒

——————————————

Deepin will give you a better experience.

——————————————

That's the reason

——————————————

Have you tried deepin?

——————————————

Windows🙈

——————————————

g++ -v

看看你的terminal

一般自带编译或运行环境的，都是值得学的东西

就连 javascript 解释器都集成在 Chrome 里

——————————————

讲句实在话，我如果学Go或Java的话，Py skill 就废了

Python 必须靠C系列来增强。

——————————————

就是因为它是底层语言，才能在功能上超过Python，不然我都找不到下一个应该学习的语言了

——————————————

这是第二次尝试

有了Python的基础， 应该没问题的。。。😊

——————————————

http://www.tutorialspoint.com/cplusplus/

除了官方，就这个网站比较系统

——————————————

其实C++ is a super set of C
是为了弥补C而打造的
而Golang只是在C的基础上创新

本质上几年前我就对自己的语言学习有了一定规划

不用劝了，怎么看都觉得C plus plus的代码干净顺眼


Anyone who has used either an Apple Macintosh or a PC running Windows has indirectly used C++ because the primary user interfaces of these systems are written in C++.

——————————————

第一稳定是C
第二是C++

——————————————

其实你们有没有发现

前5名都是很稳定的语言

——————————————

前20名都没有它，怕是没特长

——————————————

为什么java常年排第一呢？

——————————————

Seems weird

——————————————

恩

静不下心

高中毕业后有三个新语言供选择：
Go、C++、Java

——————————————

I like mindmaps

——————————————

Beats 35%

class Solution(object):
    def countAndSay(self, n):
        from re import sub
        def say(s):
            return str(len(s)) + s[0]
        
        def replace(matchobj):
            return matchobj.group(0) + '\n'

        now = '1'
        for _ in range(n-1):
            sequence = sub(r'0+|1+|2+|3+|4+|5+|6+|7+|8+|9+', replace, now).split('\n')
            now = ''.join([say(i) for i in sequence if i != ''])
        return now

——————————————

Count and Say


The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...

1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
Given an integer n, generate the nth sequence.

Note: The sequence of integers will be represented as a string.



class Solution(object):
    def countAndSay(self, n):
        """
        :type n: int
        :rtype: str
        """
        


https://leetcode.com/problems/count-and-say/#/description


事实上世界上还有很多除了编程以外有趣的事，看开点

——————————————

So why I suddenly become interested in network programming?

That's because it's the only way to connect customer and business provider.

——————————————

blog.jiamin.info/resume/


其实好多开发者就只是大学生，和计算机专业毛关系没有

——————————————

虽然主线程try了KeyboardInterrupt异常，但是子线程并没有退出，为了解决这个问题，可以设置子线程为守护线程，这样当主线程结束的时候，子线程也随机退出。

blog.jiamin.info/2017/01/17/python-magic-asyncio/

我想这可以避免主线程挂了而子线程不退出。

——————————————

果然看完后还是一头雾水

好东西，是的，但在这里的语法难以理解

——————————————

https://www.google.com/amp/blog.rainy.im/2016/03/10/how-the-heck-does-async-await-work-in-python-3-5/amp/

和我一起看

——————————————

https://xidui.github.io/2015/10/29/深入理解python3-4-Asyncio库与Node-js的异步IO机制/

连中文都看不懂了，这一定是高阶内容

——————————————

那种感觉就像是把函数和类给你换了

换成不知名的东西

然后你还要把那不知名的东西放在一个莫名其妙的构架里用

简直划了狗了😔

——————————————

https://pythonexample.com/code/asyncio%20chat%20server/


他们是怎么理解的这个

我觉得这可能是Python这门语言上最坑爹的部分了

——————————————

https://docs.python.org/3/library/asyncio-protocol.html#tcp-echo-client-protocol

https://docs.python.org/3/library/asyncio-eventloop.html#creating-connections

This method is a coroutine which will try to establish the connection in the background. When successful, the coroutine returns a (transport, protocol) pair.

https://docs.python.org/3/library/asyncio-protocol.html#asyncio.WriteTransport.write

After reading+trying again and again, finally I understand how it works.

Thank god.


transport, protocol = loop.run_until_complete(coro)
threading.Thread(target=loop.run_forever)
time.sleep(2)
transport.write(b"Hi") #In this case, we can send something to server from background threading.

——————————————

Then I'll feel lonely.

——————————————

If she doesn't, we will have no common interests.

We won't talk much.

So we won't have a deep feeling in love.

——————————————

I mean the real problem is I can't find a girl who fancy in programming or computer tech.

——————————————

Sometimes I really doubt whether people have the power to change their destiny.

At least to me, no effort will make if no one push me.

You see, I even can't insist go to sleeping.

——————————————

A few years ago, I laughed at those who take money from software.

But now I understand life's hard.

——————————————

Then I dive into struggling, which is how to choose between reality and imagination.

——————————————

But somehow I'm already 19 years old now.

My mom and dad need me to care.

——————————————

All because of love

I hope i'll stay on this way even I can't get money from it.

——————————————

No, I just don't understand.

——————————————

这意味着可以直接假设本地服务器给公网


人们就可以看我直播玩手机了，并且还带声音

——————————————

玩手机时忽然发现

airshow可以直接把屏幕加录音转发到局域网

——————————————

睡不着

——————————————

为什么我们很难进步？


1.我们无法坚持看完一本书
2.我们无法坚持做完一个实际项目
3.我们无法坚持完成一系列系统化的任务

——————————————

我要睡10个小时，才能在7点前自然醒，才能赶上高考

所以我得睡了👋

——————————————

https://pjf.name/post-455.html

榜样

——————————————

你看那些应用，抛去它们华丽的外衣

不过是客户端连接服务器、客户端显示数据、客户端操作数据、客户端操作硬件

没了

——————————————

自从刚才把kivy for py3的环境搞出来

我突然明白，学那么多干嘛，够用就行

事实上学了任何一个语言，除去基本语法，你构建一个能用的系统都是套路、都是固定的模式

与其自己造轮子，不如用现成的

——————————————

Java看什么学？

——————————————

又发现官方文档的错误
https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions



正确代码应该是这样：

pairs = [(2, 'two'), (1, 'one'), (3, 'three'), (4, 'four')]
pairs.sort(key=lambda pair: pair[0])
print(pairs)

——————————————

线程多了容易崩溃

其实asyncio单进程并发也可以抓网页，更稳定

——————————————

https://docs.python.org/3/library/asyncio-protocol.html#tcp-echo-client-protocol

看这个例子里的lambda

——————————————

最多一个网页一个线程

——————————————

So generator 是设计出来对抗无限数据的，到底是把所有数据都装进内存还是每次只取一点，这是生活哲学啊！

数学上也有用数学公式表示无限数据的地方

https://www.programiz.com/python-programming/generator

——————————————

https://www.programiz.com/python-programming/anonymous-function


Good explanation

——————————————

asyncio模块里经常可以看到这两个东西

完全不明所以

——————————————

lambda and yield

Are you sure you really understand?
I don't know.

——————————————

py3打包的唯一缺点就是基础大小就是19M

py2只需要7M

——————————————

https://drive.google.com/open?id=0B8M6pE4UPOI5ZUxodEJFRTBLOW8

——————————————

好吧，确实厉害

13.4G压缩到3.1G

——————————————

13G的vmdk

本以为压缩成tar.xz会小很多

现在一下午了，到3G还没压完

——————————————

看完 the imitation game ，我们懂了2件事

1.战争催生发明
2.图灵真是为了不孤独发明的图灵机(或者女装的起源)

——————————————

其实vmdk就是一个虚拟磁盘

直接把我的克隆文件替换官方的vmdk文件就可以了

根本用不着导出

——————————————

好不容易制造出python3的环境，竟然导不出，【黑脸】

——————————————

意思是我不能用原来官方的镜像修改后导出？

——————————————

But I got this when I exporting.

——————————————

kivy for 3 的镜像做好了

——————————————

Linux开源，对作者带来了名气，但 not too much money.

——————————————

然后NDK怎么看都是个笑话

必须有SDK才能用NDK

而SDK在未来又会被封装到Android Studio

谷歌是新一代的独裁者

——————————————

然后我又发现

Python for Android只不过把Android Studio的命令行工具调用了一遍，一旦谷歌改变命令或干脆放弃命令行方式，它就挂了

实际上从我目前测试来看，命令已经变了，实际已经不能用

就这样的话，干嘛不封装得死一点，像易语言一样，一个离线包，编译十年都不变，微软早就让所有接口都变化了，易语言还是能用

——————————————

https://python-for-android.readthedocs.io/en/latest/quickstart/#installing-dependencies

我感到奇怪的是，即使它依赖ant，为什么发镜像时不把它带上

——————————————

今天鼓捣 Linux Python3 for Android 一天，最终死在ant上

java就是垃圾

环境布置太累人了

照这个速度，一周也搞不定

无头苍蝇乱转啊

——————————————

great

——————————————

Not at all, but next year I will.

——————————————

in the future

——————————————

You will success

——————————————

Keep going

——————————————

good, younger than me.

——————————————

So, how old are u?

——————————————

👌🏻

——————————————

I know that feeling.

I used to have talking with some native man online.

——————————————

Wonderful!

——————————————

Surely will, but just online...

——————————————

chance

——————————————

But I think I could have no change to really speaking with a native speaker.

——————————————

yeah, I agree

——————————————

Who said you not help?

——————————————

NO, just means the server can't be visit by mainland.

——————————————

yeah

——————————————

Through what you said is good, but for some reason, it's not work.

It's a sh script, and I don't know where that file should be.

Even I tried this: www.zhangminghao.com/post/48.html

——————————————

https://www.libsdl.org/release/SDL2-2.0.4.tar.gz



Why I can't download this from mainland internet?

——————————————

Stuck on there...

——————————————

They never stop make me crazy!

——————————————

and

https_proxy=http://192.168.1.103:1080

——————————————

http://www.jianshu.com/p/bdee54867048

SS bind to 0.0.0.0:1080, 
server type choose HTTP
export http_proxy=192.168.1.103:1080

——————————————

不明白为什么国家连sdl官网都要墙

——————————————

www.cnblogs.com/cposture/p/5032283.html

www.cnblogs.com/xueweihan/p/5923937.html


crystax_ndk解压出来有7个G

虚拟机根本吃不消

——————————————

不过未来的魔法师是程序员

这还是可以肯定的

——————————————

为什么一个留英妹子会信气功大师呢？

感觉这是文科背的国，文科就是制造信仰

——————————————

https://youtu.be/FFO4M9r_M1s 

我在思考，只需要看一两页教义便知道法轮功是不是邪教，但我看了一下维基百科，这东西完全就是现代化的中国传统武术派别的装神弄鬼

But wait a minute，看名字就不科学，应该改名叫科学社，然后以现代科学基础，以计算机科学为武器…


良心犯如果不包括法轮功学员的话，被活摘器官还是不能忍的

抗议政府直接枪毙…但考虑到资源合理利用…

这样好了，每个异教徒应该随身绑上炸弹，不绑炸弹不配异教徒的称号…

可惜会当异教徒的都不会做炸弹，唉

——————————————

https://blog.kivy.org/2016/01/python-for-android-now-supports-python-3%C2%A0apks/

官方虽然说了支持，但是实际操作起来有困难啊，它自己给的打包教程和镜像全不能用，我还是用的别人的，然而别人的只支持2

怪我咯😒

——————————————

这样的话，如果掌握了kivy监听按键的用法

基本就可以用强大的python2库做跨平台应用了

——————————————

我插，结束asyncore线程最简单的方法是(asyncore实类).close()

直接在Kivy app 类方法def on_stop(self):下面加上上面的方法即可


这样不管是退到后台或按下了返回键，线程都会跟着sdl主界面线程关闭

——————————————

事实上，youtube网页版比客户端版稳定

——————————————

是的

电脑上用SS 倒是不会断

就是手机上会

——————————————

应该是每隔几分钟

——————————————

https://youtu.be/Z-HL5nppBnM

——————————————

只有YouTube才能看英文流吗？

每几十分钟YouTube会断一次流(防火墙的原因)

——————————————

对啊，像我以前一样疯狂学英语的人太少了(毕竟他们还没疯😄)

——————————————

稍微地搜了一下

发现相关的资料很少

特别是2017年，所以这个可以当个兴趣项目，无聊了就翻翻

——————————————

互联网改变了一切

——————————————

虽然整天嚷嚷着p2p

但以我现在的水平，完全不能想象不用ip地址，怎么能实现TCP连接😄

——————————————

个人要权力就得先付出

p2p又当服务器又当客户的特性最适合这个了




P2P网络的一个重要的目标就是让所有的客户端都能提供资源，包括带宽，存储空间和计算能力。因此，当有节点加入且对系统请求增多，整个系统的容量也增大。这是具有一组固定服务器的Client-Server结构不能实现的，因为在上述这种结构中，客户端的增加意味着所有用户更慢的数据传输。



到时候我们又回到了书信很远的时代？不一定，只要个人计算机计算力提上去了，就还好

——————————————

还是p2p好

现在差个p2p通讯工具

——————————————

https://youtu.be/yVwAodrjZMY

——————————————

不过电影里出现了一个漏洞，他们不可能用windows系统。

——————————————

你们真该看看 Snowden 这部电影


原来我们时时刻刻被人监视

无论国家、无论哪个APP、哪个系统

——————————————

慈眉善目的老人😂

——————————————

当然不是，群主怎么会抛弃群呢？

刚才那个一定是女的

看俺长得太丑就跑了

——————————————

你猜刚才那个是男的还是女的？

——————————————

{"title": "Unsupported characters"}

——————————————

{"title": "Unsupported characters"}

——————————————

I can't tell you...

——————————————

🙊

——————————————

Where you come from?

是不是和 @VVWbot 有一腿

你们怎么都用同一格式的网名😂

——————————————

@PS_URINE 

So, 经常看见你发日文，学会了没呀？

是不是现在的年轻人都哈日，不跟哈就脱群啦？

——————————————

beats 8.1%

class Solution(object):
    def strStr(self, haystack, needle):
        import re
        result = re.search(needle, haystack)
        if result == None:
            return -1
        else:
            return result.start(0)

——————————————

Implement strStr()


Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

实现strStr()。返回匹配时的第一个索引， 如果没有匹配的就返回-1。（感觉原文用针和草堆来形容根本看不懂）


class Solution(object):
    def strStr(self, haystack, needle):
        """
        :type haystack: str
        :type needle: str
        :rtype: int
        """

https://leetcode.com/problems/implement-strstr/#/description

——————————————

除此之外，心跳包机制被提上日程

我敢保证，国内一次性TCP连接超不过5分钟…

——————————————

https://github.com/kivy/kivy/wiki/Working-with-Python-threads-inside-a-Kivy-application


OK, now I understand.

如果我们不在界面退出或暂停时停止线程，线程会继续运行，并且阻碍界面，使界面卡住

——————————————

目前的问题是，退出后返回屏幕直接卡住

——————————————

你知道为什么酷安急着实名制吗？

因为火山移动的发布和kivy的崛起


我刚刚做了测试，发现只要server.py在服务器以python3的环境运行，原来做的kivy-chat就能正常使用

多进程或线程都OK。

——————————————

要是能进入某个高级社区就好了

比如那个社区只允许有计算机相关专业硕士学位的人加入

然后我偷偷混进去侦察情报😂

——————————————

照这样看，把时间浪费在建造自己的分享站真的不可取


这里有大量已经造好的东西

——————————————

https://hub.docker.com/_/nextcloud/

If don't need a reverse proxy, it'll be better, I think.

1 button built our own cloud.

——————————————

你为什么不找女朋友呢？

——————————————

然后你还要吐槽一下国内的英语老师

95%的时间都在讲中文，还自以为很屌的样子

——————————————

你知道最关键的东西是什么吗

那些教员都用中文教东西

就好象把自己装在一个黑箱，哪天别人提起什么新技术，就去翻翻中文论坛

结果学生也跟着老师讲起了中文，最后大家都封闭在了一个黑箱子

——————————————

https://github.com/liyuanrui/oschina-python

中文学这些也是蛮难🙈

——————————————

弱鸡 and 大学教员 and China leaders secret.

——————————————

The truth is, 防火墙保护了中国程序员。

——————————————

https://telegram.org/blog/instant-view-contest-200K

——————————————

这不就是人工爬虫？

——————————————

KingRoot 520% 被腾讯收购了

——————————————

https://en.wikibooks.org/wiki/LaTeX/Mathematics

https://www.mathjax.org/

markdown排版，latex写数学公式还是比较靠谱的

——————————————

上apkpure还不如上play store

——————————————

感觉汇集了各个国家的小软件


中毒几率可能很高

——————————————

酷安实名制了

那到什么地方下载小软件呢？

——————————————

人类进化

发现用通讯软件发即时信息比较高效

大多数人都这样做，然而还是摆脱不了自然交流的欲望，所以他们需要言谈类节目 from radio or video.

所以真理是小部分人说，大部分人听，而被倾听则成为享受(多数人追求的目标) 。

——————————————

其实今天我连着看了4部加勒比海盗

——————————————

现在我知道了.MD是markdown的意思

——————————————

beats 34%


class Solution(object):
    def removeDuplicates(self, nums):
        nums_list = [{value: key} for key, value in enumerate(nums, start=0)]
        nums_dict = dict()
        for i in nums_list:
            nums_dict.update(i)
        
        del nums[:]
        for num in nums_dict.keys():
            nums.append(num)
        nums.sort()
        
        return len(nums)

——————————————

i'm very sad about this..

——————————————

对呀，你要实现不阻塞主进程的功能，用线程和进程都差不多…

——————————————

其实多进程和线程都差不多

都不能暂停和停止

只能通过特殊的方法传递参数控制

——————————————

Remove Duplicates from Sorted Array


Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

Do not allocate extra space for another array, you must do this in place with constant memory.

For example,
Given input array nums = [1,1,2],

Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively. It doesn't matter what you leave beyond the new length.


class Solution(object):
    def removeDuplicates(self, nums):
        for num in nums:
            
        """
        :type nums: List[int]
        :rtype: int
        """


https://leetcode.com/problems/remove-duplicates-from-sorted-array/#/description

——————————————

I can't log in from chrom, baidu is gabage...

——————————————

Betes 0.8% people😭


class Solution(object):
    def isValid(self, s):
        length = len(s)
        
        if length % 2 != 0:
            return False
        
        replace_list = [
            "()",
            "{}",
            "[]"
            ]
        
        result = s
        for _ in range(length//2):
            for i in replace_list:
                result = result.replace(i, "")
                
        if result == "":
            return True
        else:
            return False

——————————————

Can you help me download two files?

https://wenku.baidu.com/view/0f19ce305901020207409ce8.html?re=view

https://wenku.baidu.com/view/5b89494f33687e21af45a9ca.html?from=search

——————————————

其实很强了， 有国外网站的风范

像国内QQ， 服务都没个准，一两年就停了

——————————————

https://386791553.wodemo.com/filelist

现在竟然还有人坚守wap

https://wodemo.com/

——————————————

群主娘为何跑路？

——————————————

有了中文就有了傻逼，为什么？

因为中国人基数多啊！

——————————————

其实感觉灵魂被掏空

明明是很基础的题

死活做不出来

——————————————

其实我们的原则是不养伸手党

要想获得什么，先得分享什么

再说，你写的什么鬼，一点可用信息都没有，别人怎么知道你在做什麽

——————————————

Valid Parentheses


Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.


class Solution(object):
    def isValid(self, s):
        print(s)
        """
        :type s: str
        :rtype: bool
        """
        


https://leetcode.com/problems/valid-parentheses/#/description

——————————————

😂

看懂别人的代码比自己做还艰难

——————————————

kill 60% people


class Solution(object):
    def longestCommonPrefix(self, strs):
        longest_str = ""
        common_length = 0
        single_chr = ""
        while True:
            try:
                single_char = strs[0][common_length]
                for i in strs:
                    if i[common_length] == single_char:
                        longest_str = i
                        pass
                    else:
                        [2,3][2] # make it error
            except:
                break
            common_length += 1
        print(common_length)
        return longest_str[:common_length]

——————————————

那个好烦人

每次都要更新半天

——————————————

先找本书看比较好

——————————————

Longest Common Prefix


Write a function to find the longest common prefix string amongst an array of strings.


class Solution(object):
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """

不畏艰难地造轮子
https://leetcode.com/problems/longest-common-prefix/#/description

——————————————

Beats 81% people.

class Solution(object):
    
    def romanToInt(self, s):
        roman_dict = {
            "I": 1,
            "V": 5,
            "X": 10,
            "L": 50,
            "C": 100,
            "D": 500,
            "M": 1000
        }
        
        integer = 0
        old_num = 0
        for i in list(s)[::-1]:
            now_num = roman_dict[i]
            if now_num < old_num:
                integer -= now_num
            else:
                integer += now_num
            old_num = now_num
        return integer

——————————————

https://leetcode.com/problems/roman-to-integer/#/description

没想到罗马人死了还要来祸害咱们

怪说不得目前阿拉伯数字世界通用呢

——————————————

I'm genius than I think!


class Solution(object):
    
    def reverse(self, x):
        if x < 0:
            str_integer = str(x)[1:]
            reversed_interger = '-' + str_integer[::-1]
            interger = int(reversed_interger)
        else:
            str_integer = str(x)
            reversed_interger = str_integer[::-1]
            interger = int(reversed_interger)

        if -2147483648 < interger < 2147483648:
            return interger
        else:
            return 0

——————————————

大神果然是科班出身

——————————————

https://leetcode.com/problems/reverse-integer/#/description

——————————————

对于这种超能力的题，我们要大胆说no

还是先做简单的吧

——————————————

我觉得我脑袋不够用了😄

——————————————

http://openbookproject.net/thinkcs/python/english3e/linked_lists.html#linked-lists

——————————————

完全看不懂，什么是链表

——————————————

https://leetcode.com/problems/add-two-numbers/#/description

——————————————

Add Two Numbers


You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

You may assume the two numbers do not contain any leading zero, except the number 0 itself.


Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8

Using python
# Definition for singly-linked list.
# class ListNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.next = None

class Solution(object):
    def addTwoNumbers(self, l1, l2):
        print(str(l1))
        print(str(l2))
        """
        :type l1: ListNode
        :type l2: ListNode
        :rtype: ListNode
        """

——————————————

2000年以后的语言都不值得学

——————————————

新出来的东西良莠不齐

以前是信息大爆炸

现在是语言大爆炸

——————————————

gabage language

——————————————

Finally, I did it!


class Solution:
    
    def twoSum(self, nums, target):
        first = 0
        last = 0
        
        for index1, num1 in enumerate(nums, start=0):
            num2 = target - num1
            
            nums_part = nums[index1+1:]
            #print(index1, ":", nums_part)
            try:
                index2 = nums_part.index(num2)
                #print(index2, index1)
                if index2 != index1:
                    first = index1
                    last = index1 + index2 + 1
                    break
                else:
                    nums_part = nums[index1+index2+2:]
                    #print(nums_part)
                    try:
                        index3 = nums_part.index(num2)
                        first = index1
                        last = index1 + index2 + index3 + 2
                        break
                    except:
                        pass 
            except:
                pass
        if len(nums) == 2:
            last = 1
        if first > last:
            return[last, first]
        else:
            return[first,last]


https://leetcode.com/problems/two-sum/#/description

——————————————

顺便说一句

index真是个烂方法，只返回第一个匹配的项

这不就重复了吗

——————————————

我放弃

留到明天继续

——————————————

我知道了，等一会儿

——————————————

唉，我无辜的大脑


第一次发现自己这么垃圾

——————————————

因为一个for检查后面

一个for检查前面

——————————————

宝宝心里苦，但宝宝不说

——————————————

刚才自己动手测试了一下，不应该有错啊

感觉无爱了

——————————————

原来运行和提交是两码事

——————————————

Wrong answer

——————————————

难道数组下标真的叫indice(指数)吗？

——————————————

当然

——————————————

So, I finished it.

class Solution:
    def twoSum(self, nums, target):
        first = 0
        last = 0
        for indice1, num1 in enumerate(nums, start=0):
            for indice2, num2 in enumerate(nums[indice1:], start=0):
                if num1 + num2 == target:
                    first = indice1
                    last = indice2 + indice1
            for indice2, num2 in enumerate(nums[:indice1], start=0):
                if num1 + num2 == target:
                    first = indice1
                    last = indice2
        if first > last:
            return[last, first]
        else:
            return[first,last]


膜拜我吧😄

——————————————

别说话，感觉我还没开始

心疼我的智商

——————————————

https://leetcode.com/problems/two-sum/#/description

——————————————

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:
Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].


using Python3:
class Solution:
    def twoSum(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """

——————————————

等会我来给一个算法题

我们来做做

——————————————

红二叉树是什么、冒泡算法是什么…

我脑海就只有这几个名词，然后就蒙蔽了

——————————————

不过想到面试时问什么算法还是很害怕

根本没学过

——————————————

写不出东西很正常

世界上90%以上的程序员没有在写界面

——————————————

不过说到标准库

那是好东西

我可能才掌握10%吧

——————————————

在记忆里随时可用的才是真东西

——————————————

在记忆里的和在文档里的不一样

——————————————

不行，我本来是打算从print()开始把我会的Python翻译成其他语言

——————————————

我现在脸上都露着笑

得到大佬的肯定

——————————————

好了，我明天终于可以睡觉了😄

——————————————

服务器端的JavaScript

——————————————

其实你就是怕告诉我，你平时还是Python用得最多😏

——————————————

npm

——————————————

还真可以

新JavaScript

——————————————

我比较信任 @system357嘛

——————————————

一方面我问什么语言在工作中用得最多，是考虑实用性

另一方面，我确信群直播是可以的

——————————————

上次我立什么了？

——————————————

竟然不帮我立flag

——————————————

这样吧，你工作时用什么语言最多，我明天一天就把它学会

全程直播

——————————————

搞得我要学第二门语言了一样😒

——————————————

要收费啊

——————————————

看 bilibil 丧志

——————————————

来本书也行啊

——————————————

那你推荐个网址呗

——————————————

举个例子，在网上没找到好的java文档，官方的根本不能看


我至今尝试了很多次，没一次我想接着看

——————————————

上了年纪还是不要学重语言好

免得伤心

——————————————

想多了，Java

——————————————

一人对抗整个英文社区

——————————————

事实是，不管从哪方面，易语言都不行

——————————————

https://github.com/SavinaRoja/PyUserInput

——————————————

python的底层虽然省去了，但它基本绝对稳定

不会有语言上的问题

说一就是一

——————————————

最后还不稳定

还不知道到底怎么回事(因为没有底层的详细逻辑)

——————————————

不，最近我发现小软件都不行

效率太低



Python几分钟的事，易语言调试一个小时

——————————————

毕竟函数式编程为主

——————————————

没什么，只要不用中文还来得及

——————————————

😄

——————————————

你在干的话收我入伙呗

——————————————

我想找个老外办这个

——————————————

这倒是

——————————————

然后你发现你还是做不出什么玩意儿

——————————————

另一本书教高级

——————————————

一本书

——————————————

要不是我老师他们还用QQ当交流群

我立马就把它删了

——————————————

https://github.com/soimort/you-get/blob/develop/README.md 

爬虫圣手

——————————————

来，让我们把xp删了

虚拟机删了

一起踏上docker的伟大征程

——————————————

连网易云都有Linux版

——————————————

好吧，QQ是垃圾

——————————————

算了

可能是虚拟机网络本身的问题
服务器不能回信

——————————————

你们怎么能拿我只学得会Python开玩笑呢

——————————————

特别诡异的是

我们这边发的消息，酷Q接不到

——————————————

AI 群

欢迎加入Artificial intelligence，群号码：208408255

——————————————

一天的时间就在聊天中过去了

——————————————

https://github.com/yingshaoxo/hosts

我写了这个，以后host翻墙比较轻松

不用再复制粘贴

——————————————

恩

只需要修改上面那个文件，然后把主程序改成main.py

然后docker翻墙后就可以成功编译了

——————————————

成功用docker编译了一个apk

官方的镜像不给力

——————————————

docker run --network=host

现在你可以host翻墙给docker用了

——————————————

发不出信息，我挂它干嘛

——————————————

本来想连接的

但是QQ不稳定啊

——————————————

好吧，kivy官方又给了个垃圾镜像(会编译出错的东西)

——————————————

反思学校教育

如果从初中开始，学生每天上课都可以任意玩笔记本

编程6年，全日制，高中毕业估计得成神

——————————————

卧槽，英语不好好焦虑

想和外国妹子继续发展关系却词穷了😔

——————————————

Did you success?

——————————————

successful is a adjective

——————————————

kivy buildozer image, no docker

——————————————

Two hours passed...

——————————————

From group info, you should see what we should do in this group.

——————————————

You should say welcome instead of 欢迎.

——————————————

kivy送新的镜像了

这下有界面开发环境了

——————————————

http://txzone.net/files/torrents/kivy-buildozer-vm-2.0.zip

——————————————

别人家的WiFi就是快一点

——————————————

没排斥啊

你用c系列都欢迎啊

——————————————

你见过这么优雅的实现吗

——————————————

这才是神级语言

——————————————

nice

——————————————

学语言最快的方法就是做翻译

把Python能实现的东西用c++做一遍，你绝对就会c++了

😂，等你学会c++，别人都做6、70个项目了

——————————————

Python一个list一个for就搞定了

3行代码

——————————————

感觉这是pc的chrome

——————————————

When 和 switch又是什么？

——————————————

你在你安卓上装了什么？

——————————————

它这个可能是携带了JavaScript解释器

——————————————

再说这个体积也这么大

和kivy差不多

——————————————

果然不靠谱

——————————————

报错了？

——————————————

是不是白板？

——————————————

??

——————————————

react native

——————————————

你打开我发的那个程序是不是白板？

——————————————

实际上是我没交宽带费

2333

——————————————

纯粹是github公开库的带环境+命令封装版

docker=码头=装载程序供生产

——————————————

感觉又是一块很大的东西


不过下午学了docker后神清气爽

终于有了快速在linux构建虚拟机的工具

我甚至看到有人用这个做SS

这样看来，随随便便封装个网站是没问题的

即用即取，用完即扔，还是很不错的

——————————————

似乎一个白板就要7M

——————————————

你们来试试

——————————————

虽然看起来 react native 不支持我这个低版本手机

白板😂

——————————————

https://github.com/DingGuodong/GoogleHostsFileForLinux

——————————————

To use storage drivers effectively, you must understand how Docker builds and stores images. Then, you need an understanding of how these images are used by containers. Finally, you’ll need a short introduction to the technologies that enable both images and container operations.

Each Docker image references a list of read-only layers that represent filesystem differences. Layers are stacked on top of each other to form a base for a container’s root filesystem. 

When you create a new container, you add a new, thin, writable layer on top of the underlying stack. This layer is often called the “container layer”. 

Previously, image and layer data was referenced and stored using a randomly generated UUID. In the new model this is replaced by a secure content hash.

The new model improves security, provides a built-in way to avoid ID collisions, and guarantees data integrity after pull, push, load, and save operations. It also enables better sharing of layers by allowing many images to freely share their layers even if they didn’t come from the same build.

https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/#content-addressable-storage

——————————————

https://hub.docker.com/

Here you go, to find it..

——————————————

i need tizi in docker...

——————————————

https://hub.docker.com/r/elviejokike/react-native-android/

https://facebook.github.io/react-native/docs/getting-started.html

react native, shall I tell you how to use it?

——————————————

这些新闻可能只是吸引一些中老年人去看广告

——————————————

要知道

——————————————

deepin terminal竟然不能单独设代理

早知道服务器几百k一秒的速度和本地几十k一秒的速度是不能比的

——————————————

Stop / remove all Docker containers


docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

——————————————

Endless

——————————————

每次我想停止每个程序我就得pkill python

每个进程都给杀掉了

其实我只想重启某个程序的

怎么办呢？

——————————————

pkill python
sleep 5s

#ssserver -c ss/ss.json -d start
cd shadowsocks
python3 server.py -c ss.json -d start
cd
sleep 3s

cd Telegram-with-QQ
rm nohup.out
nohup python3 server.py &
nohup python3 telegram.py &
cd
sleep 4s

cd Music_town
rm nohup.out
nohup python3 app.py &
cd
sleep 3s

sleep 5s
clear

When I do this script, it didn't sleep as I expected.

It's faster.

——————————————

难道sh脚本不是一项一项执行的？

——————————————

我们这边的信息传不到QQ

🌚

——————————————

然后省下一笔不小的网费

——————————————

网警

——————————————

wifi破解成为一项生存哲学

随便找个地方就上网

让追踪者查去吧

——————————————

要我说，还是别人家的wifi好用

https://github.com/breakwa11/shadowsocks-rss/wiki/Server-Setup

——————————————

妈蛋，SS可能不安全了

国外流量一大就断网

正常流量都不给

——————————————

Just running Ku Q on it.

——————————————

128M is enough for running xp.

——————————————

gabage news

——————————————

docker run -it --publish 6606:80 --volume ${HOME}/Kivy-Chat:/Kivy-Chat --workdir /Kivy-Chat argensis/python3-kivy:nopip ls

--publish 6606:80
container 80 part to host 6606 port

-volume ${HOME}/Kivy-Chat:/Kivy-Chat
reforword Host /root/Kivy-Chat to container Kivy-Chat

 --workdir /Kivy-Chat
set container workdir to Kivy-Chat

argensis/python3-kivy:nopip
image name

ls
just command name, is also could be python -c "print('hello, docker')"

——————————————

Life is full of unknown.

——————————————

比如我要做一个聊天项目，kivy不支持Python 3的安卓打包，这个就吹了

我要做一个分享屏幕的平台，没办法全局截屏(E4A可以截屏，但对小米没用)，这事儿又吹了

——————————————

我一直想做一个真实的项目

一个属于自己的项目

可还是没达到水准




怎样把以前写过的代码凑在一起是个大问题

——————————————

按键精灵 ∈ 易语言
所以我就放弃了按键精灵，学了易语言，按键精灵过时

易语言 ∈ Python
所以我就放弃了易语言，学了Python，易语言过时

Python ∈ ?
所以我就放弃了Python，学了?，Python过时

你知道？是什么吗？

——————————————

主要是变化大，一天一个花样

以半年为更新周期

——————————————

别忙，这个坑很大

我再掂量掂量😏

——————————————

所以现在选择很明了，一方面我们要紧握Python的大旗不放(毕竟人多为王，python是全球English Speaker的首选)，另一方面做各种平台(包括网页)界面的任务就交给JavaScript了。

这样反倒是互补不足了。

(我的原则是同一类东西，除非原来的东西不能满足需求，不然不换新的)

鉴于Python在界面生成上确实不行，所以可以加新技能点

——————————————

他们做安卓竟然都不用java了

想想确实有道理(java is garbage)

——————————————

突然感觉到，如果要做酷炫的界面还是学JavaScript吧

看看 react 或 deepin桌面就知道了

——————————————

唉，搞了半天还是不知道怎么运行一个py文件

——————————————

😂

——————————————

http://get.daocloud.io/#install-docker

https://hub.docker.com/r/argensis/python3-kivy/

Let's getting started using docker.

——————————————

Have you heard of gitlab?

——————————————

…

Great forbidden wall

——————————————

In fack, every country has its own GFW.

https://github.com/gfwlist/gfwlist

——————————————

现在单独给chrome和telegram配个socket连接

爽得不亦乐乎，再也不用反复开ss了

win就是垃圾

——————————————

还有deepin的terminal自带的账号管理，简直不要太方便

——————————————

配置累死我了

果然一键脚本、集中设置才好

——————————————

/whoami@GuoguoBot

——————————————

And if you need more information on the internet, shadowsocks is a good choice for you.

Especially when you know how to set a local socket proxy.

http://ian.wang/233.htm

——————————————

行了，误删服务器就是不好

——————————————

不小心把服务器上的东西删完了…

——————————————

Just a few hours before, I installed deepin 15.4. It's incredibly beautiful in my eyes, so I'll keep using it as my developing envelopment.

——————————————

我在想

他们如果都要1、2、3年开发工作经验

那这1、2、3年经验从哪儿来呢？

——————————————

blog.devtang.com/2015/10/07/why-fresh-wants-to-do-server-dev/ 

半夜3点上线什么的我最喜欢了

——————————————

kivy 的整个 tool chain 还停留在 python2 的阶段，你啥时候去建议他们更新一下呗

表示python2用着蛋疼，有很多地方不方便

——————————————

我们说是开发，实际不过是围绕这个平台的API接口和运行机制打转

突破平台限制最好的方法是把主程序放在自己能操控的系统或语言上(能批量生产的如Linux server)，然后通过网络编程把各个平台的简易界面连接起来。

你必须清楚一件事，如果对某一平台过于依赖(除界面外几乎每个操作都需要那个平台的非网络API)，那么这个程度多半是可以离线使用的(你想啊，PS，C4D，KingROOT，AirShow，相机)


但这仍有不足之处，因为服务器是中心，是容易被打击的对象，deep internet(tor 网络)的模式可以适当缓解被打击的几率




然后，p2p模式出现，这个实在是好，把server和client放在一个程序上。

你完全可以挑你熟悉的那个平台做，只要把socket接口做好，其他平台对应的软件可以让其他爱好者自行制作

只要你的构思足够实用，突破政府、商业、文化的限制将非常轻松

——————————————

Linux的好处是显而易见的

只要是广义的计算机，基本可以安装Linux

比如智能路由、基于树莓派的机器人或智能设备

当然现在有些所谓智能产品打着智能的旗号把硬件控制的APP垄断，那实际上算不得智能，不能diy，不能自主操控，都是垃圾

——————————————

linux

——————————————

这些平台在个体眼里就是一台设备

你能不能完全操纵这台设备取决于你找不找得到对应的软件(如果你找不到现存的东西，自己做也是必须的)

额…只是台设备而已

要是我换台苹果机，那学了安卓开发就没用了

要是没有苹果机，我就编译不了苹果软件，自然也就学不了iPhone app design

这就是鸡肋的地方了

我还是觉得unix好用，虽然没有合适的unix phone system

——————————————

这些年来，就html跨平台做得最好，其它的多少都依赖平台

——————————————

图片完全可以转为黑白图

再把黑白图转为空格与0

这样简单的表情就可以纯文本发送了

——————————————

哈哈，以前用win服务器根本不敢开流量

——————————————

本地PC挂的

——————————————

我早不用win服务器了

——————————————

一张图片，经酷Q转化就成了一堆垃圾

——————————————

哈哈，不管怎么说，今天是高兴的一天

链接了QQ，做了一个直播流，做了一个转本地服务器为公网的东西( ngrok )，还添加了新人

——————————————

录音后就不知道怎么办了

还需要学习

——————————————

我发现所谓直播，就是把视频数据分成很多小节，一段一段的发给客户端

——————————————

kivy最多能做个客户端

服务端截屏、录音什么的就别想了，应该没有root接口

——————————————

其实想到直播手机还是挺兴奋的

——————————————

这个视频流挺好的，就是没声音

同时我也搞不到持续的安卓截图，不然就可以直播我的手机了

——————————————

厉害

——————————————

难道使用人数瞬间增多硬盘就会爆炸？

——————————————

why, 硬盘爆炸？

——————————————

But I'm on the toilet right now

So it's still, absolutely still.

——————————————

I made a stream on flask
Now you can see how I use my computer

online.yingshaoxo.cf:52013

——————————————

The strangest thing is even you know that you can read almost Everything in English, you still can't get high score in school test.

——————————————

你们这些后生拥有得天独厚的条件

应该好好学习

——————————————

反正高二下学的，现在高4快完了

——————————————

我是为了编程才学的英语

3年

——————————————

主要还是复制官网例程

——————————————

right, I always do it

——————————————

构架打好就行

——————————————

抄可以，但要抄得有个性，抄得专业

——————————————

在考虑未来

——————————————

我马上就高考了

——————————————

你有github帐号吗

我看看就知道了

——————————————

完蛋了，北京专科比四川本科好😒

——————————————

工作地区是？

几线城市？

——————————————

学校

——————————————

还没回答我的问题呢

——————————————

每次发东西给别人我都心如刀割

哈哈，知识就是力量

——————————————

https://awesome-python.com

——————————————

Python不需要做轮子

——————————————

什么学校，我要去读读😁

——————————————

亚裔

——————————————

我们群只有一位真正意义上的大佬

美国programmer @system357

——————————————

肯定是本科生

与我无缘了

——————————————

我想问个问题，你怎么找到工作的

感觉这个事我也能做

——————————————

所以你是专业测试咯？

——————————————

好啊，先说说测试是什么玩意儿

然后你平时测试什么😂

——————————————

高几来着？

——————————————

我一直觉得你和 @system357 是在职的程序员😄

——————————————

去酷Q网

开发包里有C语言

——————————————

可以，用windows吗

——————————————

额…

先说你使用什么语言吧

——————————————

有个怪异的地方，酷Q需要开启调试模式

——————————————

分享Sia/Alan Walker的单曲《Move Your Body (Alan Walker Remix)》: http://music.163.com/song/436487129/?userid=280429778 (来自@网易云音乐)

——————————————

有了，每次加新人，一段时间后根据活跃度删人

然后极少的人发展感情

留下的就是管理了

——————————————

{"title": "\u6613\u8bed\u8a00"}

——————————————

xiaosheng.me/2017/04/01/article47/

这些人学着学着就让人觉得不可思议了

——————————————

测试结果出来了，会断

只要不是局域网，都会断…鸡肋

——————————————

隐隐觉得Hex11.cs的年龄比我们都大，至少25以上

——————————————

你看现在，只能是点对点(固定的群对固定的群)发送消息

其实可以做得更好，自动换群

关键是function进了线程我就不能修改其内的变量

所以 can't change CHAT_ID on fly.

——————————————

我现在十分疑惑，关于国内的网络，tcp不发心跳包会不会断

如果会断，那么就要重新构建server.py

That's silly.

——————————————

threading挺好用的啊

你看那教程了没 

https://morvanzhou.github.io/tutorials/python-basic/threading/

——————————————

不是，是用的asyncio实现并发

——————————————

要是能基于暗网就更好了

——————————————

普通的server+client模式，政府很容易封杀，app发出去没意思

——————————————

没事，我去研究下p2p

——————————————

其实客户端无所谓平台，支持Sockets通信就好

——————————————

所以总体来说，共同维护server.py和telegram.py，你管webQQ的Python代码，我管酷Q

——————————————

全Python代码你不能运行吗？

——————————————

这样你就可以运行这个项目在你的手机

——————————————

找一个就好了

——————————————

/chat_id

——————————————

我不是准备做酷Q一个平台

所以其他平台就你选了

需要用到什么API要磋商，反正学习下合作

单打独斗不可取

——————————————

已经发出邀请

——————————————

你的username是什么啊？

——————————————

@tuyunlei 
怎么合作？github有共享项目吗

——————————————

But just in theory，事实上kivy在Python 2不主动加载线程，只支持twisted

所以不能编译就鸡肋了

——————————————

Here you can see, and so I can make my own chat app on any platform in theory:

https://github.com/yingshaoxo/Kivy-Chat

——————————————

成功利用多线程解决了这个问题

后来才知道安卓等带界面的程序都是用线程把前台和后台分开的

——————————————

https://github.com/yingshaoxo/Telegram-with-QQ

——————————————

/chat_id

——————————————

举个例子，上次我遇到个kivy问题，根本没办法直接通过关键字谷歌得到答案(事实上连关键字是什么都不知道)

然后我把整个代码贴在kivy issue里，说出了我怀疑是bug的想法

结果作者很快给我回复，详细给了修改方案

我一看，瞬间懂了kivy核心原理

😄开issue方便自己也方便他人

有些小众的库只有作者和它的社团最清楚

——————————————

https://hackernoon.com/the-impatient-programmers-guide-to-learning-e2960d0516a

Wow, English is the best language in this world.

——————————————

you can try to import this in Python terminal, and some amazing things will happen:
import this

——————————————

https://hackernoon.com/asyncio-for-the-working-python-developer-5c468e6e2e8e

所以成功的Python程序应该这样搞

class、function
↓
asyncio
↓
threading
↓
multiprocessing

——————————————

成功的用多线程结合了telegram bot与asyncore

原来asyncio不是多线程，而是一种特殊的构建，用来实现一部分并发

——————————————

threading 学会多线程 python 教学 学习教程: http://www.youtube.com/playlist?list=PLXO45tsB95cKaHtKLn-jat8SOGndS3MEt

——————————————

nanshu.wang/post/2017-05-04/

我们不是一个世界的人

——————————————

这一次终于觉得易语言的组件设计得很成功

——————————————

我强烈怀疑做asyncio的人是不是脑残

要是Sockets不能和其他的框架混用，单进程能做什么？

——————————————

为什么易语言在搞界面的同时，TCP组件照样可以运行

而到了Python，就是一个loop一个进程了呢？

——————————————

我指官网

——————————————

还有，python怎么翻墙后打不开，是不是被中共收购了？

——————————————

asyncio简直是噩梦

看不懂，不明所以

——————————————

因为我需要个异步Sockets帮聊天APP在显示界面的同时接收服务器信息

——————————————

你说Python怎么这么扯啊

说好的 asynchronous、no-blocking，结果到了kivy或者一个简单的input ()就阻塞了、就接不到数据了。

——————————————

对了，还彻底搞懂了sockets

——————————————

https://docs.python.org/3/library/asyncore.html#asyncore-example-basic-echo-server

https://docs.python.org/3.5/library/asyncore.html#asyncore.dispatcher

终于搞懂asyncore并成功做了一个异步聊天服务器原型。。。
顺便看懂了kivy chat app中调用twisted的方法。。。

明天发源码

——————————————

我们是这样思考的：

为了更好地利用现有条件，不重复造轮子，通过网络协议(inproc, IPC, TCP, TIPC, multicast)把各种编程语言已有的好工具连接起来。
Connect your code in any language, on any platform.

比如酷Q+PYTelegramBot

——————————————

http://twistedmatrix.com/documents/current/core/howto/servers.html?highlight=protocol%20protocol#putting-it-all-together

至少我们知道了官方的例子不能成功在python3上运行，即使我们安装了python3版本的twisted

——————————————

You'll notice, 如果我们只是这样用TCP(发完消息即断)，就完全违背了它的初衷：“远程长久连接”。

所以下个任务是让服务器同时连接多个客户端，并支持服务器同时向多个客户端发信息。

——————————————

@tuyunlei 这个年轻有为的少年是你吗？

——————————————

tcp_server.py
import socket
from datetime import datetime

server_address = ('127.0.0.1', 6789)
max_size = 1000

print('Starting the server at', datetime.now())
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(server_address)
server.listen(5)

while True:
    client, addr = server.accept()
    data = client.recv(max_size)
    print(addr, 'said:', data)

    reply_text = '{name} reply: {msg}'.format(name='server', msg='Then?')
    client.sendall(reply_text.encode('utf-8'))
    client.close()

server.close()


tcp_client.py
import socket

server_address = ('127.0.0.1', 6789)
max_size = 1000

while True:
    client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client.connect(server_address)
    
    sending_text = ''
    while sending_text == '':
        sending_text = input('\nSay somethine: ')
    client.sendall(sending_text.encode('utf-8'))

    data = client.recv(max_size)
    print(data)

    client.close()


If you find yourself fascinated by socket programming, check out this website for more information: https://docs.python.org/3/howto/sockets.html

——————————————

UDP used for local progress communication.

——————————————

Sockets


The lowest level of network programming uses a socket, borrowed from the C language and the Unix operating system. 

Let’s write a very simple client-server exchange. The client sends a string in a UDP datagram to a server, and the server returns a packet of data containing a string. The server needs to listen at a particular address and port—like a post office and a post office box. The client needs to know these two values to deliver its message, and receive any reply.

Here’s the first program, udp_server.py:

 from datetime import datetime
import socket
server_address = ('localhost', 6789)
max_size = 4096

print('Starting the server at', datetime.now())
print('Waiting for a client to call.')
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind(server_address)

data, client = server.recvfrom(max_size)

print('At', datetime.now(), client, 'said', data)
server.sendto(b'Are you talking to me?', client)
server.close()


The server has to set up networking through two methods imported from the socket package. The first method, socket.socket, creates a socket, and the second, bind, binds to it (listens to any data arriving at that IP address and port). AF_INET means we’ll create an Internet (IP) socket. (There’s another type for Unix domain sockets, but those work only on the local machine.) SOCK_DGRAM means we’ll send and receive datagrams—in other words, we’ll use UDP.

At this point, the server sits and waits for a datagram to come in (recvfrom). When one arrives, the server wakes up and gets both the data and information about the client. The client variable contains the address and port combination needed to reach the client. The server ends by sending a reply and closing its connection.

Let’s take a look at udp_client.py:

 import socket
from datetime import datetime

server_address = ('localhost', 6789)
max_size = 4096

print('Starting the client at', datetime.now())
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.sendto(b'Hey!', server_address)
data, server = client.recvfrom(max_size)
print('At', datetime.now(), server, 'said', data)
client.close()


The client has most of the same methods as the server (with the exception of bind()). The client sends and then receives, whereas the server receives first.

Start the server first, in its own window. It will print its greeting and then wait with an eerie calm until a client sends it some data.

Next, start the client in another window. It will print its greeting, send data to the server, print the reply, and then exit.

——————————————

TCP (Transmission Control Protocol) 

This protocol is used for longer-lived connections. It sends streams of bytes and ensures that they arrive in order without duplication.

——————————————

https://muxuezi.github.io/posts/kivy-ch4-chat-app.html

——————————————

https://muxuezi.github.io/categories/kivy.html

——————————————

https://github.com/muxuezi/kb

——————————————

在洗澡时想了想，做人不应该浮躁


事情还是得一件件做，能力还是得一步步提高

——————————————

原来项目是给别人用的

——————————————

一个人真的能做项目吗？

你们两个好像github一个项目也没有

——————————————

没搜到 tor内网穿透相关 文章

——————————————

不能直接执行2进制文件，所以我还是按照官方教程安装的Sync：https://help.getsync.com/hc/en-us/articles/206178924

——————————————

北京还是上海？

——————————————

你是哪里的人？

——————————————

你们学校自带安卓机，牛逼

——————————————

为什么

——————————————

哦，我在找

——————————————

但我学聪明了，你去看看有没有现成的project可以用

——————————————

内网穿透可以利用闲置的废安卓机

——————————————

对呀，像花生壳什么的要收费

——————————————

你说有没有可能通过tcp协议用一台服务器把局域网服务器发出去

——————————————

不是，我是手动的

——————————————

还可以随系统自动启动

有了这个要什么电脑，外接键盘就可以编程了

——————————————

这东西可以安装Ubuntu 16，同时竟然兼容我之前手动安装的系统(能直接启动，省不少时间)

https://blog.mlapp.cn/134.html

——————————————

https://www.sfantree.com

看吧，学了C++基本就是搞硬件编程

——————————————

竟然有一亿下载量

——————————————

挺好，你一说才知道有这个东西

——————————————

http://ubuntuhandbook.org/index.php/2016/04/enable-ssh-ubuntu-16-04-lts/

——————————————

吓死我了，升级后重启ssh没了

重新安装就好了：

——————————————

安装resilio时遇到了坑，我手机上安装ubunt的话，属于ARMHF版本

——————————————

很好，似乎从13升到14去了(只能一级一级升)

然后把/etc/apt/sources.list里的in.archive.ubuntu.com和security.ubuntu.com换成old-releases.ubuntu.com，就可以安装python-pip什么的了。

https://askubuntu.com/questions/731891/not-able-to-install-anything-and-update-on-ubuntu-14-10

——————————————

台式放家里生锈😁

——————————————

大学买笔记本

——————————————

PC控制安卓

chrome好好的vysor用不了

只能用变味圈钱的Total Control

——————————————

2G内存

——————————————

2013年联想

——————————————

我手机性能比我电脑好

[笑哭]

——————————————

没有安卓5.0，就不能用那个

——————————————

今天试了twstied，垃圾，根本安装不了

老是说需要 微软 c++ 14.0

——————————————

如果可以，就把我的烂机器当局域网服务器用…

配上安卓SS还自带翻墙呢😂

——————————————

看能不能升级

——————————————

还是不行，用了apt-get dist-upgrade

——————————————

登进入 apt-get update太老，要先用这句更新

——————————————

sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

——————————————

我登进去了

——————————————

额，可以在VNC里用 sudo -i 得到权限，再用 visudo 改每个用户的权限。

——————————————

结果安装好，发现ssh不能以root进入

电脑控制手机又不能用vim，改不了权限…

——————————————

我有一个屏幕坏了的安卓机， 但刚好能用数据线，系统也是好的

我准备试试这个

——————————————

http://www.ithome.com/html/android/299319.htm

——————————————

http://www.jianshu.com/p/f95576c03f5b

——————————————

https://muxuezi.github.io/posts/doc-pyautogui.html

好啊，高度定制版全平台按键精灵

——————————————

这么晚睡不上学吗

——————————————

https://github.com/r0x0r/pywebview/ 

找到个符合我想法的app，但偏偏不支持安卓和苹果

这两个平台真这么恶心吗？

——————————————

twistedmatrix.com/trac/

我为什么要自己写tcp协议，脑残😃

——————————————

Wow, you like using web version

——————————————

Simple is good.

——————————————

Telegram desktop version is better than web version.

——————————————

别用易语言了

我电脑又中毒了


每次开始用易语言，过不了几天就得中毒、断网、重装、换unix

真的很烦啊

——————————————

举个例子，一个telebot程序+Sockets程序，对于怎么融合我一点方法都没有

——————————————

突然发现我不会写asynchronous程序

好多实时同步的东西不能写

——————————————

呵呵，

——————————————

 #qpy:kivy
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
from kivy.uix.popup import Popup
from kivy.uix.label import Label

import os


def find_all_books(base_folder):
    '''return all Ebook path'''
    file_list = []
    for root, dirs, files in os.walk(base_folder, topdown=False): # find all files
        for name in files:
            path = os.path.join(root, name)
            #print(path)
            if path.split('.')[-1] in ['pdf', 'epub', 'mobi']:
                file_list.append(path)
        for name in dirs:
            pass
    if len(file_list) == 0: # if no file frond, show the current folder path
        file_list.append(base_folder)
    return file_list


Builder.load_string('''
<RootWidget>:
#This is the root widget's kv definition
    Screen:
        name: 'Home'
        
        GridLayout:
            cols: 1
            Button:
                text: 'Show All Ebooks'
                on_release: root.current = 'Show'
                size_hint_y: 0.7
                pos_hint: {"left": 0, "top":1}

            Button:
                text: 'Collect All Ebooks to One Folder'
                on_release: root.collect()
                size_hint_y: 0.3
                pos_hint: {"left": 0, "top":0.5}
            
    Screen:
        name: 'Show'
        
        ListView:
            item_strings: root.all_books_name
            size_hint: 1, 0.8
            pos_hint: {"left": 0, "top":1}
            
        Button:
            text: 'Back Home'
            on_release: root.current = 'Home'
            size_hint: 1, 0.2
            pos_hint: {"bottom":1}
''')


class RootWidget(ScreenManager):
    '''This the class representing your root widget.
       By default it is inherited from ScreenManager,
       you can use any other layout/widget depending on your usage.
    '''
    def __init__(self, **kwargs):
        self.base_folder =os.path.dirname(os.path.abspath('.'))
        self.all_books_path = find_all_books(self.base_folder)
        self.all_books_name = [os.path.basename(name) for name in self.all_books_path]
        super(RootWidget, self).__init__(**kwargs)
        
        self.home_screen = self.get_screen('Home')

    def collect(self):
        '''collect all books to one folder'''
        if self.all_books_path[0] != self.base_folder: # detect if no books found
            goal_folder = os.path.join(self.base_folder, 'Books')
            if not os.path.exists(goal_folder): # if no goal_folder exists, creat a new one
                os.mkdir(goal_folder)
            for path in self.all_books_path: # move file
                goal_path = os.path.join(goal_folder, os.path.basename(path))
                os.rename(path, goal_path)
            Popup(title='Tip', content=Label(text='All books collected in \n'+goal_folder), size_hint=(None, None) ,size=(350, 350)).open()
        

class MainApp(App):
    '''This is the main class of your app.
       Define any app wide entities here.
       This class can be accessed anywhere inside the kivy app as,
       in python::

         app = App.get_running_app()
         print (app.title)

       in kv language::

         on_release: print(app.title)
       Name of the .kv file that is auto-loaded is derived from the name
       of this class::

         MainApp = main.kv
         MainClass = mainclass.kv

       The App part is auto removed and the whole name is lowercased.
    '''

    def build(self):
        '''Your app will be build from here.
           Return your widget here.
        '''
        return RootWidget()

if __name__ == '__main__':
    MainApp().run() 


#早就想做了，今天一气之下看完sentdex的kivy视频教程并跟着码了一遍代码，自己动手几个小时后发现kivy官方的文档全都懂了…

就是界面有点丑…😁

——————————————

dir()是个好东西

在不知道a class有什么functions时可以用来查看

——————————————

竟然有中英句句对应的技术书

太好了

——————————————

https://github.com/yunjey/domain-transfer-network/blob/master/README.md

只能转换脸吗？要是所有图片都可以动漫化，生成体积小的视频倒是挺好😏

——————————————

https://github.com/thtrieu/darkflow

I probably will use this in the future.

But now, just stop the stupid game.

——————————————

4、 利用训练好的分类器进行目标检测

得到了分类器后，我们就可以用来对输入的图像进行分类了，也就是在图像中检测是否存在我们想要检测的目标。一般的检测过程是这样的：用一个扫描子窗口在待检测的图像中不断的移位滑动，子窗口每到一个位置，就会计算出该区域的特征，然后用我们训练好的分类器对该特征进行筛选，判定该区域是否为目标。有时候可能因为目标图像的大小和你训练分类器时使用的样本图片大小不一样，所以就需要对这个扫描的子窗口变大或者变小（或者将图像变小），再在图像中滑动，重新进行匹配一遍。

https://m.sohu.com/n/486402690/



它的意思是把大图片分成n个小图片，再用分类器来检测

——————————————

事实上我想到了钢铁侠的智能头盔

那种自动检测敌人的东西

——————————————

谷歌这事做得不厚道

自动化武器系统必须要 detect location info

——————————————

要是开源就好了

——————————————

http://silverpond.com.au/object-detector

——————————————

https://youtu.be/edWI4ZnWUGg


我就上直播流催了一下，立马就录了个新的，sentdex真是个好人

——————————————

https://zhuanlan.zhihu.com/p/25323786

人类真神奇，图片经过那么多处理还是能识别出来

——————————————

https://deeplearningsandbox.com/how-to-use-transfer-learning-and-fine-tuning-in-keras-and-tensorflow-to-build-an-image-recognition-94b0b02444f2

竟然通过反向制造更多data

——————————————

https://deeplearningsandbox.com/how-to-build-an-image-recognition-system-using-keras-and-tensorflow-for-a-1000-everyday-object-559856e04699

——————————————

silverpond.com.au/2016/10/24/pedestrian-detection-using-tensorflow-and-inception.html

不给github代码就是耍流氓

——————————————

太鸡肋了，我拒绝发布

除非找到把简单分类转化为 object detection 的方法

——————————————

www.cnblogs.com/neo-T/p/6432596.html

为什么他识别人脸要1000张图片，而腾讯安全中心等的刷脸验证似乎只要几秒钟的视频

——————————————

但我有点不甘心啊，明明识别效果非常好，就算是怪物也能识别出来


为毛就不能有位置信息呢？

自动找人想想就激动呢

——————————————

等训练好，调整下参数，生成exe，辅助网站投稿

整理相关文件上传到github

然后就结束这个项目

——————————————

现在准备多收集些打击到的图片，不局限于单一人物，全图、全游戏通用

已有192，预计到500

——————————————

单文件版不行

tensorflow被分配到缓存目录，路径太长，出错

生成文件夹版，把模块放进去还行

——————————————

好了，现在是100*100的黑白轮廓图(轮廓的意义：识别人形)

去掉了延时，速度取决于电脑配置

现在准备打包成exe

——————————————

是有内奸吗

今天发现我正在搞的游戏把游戏中的鼠标位置放到了边缘

我是说识别怎么变差劲了




改了下，发现昨天训练的黑白轮廓模块照样有用

——————————————

刚刚偷偷地测试了一下，不行

数据简化可以，但不能脱离实际，如果你自己都不能从dataset中学到什么，机器就更不可能学到了

机器和人的区别只在于学习(训练)的数量的多少

——————————————

黑白边界([255,255,255]变[0 or 1]
502张背景图
347张击中人物图
484张未击中但有部分人物图

训练两千次

明天将是见证奇迹的时刻

——————————————

www.nvidia.com/object/what-is-gpu-computing.html

——————————————

貌似是某种图像引擎(硬件)

tensorflow或游戏加速要用

——————————————

以后买笔记本还是要16G内存、带GPU的

运行速度太重要了

——————————————

看起来Inception只是个分类器

不提供Bounding Boxes的功能

所以自瞄、全图找人是肯定做不了的啦

但就算用CNN构架能找到物体的位置，识别速度跟不上FPS就是最大的问题啦！

——————————————

不论角度

——————————————

现在识别率相当高

静态人物

不管远近，不换角度，都能自动开枪

只有一个问题：我必须缓慢移动或者把准心固定放在敌人身上识别才会有效

是识别太慢？现在是每0.2秒截图识别

据说3D游戏一般是60FPS，那是否意味着必须每秒识别60张图片才能跟上节奏？

——————————————

额…把截图直接加载进内存还是卡

这说明黑白照是必需的，对于游戏来说…

——————————————

隔绝就隔绝吧，反正我有用不完的模块

——————————————

http://pythonhosted.org/pynput/mouse.html

——————————————

我去

tensorflow只支持64位的win

那意味着不能调用32位的易语言DLL

太阴险了，这意味着我不能用易语言代替C (隔绝低端社区)

——————————————

速度非常快，即使没有转换成黑白轮廓…

——————————————

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

import tensorflow as tf, sys
import numpy as np
from PIL import ImageGrab
import ctypes
import time

#image_path = sys.argv[1]

user32 = ctypes.windll.user32

screensize = int(user32.GetSystemMetrics(0)), int(user32.GetSystemMetrics(1))
windowsize = 100//2

class _point_t(ctypes.Structure):
    _fields_ = [
                ('x',  ctypes.c_long),
                ('y',  ctypes.c_long),
               ]

def get_cursor_position():
    point = _point_t()
    result = user32.GetCursorPos(ctypes.pointer(point))
    if result:  return (point.x, point.y)
    else:       return None
    
# Read in the image_data
#image_data = tf.gfile.FastGFile(image_path, 'rb').read()

# Loads label file, strips off carriage return
label_lines = [line.rstrip() for line 
                   in tf.gfile.GFile("retrained_labels.txt")]

# Unpersists graph from file
with tf.gfile.FastGFile("retrained_graph.pb", 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
    _ = tf.import_graph_def(graph_def, name='')

with tf.Session() as sess:
    # Feed the image_data as input to the graph and get first prediction
    softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')
    
    while True:
        pos = get_cursor_position()
        ImageGrab.grab(bbox=(pos[0]-windowsize, pos[1]-windowsize, pos[0]+windowsize, pos[1]+windowsize)).save("test.jpg")

        image_data = tf.gfile.FastGFile("test.jpg", 'rb').read()
        predictions = sess.run(softmax_tensor, \
                 {'DecodeJpeg/contents:0': image_data})
        
        # Sort to show labels of first prediction in order of confidence
        top_k = predictions[0].argsort()[-len(predictions[0]):][::-1]

        #print(label_lines[top_k[0]])
        for node_id in top_k:
            human_string = label_lines[node_id]
            score = predictions[0][node_id]
            print('%s (score = %.5f)' % (human_string, score))

        print('\n')
        
        time.sleep(0.5)

——————————————

目前来看，只要把85M的模型加载到内存，每半秒识别一次是没问题的:

——————————————

你还真以为我有几台电脑

没有

虚拟机倒是很多






不要在意细节，我现在还在初级阶段，只是在尝试实时识别


你说的那个可以用网络api做出来，但那是生产环境，我不是还在玩吗？

——————————————

不懂

——————————————

这是录制屏幕的代码

——————————————

import numpy as np
from PIL import ImageGrab
import cv2
import time
import ctypes

user32 = ctypes.windll.user32
screensize = int(user32.GetSystemMetrics(0)), int(user32.GetSystemMetrics(1))
windowsize = 300
left, upper, right, lower = screensize[0]//2-windowsize//2, screensize[1]//2-windowsize//2, screensize[0]//2+windowsize//2, screensize[1]//2+windowsize//2

def process_img(image):
    original_image = image
    # convert to gray
    processed_img = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    # edge detection
    processed_img = cv2.Canny(processed_img, threshold1 = 200, threshold2=300)
    return processed_img

def main():
    for i in list(range(4))[::-1]:
        print(i+1)
        time.sleep(1)

    last_time = time.time()
    while True:
        screen = np.array(ImageGrab.grab(bbox=(left, upper, right, lower)))
        #print('Frame took {} seconds'.format(time.time()-last_time))
        last_time = time.time()
        new_screen = process_img(screen)
        #cv2.imshow('window', new_screen)
        cv2.imshow('window',cv2.cvtColor(screen, cv2.COLOR_BGR2RGB))
        if cv2.waitKey(25) & 0xFF == ord('q'):
            cv2.destroyAllWindows()
            break

main()

——————————————

其实谷歌预置的inception分类器就有83M，可以识别1000个物种

然后我们基于这个分类器，训练个几分钟，增加几M就到了85M

——————————————

这是两个问题

另外对于游戏人物的轮廓还可以这样做：

——————————————

但是，把85MB的模型加载到内存里需要太长的时间了，因此需要把分类器图表加载到内存里。

即便如此，用 TensorFlow 分析 PiCamera 拍摄到的每一张图片也是不可行的，因为这样 CPU 的使用率最终将达到100%，导致 Raspberry Pi 系统过热，因此只有运动物体的图片传送给了 Pi 上的图片分类器，并用 TensorFlow 识别不同类型车辆。

——————————————

另外还可以搞那些与你有相似爱好的用户，把他们主动搜索并听很多遍的歌曲再推荐给你😃

——————————————

歌曲特征：

发行年代(90、80)
歌曲类型(说唱、电音、民谣)
语种(中、英)
节拍速度(90bpm)
歌名和歌词的情感色彩分析(乐观、悲观、恋爱、失恋、爱情、亲情、爱国)
歌曲热度(多少人听：收听这首歌人数/平台听歌总人数)
高、低音所占时间比
…
还有很多


非监督性学习，按特征相似度聚类，网易云音乐(给你推荐音乐)就这么干😏

——————————————

人多力量大，做好数据采集程序

发给游戏辅助交流群，每人贡献100张图，应该能很快凑足数据

关键在于怎样把分类器用于“生产”，用于实时预测屏幕截图…

——————————————

300张 200次 同一个小地图

基本可以把出现人物的图和没人物的背景图分开



要做到同一个地图的自动开枪至少要500张打到人时的100×100图片(可惜我技术太渣，一晚上就打了100发在敌人身上，其余全是自己小号弄的，不真实的图片效果没那么好)

——————————————

我插，果然自己做训练集会累死

还是有个检测机制自学习好

——————————————

But就算我训练成功

怎么让它识别更快，怎么输入视频流给它，这是一个大问题

——————————————

用了150张带人物的和不带人物的图片

训练200次

结果overfiting了

对新图像识别失败



准备训练2000次，一夜时间

——————————————

用精易模块装个全局键盘钩子太容易了

Win可怕，任何软件都可以抓到账号和密码

——————————————

成功了

文件夹名是label，图片是该label类型的图片(无需固定尺寸，只需包含该类物体)



接下来准备尽可能多的收集某枪战游戏的人物图片

做人物识别+自动瞄准

——————————————

诶，我去

训练到一半停电了，是逗比吗

——————————————

Docker还不错

已经开始训练了

就像一个便携式虚拟机

——————————————

你在什么系统上训练的？

——————————————

对了，我今天突然发现，训练集可以不用固定分辨率

比opencv好多了

——————————————

你处理了什么？

——————————————

还有cpython

——————————————

对呀，c可以学

但是还没到Python的性能瓶颈

我目前还真没什么个人软件需求

明天准备做做图像识别，根据谷歌教程： https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/?utm_campaign=chrome_series_machinelearning_063016&utm_source=gdev&utm_medium=yt-desc#0

——————————————

不好玩，老是加速电影电视剧

那些人怎么还没找出安卓加速放YouTube的方法

我不想用电脑或手机开电脑网页手动加速

——————————————

恩，决定了

除了与Python相关的，再不学其它语言

人生苦短

——————————————

编程从入门到转行

我有轻度抑郁症

——————————————

诶，好像安卓的界面布局代码就是基于html的

都有<x></x>

——————————————

另一方面，如果是html类代码

那用代码写界面倒是很轻松



关键安卓java各种申明和绑定是要闹啥呀

——————————————

我想不是什么都做不了，只是不能用代码写界面

拖控件最好

——————————————

你有感受到学了编程也什么都做不了的感觉吗？

Do you feel some upsetting when you can't do something on programming?

——————————————

预测错误

反正只有几千人评星的都是水，在日本片上比较常见

——————————————

豆瓣上7.x的评分才是真的

8.x都是水的，极少数人乱搞

——————————————

接着我们学会使用智能

迈上一个新的层次

新新人类

——————————————

风格转换

漫画自动上色

图片修复

HQ to HD

智能背景音乐合成





…

任何基于经验的脑力活动都会受到冲击

——————————————

以前他们说机器人不会搞艺术

再过几年他们肯定会被气死

机器人可以搞艺术，某些方面来说，机器人效率还高点

——————————————

www.coolapk.com/apk/com.nitroxenon.terrarium

又找到个看美剧的神器，两倍速的话，逻辑什么的就不要了😁

——————————————

直白点，就是专家有了这个技能

可以省去很多重复的脑力劳动，变得更专

而没有这个技能，专家就和普通人一样，适应不了大数据的冲击

——————————————

而且看着看着你就觉得机器学习并不神秘

只是和我们平时思考差不多

相当于用计算机取代专家学者的数学预测

作为代替的，你要提供很多数据

——————————————

然后我还发现书里讲的很多概念你用中文根本不能很好理解


我的意思是用中文去表示会让人摸不着头脑


反正我以前看中文的相关东西就觉得看不懂

——————————————

实例

——————————————

然后等到一个新事例出现，就根据这个具体的函数去预测y值

——————————————

结果还和数学有关

是计算回归曲线，拟合函数

——————————————

我不是发在群里了吗

——————————————

然后学AI的那本书，三天才念百分之0.几

但另一方面，不念出来，我不太可能深入的理解

——————————————

说实话

目前完全没有动力继续做卷子

我只知道考基础我肯定是没问题的

——————————————

Docker不支持Win7

我电脑被淘汰了

——————————————

原来在机器学习里

我们面对的只不过是不同类型的数

——————————————

就像腾讯

他的主用户，QQ账号和密码在一边

各种服务又在一边

有了这个，开发可以变得轻松

——————————————

如果我解决了多文件上传+进度条显示

那差不多在website建设上就功德圆满了




因为除了上传和下载外，其他东西是不受限制的

你可以随着你的兴趣任意地做任何小应用，这些应用并不影响你的用户系统

——————————————

现在唯一知道的，就是django自带的用户管理系统是在最顶级

你每创建一个子应用都可以直接调用顶级的用户信息

关键是你不能按照官方教程那样搞，你必须把登录和验证页面做到顶级去

——————————————

说实话，有了无限空间，感觉也没啥用，因为我不会做多文件同时上传

同时，登录界面在一个子应用上，迁移出来好麻烦

——————————————

找到一个php版网易云音乐…

——————————————

https://github.com/mengkunsoft/MKOnlineMusicPlayer

——————————————

对了，如果不上传书签的话

自动删号…

——————————————

在test群

账号可以随便注册

——————————————

拿material design lite实际做了个demo

用三个字总结这个框架：不成熟

用着揪心

——————————————

谁用2G内存电脑+Android studio做程序，谁就会想死

妈了个蛋，导入一个别人的项目，几个小时过去了😡

——————————————

I don't think it's good at all.

You know, one man can't rely on one point to support the whole building.

——————————————

123moviesfree.com/watch/supergirl-s02-2015-i.2-online-free-123movies.html

——————————————

You may won't miss this chance to improve your poor English.

——————————————

搞什么鬼，任何与谷歌作对的企业 will get punished.

——————————————

金刚狼3看了没，里面那个妹子还不错

——————————————

Twitter 年轻人怎么多是日本二次元粉

难道就没有像我一样的漫威粉？

——————————————

it looks like life satisfaction goes up more or less linearly as the country’s GDP per capita increases.

——————————————

就

——————————————

其实我觉得在一些AI大方向上，用谷歌的API六足够了

https://youtu.be/w1xNTLH1zlA

——————————————

分享LE_CHAT创建的歌单「【被施过魔法】适合大开脑洞/做白日梦的BGM」: http://music.163.com/playlist/151202235/41991812/?userid=280429778 (来自@网易云音乐)

——————————————

但事实上有技术就可以在两个世界穿梭

——————————————

突然想到，政治意识形态催生的一堵墙隔绝出了两个世界。

东方用这堵墙免费享受西方作品，同时隔绝了科技。

西方想打破这堵墙卖版权和科技。

——————————————

A big challenge with online learning is that if bad data is fed to the system, the system’s performance will gradually decline. 


So now, I have evidence to say, our brain is a natural online learning system.

——————————————

One important parameter of online learning systems is how fast they should adapt to changing data: this is called the learning rate. If you set a high learning rate, then your system will rapidly adapt to new data, but it will also tend to quickly forget the old data (you don’t want a spam filter to flag only the latest kinds of spam it was shown). 




This explained why I'll gradually forget what I have learned. That's because I was learning something new.

——————————————

我知道安卓是基于unix，但unix维护者说它并不能直接运行unix程序，然后把它删除出了unix分支

——————————————

为什么没有基于unix的手机系统？

明明unix这么好用！加上个电话功能完全是神器啊！为毛没人做？！

——————————————

有个大点的平板就可以享受很多看书的便利了

我指多看阅读器的离线版

——————————————

即使是到现在，Torrent仍然是主流的盗版下载方式，这意味着迅雷的p2p下载还是可以用的

——————————————

为什么一本书可以卖几百呢？

——————————————

https://www.google.com/search?tbm=bks&q=python3+matching+learning#newwindow=1&tbs=sbd:1&tbm=bks&q=python3+Machine+learning

——————————————

本想着c++写类库，火山写界面，python写服务器

但看了看调用c++的方式，各种转换，还是要写一点java的，可我看着java就恶心

最后发现还是Python好

——————————————

http://blog.csdn.net/double2hao/article/details/50740093

——————————————

But now I know how to fix it:

——————————————

Almost every time I installing this studio, I'll get this error message, It make me feel sick about it.

——————————————

Shit, after five minutes I got this:

——————————————

Always stuck in here, what I should do now?

——————————————

SDK is written using java programming language and runs on Dalvik virtual machine . It consists of libraries,sample codes,development tools.Mostly ndk is used for accessing things from a lower level,finally to be able to port c/c++ code from differentprojects.

——————————————

https://blogs.msdn.microsoft.com/vcblog/2016/01/25/top-10-reasons-to-use-visual-studio-for-c-android-development/

https://books.google.com/books/about/Learn_C++_for_Android_Development.html?id=DWxDmwEACAAJ

https://www.sitepoint.com/using-c-and-c-code-in-an-android-app-with-the-ndk/

——————————————

I hope GaoKao could be passed earlier.

Then I can start a new journey.

——————————————

m.kekenet.com/Article/15402/

——————————————

Wow，这种小窗口好省时间

——————————————

I'm trying to run this model on the background(means not block telebot):

https://schedule.readthedocs.io/en/stable/

——————————————

After seemed so many books, no one comes similar to 'Introducing Python', which is easy to read and useful to look for.

——————————————

One difference between multiprocessing and threading is that threading does not have a terminate() function. There’s no easy way to terminate a running thread, because it can cause all sorts of problems in your code.

Threads can be dangerous. Like manual memory management in languages such as C and C++, they can cause bugs that are extremely hard to find, let alone fix.

——————————————

The problem is, if I insist searching by Chinese, I'll be stuck in Chinese, then everything I touched will not be the latest.

——————————————

https://daimajia.com/2016/09/23/share-my-exp

——————————————

Zhejiang, close to ocean and shanghai.

——————————————

Only shit!

flygon.net/浙江省2017高中信息技术改革/

——————————————

Actually, I build xiaoya just for my own study.

——————————————

no

——————————————

Well, you have choice.

You can always choose those EBook which don't have much pictures.

——————————————

So the next thing I want to do is converting epub to txt. 

I'd like to keep those original codes than broken it.

——————————————

Telegram is good, greater than any other chat server.😜

——————————————

What's the fuck, I forgot speaking English😄

——————————————

Twitter上就这个团体会发点有用的东西：

https://twitter.com/RealPython?s=09

——————————————

吃了褪黑素也不管用

半夜起来改小雅

——————————————

知识分发系统

分两层，两个参数控制，目录名+user ID

如果目录名空，加载所有书

如果有目录名，加载主目录+该目录 的书

user ID控制进度


插件只要一级目录(未完成)

——————————————

说点正经的，安卓网页视频加速看教程：


1.两个APP，UC国际版+Dice player

2.用UC打开(B站)视频网址并播放，右上角点“play with ...”，选Dice player

3.加速

——————————————

所以想和我以前的老QQ群友用一天时间分享我的一生(指日记)都办不到。

一天之类看完以前写的东西一定会特别有感触😭

——————————————

假设我想设置一个异步的时钟周期事件，易语言的控件有这个功能，但模块没有，模块需要提供一个int值和函数指针。

很抱歉，这个程序的时钟周期是随情况动态变化的，这时就能看出动态语言与编译语言的差别。

动态多是处理未知情况；编译则需要预先考虑周全，让程序不出错，一般是处理不变的逻辑。

可能容错机制也是一个差别，似乎编译语言都没有try: except:这种东西吧。

——————————————

一个人，如果处处争强好胜，他的体力、精神必定消耗得快，智者不会轻举妄动，而是不断的锻炼自己的体力意志，一直到能完全克敌制胜的时候，他才会有行动，也就是说，他不鸣则已，一鸣惊人，不动则已，一动就势不可挡。

——————————————

看过这么多是是非非

都是钱惹的祸，假设只是兼职或兴趣爱好，便不以用户需求为需求

什么用得爽，什么用得舒心便用什么

换个角度讲，这十年来还有不少人靠易语言发了家呢！

——————————————

https://youtu.be/TB0T9AwQq38

梦幻学校太遥远

——————————————

https://docs.djangoproject.com/en/1.11/ref/contrib/auth/


总之, django的用户验证模块确实为开发者节省不少时间

——————————————

https://m.youtube.com/watch?v=eLXHLRa37_g

三片纸都这么强大

——————————————

https://www.polymer-project.org/2.0/start/quick-tour

而谷歌所谓的框架或组件，不过是把原来在服务器的模板渲染放到了用户的浏览器

——————————————

https://angularjs.org/

看了看这个，发现它把jinja的模板技术用在了JavaScript上

没意思，同样是跨平台还是得看个人喜好

代码不人性的看不了几行就得放弃

——————————————

你可以清晰的感觉到，酷安就是用Django+Bootstrap构建的。

——————————————

maybe加密

maybe bbr

——————————————

不懂

——————————————

仔细想想，what is website?

它只不过是后端的显示方式之一

只是一个服务器想显示点信息，然后你访问个ip，website就诞生了

——————————————

不管怎么说，学习不跨平台的语言就是浪费生命

——————————————

From this talk, we know twree things:

1.中国的选举是水的，不代表人民
2.中国的司法不独立，人治严重
3.中国的政府行事不公开，媒体被管控，人民不能很好监督政府

https://www.youtube.com/watch?v=ZmTKkIQ8EgE&t=409sv

——————————————

说得好像他是不能专注学业，跑去当程序员了一样…😄

——————————————

所以我总结下结论：

1.网站长期存在(至少10年)
2.后端永存
3.20年后，AI将运用于人类生活的方方面面，就像目前的计算机

——————————————

这样讲来，前端和PHP都是烟雾弹，把用户的视野局限起来

更多的服务端却看不到，他们没意识到后端是程序员的主战场。如果大家都把运算在本地做了，谁来当用户？所以后端永存且知识更新速度稍慢，至少unix存在了近50年。

——————————————

近20年，平台一个接一个的死，但是web开发却从未死去，可见其威力。

而这20年积累的web工程师，已经形成一股力量，在开发web的同时，他们也想做点平台应用(别想多了，还是轻应用)，他们要这些平台应用的意图是摆脱浏览器框架、获得一些稳定性和离线功能(但我不得不说，离线功能是个渣，在以后网络会越来越稳定，恨不得把所有东西都放服务器)

另外像Facebook之类的大咖，都不想花太多精力或把自己的前途赌在一个平台上，所以催生了React-native这种东西。这些大咖主要还是经营网站，只是手机上需要轻应用做显示。

像腾讯，就太失败了，受制于专制文化，不敢做网站，怕泄漏大数据。结果只能深植于平台，最近的“ios微信打赏关停”事件，就是一个警钟。

该睡觉了，褪黑素还没寄到，不知道身边药店会不会卖安眠药。

——————————————

不过既然是跨平台，跨谁呢？

苹果？不要用苹果，只有乌合之众才会用不开源、封闭的东西(So, if 苹果不开源，不会成为工程师的首选)

安卓？谷歌的小弟，是侵占市场的工具，如果谷歌倒了，安卓就没有活路。并且，谷歌主要依托网站，没有网站还做什么自由搜索，还做什么互联网？叫封闭网络得了。So, 网页是谷歌的底线，谁敢封杀网页，谁就是与谷歌作对，而PHP是不支持系统级开发的(X掉)，java对开发者不友好(X掉)，只有Python能担当既保留网站又做到大型系统的运算，并且保留友好对所有人。

所以科技+网页仍是主流，谷歌不倒，就还有救。

要想谷歌倒闭，除非你们工程师愿意在一个APP查资料，但事实上是不可能的，没人喜欢专制，专制了就不是互联网。

——————————————

https://facebook.github.io/react-native/

于是我们又给Facebook打工了

不过想法不错，网页设计技能跨平台

——————————————

原来社交平台最重要的不是软件或其他什么东西


而是人


没了人，全都玩完

——————————————

{"title": "Easy Language"}

——————————————

获得的途径

——————————————

从哪儿得到的链接？

——————————————

你怎么进来的

——————————————

/remove@zh_groups_bot

——————————————

{"title": "\u6613\u8bed\u8a00"}

——————————————

/remove@zh_groups_bot

——————————————

我不是一个纯粹的程序员

我还懂人性

——————————————

我总结了这么多经验，结果就最后一句有效：


你我都错了，学习最重要的不是方法，而是兴趣，没有什么比饱含热情持续不断的做某事更能让人进步的了。

——————————————

论：
英语积累愈多，才能窥见规律，遂生语法。
数学题型把握愈多，才能洞察规律、明晰思想，而后灵活之。
语文积文成山，而后文思当如泉涌。
历史博古通今，而后慎思明辩。
(政治缩句内化，网罗(织)思想(考点))

-2.Role model
英语：疯狂英语李阳
数学：新东方周帅
历史：真话历史袁腾飞

-1.Resource
English: 英汉对应的简单材料、《English Grammar in Use》、TED、Youtube
Math: 6·7高考自主复习资料

0.Repeat
英语：不理解的真题在理解基础上背三遍。
数学：逻辑严密基础上，例题、真题做三遍。
原理：Memories, 加深印象，减少延迟，减少失误。(How to memories? Repeat!)

——————————————

理论总括:
记忆是智慧之源。
想象是智慧之路。
直觉是智慧的生产力，它是由大量训练后得到的通过潜意识预测事物的神经网络。


记忆的三要素:
集中注意力(耗精力想要去记)、联想(从已有记忆找联系)、重复(不断复习对抗遗忘)

记忆方式:
理解记忆(由已有记忆找联系)、机械记忆(不断重复，从无到有)

想象的关键：
多维多角度

逻辑连接思维，想象连接现实。

精力是脑力之源。
精力：大脑耐用程度(神经元耐电性能)
精力提高：清心寡欲 + 长跑等体育项目

具体综合:
英语靠记忆，数学靠思考(先记忆、后思索)。
错、难题会告诉你不足之处。
珍视一题多解，深入理解题目内涵。

小技巧：
专心+番茄钟(精力充沛做“理科”，精力不足做“文科”)

小心态：
放轻松，深呼吸



特辑：万能做题法

一切涉及到计算、逻辑推理的题都需要数学能力做支撑。

一切阻碍你做题的记忆性知识都要求你记住。

具体：独立做出后才对照答案，不对继续思考(可翻书)，直到出正确答案或放弃，放弃则不答题，然后请教他人。(文综类试题更偏像语文，不用太注重答案，相似即可，因为教育不是要生产出同一型号的机器人)

理由：做题不是目的，会做题才是，彻底搞懂一道题，胜过瞎做十道题。并且，浮躁的人做不好这些需“慢慢”、仔细思考的题。(不怕慢，就怕一天到晚瞎猜答案，什么都不懂，做无用功，浪费时间和青春)



特辑:英语学习

指导思想:疯狂英语(母语式学习)

科学解释:
1.快速的将脑中中文含义转化为英文认知

2.三最法帮助人们集中注意力、练习口语、听力、眼力

3.脱口而出符合检验人们是否记忆的原则——复述

4.疯狂的信念是积极的思想，人无信念，难成大事。

具体:
初学者最好选择有字字对应的译文的材料。

句子是中介，你需要彻底分析并记忆它。

记句子，要敢于发声，一个单词一个单词读准、明白并记忆意思，一个句子一个句子读顺、分析语法与意思，一篇文章一篇文章读烂、能背诵与默写。

遇到新句子时，要坚持不搞懂第一句，绝对不学第二句的原则。

为了将语音转换为字形，你要常写。

为了对付听力，你要把带字幕听力像阅读一样搞懂听熟。

坚持下去，你的英语水平取决于你掌握的长难句与文章数量。

为了训练英语思维，你有时要强迫自己用英语思考、造句、表达。

 

特辑：数学学习

数学学习三步曲(新手+不会的新题型)：
1.连题目带答案抄一遍(若已经记在脑中就免去这一步)。
2.结合题目，边抄第二遍答案边思索每一步的由来(在脑中演算每一步的由来)。
3.重复第二步，直到彻底理解并能独立做出来。(对照答案，不对则重新演算)

理由：无输入无输出，无思考无智力，彻底理解、独立做题才是王道。

评价：掌握到这个方法，再难的题都可以从中汲取营养。但需选择性的使用，偏重高考题或经典例题。



学习猜想:
当你探索某类知识的学习方法并不断对自己实验时，你已经在慢慢进步了，当你能写出一整套基于你实践的学习方法时，你已经成功的学会了这类知识，并且还掌握了更新它的方法。

资料分两种，一种是“天梯”，看似终点遥不可及，实则一步步前进，能到达顶端；另一种是“天坑”，知识前后不连贯，时常遇到难以逾越的天堑，需要神人相助。寻到“天梯”是一种幸运。

学习就像穿衣服，有些人穿一辈子还是那么慢，有些人两、三年间练成换装术；一是由于所花时间不同，普通人每天两分钟，大师每天五小时；二是由于态度和方法，大师不断寻求最优穿法，而普通人只把穿上作为目标。

绝对的执行力带来绝对的自信，绝对的routine带来绝对的稳定。

学好数学最原始、有效、通用的方法就是做题。不过做题分两类，一是学习性做题，二是训练性做题。

(把单词放在句子里记得牢，同理，把公式放在题里记得牢。(把句子…文章里，把题…套卷里))

彻底搞懂一类题→反复思考这类题
彻底理解一段话→反复记忆这段话、在不同场景感受这句话。

(字形)图像、声音、想象三者合一，你才有可能记得更快。

当你闲得蛋疼，除学习外没别的事可做，就一定能克服内心的动力障碍。


哲：
知识无处不在。

世界上许多伟大发现(明)都是偶然造成的。那需要机遇和巧合。但唯一不靠运气的是掌握、运用已发现(发明)的规律(东西)。

学习的最高境界就是靠直觉。解题时并非无逻辑，只是被抽象内化了，就像机器学习一样。使用训练集完成任务在一瞬之间，而训练集的获得却需要大量的训练。


评：
传统的老师一般认为训练性做题是学生的事，同时把课堂当成学习性做题时间，甚至没收学生答案。这是一种专制，损害了学生的自主学习能力和积极性。

受类似“教会徒弟，饿死师傅”等思想影响，中国老师或多或少教学有所保留，即使她们表面不说，潜意识也这样想。她们害怕学生不靠她而比她强。而美国人，如程序员，不这么想，他们毫无保留的分享他们的知识，一方面因为极少人能看懂，另一方面，他们有信心能掌握比他们所教的东西更多的东西，他们有很强的学习能力。

老师们所说的“同为一个班，说老师不行，得全班都考得差”这句话是有问题的，按照这种逻辑，得全班考得好才能证明老师好。事实上一个班既有top student, 也有 low student，传统教学只对中端学生起作用。换句话说，最低成绩和你没关系，最高成绩也和你没关系。高不需，低不懂是班级普遍现象。依我所见，唯有 study leader (精神导师) 才能发挥最大教学作用。此时，知识本身不重要，带你去学会学习，让你愿意学习才重要。

你我都错了，学习最重要的不是方法，而是兴趣，没有什么比饱含热情持续不断的做某事更能让人进步的了。

——————————————

也对，目前时代升级，博客的效果减弱了

配合视频打造个人ip也许更好，像： https://youtu.be/nWJZ4w0HKz8

——————————————

其实我完全不在乎他们全用php做网站

因为我还没看过高手用php

同时，css和js负责外观，这是比较统一的标准

谷歌也认可

纯css+js的外观很容易更换，这也是网页模板的思想

——————————————

https://itroy.cc/791


有些高中生完全具备了大学生的能力…

——————————————

树莓派+轻型笔记本+云端服务器

这样的开发环境肯定很爽

——————————————

有了sync，从此不要数据线

本地网络传输挺快的

——————————————

那意味着我还是哑巴

——————————————

突然发现我听英文歌不用看歌词秒懂

看电影不用字幕秒懂

估计听力词汇到1万了



再加上最近的2倍速原则…

但不知怎么，我不太高兴，因为我还不会随口说出正确的英语

——————————————

😏

——————————————

刚刚尝试用Python写一个计算时间的任务执行器

两个小时下来，几乎被气疯

还是易语言好…

——————————————

https://sunflyer.cn/archives/421

我觉得这些程序员做的事还是很有趣的

一般人根本做不出来…

——————————————

https://simpleisbetterthancomplex.com/tutorial/2017/02/21/how-to-add-recaptcha-to-django-site.html


好，现在我们不用担心网站被人注水、恶意攻击可

——————————————

There is nothing good compared with math and programming.


Especially when you got deep into programming, math can be fun.

——————————————

https://tonejs.github.io/examples/#shiny

——————————————

http://www.exhaustingacrowd.com/london

——————————————

为了保持多端文件共享传输的稳定，利用路由器固定内网ip是必要的。

为了更舒适的学习、工作环境，换一个噪音小的PC是必要的。

——————————————

为了让眼睛更舒服，全黑背景 + f.lux + 自动隐藏桌面图标和任务栏是必需的。

——————————————

为了更自然的抄袭代码和显示效果

我们必须使用ssh工具如putty连接虚拟机

——————————————

为了更自然的使用vimium

我必须把chrome书签隐藏起来

——————————————

不停地看鸡汤

——————————————

http://tech.glowing.com/cn/advices-to-junior-developers/

——————————————

卧槽

没想到JavaScript这么简单，(有Python和C++基础)五分钟学会，关键要找对地方…

https://www.javascript.com/learn/javascript/strings

——————————————

我现在也相信JavaScript会永生了…

——————————————

最后，浪费时间是可耻的

Blogger靠谱，写生活还不会被国内的有心人利用，good

https://yingshaoxo.blogspot.com/2017/04/new-year.html

——————————————

另外，谷歌的Blogger、简书、知乎这些地方写文章也不错啊，就是国产的可能不支持导出，并有审查删文的风险

——————————————

当然还有基于go的hugo

——————————————

不过我怀疑放着大量基于→php的框架如wordpress、ruby的框架如jekyll、JavaScript的框架如hexo←不用，自己做是不是很脑残

——————————————

考完后先去找工作或考驾照

同时做个人博客(基于flask和material)，然后开始系统学习机器学习、写博客

要从相关理论开始

等学完差不多就该毕业了

——————————————

网页的iframe框架竟然不支持带端口号的网址

那基于不同端口的网站计划就泡汤了

——————————————

前端框架的博客模板

——————————————

https://getmdl.io/templates/blog/index.html

谷歌家的东西就是要好一点

——————————————

http://www.williamlong.info/archives/4945.html

——————————————

那么理论又来了

对于一家初创的小公司，别人做得已经泛滥的东西不要做，没前途

对于一家大公司，拓展一下自己的业务是可以的，但要怀着一颗敬畏之心，不可草草了事

这种情况在新平台、新语言出现时会被打破，小公司可以趁这个机会抢大公司的市场

程序员则应更早注意到新软件平台的出现，提前学习，好在高潮到来时领到高薪


循环

——————————————

你看，有什么意思，人的需求一时一个样，做得再好也会过时，并且处在互联网时代，过时变得太快了


http://music.163.com/song/34040693/?userid=280429778

——————————————

我算是彻底失眠了，明天要买安眠药

——————————————

这样说来，到一定程度，程序员要进步还真得写博客。

——————————————

或许是学校非常蛋疼，周末一个人无聊就自己思考写书什么的

——————————————

实用

——————————————

以前我能写那么多理论，有重要的一点：我会写日记、我会定期回顾我的言论。


这说明复习很重要，每次复习后知识会更系统化、更便于总结成使用的经验。

——————————————

"The true sign of intelligence is not knowledge but imagination." – Albert Einstein


https://www.google.com/culturalinstitute/beta/theme/OALiBKJSp6JeIQ

——————————————

整体无所事事，除了做卷子也不知道做什么程序好呢？

都怪你还不分享你的书签

要是我能编译出安卓的kivy，就肯定有事做了😳

——————————————

当然还有不写注释

我已经看不懂以前写的小雅什么逻辑了😂

——————————————

我目前写程序有几个大毛病


1.不会git分支及相关版本控制

2.不会写测试程序

3.不会异步并发处理

——————————————

kb.cnblogs.com/page/566523/

——————————————

http://chinadigitaltimes.net/chinese/2017/02/%e8%99%8e%e5%97%85%e7%bd%91-%e5%b8%b8%e6%9c%88clarence-%ef%bc%9a%e5%b0%8f%e5%9f%8e%e5%b8%82%e5%9c%a8%e4%ba%92%e8%81%94%e7%bd%91%e6%97%b6%e4%bb%a3%e7%9a%84%e5%8a%a0%e9%80%9f%e8%a1%b0%e8%b4%a5/


我们做的一切互联网交易，都是为一线城市运送资金…

——————————————

只有大城市好找，比如上海

像贫困地区如四川省里的市，就找不到了

——————————————

哦

——————————————

from selenium import webdriver


url = 'http://foxtube.com/videos/lovely-blonde-staci-carr-really-arousing-massage-13584.shtml'

driver = webdriver.Chrome()

driver.get(url)
content_element = driver.find_element_by_tag_name("iframe")
content_url = content_element.get_attribute('src')

driver.get(content_url)
content_element = driver.find_element_by_tag_name("video")
video_url = content_element.get_attribute('src')

driver.close()

print(video_url)


#http://www.seleniumhq.org/docs/03_webdriver.jsp#selenium-webdriver-api-commands-and-operations
#https://chromedriver.storage.googleapis.com/index.html?path=2.29/
#Ok, now everything just ok, but you got to endure the slow speed.

——————————————

其实目前还有一个市场待开发：

宠物p2p(people to people)交易平台



传统的快递不允许送活物，导致我想买只猫都不行，所以有这个平台，那些家里生了宠物宝宝的就可以就近出售，由于面对面交易，还可以搭配做出社交平台的感觉(其实这也是电商转型做平台的一个开端)。

——————————————

奇怪

我一直以为搜索是不用分词的，就像文本编辑器默认的那样，搜索到匹配的文本会高亮

——————————————

为什么在网页版和安卓版，搜索“收费”两个字，搜不到这条消息？是bug吗？

——————————————

为什么不整理国外的资料

国内的不好用，都是几年前的货

——————————————

…

到时你把编译成安卓的过程做个视频或文章记录可好？

——————————————

你的kivy程序开源吗？

——————————————

https://medium.com/dualcores-studio/advanced-web-scraping-in-python-d19dfccba235


有了这招，动态加载的网站就可以被爬取了

——————————————

其实有时候，我觉得毛泽东是个好人

他推崇英语，曾提议把中文变为字母语言


相反那些鼓励文言文的人最为可恶

——————————————

你们为什么不分享书签

两个原因：

1.小气

2.懒得注册(思考，我可以把密码项撤掉，但名字还是要输的)

——————————————

速度一下子就提上去了

——————————————

https://down.vpsmm.com/shell/bbr.sh

This one just work fine for installing bbr.

——————————————

https://yepster.me/vps/ 

我就喜欢看别人博客

——————————————

闪led有什么用😄


vultr自建的SS看不了YouTube是不是可以找客服解决

——————————————

Can you send your Chrome bookmarks to my website?

——————————————

回头看django

除了修改代码后自动加载没什么优势

反观flask, 就这么个功能，分分钟做好，结果django我用了几天

django太死板了，不如flask那样灵活

——————————————

Sure

——————————————

不要，直接@BotFather

——————————————

什么bot

——————————————

然后呢？

其实我现在还在做bot

只是在等知识更新，AI向

——————————————

http://yingshaoxo.cf:8888/main/

——————————————

利用openload可以突破存储限制

但我想了想，送人以鱼不如送人以网

分享网站更靠谱

——————————————

网络有一种冲破信息封闭的力量

——————————————

好吧

传统套路，高考改变人生

——————————————

你不觉得网络(技术)可以改变人生？

——————————————

中国的9大社会阶层


◇第1级

以在任政治局委员、退休常委为代表。
和2级的区别在于：1级对全国局势有控制能力，2级没有。

◇第2级

以在任有实权的省部级干部、退休委员、部份大权贵、大富商、大银行家为代表。
和3级的区别在于：2级能影响国家政策，3级不能。
（编程随想注：某些2级的家伙，其实是1级的直系亲属，比如邓、李、江、朱、胡、温等人的老婆或子女）

◇第3级

以一般省部、副省部、特别实权的局级，或是大企业主、一般权贵富商、名牌大学校长、中等银行家为代表。
和4的区别在于：3能够影响一个地区或者行业的发展，4级不能。
3级以马云、马化腾等为体制外的顶峰，3级其实是行业精英或地区体制精英。
（编程随想注：某些3级的家伙，其实是1级的旁系亲属，比如习近平的两个姐夫都是大财主）

1至3级是中国的上层社会，普通人非奇遇不能进。

================================

◇第4级

以一般地厅级、实权县处级、院士、大教授、高级职业经理人、名医生、名律师、高校校长、演艺明星、知名作家、 中等企业主、小银行家之类为主。
普通人通过奋斗最多能够达到这个层次。比如惠普谷歌大中国区总裁、范冰冰之类就是体制外本级的顶峰。
和5级的区别在于：4级和上层有千丝万缕的联系，5级没有。

◇第5级

以小企业主、普通处级副处级或实权科级干部、教授、中等职业经理人、大城市多套房地主、二三线明星、小有名气的医生、律师、工程师等。
和6级的区别在于：5级有自己的事业，6级没有。

◇第6级

以普通公务员、主流企业职员、高校青年教师、普通自由职业者、一般医生律师、一般工程师、大点的个体户等为主。
名牌大学生、研究生毕业后多在这个层次。
和7级的区别在于：6级有一定的上升空间，7级很难。

4至6级是中国的中层社会，分别是高、中、低端中产阶级。普通人通过努力，最后能够定格在第5级就算是很不错了。

--------------------------------

◇第7级

以普通企业工人、边缘化的体制内人员、小个体户、城市底层土著、富裕农民之类为代表。
和8级的区别在于：7级能够在大中城市立足，8级不能。

◇第8级

以血汗工厂工人、普通农民等为代表。
和9级的区别在于：8级能够自食其力，9级不能。

◇第9级

以大城市底层失业人口、偏远山区农民等为代表。
以城市的基本生活标准要求，这些人在城市基本不能自食其力。

7至9级是中国社会的底层，是草根阶层。

——————————————

http://www.itheima.com/special/pythonzly/?wangmeng


感觉这上面说的学习路径和我的差不了多少…
我马上也要跳到第6阶段了。

——————————————

我正在做一个分享网站

——————————————

大概明天完成

——————————————

我想到一个填补网络阶级鸿沟的办法

——————————————

Look at this, just amazing!

——————————————

https://aiexperiments.withgoogle.com/

——————————————

被气得吐血…

搞什么飞机，非要去中文化

——————————————

http://www.ziqiangxuetang.com/django/django-tutorial.html

——————————————

我又开始说中文了

真是应了那句老话，我们都是哑巴英语人

——————————————

火山移动迟迟不出来

真是应了那句老话，每次都慢时代一拍

——————————————

In the end, I solved it with JavaScript.

window.location=""

——————————————

https://blog.icehoney.me

别人的博客都比我的好看

——————————————

Django 不好用， redirect像渣一样，无法跳转

——————————————

https://hackernoon.com/docker-tutorial-getting-started-with-python-redis-and-nginx-81a9d740d091

Indeed, it should be good for program developing.

——————————————

当个程序员真费劲

不是就是很难和普通人说上话

不是就是一说话就得罪了他们

Aloneness is the only mather fucker I got.

——————————————

Are you kidding me?

I guess the first thing you need do is finding out how to survive in a new country.

——————————————

How about do this after failing in university entrance exams?

——————————————

If you want to work abroad, how would you do to achieve it?

——————————————

On Unix, we could just created a file named ‘do.sh’, filling it with Unix script commands, running it with '. do.sh'.

——————————————

https://www.autodraw.com

We all artist!

——————————————

Well, English is power, when you being a poor country.

——————————————

{"title": "Easy Language"}

——————————————

I would recommend you this book for Python learning.

——————————————

@Grimes_Z

Here you can see, this group got some E-book.

But not all...

——————————————

I'll remain some person that I think helpful to this group.

要留下的尽快发句话，不然都删掉，你们平时也不发言，只是做伸手党，并且还老是泄漏消息…ash.

——————————————

心累，老感觉自己啥也不会

可能这才是编程的终极世界

——————————————

我想解散本群，有人支持否？

——————————————

仅仅可能因为第三方有广告

然后读者体验不好

——————————————

还有视频、音频的上传下载

都有现成的，我为什么想自己做一个？

——————————————

同样是言论，自己做个blog和用Twitter有什么区别

感觉都差不多啊，我为什么要执着于自己做一个…

——————————————

http://chinadigitaltimes.net/chinese/2017/02/%e3%80%90%e7%9c%9f%e7%90%86%e9%83%a8%e3%80%91%e5%90%ac%e5%a3%b0%e5%b0%b1%e8%83%bd%e8%af%86%e9%aa%97%e5%ad%90/



不过看起来还是人工智能前景最好

——————————————

从功利一点的角度讲，我是没看到招flask程序员的…

所以才学的dgango

——————————————

https://developers.google.cn/web/tools/

——————————————

然后是数据库

不要排斥它，数据处理还是挺实用的


并且Python自带 sqlite3 数据库

——————————————

dgango简直神器(super tool for web design)

比起Flask，代码 (包括html) 更改后自动重启服务，能节省非常多的时间

——————————————

These days, I been trying something hard.

像是坚持以两倍速看教程，坚持以n倍速听书，坚持看英文document，坚持用冥想的方法做卷子，坚持在computer工作的时候去做其他事情

It's really help to me, 这很容易让人懂，你有更大的价值还未被开发

你有更多的以前做不到，but you can do it in the near future.

——————————————

人们常说“人生苦短，我用Python”

其实不然，应是“人生苦短，我用English”

受国家意识形态限制(我腐败独裁你不要说)，国语已经被彻底严格控制

中文已经变成了一种死文字，无法自由的表达

你可以在几十个人的群里畅言，但你无法对成千上万的人讲这些…


此外，这是个全球化合作的时代，机遇往往不在中国，而是外国出现，中国抄袭。

这是一种常态(normal situation)

任何想超越阶级的新一代年轻人若是不想适应高考，学习(抄袭)西方的新东西，应用到本土，继而开辟巨额市场 is the only way to success.

——————————————

yingshao xo:
不知你们中的谁把Python的东西放在吾爱破解或其他中文平台

我只想说一句，please speak English!

不要让党国愚昧人民的做法得逞，using English, 你可以看到一个更广阔的世界(You will see a bigger world)

On the other hand, 结合中国本身的特点及文化，你可以更深入的看懂人性

了解了这个，你就不应该盲目

Knowledge and economy, they are friends.

——————————————

什么必须收费？娱乐的，让人感到愉悦的，如AV、影视。

什么不应强制收费？P2P的，由用户提供数据的。

——————————————

Don’t be evil. We believe strongly that in the long term, we will be better served — by a company that does good things for the world even if we forgo some short term gains

——————————————

其实技术本身就是一场逐浪

人也在逐浪

日新月异

——————————————

先停一停，考上大学再继续

——————————————

苦逼程序员英语好

牛逼程序员数学好

——————————————

代表同样的概率

——————————————

文字是对数据的表现方式之一。

数据的本质是事物的差异。


对于计算机来说0.5和1/2没区别。

所有事物的差异都可以用数字的大小关系等价代换。

因而机器能学习，因为你把人类能理解的差异变成了计算机能理解的差异。

——————————————

人所有的脑力活动也是对数据进行处理。

综合看来，电脑是对人脑的外延(外部延伸)、是人类改造世界的有力工具。

——————————————

所有的程序不过是对数据进行处理。

计算机是计算什么的呢？数据。

数据的另一个称呼是信息，所以有“信息技术”这个词。

——————————————

企业招人通常有下面几个渠道和路径： 

1.在招聘网站上刊登自己的招聘信息，然后等待应聘者投简历。 

2.在招聘网站上搜寻满足自己要求的简历，然后线下联系。 

3.推荐。通过内部推荐找到公司内部和外部的合适人选。

#从文章中学得

——————————————

我国某程序员的自录

www.kancloud.cn/lincyang/details-itguys/99277

——————————————

https://www.zhihu.com/question/31529039


我的世界观崩塌了

——————————————

https://www.zhihu.com/question/21359049 


世界真奇妙，你我太渺小

——————————————

我甚至想做个家庭影音小站

一键架设局域网网站(放公网也行，因为是Python)

用于分享、控制影音资源，包括云播、离线下载、网盘

——————————————

在后端呆久了，看到乱七八糟、五颜六色的界面就觉得是种对时间、精力的浪费。

——————————————

Disable desktop service from boot:
sudo systemctl disable lightdm.service


Start desktop service:
sudo systemctl start lightdm.service

——————————————

搞不明白为什么这个网站，中国也要禁，硅谷网也要禁

只有香港的网才能正常访问

https://www.w3schools.com/Bootstrap/bootstrap_ref_all_classes.asp

https://zh.greatfire.org/https/www.w3schools.com/Bootstrap/bootstrap_ref_all_classes.asp

——————————————

经过半夜的奋斗，总算把css调得好看一点了…

——————————————

Make web_object staying at the center of a page


<style>
   .center{
   text-align: center;
   margin-top: 50%;
   margin-bottom: 50%;
   margin-left: auto;
   margin-right: auto;
      }
</style>

<p class="center">Hi!</p>

——————————————

kxstudio.linuxaudio.org

难道Ubuntu上的音乐制作就这一个吗

可苦了我的midi键盘，没win都无处施展

——————————————

沉寂了一小会儿


突然发现，目前所有的想法，都是别人产品里的东西…

像网易、腾讯、谷歌这些…

——————————————

One command install Chrome:


sudo apt-get install chromium-browser


And run it by :
chromium-browser

——————————————

Get

——————————————

Update Ubuntu server to desktop


No preloaded programs:
sudo apt-get install --no-install-recommends ubuntu-desktop

Got preloaded programs:
sudo apt-get install ubuntu-desktop

——————————————

似乎是PHP写的

如果我会Css+JS，有没有可能用Python写出这种东西呢？

然后翻了翻豆瓣，发现用Python能做大项目(PHP好像也可以…)

https://music.douban.com/programme/305842


接着看到知乎，我笑了
https://www.zhihu.com/question/19628655



最后，Python程序员于中国不好找，物以稀为贵
https://w3techs.com/technologies/overview/programming_language/all

——————————————

https://smusic.qz5z.tech

这个点歌台玩得不错

肯定学校装逼之作…

——————————————

thefatrat.cn


music time

——————————————

但现实是版权商会把我砍死

——————————————

给我1000G储存

我能做出一个超越网易的音乐产品


作为文科生最不缺的就是想法

——————————————

Python不就是西方版的易语言嘛

什么都有人为你做了

你引用就是了

——————————————

http://yingshaoxo.cf

账号test
密码test

——————————————

Gunicorn竟然可以设置多个工人(进程)，并发提供服务


这样网站不卡了

——————————————

How to kill a series of special process by its name


pkill it's_name

——————————————

How to use Gunicorn power Flask website


1.remove flask
if  __name__ == '__main__':

2.run
gunicorn -b 0.0.0.0:80 -w 4 flask_file_name:app

——————————————

jiayi.space/post/flask-gunicorn-nginx-bu-shu

这是我找到的

——————————————

flask 在服务器老是自动挂掉

就算用了nohup也没用


怎么办呢？

@MikumoConoHa

——————————————

小雅不接受群消息

@XiaoyaBot

——————————————

@XiaoyaBot 

小雅不接受群消息

——————————————

还差分页，我flask项目就完成了

——————————————

chenghaoq.me/article/17/


看看老大哥怎么写python的

——————————————

大数据听起来就很坑爹

实际上对于平头小百姓，学的是爬虫科学…

——————————————

学Python就是好，一条龙服务

学了大数据，就把数据拿来训练AI

然后AI又可以用到服务器上，以网站形式或客户端形式提供服务

这一切，它一个就能搞定

——————————————

就是主机的速度慢上天了

——————————————

http://yingshaoxo.cf

终于把框架做好了

Music town ， 纯Python+Flask制造

——————————————

看你很熟悉的样子

肯定改过不少游戏

——————————————

哦

模拟出来也没用啊，客户端又不是想改就能改的，请求地址不一样

——————————————

什么鬼，可以写游戏？这么有趣的事？

我一点都感觉不到可以用这几招写个网页游戏的可能性，当然网上也没看到现成的源码

——————————————

了解了这个就可以让html与Python交互，做出动态网页


https://youtu.be/uqr-e-dkkNI

——————————————

我只是觉得中文的别扭，歪曲作者表达效果

——————————————

https://xiaolongtongxue.com/articles/2017/how-does-qq-know-who-i-am/

像这样写文章一定很爽

——————————————

什么时候像作者那样屌就好了

https://xiaolongtongxue.com/articles/2017/english-writing/

——————————————

www.hcocoa.com/wap/2013/03/25/Legend-of-Chinese-Hacker-A-Spectre-is-Haunting-Darkness

结果就是看很多中文

——————————————

对了，我还想问问英语怎么提升

不提升看相关原著很困难

像这个：

——————————————

主要是到年纪脑力该下降了

——————————————

没事，我感觉学不长了

想找本介绍ML的好书，仔仔细细看看

——————————————

现在 Ubuntu server 也可以使用SS全局翻墙了


https://jingsam.github.io/2016/05/08/setup-shadowsocks-http-proxy-on-ubuntu-server.html

——————————————

刚刚用Ubuntu更新，发现几B一秒

瞎他妈的防火墙

——————————————

《易精经》易语言源码大全

https://eyun.baidu.com/s/3bpzQGk3

——————————————

竟然有246M的win 7

https://mirrors.lolinet.com/iso/windows/custom/win7/fretful_fretful_fretful/Win7_x86_Enterprise_Edition_by_fretful-fretful-fretful.zip

——————————————

几乎所有程序员都是孤独的


他们几乎一天12小时泡在社交平台上

——————————————

https://youtu.be/vOppzHpvTiQ

正经的教学

——————————————

Dictionary Comprehensions


>>>word='letters'
>>>letter_counts={letter : word.count(letter) for letter in word}
>>>letter_counts

{'l':1,'e':2,'t':2,'r':1,'s':1}




#竟然忘了字典也可以循环，这他妈要省多少功夫啊

——————————————

Set a root user in Ubuntu


sudo -i

sudo passwd root

——————————————

Vim commands


copy a line:
yy

delete or cut a line:
dd

paste a line:
pp

create a new line:
o

——————————————

531670665

国内人为什么偏爱QQ

——————————————

https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/

正经的教学

——————————————

https://youtu.be/JKR1Dxinwwc

9个月前的，不知能不能用

——————————————

什么是GPU


显卡的处理器称为图形处理器（GPU），它是显卡的“心脏”，与CPU类似，只不过GPU是专为执行复杂的数学和几何计算而设计的，这些计算是图形渲染所必需的。

GPU科学计算速度比CPU快。

——————————————

兴奋之余想到还有两年的学习时间


还是感到满足了

——————————————

突然发现Python学得差不多入门了

——————————————

http://playground.tensorflow.org

——————————————

艹，总算可以做自动开枪的外挂了

https://youtu.be/cSKfRcEDGUs

——————————————

对了，还要将特征全部转换成数字。

——————————————

关键是找到区分事物的特征值

并且指定什么不同事物的名称→即标签


然后有了大量数据就可以用决策树做出很好的预测了。

——————————————

运用决策树判断数值大小



from sklearn import tree

features = [[1, 2], [5, 7], [13, 15], [16, 19]]
labels = [0, 0, 1, 1] #0:<20, 1:>20 
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features, labels)
print(clf.predict([[10, 11]])) #>20, 1
print(clf.predict([[5, 8]])) #<20, 0

——————————————

我这级别就只能看懂前三集

——————————————

https://youtu.be/cKxRvEZd3Mw

第一集这么简单，我以前怎么没看懂

——————————————

我是不是用错了模块…

——————————————

文化苦旅


你现在在做什么开发？

——————————————

How to use flask session:


connor-johnson.com/2016/01/22/using-sessions-in-flask/
https://www.tutorialspoint.com/flask/flask_sessions.htm

——————————————

我要做程序员，决定了


就算是做兼职也行

——————————————

php20.cn/article/26

别人初中毕业就能找到工作，我大学毕业为什么不能？

——————————————

你看，这个页面的顶部栏在电脑宽屏浏览器是置中的，换到手机小屏浏览器就左对齐了

求解？

http://45.63.90.169/example/test.html

——————————————

先回答我一个问题

——————————————

来总结一下近代软件做了什么：


连接(联系)、分享、音视频(视觉和听觉)

——————————————

我看到的是一张张卷子

——————————————

哪里有乐趣？

——————————————

yingshaoxo.cf

做好了，用的最简单的方法



https://github.com/yingshaoxo/yingshaoxo.github.io/tree/master/destiny_town

——————————————

I always want it more simple.

——————————————

我竟然连用户登录系统都做不好…

——————————————

https://google.github.io/styleguide/pyguide.html?showone=Packages#Naming

——————————————

我放弃，宁愿重新规划文件结构

长路径本身就代表不合理，不好记和书写

——————————————

https://www.quantifiedcode.com/

用这个检查我代码，发现好多错误，但不想改

以后开始新项目就照着提示优化，改掉一些坏习惯

——————————————

如果不行就说明Unix自身带有限制

如果命名不合理，一个项目子目录太多，就算不合理设计

就无法用unix完成项目

很好

——————————————

如何

——————————————

我用pwd得到了当前路径

如果在不安装三方程序的情况下，把这个路径复制下来

…当然啦，不用鼠标

——————————————

恩，你不说我还不知道有快捷键

这是 Ubuntu16 自带的

——————————————

See hidden files by one command:


la

——————————————

没听说过

——————————————

并且最近我发现python的界面库也还是很强大的

虽然我没用kivy编译出安卓程序，但win平台是绰绰有余的

——————————————

不对，Python可以打包成 one .exe program.

——————————————

你如果用unix就不这样想了

然后你发现易语言被困于win

相反，python做的API与后台服务在任何平台都处于中流砥柱的地位。

——————————————

可以，就是麻烦得让你吐血

——————————————

你无法想象这种开发方式多爽

任何查找、复制和粘贴都由手机触屏完成

任何编码都由纯键盘完成

所有的文件都是秒同步

Perfect!

——————————————

Flask模拟github简单假设静态网页



from flask import Flask, send_from_directory
import os


your_host_ip = '45.63.90.169'
your_port = '80'
url = 'http://{}:{}'.format(your_host_ip, your_port)


app = Flask(__name__)

@app.route('/')
def home_page():
    return send_from_directory('.', 'index.html')

@app.route('/<path:path>')
def any_path(path):
    if os.path.exists(path):
        return send_from_directory('.', path)
    else:
        return '404'

if __name__ == '__main__':
    print(url)
    app.run(host='0.0.0.0', port=your_port)


yingshaoxo.cf/run.py

——————————————

How to visit flask website without port?

Just set the port to 80.
You may need sudo.

——————————————

https://awesome-python.com

——————————————

你们难道没发现谷歌的手机页面多么合理和漂亮？

偷出来放在博客上肯定帅呆了

——————————————

唯一的问题是中文下载会失败

——————————————

Python FTP:


http://45.63.90.169:5321/+Python%20Codes/ftp.py

——————————————

sudo without password:



sudo visudo


Change
%root    ALL=(ALL:ALL)

Into 
%root    ALL=(ALL:ALL) NOPASSWD:ALL


If you have your own user_name, you can write a new line after it, just like
%yingshaoxo    ALL=(ALL:ALL) NOPASSWD:ALL

And don't forget the spaces in middle is a Tab.

——————————————

Sync ubuntu16 安装指南


wget https://download-cdn.resilio.com/stable/linux-x64/resilio-sync_x64.tar.gz

tar xvf resilio-sync_x64.tar.gz

mv rslsync /opt/rslsync

crontab -e

add this to the last line:
@reboot /opt/rslsync --webui.listen 0.0.0.0:7654

reboot and you'll visit it in http://your_ip:7654

——————————————

那我该放在哪儿不影响备份root目录呢？

——————————————

教程里说的…

上当了！

——————————————

这里有什么问题吗？

——————————————

唯一的问题是，一同步CPU怎么飙到了100%？

——————————————

我准备这样玩：

本地电脑下载git、写代码的过程中决定是否传到github

然后本地的整个root工作目录，都通过sync同步到云服务器

然后云服务器负责执行代码，建网站…



这样既保证代码不遗失，又保证代码实时可运行

然后查资料和谷歌就交给手机，打字方便…浏览不影响编码…

——————————————

云机有快照功能，可以乱玩

本地既然搞不出虚拟机，就只能按规矩来了…

——————————————

装了一下午的KVM，硬是没能运行起来

——————————————

我以为可以吃😁

——————————————

原来树莓派是微型电脑

m.guokr.com/post/744178/

——————————————

用了这么久电脑，总算可以给它定性了

电脑唯一的好处是输入快，可以盲打、用VIM、快捷键之类

如果你不输入什么，电脑对你来说没什么意义

除了玩游戏

——————————————

This show you copying and pasting in VIM


vim.wikia.com/wiki/Copy,_cut_and_paste

——————————————

Type
exit
to quit SSH.

——————————————

用手机控制自家电脑


https://www.linuxdashen.com/ssh-key：两个简单步骤实现ssh无密码登录

www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html

——————————————

Scroll up/down on linux server


shift+ Page Up/Page Down

——————————————

Cool stuff

——————————————

You can use
sudo dpkg-reconfigure console-setup
to change the font size. 

The font size appears at the end of the configuration stage.

——————————————

DNS server - 网域名称服务器

LAMP server - 即是所谓 Linux + Apache + MySQL + PHP 组合，以 Apache 作为网页服务器，MySQL 作为数据库管理系统和 PHP 作为网站应用程序语言，可以架设网站或电子商贸系统。

Mail server - 电子邮件服务器，使用 Postfix 作为 MTA 及 Dovecot 作为 POP 和 IMAP 服务器。

OpenSSH server - 远端存取服务器

PostgreSQL server - 数据库服务器，使用 PostgreSQL

Print server - 打印服务器，使用 CUPS

Samba server - 使用 Samba 作为可以整合至 Windows 网络的档案服务器

Tomcat Java server - 使用 Tomcat 的 Java 网页应用程序服务器

Virtual Machine host - 虚拟机器服务器

Manual package selection - 自行手动在数千个套件中选择要安装的。


wiki.linux.org.hk/w/Install_Ubuntu_server

——————————————

这里可以运行虚拟机？

——————————————

下载地址

releases.ubuntu.com/16.04/

——————————————

被各种系统搞得焦头烂额


决定安装 no-gui system ，有推荐的iso吗？

——————————————

https://www.zhihu.com/question/40746923

——————————————

一方面，普通的编程工作我做不了

另一方面，机器学习那边的文章我看不懂




这样的话，我倒觉得高考卷目前对我来说最简单

——————————————

额，自动同步的话，btsync确实不错

——————————————

不过鉴于百度网盘速度越来越慢，国内网盘安全度越来越差

在工作中的人自己建一个云盘还是很有必要的

——————————————

https://c.runoob.com/compile/9

You can't delete any file of it...

——————————————

本来打算用云机分享东西，忽然发现这货还有虚拟机文件传输功能…不过没什么意义，Android虚拟机老是被检测出虚拟机，软件强制退出。而且安卓屏幕大小不能调，还老是横屏…


https://www.linuxdashen.com/linux系统安装并使用bittorrent-sync教程

——————————————

Sync简直是神器

从此再不担心没书看

——————————————

配置好后，可以用

但要手动注册，装逼失败

——————————————

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-nextcloud-on-ubuntu-16-04

——————————————

You can do this by asking a specific server what your IP address is:


sudo apt-get install curl
curl http://icanhazip.com

——————————————

How to connect your VPS through SSH in terminal

import os

ip_address = '45.76.29.42'
user_name = 'root'
port = '77'
commands = ['ssh ' + user_name + '@' + ip_address + '  -p' + port]
os.system(' && '.join(commands))

——————————————

How to Change the SSH Port for Your Linux Server


Connect to your server via SSH
Switch to the root user

Run the following command:
vi /etc/ssh/sshd_config

Locate the following line:
# Port 22
Remove # and change 22 to your desired port number.

Restart the sshd service by running the following command:
service sshd restart

——————————————

http://talent.baidu.com/external/baidu/activityPage/tg/tghr.min.html

http://talent.baidu.com/external/baidu/index.html#/jobDetail/2/510656426

不知道社招有没有限制学历

——————————————

http://home.gidot.net

How about this page?

——————————————

sudo shutdown -P 2:00

——————————————

import re


def handle_break(obj):
    text = obj.group(0)
    if re.match(r'^\s+$', text)==None:
        return re.sub(r'\n*', '', text)
    else:
        return text
    
def fix_break(text):
    text = re.sub(r'[^.!?~;:"]\s+', handle_break, text)
    return text


def list_to_text(_list, num_of_line):
    text = ''
    for num, i in enumerate(_list, start=1):
        if num % num_of_line != 0:
            text += i + '\n'
        else:
            text += i + '\n\n'
    return text

def OT(text):
    while (text[0:1] == '\n' or text[0:1] == ' ' or text[0:1] == '　'):#left
        text = text[1:]
    while (text[-1:] == '\n' or text[-1:] == ' ' or text[-1:] == '　'):#right
        text = text[:-1]
    return text

def handle(obj):
    text = obj.group(0)
    text = OT(text)
    return text + '\n'*2

def handle_no_space(obj):
    text = obj.group(0)
    return re.sub(r'\n*', '', text)

def split_sentence(text):
    text = fix_break(text)
    text = re.sub(r'((.*?)(?<!B|A)([!?.] ) ?)', handle, text)
    text = re.sub(r'"(\\.|[^"])*"', handle_no_space, text)
    
    a_list = text.split('\n')
    a_list = [OT(i) for i in a_list if re.match(r'^\s*$', i) == None]
 
    text = list_to_text(a_list, 1)
    return text.strip('  　\n ')

def main(text):
    text = re.sub(r'[(（]\s*\w*\d*\s*[)）]', '', text)
    return split_sentence(text)



text = '''
Good News Beats Bad on Social Networks.


Bad news sells. If it bleeds, it leads. No news is good news, and good news is no news.
Those are the classic rules for the evening broadcasts and the morning papers.

But now that infor
mation is being spr
ead and monitored in different ways, resear
chers are discovering new rules.

By tracking people's e-mails and online posts, scientists have found that good news can spread faster and farther than disasters and sob stories.

"The 'if it bleeds' rule works for mass med
ia," says Jonah Berger, a scholar at the University of Pennsylvania.

"They want your eye
ba
lls and don't care how you're feeling. But when you share a story with your friends, you care a lot more how they react. You don't want them to think of you as a Debbie Downer."

Re
searchers analyzing word-of-mouth communication — e-mails, Web posts and reviews, face-to-face conversations — found that it tended to be more positive than negative, but that didn't necessarily mean people preferred positive news.

Was p
ositive news shared more often simply beca
use people experienced more good things than bad things?

To test for that possibility, Dr.Berger loo
ked at how people spread a particular set of news stories: thousands of articles on The New York Times' website.

He and a Penn colleague analyzed the "most e-mailed" list for six months.

One of his first findings was that articles in the sci
ence section were much more like
ly to make the list than non-science articles.

He found that sc
ience amazed Times' readers and made them want to share this positive feeling with others.

Readers also tended to share articles that were exciting or funny, or that inspired negative feelings like anger or anxiety, but not articles that left them merely sad.

They needed to be aroused one way or the other, and they pref
erred good news to bad.

Th
e mo
re pos
itive 
an article, the more likely it was to be shared, as Dr.Berger explains in his new book, "Contagious: Why Things Catch On."

'''
print(main(text))
#English virsion

——————————————

import re


def handle_break(obj):
    text = obj.group(0)
    if re.match(r'^\s+$', text)==None:
        return re.sub(r'\s*', '', text)
    else:
        return text
    
def fix_break(text):
    text = re.sub(r'[^。！？…；：”"》】]\s+', handle_break, text)
    return text


def list_to_text(_list, num_of_line):
    text = ''
    for num, i in enumerate(_list, start=1):
        if num % num_of_line != 0:
            text += i + '\n'
        else:
            text += i + '\n\n'
    return text

def handle(obj):
    text = obj.group(0)
    text = text.strip('   \n ')
    return text + '\n'*2

def handle_no_space(obj):
    text = obj.group(0)
    return re.sub(r'\s*', '', text)

def split_sentence(text):
    text = fix_break(text)
    text = re.sub(r'((.*?)(?<!B|A)([！？。]))', handle, text)
    
    text = re.sub(r'“(\\.|[^“”])*”', handle_no_space, text)
    text = re.sub(r'：(\\.|[^：“])*“', handle_no_space, text)
    
    a_list = text.split('\n')
    a_list = [i.strip('   \n ') for i in a_list if re.match(r'^\s*$', i) == None]
 
    text = list_to_text(a_list, 1)
    return text.strip('   \n ')

def main(text):
    return split_sentence(text)



text = '''
坊市制主要表现为将住宅区（坊）和交易区（市）严格分开，并用法律和制度对交易的时间和地点进行严加控制。坊市制度将商业区和居住区分开，居住区内禁止经商。唐代后期，开始打破市坊制，也不再限制商品交易的时间。

在繁华城市不论白天
还是夜晚，集市贸易都
相当发达。唐代中期，随着农业、手工业的不
断发展，商业出现了新的繁荣局面，单靠白天的市场交换商品显然已不
能适应，于是夜市正式出现。

当时文人的诗作里出现过“夜市千灯照碧云，高楼红袖客纷纷。

水门向晚茶商闹，桥市通宵酒客行。

”
'''
print(split_sentence(text))

——————————————

现在你不应担心pdf或ocr后的中文文本不好看了，一键中文修复错误断行+分句，无阻塞。

——————————————

在西化的过程中，我的时差也倒过来了，我的程序员朋友们。😄

——————————————

不过我很欣赏这种按时收费的模式😁

——————————————

我觉得是官方想卖防护

还是windows轻松，没ddos风险

——————————————

重装系统也不顶用…

——————————————

@XiaoyaBot 
#codes

group = ['A', 'B', 'C']
student = ['jia', 'yi']

same = 0
diff = 0

for student[0] in group:
    for student[1] in group:
        if student[0] == student[1]:
            same += 1
        else:
            diff +=1

print(same/(same+diff))

——————————————

Matplotlib is a good tool to show math.

——————————————

import matplotlib.pyplot as plt


plt.plot([1,2,3,4])
plt.pause(0.01)
plt.plot([1,2,2,3])

plt.ylabel('some numbers')
plt.show()

——————————————

好的

——————————————

才把服务器打开，刚才又被停了，dos没完没了啊

——————————————

我密码设得很简单，会不会有人进入我服务器搞的鬼？

——————————————

昨天晚上服务器向外发送了11G的流量

导致管理员直接把服务器关停

——————————————

def func(a, b):
    return (a+b)

list_args = [[i, i-1] for i in list(range(1, 101))]
list_result = [func(a,b) for a,b in list_args if (a+b)%3 == 0]
print(list_result)

#This program shows why map() and filter() no longer need.

——————————————

椭圆、双曲线、抛物线、对数、指数、复数、三角函数、回归方程、不等式、向量、面积、体积、棱锥、棱柱、几何体、多面形、奇偶性、方差

这些都可以用编程手法实现啊！

——————————————

But the author ended it in 2010.

——————————————

3-D Graphics and Animation


Watch the long end-credits for almost any contemporary movie, and you’ll see mass quantities of people doing special effects and animation.

Most of the big studios—Walt Disney Animation, ILM, Weta, Dreamworks, Pixar—hire people with Python experience.

Do a web search for “python animation jobs” or visit vfxjobs and search for “python” to see what’s available now.

If you’d like to experiment with Python and 3-D, animation, multimedia, and games, try Panda3D.

——————————————

#I spent 5 hours write this, fuck math

from tkinter import *


class draw():
    def __init__(self, canvas_width, canvas_height):
        self.x = canvas_width//2
        self.y = canvas_height//2

        self.main = Tk()
        self.main.title("Drawing")

        self.papaer = Canvas(self.main, width=canvas_width, height=canvas_height)
        self.papaer.pack(expand=YES, fill=BOTH)

    def point(self, x, y):
        x1, y1 = (x - 0.5), (y - 0.5)
        x2, y2 = (x + 0.5), (y + 0.5)
        self.papaer.create_oval(x1, y1, x2, y2, fill="#000000")
        
        #self.x, self.y = x, 

    def finish(self):
        mainloop()



length = 500
drawer = draw(length, length)

def cube(x_center, y_center, side_length):
    x_from = x_center - side_length//2
    y_from = y_center - side_length//2
    for x in range(x_from, x_from+side_length+1):
        for y in range(y_from, y_from+side_length+1):
            drawer.point(x, y)

def circular(x_center, y_center, radius):
    side_length = radius * 2 
    x_from = x_center - side_length//2
    y_from = y_center - side_length//2
    for x in range(x_from, x_from+side_length+1):
        for y in range(y_from, y_from+side_length+1):
            if int((x-x_center)**2) + int((y-y_center)**2) <= radius**2:
                drawer.point(x, y)


circular(drawer.x, drawer.y, 100)


drawer.finish()

#You can found official example has many BUG, can't run at all. https://docs.python.org/3.5/library/tkinter.html#a-simple-hello-world-program

——————————————

Look at the ground of BUG, I can't say a word.
望着满地的BUG, 我无处话凄凉。

——————————————

I want to see more.

——————————————

If I told you, I'm no longer proud of knowing how to programming.

What would you say?

I just tired with anything I saw on Internet.

Those things just combination of particular parts. They never change indeed.

——————————————

Show me the codes

——————————————

#AutoToGit.py
import os


commands = ['cd ', 'cd Downloads/My-little-program/', 'git add .', 'git commit -m "update"', 'git push origin master']

os.system(' && '.join(commands))

——————————————

@XiaoyaBot 
#baike
易语言

——————————————

from bs4 import BeautifulSoup
import requests
import json
import re


def BaiduBaike(key_word):
    url = 'http://baike.baidu.com/client/search?app=1&uid=863798020288531&cuid=491A1DBA0DDCE44231934FD168AE36A2|135882020897368&ver=2.2.2&word='
    r = requests.get(url+key_word)
    result = r.text

    true_id = json.loads(result)['lemmaId']

    r = requests.get('http://baike.baidu.com/client/view/'+str(true_id)+'.htm')
    r.encoding = 'url'
    result = r.text

    soup = BeautifulSoup(result, 'html.parser')
    result = soup.find('div', attrs={'class':'summary'}).get_text()

    return result

key_word = '百度'
print(BaiduBaike(key_word))

——————————————

VIM core write commands


To insert before the curser: i
To insert after the curser: a

To insert before the line: I
To append at the end of line: A

——————————————

https://www.linuxbabe.com/linux-server/setup-your-own-shadowsocks-server-on-debian-ubuntu-centos

——————————————

Servers install package so quick.

——————————————

Unbelievable! I connected! 

But...why ls don't work...😄

——————————————

😡

——————————————

…🤔

——————————————

www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html

——————————————

I'm thinking about SSH

——————————————

Which one you would like most?

——————————————

Why from the start I got to pay?

I'd rather look at those vps server first.

——————————————

Can you recommend me a Unix VPS?

Cheap is good.

——————————————

Just for KuQ communicate with Python.

——————————————

No problem, IP no use.

——————————————

@XiaoyaBot 
#codes
import os

os.system('ipconfig')

——————————————

@XiaoyaBot 
#codes
import os

os.system('ipconfig')

——————————————

@XiaoyaBot 
#codes
import os

os.system('ls')

——————————————

@XiaoyaBot 

#codes

import('os').system('ls')

——————————————

@XiaoyaBot

——————————————

@XiaoyaBot 

#codes

1+1

——————————————

https://program-think.blogspot.com/2012/02/why-choose-python-4-fp.html?m=1



map() and filter()

——————————————

https://github.com/programthink/opensource/blob/master/libs/python.wiki#12___-2

——————————————

http://pan.baidu.com/wap/link?uk=3393938800&shareid=458384204&third=0

?

——————————————

You?

——————————————

Why Class?


1. Using Class, you can write fewer codes to do more things.

2. It's easy to understand, and more convenient to update.

3.Multi-instances = Multi-tasks

——————————————

python3

——————————————

But now I change it to private, you can chat with xiaoya to find out.

——————————————

hhh

——————————————

Now, once I speak, xiaoya'll send a piece of knowledge.

——————————————

Multiple system finished with Class Programming.

——————————————

http://www.jianshu.com/p/9633bc76a7b3

——————————————

Now, I almost a Object-oriented programmer.

——————————————

Oh, I got it.

os.path.join()

——————————————

Shit，Windows and Unix dir has some different.

win use \ to split name
unix use / to split name


How I could do to make a program work just fine on both system?

——————————————

Does

——————————————

Dose make sense.

——————————————

Next time I get this no_tip error, I should look at the previous line of the error codes.

——————————————

…

——————————————

No problem, sir 

Path is right, I don't want to change that.

——————————————

Still that error

——————————————

Still wrong anyway...


How strange this question is!

——————————————

Still can't work

——————————————

wait a minute

——————————————

I don't understand

The bad thing is I can't Google this error...

——————————————

Why I get invalid syntax about class?                                                                                                                                                                        It shouldn't be.

——————————————

import os
import re
import json


global path
path = os.path.dirname(__file__) + '\\'


class in_or_out():
    def __init__(self):
        self.dir = path + 'Sources\\'
        self.setting_file_name = 'setting.json'
        self.setting_file_path = self.dir + self.setting_file_name
        
    def get_setting(self):
        with open(self.setting_file_path, 'r') as f:
            text = f.read()
        return json.loads(text)

    def write_setting(self, a_dict):
        with open(self.setting_file_path, 'w') as f:
            f.write(str(json.dumps(a_dict, sort_keys=True, indent=4))


class update(in_or_out):
    def __init__(self):
        super().__init__(self)
        if os.path.exists(self.dir) == False:
            os.mkdir(self.dir)
        if os.path.exists(self.setting_file_path) == False:
            self.write_setting({'NO':0})

    def update_setting(self):
        setting = self.get_setting()
        old_books = setting.get('books')

        txt_files = [i for i in os.listdir(self.dir) if '.txt' in i]
        #print(txt_files)
        if old_books == None:
            new_txt = txt_files
            old_books = {'NO': 0}
        else:
            new_txt = [i for i in txt_files if i not in old_books]

        for i in new_txt:
            old_books.update({i: 0})
        if 'NO' in old_books:
            del old_books['NO']

        for i in [i for i in old_books.keys() if i not in txt_files]:
            del old_books[i]

        setting.update({'books': old_books})
        self.write_setting(setting)

p = update()
p.update_setting()

——————————————

I need update for my mind.

——————————————

I won't speak Chinese from now on.

——————————————

你是大神…

——————————————

开SS映射端口，下载就会出错

坑爹

——————————————

#How to download                                                                                                                                                                                               import requests


url = 'http://book.yunzhan365.com/xzzp/atym/files/mobile/83.jpg'

r = requests.get(url)
with open("picture.jpg", "wb") as code:
    code.write(r.content)

——————————————

#Call parent methods using super()

class Person():
    def init(self, name):
        self.name = name

class EmailPerson(Person):
    def init(self, name, email):
        super().__init__(name)
        self.email = email

class QQPerson(EmailPerson):
    def init(self, name, email, qq):
        super().__init__(name, email)
        self.qq = qq

bob = EmailPerson('Bob Frapples', 'bob@frapples.com')
print(bob.name)
print(bob.email, '\n'*2)

ys = QQPerson('yingshaoxo', 'yingshaoxo@gmail.com', '1576570260')
print(ys.name)
print(ys.email)
print(ys.qq)

——————————————

class Car():
    def exclaim(self):
        print("I'm a Car!")
        
class Yugo(Car):
    def exclaim(self):
        print("I'm a Yugo! Much like a Car, but more Yugo-ish.")

give_me_a_yugo = Yugo()
give_me_a_yugo.exclaim()




#原来同样的函数名就可以重载

——————————————

# Let’s inherit something. 

class Car():
    def exclaim(self):
        print("I'm a Car!")
        
class Yugo(Car):
    pass

give_me_a_yugo = Yugo()
give_me_a_yugo.exclaim()

——————————————

class Person():
    def init(self, name):
        self.name = name

hunter = Person('Elmer Fudd')
print('The mighty hunter: ', hunter.name)



# It is not necessary to have an init method in every class definition; it’s used to do anything that’s needed to distinguish this object from others created from the same class.

——————————————

What Are Objects?


An object contains both data (variables, called attributes) and code (functions, called methods). It represents a unique instance of some concrete thing. For example, the integer object with the value 7 is an object that facilitates methods such as addition and multiplication, as is demonstrated in Numbers. 8 is a different object. This means there’s an Integer class in Python, to which both 7 and 8 belong. The strings 'cat' and 'duck' are also objects in Python, and have string methods that you’ve seen, such as capitalize() and replace().

When you create new objects no one has ever created before, you must create a class that indicates what they contain.

Think of objects as nouns and their methods as verbs. An object represents an individual thing, and its methods define how it interacts with other things.

Unlike modules, you can have multiple objects at the same time, each one with different values for its attributes. They’re like super data structures, with code thrown in.

——————————————

坚持挑战


生活的每一天每一秒，每个人都在经历不同的事情，有的好，有的坏，有的开心，有的沮丧，但是不管任何，你总要去面对。

痛苦的事，往往面对起来更加让人难以接受，黑暗，痛苦，煎熬，各种负面情绪都在考验着你，而你，如何选择。

有些人抱着一丝侥幸心理，放弃吧，又何必坚持，有什么必要呢？这些人，躲过了不是一次灾难，而是一次挑战命运的机会。而那些迎头直上，撕裂痛苦，改变悲剧的人，最终成就的就是常人常不能达到的成功。

19世纪，曾经的华夏中国经历了长时间的闭关锁国，早已不复当年万国来朝的气势，已经向一个迟暮的老者一样，颤颤巍巍的等待着。而当时的领导者在面对列强时，抱着忍一下，再忍一下的态度，一而再，再而三的退让，本以为能换来和平，而结果是什么，八国联军侵华，曾经的不败帝国再也不能恢复秦始皇的豪迈，成吉思汗的霸气，朱元璋的傲岸，只剩甲午战败，南京大屠杀这些让人心痛的悲剧。

的确，挑战是痛苦的，但是只有经历了痛苦，才能破茧成蝶，化身为龙。

50年前，当他被自己的父母抛弃时，他坚持下去了；30年前，当他的产品被抛弃时，他坚持了下去；20年前，当他被逼离开自己的公司时，他坚持了下去；十年前，当他看到即将倒闭的企业时，他坚持了下去。只看到，比尔盖茨成就微软无上霸业，WINDOS纵横世界无可匹敌，没看到，他的IBM董事会的父母给他带来第一笔生意；只看到，股神巴菲特八岁进入证交所，弹指改变世界经济，没看到，他第一次进入是由他国会议员的父亲带领，由证交所主席接待；只看到，迪斯尼创造米老鼠，欢笑世界长盛不衰，没看到早在其他动漫公司开始时他已经注资，最后收购其中。而他，以一个人的力量，开创属于自己的纪元。他创造了IMAC，让计算机脱离沉重单调的机箱，让计算机变得更加美丽；他创造了IPOD，让播放器拥有更多，让便携走入千家万户；他创造了ITUNES，让音乐脱离盗版，让权益的种子播撒世界；他创造了IPAD，让微软的电子笔见鬼，让繁琐无处可藏；他创造了IPHONE，让全世界为之改变，让苹果名扬天下。他，就是苹果前董事长，神一般的斯蒂文乔布斯。让苹果的华丽战胜微软的繁琐，让苹果的严谨战胜谷歌的随意；让苹果的清晰战胜索尼的昂贵。以一个人的力量打败了全世界。

当困难来临时，不要去害怕，坚持挑战，担心什么，全力一拼，或许成功就在眼前；恐惧什么，放手一搏，或许世界因你改变。

——————————————

你是怎么复习的？

——————————————

不，最后几十天我要学会Python的类处理方法

——————————————

我十有八九是个面向过程的程序员

我不懂对象式程序设计…

——————————————

http://www.jianshu.com/p/9a9b8d9248e5                                                      太折腾, 明年再说

——————————————

ocr.wdku.net

这东西识别率比离线的高多了

我也想做一个

——————————————

那样OCR更准确点

——————————————

若我手机分辨率再高些

就没有我取不到的纯文本

——————————————

我把程序做成类

虽然类可以变成很多实体变量

但每个类里面保存的东西还是一样的

这时类似乎没用…

——————————————

但同时要注意到，任何与去中心分布式扯上关系的产品，都是公益产品，是赚不到钱的。

——————————————

我们一般把自由民主放在一起。

——————————————

未来只有两个技术值得学

一是AI，智慧的power
二是去中心分布式计算，自由的power

把两者完美结合在一起可以超越谷歌与世界上任意一个专制国家。

——————————————

AI将掀起新一次工业革命：

http://c.open.163.com/mob/video.htm?plid=MCDE54QDM&mid=MCDE5HTRK&lan=cn#share-mob&lan=cn#share-mob

——————————————

当我真正进入编程的世界


我才明白，前端只是个壳

后端的功能才是支撑互联网公司存活的主要东西。

——————————————

现在我主要需要解决的问题是

根据访问者ip设置不同的“域”

使小雅聊天的各种文本进度根据ip分离

ip取得不难，关键是进度及分类要保存为json

我不熟…但我还是会试试的，毕竟json的一套文本标识符我是很难用txt实现的🏌🚣

上进的感觉真好

——————————————

代码是屏蔽不完的

我开始是打算用虚拟机的

后来想起来太麻烦，自己在本地编程就挺好了

干嘛要做其它东西出来装逼…还是给别人用…

——————————————

这个想法多亏了

某个我们群里的机器人

有次它的主人装逼在线运行Python

我要源码也不给，就自己做了

是你吗？

——————————————

重新改版，这是我对外发布的一个版本

e.ghboke.com/uncategorized/tools-runpy.html

——————————————

它编译时你可以去做卷子啊

——————————————

#有了这个，再也不用担心有会计朋友叫你写程序了，xlsx表格随便操作

from openpyxl import Workbook
wb = Workbook()

# grab the active worksheet
ws = wb.active

# Data can be assigned directly to cells
ws['A1'] = 'hour'
ws['B1'] = 'minute'
ws['C1'] = 'second'

# Rows can also be appended
ws.append([1, 2, 3])

# Save the file
wb.save("time.xlsx")

——————————————

已经找到原因

生成的exe在dist文件夹，非built文件夹

这下所有Python文件都可以编译出来使用了

——————————————

我的意思是，转出来的exe无法正常运行

——————————————

但这个东西只能在3.5运行

还不能通过 pyinstaller 转为exe文件

——————————————

显示实时时间

——————————————

import time


while 1:
    old_time = time.strftime("%T")
    while 1:
        new_time = time.strftime("%T")
        if new_time != old_time:
            old_time = new_time
            print(old_time)
            break

——————————————

世界上只有两种语言会永存

C++和Python

Java是过渡阶段

——————————————

https://zh.greatfire.org/search/alexa-top-1000-domains

在你提供的网站里竟然发现了这个：txxx.com

再也不愁找不到好网站了，禁得越凶，网站越屌

——————————————

这网站不错，我收藏了😄

看来确实是网太垃圾，我对这个解释很满意🐱

——————————————

移动网

——————————————

奇怪的是，用手机流量访问又可以…

——————————————

用北京、上海等地的ip测试没问题

自己不翻墙就是访问不了

难道是本地网络运营商禁的？

——————————————

翻墙才能访问！！！

Oh my god!!  Only Shit!!

——————————————

我的主机竟然被墙了

——————————————

http://118.193.233.89:5000/Search/

——————————————

How about this, can you understand?

——————————————

为什么乱@

——————————————

我看了你的微机

有两件事要跟你说下

1.如果接口不是你自己能从微信提取出来，不要做了

2.那插件机制真不怎么样，模仿下酷Q接口吧，没准你还能做大

——————————————

为什么要加密

——————————————

编程超过2小时就最好停手

不然充满BUG与闹心与无思路

——————————————

对呀，我怎么没想到！

——————————————

搞了一下午，该去做题了

——————————————

易语言不能把搜寻文件直接做成一个有返回值的子程序吗？

网上全TM是异步例程



我要在C盘找叫“python.exe”的文件

——————————————

Today is supposed to be happy.

Because it's sunday.

——————————————

Come back to that moment, I just a kid.

I don't know what is programming, what I interested is just how to create a program.

And there is no doubt, I don't know English either.

So, the Easy Programming Language is my only option to create my own program for that moment.

——————————————

I don't know, actually.

——————————————

kindle115.com

——————————————

嗯啊

——————————————

现在有了这个框架，你可以做一些文本清洗或者整理了

还自带简单版本控制呢！

——————————————

import re

virsion = str(0)
if virsion == '0':
    virsion = ''
book = '/sdcard/王者文件夹/My-books/Others/Handling/罗织经.txt'
book2 = book.replace('.txt', virsion+'.txt')
with open(book2, 'r', encoding='utf-8') as f:
    text = f.read()


line = '\n\n' + '——————————————' + '\n\n'
#do something in here
list1 = text.split(line)

list1 = [i.replace('\n'*3, '\n') for i in list1]
list1 = [i.replace('【译文】', '') for i in list1]

list1 = [i.strip('  　\n ') for i in list1]
text = ''
for i in list1:
    text += i + line
text = text[:-len(line)*2]
print(text)
#do something in here


if virsion == '':
    virsion = '0'
book2 = book.replace('.txt', str(int(virsion)+1)+'.txt')
with open(book2, 'w', encoding='utf-8') as f:
    f.write(text)

——————————————

我投稿了

——————————————

举个例子，李嘉诚。

察言观色不是在学校里能够学出来的。

超强的口才也不是在学校里能够学出来的。

…如此等等。

——————————————

因为人在十六岁之前思维是无穷的，这个时候是学东西最快的时候。

反倒是在学校死读书的人，没有什么太大的能耐。

——————————————

正因为他小学没有毕业就去学编程，所以说他才能够开一家电脑公司，才能够承接很多的软件业务。

才能买得起跑车，买得了房子。

——————————————

别看不起人家

人家小学都没毕业

——————————————

并且小工具就像小玩具一样，充满了乐趣

这样就不会感到厌倦



就算感到厌倦了，去开发大项目也未尝不可，因为大项目是由小玩具拼凑起来的。

——————————————

不管哪个平台

从给自己用、提升自己工作效率的小工具包入手，无疑是双赢的选择

既解决了眼前问题，又为进步打下基础

——————————————

如果POST是无限制的，那就可以利用它来实现文本传送…

——————————————

今天做的

——————————————

然后host内存低了，deepin在虚拟机老出问题，放弃


目前git，手机每天备份文档，

电脑直接在网页上托，反正对我来说git就是个不会挂的网盘

——————————————

这样的话，开发安卓工具，可以把重心都放在python上，E4A就做个安卓界面壳。

——————————————

E4A的POST问题解决了：


置附加协议头("Content-Type: text; charset=utf-8/nAccept-Encoding:utf-8")


要想不同平台间轻松交互，1.编码不能乱。2.不能接受压缩数据gzip

——————————————

Tonight I forced myself to learn some Android development.

然后我发现它们不过是名字与格式的变化，表示的东西是一样的。

用翻译好的E4A，3分钟可以搞好的东西，AIDE要十几分钟…

——————————————

The main problem is they can't write a program using Chinese.

So in order to remain the ability writing programs, they must speak English in their chat.

——————————————

那些编程爱好者

爱着爱着就成了和我一样的聊天爱好者


要是我每天写3行代码，也不至于像如今这般无奈😞

——————————————

尺有所短，寸有所长


用Python搞一些乱七八糟的界面实在不适合

文本处理还好

——————————————

并且，你们难道没有发现，手机更好翻墙？



你们没觉得手机平台更统一？安卓和苹果？

反倒是PC上一堆麻烦事

——————————————

还不如在手机上写…更好操作…


我已经离不开手机、离不开Windows了

我完了

——————————————

不是我看不懂，而是完全不知道从何下手

——————————————

打开sublime一看，发现我不会写代码了

——————————————

写个代码，要那么极致干嘛，简简单单多好

乱花渐欲迷人眼，东西多了反而是负担

——————————————

我vbox安装完deepin后，发现不能全屏，有点别扭

——————————————

deein没有VMware免费版吧？

——————————————

还好吧，都是玩

——————————————

为什么

——————————————

好吧

——————————————

感觉你的好玩一点

你肯定优化+翻墙了

——————————————

你有 win10 vdi 吗？

谷歌盘发来玩玩😘

——————————————

恩


然后我也不想想太多，小雅的知识分发系统和总构架还不完备，专心补漏、优化。

为接下来的高考强力复习做准备。

——————————————

deepin安装程序从一开始就检测出我是用的虚拟机…

——————————————

或者一个折中的办法

在虚拟机上再开一个deepin

——————————————

唉，受够了


我要把我的工作站放到VPS上，用虚拟机

明天

——————————————

分享李玉刚的单曲《刚好遇见你》: http://music.163.com/song/439915614/?userid=280429778 (来自@网易云音乐)

——————————————

诶，卧槽，才一会儿，就又不行了


我们群里不是有国家的人吧？

——————————————

我怎么能知道别人@机器人呢？

——————————————

也许是这样，我还没来得及翻墙，小雅就运行起来了

——————————————

恩

——————————————

@botfather

——————————————

bot现在不用翻墙了，真好

——————————————

Python自带的挺好


准备拿它装个逼

——————————————

我去，怎么这么多消息

——————————————

易语言用起来真的很爽啊，你们不觉得吗？

——————————————

因为是中文，外国人还用不了

不知道外国有没有类似易语言的东西…

——————————————

话说，易语言、E4A，还有即将出来的火山移动有什么不好呢？

快速开发，跨平台

加上我服务器的Python

也算是全栈了

——————————————

估计是POST函数不干净

等会儿布置好易语言环境，再看看以前的代码

——————————————

不然呢？

——————————————

我好心塞

做了半天界面

结果E4A的POST，Python的Flask毛都收不到…

——————————————

突然发现E4A的程序窗口现在不会重叠了

这意味着可以利用它进行大型APP开发了

——————————————

额…


MX播放器可以做到:

不与系统音量同步+播放时不停用其他播放器

——————————————

安卓有没有无声播放器呢？

就是那种可以边洗澡，边放歌，边用无声播放器放AV的那种APP

这个需求量肯定大，在市场上找了一圈没有，准备自己开发了呢！

——————————————

绿色守护确实让安卓机快了不少

——————————————

我们生活在一个多元的时代，我当初认为前端不会有作为，然而我错了，我判断失误了，前端比其他的更容易去赚到钱。

——————————————

6

——————————————

一直觉得微信公众号申请机制很炒蛋，所以就没做

——————————————

要分类，程序及编程相关放这里

——————————————

你能找到更好的我就承认

——————————————

Mgit 可以充当安卓上的git。

推送、创建仓库什么的都是一键。

——————————————

网易真是良心厂家，视频还可以加速。

这下可以学炒菜了。


http://study.163.com/course/introduction/1003225036.htm?courseId=1003225036&shareLessonId=1003658837&utm_medium=androidShare&utm_campaign=share&utm_source=qq&utm_content=courseLearn&lan=cn

——————————————

开源是为了促使自己进步。


因为你分享了你自己的劳动成果，如果你不进步，将会被别人超越、取代。

——————————————

http://www.kymjs.com/code/2015/04/01/01/

——————————————

突然发现我可以修改、编译github上所有的Java程序😄

——————————————

突然想到我似乎遗失了这个软件的源码，那还是备份一个吧。

——————————————

接下来又回到一个老问题，data and analyze.

数据还会增加，关键就看如何处理这些数据了

提取出更精华的数据？让数据更好的显示？或者用数据训练人工智能？

这些都是未来人们会继续做下去的。

——————————————

好吧，APP寒冬已经到来


任何你需要的，都能找到一个现成的，精美的APP

You don't need to create you own any more.

——————————————

AIDE好

不大又能直接编译

——————————————

然后英语每天就跟读一段TED

数学，每天就做一点高考题

——————————————

但现在看来，去他妈的

核心思想永不过时


还是好好学屌数学、英语

其他的就让时代的洪流冲击吧！

——————————————

看见别人都在用手机软件

才又想做安卓来着

——————————————

然后别人都推荐学Python

就和着谷歌，学完了Python基本命令


发现还是毛都做不出一个

——————————————

然后听别人说易语言不正规，拿着C++书学了一个月，发现看完半本书后毛都做不出来一个

放弃了

——————————————

然后就开始百度易语言，

做了两年的易语言网页游戏辅助

——————————————

过了一年，看见别人的辅助更新后没有按键精灵的框子

觉得很神奇


结果一打听，是易语言

——————————————

我在用别人用按键精灵写的飞车辅助

然后就喜欢上了按键精灵，发现自己也可以做辅助

——————————————

从按键精灵辅助开始的

——————————————

竟然没有把安卓开发环境用VirtualBox打包的

突然觉得易语言是多么好

——————————————

我去，电脑上也能检测出来

——————————————

奇怪，改了机型，软件还是检测得出我的平台是x86

——————————————

突然发现 RE浏览器才是王道

ES已经成渣了

——————————————

草，好多软件检测到机型x86都闪退，不让用

垃圾权限又改不了机型

——————————————

如果屏幕老是旋转

下载安卓Orientation Control

强制竖屏即可

——————————————

可以用安卓虚拟机了

下了R4版本，直接进系统，不安装

https://drive.google.com/file/d/0B_HAFnYs6Ur-M2loOGJpeEhCRXc/view

😊

——————————————

#如果3个正整数可作为一个直角三角形三条边的边长，则称这3个数为一组勾股数，从1,2,3,4,5中任取3个不同的数，则这3个数构成一组勾股数的概率为(　　)
#没道理啊，书上算法得到的概率比实际程序模拟出的概率高了一位数！怎么回事？
from random import choice


def test(list_3):
    a = list_3[0]
    b = list_3[1]
    c = list_3[2]
    #print(list_3)
    if (a**2 + b**2) == (c**2):
        return True
    else:
        return False

a = [1, 2, 3, 4, 5]

accuracy = 10000
num = 0
for i in range(0, accuracy):
    b1 = b2 = b3 = 0
    while(b1 == b2 or b1 == b3 or b2 == b3):
        b1 = choice(a)
        b2 = choice(a)
        b3 = choice(a)
    if test([b1, b2, b3]):
        num += 1
possibility = num/accuracy

print(possibility)
print(num)
print(accuracy)

——————————————

不同符号所代表的数集


Q, 有理数
R, 实数
N, 自然数
N*, 正整数

自然数：零和大于零的整数，即0，1，2，3，4，5，…。
正整数：大于零的整数，即0，1，2，3，4，5，…。

——————————————

m.lao8.org/a1643

这个写得好

——————————————

https://gist.github.com/facert/097af928b50ef9946513c7a5b42ec5c2 


谁来把它改成Python 3?

——————————————

About TED


TED is a nonpartisan nonprofit devoted to spreading ideas, usually in the form of short, powerful talks. TED began in 1984 as a conference where Technology, Entertainment and Design converged, and today covers almost all topics — from science to business to global issues — in more than 110 languages. Meanwhile, independently run TEDx events help share ideas in communities around the world.

——————————————

翻墙路由器也是有很大的折腾成本的…

——————————————

难道首次启动就没什么连接超时自动跳过的道理吗？

——————————————

看来我的破电脑只配启动4.4版本

然后没有外国网，我连系统都进不了…

正在连接…永远连接…

——————————————

竟然启动不了

——————————————

https://www.osboxes.org/android-x86/

——————————————

http://kg.qq.com/share.html?s=uRjYs7uRxfC09uQ9

——————————————

腾讯这招太屌了

让用户自己去选择好听的文字与音调的组合



最后达到个目的，用户乱哼哼就能生成天籁般的音乐！

——————————————

现在缺个不需要配置的安卓，谁有？

——————————————

OK, now                                                                            https://drive.google.com/open?id=0B8M6pE4UPOI5cC1aS0xxazJHb2c

——————————————

用QT版SS失败了几次(意外连接中断，SS崩溃并卡死deepin)

这次改Hosts再试

——————————————

正把ios变成ova

然后传到谷歌盘

——————————————

要在 VirtualBox 恢复win的.GHO备份

必须得有.iso的PE系统

先用它来进行磁盘分区，分两个，一个装系统，一个放.GHO文件。

(进入PE系统和放.GHO文件都是通过Settings→Storage→'光驱选择'实现的。⇝⇜(比如说放文件到虚拟机磁盘的方法是： 用Deepin创建.iso后缀的压缩文件，把如.GHO的文件拖进这个压缩包。然后Devices→Optical Drives→Choose image→选择刚才做的.iso压缩包，你就可以在虚拟机'我的电脑'的光驱盘符处看见它了，然后把它复制到放文件的磁盘分区。 ))

既然.GHO文件和Win环境准备好了，那么运行相应的还原应用即可。

——————————————

http://nguyenvanphong.info/link-google-drive-fshare-tai-iso-windows-7-8-1-10-office-2003-2007-2010-2013-2016.html#windows7

——————————————

我发现正版有30天试用时间，你们可以试试：

——————————————

我一进去，群组娘就给我发信息了

她怎么知道我进去了

——————————————

还说不小众😄

——————————————

地址

——————————————

原来美版win7干净得像坨屎

——————————————

我正安装正版win7

不知道等会儿会发生什么

越来越喜欢虚拟机了

——————————————

准确的说是网站名称

——————————————

什么东西都要自己先知道关键字

——————————————

百度真是垃圾

——————————————

我去，又到了一个境地


没有Win7包

什么软件都用不了，也下不了镜像…

——————————————

我去，xp里的百度网盘竟然说我网络异常，简直不是非垃圾

——————————————

In the “Display -> Video” section, increase video ram to 32mb or above.

Enable 3d acceleration to improve the user experience.

https://help.ubuntu.com/community/VirtualBox/SharedFolders



从未如此流畅，爽


现在只差N多镜像了

——————————————

jingyan.baidu.com/album/5d368d1e1a88b73f60c05721.html?stepindex=1&st=2&os=0&bd_page_type=1&net_type=1&ssid=&from=


成功装上XP，哈哈

——————————————

小系统，翻墙麻烦，查问题麻烦

——————————————

好了，我已经决定放弃Windows作为 Host 系统了


太他妈炒蛋了，给U盘装上最新 deepin ，向Windows永别吧！😄

——————————————

你是对的

把CE的iso复制到Fat32的U盘，直接就能启动CE


XP没试过

——————————————

懂了

——————————————

你的意思是用dd把iso里的文件整个移到某分区，然后修复引导？

——————————————

就算进了体验系统也不知道怎么办

——————————————

突然明白了


你说那个LiveCD就是装机时的图形界面




那个没用，不知道怎么在deepin安装Windows的iso

——————————————

似乎deepin系统下


我连个 PE U盘都做不出

——————————————

但是deepin上不是破解版，要钱

——————————————

这样一掐导致没有百度客户端直接不敢用百度云，上了一个G根本下不了，那真成了垃圾😂

——————————————

只有谷歌drive


网页下几个G都不会断网


国内任何一个网站都做不到





所以用它保存镜像最保险、实用

——————————————

https://www.tensorflow.org/tutorials/mnist/beginners/



不懂高等数学的我，真能学这个吗？

——————————————

如果腾讯成功了


这将是唯一能对抗网易云音乐的

——————————————

http://kg.qq.com/share.html?s=Mds8j1MdSaxYaMVM

——————————————

原来腾讯出全民K歌就是为了做音频方面的AI

——————————————

我有400元


在哪个平台学Java比较好呢？

——————————————

还来得及吗？

4个月后参加高考

——————————————

用了镜像也编译不了安卓kivy

——————————————

http://kingname.info/2014/12/14/Python%E5%AD%97%E7%AC%A6%E7%BC%96%E7%A0%81%E7%9A%84%E4%B8%80%E4%B8%AA%E7%9B%B8%E5%AF%B9%E4%B8%87%E8%83%BD%E7%9A%84%E5%A4%84%E7%90%86%E6%96%B9%E6%B3%95/


似乎编码问题解决了

——————————————

https://github.com/kingname/RemoteControl/tree/master/wcc


似乎有了这个东西就可以远程用Python和网页控制Windows了

——————————————

但我要装win7系统去搞

谷歌网盘…


Win配置起来快一点

——————————————

不用了，突然发现官网提供了一个Kivy Buildozer VM

——————————————

今天老老实实地跟着官网搞

谷歌翻了几百个网页



我去，环境还是没搭好




他们难道就不会用镜像，下到U盘直接装系统多好

——————————————

Ubuntu

——————————————

得到个安装包就这么难吗？

国家的墙也在和我作对

——————————————

唉，一整天都在捣鼓kivy安卓编译环境

——————————————

草，链接失效                              http://dl.google.com/android/ndk/android-ndk-r9-linux-x86.tar.bz2

——————————————

假设某包以前的版本与现在需要的起了冲突，那么可以用下面的命令将其重安装，同时指定需要的版本：

sudo apt-get install --reinstall libpng12-0=1.2.51-0ubuntu3

——————————————

https://muxuezi.github.io/categories/kivy.html

——————————————

接下来如果给它做AI磨皮，可能感觉更爽

——————————————

http://www.jianshu.com/p/01643041621a                                              http://ghost-py.readthedocs.io/en/latest/                                           I hope I could find a way get out of this situation

——————————————

But I still can't get picture at all.

It's so bad I think.

What a terrible design, I must scroll down to loading those pictures...

——————————————

from ghost import Ghost

client = Ghost()

ghost = client.start()

page,res = ghost.open('https://www.baidu.com')

assert page.http_status==200

ghost.print_to_pdf('hi.pdf')

——————————————

用这个还是不能得到图片，微信太可恶了

http://weasyprint.readthedocs.io/en/stable/install.html

——————————————

But I can't get the picture on the website, I need a complete HTML.                                                                                            http://mp.weixin.qq.com/s?__biz=MzA3ODQ1ODM0MA==&mid=2656561038&idx=2&sn=351e3390962bd08bec7c6a58bca8d4c4&scene=19#wechat_redirect

——————————————

We can use it do some robbing                                                  http://www.jianshu.com/p/91fa0420f621

——————————————

我好焦躁

——————————————

http://www.peiyinge.com/soundRead/


再不学AI就晚了

——————————————

http://codepen.io/

你学前端应该不算晚

——————————————

不要这样说，我目前最大的成就就是看完了一本 Python 书

然而别人一年看几本…

我根本就是渣😴

——————————————

累了，18岁大脑停止发育，就这样吧

内存不能再大了

唉😞

——————————————

如果我能独立做出 telegram 这种级别的项目，我还是有信心成为职业程序员的…

😞

——————————————

我18岁才学Python

肯定是晚了

——————————————

所以10年成专家是可能的

——————————————

但他们是从5、6岁开始学

——————————————

天才多半在12岁就学完了行业内前人的知识

——————————————

你到现在也没出一个项目、作品

也不会有公司要的…

——————————————

理论和实际不同，你有想过你考不上大学？

——————————————

不一样，我18了

——————————————

但不清楚原理

——————————————

我有想过写p2p的软件

——————————————

博客上写的

——————————————

SS的模式再来一遍，只不过这次加密、翻墙的重心转到了聊天

——————————————

这样说来，我得用Python做出真正的终端服务器，用API支撑各个平台聊天，恩，这个构想不错

可这不就是走Telegram的老路吗？…不对，telegram服务器不开源

——————————————

被我带进telegram的世界不能自拔

——————————————

我记得你才12岁

——————————————

易语言快过时了

还是Python好…

聊天系统做得差不多了：

http://118.193.233.89:5277/

——————————————

群主娘好多语言群都挂了，就咱们易语言群屹立不倒😄

——————————————

Creating an object and Accessing it's properties


var book;

book = {
    title : "The Hobbit",
    author : "J. R. R. Tolkien",
    published : 1937
};

console.log(book.title);

——————————————

明天老同学结完婚，我就得好好学习了，还得考学校


这几天一折腾，感觉编程的水越来越深了😁

——————————————

例程中确实有个chat_room

和socket的例程很接近，，，，我改错了 

改到了Chat_room，结果是用的长轮询😂

笑哭😭

——————————————

此外， JSbin对于前端调配来讲，真是神器

——————————————

慢慢理解了一些东西，我想我可以通过改html，css，JS, Python 让它变得更好

——————————————

我再次跟新了系统


http://118.193.233.89:5277/

——————————————

2.2.4. Using a variable in its own assignment


var score;
score = 100 + 50;
console.log('Your score is ' + score);

——————————————

2.2.3. One-step declaration and assignment


You’ve seen how to declare variables and then assign them values in two steps. It’s also possible to declare a variable and assign it a value in a single statement:

var score = 100;

——————————————

https://flask-socketio.readthedocs.io/en/latest/

www.jianshu.com/p/be4b23ea0ba5




果然除了上面的 Python socket 接口要掌握外，还要学对应于Js的socket相关知识

果然有价值的开发很操蛋…

——————————————

把这个变成真实可用的东西，是我一直以来的愿望


http://www.htmleaf.com/Demo/201503111501.html

——————————————

这是源码

https://github.com/yingshaoxo/My-little-program/tree/master/%40Chatting_With_Math/Python

——————————————

如果能进一步理解并移植到漂亮的 Web-UI 上就很好

——————————————

即时聊天系统的简易版出来了：


http://118.193.233.89:5277/

——————————————

我注意这个小伙很久了，不仅长得帅，还说一口流利的英语，跟着他学Python准没错😂


https://www.youtube.com/watch?v=eMtHmKO8GsA

——————————————

两倍速看别人写程序的感觉真好

https://www.youtube.com/watch?v=tHbCkikFfDE

——————————————

在线加速看视频


Chrome插件：HTML5 Video Speed Control

——————————————

http://localhost:8888/

——————————————

It's the only one I can run correctly...   https://github.com/tornadoweb/tornado/tree/stable/demos/chat

——————————————

https://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent

也许这就是答案， websockets

明天再试试，老是觉得Flask比其他乱七八糟的模块靠谱些😉

——————————————

python.jobbole.com/81396/


我就纳闷了，难道 Flask 就不能做即时聊天系统吗？

——————————————

https://docs.djangoproject.com/en/1.9/intro/tutorial01/


学了一小节，心力憔悴😭

——————————————

感觉一个源码都运行不了

那些依赖包太可恶了




个人觉得，优秀系统用靠谱的一两个模块就够了，达到5个或以上就是失败作品

——————————————

tensorfly.cn/tfdoc/get_started/introduction.html

翻译得很快

——————————————

又一次发现Python很屌，简直像未来科技

blog.topspeedsnail.com

——————————————

Chrome 在 Ubuntu 系统上卡死的解决方法


下载 StopFlash 插件并启用。

——————————————

https://github.com/jacobian/channels-example 


我在想什么呢，Python也能做聊天系统

——————————————

可能是想做即时聊天系统

——————————————

2.2.2. Assigning values to variables


var score;
score = 100;
console.log(score);
console.log('Hi, asshole.');

——————————————

2.2.1. Declaring variables


var score;

——————————————

2.2. Declaring variables and assigning values


Letting the computer know about information you’d like to store requires two steps:

1.  You need to set a name you can use to refer to your data in the program, like score or playerName or taxRate.

2.  You need to link the name with the value you want to store: something like set score equal to 100 or make ‘George’ the playerName or let the tax rate be 12%.

——————————————

http://mobile.rr.tv/pages/videoShare?id=90756&share=11458302

——————————————

Chapter 2. Variables: storing data in your program


Get Programming with JavaScript has been written as a gentle introduction to programming. This chapter, then, is a gentle introduction to a gentle introduction. As far as adventures go, you hardly leave the house. You can think of it as the packing stage for your journey, vitally important—you don’t want to get to the airport without your passport or to the Oscars without your selfiestick—but not the main event.

Almost without exception, programs store, manipulate, and display data. Whether you’re writing a system for blogging, analyzing engine performance, predicting the weather, or sending a probe to land on a comet in 10 years’ time, you need to consider the data you’ll use and what kinds of values that data might take. To work with data in your programs, you use variables.

——————————————

2.1. What is a variable?


A variable is a named value in your program. Whenever you use the name in the program, it’s replaced with the value. You could create a variable called score and give it the value 100. Then, if you tell the computer to “display the score,” it will display 100. Now, variables can change, hence the name, so later in the program, maybe in response to some action a player takes, you can update the score. If you add 50 to score and tell the computer to “display the score,” it will now display 150.

So how can you use JavaScript to make this magic happen?

——————————————

1.8. Summary


Programs are sets of instructions for computers to follow.

High-level languages let us write instructions that are easier to read and understand.

JavaScript is one of the most widely used programming languages in the world. Associated most strongly with adding interactivity to web pages, it’s also used in server-side programming, as a scripting language for applications, and as a way of programmming robots and other devices.

Learning follows from thinking. So, get involved in the practical examples in the book and be curious, committed, and resilient.

JS Bin, an online code sandbox, will help you to focus on the JavaScript and give quick feedback as you experiment and practice.

Our main running example is The Crypt. It gives you a context for learning programming concepts and for building a relatively complicated program from simple elements.

Further examples will help you to gain depth through breadth and to appreciate how the concepts you learn are applied in a wider variety of situations.

——————————————

1.5.1. Playing The Crypt


The game will display a description of a player’s current location along with any items that are found there and any exits.

Players can type in commands to move from place to place, pick up items they discover, and use the items to overcome challenges.

You need to write code for all of the different elements within the game. But don’t worry—you take it step by step, and I’ll introduce what you need to know as you progress. You can play the game on JS Bin at http://output.jsbin.com/yapiyic.

——————————————

1.5. The Crypt—our running example


Throughout the book, you’re developing a text-based adventure game called The Crypt. Players will be able to explore locations on a map, moving from place to place, picking up items to help them solve challenges and get past obstacles. The last section of each chapter will use what you covered in the chapter to develop the game further. You’re able to see how the programming concepts help you build the pieces that are then combined to produce a large program.

——————————————

1.4.8. Get an account


It’s worth signing up for a free account on JS Bin. Your work will be saved and you’ll be able to set a lot more preferences. As you start to write your own programs, it’s a great place to try out your ideas and get immediate previews and feedback.

——————————————

1.4.7. Line numbers


The error message in told you the line number where the error occurred. You had only one line of code, so the error was on line 1. Programs can get quite long, so it’s helpful to have line numbers you can see. You don’t add line numbers by hand; your text editor, in this case JS Bin, does that automatically. They’re not part of the program; they help you while writing and testing the code. Don’t worry about understanding the code for now, but see if you can spot the errors reported by JS Bin in the figure. Without the line numbers it would be much harder, especially if the program were longer.

To toggle the display of line numbers on JS Bin, double-click the word JavaScript at the top left of the JavaScript panel. A menu will open and close as you double-click, but the line numbers should switch from hidden to visible (or vice versa) as well. You can also switch on line numbers in your JS Bin profile, if you’ve registered.

——————————————

1.4.6. Error messages


As you add code to the JavaScript panel, JS Bin is continuously checking for errors. You’ll see a red error section appear at the bottom of the JavaScript panel. Don’t worry about it until you’ve finished adding a line of code. If the error section is still there, click it to see the error messages.

For example, try deleting the semicolon from the end of the line of code.

The semicolon signals the end of a line of code. Each line of code, ending with a semicolon, is called a statement. If you stop typing but the line does not end with a semicolon, JS Bin will complain. The program may still run, and JavaScript will try to insert semicolons where it thinks they should go, but it’s much better practice to put the semicolons in yourself; the errors in JS Bin are encouraging good practice.

JS Bin does its best to give error messages that help you fix any problems. Delete more characters, one by one, from the end of your line of code and watch as the error messages update.

——————————————

1.4.5. Further Adventures


Most code listings for Get Programming with JavaScript on JS Bin come with a small set of exercises, called Further Adventures, included as comments after the code. Some are easy, some are repetitive, and some are challenging. The best way to learn programming is to program, so I urge you to jump in and try the challenges. You can get help on the Manning Forums, and solutions to many of the tasks are given on the book’s websites at www.manning.com/books/get-proggramming-with-javascript and www.room51.co.uk/books/getProgramming/index.html.

——————————————

1.4.4. Code comments


Along with the code statements, the JS Bin listings for this book include comments, text that’s not part of the program but is useful for explaining what the code does. Here’s the first block comment from listing 1.1 on JS Bin:

/* Get Programming with JavaScript
 * Listing 1.1
 * Using console.log
 */


As well as block comments, which can span multiple lines, you’ll sometimes see single-line comments:

// This is a single-line comment


On JS Bin, the comments are usually shown in green. Programmers add comments to their code if they feel it needs some explanation to be understood by other programmers. When a program is executed, the computer ignores the comments.

——————————————

1.4.3. Logging to the console


At various points you want programs to output information by displaying it on the Console panel. To display information on the console, use the console.log command. 

Running the program in this listing displays the following on the conssole:

> Hello World!


Listing 1.1. Using console.log to display information (http://jsbin.com/mujepu/edit?js,console)

console.log("Hello World!");


You place the message to be displayed between quotation marks, within the parentheses.

Notice that the listing title contains a JS Bin link. Click the link to see the live code on JS Bin. To execute the code in the JavaScript panel, click the Run button at the top of the Console panel. You’ll see your message, “Hello World!”, appear on the console.

——————————————

1.4.2. Following the code listings on JS Bin


You’ll write programs by adding lines of code to the JavaScript panel on JS Bin. The programs will start simply and slowly increase in complexity as you cover more features of the language. For most of the code listings in part 1 of the book, you can test the code on JS Bin by following these steps:

1.  Select New on the File menu on JS Bin.
2.  Toggle the panels so that the JavaScript and Console panels are visible.
3.  Enter code in the JavaScript panel.
4.  Click Run.
5.  Check the result on the Console panel.

——————————————

1.4.1. JS Bin panels


JS Bin is a tool for developing web pages and applications. In addition to the Info panel at the top, it has five panels available for display: HTML, CSS, JavaScript, Console, and Output. Clicking a panel’s name on the JS Bin toolbar toggles the panel on or off. In part 1 you work with just the JavaScript and Console panels, part 2 will use the HTML panel, and part 3 will add the CSS and Output panels. You’ll be using only the JavaScript and Console panels to begin with, so toggle those two panels on and the others off.

——————————————

HTML
HTML is used to structure the content of web pages. Text, images, video, and forms are examples of content.

CSS
Cascading Style Sheets let you specify how your content should be presented. You can define background color, font details, margins, sizes, and so on.

JavaScript
JavaScript lets you add behavior and interactivity to your web pages. Or you can use it to write programs not in the context of a web page.

Console
The console can be used by a program to display information for users and developers. Warnings and errors about a program may be shown here. The console is interactive; you can type into it to find out about the state of a program. It’s not normally used in finished applications, but you’ll make good use of it as a quick and simple way of interacting with your programs as you learn.

Output
The Output panel shows a preview of the web page defined in the HTML, CSS, and JavaScript panels. It shows what a visitor to a page would normally see in a browser.

——————————————

1.4. JS Bin


JavaScript is most commonly run by a web browser. The browser loads a web page from a server, and that page may include JavaScript code or a link to code the browser then fetches. The browser steps through the code, executing the instructions. For part 1 of Get Programming with JavaScript, you avoid the extra considerations of writing and loading web pages and linking to code files. You keep your focus on the JavaScript language itself. To do that, you make use of JS Bin, a free online service.

JS Bin is an online sandbox for developing and sharing web pages and JavaScript programs. All of the code listings in this book are available on JS Bin (www.jsbin.com) to give you hands-on practice with the code and to let you experiment and learn.

When you first visit the site, you’ll see a header section with a picture of Dave the BinBot and some helpful links to get you started. Feel free to explore, but don’t be put off by any complicated information you might find. Once you’ve finished exploring, close the header by clicking the X to the left of Dave. (You can close any welcome messages or other messages that JS Bin sometimes shows as well.)

——————————————

1.3. Learning by doing and thinking


Learning follows thinking. The philosophy of Get Programming with JavaScript is that by experimenting with programs in an online sandbox, finding out firsthand what works and what doesn’t, and by attempting challenges, you’ll have to think carefully about the concepts in each chapter. That thinking will lead to understanding and learning.

The sandbox lets you run programs and get instant feedback. Sometimes the feedback will be unexpected and force you to question what you thought you knew. Some ideas may click into place quickly whereas others could take longer; careful consideration and further experimentation may be needed. Curiosity, commitment, and resilience are key attitudes when learning anything, and they’ll certainly help you to be a better programmer.

That’s not to say learning to program will be a chore! Far from it. Even after more than 30 years of programming, I still find the transformation of code into a useful and/or fun application to be almost magical. That lines of simple statements, when combined, can accomplish such a variety of outcomes is astonishing. And seeing others use something you’ve created to be more productive or more organized or just to have more fun is a privilege and a pleasure.

So be prepared for an adventure of discovery, and don’t be disheartened if you find some concepts tricky at first. Take your time, do the exercises, and don’t forget the resources on the Get Programming with JavaScript website; it has links to listings, solutions, videos, and further reading at www.room51.co.uk/books/getProgramming/index.html. Learning to program is worth the effort.

——————————————

1.1. Programming


Programming is about giving the computer a series of instructions in a format it understands. Programs are everywhere, running Mars rovers, the Large Hadron Collider, engine management systems, financial markets, drones, phones, tablets, TVs, and medical equipment. The power and versatility of programs are astonishing. Programs can be a few lines long or millions of lines long, with complex solutions built from simple building blocks.

Deep down in a computer’s electronics is a land of binary, counters, registers, busses, and memory allocation. There are low-level programming languages that let us work in that land, known as machine code and assembly language. Luckily for us, high-level languages have been created that are much easier to read, follow, and use. We can write code that’s almost understandable by anyone; here’s some pretend code (pseudocode) that’s close to what high-level languages allow:

increase score by 100
if score is greater than 5000 print "Congratulations! You win!"
otherwise load new level


Different languages set out how you might write such code; some use more symbols than others, some more natural words. Here’s how it might look in JavaScript:

score = score + 100;
if (score > 5000) {
    alert("Congratulations! You win!");
} else {
    loadNewLevel();
}


The parentheses and curly braces and semicolons are all part of the language’s syntax, its rules for setting out the code so it can be understood by the computer. The code you write will be automatically translated into low-level code for the computer to execute.

In the previous JavaScript snippet is the instruction loadNewLevel();, to load a new level in the game, presumably. Somewhere else in the program will be more code with instructions outlining, step-by-step, how to load a new level. Part of the art of programming is breaking larger programs into smaller pieces that perform specific jobs. The smaller pieces are then combined to fulfill the purpose of the main program.

There are many, many programming languages. Some you may have heard of are Java, C, PHP, Python, and Swift. Let’s take a look at why you might choose JavaScript.

——————————————

1.2. JavaScript


JavaScript is an incredibly popular programming language, mostly seen in web browsers but gaining popularity in other contexts. On web pages it adds interactivity, from simple animation effects to form validation to full-blown single-page applications. Servers—programs that make files, web pages, and other resources available on the internet—are now written using JavaScript with Node.js. Other programs can be scripted with JavaScript, like Photoshop and Minecraft, and some databases store JavaScript and let you query data with JavaScript. And as more and more network-enabled objects are added to the Internet of Things, JavaScript is becoming more popular for programming sensors, robots, drones, and Arduino-style electronics.

Learning to program gives you a great skill that’s versatile, useful, stimulating, creative, fun, rewarding, and in demand. Learning to program with JavaScript puts one of the world’s most widely used languages at your fingertips, letting you develop applications for all manner of uses, devices, platforms, and OSes.

——————————————

About this Book


Get Programming with JavaScript is a book for beginners, for those with no programming experience. It makes extensive use of online code listings on the JS Bin website, a sandbox where you can experiment with the code and see the results instantly. There’s no setup or installation required; if you’ve got internet access, you can just get programming straight away. If you don’t have internet access, don’t worry, the printed listings include helpful annotations, and all the ideas are explained in the text.

In addition to shorter examples to illustrate the concepts covered, there is an ongoing example—a text-based adventure game called The Crypt—that you build as you progress through the book.

——————————————

Who should read this book


If you are happy working with computers, using a variety of applications, and saving and organizing your files but haven’t written programs before and would like to learn how, then this book is for you. It doesn’t try to cover all of JavaScript, or even all parts of JavaScript; it helps you to get programming with lots of practical examples and exercises that encourage you to think and explore. If you’re already a programmer and are looking for a complete JavaScript reference, then move along. But if you want a patient introduction to the language, then it’s worth sticking around; a strong understanding of the basics will make it much easier to access some of the other excellent books for programmers.

——————————————

lijiancheng0614.github.io/scikit-learn/

没关系，我看不懂的太多了

——————————————

Yeah, it was.

——————————————

http://blog.rainy.im/2016/06/01/tornado-x-websocket/

我看不懂，又很想用Python做一个，怎么办？

——————————————

#百度翻译的Python调用，自己改appid和Key
#coding=utf8
 
import requests
from hashlib import md5
import json

appid = '20770212000011684'
secretKey = 'lkX'
 
q = 'apple'
fromLang = 'en'
toLang = 'zh'
salt = 520

sign = appid+q+str(salt)+secretKey
m1 = md5()
m1.update(sign.encode('utf-8'))
sign = m1.hexdigest()
myurl = 'http://api.fanyi.baidu.com/api/trans/vip/translate?q='+q+'&from='+fromLang+'&to='+toLang+'&appid='+appid+'&salt='+str(salt)+'&sign='+sign
 
try:
    r = requests.get(myurl)
    rr =  json.loads(r.text)['trans_result'][0]['dst']
    print (rr)
except Exception as e:
    print (e)

——————————————

http://translate.google.cn/translate_a/t?client=j&text=I love you.&hl=zh-CN&multires=1&otf=1&pc=0&sc=1&sl=en&tl=zh-CN

——————————————

对了，我又回家自学了

——————————————

http://www.liuxiatool.com/t.php?sl=en&tl=zh-CN&q=I%20love%20you.&p=1&method=post&type=output&tijioao=submit

要是有Python的模块可以直接调用就好了

——————————————

python3-cookbook.readthedocs.io/zh_CN/latest/c02/p11_strip_unwanted_characters.html 

这个好

——————————————

Finding URLs Within Full Text


\b(https?|ftp|file)://\S+

——————————————

Find All Except a Specific Word


A negative lookahead can help you rule out specific words, and is key to this next regex:
\b(?!cat\b)\w+


Although a negated character class (written as [^⋯]) makes it easy to match anything except a specific character, you can’t just write ‹[^cat]› to match anything except the word cat. ‹[^cat]› is a valid regex, but it matches any character except c, a, or t. 


\b     # Assert position at a word boundary.
(?!    # Not followed by:
  cat  #   Match "cat".
  \b   #   Assert position at a word boundary.
)      # End the negative lookahead.
\w+    # Match one or more word characters.

——————————————

http://sentence.iciba.com/index.php?&c=dailysentence&m=getTodaySentence

Iciba daily sentence.

——————————————

纯种程序员的生存空间被大大的压缩

从形势上讲，未来的程序员分三种

1.I T民工，除了死敲代码什么也不会，繁杂的工作就是他的了

2.精通某一其它职业，并且对该职业的数学原理比较精通，同时也精通编程。这种人就是写特定职业核心算法的，不写则已，一写惊人。

3.ML程序员。不会具体行业没关系，现查现学，以基本原理推动机器学习，其训练成功的模型多相当于人类在该行业的正常水平。

——————————————

I hope all of you enjoy yourselves today.

——————————————

唉，文科生学的东西，除了数学英语

和这里没有什么关系

——————————————

唉，在学校主要在看kivy

这个似乎又是一个界面库

——————————————

The turtle Module


To check whether you have the turtle module, open the Python interpreter and type:

>>> import turtle
>>> bob = turtle.Turtle()


When you run this code, it should create a new window with a small arrow that represents the turtle. Close the window.

Create a file named mypolygon.py and type in the following code:

import turtle
bob = turtle.Turtle()
print(bob)
turtle.mainloop()


The turtle module (with a lowercase t) provides a function called Turtle (with an uppercase T) that creates a Turtle object, which we assign to a variable named bob. Printing bob displays something like:

<turtle.Turtle object at 0xb7bfbf4c>


This means that bob refers to an object with type Turtle as defined in module turtle.

mainloop tells the window to wait for the user to do something, although in this case there’s not much for the user to do except close the window.

Once you create a Turtle, you can call a method to move it around the window. A method is similar to a function, but it uses slightly different syntax. For example, to move the turtle forward:

bob.fd(100)


The method, fd, is associated with the turtle object we’re calling bob. Calling a method is like making a request: you are asking bob to move forward.

The argument of fd is a distance in pixels, so the actual size depends on your display.

Other methods you can call on a Turtle are bk to move backward, lt for left turn, and rt right turn. The argument for lt and rt is an angle in degrees.

Also, each Turtle is holding a pen, which is either down or up; if the pen is down, the Turtle leaves a trail when it moves. The methods pu and pd stand for “pen up” and “pen down”.

To draw a right angle, add these lines to the program (after creating bob and before calling mainloop):

bob.fd(100)
bob.lt(90)
bob.fd(100)


When you run this program, you should see bob move east and then north, leaving two line segments behind.

Now modify the program to draw a square. Don’t go on until you’ve got it working!

——————————————

Exercise 3-1.


Write a function named right_justify that takes a string named s as a parameter and prints the string with enough leading spaces so that the last letter of the string is in column 70 of the display:

>>> right_justify('monty')
                                                                 monty


Hint: Use string concatenation and repetition. Also, Python provides a built-in function called len that returns the length of a string, so the value of len('monty') is 5.


def right_justify(s):
    print((70-len(s))*' ' + s)

right_justify('monty')

——————————————

Exercise 3-2.

A function object is a value you can assign to a variable or pass as an argument. For example, do_twice is a function that takes a function object as an argument and calls it twice:

def do_twice(f):
    f()
    f()


Here’s an example that uses do_twice to call a function named print_spam twice:

def print_spam():
    print('spam')

do_twice(print_spam)


1.Type this example into a script and test it.

2.Modify do_twice so that it takes two arguments, a function object and a value, and calls the function twice, passing the value as an argument.

3.Use the modified version of do_twice to call print_twice twice, passing 'spam' as an argument.

4.Run it.

def do_twice(f, arg):
    f(arg)
    f(arg)

def print_twice(o):
    print(o)
    print(o)

do_twice(print_twice, 'What you want')

——————————————

Exercise 3-3.


Write a function that draws a grid like the following:
+ - - - - + - - - - +
|         |         |
|         |         |
|         |         |
|         |         |
+ - - - - + - - - - +
|         |         |
|         |         |
|         |         |
|         |         |
+ - - - - + - - - - +


def do_twice(f): 
    f() 
    f() 
    
def do_four(f): 
    do_twice(f) 
    do_twice(f) 
    
def print_beam(): 
    print('+ - - - -', end=' ') 
    
def print_post(): 
    print('|        ', end=' ') 
    
def print_beams(): 
    do_twice(print_beam) 
    print('+') 
    
def print_posts(): 
    do_twice(print_post) 
    print('|') 
    
def print_row(): 
    print_beams() 
    do_four(print_posts) 
    
def print_grid(): 
    do_twice(print_row) 
    print_beams() 

print_grid()

——————————————

——————————————

Glossary


function:
A named sequence of statements that performs some useful operation. Functions may or may not take arguments and may or may not produce a result.

function definition:
A statement that creates a new function, specifying its name, parameters, and the statements it contains.

function object:
A value created by a function definition. The name of the function is a variable that refers to a function object.

header:
The first line of a function definition.

body:
The sequence of statements inside a function definition.

parameter:
A name used inside a function to refer to the value passed as an argument.

function call:
A statement that runs a function. It consists of the function name followed by an argument list in parentheses.

argument:
A value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.

local variable:
A variable defined inside a function. A local variable can only be used inside its function.

return value:
The result of a function. If a function call is used as an expression, the return value is the value of the expression.

fruitful function:
A function that returns a value.

void function:
A function that always returns None.

None:
A special value returned by void functions.

module:
A file that contains a collection of related functions and other definitions.

import statement:
A statement that reads a module file and creates a module object.

module object:
A value created by an import statement that provides access to the values defined in a module.

dot notation:
The syntax for calling a function in another module by specifying the module name followed by a dot (period) and the function name.

composition:
Using an expression as part of a larger expression, or a statement as part of a larger statement.

flow of execution:
The order statements run in.

stack diagram:
A graphical representation of a stack of functions, their variables, and the values they refer to.

frame:
A box in a stack diagram that represents a function call. It contains the local variables and parameters of the function.

traceback:
A list of the functions that are executing, printed when an exception occurs.

——————————————

Debugging


One of the most important skills you will acquire is debugging. Although it can be frustrating, debugging is one of the most intellectually rich, challenging, and interesting parts of programming.

In some ways debugging is like detective work. You are confronted with clues and you have to infer the processes and events that led to the results you see.

Debugging is also like an experimental science. Once you have an idea about what is going wrong, you modify your program and try again. If your hypothesis was correct, you can predict the result of the modification, and you take a step closer to a working program. If your hypothesis was wrong, you have to come up with a new one. As Sherlock Holmes pointed out, “When you have eliminated the impossible, whatever remains, however improbable, must be the truth.” (A. Conan Doyle, The Sign of Four).

For some people, programming and debugging are the same thing. That is, programming is the process of gradually debugging a program until it does what you want. The idea is that you should start with a working program and make small modifications, debugging them as you go.

For example, Linux is an operating system that contains millions of lines of code, but it started out as a simple program Linus Torvalds used to explore the Intel 80386 chip. According to Larry Greenfield, “One of Linus’s earlier projects was a program that would switch between printing AAAA and BBBB. This later evolved to Linux.” (The Linux Users’ Guide Beta Version 1).

——————————————

Why Functions?


It may not be clear why it is worth the trouble to divide a program into functions. There are several reasons:

Creating a new function gives you an opportunity to name a group of statements, which makes your program easier to read and debug.

Functions can make a program smaller by eliminating repetitive code. Later, if you make a change, you only have to make it in one place.

Dividing a long program into functions allows you to debug the parts one at a time and then assemble them into a working whole.

Well-designed functions are often useful for many programs. Once you write and debug one, you can reuse it.

——————————————

Fruitful Functions and Void Functions


Some of the functions we have used, such as the math functions, return results; for lack of a better name, I call them fruitful functions. Other functions, like print_twice, perform an action but don’t return a value. They are called void functions.

When you call a fruitful function, you almost always want to do something with the result; for example, you might assign it to a variable or use it as part of an expression:

x = math.cos(radians)
golden = (math.sqrt(5) + 1) / 2


When you call a function in interactive mode, Python displays the result:

>>> math.sqrt(5)
2.2360679774997898


But in a script, if you call a fruitful function all by itself, the return value is lost forever!

math.sqrt(5)

This script computes the square root of 5, but since it doesn’t store or display the result, it is not very useful.

Void functions might display something on the screen or have some other effect, but they don’t have a return value. If you assign the result to a variable, you get a special value called None:

>>> result = print_twice('Bing')
Bing
Bing
>>> print(result)
None


The value None is not the same as the string 'None'. It is a special value that has its own type:

>>> print(type(None))
<class 'NoneType'>


The functions we have written so far are all void. We will start writing fruitful functions in a few chapters.

——————————————

Stack Diagrams


To keep track of which variables can be used where, it is sometimes useful to draw a stack diagram. Like state diagrams, stack diagrams show the value of each variable, but they also show the function each variable belongs to.

Each function is represented by a frame. A frame is a box with the name of a function beside it and the parameters and variables of the function inside it.

The frames are arranged in a stack that indicates which function called which, and so on. In this example, print_twice was called by cat_twice, and cat_twice was called by __main__, which is a special name for the topmost frame. When you create a variable outside of any function, it belongs to __main__.

Each parameter refers to the same value as its corresponding argument. So, part1 has the same value as line1, part2 has the same value as line2, and bruce has the same value as cat.

If an error occurs during a function call, Python prints the name of the function, the name of the function that called it, and the name of the function that called that, all the way back to __main__.

For example, if you try to access cat from within print_twice, you get a NameError:

Traceback (innermost last):
  File "test.py", line 13, in __main__
    cat_twice(line1, line2)
  File "test.py", line 5, in cat_twice
    print_twice(cat)
  File "test.py", line 9, in print_twice
    print(cat)
NameError: name 'cat' is not defined


This list of functions is called a traceback. It tells you what program file the error occurred in, and what line, and what functions were executing at the time. It also shows the line of code that caused the error.

The order of the functions in the traceback is the same as the order of the frames in the stack diagram. The function that is currently running is at the bottom.

——————————————

Variables and Parameters Are Local


When you create a variable inside a function, it is local, which means that it only exists inside the function. For example:

def cat_twice(part1, part2):
    cat = part1 + part2
    print_twice(cat)


This function takes two arguments, concatenates them, and prints the result twice. Here is an example that uses it:

>>> line1 = 'Bing tiddle '
>>> line2 = 'tiddle bang.'
>>> cat_twice(line1, line2)
Bing tiddle tiddle bang.
Bing tiddle tiddle bang.


When cat_twice terminates, the variable cat is destroyed. If we try to print it, we get an exception:

>>> print(cat)
NameError: name 'cat' is not defined


Parameters are also local. For example, outside print_twice, there is no such thing as bruce.

——————————————

https://pyhub.cc

——————————————

Parameters and Arguments


Some of the functions we have seen require arguments. For example, when you call math.sin you pass a number as an argument. Some functions take more than one argument: math.pow takes two, the base and the exponent.

Inside the function, the arguments are assigned to variables called parameters. Here is a definition for a function that takes an argument:

def print_twice(bruce):
    print(bruce)
    print(bruce)


This function assigns the argument to a parameter named bruce. When the function is called, it prints the value of the parameter (whatever it is) twice.

This function works with any value that can be printed:

>>> print_twice('Spam')
Spam
Spam
>>> print_twice(42)
42
42
>>> print_twice(math.pi)
3.14159265359
3.14159265359


The same rules of composition that apply to built-in functions also apply to programmer-defined functions, so we can use any kind of expression as an argument for print_twice:

>>> print_twice('Spam '*4)
Spam Spam Spam Spam
Spam Spam Spam Spam
>>> print_twice(math.cos(math.pi))
-1.0
-1.0


The argument is evaluated before the function is called, so in the examples the expressions 'Spam '*4 and math.cos(math.pi) are only evaluated once.

You can also use a variable as an argument:

>>> michael = 'Eric, the half a bee.'
>>> print_twice(michael)
Eric, the half a bee.
Eric, the half a bee.


The name of the variable we pass as an argument (michael) has nothing to do with the name of the parameter (bruce). It doesn’t matter what the value was called back home (in the caller); here in print_twice, we call everybody bruce.

——————————————

不懂你说什么😒

——————————————

Flow of Execution


To ensure that a function is defined before its first use, you have to know the order statements run in, which is called the flow of execution.

Execution always begins at the first statement of the program. Statements are run one at a time, in order from top to bottom.

Function definitions do not alter the flow of execution of the program, but remember that statements inside the function don’t run until the function is called.

A function call is like a detour in the flow of execution. Instead of going to the next statement, the flow jumps to the body of the function, runs the statements there, and then comes back to pick up where it left off.

That sounds simple enough, until you remember that one function can call another. While in the middle of one function, the program might have to run the statements in another function. Then, while running that new function, the program might have to run yet another function!

Fortunately, Python is good at keeping track of where it is, so each time a function completes, the program picks up where it left off in the function that called it. When it gets to the end of the program, it terminates.

In summary, when you read a program, you don’t always want to read from top to bottom. Sometimes it makes more sense if you follow the flow of execution.

——————————————

Perfect API Server.

——————————————

import os
import sys
import subprocess
from flask import Flask, request



def handle_message(msg):
    return (msg + '\n\nThis msg have ' + str(len(msg)) + ' characters.')



EXEC = sys.executable #local pythonw.exe

def run_py_file(py_path):
    result = subprocess.run([EXEC, py_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
    return str(result.stdout)

def run_py_codes(py_codes):
    codes = str(py_codes)
    if codes.count('print') == 0 and codes.count('import ') == 0:
        try:
            result = str(eval(codes))
        except Exception as e:
            result = str(e)
        return result
    else:
        py_path = os.path.dirname(os.path.realpath(__file__)) + '\\codes.txt'
        code_bytes = codes.encode('utf-8', 'ignore')
        open(py_path, 'wb').write(code_bytes)
        result = str(run_py_file(py_path))
        os.remove(py_path)
        return result



tip = '''[Handle Message & Reply] POST text message to http://127.0.0.1:5000/Chat/
[Run Python Codes] POST Python codes to http://127.0.0.1:5000/Python/
'''


def decode(data):
    try:
        codes = data.decode('utf-8')
    except:
        codes = data.decode('gb2312')
    return codes


app = Flask(__name__)

@app.route('/')
def home_page(): #http://127.0.0.1:5000
    return tip

@app.route('/Chat/', methods=['POST'])
def reply_message():
    if request.method == 'POST':
        msg = decode(request.data)

        if msg == '':
            print('Nothing received.')
            return ''
        else:
            return handle_message(msg) 

@app.route('/Python/', methods=['POST'])
def run_python():
    if request.method == 'POST':
        codes = decode(request.data)

        if codes == '':
            print('Nothing received.')
            return ''
        else:
            return run_py_codes(codes)

if __name__ == '__main__':
    print(tip)
    app.run()

——————————————

我觉得目前我没有必要换语言，除非感觉Python不够用

但很明显，我没达到那个级别

——————————————

这完全是在虐狗，哪个语言有这么吊？

——————————————

#code
class a:
    def __init__(self):
        self.v = 5
        class i:
            def __init__(self):
                print('SB')
        
        def b(c):
            return c*2
        def d(c):
            def dd(cc):
                return cc*2*self.v
            
            return c*dd(2)
        
        i()
        print(d(b(self.v)))

a()


#Class also.

——————————————

#code
class a:
    def __init__(self):
        self.v = 5
        
        def b(c):
            return c*2
        def d(c):
            def dd(cc):
                return cc*2*self.v
            
            return c*dd(2)
        print(d(b(self.v)))

s = a()

#原来Python可以无限嵌套子程序

——————————————

Definitions and Uses


Pulling together the code fragments from the previous section, the whole program looks like this:

def print_lyrics():
    print("I'm a lumberjack, and I'm okay.")
    print("I sleep all night and I work all day.")

def repeat_lyrics():
    print_lyrics()
    print_lyrics()

repeat_lyrics()


This program contains two function definitions: print_lyrics and repeat_lyrics. Function definitions get executed just like other statements, but the effect is to create function objects. The statements inside the function do not run until the function is called, and the function definition generates no output.

As you might expect, you have to create a function before you can run it. In other words, the function definition has to run before the function gets called.

As an exercise, move the last line of this program to the top, so the function call appears before the definitions. Run the program and see what error message you get.

Now move the function call back to the bottom and move the definition of print_lyrics after the definition of repeat_lyrics. What happens when you run this program?

——————————————

Adding New Functions


So far, we have only been using the functions that come with Python, but it is also possible to add new functions. A function definition specifies the name of a new function and the sequence of statements that run when the function is called.

Here is an example:

def print_lyrics():
    print("I'm a lumberjack, and I'm okay.")
    print("I sleep all night and I work all day.")


def is a keyword that indicates that this is a function definition. The name of the function is print_lyrics. The rules for function names are the same as for variable names: letters, numbers and underscore are legal, but the first character can’t be a number. You can’t use a keyword as the name of a function, and you should avoid having a variable and a function with the same name.

The empty parentheses after the name indicate that this function doesn’t take any arguments.

The first line of the function definition is called the header; the rest is called the body. The header has to end with a colon and the body has to be indented. By convention, indentation is always four spaces. The body can contain any number of statements.

The strings in the print statements are enclosed in double quotes. Single quotes and double quotes do the same thing; most people use single quotes except in cases like this where a single quote (which is also an apostrophe) appears in the string.

All quotation marks (single and double) must be “straight quotes”, usually located next to Enter on the keyboard. “Curly quotes”, like the ones in this sentence, are not legal in Python.

If you type a function definition in interactive mode, the interpreter prints dots (...) to let you know that the definition isn’t complete:

>>> def print_lyrics():
...     print("I'm a lumberjack, and I'm okay.")
...     print("I sleep all night and I work all day.")
...


To end the function, you have to enter an empty line.

Defining a function creates a function object, which has type function:

>>> print(print_lyrics)
<function print_lyrics at 0xb7e99e9c>
>>> type(print_lyrics)
<class 'function'>


The syntax for calling the new function is the same as for built-in functions:

>>> print_lyrics()
I'm a lumberjack, and I'm okay.
I sleep all night and I work all day.


Once you have defined a function, you can use it inside another function. For example, to repeat the previous refrain, we could write a function called repeat_lyrics:

def repeat_lyrics():
    print_lyrics()
    print_lyrics()


And then call repeat_lyrics:

>>> repeat_lyrics()
I'm a lumberjack, and I'm okay.
I sleep all night and I work all day.
I'm a lumberjack, and I'm okay.
I sleep all night and I work all day.


But that’s not really how the song goes.

——————————————

Composition


So far, we have looked at the elements of a program—variables, expressions, and statements—in isolation, without talking about how to combine them.

One of the most useful features of programming languages is their ability to take small building blocks and compose them. For example, the argument of a function can be any kind of expression, including arithmetic operators:

x = math.sin(degrees / 360.0 * 2 * math.pi)


And even function calls:

x = math.exp(math.log(x+1))


Almost anywhere you can put a value, you can put an arbitrary expression, with one exception: the left side of an assignment statement has to be a variable name. Any other expression on the left side is a syntax error (we will see exceptions to this rule later).

>>> minutes = hours * 60                 # right
>>> hours * 60 = minutes                 # wrong!
SyntaxError: can't assign to operator

——————————————

Math Functions


Python has a math module that provides most of the familiar mathematical functions. A module is a file that contains a collection of related functions.

Before we can use the functions in a module, we have to import it with an import statement:

>>> import math


This statement creates a module object named math. If you display the module object, you get some information about it:

>>> math
<module 'math' (built-in)>


The module object contains the functions and variables defined in the module. To access one of the functions, you have to specify the name of the module and the name of the function, separated by a dot (also known as a period). This format is called dot notation.

>>> ratio = signal_power / noise_power
>>> decibels = 10 * math.log10(ratio)

>>> radians = 0.7
>>> height = math.sin(radians)


The first example uses math.log10 to compute a signal-to-noise ratio in decibels (assuming that signal_power and noise_power are defined). The math module also provides log, which computes logarithms base e.

The second example finds the sine of radians. The name of the variable is a hint that sin and the other trigonometric functions (cos, tan, etc.) take arguments in radians. To convert from degrees to radians, divide by 180 and multiply by π:

>>> degrees = 45
>>> radians = degrees / 180.0 * math.pi
>>> math.sin(radians)
0.707106781187


The expression math.pi gets the variable pi from the math module. Its value is a floating-point approximation of π, accurate to about 15 digits.

If you know trigonometry, you can check the previous result by comparing it to the square root of 2 divided by 2:

>>> math.sqrt(2) / 2.0
0.707106781187

——————————————

Function Calls


We have already seen one example of a function call:

>>> type(42)
<class 'int'>


The name of the function is type. The expression in parentheses is called the argument of the function. The result, for this function, is the type of the argument.

It is common to say that a function “takes” an argument and “returns” a result. The result is also called the return value.

Python provides functions that convert values from one type to another. The int function takes any value and converts it to an integer, if it can, or complains otherwise:

>>> int('32')
32
>>> int('Hello')
ValueError: invalid literal for int(): Hello


int can convert floating-point values to integers, but it doesn’t round off; it chops off the fraction part:

>>> int(3.99999)
3
>>> int(-2.3)
-2


float converts integers and strings to floating-point numbers:

>>> float(32)
32.0
>>> float('3.14159')
3.14159


Finally, str converts its argument to a string:

>>> str(32)
'32'
>>> str(3.14159)
'3.14159'

——————————————

感觉两本书间还是有很多不同，一方面是术语，另一方面是价值观


…反正我也不知道看什么，要上学了

——————————————

Chapter 3. Functions


In the context of programming, a function is a named sequence of statements that performs a computation. When you define a function, you specify the name and the sequence of statements. Later, you can “call” the function by name.

——————————————

Glossary


variable:
A name that refers to a value.

assignment:
A statement that assigns a value to a variable.

state diagram:
A graphical representation of a set of variables and the values they refer to.

keyword:
A reserved word that is used to parse a program; you cannot use keywords like if, def, and while as variable names.

operand:
One of the values on which an operator operates.

expression:
A combination of variables, operators, and values that represents a single result.

evaluate:
To simplify an expression by performing the operations in order to yield a single value.

statement:
A section of code that represents a command or action. So far, the statements we have seen are assignments and print statements.

execute:
To run a statement and do what it says.

interactive mode:
A way of using the Python interpreter by typing code at the prompt.

script mode:
A way of using the Python interpreter to read code from a script and run it.

script:
A program stored in a file.

order of operations:
Rules governing the order in which expressions involving multiple operators and operands are evaluated.

concatenate:
To join two operands end-to-end.

comment:Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program.

syntax error:
An error in a program that makes it impossible to parse (and therefore impossible to interpret).

exception:
An error that is detected while the program is running.

semantics:
The meaning of a program.

semantic error:
An error in a program that makes it do something other than what the programmer intended.

——————————————

Debugging


Three kinds of errors can occur in a program: syntax errors, runtime errors, and semantic errors. It is useful to distinguish between them in order to track them down more quickly.

Syntax error:

“Syntax” refers to the structure of a program and the rules about that structure. For example, parentheses have to come in matching pairs, so (1 + 2) is legal, but 8) is a syntax error.

If there is a syntax error anywhere in your program, Python displays an error message and quits, and you will not be able to run the program. During the first few weeks of your programming career, you might spend a lot of time tracking down syntax errors. As you gain experience, you will make fewer errors and find them faster.


Runtime error:

The second type of error is a runtime error, so called because the error does not appear until after the program has started running. These errors are also called exceptions because they usually indicate that something exceptional (and bad) has happened.

Runtime errors are rare in the simple programs you will see in the first few chapters, so it might be a while before you encounter one.


Semantic error:

The third type of error is “semantic”, which means related to meaning. If there is a semantic error in your program, it will run without generating error messages, but it will not do the right thing. It will do something else. Specifically, it will do what you told it to do.

Identifying semantic errors can be tricky because it requires you to work backward by looking at the output of the program and trying to figure out what it is doing.

——————————————

Comments


As programs get bigger and more complicated, they get more difficult to read. Formal languages are dense, and it is often difficult to look at a piece of code and figure out what it is doing, or why.

For this reason, it is a good idea to add notes to your programs to explain in natural language what the program is doing. These notes are called comments, and they start with the # symbol:

# compute the percentage of the hour that has elapsed
percentage = (minute * 100) / 60


In this case, the comment appears on a line by itself. You can also put comments at the end of a line:

percentage = (minute * 100) / 60     # percentage of an hour


Everything from the # to the end of the line is ignored—it has no effect on the execution of the program.

Comments are most useful when they document non-obvious features of the code. It is reasonable to assume that the reader can figure out what the code does; it is more useful to explain why.

This comment is redundant with the code and useless:

v = 5     # assign 5 to v


This comment contains useful information that is not in the code:

v = 5     # velocity in meters/second.


Good variable names can reduce the need for comments, but long names can make complex expressions hard to read, so there is a trade-off.

——————————————

String Operations


In general, you can’t perform mathematical operations on strings, even if the strings look like numbers, so the following are illegal:

'2'-'1'    'eggs'/'easy'    'third'*'a charm'


But there are two exceptions, + and *.

The + operator performs string concatenation, which means it joins the strings by linking them end-to-end. For example:

The * operator also works on strings; it performs repetition. For example, 'Spam'*3 is 'SpamSpamSpam'. If one of the values is a string, the other has to be an integer.

This use of + and * makes sense by analogy with addition and multiplication. Just as 4*3 is equivalent to 4+4+4, we expect 'Spam'*3 to be the same as 'Spam'+'Spam'+'Spam', and it is. On the other hand, there is a significant way in which string concatenation and repetition are different from integer addition and multiplication. Can you think of a property that addition has that string concatenation does not?

——————————————

Order of Operations


When an expression contains more than one operator, the order of evaluation depends on the order of operations. For mathematical operators, Python follows mathematical convention. The acronym PEMDAS is a useful way to remember the rules:

Parentheses have the highest precedence and can be used to force an expression to evaluate in the order you want. Since expressions in parentheses are evaluated first, 2 * (3-1) is 4, and (1+1)**(5-2) is 8. You can also use parentheses to make an expression easier to read, as in (minute * 100) / 60, even if it doesn’t change the result.

Exponentiation has the next highest precedence, so 1 + 2**3 is 9, not 27, and 2 * 3**2 is 18, not 36.

Multiplication and Division have higher precedence than Addition and Subtraction. So 2*3-1 is 5, not 4, and 6+4/2 is 8, not 5.

Operators with the same precedence are evaluated from left to right.


I don’t work very hard to remember the precedence of operators. If I can’t tell by looking at the expression, I use parentheses to make it obvious.

——————————————

Script Mode


So far we have run Python in interactive mode, which means that you interact directly with the interpreter. Interactive mode is a good way to get started, but if you are working with more than a few lines of code, it can be clumsy.

The alternative is to save code in a file called a script and then run the interpreter in script mode to execute the script. By convention, Python scripts have names that end with .py.

If you know how to create and run a script on your computer, you are ready to go. Otherwise I recommend using PythonAnywhere again. I have posted instructions for running in script mode at http://tinyurl.com/thinkpython2e.

Because Python provides both modes, you can test bits of code in interactive mode before you put them in a script. But there are differences between interactive mode and script mode that can be confusing.

For example, if you are using Python as a calculator, you might type:

>>> miles = 26.2
>>> miles * 1.61
42.182


The first line assigns a value to miles, but it has no visible effect. The second line is an expression, so the interpreter evaluates it and displays the result. It turns out that a marathon is about 42 kilometers.

But if you type the same code into a script and run it, you get no output at all. In script mode an expression, all by itself, has no visible effect. Python actually evaluates the expression, but it doesn’t display the value unless you tell it to:

miles = 26.2
print(miles * 1.61)


This behavior can be confusing at first.

A script usually contains a sequence of statements. If there is more than one statement, the results appear one at a time as the statements execute.

For example, the script

print(1)
x = 2
print(x)


produces the output

1
2


The assignment statement produces no output.

To check your understanding, type the following statements in the Python interpreter and see what they do:

5
x = 5
x + 1


Now put the same statements in a script and run it. What is the output? Modify the script by transforming each expression into a print statement and then run it again.

——————————————

Expressions and Statements


An expression is a combination of values, variables, and operators. A value all by itself is considered an expression, and so is a variable, so the following are all legal expressions:

>>> 42
42

>>> n
17

>>> n + 25
42


When you type an expression at the prompt, the interpreter evaluates it, which means that it finds the value of the expression. In this example, n has the value 17 and n + 25 has the value 42.

A statement is a unit of code that has an effect, like creating a variable or displaying a value.

>>> n = 17
>>> print(n)

The first line is an assignment statement that gives a value to n. The second line is a print statement that displays the value of n.

When you type a statement, the interpreter executes it, which means that it does whatever the statement says. In general, statements don’t have values.

——————————————

Variable Names


Programmers generally choose names for their variables that are meaningful—they document what the variable is used for.

Variable names can be as long as you like. They can contain both letters and numbers, but they can’t begin with a number. It is legal to use uppercase letters, but it is conventional to use only lowercase for variables names.

The underscore character, _, can appear in a name. It is often used in names with multiple words, such as your_name or airspeed_of_unladen_swallow.

If you give a variable an illegal name, you get a syntax error:

>>> 76trombones = 'big parade'
SyntaxError: invalid syntax

>>> more@ = 1000000
SyntaxError: invalid syntax

>>> class = 'Advanced Theoretical Zymurgy'
SyntaxError: invalid syntax


76trombones is illegal because it begins with a number. more@ is illegal because it contains an illegal character, @. But what’s wrong with class?

It turns out that class is one of Python’s keywords. The interpreter uses keywords to recognize the structure of the program, and they cannot be used as variable names.

Python 3 has these keywords:

False      class      finally    is         return
None       continue   for        lambda     try
True       def        from       nonlocal   while
and        del        global     not        with
as         elif       if         or         yield
assert     else       import     pass
break      except     in         raise


You don’t have to memorize this list. In most development environments, keywords are displayed in a different color; if you try to use one as a variable name, you’ll know.

——————————————

虽然有点繁琐

还是绝对分开，这里只发编程语言

——————————————

Assignment Statements


An assignment statement creates a new variable and gives it a value:

>>> message = 'And now for something completely different'
>>> n = 17
>>> pi = 3.141592653589793

This example makes three assignments. The first assigns a string to a new variable named message; the second gives the integer 17 to n; the third assigns the (approximate) value of π to pi.

——————————————

Chapter 2. Variables, Expressions and Statements


One of the most powerful features of a programming language is the ability to manipulate variables. A variable is a name that refers to a value.

——————————————

About Exercises


It is a good idea to read this book in front of a computer so you can try out the examples as you go.

Whenever you are experimenting with a new feature, you should try to make mistakes. For example, in the “Hello, world!” program, what happens if you leave out one of the quotation marks? What if you leave out both? What if you spell print wrong?

This kind of experiment helps you remember what you read; it also helps when you are programming, because you get to know what the error messages mean. It is better to make mistakes now and on purpose than later and accidentally.

——————————————

Glossary


problem solving:
The process of formulating a problem, finding a solution, and expressing it.

high-level language:
A programming language like Python that is designed to be easy for humans to read and write.

low-level language:
A programming language that is designed to be easy for a computer to run; also called “machine language” or “assembly language”.

portability:
A property of a program that can run on more than one kind of computer.

interpreter:
A program that reads another program and executes it.

prompt:
Characters displayed by the interpreter to indicate that it is ready to take input from the user.

program:
A set of instructions that specifies a computation.

print statement:
An instruction that causes the Python interpreter to display a value on the screen.

operator:
A special symbol that represents a simple computation like addition, multiplication, or string concatenation.

value:
One of the basic units of data, like a number or string, that a program manipulates.

type:
A category of values. The types we have seen so far are integers (type int), floating-point numbers (type float), and strings (type str).

integer:
A type that represents whole numbers.

floating-point:
A type that represents numbers with fractional parts.

string:
A type that represents sequences of characters.

natural language:
Any one of the languages that people speak that evolved naturally.

formal language:
Any one of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer programs; all programming languages are formal languages.

token:
One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language.

syntax:
The rules that govern the structure of a program.

parse:
To examine a program and analyze the syntactic structure.

bug:
An error in a program.

debugging:
The process of finding and correcting bugs.

——————————————

Debugging


Programmers make mistakes. For whimsical reasons, programming errors are called bugs and the process of tracking them down is called debugging.

Programming, and especially debugging, sometimes brings out strong emotions. If you are struggling with a difficult bug, you might feel angry, despondent, or embarrassed.

There is evidence that people naturally respond to computers as if they were people. When they work well, we think of them as teammates, and when they are obstinate or rude, we respond to them the same way we respond to rude, obstinate people (Reeves and Nass, The Media Equation: How People Treat Computers, Television, and New Media Like Real People and Places).

Preparing for these reactions might help you deal with them. One approach is to think of the computer as an employee with certain strengths, like speed and precision, and particular weaknesses, like lack of empathy and inability to grasp the big picture.

Your job is to be a good manager: find ways to take advantage of the strengths and mitigate the weaknesses. And find ways to use your emotions to engage with the problem, without letting your reactions interfere with your ability to work effectively.

Learning to debug can be frustrating, but it is a valuable skill that is useful for many activities beyond programming. At the end of each chapter there is a section, like this one, with my suggestions for debugging. I hope they help!

——————————————

1.4.4. Machine learning frameworks


When you have the data in place, it’s time to extract the coveted insights. This is where you rely on the fields of machine learning, statistics, and applied mathematics. Before World War II everything needed to be calculated by hand, which severely limited the possibilities of data analysis. After World War II computers and scientific computing were developed. A single computer could do all the counting and calculations and a world of opportunities opened. Ever since this breakthrough, people only need to derive the mathematical formulas, write them in an algorithm, and load their data. With the enormous amount of data available nowadays, one computer can no longer handle the workload by itself. In fact, several algorithms developed in the previous millennium would never terminate before the end of the universe, even if you could use every computer available on Earth. This has to do with time complexity (https://en.wikipedia.org/wiki/Time_complexity). An example is trying to break a password by testing every possible combination. An example can be found at http://stackoverflow.com/questions/7055652/real-world-example-of-exponential-time-complexity. One of the biggest issues with the old algorithms is that they don’t scale well. With the amount of data we need to analyze today, this becomes problematic, and specialized frameworks and libraries are required to deal with this amount of data. The most popular machine-learning library for Python is Scikit-learn. It’s a great machine-learning toolbox, and we’ll use it later in the book. There are, of course, other Python libraries:

PyBrain for neural networks —Neural networks are learning algorithms that mimic the human brain in learning mechanics and complexity. Neural networks are often regarded as advanced and black box.

NLTK or Natural Language Toolkit —As the name suggests, its focus is working with natural language. It’s an extensive library that comes bundled with a number of text corpuses to help you model your own data.

Pylearn2 —Another machine learning toolbox but a bit less mature than Scikit-learn.

TensorFlow —A Python library for deep learning provided by Google.


The landscape doesn’t end with Python libraries, of course. Spark is a new Apache-licensed machine-learning engine, specializing in real-learn-time machine learning. It’s worth taking a look at and you can read more about it at http://spark.apache.org/.

——————————————

1.4.3. Data integration framework


Once you have a distributed file system in place, you need to add data. You need to move data from one source to another, and this is where the data integration frameworks such as Apache Sqoop and Apache Flume excel. The process is similar to an extract, transform, and load process in a traditional data warehouse.

——————————————

1.4.2. Distributed programming framework


Once you have the data stored on the distributed file system, you want to exploit it. One important aspect of working on a distributed hard disk is that you won’t move your data to your program, but rather you’ll move your program to the data. When you start from scratch with a normal general-purpose programming language such as C, Python, or Java, you need to deal with the complexities that come with distributed programming, such as restarting jobs that have failed, tracking the results from the different subprocesses, and so on. Luckily, the open source community has developed many frameworks to handle this for you, and these give you a much better experience working with distributed data and dealing with many of the challenges it carries.

——————————————

1.4.1. Distributed file systems


A distributed file system is similar to a normal file system, except that it runs on multiple servers at once. Because it’s a file system, you can do almost all the same things you’d do on a normal file system. Actions such as storing, reading, and deleting files and adding security to files are at the core of every file system, including the distributed one. Distributed file systems have significant advantages:

They can store files larger than any one computer disk.

Files get automatically replicated across multiple servers for redundancy or parallel operations while hiding the complexity of doing so from the user.

The system scales easily: you’re no longer bound by the memory or storage restricttions of a single server.

In the past, scale was increased by moving everything to a server with more memory, storage, and a better CPU (vertical scaling). Nowadays you can add another small server (horizontal scaling). This principle makes the scaling potential virtually limitless.

The best-known distributed file system at this moment is the Hadoop File System (HDFS). It is an open source implementation of the Google File System. In this book we focus on the Hadoop File System because it is the most common one in use. However, many other distributed file systems exist: Red Hat Cluster File System, Ceph File System, and Tachyon File System, to name but three.

——————————————

1.4. The big data ecosystem and data science


Data scientists use many different technologies, but not all of them; we’ll dedicate a separate chapter to the most important data science technology classes.

Let’s look at the different groups of tools in this diagram and see what each does. We’ll start with distributed file systems.

——————————————

Formal and Natural Languages


Natural languages are the languages people speak, such as English, Spanish, and French. They were not designed by people (although people try to impose some order on them); they evolved naturally.

Formal languages are languages that are designed by people for specific applications. For example, the notation that mathematicians use is a formal language that is particularly good at denoting relationships among numbers and symbols. Chemists use a formal language to represent the chemical structure of molecules. And most importantly:

Programming languages are formal languages that have been designed to express computations.

Formal languages tend to have strict syntax rules that govern the structure of statements. For example, in mathematics the statement 3+3=6 has correct syntax, but 3+=3$6 does not. In chemistry H2O is a syntactically correct formula, but 2Zz is not.

Syntax rules come in two flavors, pertaining to tokens and structure. Tokens are the basic elements of the language, such as words, numbers, and chemical elements. One of the problems with 3+=3$6 is that $ is not a legal token in mathematics (at least as far as I know). Similarly, 2Zz is not legal because there is no element with the abbreviation Zz.

The second type of syntax rule pertains to the way tokens are combined. The equation 3+=3 is illegal because even though + and = are legal tokens, you can’t have one right after the other. Similarly, in a chemical formula the subscript comes after the element name, not before.

This is @ well-structured Engli$h sentence with invalid t*kens in it. This sentence all valid tokens has, but invalid structure with.

When you read a sentence in English or a statement in a formal language, you have to figure out the structure (although in a natural language you do this subconsciously). This process is called parsing.

Although formal and natural languages have many features in common—tokens, structure, and syntax—there are some differences:

ambiguity:
Natural languages are full of ambiguity, which people deal with by using contextual clues and other information. Formal languages are designed to be nearly or completely unambiguous, which means that any statement has exactly one meaning, regardless of context.

redundancy:
In order to make up for ambiguity and reduce misunderstandings, natural languages employ lots of redundancy. As a result, they are often verbose. Formal languages are less redundant and more concise.

literalness:
Natural languages are full of idiom and metaphor. If I say, “The penny dropped”, there is probably no penny and nothing dropping (this idiom means that someone understood something after a period of confusion). Formal languages mean exactly what they say.

Because we all grow up speaking natural languages, it is sometimes hard to adjust to formal languages. The difference between formal and natural language is like the difference between poetry and prose, but more so:

Poetry:
Words are used for their sounds as well as for their meaning, and the whole poem together creates an effect or emotional response. Ambiguity is not only common but often deliberate.

Prose:
The literal meaning of words is more important, and the structure contributes more meaning. Prose is more amenable to analysis than poetry but still often ambiguous.

Programs:
The meaning of a computer program is unambiguous and literal, and can be understood entirely by analysis of the tokens and structure.

Formal languages are more dense than natural languages, so it takes longer to read them. Also, the structure is important, so it is not always best to read from top to bottom, left to right. Instead, learn to parse the program in your head, identifying the tokens and interpreting the structure. Finally, the details matter. Small errors in spelling and punctuation, which you can get away with in natural languages, can make a big difference in a formal language.

——————————————

Values and Types


A value is one of the basic things a program works with, like a letter or a number. Some values we have seen so far are 2, 42.0, and 'Hello, World!'

These values belong to different types: 2 is an integer, 42.0 is a floating-point number, and 'Hello, World!' is a string, so-called because the letters it contains are strung together.

If you are not sure what type a value has, the interpreter can tell you:

>>> type(2)
<class 'int'>

>>> type(42.0)
<class 'float'>

>>> type('Hello, World!')
<class 'str'>

In these results, the word “class” is used in the sense of a category; a type is a category of values.

Not surprisingly, integers belong to the type int, strings belong to str, and floating-point numbers belong to float.

What about values like '2' and '42.0'? They look like numbers, but they are in quotation marks like strings:

>>> type('2')
<class 'str'>

>>> type('42.0')
<class 'str'>

They’re strings.

When you type a large integer, you might be tempted to use commas between groups of digits, as in 1,000,000. This is not a legal integer in Python, but it is legal:

>>> 1,000,000
(1, 0, 0)

That’s not what we expected at all! Python interprets 1,000,000 as a comma-separated sequence of integers. We’ll learn more about this kind of sequence later.

——————————————

Arithmetic Operators


After “Hello, World”, the next step is arithmetic. Python provides operators, which are special symbols that represent computations like addition and multiplication.

The operators +, -, and * perform addition, subtraction, and multiplication, as in the following examples:

>>> 40 + 2
42
>>> 43 - 1
42
>>> 6 * 7
42

The operator / performs division:

>>> 84 / 2
42.0

You might wonder why the result is 42.0 instead of 42. I’ll explain in the next section.

Finally, the operator ** performs exponentiation; that is, it raises a number to a power:

>>> 6**2 + 6
42

In some other languages, ^ is used for exponentiation, but in Python it is a bitwise operator called XOR. If you are not familiar with bitwise operators, the result will surprise you:

>>> 6 ^ 2
4

I won’t cover bitwise operators in this book, but you can read about them at http://wiki.python.org/moin/BitwiseOperators.

——————————————

The First Program


Traditionally, the first program you write in a new language is called “Hello, World!” because all it does is display the words “Hello, World!” In Python, it looks like this:

>>> print('Hello, World!')

This is an example of a print statement, although it doesn’t actually print anything on paper. It displays a result on the screen. In this case, the result is the words

Hello, World!

The quotation marks in the program mark the beginning and end of the text to be displayed; they don’t appear in the result.

The parentheses indicate that print is a function. We’ll get to functions in Chapter 3.

In Python 2, the print statement is slightly different; it is not a function, so it doesn’t use parentheses.

>>> print 'Hello, World!'

This distinction will make more sense soon, but that’s enough to get started.

——————————————

1.3.6. Presentation and automation


Finally, you present the results to your business. These results can take many forms, ranging from presentations to research reports. Sometimes you’ll need to automate the execution of the process because the business will want to use the insights you gained in another project or enable an operational process to use the outcome from your model.

The previous description of the data science process gives you the impression that you walk through this process in a linear way, but in reality you often have to step back and rework certain findings. For instance, you might find outliers in the data exploration phase that point to data import errors. As part of the data science process you gain incremental insights, which may lead to new questions. To prevent rework, make sure that you scope the business question clearly and thoroughly at the start.

Now that we have a better understanding of the process, let’s look at the technologies.

——————————————

1.3.5. Data modeling or model building


In this phase you use models, domain knowledge, and insights about the data you found in the previous steps to answer the research question. You select a technique from the fields of statistics, machine learning, operations research, and so on. Building a model is an iterative process that involves selecting the variables for the model, executing the model, and model diagnostics.

——————————————

1.3.4. Data exploration


Data exploration is concerned with building a deeper understanding of your data. You try to understand how variables interact with each other, the distribution of the data, and whether there are outliers. To achieve this you mainly use descriptive statistics, visual techniques, and simple modeling. This step often goes by the abbreviation EDA, for Exploratory Data Analysis.

——————————————

1.3.3. Data preparation


Data collection is an error-prone process; in this phase you enhance the quality of the data and prepare it for use in subsequent steps. This phase consists of three subphases: data cleansing removes false values from a data source and inconsistencies across data sources, data integration enriches data sources by combining information from multiple data sources, and data transformation ensures that the data is in a suitable format for use in your models.

——————————————

1.3.2. Retrieving data


The second step is to collect data. You’ve stated in the project charter which data you need and where you can find it. In this step you ensure that you can use the data in your program, which means checking the existence of, quality, and access to the data. Data can also be delivered by third-party companies and takes many forms ranging from Excel spreadsheets to different types of databases.

——————————————

1.3.1. Setting the research goal

Data science is mostly applied in the context of an organization. When the business asks you to perform a data science project, you’ll first prepare a project charter. This charter contains information such as what you’re going to research, how the company benefits from that, what data and resources you need, a timetable, and deliveraables. Throughout this book, the data science process will be applied to bigger case studies and you’ll get an idea of different possible research goals.

——————————————

1.2.6. Audio, image, and video


Audio, image, and video are data types that pose specific challenges to a data scientist. Tasks that are trivial for humans, such as recognizing objects in pictures, turn out to be challenging for computers. MLBAM (Major League Baseball Advanced Media) announced in 2014 that they’ll increase video capture to approximately 7 TB per game for the purpose of live, in-game analytics. High-speed cameras at stadiums will capture ball and athlete movements to calculate in real time, for example, the path taken by a defender relative to two baselines.

Recently a company called DeepMind succeeded at creating an algorithm that’s capable of learning how to play video games. This algorithm takes the video screen as input and learns to interpret everything via a complex process of deep learning. It’s a remarkable feat that prompted Google to buy the company for their own Artificial Intelligence (AI) development plans. The learning algorithm takes in data as it’s produced by the computer game; it’s streaming data.

——————————————

虽然感觉很弱智还是要发😳

——————————————

Running Python


One of the challenges of getting started with Python is that you might have to install Python and related software on your computer. If you are familiar with your operating system, and especially if you are comfortable with the command-line interface, you will have no trouble installing Python. But for beginners, it can be painful to learn about system administration and programming at the same time.

To avoid that problem, I recommend that you start out running Python in a browser. Later, when you are comfortable with Python, I’ll make suggestions for installing Python on your computer.

There are a number of web pages you can use to run Python. If you already have a favorite, go ahead and use it. Otherwise I recommend PythonAnywhere. I provide detailed instructions for getting started at http://tinyurl.com/thinkpython2e.

There are two versions of Python, called Python 2 and Python 3. They are very similar, so if you learn one, it is easy to switch to the other. In fact, there are only a few differences you will encounter as a beginner. This book is written for Python 3, but I include some notes about Python 2.

The Python interpreter is a program that reads and executes Python code. Depending on your environment, you might start the interpreter by clicking on an icon, or by typing python on a command line. When it starts, you should see output like this:

Python 3.4.0 (default, Jun 19 2015, 14:20:21) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>


The first three lines contain information about the interpreter and the operating system it’s running on, so it might be different for you. But you should check that the version number, which is 3.4.0 in this example, begins with 3, which indicates that you are running Python 3. If it begins with 2, you are running (you guessed it) Python 2.

The last line is a prompt that indicates that the interpreter is ready for you to enter code. If you type a line of code and hit Enter, the interpreter displays the result:

>>> 1 + 1
2


Now you’re ready to get started. From here on, I assume that you know how to start the Python interpreter and run code.

——————————————

What Is a Program?


A program is a sequence of instructions that specifies how to perform a computation. The computation might be something mathematical, such as solving a system of equations or finding the roots of a polynomial, but it can also be a symbolic computation, such as searching and replacing text in a document or something graphical, like processing an image or playing a video.

The details look different in different languages, but a few basic instructions appear in just about every language:

input:
Get data from the keyboard, a file, the network, or some other device.

output:

Display data on the screen, save it in a file, send it over the network, etc.

math:

Perform basic mathematical operations like addition and multiplication.

conditional execution:

Check for certain conditions and run the appropriate code.

repetition:

Perform some action repeatedly, usually with some variation.


Believe it or not, that’s pretty much all there is to it. Every program you’ve ever used, no matter how complicated, is made up of instructions that look pretty much like these. So you can think of programming as the process of breaking a large, complex task into smaller and smaller subtasks until the subtasks are simple enough to be performed with one of these basic instructions.

——————————————

Chapter 1. The Way of the Program


The goal of this book is to teach you to think like a computer scientist. This way of thinking combines some of the best features of mathematics, engineering, and natural science. Like mathematicians, computer scientists use formal languages to denote ideas (specifically computations). Like engineers, they design things, assembling components into systems and evaluating tradeoffs among alternatives. Like scientists, they observe the behavior of complex systems, form hypotheses, and test predictions.

The single most important skill for a computer scientist is problem solving. Problem solving means the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately. As it turns out, the process of learning to program is an excellent opportunity to practice problem-solving skills. That’s why this chapter is called “The Way of the Program”.

On one level, you will be learning to program, a useful skill by itself. On another level, you will use programming as a means to an end. As we go along, that end will become clearer.

——————————————

Think Python

——————————————

不对，这个不应该发在这里

——————————————

1.2.5. Graph-based or network data


“Graph data” can be a confusing term because any data can be shown in a graph. “Graph” in this case points to mathematical graph theory. In graph theory, a graph is a mathematical structure to model pair-wise relationships between objects. Graph or network data is, in short, data that focuses on the relationship or adjacency of objects. The graph structures use nodes, edges, and properties to represent and store graphical data. Graph-based data is a natural way to represent social networks, and its structure allows you to calculate specific metrics such as the influence of a person and the shortest path between two people.

Examples of graph-based data can be found on many social media websites. For instance, on LinkedIn you can see who you know at which company. Your follower list on Twitter is another example of graph-based data.

——————————————

1.2.4. Machine-generated data


Machine-generated data is information that’s automatically created by a computer, process, application, or other machine without human intervention. Machine-generated data is becoming a major data resource and will continue to do so. Wikibon has forecast that the market value of the industrial Internet (a term coined by Frost & Sullivan to refer to the integration of complex physical machinery with networked sensors and software) will be approximately $540 billion in 2020. IDC (International Data Corporation) has estimated there will be 26 times more connected things than people in 2020. This network is commonly referred to as the internet of things.

——————————————

1.2.3. Natural language


Natural language is a special type of unstructured data; it’s challenging to process because it requires knowledge of specific data science techniques and linguistics.

The natural language processing community has had success in entity recognition, topic recognition, summarization, text completion, and sentiment analysis, but models trained in one domain don’t generalize well to other domains. Even state-of-the-art techniques aren’t able to decipher the meaning of every piece of text. This shouldn’t be a surprise though: humans struggle with natural language as well. It’s ambiguous by nature. The concept of meaning itself is questionable here. Have two people listen to the same conversation. Will they get the same meaning? The meaning of the same words can vary when coming from someone upset or joyous.

——————————————

1.2.2. Unstructured data


Unstructured data is data that isn’t easy to fit into a data model because the content is context-specific or varying. One example of unstructured data is your regular email. Although email contains structured elements such as the sender, title, and body text, it’s a challenge to find the number of people who have written an email complaint about a specific employee because so many ways exist to refer to a person, for example. The thousands of different languages and dialects out there further complicate this.

——————————————

1.2.1. Structured data


Structured data is data that depends on a data model and resides in a fixed field within a record. As such, it’s often easy to store structured data in tables within databases or Excel files. SQL, or Structured Query Language, is the preferred way to manage and query data that resides in databases. You may also come across structured data that might give you a hard time storing it in a traditional relational database. 

The world isn’t made up of structured data, though; it’s imposed upon it by humans and machines. More often, data comes unstructured.

——————————————

1.2. Facets of data


In data science and big data you’ll come across many different types of data, and each of them tends to require different tools and techniques. The main categories of data are these:

Structured
Unstructured
Natural language
Machine-generated
Graph-based
Audio, video, and images
Streaming


Let’s explore all these interesting data types.

——————————————

1、将data目录压缩为data.zip

zip -r data.zip data



2、将data.zip解压到data目录

unzip data.zip -d data

——————————————

要是我不去复读

现在就在看 Introducting data science.

——————————————

https://serve.netsh.org/pub/ipv4-hosts/

本来想找个软件自己制作hosts文件的

——————————————

yingshao xo:
更新远程仓库可能是件很烦的事，但我们有Python:

import os


commands = '''
git add .
git commit -m "update"
git push origin master
'''

for c in [c for c in commands.split('\n') if c != '']:
    os.system(c)

print('OK')

——————————————

天，等我一年后回来，你们是不是都走光了？

——————————————

列出当前系统中所有已安装的软件包:

dpkg -l


列出包含关键字，如qq的安装包:

dpkg -l | grep qq


卸载安装包(package):

sudo dpkg -r package
##删除已安装的软件包，但保留配置文件 

sudo dpkg -P package
##删除已安装软件包,完全清除包（含配置文件）

sudo dpkg –force-all –purge packagename
##有些软件很难卸载，而且还阻止了别的软件的应用，就可以用这个，不过有点冒险。

——————————————

Until now, all this book 就读完了


更多的，is appendix


They included arts, business, and science, we don't need to view them in all.

——————————————

Coming Attractions


But wait, there’s more! Appendixes A, B, and C offer tours of Python in the arts, business, and science. You’ll find at least one package that you’ll want to explore.
Bright and shiny objects abound on the net. Only you can tell which are costume jewelry and which are silver bullets. And even if you’re not currently pestered by werewolves, you might want some of those silver bullets in your pocket. Just in case.

Finally, we have answers to those annoying end-of-chapter exercises, details on installation of Python and friends, and a few cheat sheets for things that I always need to look up. Your brain is almost certainly better tuned, but they’re there if you need them.

——————————————

Conferences


Of the many conferences and workshops around the world, the largest are held annually in North America and Europe.

——————————————

Websites


Here are some websites where you can find helpful tutorials:

■ Learn Python the Hard Way by Zed Shaw.

■ Dive Into Python 3 by Mark Pilgrim.

■ Mouse Vs. Python by Michael Driscoll.


If you’re interested in keeping up with what’s going on in the Pythonic world, check out these news websites:

■ comp.lang.python

■ comp.lang.python.announce

■ python subreddit

■ Planet Python


Finally, here are some good websites for downloading code:

■ The Python Package Index

■ stackoverflow Python questions

■ ActiveState Python recipes

■ Python packages trending on GitHub

——————————————

Books


I’ve found the books in the list that follows to be especially useful. These range from introductory to advanced, with mixtures of Python 2 and 3.

Barry, Paul. Head First Python. O’Reilly, 2010.

Beazley, David M. Python Essential Reference (4th Edition). Addison-Wesley, 2009.

Beazley, David M. and Brian K. Jones. Python Cookbook (3rd Edition). O’Reilly, 2013.

Chun, Wesley. Core Python Applications Programming (3rd Edition). Prentice Hall, 2012.

McKinney, Wes. Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython. O’Reilly, 2012.

Summerfield, Mark. Python in Practice: Create Better Programs Using Concurrency, Libraries, and Patterns. Addison-Wesley, 2013.

Of course, there are many more.

——————————————

How You Can Learn More


This is an introduction. It almost certainly says too much about some things that you don’t care about and not enough about some things that you do. Let me recommend some Python resources that I’ve found helpful.

——————————————

Clone This Book


You can get a copy of all the programs in this book. Visit the git repository and follow the directions to copy it to your local machine. If you have git, run the command git clone https://github.com/madscheme/introducing-python to make a git repository on your computer. You can also download the files in zip format.

——————————————

Git(2)


Okay, all current changes have been committed. This means that we can change things and not worry about losing the original version. Make an adjustment now to test.py—change Oops to Ops! and save the file:

print('Ops!')


Let’s check to see what git thinks now:

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   test.py

no changes added to commit (use "git add" and/or "git commit -a")


Use git diff to see what lines have changed since the last commit:

$ git diff
 diff --git a/test.py b/test.py
 index 76b8c39..62782b2 100644
 --- a/test.py
 +++ b/test.py
 @@ -1 +1 @@
 -print('Oops')
 +print('Ops!')


If you try to commit this change now, git complains:

$ git commit -m "change the print string"
On branch master
Changes not staged for commit:
    modified:   test.py

no changes added to commit


That staged for commit phrase means you need to add the file, which roughly translated means hey git, look over here:

$ git add test.py


You could have also typed git add . to add all changed files in the current directory; that’s handy when you actually have edited multiple files and want to ensure that you check in all their changes. Now we can commit the change:

$ git commit -m "my first change"
 [master e1e11ec] my first change
  1 file changed, 1 insertion(+), 1 deletion(-)


If you’d like to see all the terrible things that you’ve done to test.py, most recent first, use git log:

$ git log test.py
 commit e1e11ecf802ae1a78debe6193c552dcd15ca160a
 Author: William Lubanovic <bill@madscheme.com>
 Date:   Tue May 13 23:34:59 2014 -0500

     change the print string

 commit 52d60d76594a62299f6fd561b2446c8b1227cfe1
 Author: William Lubanovic <bill@madscheme.com>
 Date:   Tue May 13 23:26:14 2014 -0500

     simple print program

——————————————

Git(1)


Git was originally written for Linux kernel development, but now dominates open source in general. It’s similar to Mercurial, although some find it slightly trickier to master. GitHub is the largest git host, with over a million repositories, but there are many other hosts.

The standalone program examples in this book are available in a public git repository at GitHub. If you have the git program on your computer, you can download these programs by using this command:

$ git clone https://github.com/madscheme/introducing-python


You can also download the code by pressing the following buttons on the GitHub page:

■ Click “Clone in Desktop” to open your computer’s version of git, if it’s been installed.

■ Click “Download ZIP” to get a zipped archive of the programs.


If you don’t have git but would like to try it, read the installation guide. I’ll talk about the command-line version here, but you might be interested in sites such as GitHub that have extra services and might be easier to use in some cases; git has many features, but is not always intuitive.

Let’s take git for a test drive. We won’t go far, but the ride will show a few commands and their output.

Make a new directory and change to it:

$ mkdir newdir
$ cd newdir


Create a local git repository in your current directory newdir:

$ git init
Initialized empty Git repository in /Users/williamlubanovic/newdir/.git/


Create a Python file called test.py with these contents in newdir:

print('Oops')


Add the file to the git repository:

$ git add test.py


What do you think of that, Mr. Git?

$ git status
On branch master
Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

    new file:   test.py


This means that test.py is part of the local repository but its changes have not yet been committed. Let’s commit it:

$ git commit -m "simple print program"
 [master (root-commit) 52d60d7] my first commit
  1 file changed, 1 insertion(+)
  create mode 100644 test.py


That -m "my first commit" was your commit message. If you omitted that, git would pop you into an editor and coax you to enter the message that way. This becomes a part of the git change history for that file.

Let’s see what our current status is:

$ git status
 On branch master
 nothing to commit, working directory clean

——————————————

Mercurial


Mercurial is written in Python. It’s fairly easy to learn, with a handful of subcommands to download code from a Mercurial repository, add files, check in changes, and merge changes from different sources. bitbucket and other sites offer free or commercial hosting.

——————————————

Source Control


When you’re working on a small group of programs, you can usually keep track of your changes—until you make a boneheaded mistake and clobber a few days of work. Source control systems help protect your code from dangerous forces, like you. If you work with a group of developers, source control becomes a necessity. There are many commercial and open source packages in this area. The most popular in the open source world where Python lives are Mercurial and Git. Both are examples of distributed version control systems, which produce multiple copies of code repositories. Earlier systems such as Subversion run on a single server.

——————————————

PyPy


When Java first appeared about 20 years ago, it was as slow as an arthritic schnauzer. When it started to mean real money to Sun and other companies, though, they put millions into optimizing the Java interpreter and the underlying Java virtual machine (JVM), borrowing techniques from earlier languages like Smalltalk and LISP. Microsoft likewise put great effort into optimizing its rival C# language and .NET VM.

No one owns Python, so no one has pushed that hard to make it faster. You’re probably using the standard Python implementation. It’s written in C, and often called CPython (not the same as Cython).

Like PHP, Perl, and even Java, Python is not compiled to machine language, but translated to an intermediate language (with names such as bytecode or p-code) which is then interpreted in a virtual machine.

PyPy is a new Python interpreter that applies some of the tricks that sped up Java. Its benchmarks show that PyPy is faster than CPython in every test—over 6 times faster on average, and up to 20 times faster in some cases. It works with Python 2 and 3. You can download it and use it instead of CPython. PyPy is constantly being improved, and it might even replace CPython some day. Read the latest release notes on the site to see if it could work for your purposes.

——————————————

Cython, NumPy, and C Extensions


If you’re pushing Python as hard as you can and still can’t get the performance you want, you have yet more options.

Cython is a hybrid of Python and C, designed to translate Python with some performance annotations to compiled C code. These annotations are fairly small, like declaring the types of some variables, function arguments, or function returns. For scientific-style loops of numeric calculations, adding these hints will make them much faster—as much as a thousand times faster. See the Cython wiki for documentation and examples.

You can read much more about NumPy in Appendix C. It’s a Python math library, written in C for speed.

Many parts of Python and its standard library are written in C for speed and wrapped in Python for convenience. These hooks are available to you for your applications. If you know C and Python and really want to make your code fly, writing a C extension is harder but the improvements can be worth the trouble.

——————————————

Algorithms and Data Structures


The Zen of Python declares that There should be one—and preferably only one—obvious way to do it. Unfortunately, sometimes it isn’t obvious, and you need to compare alternatives. For example, is it better to use a for loop or a list comprehension to build a list? And what do we mean by better? Is it faster, easier to understand, using less memory, or more “Pythonic”?

In this next exercise, we’ll build a list in different ways, comparing speed, readability, and Python style. Here’s time_lists.py:

from timeit import timeit

def make_list_1():
    result = []
    for value in range(1000):
        result.append(value)
    return result

def make_list_2():
    result = [value for value in range(1000)]
    return result

print('make_list_1 takes', timeit(make_list_1, number=1000), 'seconds')
print('make_list_2 takes', timeit(make_list_2, number=1000), 'seconds')


In each function, we add 1,000 items to a list, and we call each function 1,000 times. Notice that in this test we called timeit() with the function name as the first argument rather than code as a string. Let’s run it:

$ python time_lists.py
make_list_1 takes 0.14117428699682932 seconds
make_list_2 takes 0.06174145900149597 seconds


The list comprehension is at least twice as fast as adding items to the list by using append(). In general, comprehensions are faster than manual construction.

Use these ideas to make your own code faster.

——————————————

我打算复读了

——————————————

我想主业搞这个更有动力

——————————————

有什么办法退档去专二录？

——————————————

Measure Timing


You’ve seen that the time function in the time module returns the current epoch time as a floating-point number of seconds. A quick way of timing something is to get the current time, do something, get the new time, and then subtract the original time from the new time. Let’s write this up and call it time1.py:

from time import time
t1 = time()
num = 5
num *= 2
print(time() - t1)


In this example, we’re measuring the the time it takes to assign the value 5 to the name num and multiply it by 2. This is not a realistic benchmark, just an example of how to measure some arbitrary Python code. Try running it a few times, just to see how much it can vary:

$ python time1.py
2.1457672119140625e-06
$ python time1.py
2.1457672119140625e-06
$ python time1.py
2.1457672119140625e-06
$ python time1.py
1.9073486328125e-06
$ python time1.py
3.0994415283203125e-06


That was about two or three millionths of a second. Let’s try something slower, such as sleep. If we sleep for a second, our timer should take a tiny bit more than a second. Save this as time2.py:

from time import time, sleep

t1 = time()
sleep(1.0)
print(time() - t1)


Let’s be certain of our results, so run it a few times:

$ python time2.py
1.000797986984253
$ python time2.py
1.0010130405426025
$ python time2.py
1.0010390281677246


As expected, it takes about a second to run. If it didn’t, either our timer or sleep() should be embarrassed.

There’s a handier way to measure code snippets like this: the standard module timeit. It has a function called (you guessed it) timeit(), which will run your test code count times and print some results. The syntax is: timeit.timeit( code, number, count ).

In the examples in this section, the code needs to be within quotes so that it is not executed after you press the Return key but is executed inside timeit(). (In the next section, you’ll see how to time a function by passing its name to timeit().) Let’s run our previous example just once and time it. Call this file timeit1.py:

from timeit import timeit
print(timeit('num = 5; num *= 2', number=1))


Run it a few times:

$ python timeit1.py
2.5600020308047533e-06
$ python timeit1.py
1.9020008039660752e-06
$ python timeit1.py
1.7380007193423808e-06


Again, these two code lines ran in about two millionths of a second. We can use the repeat argument of the timeit module’s repeat() function to run more sets. Save this as timeit2.py:

from timeit import repeat

print(repeat('num = 5; num *= 2', number=1, repeat=3))


Try running it to see what transpires:

$ python timeit2.py
[1.691998477326706e-06, 4.070025170221925e-07, 2.4700057110749185e-07]


The first run took two millionths of a second, and the second and third runs were faster. Why? There could be many reasons. For one thing, we’re testing a very small piece of code, and its speed could depend on what else the computer was doing in those instants, how the Python system optimizes calculations, and many other things.

Or, it could be just chance. Let’s try something more realistic than variable assignment and sleep. We’ll measure some code to help compare the efficiency of a few algorithms (program logic) and data structures (storage mechanisms).

——————————————

Optimize Your Code


Python is usually fast enough—until it isn’t. In many cases, you can gain speed by using a better algorithm or data structure. The trick is knowing where to do this. Even experienced programmers guess wrong surprisingly often. You need to be like the careful quiltmaker, and measure before you cut. And this leads us to timers.

——————————————

u can control the format of your logged messages. In our first example, our default gave us something similar to this:

WARNING:root:Message...


If you provide a format string to basicConfig(), you can change to the format of your preference:

>>> import logging
>>> fmt = '%(asctime)s %(levelname)s %(lineno)s %(message)s'
>>> logging.basicConfig(level='DEBUG', format=fmt)
>>> logger = logging.getLogger('bunyan')
>>> logger.error("Where's my other plaid shirt?")
2014-04-08 23:13:59,899 ERROR 1 Where's my other plaid shirt?


We let the logger send output to the screen again, but changed the format. The logging module recognizes a number of variable names in the fmt format string. We used asctime (date and time as an ISO 8601 string), levelname, lineno (line number), and the message itself. There are other built-ins, and you can provide your own variables, as well.

There’s much more to logging than this little overview can provide. You can log to more than one place at the same time, with different priorities and formats. The package has a lot of flexibility, but sometimes at the cost of simplicity.

——————————————

Logging Error Messages


At some point you might need to graduate from using print() statements to logging messages. A log is usually a system file that accumulates messages, often inserting useful information such as a timestamp or the name of the user who’s running the program. Often logs are rotated (renamed) daily and compressed; by doing so, they don’t fill up your disk and cause problems themselves. When something goes wrong with your program, you can look at the appropriate log file to see what happened. The contents of exceptions are especially useful in logs because they show you the actual line at which your program croaked, and why.

The standard Python library module is logging. I’ve found most descriptions of it somewhat confusing. After a while it makes more sense, but it does seem overly complicated at first. The logging module includes these concepts:

■ The message that you want to save to the log

■ Ranked priority levels and matching functions: debug(), info(), warn(), error(), and critical()

■ One or more logger objects as the main connection with the module

■ Handlers that direct the message to your terminal, a file, a database, or somewhere else

■ Formatters that create the output

■ Filters that make decisions based on the input


For the simplest logging example, just import the module and use some of its functions:

>>> import logging
>>> logging.debug("Looks like rain")
>>> logging.info("And hail")
>>> logging.warn("Did I hear thunder?")
WARNING:root:Did I hear thunder?
>>> logging.error("Was that lightning?")
ERROR:root:Was that lightning?
>>> logging.critical("Stop fencing and get inside!")
CRITICAL:root:Stop fencing and get inside!


Did you notice that debug() and info() didn’t do anything, and the other two printed LEVEL:root: before each message? So far, it’s like a print() statement with multiple personalities, some of them hostile.

But it is useful. You can scan for a particular value of LEVEL in a log file to find particular messages, compare timestamps to see what happened before your server crashed, and so on.

A lot of digging through the documentation answers the first mystery (we’ll get to the second one in a page or two): the default priority level is WARNING, and that got locked in as soon as we called the first function (logging.debug()). We can set the default level by using basicConfig(). DEBUG is the lowest level, so this enables it and all the higher levels to flow through:

>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> logging.debug("It's raining again")
DEBUG:root:It's raining again
>>> logging.info("With hail the size of hailstones")
INFO:root:With hail the size of hailstones


We did all that with the default logging functions, without actually creating a logger object. Each logger has a name. Let’s make one called bunyan:

>>> import logging
>>> logging.basicConfig(level='DEBUG')
>>> logger = logging.getLogger('bunyan')
>>> logger.debug('Timber!')
DEBUG:bunyan:Timber!


If the logger name contains any dot characters, they separate levels of a hierarchy of loggers, each with potentially different properties. This means that a logger named quark is higher than one named quark.charmed. The special root logger is at the top, and is called ''.

So far, we’ve just printed messages, which is not a great improvement over print(). We use handlers to direct the messages to different places. The most common is a log file, and here’s how you do it:

>>> import logging
>>> logging.basicConfig(level='DEBUG', filename='blue_ox.log')
>>> logger = logging.getLogger('bunyan')
>>> logger.debug("Where's my axe?")
>>> logger.warn("I need my axe")
>>>


Aha, the lines aren’t on the screen anymore; instead, they’re in the file named blue_ox.log:

DEBUG:bunyan:Where's my axe?
WARNING:bunyan:I need my axe


Calling basicConfig() with a filename argument created a FileHandler for you and made it available to your logger. The logging module includes at least 15 handlers to send messages to places such as email and web servers as well as the screen and files.

Finally, yo

——————————————

https://pythonprogramming.net/haar-cascade-object-detection-python-opencv-tutorial/

God, they must need VPS to training.

——————————————

可我感觉一直用鼠标都快用傻了，做什么都慢吞吞的。

——————————————

嗯，我用了4年点坏鼠标左键

——————————————

鼠标突然坏了


摆在我面前的只有两条路


一是用deepin, 全命令行操作

二是用Win，靠快捷键或辅助工具度日


不过，这两种都是进阶高手的道路

——————————————

它都说了

少调试，多自动化测试

——————————————

不知道，我才知道Python也有断点、单步这些调试功能

——————————————

Debug with pdb(3)


We could continue using s or n, hoping to spot something, but let’s use one of the main features of a debugger: breakpoints. A breakpoint stops execution at the line you indicate. In our case, we want to know why process_cities() bails out before it’s read all of the input lines. Line 3 (for line in file:) will read every line in the input file, so that seems innocent. The only other place where we could return from the function before reading all of the data is at line 6 (return). Let’s set a breakpoint on line 6:

(Pdb) b 6
Breakpoint 1 at /Users/williamlubanovic/book/capitals.py:6


Next, let’s continue the program until it either hits the breakpoint or reads all of the input lines and finishes normally:

(Pdb) c
 Buenos Aires,Argentina
 La Paz,Bolivia
 Brasilia,Brazil
 Santiago,Chile
 Bogotá,Colombia
 > /Users/williamlubanovic/book/capitals.py(6)process_cities()
 -> return


Aha, it stopped at our line 6 breakpoint. This indicates that the program wants to return early after reading the country after Colombia. Let’s print the value of line to see what we just read:

(Pdb) p line
'ecuador,quito'


What’s so special about—oh, never mind.
Really? *quit*o? Our manager never expected the string quit to turn up inside normal data, so using it as a sentinel (end indicator) value like this was a boneheaded idea. You march right in there and tell him that, while I wait here.

If at this point you still have a job, you can see all your breakpoints by using a plain b command:

(Pdb) b
Num Type         Disp Enb   Where
1   breakpoint   keep yes   at /Users/williamlubanovic/book/capitals.py:6
    breakpoint already hit 1 time


An l will show your code lines, the current line (->), and any breakpoints (B). A plain l will start listing from the end of your previous call to l, so include the optional starting line (here, let’s start from line 1):

(Pdb) l 1
  1      def process_cities(filename):
  2         with open(filename, 'rt') as file:
  3             for line in file:
  4                 line = line.strip()
  5                 if 'quit' in line.lower():
  6 B->                 return
  7                 country, city = line.split(',')
  8                 city = city.strip()
  9                 country = country.strip()
 10                 print(city.title(), country.title(), sep=',')
 11


Okay, let’s fix that quit test to only match the full line, not within other characters:
def process_cities(filename):

    with open(filename, 'rt') as file:
        for line in file:
            line = line.strip()
            if 'quit' == line.lower():
                return
            country, city = line.split(',')
            city = city.strip()
            country = country.strip()
            print(city.title(), country.title(), sep=',')

if __name__ == '__main__':
    import sys
    process_cities(sys.argv[1])


Once more, with feeling:

$ python capitals2.py cities2.csv
Buenos Aires,Argentina
La Paz,Bolivia
Brasilia,Brazil
Santiago,Chile
Bogotá,Colombia
Quito,Ecuador
Stanley,Falkland Islands
Cayenne,French Guiana
Georgetown,Guyana
Asunción,Paraguay
Lima,Peru
Paramaribo,Suriname
Montevideo,Uruguay
Caracas,Venezuela


That was a skimpy overview of the debugger—just enough to show you what it can do and what commands you’d use most of the time.

Remember: more tests, less debugging.

——————————————

Debug with pdb(2)


To use the debugger, import the pdb module from the command line by typing -m pdb, like so:

$ python -m pdb capitals.py cities2.csv
> /Users/williamlubanovic/book/capitals.py(1)<module>()
-> def process_cities(filename):
(Pdb)


This starts the program and places you at the first line. If you type c (continue), the program will run until it ends, either normally or with an error:

(Pdb) c
Buenos Aires,Argentina
La Paz,Bolivia
Brazilia,Brazil
Santiago,Chile
Bogotá,Colombia
The program finished and will be restarted
> /Users/williamlubanovic/book/capitals.py(1)<module>()
-> def process_cities(filename):


It completed normally, just as it did when we ran it earlier outside of the debugger. Let’s try again, using some commands to narrow down where the problem lies. It seems to be a logic error rather than a syntax problem or exception (which would have printed error messages).

Type s (step) to single-step through Python lines. This steps through all Python code lines: yours, the standard library’s, and any other modules you might be using. When you use s, you also go into functions and single-step within them. Type n (next) to single-step but not to go inside functions; when you get to a function, a single n causes the entire function to execute and take you to the next line of your program. Thus, use s when you’re not sure where the problem is; use n when you’re sure that a particular function isn’t the cause, especially if it’s a long function. Often you’ll single-step through your own code and step over library code, which is presumably well tested. We’ll use s to step from the beginning of the program, into the function process_cities():

(Pdb) s
 > /Users/williamlubanovic/book/capitals.py(12)<module>()
 -> if __name__ == '__main__':
(Pdb) s
 > /Users/williamlubanovic/book/capitals.py(13)<module>()
 -> import sys
(Pdb) s
 > /Users/williamlubanovic/book/capitals.py(14)<module>()
 -> process_cities(sys.argv[1])
(Pdb) s
 --Call--
 > /Users/williamlubanovic/book/capitals.py(1)process_cities()
 -> def process_cities(filename):
(Pdb) s
 > /Users/williamlubanovic/book/capitals.py(2)process_cities()
 -> with open(filename, 'rt') as file:


Type l (list) to see the next few lines of your program:

(Pdb) l
  1      def process_cities(filename):
  2  ->     with open(filename, 'rt') as file:
  3             for line in file:
  4                 line = line.strip()
  5                 if 'quit' in line.lower():
  6                     return
  7                 country, city = line.split(',')
  8                 city = city.strip()
  9                 country = country.strip()
 10                 print(city.title(), country.title(), sep=',')
 11
(Pdb)


The arrow (->) denotes the current line.

——————————————

Debug with pdb(1)


These techniques help, but sometimes there’s no substitute for a real debugger. Most IDEs include a debugger, with varying features and user interfaces. Here, I’ll describe use of the standard Python debugger, pdb.


Note

If you run your program with the -i flag, Python will drop you into its interactive interpreter if the program fails.


Here’s a program with a bug that depends on data—the kind of bug that can be particularly hard to find. This is a real bug from the early days of computing, and it baffled programmers for quite a while.

We’re going to read a file of countries and their capital cities, separated by a comma, and write them out as capital, country. They might be capitalized incorrectly, so we should fix that also when we print. Oh, and there might be extra spaces here and there, and you’ll want to get rid of those, too. Finally, although it would make sense for the program to just read to the end of the file, for some reason our manager told us to stop when we encounter the word quit (in any mixture of uppercase and lowercase characters). Here’s a sample data file:

France, Paris
venuzuela,caracas
  LithuniA,vilnius
     quit


Let’s design our algorithm (method for solving the problem). This is pseudocode—it looks like a program, but is just a way to explain the logic in normal language before converting it to an actual program. One reason programmers like Python is because it looks a lot like pseudocode, so there’s less work involved to convert it to a working program:

for each line in the text file:
    read the line
    strip leading and trailing spaces
    if `quit` occurs in the lower-case copy of the line:
        stop
    else:
        split the country and capital by the comma character
        trim any leading and trailing spaces
        convert the country and capital to titlecase
        print the capital, a comma, and the country


We need to strip initial and trailing spaces from the names because that was a requirement. Likewise for the lowercase comparison with quit and converting the city and country names to title case. That being the case, let’s whip out capitals.py, which is sure to work perfectly:

def process_cities(filename):
    with open(filename, 'rt') as file:
        for line in file:
            line = line.strip()
            if 'quit' in line.lower():
                return
            country, city = line.split(',')
            city = city.strip()
            country = country.strip()
            print(city.title(), country.title(), sep=',')

if __name__ == '__main__':
    import sys
    process_cities(sys.argv[1])


Let’s try it with that sample data file we made earlier. Ready, fire, aim:

$ python capitals.py  cities1.csv
Paris,France
Caracas,Venuzuela
Vilnius,Lithunia


Looks great! It passed one test, so let’s put it in production, processing capitals and countries from around the world—until it fails, but only for this data file:

argentina,buenos aires
bolivia,la paz
brazil,brasilia
chile,santiago
colombia,Bogotá
ecuador,quito
falkland islands,stanley
french guiana,cayenne
guyana,georgetown
paraguay,Asunción
peru,lima
suriname,paramaribo
uruguay,montevideo
venezuela,caracas
quit


The program ends after printing only 5 lines of the 15 in the data file, as demonstrated here:

$ python capitals.py  cities2.csv
Buenos Aires,Argentina
La Paz,Bolivia
Brazilia,Brazil
Santiago,Chile
Bogotá,Colombia


What happened? We can keep editing capitals.py, putting print() statements in likely places, but let’s see if the debugger can help us.

——————————————

http://ml.memect.com/article/machine-learning-guide.html

——————————————

老是装不上pyopencl

说是缺gcc

装了python-dev也不行



后端的环境配置真是让我喷血

——————————————

那个是Python2.7

我是3，我担心…




算了，换到deepin环境看看

——————————————

链接给我看看

我觉得这个很好，可以学习

——————————————

故意的，我没找到能用的Python版

——————————————

http://waifu2x.me/?lan=en

——————————————

Debugging Python Code


Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
— Brian Kernighan

Test first. The better your tests are, the less you’ll have to fix later. Yet, bugs happen and need to be fixed when they’re found later. Again, the simplest way to debug in Python is to print out strings. Some useful things to print include vars(), which extracts the values of your local variables, including function arguments:

 >>> def func(*args, **kwargs):
 ...     print(vars())
 ...
 >>> func(1, 2, 3)
 {'args': (1, 2, 3), 'kwargs': {}}
 >>> func(['a', 'b', 'argh'])
 {'args': (['a', 'b', 'argh'],), 'kwargs': {}}


As you read in Decorators, a decorator can call code before or after a function without modifying the code within the function itself. This means that you can use a decorator to do something before or after any Python function, not just ones that you wrote. Let’s define the decorator dump to print the input arguments and output values of any function as it’s called (designers know that a dump often needs decorating):

def dump(func):
    "Print input arguments and output value(s)"
    def wrapped(*args, **kwargs):
        print("Function name: %s" % func.__name__)
        print("Input arguments: %s" % ' '.join(map(str, args)))
        print("Input keyword arguments: %s" % kwargs.items())
        output = func(*args, **kwargs)
        print("Output:", output)
        return output
    return wrapped


Now the decoratee. This is a function called double() that expects numeric arguments, either named or unnamed, and returns them in a list with their values doubled:

from dump1 import dump

@dump
def double(*args, **kwargs):
    "Double every argument"
    output_list = [ 2 * arg for arg in args ]
    output_dict =  { k:2*v for k,v in kwargs.items() }
    return output_list, output_dict

if __name__ == '__main__':
    output = double(3, 5, first=100, next=98.6, last=-40)


Take a moment to run it:

$ python test_dump.py
Function name: double
Input arguments: 3 5
Input keyword arguments: dict_items([('last', -40), ('first', 100),
 ('next', 98.6)])
Output: ([6, 10], {'last': -80, 'first': 200, 'next': 197.2})

——————————————

Continuous Integration


When your group is cranking out a lot of code daily, it helps to automate tests as soon as changes arrive. You can automate source control systems to run tests on all code as it’s checked in. This way, everyone knows if someone broke the build and just disappeared for an early lunch.

These are big systems, and I’m not going into installation and usage details here. In case you need them someday, you’ll know where to find them:

buildbot 
Written in Python, this source control system automates building, testing, and releasing.

jenkins 
This is written in Java and seems to be the preferred CI tool of the moment.

travis-ci 
This automates projects hosted at GitHub, and it’s free for open source projects.

——————————————

Other Test Frameworks


For some reason, people like to write Python test frameworks. If you’re curious, you can check out some other popular ones, including tox and py.test.

——————————————

Test with nose


The third-party package called nose is another alternative to unittest. Here’s the command to install it:

$ pip install nose


You don’t need to create a class that includes test methods, as we did with unittest. Any function with a name matching test somewhere in its name will be run. Let’s modify our last version of our unittest tester and save it as test_cap_nose.py:

import cap
from nose.tools import eq_

def test_one_word():
    text = 'duck'
    result = cap.just_do_it(text)
    eq_(result, 'Duck')

def test_multiple_words():
    text = 'a veritable flock of ducks'
    result = cap.just_do_it(text)
    eq_(result, 'A Veritable Flock Of Ducks')

def test_words_with_apostrophes():
    text = "I'm fresh out of ideas"
    result = cap.just_do_it(text)
    eq_(result, "I'm Fresh Out Of Ideas")

def test_words_with_quotes():
    text = "\"You're despicable,\" said Daffy Duck"
    result = cap.just_do_it(text)
    eq_(result, "\"You're Despicable,\" Said Daffy Duck")


Run the tests:

$ nosetests test_cap_nose.py
 ...F
 ======================================================================
 FAIL: test_cap_nose.test_words_with_quotes
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/Users/.../site-packages/nose/case.py", line 198, in runTest
     self.test(*self.arg)
   File "/Users/.../book/test_cap_nose.py", line 23, in test_words_with_quotes
     eq_(result, "\"You're Despicable,\" Said Daffy Duck")
 AssertionError: '"you\'re Despicable," Said Daffy Duck'
     != '"You\'re Despicable," Said Daffy Duck'

 ----------------------------------------------------------------------
 Ran 4 tests in 0.005s

 FAILED (failures=1)


This is the same bug we found when we used unittest for testing; fortunately, there’s an exercise to fix it at the end of this chapter.

——————————————

Test with doctest


The second test package in the standard library is doctest. With this package, you can write tests within the docstring itself, also serving as documentation. It looks like the interactive interpreter: the characters >>>, followed by the call, and then the results on the following line. You can run some tests in the interactive interpreter and just paste the results into your test file. We’ll modify cap.py (without that troublesome last test with quotes):

def just_do_it(text):
    """
    >>> just_do_it('duck')
    'Duck'
    >>> just_do_it('a veritable flock of ducks')
    'A Veritable Flock Of Ducks'
    >>> just_do_it("I'm fresh out of ideas")
    "I'm Fresh Out Of Ideas"
    """
    from string import capwords
    return capwords(text)

if __name__ == '__main__':
    import doctest
    doctest.testmod()


When you run it, it doesn’t print anything if all tests passed:

$ python cap.py


Give it the verbose (-v) option to see what actually happened:

$ python cap.py -v
 Trying:
     just_do_it('duck')
 Expecting:
     'Duck'
 ok
 Trying:
     just_do_it('a veritable flock of ducks')
 Expecting:
     'A Veritable Flock Of Ducks'
 ok
 Trying:
     just_do_it("I'm fresh out of ideas")
 Expecting:
     "I'm Fresh Out Of Ideas"
 ok
 1 items had no tests:
     __main__
 1 items passed all tests:
    3 tests in __main__.just_do_it
 3 tests in 2 items.
 3 passed and 0 failed.
 Test passed.

——————————————

Test with unittest(2)


Consequently, we need another function. Gazing down that page a bit, we find title(). So, let’s change cap.py to use title() instead of capitalize():

def just_do_it(text):
    return text.title()


Rerun the tests, and let’s see what happens:

$ python test_cap.py
 ..
 ----------------------------------------------------------------------
 Ran 2 tests in 0.000s

 OK


Everything is great. Well, actually, they’re not. We need to add at least one more method to test_cap.py:

    def test_words_with_apostrophes(self):
        text = "I'm fresh out of ideas"
        result = cap.just_do_it(text)
        self.assertEqual(result, "I'm Fresh Out Of Ideas")


Go ahead and try it again:

$ python test_cap.py
 ..F
 ======================================================================
 FAIL: test_words_with_apostrophes (__main__.TestCap)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "test_cap.py", line 25, in test_words_with_apostrophes
     self.assertEqual(result, "I'm Fresh Out Of Ideas")
 AssertionError: "I'M Fresh Out Of Ideas" != "I'm Fresh Out Of Ideas"
 - I'M Fresh Out Of Ideas
 ?   ^
 + I'm Fresh Out Of Ideas
 ?   ^


 ----------------------------------------------------------------------
 Ran 3 tests in 0.001s

 FAILED (failures=1)


Our function capitalized the m in I'm. A quick run back to the documentation for title() shows that it doesn’t handle apostrophes well. We really should have read the entire text first.

At the bottom of the standard library’s string documentation is another candidate: a helper function called capwords(). Let’s use it in cap.py:

def just_do_it(text):
    from string import capwords
    return capwords(text)
$ python test_cap.py
 ...
 ----------------------------------------------------------------------
 Ran 3 tests in 0.004s

 OK


At last, we’re finally done! Uh, no. One more test to add to test_cap.py:

    def test_words_with_quotes(self):
        text = "\"You're despicable,\" said Daffy Duck"
        result = cap.just_do_it(text)
        self.assertEqual(result, "\"You're Despicable,\" Said Daffy Duck")


Did it work?

$ python test_cap.py
 ...F
 ======================================================================
 FAIL: test_words_with_quotes (__main__.TestCap)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "test_cap.py", line 30, in test_words_with_quotes
     self.assertEqual(result, "\"You're
     Despicable,\" Said Daffy Duck")
 AssertionError: '"you\'re Despicable," Said Daffy Duck'
  != '"You\'re Despicable," Said Daffy Duck'
 - "you're Despicable," Said Daffy Duck
 ?  ^
 + "You're Despicable," Said Daffy Duck
 ?  ^


 ----------------------------------------------------------------------
 Ran 4 tests in 0.004s

 FAILED (failures=1)


It looks like that first double quote confused even capwords, our favorite capitalizer thus far. It tried to capitalize the ", and lowercased the rest (You're). We should have also tested that our capitalizer left the rest of the string untouched.

People who do testing for a living have a knack for spotting these edge cases, but developers often have blind spots when it comes to their own code.

unittest provides a small but powerful set of assertions, letting you check values, confirm whether you have the class you want, determine whether an error was raised, and so on.

——————————————

Test with unittest(1)


We’ve verified that we’re no longer insulting the style senses of the code gods, so let’s move on to actual tests of the logic in your program.

It’s a good practice to write independent test programs first, to ensure that they all pass before you commit your code to any source control system. Writing tests can seem tedious at first, but they really do help you find problems faster—especially regressions (breaking something that used to work). 

Painful experience teaches all developers that even the teeniest change, which they swear could not possibly affect anything else, actually does. If you look at well-written Python packages, they always include a test suite.

The standard library contains not one, but two test packages. Let’s start with unittest. We’ll write a module that capitalizes words. Our first version just uses the standard string function capitalize(), with some unexpected results as we’ll see. Save this as cap.py:

def just_do_it(text):
    return text.capitalize()


The basis of testing is to decide what outcome you want from a certain input (here, you want the capitalized version of whatever text you input), submit the input to the function you’re testing, and then check whether it returned the expected results. The expected result is called an assertion, so in unittest you check your results by using methods with names that begin with assert, like the assertEqual method shown in the following example.

Save this test script as test_cap.py:

import unittest
import cap

class TestCap(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_one_word(self):
        text = 'duck'
        result = cap.just_do_it(text)
        self.assertEqual(result, 'Duck')

    def test_multiple_words(self):
        text = 'a veritable flock of ducks'
        result = cap.just_do_it(text)
        self.assertEqual(result, 'A Veritable Flock Of Ducks')


if __name__ == '__main__':
    unittest.main()


The setUp() method is called before each test method, and the tearDown() method is called after each. Their purpose is to allocate and free external resources needed by the tests, such as a database connection or some test data. In this case, our tests are self-contained, and we wouldn’t even need to define setUp() and tearDown(), but it doesn’t hurt to have empty versions there. The heart of our test is the two functions named test_one_word() and test_multiple_words(). Each runs the just_do_it() function we defined with different input and checks whether we got back what we expect.

Okay, let’s run it. This will call our two test methods:

$ python test_cap.py
 F.
 ======================================================================
 FAIL: test_multiple_words (__main__.TestCap)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "test_cap.py", line 20, in test_multiple_words
  self.assertEqual(result, 'A Veritable Flock Of Ducks')
 AssertionError: 'A veritable flock of ducks' != 'A Veritable Flock Of Ducks'
 - A veritable flock of ducks
 ?   ^         ^     ^  ^
 + A Veritable Flock Of Ducks
 ?   ^         ^     ^  ^


 ----------------------------------------------------------------------
 Ran 2 tests in 0.001s

 FAILED (failures=1)


It liked the first test (test_one_word) but not the second (test_multiple_words). The up arrows (^) shows where the strings actually differed.

What’s special about multiple words? Reading the documentation for the string capitalize function yields an important clue: 

it capitalizes only the first letter of the first word. Maybe we should have read that first.

——————————————

I recommend you to use pep8.

——————————————

Check with pylint, pyflakes, and pep8


The next step, before creating actual test programs, is to run a Python code checker. The most popular are pylint and pyflakes. You can install either or both by using pip:

$ pip install pylint
$ pip install pyflakes


These check for actual code errors (such as referring to a variable before assigning it a value) and style faux pas (the code equivalent of wearing plaids and stripes). Here’s a fairly meaningless program with a bug and style issue:

a = 1
b = 2
print(a)
print(b)
print(c)


Here’s the initial output of pylint:

$ pylint style1.py
No config file found, using default configuration
************* Module style1
C:  1,0: Missing docstring
C:  1,0: Invalid name "a" for type constant
  (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C:  2,0: Invalid name "b" for type constant
  (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
E:  5,6: Undefined variable 'c'


Much further down, under Global evaluation, is our score (10.0 is perfect):

Your code has been rated at -3.33/10


Ouch. Let’s fix the bug first. That pylint output line starting with an E indicates an Error, which occurred because we didn’t assign a value to c before we printed it. Let’s fix that:

a = 1
b = 2
c = 3
print(a)
print(b)
print(c)


$ pylint style2.py
No config file found, using default configuration
************* Module style2
C:  1,0: Missing docstring
C:  1,0: Invalid name "a" for type constant
  (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C:  2,0: Invalid name "b" for type constant
  (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C:  3,0: Invalid name "c" for type constant
  (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)


Good, no more E lines. And our score jumped from -3.33 to 4.29:

Your code has been rated at 4.29/10


pylint wants a docstring (a short text at the top of a module or function, describing the code), and it thinks short variable names such as a, b, and c are tacky. Let’s make pylint happier and improve style2.py to style3.py:

"Module docstring goes here"

def func():
    "Function docstring goes here. Hi, Mom!"
    first = 1
    second = 2
    third = 3
    print(first)
    print(second)
    print(third)
func()


$ pylint style3.py
No config file found, using default configuration


Hey, no complaints. And our score?

Your code has been rated at 10.00/10


Not too shabby at all, right?

Another style checker is pep8, which you can install in the usual way:

$ pip install pep8


What does it say about our style makeover?

$ pep8 style3.py
style3.py:3:1: E302 expected 2 blank lines, found 1


To be really stylish, it’s recommending that I add a blank line after the initial module docstring.

——————————————

Testing Your Code


Once in a while, I’ll make some trivial code change and say to myself, “Looks good, ship it.” And then it breaks. Oops. Every time I do this (thankfully, less and less over time) I feel like a doofus, and I swear to write even more tests next time.

The very simplest way to test Python programs is to add print() statements. The Python interactive interpreter’s Read-Evaluate-Print Loop (REPL) lets you edit and test changes quickly. However, you probably don’t want print() statements in production code, so you need to remember to take them all out. Furthermore, cut-and-paste errors are really easy to make.

——————————————

Just some example, don't so anxious.

——————————————

Name and Document


You won’t remember what you wrote. There are times when I look at code I wrote even recently and wonder where on earth it came from. That’s why it helps to document your code. Documentation can include comments and docstrings, but it can also incorporate informative naming of variables, functions, modules, and classes. Don’t be obsessive, as in this example:

>>> # I'm going to assign 10 to the variable "num" here:
... num = 10
>>> # I hope that worked
... print(num)
10
>>> # Whew.


Instead, say why you assigned the value 10. Point out why you called the variable num. If you were writing the venerable Fahrenheit to Celsius converter, you might name variables to explain what they do, rather than a lump of magic code. And a little test code wouldn’t hurt:

def ftoc(f_temp):
    "Convert Fahrenheit temperature <f_temp> to Celsius and return it."
    f_boil_temp = 212.0
    f_freeze_temp = 32.0
    c_boil_temp = 100.0
    c_freeze_temp = 0.0
    f_range = f_boil_temp - f_freeze_temp
    c_range = c_boil_temp - c_freeze_temp
    f_c_ratio = c_range / f_range
    c_temp = (f_temp - f_freeze_temp) * f_c_ratio + c_freeze_temp
    return c_temp

if __name__ == '__main__':
    for f_temp in [-40.0, 0.0, 32.0, 100.0, 212.0]:
        c_temp = ftoc(f_temp)
        print('%f F => %f C' % (f_temp, c_temp))


Let’s run the tests:

$ python ftoc1.py
-40.000000 F => -40.000000 C
0.000000 F => -17.777778 C
32.000000 F => 0.000000 C
100.000000 F => 37.777778 C
212.000000 F => 100.000000 C


We can make (at least) two improvements:

■ Python doesn’t have constants, but the PEP8 stylesheet recommends using capital letters and underscores (e.g., ALL_CAPS) when naming variables that should be considered constants. Let’s rename those constant-y variables in our example.

■ Because we precompute values based on constant values, let’s move them to the top level of the module. Then, they’ll only be calculated once rather than in every call to the ftoc() function.

Here’s the result of our rework:

F_BOIL_TEMP = 212.0
F_FREEZE_TEMP = 32.0
C_BOIL_TEMP = 100.0
C_FREEZE_TEMP = 0.0
F_RANGE = F_BOIL_TEMP - F_FREEZE_TEMP
C_RANGE = C_BOIL_TEMP - C_FREEZE_TEMP
F_C_RATIO = C_RANGE / F_RANGE

def ftoc(f_temp):
    "Convert Fahrenheit temperature <f_temp> to Celsius and return it."
    c_temp = (f_temp - F_FREEZE_TEMP) * F_C_RATIO + C_FREEZE_TEMP
    return c_temp

if __name__ == '__main__':
    for f_temp in [-40.0, 0.0, 32.0, 100.0, 212.0]:
        c_temp = ftoc(f_temp)
        print('%f F => %f C' % (f_temp, c_temp))

——————————————

Integrated Development Environments


I’ve used a plain-text interface for programs in this book, but that doesn’t mean that you need to run everything in a console or text window. There are many free and commercial integrated development environments (IDEs), which are GUIs with support for such tools as text editors, debuggers, library searching, and so on.

IDLE
IDLE is the only Python IDE that’s included with the standard distribution. It’s based on tkinter, and its GUI is plain.

PyCharm
PyCharm is a recent graphic IDE with many features. The community edition is free, and you can get a free license for the professional edition to use in a classroom or an open source project. Figure 12-1 shows its initial display.

IPython
iPython, which you can see in Appendix C, is a publishing platform as well as an extensive IDE.

——————————————

suffix
后缀

distribution
分布

restricted
限制

installer
安装程序

——————————————

constantly
不断地

mostly
主要是

monty
蒙蒂

module
模块

formerly
以前

sports
体育

repository
存储库

index
指数

currently
目前

python
python

solution
解决方案

——————————————

analyze
分析

operating
操作

elusive
难以捉摸的

experimental
实验

correctly
正确

graphics
图形

programmer
程序员

based
基于

program
程序

personality
个性

delve
深入研究

logical
逻辑

aptitude
资质

original
原始

logically
在逻辑上

creative
有创意的

——————————————

Install from Source


Occasionally, a Python package is new, or the author hasn’t managed to make it available with pip. To build the package, you generally do the following:

1. Download the code.

2. Extract the files by using zip, tar, or another appropriate tool if they’re archived or compressed.

3. Run python install setup.py in the directory containing a setup.py file.


Note

As always, be careful what you download and install. It’s a little harder to hide malware in Python programs, which are readable text, but it has happened.

——————————————

Use a Package Manager


Apple’s OS X includes the third-party packagers homebrew (brew) and ports. They work a little like pip, but aren’t restricted to Python packages.

Linux has a different manager for each distribution. The most popular are apt-get, yum, dpkg, and zypper.

Windows has the Windows Installer and package files with a .msi suffix. If you installed Python for Windows, it was probably in the MSI format.

——————————————

Use pip


Python packaging has had some limitations. An earlier installation tool called easy_install has been replaced by one called pip, but neither had been in the standard Python installation. If you’re supposed to install things by using pip, from where did you get pip? Starting with Python 3.4, pip will finally be included with the rest of Python to avoid such existential crises. If you’re using an earlier version of Python 3 and don’t have pip, you can get it from http://www.pip-installer.org.

The simplest use of pip is to install the latest version of a single package by using the following command:

$ pip install flask


You will see details on what it’s doing, just so you don’t think it’s goofing off: downloading, running setup.py, installing files on your disk, and other details.

You can also ask pip to install a specific version:

$ pip install flask==0.9.0


Or, a minimum version (this is useful when some feature that you can’t live without turns up in a particular version):

$ pip install 'flask>=0.9.0'


In the preceding example, those single quotes prevent the > from being interpreted by the shell to redirect output to a file called =0.9.0.

If you want to install more than one Python package, you can use a requirements file. Although it has many options, the simplest use is a list of packages, one per line, optionally with a specific or relative version:

$ pip -r requirements.txt


Your sample requirements.txt file might contain this:

flask==0.9.0
django
psycopg2

——————————————

Install Packages


There are three ways to install Python packages:

■ Use pip if you can. You can install most of the Python packages you’re likely to encounter with pip.

■ Sometimes, you can use a package manager for your operating system.

■ Install from source.


If you’re interested in several packages in the same area, you might find a Python distribution that already includes them. For instance, in Appendix C, you can try out a number of numeric and scientific programs that would be tedious to install individually but are included with distributions such as Anaconda.

——————————————

Find Python Code


When you need to develop some code, the fastest solution is to steal it. Well…that is, from a source from which you’re allowed to steal code.

The Python standard library is wide, deep, and mostly clear. Dive in and look for those pearls.

Like the halls of fame for various sports, it takes time for a module to get into the standard library. New packages are appearing outside constantly, and throughout this book I’ve highlighted some that either do something new or do something old better. Python is advertised as batteries included, but you might need a new kind of battery.

So where, outside the standard library, should you look for good Python code?

The first place to look is the Python Package Index (PyPI). Formerly named the Cheese Shop after a Monty Python skit, this site is constantly updated with Python packages—over 39,000 as I write this. When you use pip (see the next section), it searches PyPI. The main PyPI page shows the most recently added packages. You can also conduct a direct search.

Another popular repository is GitHub. See what Python packages are currently popular.

Popular Python recipes has over four thousand short Python programs on every subject.

——————————————

About Programming


First, a few notes about programming, based on personal experience.

My original career path was science, and I taught myself programming to analyze and display experimental data. I expected computer programming to be like my impression of accounting—precise but dull. I was surprised to find that I enjoyed it. Part of the fun was its logical aspects—like solving puzzles—but part was creative. You had to write your program correctly to get the right results, but you had the freedom to write it any way you wanted. It was an unusual balance of right-brain and left-brain thinking.

After I wandered off into a career in programming, I also learned that the field had many niches, with very different tasks and types of people. You could delve into computer graphics, operating systems, business applications—even science.

If you’re a programmer, you might have had a similar experience yourself. If you’re not, you might try programming a bit to see if it fits your personality, or at least helps you to get something done. As I may have mentioned much earlier in this book, math skills are not so important. It seems that the ability to think logically is most important, and that an aptitude for languages seems to help. Finally, patience helps, especially when you’re tracking down an elusive bug in your code.

——————————————

f.lux makes your computer screen look like the room you're in, all the time. When the sun sets, it makes your computer look like your indoor lights. In the morning, it makes things look like sunlight again.

https://justgetflux.com/

——————————————

Chapter 12. Be a Pythonista


Always wanted to travel back in time to try fighting a younger version of yourself? Software development is the career for you!
—Elliot Loh

This chapter is devoted to the art and science of Python development, with “best practice” recommendations. Absorb them, and you too can be a card-carrying Pythonista.

——————————————

顺便可以告诉她，易语言没卵用

——————————————

你把这个群的软件包发给他就好了

——————————————

11.3 Try the same with XMLRPC.


xmlrpc_time_server.py:

from xmlrpc.server import SimpleXMLRPCServer

def a_function(text):
    if text == 'time':
        from datetime import datetime
        return str(datetime.utcnow())

server = SimpleXMLRPCServer(('127.0.0.1', 6789))
server.register_function(a_function, 'a_function')
server.serve_forever()



xmlrpc_client.py:

import xmlrpc.client

proxy = xmlrpc.client.ServerProxy('http://127.0.0.1:6789/')
result = proxy.a_function('time')
print(result)

——————————————

11.2 Use ZeroMQ REQ and REP sockets to do the same thing.


Firstly, you’ll need to install the Python ZeroMQ library by this command:

$ python -m pip install --upgrade pip
$ pip install pyzmq


zmq_time_server.py:

import zmq
from datetime import datetime

print('Starting the server at', datetime.now())
print('Waiting for a client to call.')
server = zmq.Context().socket(zmq.REP)
server.bind('tcp://{host}:{port}'.format(host='127.0.0.1', port=6789))

data = server.recv()
if data == b'time':
    server.send(str(datetime.utcnow()).encode('utf-8'))



zmq_client.py:

import zmq
from datetime import datetime

print('Starting the client at', datetime.now())
client = zmq.Context().socket(zmq.REQ)
client.connect('tcp://{host}:{port}'.format(host='127.0.0.1', port=6789))

client.send(b'time')

date = client.recv()
print('Now time is', date)

——————————————

11.1 Use a plain socket to implement a current-time-service. When a client sends the string time to the server, return the current date and time as an ISO string.

 udp_time_server.py:

import socket
from datetime import datetime

address = ('localhost', 6789)
max_size = 4096

print('Starting the server at', datetime.now())
print('Waiting for a client to call.')
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# AF_INET means we’ll create an Internet (IP) socket; 
#SOCK_DGRAM means we’ll send and receive datagrams—in other words, we’ll use UDP.

#What is UDP (User Datagram Protocol)?
#This is used for short exchanges. A datagram is a tiny message sent in a single burst, like a note on a postcard.

server.bind(address)

data, client = server.recvfrom(max_size)
if data == b'time':
    server.sendto(str(datetime.utcnow()).encode('utf-8'), client)
    server.close()



udp_client.py:

import socket
from datetime import datetime

server_address = ('localhost', 6789)
max_size = 4096
print('Starting the client at', datetime.now())
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

client.sendto(b'time', server_address)

date, server = client.recvfrom(max_size)
print('Now time is', date)
client.close()

——————————————

用了几天时间做了一个依据我词汇量，自动扒文章中生词并翻译的功能



熟悉了nltk



but...

Introducing Python 还没看完，有些堕落啊，目前这章的题涉及分发、同步、异步任务处理什么的…


好了，不说了，明天继续看书

——————————————

我有半年没见过360了

——————————————

http://www.nltk.org/book

Natural language processing 要用到的东西，这本书上都有

实际上它就是nltk的教程

——————————————

http://www.nltk.org/book

——————————————

我就笑笑
不说话

——————————————

秒杀C++😃

——————————————

http://pyhome.org/

——————————————

https://www.python.org/dev/peps/pep-0008/

——————————————

import nltk

#tag text
#词性标注
def tag(text):
    words = nltk.word_tokenize(text)
    return nltk.pos_tag(words)

#CC是连接词，RB是副词，IN是介词，NN是名次，JJ是形容词
print(tag('And now for something completely different'))

——————————————

#PorterStemmer
#英文词干提取

import nltk
porter = nltk.PorterStemmer()
print(porter.stem('lying'))

——————————————

欲前进，一定不看中文资料

欲更进，一定多用数学思想解决实际问题

——————————————

Things to Do

——————————————

Telemetry
遥测

metrics
指标

metering
计量

incubation
孵化

explanatory
说明

dashboard
仪表盘

vendors
供应商

accelerating
加速

proprietary
专有的

——————————————

OpenStack


The second most popular cloud service provider has been Rackspace. In 2010, it formed an unusual partnership with NASA to merge some of their cloud infrastructure into OpenStack. This is a freely available open source platform to build public, private, and hybrid clouds. A new release is made every six months, the most recent containing over 1.25 million lines of Python from many contributors. OpenStack is used in production by a growing number of organizations, including CERN and PayPal.

OpenStack’s main APIs are RESTful, with Python modules providing programmatic interfaces, and command-line Python programs for shell automation. Here are some of the standard services in the current release:

Keystone 
Identity service, providing authentication (for example, user/password), authorization (capabilities), and service discovery.

Nova 
Compute service, distributing work across networked servers.

Swift 
Object storage, such as Amazon’s S3. It’s used by Rackspace’s Cloud Files service.

Glance 
Mid-level image storage service.

Cinder 
Low-level block storage service.Horizon Web-based dashboard for all the services.

Neutron 
Network management service.

Heat 
Orchestration (multicloud) service.

Ceilometer 
Telemetry (metrics, monitoring, and metering) service.


Other services are proposed from time to time, which then go through an incubation process and might become part of the standard OpenStack platform.

OpenStack runs on Linux or within a Linux virtual machine (VM). The installation of its core services is still somewhat involved. The fastest way to install OpenStack on Linux is to use Devstack and watch all the explanatory text flying by as it runs. You’ll end up with a web dashboard that can view and control the other services.

If you want to install some or all of OpenStack manually, use your Linux distribution’s package manager. All of the major Linux vendors support OpenStack and are providing official packages on their download servers. Browse the main OpenStack site for installation documents, news, and related information.

OpenStack development and corporate support are accelerating. It’s been compared to Linux when it was disrupting the proprietary Unix versions.

——————————————

thereabouts
在那附近

henceforth
从今以后

memo
备忘录

Elastic
有弹性的

——————————————

Amazon


As Amazon was growing from hundreds to thousands to millions of servers, developers ran into all the nasty problems of distributed systems. One day in 2002 or thereabouts, CEO Jeff Bezos declared to Amazon employees that, henceforth, all data and functionality needed to be exposed only via network service interfaces—not files, or databases, or local function calls. They had to design these interfaces as though they were being offered to the public. The memo ended with a motivational nugget: “Anyone who doesn’t do this will be fired.”

Not surprisingly, developers got to work, and over time built a very large service-oriented architecture. They borrowed or innovated many solutions, evolving into Amazon Web Services (AWS), which now dominates the market. It now contains dozens of services, but the most relevant are the following:

Elastic Beanstalk 
High-level application platform

EC2 (Elastic Compute) 
Distributed computing

S3 (Simple Storage Service) 
Object storage

RDS 
Relational databases (MySQL, PostgreSQL, Oracle, MSSQL)

DynamoDB 
NoSQL database

Redshift 
Data warehouse

EMR 
Hadoop


For details on these and other AWS services, download the Amazon Python SDK and read the help section.

The official Python AWS library, boto, is another footdragger, not yet fully ported to Python 3. You’ll need to use Python 2, or try an alternative, which you can do by searching the Python Package Index for “aws” or “amazon.”

——————————————

deploy
部署

——————————————

Google


Google uses Python a lot internally, and it employs some prominent Python developers (even Guido van Rossum himself, for some time).

Go to the App Engine site and then, under “Choose a Language,” click in the Python box. You can type Python code into the Cloud Playground and see results just below. Just after that are links and directions to download the Python SDK to your machine. This allows you to develop against Google’s cloud APIs on your own hardware. Following this are details on how to deploy your application to AppEngine itself.

From Google’s main cloud page, you can find details on its services, including these:

App Engine 
A high-level platform, including Python tools such as flask and django.

Compute Engine 
Create clusters of virtual machines for large distributed computing tasks.

Cloud Storage 
Object storage (objects are files, but there are no directory hierarchies).Cloud Datastore A large NoSQL database.

Cloud SQL 
A large SQL database.

Cloud Endpoints 
Restful access to applications.BigQuery Hadoop-like big data.


Google services compete with Amazon and OpenStack, a segue if there ever was one.

——————————————

novelty
新奇的事物

fee
费

leased
租赁

redundantly
多余地

fallacies
谬论

Latency
潜在因素

Bandwidth
带宽

infinite
无限

Topology
拓扑结构

homogeneous
同等的

livestock
牲畜

maintenance
维护

dashboards
指示板

elastic
有弹性的

alerted
提醒

exceeds
超过

threshold
阈值

corporate
企业

spiked
飙升

——————————————

Working in the Clouds


Not so long ago, you would buy your own servers, bolt them into racks in data centers, and install layers of software on them: operating systems, device drivers, file systems, databases, web servers, email servers, name servers, load balancers, monitors, and more. Any initial novelty wore off as you tried to keep multiple systems alive and responsive. And you worried constantly about security.

Many hosting services offered to take care of your servers for a fee, but you still leased the physical devices and had to pay for your peak load configuration at all times.

With more individual machines, failures are no longer infrequent: they’re very common. You need to scale services horizontally and store data redundantly. You can’t assume that the network operates like a single machine. The eight fallacies of distributed computing, according to Peter Deutsch, are as follows:

■ The network is reliable.
■ Latency is zero.
■ Bandwidth is infinite.
■ The network is secure.
■ Topology doesn’t change.
■ There is one administrator.
■ Transport cost is zero.
■ The network is homogeneous.


You can try to build these complex distributed systems, but it’s a lot of work, and a different toolset is needed. To borrow an analogy, when you have a handful of servers, you treat them like pets—you give them names, know their personalities, and nurse them back to health when needed. But at scale, you treat servers more like livestock: they look alike, have numbers, and are just replaced if they have any problems.

Instead of building, you can rent servers in the cloud. By adopting this model, maintenance is someone else’s problem, and you can concentrate on your service, or blog, or whatever you want to show the world. Using web dashboards and APIs, you can spin up servers with whatever configuration you need, quickly and easily—they’re elastic. 

You can monitor their status, and be alerted if some metric exceeds a given threshold. Clouds are currently a pretty hot topic, and corporate spending on cloud components has spiked.

Let’s see how Python interacts with some popular clouds.

——————————————

vinyl
黑胶唱片

consecutive
连续

exceeds
超过

batch
批处理

rival
竞争对手

Alas
唉

parallel
平行

——————————————

Big Fat Data and MapReduce


As Google and other Internet companies grew, they found that traditional computing solutions didn’t scale. Software that worked for single machines, or even a few dozen, could not keep up with thousands.

Disk storage for databases and files involved too much seeking, which requires mechanical movement of disk heads. (Think of a vinyl record, and the time it takes to move the needle from one track to another manually. And think of the screeching sound it makes when you drop it too hard, not to mention the sounds made by the record’s owner.) But you could stream consecutive segments of the disk more quickly.

Developers found that it was faster to distribute and analyze data on many networked machines than on individual ones. They could use algorithms that sounded simplistic, but actually worked better overall with massively distributed data. One of these is MapReduce, which spreads a calculation across many machines and then gathers the results. It’s similar to working with queues.

After Google published its results in a paper, Yahoo followed with an open source Java-based package named Hadoop (named after the toy stuffed elephant of the lead programmer’s son).

The phrase big data applies here. Often it just means “data too big to fit on my machine”: data that exceeds the disk, memory, CPU time, or all of the above. To some organizations, if big data is mentioned somewhere in a question, the answer is always Hadoop. Hadoop copies data among machines, running them through map and reduce programs, and saving the results on disk at each step.

This batch process can be slow. A quicker method called Hadoop streaming works like Unix pipes, streaming the data through programs without requiring disk writes at each step. You can write Hadoop streaming programs in any language, including Python.
Many Python modules have been written for Hadoop, and some are discussed in the blog post “A Guide to Python Frameworks for Hadoop”. The Spotify company, known for streaming music, open sourced its Python component for Hadoop streaming, Luigi. The Python 3 port is still incomplete.

A rival named Spark was designed to run ten to a hundred times faster than Hadoop. It can read and process any Hadoop data source and format. Spark includes APIs for Python and other languages. You can find the installation documents online.

Another alternative to Hadoop is Disco, which uses Python for MapReduce processing and Erlang for communication. Alas, you can’t install it with pip; see the documentation.

See Appendix C for related examples of parallel programming, in which a large structured calculation is distributed among many machines.

——————————————

tribute
称赞

——————————————

Salt


Salt started as a way to implement remote execution, but it grew to a full-fledged systems management platform. Based on ZeroMQ rather than SSH, it can scale to thousands of servers.

Salt has not yet been ported to Python 3. In this case, I won’t show Python 2 examples. If you’re interested in this area, read the documents, and watch for announcements when they do complete the port.

——————————————

兴趣是最好的老师，实践是进步的捷径，需求是灵感的源泉。

——————————————

"""
How to use it?

First, pip install nltk

Second:
    import nltk
    nltk.download() # It'll open a window, just download all Packages!
    
Then you can run the following codes
"""

import nltk


def sentences_segment(text):
    sent_tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
    sentences = sent_tokenizer.tokenize(text)
    return sentences

def get_words1(text):
    from nltk.tokenize import WordPunctTokenizer
    words = WordPunctTokenizer().tokenize(text)
    return words


def get_words2(text):
    pattern = r"""(?x)                   # set flag to allow verbose regexps 
              (?:[A-Z]\.)+           # abbreviations, e.g. U.S.A. 
              |\d+(?:\.\d+)?%?       # numbers, incl. currency and percentages 
              |\w+(?:[-']\w+)*       # words w/ optional internal hyphens/apostrophe 
              |\.\.\.                # ellipsis 
              |(?:[.,;"'?():-_`])    # special characters with meanings 
            """  
    words = nltk.regexp_tokenize(text, pattern)
    return words


text = '''
How it came about that snakes manufactured poison is a mystery. Over the periods their saliva, a mild, digestive juice like our own, was converted into a poison that defies analysis even today. It was not forced upon them by the survival competition; they could have caught and lived on prey without using poison, just as the thousands of non-poisonous snakes still do. Poison to a snake is merely a luxury; it enables it to get its food with very little effort, no more effort than one bite. And why only snakes? Cats, for instance, would be greatly helped; no running fights with large, fierce rats or tussles with grown rabbits — just a bite and no more effort needed. In fact, it would be an assistance to all carnivores though it would be a two-edged weapon when they fought each other. But, of the vertebrates, unpredictable Nature selected only snakes (and one lizard). One wonders saliva into why Nature, with respect from that of others, as other on the blood.
    In the conversion of saliva into poison, one might suppose that a fixed process took place. It did not; some snakes manufacture a poison different in every respect from that of others, as different as arsenic is from strychnine, and having different effects. One poison acts on the nerves, the other on the blood.
    The makers of the nerve poison include the mambas and the cobras and their venom is called neurotoxic. Vipers (adders) and rattlesnakes manufacture the blood poison, which is known as haemolytic. Both poisons are unpleasant, but by far the more unpleasant is the blood poison. It is said that the nerve poison is the more primitive of the two, that the blood poison is, so to speak, a newer product from an improved formula. Be that as it may, the nerve poison does its business with man far more quickly than the blood poison. This, however, means nothing. Snakes did not acquire their poison for use against man but for use against prey such as rats and mice, and the effects on these of viperine poison is almost immediate.
'''
print(get_words1(text))

——————————————

还是前三句话有用，后一句只能算个小提醒（告诉我们随心而动）

——————————————

很多计算机奇迹的诞生最初都只是发明人的一时兴起，更准确地说是他们个人的需求。

——————————————

数学最主要的功效是帮助我们建立一种分析问题和解决问题的思想及方法，然后再考虑通过编程去实现它。

——————————————

优秀程序员和一般程序员之间的任何不同最根本上来说就是数学基础的好坏。

——————————————

对于学习编程，应当记住这样三句话——“经得起诱惑，耐得住寂寞，受得了挫折”。

——————————————

Procedure
过程

serializing
序列化

——————————————

Remote Procedure Calls


Remote Procedure Calls (RPCs) look like normal functions but execute on remote machines across a network. Instead of calling a RESTful API with arguments encoded in the URL or request body, you call an RPC function on your own machine. Here’s what happens under the hood of the RPC client:

It converts your function arguments into bytes (sometimes this is called marshalling, or serializing, or just encoding).

It sends the encoded bytes to the remote machine.


And here’s what happens on the remote machine:

1. It receives the encoded request bytes.

2. After receiving the bytes, the RPC client decodes the bytes back to the original data structures (or equivalent ones, if the hardware and software differ between the two machines).

3. The client then finds and calls the local function with the decoded data.

4. Next, it encodes the function results.

5. Last, the client sends the encoded bytes back to the caller.


And finally, the machine that started it all decodes the bytes to return values.

RPC is a popular technique, and people have implemented it in many ways. On the server side, you start a server program, connect it with some byte transport and encoding/decoding method, define some service functions, and light up your RPC is open for business sign. The client connects to the server and calls one of its functions via RPC.

The standard library includes one RPC implementation that uses XML as the exchange format: xmlrpc. You define and register functions on the server, and the client calls them as though they were imported. First, let’s explore the file xmlrpc_server.py:

from xmlrpc.server import SimpleXMLRPCServer

def double(num):
    return num * 2

server = SimpleXMLRPCServer(("localhost", 6789))
server.register_function(double, "double")
server.serve_forever()


The function we’re providing on the server is called double(). It expects a number as an argument and returns the value of that number times two. The server starts up on an address and port. We need to register the function to make it available to clients via RPC. Finally, start serving and carry on.

Now, you guessed it, xmlrpc_client.py:

import xmlrpc.client

proxy = xmlrpc.client.ServerProxy("http://localhost:6789/")
num = 7
result = proxy.double(num)
print("Double %s is %s" % (num, result))


The client connects to the server by using ServerProxy(). Then, it calls the function proxy.double(). Where did that come from? It was created dynamically by the server. The RPC machinery magically hooks this function name into a call to the remote server.

Give it a try—start the server and then run the client:

$ python xmlrpc_server.py
Next, run the client:
$ python xmlrpc_client.py
Double 7 is 14
The server then prints the following:
127.0.0.1 - - [13/Feb/2014 20:16:23] "POST / HTTP/1.1" 200 -


Popular transport methods are HTTP and ZeroMQ. Common encodings besides XML include JSON, Protocol Buffers, and MessagePack. There are many Python packages for JSON-based RPC, but many of them either don’t support Python 3 or seem a bit tangled. 

Let’s look at something different: MessagePack’s own Python RPC implementation. Here’s how to install it:

$ pip install msgpack-rpc-python


This will also install tornado, a Python event-based web server that this library uses as a transport. As usual, the server comes first (msgpack_server.py):

from msgpackrpc import Server, Address

class Services():
    def double(self, num):
        return num * 2

server = Server(Services())
server.listen(Address("localhost", 6789))
server.start()


The Services class exposes its methods as RPC services. Go ahead and start the client, msgpack_client.py:

from msgpackrpc import Client, Address

client = Client(Address("localhost", 6789))
num = 8
result =  client.call('double', num)
print("Double %s is %s" % (num, result))


To run these, follow the usual drill: start the server, start the client, see the results:

$ python msgpack_server.py
$ python msgpack_client.py
Double 8 is 16

——————————————

Remote Processing


Most of the examples in this book have demonstrated how to call Python code on the same machine, and usually in the same process. Thanks to Python’s expressiveness, you can also call code on other machines as though they were local. In advanced settings, if you run out of space on your single machine, you can expand beyond it. A network of machines gives you access to more processes and/or threads.

——————————————

targeted
有针对性的

mashups
混搭

minimal
最小的

fledged
成熟的

Representational
表征

outlet
出路

——————————————

Web Services and APIs


Information providers always have a website, but those are targeted for human eyes, not automation. If data is published only on a website, anyone who wants to access and structure the data needs to write scrapers (as shown in Crawl and Scrape), and rewrite them each time a page format changes. This is usually tedious. In contrast, if a website offers an API to its data, the data becomes directly available to client programs. APIs change less often than web page layouts, so client rewrites are less common. A fast, clean data pipeline also makes it easier to build mashups—combinations that might not have been foreseen but can be useful and even profitable.

In many ways, the easiest API is a web interface, but one that provides data in a structured format such as JSON or XML rather than plain text or HTML. The API might be minimal or a full-fledged RESTful API (defined in Web APIs and Representational State Transfer), but it provides another outlet for those restless bytes.

At the very beginning of this book, you can see a web API: it picks up the most popular videos from YouTube. This next example might make more sense now that you’ve read about web requests, JSON, dictionaries, lists, and slices:

import requests
url = "https://gdata.youtube.com/feeds/api/standardfeeds/top_rated?alt=json"
response = requests.get(url)
data = response.json()
for video in data['feed']['entry'][0:6]:
    print(video['title']['$t'])


APIs are especially useful for mining well-known social media sites such as Twitter, Facebook, and LinkedIn. All these sites provide APIs that are free to use, but they require you to register and get a key (a long-generated text string, sometimes also known as a token) to use when connecting. The key lets a site determine who’s accessing its data. It can also serve as a way to limit request traffic to servers. The YouTube example you just looked at did not require an API key for searching, but it would if you made calls that updated data at YouTube.

Here are some interesting service APIs:

■ New York Times
■ YouTube
■ Twitter
■ Facebook
■ Weather Underground
■ Marvel Comics
  http://developer.marvel.com

——————————————

Other protocols


Using the standard ftplib module, you can push bytes around by using the File Transfer Protocol (FTP). Although it’s an old protocol, FTP still performs very well.

You’ve seen many of these modules in various places in this book, but also try the documentation for standard library support of Internet protocols.

——————————————

Python Email Modules


The standard library contains these email modules:

■ smtplib for sending email messages via Simple Mail Transfer Protocol (SMTP)
■ email for creating and parsing email messages
■ poplib for reading email via Post Office Protocol 3 (POP3)
■ imaplib for reading email via Internet Message Access Protocol (IMAP)


The official documentation contains sample code for all of these libraries.

If you want to write your own Python SMTP server, try smtpd.

A pure-python SMTP server called Lamson allows you to store messages in databases, and you can even block spam.

——————————————

critical
至关重要的

clue
线索

——————————————

Domain Name System


Computers have numeric IP addresses such as 85.2.101.94, but we remember names better than numbers. The Domain Name System (DNS) is a critical Internet service that converts IP addresses to and from names via a distributed database. Whenever you’re using a web browser and suddenly see a message like “looking up host,” you’ve probably lost your Internet connection, and your first clue is a DNS failure.

Some DNS functions are found in the low-level socket module. gethostbyname() returns the IP address for a domain name, and the extended edition gethostbyname_ex() returns the name, a list of alternative names, and a list of addresses:

>>> import socket
>>> socket.gethostbyname('www.crappytaxidermy.com')
'66.6.44.4'
>>> socket.gethostbyname_ex('www.crappytaxidermy.com')
('crappytaxidermy.com', ['www.crappytaxidermy.com'], ['66.6.44.4'])


The getaddrinfo() method looks up the IP address, but it also returns enough information to create a socket to connect to it:

>>> socket.getaddrinfo('www.crappytaxidermy.com', 80)
[(2, 2, 17, '', ('66.6.44.4', 80)), (2, 1, 6, '', ('66.6.44.4', 80))]


The preceding call returned two tuples, the first for UDP, and the second for TCP (the 6 in the 2, 1, 6 is the value for TCP).

You can ask for TCP or UDP information only:

>>> socket.getaddrinfo('www.crappytaxidermy.com', 80, socket.AF_INET,
socket.SOCK_STREAM)
[(2, 1, 6, '', ('66.6.44.4', 80))]


Some TCP and UDP port numbers are reserved for certain services by IANA, and are associated with service names. For example, HTTP is named http and is assigned TCP port 80.

These functions convert between service names and port numbers:

>>> import socket
>>> socket.getservbyname('http')
80
>>> socket.getservbyport(80)
'http'

——————————————

automate
自动化

——————————————

Internet Services


Python has an extensive networking toolset. In the following sections, we’ll look at ways to automate some of the most popular Internet services. The official, comprehensive documentation is available online.

——————————————

investigation
调查

intimidating
令人生畏的

inclined
倾向于

——————————————

Scapy


Sometimes you need to dip into the networking stream and see the bytes swimming by. You might want to debug a web API, or track down some security issue. The scapy library is an excellent Python tool for packet investigation, and much easier than writing and debugging C programs. It’s actually a little language for constructing and analyzing packets.

I planned to include some example code here but changed my mind for two reasons:

■ scapy hasn’t been ported to Python 3 yet. That hasn’t stopped us before, when we’ve used pip2 and python2, but …

■ The installation instructions for scapy are, I think, too intimidating for an introductory book.


If you’re so inclined, take a look at the examples in the main documentation site. They might encourage you to brave an installation on your machine.

Finally, don’t confuse scapy with scrapy, which is covered in Crawl and Scrape.

——————————————

ZeroMQ(2)


The messages need to be sent as byte strings, so we encoded our example’s text strings in UTF-8 format. You can send any kind of message you like, as long as you convert it to bytes. We used simple text strings as the source of our messages, so encode() and decode() were enough to convert to and from byte strings. If your messages have other data types, you can use a library such as MessagePack.

Even this basic REQ-REP pattern allows for some fancy communication patterns, because any number of REQ clients can connect() to a single REP server. The server handles requests one at a time, synchronously, but doesn’t drop other requests that are arriving in the meantime. ZeroMQ buffers messages, up to some specified limit, until they can get through; that’s where it earns the Q in its name. The Q stands for Queue, the M stands for Message, and the Zero means there doesn’t need to be any broker.

Although ZeroMQ doesn’t impose any central brokers (intermediaries), you can build them where needed. For example, use DEALER and ROUTER sockets to connect multiple sources and/or destinations asynchronously.

Multiple REQ sockets connect to a single ROUTER, which passes each request to a DEALER, which then contacts any REP sockets that have connected to it. This is similar to a bunch of browsers contacting a proxy server in front of a web server farm. It lets you add multiple clients and servers as needed.

The REQ sockets connect only to the ROUTER socket; the DEALER connects to the multiple REP sockets behind it. ZeroMQ takes care of the nasty details, ensuring that the requests are load balanced and that the replies go back to the right place.

Another networking pattern called the ventilator uses PUSH sockets to farm out asynchronous tasks, and PULL sockets to gather the results.

The last notable feature of ZeroMQ is that it scales up and down, just by changing the connection type of the socket when it’s created:

tcp 
between processes, on one or more machines

ipc 
between processes on one machine

inproc 
between threads in a single process


That last one, inproc, is a way to pass data between threads without locks, and an alternative to the threading example in Threads.

After using ZeroMQ, you might never want to write raw socket code again.


Note

ZeroMQ is certainly not the only message-passing library that Python supports. Message passing is one of the most popular ideas in networking, and Python keeps up with other languages. The Apache project, whose web server we saw in Apache, also maintains the ActiveMQ project, including several Python interfaces using the simple-text STOMP protocol. RabbitMQ is also popular, and has useful online Python tutorials.

——————————————

ent 'message #5', received 'Stop saying message #5'


Our client ends after sending its fifth message, but we didn’t tell the server to quit, so it sits by the phone, waiting for another message. If you run the client again, it will print the same five lines, and the server will print its five also. If you don’t kill the zmq_server.py process and try to run another one, Python will complain that the address is already is use:

$ python zmq_server.py &
[2] 356
Traceback (most recent call last):
  File "zmq_server.py", line 7, in <module>
    server.bind("tcp://%s:%s" % (host, port))
  File "socket.pyx", line 444, in zmq.backend.cython.socket.Socket.bind
      (zmq/backend/cython/socket.c:4076)
  File "checkrc.pxd", line 21, in zmq.backend.cython.checkrc._check_rc
      (zmq/backend/cython/socket.c:6032)
zmq.error.ZMQError: Address already in use

——————————————

Lego
乐高

impose
强加

——————————————

ZeroMQ(1)


We’ve already seen ZeroMQ sockets used for pub-sub. ZeroMQ is a library. Sometimes described as sockets on steroids, ZeroMQ sockets do the things that you sort of expected plain sockets to do:

■Exchange entire messages

■Retry connections

■Buffer data to preserve it when the timing between senders and receivers doesn’t line up


The online guide is well written and witty, and it presents the best description of networking patterns that I’ve seen. The printed version (ZeroMQ: Messaging for Many Applications, by Pieter Hintjens, from that animal house, O’Reilly) has that good code smell and a big fish on the cover, rather than the other way around. All the examples in the printed guide are in the C language, but the online version lets you pick from multiple languages for each code example. The Python examples are also viewable. In this chapter, I’ll show you some basic uses for ZeroMQ in Python.

ZeroMQ is like a Lego set, and we all know that you can build an amazing variety of things from a few Lego shapes. In this case, you construct networks from a few socket types and patterns. The basic “Lego pieces” presented in the following list are the ZeroMQ socket types, which by some twist of fate look like the network patterns we’ve already discussed:

■ REQ (synchronous request)
■ REP (synchronous reply)
■ DEALER (asynchronous request)
■ ROUTER (asynchronous reply)
■ PUB (publish)
■ SUB (subscribe)
■ PUSH (fanout)
■ PULL (fanin)


To try these yourself, you’ll need to install the Python ZeroMQ library by typing this command:

$ pip install pyzmq


The simplest pattern is a single request-reply pair. This is synchronous: one socket makes a request and then the other replies. First, the code for the reply (server), zmq_server.py:

import zmq

host = '127.0.0.1'
port = 6789
context = zmq.Context()
server = context.socket(zmq.REP)
server.bind("tcp://%s:%s" % (host, port))
while True:
    #  Wait for next request from client
    request_bytes = server.recv()
    request_str = request_bytes.decode('utf-8')
    print("That voice in my head says: %s" % request_str)
    reply_str = "Stop saying: %s" % request_str
    reply_bytes = bytes(reply_str, 'utf-8')
    server.send(reply_bytes)


We create a Context object: this is a ZeroMQ object that maintains state. Then, we make a ZeroMQ socket of type REP (for REPly). We call bind() to make it listen on a particular IP address and port. Notice that they’re specified in a string such as 'tcp://localhost:6789' rather than a tuple, as in the plain socket examples.

This example keeps receiving requests from a sender and sending a response. The messages can be very long—ZeroMQ takes care of the details.

Following is the code for the corresponding request (client), zmq_client.py. Its type is REQ (for REQuest), and it calls connect() rather than bind().


import zmq

host = '127.0.0.1'
port = 6789
context = zmq.Context()
client = context.socket(zmq.REQ)
client.connect("tcp://%s:%s" % (host, port))
for num in range(1, 6):
    request_str = "message #%s" % num
    request_bytes = request_str.encode('utf-8')
    client.send(request_bytes)
    reply_bytes = client.recv()
    reply_str = reply_bytes.decode('utf-8')
    print("Sent %s, received %s" % (request_str, reply_str))


Now it’s time to start them. One interesting difference from the plain socket examples is that you can start the server and client in either order. Go ahead and start the server in one window in the background:

$ python zmq_server.py &


Start the client in the same window:

$ python zmq_client.py


You’ll see these alternating output lines from the client and server:

That voice in my head says 'message #1'
Sent 'message #1', received 'Stop saying message #1'
That voice in my head says 'message #2'
Sent 'message #2', received 'Stop saying message #2'
That voice in my head says 'message #3'
Sent 'message #3', received 'Stop saying message #3'
That voice in my head says 'message #4'
Sent 'message #4', received 'Stop saying message #4'
That voice in my head says 'message #5'
S

——————————————

Sockets(2)


Which brings us to TCP (Transmission Control Protocol). TCP is used for longer-lived connections, such as the Web. TCP delivers data in the order in which you send it. If there were any problems, it tries to send it again. Let’s shoot a few packets from client to server and back with TCP.

tcp_client.py acts like the previous UDP client, sending only one string to the server, but there are small differences in the socket calls, illustrated here:

import socket
from datetime import datetime

address = ('localhost', 6789)
max_size = 1000

print('Starting the client at', datetime.now())
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(address)
client.sendall(b'Hey!')
data = client.recv(max_size)
print('At', datetime.now(), 'someone replied', data)
client.close()


We’ve replaced SOCK_DGRAM with SOCK_STREAM to get the streaming protocol, TCP. We also added a connect() call to set up the stream. We didn’t need that for UDP because each datagram was on its own in the wild, wooly Internet.

tcp_server.py also differs from its UDP cousin:

from datetime import datetime
import socket

address = ('localhost', 6789)
max_size = 1000

print('Starting the server at', datetime.now())
print('Waiting for a client to call.')
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(address)
server.listen(5)

client, addr = server.accept()
data = client.recv(max_size)

print('At', datetime.now(), client, 'said', data)
client.sendall(b'Are you talking to me?')
client.close()
server.close()


server.listen(5) is configured to queue up to five client connections before refusing new ones. server.accept() gets the first available message as it arrives. The client.recv(1000) sets a maximum acceptable message length of 1,000 bytes.

As you did earlier, start the server and then the client, and watch the fun. First, the server:

$ python tcp_server.py
Starting the server at 2014-02-06 22:45:13.306971
Waiting for a client to call.
At 2014-02-06 22:45:16.048865 <socket.socket object, fd=6, family=2, type=1,
    proto=0> said b'Hey!'


Now, start the client. It will send its message to the server, receive a response, and then exit:

$ python tcp_client.py
Starting the client at 2014-02-06 22:45:16.038642
At 2014-02-06 22:45:16.049078 someone replied b'Are you talking to me?'
The server collects the message, prints it, responds, and then quits:
At 2014-02-06 22:45:16.048865 <socket.socket object, fd=6, family=2, type=1,
    proto=0> said b'Hey!'


Notice that the TCP server called client.sendall() to respond, and the earlier UDP server called client.sendto(). TCP maintains the client-server connection across multiple socket calls and remembers the client’s IP address.

This didn’t look so bad, but if you try to write anything more complex, you’ll see how low-level sockets really are. Here are some of the complications with which you need to cope:

UDP sends messages, but their size is limited, and they’re not guaranteed to reach their destination.

TCP sends streams of bytes, not messages. You don’t know how many bytes the system will send or receive with each call.


To exchange entire messages with TCP, you need some extra information to reassemble the full message from its segments: a fixed message size (bytes), or the size of the full message, or some delimiting character.

Because messages are bytes, not Unicode text strings, you need to use the Python bytes type. For more information on that, see Chapter 7.

After all of this, if you find yourself fascinated by socket programming, check out the Python socket programming HOWTO for more details.

——————————————

to know the server’s address and port number but didn’t need to specify a port number for itself. That was automatically assigned by the system—in this case, it was 56267.


Note

UDP sends data in single chunks. It does not guarantee delivery. If you send multiple messages via UDP, they can arrive out of order, or not at all. It’s fast, light, connectionless, and unreliable.

——————————————

tedious
单调乏味的

eerie
怪异的

cope
应对

reassemble
重新组装

——————————————

Sockets(1)


We’ve saved this topic until now because you don’t need to know all the low-level details to use the higher levels of the Internet. But if you like to know how things work, this is for you.

The lowest level of network programming uses a socket, borrowed from the C language and the Unix operating system. Socket-level coding is tedious. You’ll have more fun using something like ZeroMQ, but it’s useful to see what lies beneath. For instance, messages about sockets often turn up when networking errors take place.

Let’s write a very simple client-server exchange. The client sends a string in a UDP datagram to a server, and the server returns a packet of data containing a string. The server needs to listen at a particular address and port—like a post office and a post office box. The client needs to know these two values to deliver its message, and receive any reply.

In the following client and server code, address is a tuple of (address, port). The address is a string, which can be a name or an IP address. When your programs are just talking to one another on the same machine, you can use the name 'localhost' or the equivalent address '127.0.0.1'.

First, let’s send a little data from one process to another and return a little data back to the originator. The first program is the client and the second is the server. In each program, we’ll print the time and open a socket. The server will listen for connections to its socket, and the client will write to its socket, which transmits a message to the server.

Here’s the first program, udp_server.py:

from datetime import datetime
import socket

server_address = ('localhost', 6789)
max_size = 4096
print('Starting the server at', datetime.now())
print('Waiting for a client to call.')
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind(server_address)

data, client = server.recvfrom(max_size)

print('At', datetime.now(), client, 'said', data)
server.sendto(b'Are you talking to me?', client)
server.close()


The server has to set up networking through two methods imported from the socket package. The first method, socket.socket, creates a socket, and the second, bind, binds to it (listens to any data arriving at that IP address and port). AF_INET means we’ll create an Internet (IP) socket. (There’s another type for Unix domain sockets, but those work only on the local machine.) SOCK_DGRAM means we’ll send and receive datagrams—in other words, we’ll use UDP.

At this point, the server sits and waits for a datagram to come in (recvfrom). When one arrives, the server wakes up and gets both the data and information about the client. The client variable contains the address and port combination needed to reach the client. The server ends by sending a reply and closing its connection.

Let’s take a look at udp_client.py:

import socket
from datetime import datetime

server_address = ('localhost', 6789)
max_size = 4096
print('Starting the client at', datetime.now())
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.sendto(b'Hey!', server_address)
data, server = client.recvfrom(max_size)
print('At', datetime.now(), server, 'said', data)
client.close()


The client has most of the same methods as the server (with the exception of bind()). The client sends and then receives, whereas the server receives first.

Start the server first, in its own window. It will print its greeting and then wait with an eerie calm until a client sends it some data:

$ python udp_server.py
Starting the server at 2014-02-05 21:17:
41.945649
Waiting for a client to call.


Next, start the client in another window. It will print its greeting, send data to the server, print the reply, and then exit:

$ python udp_client.py
Starting the client at 2014-02-05 21:24:56.509682
At 2014-02-05 21:24:56.518670 ('127.0.0.1', 6789) said b'Are you talking to me?'


Finally, the server will print something like this, and then exit:

At 2014-02-05 21:24:56.518473 ('127.0.0.1', 56267) said b'Hey!'


The client needed

——————————————

terminate
终止

innovation
创新

conventions
约定

flow
流

Datagram
数据报

Transmission
传输

duplication
重复

acknowledged
告知已收到

handshake
握手

cable
电缆

router
路由器

atop
在

brevity
简洁

——————————————

TCP/IP


We’ve been walking through the networking house, taking for granted that whatever’s in the basement works correctly. Now, let’s actually visit the basement and look at the wires and pipes that keep everything running above ground.

The Internet is based on rules about how to make connections, exchange data, terminate connections, handle timeouts, and so on. These are called protocols, and they are arranged in layers. The purpose of layers is to allow innovation and alternative ways of doing things; you can do anything you want on one layer as long as you follow the conventions in dealing with the layers above and below you.

The very lowest layer governs aspects such as electrical signals; each higher layer builds on those below. In the middle, more or less, is the IP (Internet Protocol) layer, which specifies how network locations are addressed and how packets (chunks) of data flow. In the layer above that, two protocols describe how to move bytes between locations:

UDP (User Datagram Protocol) 
This is used for short exchanges. A datagram is a tiny message sent in a single burst, like a note on a postcard. 

TCP (Transmission Control Protocol) 
This protocol is used for longer-lived connections. It sends streams of bytes and ensures that they arrive in order without duplication.


UDP messages are not acknowledged, so you’re never sure if they arrive at their destination. If you wanted to tell a joke over UDP:

Here's a UDP joke. Get it?


TCP sets up a secret handshake between sender and receiver to ensure a good connection. A TCP joke would start like this:

Do you want to hear a TCP joke?
Yes, I want to hear a TCP joke.
Okay, I'll tell you a TCP joke.
Okay, I'll hear a TCP joke.
Okay, I'll send you a TCP joke now.
Okay, I'll receive the TCP joke now.
... (and so on)


Your local machine always has the IP address 127.0.0.1 and the name localhost. You might see this called the loopback interface. If it’s connected to the Internet, your machine will also have a public IP. If you’re just using a home computer, it’s behind equipment such as a cable modem or router. You can run Internet protocols even between processes on the same machine.

Most of the Internet with which we interact—the Web, database servers, and so on—is based on the TCP protocol running atop the IP protocol; for brevity, TCP/IP. Let’s first look at some basic Internet services. After that, we’ll explore general networking patterns.

——————————————

Other Pub-sub Tools


You might like to explore some of these other Python pub-sub links:

RabbitMQ 
This is a well-known messaging broker, and pika is a Python API for it. See the pika documentation and a pub-sub tutorial.

pypi.python.org 
Go to the upper-right corner of the search window and type pubsub to find Python packages like pypubsub.

pubsubhubbub 
This mellifluous protocol enables subscribers to register callbacks with publishers.

——————————————

bind
绑定

——————————————

ZeroMQ


Remember those ZeroMQ PUB and SUB sockets from a few pages ago? This is what they’re for. ZeroMQ has no central server, so each publisher writes to all subscribers. Let’s rewrite the cat-hat pub-sub for ZeroMQ. The publisher, zmq_pub.py, looks like this:

import zmq
import random
import time
host = '*'
port = 6789
ctx = zmq.Context()
pub = ctx.socket(zmq.PUB)
pub.bind('tcp://%s:%s' % (host, port))
cats = ['siamese', 'persian', 'maine coon', 'norwegian forest']
hats = ['stovepipe', 'bowler', 'tam-o-shanter', 'fedora']
time.sleep(1)
for msg in range(10):
    cat = random.choice(cats)
    cat_bytes = cat.encode('utf-8')
    hat = random.choice(hats)
    hat_bytes = hat.encode('utf-8')
    print('Publish: %s wears a %s' % (cat, hat))
    pub.send_multipart([cat_bytes, hat_bytes])


Notice how this code uses UTF-8 encoding for the topic and value strings.

The file for the subscriber is zmq_sub.py:

import zmq
host = '127.0.0.1'
port = 6789
ctx = zmq.Context()
sub = ctx.socket(zmq.SUB)
sub.connect('tcp://%s:%s' % (host, port))
topics = ['maine coon', 'persian']
for topic in topics:
    sub.setsockopt(zmq.SUBSCRIBE, topic.encode('utf-8'))
while True:
    cat_bytes, hat_bytes = sub.recv_multipart()
    cat = cat_bytes.decode('utf-8')
    hat = hat_bytes.decode('utf-8')
    print('Subscribe: %s wears a %s' % (cat, hat))


In this code, we subscribe to two different byte values: the two strings in topics, encoded as UTF-8.


Note

It seems a little backward, but if you want all topics, you need to subscribe to the empty bytestring b''; if you don’t, you’ll get nothing.


Notice that we call send_multipart() in the publisher and recv_multipart() in the subscriber. This makes it possible for us to send multipart messages, and use the first part as the topic. We could also send the topic and message as a single string or bytestring, but it seems cleaner to keep cats and hats separate.

Start the subscriber:

$ python zmq_sub.py


Start the publisher. It immediately sends 10 messages, and then quits:

$ python zmq_pub.py
Publish: norwegian forest wears a stovepipe
Publish: siamese wears a bowler
Publish: persian wears a stovepipe
Publish: norwegian forest wears a fedora
Publish: maine coon wears a tam-o-shanter
Publish: maine coon wears a stovepipe
Publish: persian wears a stovepipe
Publish: norwegian forest wears a fedora
Publish: norwegian forest wears a bowler
Publish: maine coon wears a bowler


The subscriber prints what it requested and received:

Subscribe: persian wears a stovepipe
Subscribe: maine coon wears a tam-o-shanter
Subscribe: maine coon wears a stovepipe
Subscribe: persian wears a stovepipe
Subscribe: maine coon wears a bowler

——————————————

emits
发出

breed
品种

accompanying
伴随

criteria
标准

——————————————

Redis


You can build a quick pub-sub system by using Redis. The publisher emits messages with a topic and a value, and subscribers say which topics they want to receive.

Here’s the publisher, redis_pub.py:

import redis
import random

conn = redis.Redis()
cats = ['siamese', 'persian', 'maine coon', 'norwegian forest']
hats = ['stovepipe', 'bowler', 'tam-o-shanter', 'fedora']
for msg in range(10):
    cat = random.choice(cats)
    hat = random.choice(hats)
    print('Publish: %s wears a %s' % (cat, hat))
    conn.publish(cat, hat)


Each topic is a breed of cat, and the accompanying message is a type of hat.

Here’s a single subscriber, redis_sub.py:

import redis
conn = redis.Redis()

topics = ['maine coon', 'persian']
sub = conn.pubsub()
sub.subscribe(topics)
for msg in sub.listen():
    if msg['type'] == 'message':
        cat = msg['channel']
        hat = msg['data']
        print('Subscribe: %s wears a %s' % (cat, hat))


The subscriber just shown wants all messages for cat types 'maine coon' and 'persian', and no others. The listen() method returns a dictionary. If its type is 'message', it was sent by the publisher and matches our criteria. The 'channel' key is the topic (cat), and the 'data' key contains the message (hat).

If you start the publisher first and no one is listening, it’s like a mime falling in the forest (does he make a sound?), so start the subscriber first:

$ python redis_sub.py


Next, start the publisher. It will send 10 messages, and then quit:

$ python redis_pub.py
Publish: maine coon wears a stovepipe
Publish: norwegian forest wears a stovepipe
Publish: norwegian forest wears a tam-o-shanter
Publish: maine coon wears a bowler
Publish: siamese wears a stovepipe
Publish: norwegian forest wears a tam-o-shanter
Publish: maine coon wears a bowler
Publish: persian wears a bowler
Publish: norwegian forest wears a bowler
Publish: maine coon wears a stovepipe


The subscriber cares about only two types of cat:

$ python redis_sub.py
Subscribe: maine coon wears a stovepipe
Subscribe: maine coon wears a bowler
Subscribe: maine coon wears a bowler
Subscribe: persian wears a bowler
Subscribe: maine coon wears a stovepipe


We didn’t tell the subscriber to quit, so it’s still waiting for messages. If you restart the publisher, the subscriber will grab a few more messages and print them.

You can have as many subscribers (and publishers) as you want. If there’s no subscriber for a message, it disappears from the Redis server. However, if there are subscribers, the messages stay in the server until all subscribers have retrieved them.

——————————————

The Publish-Subscribe Model


Publish-subscribe is not a queue but a broadcast. One or more processes publish messages. Each subscriber process indicates what type of messages it would like to receive. A copy of each message is sent to each subscriber that matched its type. Thus, a given message might be processed once, more than once, or not at all. Each publisher is just broadcasting and doesn’t know who—if anyone—is listening.

——————————————

fanout
扇出

fanin
扇入

subscribe
订阅

——————————————

Patterns


You can build networking applications from some basic patterns.

The most common pattern is request-reply, also known as client-server. This pattern is synchronous: the client waits until the server responds. You’ve seen many examples of request-reply in this book. Your web browser is also a client, making an HTTP request to a web server, which returns a reply.

Another common pattern is push, or fanout: you send data to any available worker in a pool of processes. An example is a web server behind a load balancer.

The opposite of push is pull, or fanin: you accept data from one or more sources. An example would be a logger that takes text messages from multiple processes and writes them to a single log file.

One pattern is similar to radio or television broadcasting: publish-subscribe, or pub-sub. With this pattern, a publisher sends out data. In a simple pub-sub system, all subscribers would receive a copy. More often, subscribers can indicate that they’re interested only in certain types of data (often called a topic), and the publisher will send just those. So, unlike the push pattern, more than one subscriber might receive a given piece of data. If there’s no subscriber for a topic, the data is ignored.

——————————————

span
跨度

distributing
分发

——————————————

Networks


In our discussion of concurrency, we talked mostly about time: single-machine solutions (processes, threads, green threads). We also briefly touched upon some solutions that can span networks (Redis, ZeroMQ). Now, we’ll look at networking in its own right, distributing computing across space.

——————————————

assembly
组装

banquet
宴会

pending
等待

——————————————

Beyond Queues


With more moving parts, there are more possibilities for our lovely assembly lines to be disrupted. If we need to wash the dishes from a banquet, do we have enough workers? What if the dryers get drunk? What if the sink clogs? Worries, worries!

How will you cope with it all? Fortunately, there are some techniques available that you can apply. They include the following:

Fire and forget 
Just pass things on and don’t worry about the consequences, even if no one is there. That’s the dishes-on-the-floor approach. 

Request-reply 
The washer receives an acknowledgement from the dryer, and the dryer from the put-away-er, for each dish in the pipeline. 

Back pressure or throttling 
This technique directs a fast worker to take it easy if someone downstream can’t keep up.


In real systems, you need to be careful that workers are keeping up with the demand; otherwise, you hear the dishes hitting the floor. You might add new tasks to a pending list, while some worker process pops the latest message and adds it to a working list. When the message is done, it’s removed from the working list and added to a completed list. This lets you know what tasks have failed or are taking too long. You can do this with Redis yourself, or use a system that someone else has already written and tested. Some Python-based queue packages that add this extra level of management—some of which use Redis—include:

celery 
This particular package is well worth a look. It can execute distributed tasks synchronously or asynchronously, using the methods we’ve discussed: multiprocessing, gevent, and others.

thoonk 
This package builds on Redis to provide job queues and pub-sub (coming in the next section).

rq
This is a Python library for job queues, also based on Redis.

Queues 
This site offers a discussion of queuing software, Python-based and otherwise.

——————————————

Redis(2)


Let’s make a few last changes:

■Create multiple dryer processes.
■Add a timeout to each dryer rather than looking for a sentinel.


The new redis_dryer2.py:

def dryer():
    import redis
    import os
    import time
    conn = redis.Redis()
    pid = os.getpid()
    timeout = 20
    print('Dryer process %s is starting' % pid)
    while True:
        msg = conn.blpop('dishes', timeout)
        if not msg:
            break
        val = msg[1].decode('utf-8')
        if val == 'quit':
            break
        print('%s: dried %s' % (pid, val))
        time.sleep(0.1)
    print('Dryer process %s is done' % pid)

import multiprocessing
DRYERS=3
for num in range(DRYERS):
    p = multiprocessing.Process(target=dryer)
    p.start()


Start the dryer processes in the background, and then the washer process in the foreground:

$ python redis_dryer2.py &
Dryer process 44447 is starting
Dryer process 44448 is starting
Dryer process 44446 is starting
$ python redis_washer.py
Washer is starting
Washed salad
44447: dried salad
Washed bread
44448: dried bread
Washed entree
44446: dried entree
Washed dessert
Washer is done
44447: dried dessert


One dryer process reads the quit ID and quits:

Dryer process 44448 is done


After 20 seconds, the other dryer processes get a return value of None from their blpop calls, indicating that they’ve timed out. They say their last words and exit:

Dryer process 44447 is done
Dryer process 44446 is done


After the last dryer subprocess quits, the main dryer program ends:

[1]+  Done                    python redis_dryer2.py

——————————————

mingled
混杂在一起

sentinel
哨兵

——————————————

Following part is very interesting about concurrency.

——————————————

Redis(1)


Our earlier dishwashing code examples, using processes or threads, were run on a single machine. Let’s take another approach to queues that can run on a single machine or across a network. Even with multiple singing processes and dancing threads, sometimes one machine isn’t enough, You can treat this section as a bridge between single-box (one machine) and multiple-box concurrency.

To try the examples in this section, you’ll need a Redis server and its Python module. You can see where to get them in Redis. In that chapter, Redis’s role is that of a database. Here, we’re featuring its concurrency personality.

A quick way to make a queue is with a Redis list. A Redis server runs on one machine; this can be the same one as its clients, or another that the clients can access through a network. In either case, clients talk to the server via TCP, so they’re networking. One or more provider clients pushes messages onto one end of the list. One or more client workers watches this list with a blocking pop operation. If the list is empty, they all just sit around playing cards. As soon as a message arrives, the first eager worker gets it.

Like our earlier process- and thread-based examples, redis_washer.py generates a sequence of dishes:

import redis
conn = redis.Redis()
print('Washer is starting')
dishes = ['salad', 'bread', 'entree', 'dessert']
for dish in dishes:
    msg = dish.encode('utf-8')
    conn.rpush('dishes', msg)
    print('Washed', num)
conn.rpush('dishes', 'quit')
print('Washer is done')


The loop generates four messages containing a dish name, followed by a final message that says “quit.” It appends each message to a list called dishes in the Redis server, similar to appending to a Python list.
And as soon as the first dish is ready, redis_dryer.py does its work:

import redis
conn = redis.Redis()
print('Dryer is starting')
while True:
    msg = conn.blpop('dishes')
    if not msg:
        break
    val = msg[1].decode('utf-8')
    if val == 'quit':
        break
    print('Dried', val)
print('Dishes are dried')


This code waits for messages whose first token is “dishes” and prints that each one is dried. It obeys the quit message by ending the loop.

Start the dryer, and then the washer. Using the & at the end puts the first program in the background; it keeps running, but doesn’t listen to the keyboard anymore. This works on Linux, OS X, and Windows, although you might see different output on the next line. In this case (OS X), it’s some information about the background dryer process. Then, we start the washer process normally (in the foreground). You’ll see the mingled output of the two processes:

$ python redis_dryer.py &
[2] 81691
Dryer is starting
$ python redis_washer.py
Washer is starting
Washed salad
Dried salad
Washed bread
Dried bread
Washed entree
Dried entree
Washed dessert
Washer is done
Dried dessert
Dishes are dried
[2]+  Done                    python redis_dryer.py


As soon as dish IDs started arriving at Redis from the washer process, our hard-working dryer process started pulling them back out. Each dish ID was a number, except the final sentinel value, the string 'quit'. When the dryer process read that quit dish ID, it quit, and some more background process information printed to the terminal (also system-dependent). You can use a sentinel (an otherwise invalid value) to indicate something special from the data stream itself—in this case, that we’re done. Otherwise, we’d need to add a lot more program logic, such as the following:

■Agreeing ahead of time on some maximum dish number, which would kind of be a sentinel anyway.

■Doing some special out-of-band (not in the data stream) interprocess communication.

■Timing out after some interval with no new data.

——————————————

asyncio


Recently, Guido van Rossum (remember him?) became involved with the Python concurrency issue. Many packages had their own event loop, and each event loop kind of likes to be the only one. How could he reconcile mechanisms such as callbacks, greenlets, and others? After many discussions and visits, he proposed Asynchronous IO Support Rebooted: the “asyncio” Module, code-named Tulip. This first appeared in Python 3.4 as the asyncio module. For now, it offers a common event loop that could be compatible with twisted, gevent, and other asynchronous methods. The goal is to provide a standard, clean, well-performing asynchronous API. Watch it expand in future releases of Python.

——————————————

twisted


twisted is an asynchronous, event-driven networking framework. You connect functions to events such as data received or connection closed, and those functions are called when those events occur. This is a callback design, and if you’ve written anything in JavaScript, it might seem familiar. If it’s new to you, it can seem backwards. For some developers, callback-based code becomes harder to manage as the application grows.

Like gevent, twisted has not yet been ported to Python 3. We’ll use the Python 2 installer and interpreter for this section. Type the following to install it:

$ pip2 install twisted


twisted is a large package, with support for many Internet protocols on top of TCP and UDP. To be short and simple, we’ll show a little knock-knock server and client, adapted from twisted examples. First, let’s look at the server, knock_server.py (notice the Python 2 syntax for print()):

from twisted.internet import protocol, reactor

class Knock(protocol.Protocol):
    def dataReceived(self, data):
        print 'Client:', data
        if data.startswith("Knock knock"):
            response = "Who's there?"
        else:
            response = data + " who?"
        print 'Server:', response
        self.transport.write(response)

class KnockFactory(protocol.Factory):
    def buildProtocol(self, addr):
        return Knock()

reactor.listenTCP(8000, KnockFactory())
reactor.run()


Now, let’s take a glance at its trusty companion, knock_client.py:

from twisted.internet import reactor, protocol

class KnockClient(protocol.Protocol):
    def connectionMade(self):
        self.transport.write("Knock knock")

    def dataReceived(self, data):
        if data.startswith("Who's there?"):
            response = "Disappearing client"
            self.transport.write(response)
        else:
            self.transport.loseConnection()
            reactor.stop()

class KnockFactory(protocol.ClientFactory):
    protocol = KnockClient

def main():
    f = KnockFactory()
    reactor.connectTCP("localhost", 8000, f)
    reactor.run()

if __name__ == '__main__':
    main()
Start the server first:
$ python2 knock_server.py
Then start the client:
$ python2 knock_client.py


The server and client exchange messages, and the server prints the conversation:

Client: Knock knock
Server: Who's there?
Client: Disappearing client
Server: Disappearing client who?


Our trickster client then ends, keeping the server waiting for the punch line.

If you’d like to enter the twisted passages, try some of the other examples from its documentation.

——————————————

ubuntu更新软件包时常出现错误提示Unable to locate package update, 解决方法是：

sudo apt-get update

——————————————

表示看不懂，也没心思看懂

——————————————

doles out
发放

imperative
必要的

variation
变异

——————————————

Don't forget an important thing, that is, this book is just an introduction.

——————————————

Green Threads and gevent(1)


As you’ve seen, developers traditionally avoid slow spots in programs by running them in separate threads or processes. The Apache web server is an example of this design.

One alternative is event-based programming. An event-based program runs a central event loop, doles out any tasks, and repeats the loop. The nginx web server follows this design, and is generally faster than Apache.

The gevent library is event-based and accomplishes a cool trick: you write normal imperative code, and it magically converts pieces to coroutines. These are like generators that can communicate with one another and keep track of where they are. gevent modifies many of Python’s standard objects such as socket to use its mechanism instead of blocking. This does not work with Python add-in code that was written in C, as some database drivers are.


Note

As of this writing, gevent was not completely ported to Python 3, so these code examples use the Python 2 tools pip2 and python2.
You install gevent by using the Python 2 version of pip:

$ pip2 install gevent


Here’s a variation of sample code at the gevent website. You’ll see the socket module’s gethostbyname() function in the upcoming DNS section. This function is synchronous, so you wait (possibly many seconds) while it chases name servers around the world to look up that address. But you could use the gevent version to look up multiple sites independently. Save this as gevent_test.py:

import gevent
from gevent import socket
hosts = ['www.crappytaxidermy.com', 'www.walterpottertaxidermy.com',
    'www.antique-taxidermy.com']
jobs = [gevent.spawn(gevent.socket.gethostbyname, host) for host in hosts]
gevent.joinall(jobs, timeout=5)
for job in jobs:
    print(job.value)


There’s a one-line for-loop in the preceding example. Each hostname is submitted in turn to a gethostbyname() call, but they can run asynchronously because it’s the gevent version of gethostbyname().

Run gevent_test.py with Python 2 by typing the following (in bold):

$ python2 gevent_test.py
66.6.44.4
74.125.142.121
78.136.12.50


gevent.spawn() creates a greenlet (also known sometimes as a green thread or a microthread) to execute each gevent.socket.gethostbyname(url).

The difference from a normal thread is that it doesn’t block. If something occurred that would have blocked a normal thread, gevent switches control to one of the other greenlets.

——————————————

No. 

Firstly, I must learned this book completely.

——————————————

图片压缩神器

https://tinypng.com/

——————————————

但现实是，硅谷哪怕是最最初级的程序员的时薪也至少要$40。

——————————————

y don’t have to fight over data, because each has completely separate variables.

But threads do sometimes have good reasons to change global data. In fact, one common reason to launch multiple threads is to let them divide up the work on some data, so a certain degree of change to the data is expected.

The usual way to share data safely is to apply a software lock before modifying a variable in a thread. This keeps the other threads out while the change is made. It’s like having a Ghostbuster guard the room you want to remain unhaunted. The trick, though, is that you need to remember to unlock it. Plus, locks can be nested—what if another Ghostbuster is also watching the same room, or the house itself? The use of locks is traditional but notoriously hard to get right.


Note

In Python, threads do not speed up CPU-bound tasks because of an implementation detail in the standard Python system called the Global Interpreter Lock (GIL). This exists to avoid threading problems in the Python interpreter, and can actually make a multithreaded program slower than its single-threaded counterpart, or even a multi-process version.


So for Python, the recommendations are as follows:

■Use threads for I/O bound problems
■Use processes, networking, or events (discussed in the next section) for CPU-bound problems

——————————————

counterpart
配对

paranormal
超自然现象的

investigator
调查员

roam
漫游

apprehensively
担心地

candlestick
烛台

entity
实体

marbles
玻璃球

ablaze
闪亮，着火

Despite
尽管

brandy
白兰地酒

evaporation
蒸发

Ghostbuster
捉鬼敢死队

notoriously
出了名的

recommendations
建议

——————————————

Threads


A thread runs within a process with access to everything in the process, similar to a multiple personality. The multiprocessing module has a cousin called threading that uses threads instead of processes (actually, multiprocessing was designed later as its process-based counterpart). Let’s redo our process example with threads:

import threading

def do_this(what):
    whoami(what)

def whoami(what):
    print("Thread %s says: %s" % (threading.current_thread(), what))

if __name__ == "__main__":
    whoami("I'm the main program")
    for n in range(4):
        p = threading.Thread(target=do_this,
          args=("I'm function %s" % n,))
        p.start()


Here’s what prints for me:

Thread <_MainThread(MainThread, started 140735207346960)> says: I'm the main
program
Thread <Thread(Thread-1, started 4326629376)> says: I'm function 0
Thread <Thread(Thread-2, started 4342157312)> says: I'm function 1
Thread <Thread(Thread-3, started 4347412480)> says: I'm function 2
Thread <Thread(Thread-4, started 4342157312)> says: I'm function 3


We can reproduce our process-based dish example by using threads:

import threading, queue
import time

def washer(dishes, dish_queue):
    for dish in dishes:
    print ("Washing", dish)
        time.sleep(5)
        dish_queue.put(dish)

def dryer(dish_queue):
    while True:
        dish = dish_queue.get()
        print ("Drying", dish)
        time.sleep(10)
        dish_queue.task_done()


dish_queue = queue.Queue()
for n in range(2):
    dryer_thread = threading.Thread(target=dryer, args=(dish_queue,))
        dryer_thread.start()

dishes = ['salad', 'bread', 'entree', 'desert']
washer(dishes, dish_queue)
dish_queue.join()


One difference between multiprocessing and threading is that threading does not have a terminate() function. There’s no easy way to terminate a running thread, because it can cause all sorts of problems in your code, and possibly in the space-time continuum itself.

Threads can be dangerous. Like manual memory management in languages such as C and C++, they can cause bugs that are extremely hard to find, let alone fix. To use threads, all the code in the program—and in external libraries that it uses—must be thread-safe. In the preceding example code, the threads didn’t share any global variables, so they could run independently without breaking anything.

Imagine that you’re a paranormal investigator in a haunted house. Ghosts roam the halls, but none are aware of the others, and at any time, any of them can view, add, remove, or move any of the house’s contents.

You’re walking apprehensively through the house, taking readings with your impressive instruments. Suddenly you notice that the candlestick you passed seconds ago is now missing.

The contents of the house are like the variables in a program. The ghosts are threads in a process (the house). If the ghosts only looked at the house’s contents, there would be no problem. It’s like a thread reading the value of a constant or variable without trying to change it.

Yet, some unseen entity could grab your flashlight, blow cold air down your neck, put marbles on the stairs, or make the fireplace come ablaze. The really subtle ghosts would change things in other rooms that you might never notice.

Despite your fancy instruments, you’d have a very hard time figuring out who did it, and how, and when.

If you used multiple processes instead of threads, it would be like having a number of houses but with only one (living) person in each. If you put your brandy in front of the fireplace, it would still be there an hour later. Some lost to evaporation, perhaps, but in the same place.

Threads can be useful and safe when global data is not involved. In particular, threads are useful for saving time while waiting for some I/O operation to complete. In these cases, the

——————————————

simulate
模拟

intermediate
中间

——————————————

Processes


You can implement queues in many ways. For a single machine, the standard library’s multiprocessing module (which you can see in Programs and Processes) contains a Queue function. Let’s simulate just a single washer and multiple dryer processes (someone can put the dishes away later) and an intermediate dish_queue. Call this program dishes.py:

import multiprocessing as mp

def washer(dishes, output):
    for dish in dishes:
        print('Washing', dish, 'dish')
        output.put(dish)

def dryer(input):
    while True:
        dish = input.get()
        print('Drying', dish, 'dish')
        input.task_done()

dish_queue = mp.JoinableQueue()
dryer_proc = mp.Process(target=dryer, args=(dish_queue,))
dryer_proc.daemon = True
dryer_proc.start()

dishes = ['salad', 'bread', 'entree', 'dessert']
washer(dishes, dish_queue)
dish_queue.join()


Run your new program thusly:

$ python dishes.py
Washing salad dish
Washing bread dish
Washing entree dish
Washing dessert dish
Drying salad dish
Drying bread dish
Drying entree dish
Drying dessert dish


This queue looked a lot like a simple Python iterator, producing a series of dishes. It actually started up separate processes along with the communication between the washer and dryer. I used a JoinableQueue and the final join() method to let the washer know that all the dishes have been dried. There are other queue types in the multiprocessing module, and you can read the documentation for more examples.

If you can't understand the codes showed above, it's doesn't matter, because me couldn't understand either.

——————————————

Queues
队列

stuck
卡住了

batch
批处理

accumulate
积累

overall
整体

barn
谷仓

——————————————

Queues


A queue is like a list: things are added at one end and taken away from the other. The most common is referred to as FIFO (first in, first out).

Suppose that you’re washing dishes. If you’re stuck with the entire job, you need to wash each dish, dry it, and put it away. You can do this in a number of ways. You might wash the first dish, dry it, and then put it away. You then repeat with the second dish, and so on. Or, you might batch operations and wash all the dishes, dry them all, and then put them away; this assumes you have space in your sink and drainer for all the dishes that accumulate at each step. These are all synchronous approaches—one worker, one thing at a time.

As an alternative, you could get a helper or two. If you’re the washer, you can hand each cleaned dish to the dryer, who hands each dried dish to the put-away-er (look it up; it’s absolutely a real word!). As long as each of you works at the same pace, you should finish much faster than by yourself.

However, what if you wash faster than the dryer dries? Wet dishes either fall on the floor, or you pile them up between you and the dryer, or you just whistle off-key until the dryer is ready. And if the last person is slower than the dryer, dry dishes can end up falling on the floor, or piling up, or the dryer does the whistling. You have multiple workers, but the overall task is still synchronous and can proceed only as fast as the slowest worker.

Many hands make light work, goes the old saying (I always thought it was Amish, because it makes me think of barn building). Adding workers can build a barn, or do the dishes, faster. This involves queues.

In general, queues transport messages, which can be any kind of information. In this case, we’re interested in queues for distributed task management, also known as work queues, job queues, or task queues. Each dish in the sink is given to an available washer, who washes and hands it off to the first available dryer, who dries and hands it to a put-away-er. This can be synchronous (workers wait for a dish to handle and another worker to whom to give it), or asynchronous (dishes are stacked between workers with different paces). As long as you have enough workers, and they keep up with the dishes, things move a lot faster.

——————————————

synchronous
同步

asynchronous
异步

bound
约束

crunching
处理

invoking
调用

bottlenecks
瓶颈

odds
几率

——————————————

Concurrency


The official Python site discusses concurrency in general and in the standard library. Those pages have many links to various packages and techniques; we’ll show the most useful ones in this chapter.

In computers, if you’re waiting for something, it’s usually for one of two reasons:

I/O bound 
This is by far more common. Computer CPUs are ridiculously fast—hundreds of times faster than computer memory and many thousands of times faster than disks or networks.

CPU bound 
This happens with number crunching tasks such as scientific or graphic calculations.


Two more terms are related to concurrency:

synchronous
One thing follows the other, like a funeral procession.

asynchronous 
Tasks are independent, like party-goers dropping in and tearing off in separate cars.


As you progress from simple systems and tasks to real-life problems, you’ll need at some point to deal with concurrency. Consider a website, for example. You can usually provide static and dynamic pages to web clients fairly quickly. A fraction of a second is considered interactive, but if the display or interaction takes longer, people become impatient. Tests by companies such as Google and Amazon showed that traffic drops off quickly if the page loads even a little slower.

But what if you can’t help it when something takes a long time, such as uploading a file, resizing an image, or querying a database? You can’t do it within your synchronous web server code anymore, because someone’s waiting.

On a single machine, if you want to perform multiple tasks as fast as possible, you want to make them independent. Slow tasks shouldn’t block all the others.

Programs and Processes demonstrates how multiprocessing can be used to overlap work on a single machine. If you needed to resize an image, your web server code could call a separate, dedicated image resizing process to run asynchronously and concurrently. It could scale your application horizontally by invoking multiple resizing processes.

The trick is getting them all to work with one another. Any shared control or state means that there will be bottlenecks. An even bigger trick is dealing with failures, because concurrent computing is harder than regular computing. Many more things can go wrong, and your odds of end-to-end success are lower.

All right. What methods can help you to deal with these complexities? Let’s begin with a good way to manage multiple tasks: queues.

——————————————

sequential
顺序

concurrency
并发性

distributed
分布式

robustness
稳健性；健壮性

duplicate
重复的

Simplicity
简单

footloose
自由自在的

coroutines
协同程序

——————————————

Chapter 11. Concurrency and Networks


Time is nature’s way of keeping everything from happening at once. Space is what prevents everything from happening to me.
—Quotes about Time

So far, most of the programs that you’ve written run in one place (a single machine) and one line at a time (sequential). But, we can do more than one thing at a time (concurrency) and in more than one place (distributed computing or networking). There are many good reasons to challenge time and space:

Performance 
Your goal is to keep fast components busy, not waiting for slow ones. 

Robustness 
There’s safety in numbers, so you want to duplicate tasks to work around hardware and software failures.

Simplicity It’s best practice to break complex tasks into many little ones that are easier to create, understand, and fix. 

Communication 
It’s just plain fun to send your footloose bytes to distant places, and bring friends back with them.


We’ll start with concurrency, first building on the non-networking techniques that are described in Chapter 10—processes and threads. Then we’ll look at other approaches, such as callbacks, green threads, and coroutines. Finally, we’ll arrive at networking, initially as a concurrency technique, and then spreading outward.


Note

Some Python packages discussed in this chapter were not yet ported to Python 3 when this was written. In many cases, I’ll show example code that would need to be run with a Python 2 interpreter, which we’re calling python2.

——————————————

10.9 When will you be (or when were you) 10,000 days old?


datetime import date
from datetime import timedelta

birth = date(1998, 3, 29)
interval = timedelta(days=10000)
print(birth + interval)

——————————————

10.8 What day of the week was your day of birth?


from datetime import date

birth = date(1998, 3, 29)
fmt = 'My birthday is %A.'
print(birth.strftime(fmt))

——————————————

10.7 Create a date object of your day of birth.


from datetime import date
birth = date(1998, 3, 29)
print(type(birth))

——————————————

http://www.code123.cc/135.html

——————————————

http://www.52nlp.cn/

——————————————

10.6 Use multiprocessing to create three separate processes. Make each one wait a random number of seconds between one and five, print the current time, and then exit.


import multiprocessing

def do_this():
    import time
    import random
    from datetime import datetime
    time.sleep(random.randrange(1,5))
    print(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))

if __name__ == '__main__':
    for n in range(3):
        p = multiprocessing.Process(target=do_this)
        p.start()

——————————————

10.5 List the files in your parent directory.


import os

for content in os.listdir('..'):
    print(content)

——————————————

10.4 List the files in your current directory.


import os

for content in os.listdir('.'):
    print(content)

——————————————

10.3 Parse the date from today_string.


import time

fmt = '%Y-%m-%d'
today_string = '2016-7-17'
print(time.strptime(today_string, fmt))

——————————————

10.2 Read the text file today.txt into the string today_string.


with open('today.txt', 'r') as f:
   today_string = f.read()
print(today_string)

——————————————

Things to Do

——————————————

10.1 Write the current date as a string to the text file today.txt.


from datetime import datetime

now = datetime.now()
time_string = '{}-{}-{}'.format(now.year, now.month, now.day)
with open('today.txt', 'w') as f:
    f.write(time_string)

——————————————

data
数据

date
日期

——————————————

Alternative Modules


If you find the standard library modules confusing, or lacking a particular conversion that you want, there are many third-party alternatives. Here are just a few of them:

arrow 
This combines many date and time functions with a simple API.

dateutil 
This module parses almost any date format and handles relative dates and times well.

iso8601 
This fills in gaps in the standard library for the ISO8601 format.

fleming 
This module offers many time zone functions.

——————————————

Read and Write Dates and Times(2)


To go the other way and convert a string to a date or time, use strptime() with the same format string. There’s no regular expression pattern matching; the nonformat parts of the string (without %) need to match exactly. Let’s specify a format that matches year-month-day, such as 2012-01-29. What happens if the date string you want to parse has spaces instead of dashes?

>>> import time
>>> fmt = "%Y-%m-%d"
>>> time.strptime("2012 01 29", fmt)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/
python3.3/_strptime.py", line 494, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data '2012 01 29' does not match format '%Y-%m-%d'


If we feed strptime() some dashes, is it happy now?

>>> time.strptime("2012-01-29", fmt)
time.struct_time(tm_year=2012, tm_mon=1, tm_mday=29, tm_hour=0, tm_min=0,
tm_sec=0, tm_wday=6, tm_yday=29, tm_isdst=-1)


Yes.
Even if the string seems to match its format, an exception is raised if a value is out of range:

>>> time.strptime("2012-13-29", fmt)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/
  python3.3/_strptime.py", line 494, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/
  python3.3/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data '2012-13-29' does not match format '%Y-%m-%d'


Names are specific to your locale—internationalization settings for your operating system. To print different month and day names, change your locale by using setlocale(); its first argument is locale.LC_TIME for dates and times, and the second is a string combining the language and country abbreviation. Let’s invite some international friends to a Halloween party. We’ll print the month, day, and day of week in US English, French, German, Spanish, and Icelandic. (What? You think Icelanders don’t enjoy a good party as much as anyone else? They even have real elves.)

>>> import locale
>>> from datetime import date
>>> halloween = date(2014, 10, 31)
>>> for lang_country in ['en_us', 'fr_fr', 'de_de', 'es_es', 'is_is',]:
...     locale.setlocale(locale.LC_TIME, lang_country)
...     halloween.strftime('%A, %B %d')
...
'en_us'
'Friday, October 31'
'fr_fr'
'Vendredi, octobre 31'
'de_de'
'Freitag, Oktober 31'
'es_es'
'viernes, octubre 31'
'is_is'
'föstudagur, október 31'
>>>


Where do you find these magic values for lang_country? This is a bit wonky, but you can try this to get all of them (there are a few hundred):

>>> import locale
>>> names = locale.locale_alias.keys()


From names, let’s get just locale names that seem to work with setlocale(), such as the ones we used in the preceding example—a two-character language code followed by an underscore and a two-character country code:

>>> good_names = [name for name in names if \
len(name) == 5 and name[2] == '_']
What do the first five look like?
>>> good_names[:5]
['sr_cs', 'de_at', 'nl_nl', 'es_ni', 'sp_yu']


So, if you wanted all the German language locales, try this:

>>> de = [name for name in good_names if name.startswith('de')]
>>> de
['de_at', 'de_de', 'de_ch', 'de_lu', 'de_be']

——————————————

Read and Write Dates and Times(1)


isoformat() is not the only way to write dates and times. You already saw the ctime() function in the time module, which you can use to convert epochs to strings:

>>> import time
>>> now = time.time()
>>> time.ctime(now)
'Mon Feb  3 21:14:36 2014'


You can also convert dates and times to strings by using strftime(). This is provided as a method in the datetime, date, and time objects, and as a function in the time module. strftime() uses format strings to specify the output, which you can see in here:

%Y
year
1900-…

%m
month
01-12

%B
month name
January, …

%b
month abbrev
Jan, …

%d
day of month
01-31

%A
weekday name
Sunday, …

a
weekday abbrev
Sun, …

%H
hour (24 hr)
00-23

%I
hour (12 hr)
01-12

%p
AM/PM
AM, PM

%M
minute
00-59

%S
second
00-59


Numbers are zero-padded on the left.

Here’s the strftime() function provided by the time module. It converts a struct_time object to a string. We’ll first define the format string fmt and use it again later:

>>> import time
>>> fmt = "It's %A, %B %d, %Y, local time %I:%M:%S%p"
>>> t = time.localtime()
>>> t
time.struct_time(tm_year=2014, tm_mon=2, tm_mday=4, tm_hour=19,
tm_min=28, tm_sec=38, tm_wday=1, tm_yday=35, tm_isdst=0)
>>> time.strftime(fmt, t)
"It's Tuesday, February 04, 2014, local time 07:28:38PM"


If we try this with a date object, only the date parts will work, and the time defaults to midnight:

>>> from datetime import date
>>> some_day = date(2014, 7, 4)
>>> fmt = "It's %B %d, %Y, local time %I:%M:%S%p"
>>> some_day.strftime(fmt)
"It's Friday, July 04, 2014, local time 12:00:00AM"


For a time object, only the time parts are converted:

>>> from datetime import time
>>> some_time = time(10, 35)
>>> some_time.strftime(fmt)
"It's Monday, January 01, 1900, local time 10:35:00AM"


Clearly, you won’t want to use the day parts from a time object, because they’re meaningless.

——————————————

denominator
分母

formerly
以前

omit
省略

mystified
迷惑

duplicates
重复的

dropouts
辍学

——————————————

Using the time Module


It is confusing that Python has a datetime module with a time object, and a separate time module. Furthermore, the time module has a function called—wait for it—time().

One way to represent an absolute time is to count the number of seconds since some starting point. Unix time uses the number of seconds since midnight on January 1, 1970.[8] This value is often called the epoch, and it is often the simplest way to exchange dates and times among systems.

The time module’s time() function returns the current time as an epoch value:

>>> import time
>>> now = time.time()
>>> now
1391488263.664645


If you do the math, you’ll see that it has been over one billion seconds since New Year’s, 1970. Where did the time go?

You can convert an epoch value to a string by using ctime():

>>> time.ctime(now)
'Mon Feb  3 22:31:03 2014'


In the next section, you’ll see how to produce more attractive formats for dates and times.

Epoch values are a useful least-common denominator for date and time exchange with different systems, such as JavaScript. Sometimes, though, you need actual days, hours, and so forth, which time provides as struct_time objects. localtime() provides the time in your system’s time zone, and gmtime() provides it in UTC:

>>> time.localtime(now)
time.struct_time(tm_year=2014, tm_mon=2, tm_mday=3, tm_hour=22, tm_min=31,
tm_sec=3, tm_wday=0, tm_yday=34, tm_isdst=0)
>>> time.gmtime(now)
time.struct_time(tm_year=2014, tm_mon=2, tm_mday=4, tm_hour=4, tm_min=31,
tm_sec=3, tm_wday=1, tm_yday=35, tm_isdst=0)


In my (Central) time zone, 22:31 was 04:31 of the next day in UTC (formerly called Greenwich time or Zulu time). If you omit the argument to localtime() or gmtime(), they assume the current time.

The opposite of these is mktime(), which converts a struct_time object to epoch seconds:

>>> tm = time.localtime(now)
>>> time.mktime(tm)
1391488263.0


This doesn’t exactly match our earlier epoch value of now() because the struct_time object preserves time only to the second.

Some advice: wherever possible, use UTC instead of time zones. UTC is an absolute time, independent of time zones. If you have a server, set its time to UTC; do not use local time.

Here’s some more advice (free of charge, no less): never use daylight savings time if you can avoid it. If you use daylight savings time, an hour disappears at one time of year (“spring ahead”) and occurs twice at another time (“fall back”). For some reason, many organizations use daylight savings in their computer systems, but are mystified every year by data duplicates and dropouts. It all ends in tears.


Note

Remember, your friends are UTC for times, and UTF-8 for strings.

——————————————

#include <iostream>

int main()
{
    using namespace std;
    
    int carrots;
    
    carrots = 25;
    cout << "I have ";
    cout << carrots;
    cout << " carrots.";
    cout << endl;
    carrots = carrots - 1;
    cout << "Crunch, crunch. Now I have " << carrots << " carrots." << endl;
}

——————————————

#include<iostream>
int main()
{
    using namespace std;
    cout << "Come up and C++ me some time.";
    cout << endl;
    cout << "You won't regret it!" << endl;
    return 0;
}

——————————————

The datetime Module(2)


The datetime object includes both the date and time of day. You can create one directly, such as the one that follows, which is for January 2, 2014, at 3:04 A.M., plus 5 seconds and 6 microseconds:

>>> from datetime import datetime
>>> some_day = datetime(2014, 1, 2, 3, 4, 5, 6)
>>> some_day
datetime.datetime(2014, 1, 2, 3, 4, 5, 6)


The datetime object also has an isoformat() method:

>>> some_day.isoformat()
'2014-01-02T03:04:05.000006'


That middle T separates the date and time parts.

datetime has a now() method with which you can get the current date and time:

>>> from datetime import datetime
>>> now = datetime.now()
>>> now
datetime.datetime(2014, 2, 2, 23, 15, 34, 694988)
14
>>> now.month
2
>>> now.day
2
>>> now.hour
23
>>> now.minute
15
>>> now.second
34
>>> now.microsecond
694988


You can merge a date object and a time object into a datetime object by using combine():

>>> from datetime import datetime, time, date
>>> noon = time(12)
>>> this_day = date.today()
>>> noon_today = datetime.combine(this_day, noon)
>>> noon_today
datetime.datetime(2014, 2, 2, 12, 0)


You can yank the date and time from a datetime by using the date() and time() methods:

>>> noon_today.date()
datetime.date(2014, 2, 2)
>>> noon_today.time()
datetime.time(12, 0)

——————————————

investigating
调查

astronomical
天文

microsecond
微秒

subsecond
次秒级

yank
猛地一拉

——————————————

The datetime Module(1)


Let’s begin by investigating the standard datetime module. It defines four main objects, each with many methods:

▪date for years, months, and days
▪time for hours, minutes, seconds, and fractions
▪datetime for dates and times together
▪timedelta for date and/or time intervals


You can make a date object by specifying a year, month, and day. Those values are then available as attributes:

>>> from datetime import date
>>> halloween = date(2014, 10, 31)
>>> halloween
datetime.date(2014, 10, 31)
>>> halloween.day
31
>>> halloween.month
10
>>> halloween.year
2014


You can print a date with its isoformat() method:

>>> halloween.isoformat()
'2014-10-31'


The iso refers to ISO 8601, an international standard for representing dates and times. It goes from most general (year) to most specific (day). It also sorts correctly: by year, then month, then day. I usually pick this format for date representation in programs, and for filenames that save data by date. The next section describes the more complex strptime() and strftime() methods for parsing and formatting dates.

This example uses the today() method to generate today’s date:

>>> from datetime import date
>>> now = date.today()
>>> now
datetime.date(2014, 2, 2)


This one makes use of a timedelta object to add some time interval to a date:

>>> from datetime import timedelta
>>> one_day = timedelta(days=1)
>>> tomorrow = now + one_day
>>> tomorrow
datetime.date(2014, 2, 3)
>>> now + 17*one_day
datetime.date(2014, 2, 19)
>>> yesterday = now - one_day
>>> yesterday
datetime.date(2014, 2, 1)


The range of date is from date.min (year=1, month=1, day=1) to date.max (year=9999, month=12, day=31). As a result, you can’t use it for historic or astronomical calculations.

The datetime module’s time object is used to represent a time of day:

>>> from datetime import time
>>> noon = time(12, 0, 0)
>>> noon
datetime.time(12, 0)
>>> noon.hour
12
>>> noon.minute
0
>>> noon.second
0
>>> noon.microsecond
0


The arguments go from the largest time unit (hours) to the smallest (microseconds). If you don’t provide all the arguments, time assumes all the rest are zero. By the way, just because you can store and retrieve microseconds doesn’t mean you can retrieve time from your computer to the exact microsecond. The accuracy of subsecond measurements depends on many factors in the hardware and operating system.

——————————————

Calendars
日历

ambiguous
模棱两可的

leap year
闰年

longitude
经度

hemisphere
半球

vice versa
反之亦然

overlap
重叠

——————————————

Calendars and Clocks


Programmers devote a surprising amount of effort to dates and times. Let’s talk about some of the problems they encounter, and then get to some best practices and tricks to make the situation a little less messy.

Dates can be represented in many ways—too many ways, actually. Even in English with the Roman calendar, you’ll see many variants of a simple date:

▪July 29 1984
▪29 Jul 1984
▪29/7/1984
▪7/29/1984


Among other problems, date representations can be ambiguous. In the previous examples, it’s easy to determine that 7 stands for the month and 29 is the day of the month, largely because months don’t go to 29. But how about 1/6/2012? Is that referring to January 6 or June 1?

The month name varies by language within the Roman calendar. Even the year and month can have a different definition in other cultures.

Leap years are another wrinkle. You probably know that every four years is a leap year (and the summer Olympics and the American presidential election). Did you also know that every 100 years is not a leap year, but that every 400 years is? Here’s code to test various years for leapiness:

>>> import calendar
>>> calendar.isleap(1900)
False
>>> calendar.isleap(1996)
True
>>> calendar.isleap(1999)
False
>>> calendar.isleap(2000)
True
>>> calendar.isleap(2002)
False
>>> calendar.isleap(2004)
True


Times have their own sources of grief, especially because of time zones and daylight savings time. If you look at a time zone map, the zones follow political and historic boundaries rather than every 15 degrees (360 degrees / 24) of longitude. And countries start and end daylight saving times on different days of the year. In fact, countries in the southern hemisphere advance their clocks when the northern hemisphere is winding them back, and vice versa. (If you think about it a bit, you will see why.)

Python’s standard library has many date and time modules: datetime, time, calendar, dateutil, and others. There’s some overlap, and it’s a bit confusing.

——————————————

Kill a Process with terminate()


If you created one or more processes and want to terminate one for some reason (perhaps it’s stuck in a loop, or maybe you’re bored, or you want to be an evil overlord), use terminate(). In the example that follows, our process would count to a million, sleeping at each step for a second, and printing an irritating message. However, our main program runs out of patience in five seconds and nukes it from orbit:

import multiprocessing
import time
import os

def whoami(name):
    print("I'm %s, in process %s" % (name, os.getpid()))

def loopy(name):
    whoami(name)
    start = 1
    stop = 1000000
    for num in range(start, stop):
        print("\tNumber %s of %s. Honk!" % (num, stop))
        time.sleep(1)

if __name__ == "__main__":
    whoami("main")
    p = multiprocessing.Process(target=loopy, args=("loopy",))
    p.start()
    time.sleep(5)
    p.terminate()


When I run this program, I get the following:

I'm main, in process 97080
I'm loopy, in process 97081
    Number 1 of 1000000. Honk!
    Number 2 of 1000000. Honk!
    Number 3 of 1000000. Honk!
    Number 4 of 1000000. Honk!
    Number 5 of 1000000. Honk!

——————————————

import requests
import json


def OrganizeText(text):
    while (text[0:1] == '\n' or text[0:1] == ' ' or text[0:1] == '　'):#left
        text = text[1😏
    while (text[-1😏 == '\n' or text[-1😏 == ' ' or text[-1😏 == '　'):#right
        text = text[:-1]
    return text

def get_info_by_words(words):
    headers = {'Host': 'fanyi.youdao.com', 'User-Agent': 'translator/2.2.0(Android/4.4.4/en_US;HM NOTE 1S)', 'Content-Type': 'application/x-www-form-urlencoded'}
    body = 'q='+ words +'&doctype=json&imei=867822021478135&screen=720x1280&model=HM_NOTE_1S&mid=4.4.4&version=2.2.0&vendor=googleplay&keyfrom=fanyi.2.2.0.android' #&type=EN2ZH_CN
    r = requests.post('http://fanyi.youdao.com/appapi/translate?&model=HM_NOTE_1S&mid=4.4.4&imei=867822021478135&vendor=googleplay&screen=720x1280&version=2.2.0&keyfrom=fanyi.2.2.0.android', headers=headers, data= body)
    return handle_info(r.text)

def handle_info(text):
    big_dict = json.loads(text)

    try:
        fanyi_dict = big_dict.get('fanyi')
        r_fanyi = fanyi_dict.get('org') + '\n' + fanyi_dict.get('trans')
        r_fanyi = OrganizeText(r_fanyi)
    except:
        r_fanyi = ''
    
    try:
        dict_dict = big_dict.get('dict')
        r_dict = dict_dict.get('org')  + '\n'
        for i in dict_dict.get('phrases'):
            r_dict += i + '\n'
        r_dict = r_dict[0:len(r_dict)+1-2]
        r_dict = OrganizeText(r_dict)
    except:
        r_dict = ''

    try:
        sentence_list = big_dict.get('sentence')
        r_sentence = ''
        for i in sentence_list:
            i_dict = dict(i)
            r_sentence += i_dict.get('org') + '\n' + i_dict.get('trans') +'\n\n'
        r_sentence = r_sentence.replace('<b>','').replace('</b>','')
        r_sentence = r_sentence.split('<br><br>')[0]
        r_sentence = OrganizeText(r_sentence)
    except:
        r_sentence = ''

    result = ''
    for i in [r_fanyi, r_dict, r_sentence]:
        if i != '':
            result += i + '\n\n\n'
    result = OrganizeText(result)

    return result


print(get_info_by_words('sky'))

——————————————

spawned
催生了

bells
钟

clown
小丑

calliope
A 风琴

queue
队列

——————————————

Create a Process with multiprocessing


You can run a Python function as a separate process or even run multiple independent processes in a single program with the multiprocessing module. Here’s a short example that does nothing useful; save it as mp.py and then run it by typing python mp.py:

import multiprocessing
import os

def do_this(what):
    whoami(what)
def whoami(what):
    print("Process %s says: %s" % (os.getpid(), what))

if __name__ == "__main__":
    whoami("I'm the main program")
    for n in range(4):
        p = multiprocessing.Process(target=do_this,
          args=("I'm function %s" % n,))
        p.start()


When I run this, my output looks like this:

Process 6224 says: I'm the main program
Process 6225 says: I'm function 0
Process 6226 says: I'm function 1
Process 6227 says: I'm function 2
Process 6228 says: I'm function 3


The Process() function spawned a new process and ran the do_this() function in it. Because we did this in a loop that had four passes, we generated four new processes that executed do_this() and then exited.

The multiprocessing module has more bells and whistles than a clown on a calliope. It’s really intended for those times when you need to farm out some task to multiple processes to save overall time; for example, downloading web pages for scraping, resizing images, and so on. It includes ways to queue tasks, enable intercommunication among processes, and wait for all the processes to finish.

——————————————

Create a Process with subprocess


All of the programs that you’ve seen here so far have been individual processes. You can start and stop other existing programs from Python by using the standard library’s subprocess module. If you just want to run another program in a shell and grab whatever output it created (both standard output and standard error output), use the getoutput() function. Here, we’ll get the output of the Unix date program:

>>> import subprocess
>>> ret = subprocess.getoutput('date')
>>> ret
'Sun Mar 30 22:54:37 CDT 2014'


You won’t get anything back until the process ends. If you need to call something that might take a lot of time, see the discussion on concurrency in Concurrency. Because the argument to getoutput() is a string representing a complete shell command, you can include arguments, pipes, < and > I/O redirection, and so on:

>>> ret = subprocess.getoutput('date -u')
>>> ret
'Mon Mar 31 03:55:01 UTC 2014'


Piping that output string to the wc command counts one line, six “words,” and 29 characters:

>>> ret = subprocess.getoutput('date -u | wc')
>>> ret
'       1       6      29'


A variant method called check_output() takes a list of the command and arguments. By default it only returns standard output as type bytes rather than a string and does not use the shell:

>>> ret = subprocess.check_output(['date', '-u'])
>>> ret
b'Mon Mar 31 04:01:50 UTC 2014\n'


To show the exit status of the other program, getstatusoutput() returns a tuple with the status code and output:

>>> ret = subprocess.getstatusoutput('date')
>>> ret
(0, 'Sat Jan 18 21:36:23 CST 2014')


If you don’t want to capture the output but might want to know its exit status, use call():

>>> ret = subprocess.call('date')
Sat Jan 18 21:33:11 CST 2014
>>> ret
0


(In Unix-like systems, 0 is usually the exit status for success.)
That date and time was printed to output but not captured within our program. So, we saved the return code as ret.

You can run programs with arguments in two ways. The first is to specify them in a single string. Our sample command is date -u, which prints the current date and time in UTC (you’ll read more about UTC in a few pages):

>>> ret = subprocess.call('date -u', shell=True)
Tue Jan 21 04:40:04 UTC 2014


You need that shell=True to recognize the command line date -u, splitting it into separate strings and possibly expanding any wildcard characters such as * (we didn’t use any in this example).

The second method makes a list of the arguments, so it doesn’t need to call the shell:

>>> ret = subprocess.call(['date', '-u'])
Tue Jan 21 04:41:59 UTC 2014

——————————————

kernel
内核

interfere
影响

——————————————

Programs and Processes


When you run an individual program, your operating system creates a single process. It uses system resources (CPU, memory, disk space) and data structures in the operating system’s kernel (file and network connections, usage statistics, and so on). A process is isolated from other processes—it can’t see what other processes are doing or interfere with them.

The operating system keeps track of all the running processes, giving each a little time to run and then switching to another, with the twin goals of spreading the work around fairly and being responsive to the user. You can see the state of your processes with graphical interfaces such as the Mac’s Activity Monitor (OS X), or Task Manager on Windows-based computers.

You can also access process data from your own programs. The standard library’s os module provides a common way of accessing some system information. For instance, the following functions get the process ID and the current working directory of the running Python interpreter:

>>> import os
>>> os.getpid()
76051
>>> os.getcwd()
'/Users/williamlubanovic'


And these get my user ID and group ID:

>>> os.getuid()
501
>>> os.getgid()
20

——————————————

from bs4 import BeautifulSoup

import requests


r = requests.get('http://shici.chazidian.com/shi1389/')

s = BeautifulSoup(r.text, 'html.parser')

result = s.find_all('p', attrs={"style":"text-align:center;"}, limit=6)

ss = BeautifulSoup(str(result), 'html.parser')

result = ss.find_all('span')

print(s.title.string[0:3])

for i, x in enumerate(result):
    if i > 0:
        print(x.string.replace(u'\xa0', u' ')+'\n')
    else:
        print(x.string.replace(u'\xa0', u' ')+'\n\n')

——————————————

import re


def get_URLs(text):
   return re_get_first_text(r'https?://\S+', text)

def re_get_first_text(regular_expression, from_text):
    result_list = re.findall(regular_expression, from_text)
    if (len(result_list) != 0):
        return result_list[0]
    else:
        return ''

text = "What a big SB!\nhttps://baidu.com"
print(get_URLs(text))

——————————————

List Matching Files with glob()


The glob() function matches file or directory names by using Unix shell rules rather than the more complete regular expression syntax. Here are those rules:

* matches everything (re would expect .*)

? matches a single character

[abc] matches character a, b, or c

[!abc] matches any character except a, b, or c


Try getting all files or directories that begin with m:

>>> import glob
>>> glob.glob('m*')
['mcintyre']


How about any two-letter files or directories?

>>> glob.glob('??')
[]


I’m thinking of an eight-letter word that begins with m and ends with e:

>>> glob.glob('m??????e')
['mcintyre']


What about anything that begins with a k, l, or m, and ends with e?

>>> glob.glob('[klm]*e')
['mcintyre']

——————————————

Change Current Directory with chdir()


With this function, you can go from one directory to another. Let’s leave the current directory and spend a little time in poems:

>>> import os
>>> os.chdir('poems')
>>> os.listdir('.')
['mcintyre']

——————————————

List Contents with listdir()


Okay, take two; let’s make poems again, with some contents:

>>> os.mkdir('poems')


Now, get a list of its contents (none so far):

>>> os.listdir('poems')
[]


Next, make a subdirectory:

>>> os.mkdir('poems/mcintyre')
>>> os.listdir('poems')
['mcintyre']


Create a file in this subdirectory (don’t type all these lines unless you really feel poetic; just make sure you begin and end with matching quotes, either single or tripled):

>>> fout = open('poems/mcintyre/the_good_man', 'wt')
>>> fout.write('''Cheerful and happy was his mood,
... He to the poor was kind and good,
... And he oft' times did find them food,
... Also supplies of coal and wood,
... He never spake a word was rude,
... And cheer'd those did o'er sorrows brood,
... He passed away not understood,
... Because no poet in his lays
... Had penned a sonnet in his praise,
... 'Tis sad, but such is world's ways.
... ''')
344
>>> fout.close()


Finally, let’s see what we have. It had better be there:

>>> os.listdir('poems/mcintyre')
['the_good_man']

——————————————

Delete with rmdir()


Upon second thought, you decide you don’t need that directory after all. Here’s how to delete it:

>>> os.rmdir('poems')
>>> os.path.exists('poems')
False

——————————————

It's been a month since I came to this new school and I really want share to with you some of the problems I have been experiencing.

——————————————

As I tell you last time, I made three new friends here.

结合 last time 以及下一句 “I made three new friend here” 中的 made 可知，此处在描述上一次发生的事情，且“我上一次告诉你”为发生在过去的事实，应用一般过去时。故正确答案为将 tell 改为 told。

As I told you last time, I made three new friends here.

——————————————

We hang out together during lunch and after school.

——————————————

We've been spending a lot of time sing in karaoke bars.

spend some time （in） doing sth. 为固定搭配，意为“花多少时间做某事”。此处表达“花很多时间唱歌”。故正确答案为将 sing 改为 singing。

We've been spending a lot of time singing in karaoke bars.

——————————————

It's been three Saturdays now and it really costs me much.

——————————————

And I started to see this as a time-wasting activity!

——————————————

In fact, I don't like to go anymore, but I'm afraid I'll lose their friendship.

——————————————

How do you think I should do?

分析句子成分可知，do you think 在此处为插入语，若为 how 则句子中缺少了 do 的宾语，结构不完整。可用 what 作 do 的宾语，表示“你认为我应该做什么？”，符合文意和语法结构。故正确答案为将 How 改为 What。

What do you think I should do?

——————————————

If you were me, would you talk to him?

结合本段倒数第三句 “... so I'm afraid I'll lose their friendship” 中的 their 可知，此处描述的是“我”和他们之间的事情，故应表达的是“你会和他们谈吗？”。故正确答案为将 him 改为 them。

If you were me, would you talk to them?

——————————————

Please help with me and give me some advice.

——————————————

It's been a month since I came to this new school and I really want to share with you some of the problems I have been experiencing.

As I told you last time, I made three new friends here.

We hang out together during lunch and after school.

We've been spending a lot of time singing in karaoke bars.

It's been three Saturdays now and it really costs me much.

And I started to see this as a time-wasting activity!

In fact, I don't like to go anymore, but I'm afraid I'll lose their friendship.

What do you think I should do?

If you were me, would you talk to them?

Please help me and give me some advice.

——————————————

Create with mkdir()


This example shows how to create a directory called poems to store that precious verse:

>>> os.mkdir('poems')
>>> os.path.exists('poems')
True

——————————————

hierarchy
层次结构

——————————————

Directories


In most operating systems, files exist in a hierarchy of directories (more often called folders these days). The container of all of these files and directories is a file system (sometimes called a volume). 

The standard os module deals with operating specifics such as these and provides the following functions with which you can manipulate them.

——————————————

Delete a File with remove()


In this snippet, we use the remove() function and say farewell to oops.txt:

>>> os.remove('oops.txt')
>>> os.path.exists('oops.txt')
False

——————————————

Get a Pathname with abspath()


This function expands a relative name to an absolute one. If your current directory is /usr/gaberlunzie and the file oops.txt is there, also, you can type the following:

>>> os.path.abspath('oops.txt')
'/usr/gaberlunzie/oops.txt'

——————————————

Ownership
所有权

numeric
数字

——————————————

Change Ownership with chown()


This function is also Unix/Linux/Mac–specific. You can change the owner and/or group ownership of a file by specifying the numeric user ID (uid) and group ID (gid):

>>> uid = 5
>>> gid = 22
>>> os.chown('oops', uid, gid)

——————————————

intensely
强烈的

compress
压缩

octal
八进制

cryptic
神秘的

obscure
晦涩难懂的

constants
常量

——————————————

Change Permissions with chmod()


On a Unix system, chmod() changes file permissions.There are read, write, and execute permissions for the user (that’s usually you, if you created the file), the main group that the user is in, and the rest of the world. The command takes an intensely compressed octal (base 8) value that combines user, group, and other permissions. For instance, to make oops.txt only readable by its owner, type the following:

>>> os.chmod('oops.txt', 0o400)


If you don’t want to deal with cryptic octal values and would rather deal with (slightly) obscure cryptic symbols, you can import some constants from the stat module and use a statement such as the following:

>>> import stat
>>> os.chmod('oops.txt', stat.S_IRUSR)

——————————————

Link with link() or symlink()


In Unix, a file exists in one place, but it can have multiple names, called links. In low-level hard links, it’s not easy to find all the names for a given file. A symbolic link is an alternative method that stores the new name as its own file, making it possible for you to get both the original and new names at once. The link() call creates a hard link, and symlink() makes a symbolic link. The islink() function checks whether the file is a symbolic link.

Here’s how to make a hard link to the existing file oops.txt from the new file yikes.txt:

>>> os.link('oops.txt', 'yikes.txt')
>>> os.path.isfile('yikes.txt')
True


To create a symbolic link to the existing file oops.txt from the new file jeepers.txt, use the following:

>>> os.path.islink('yikes.txt')
False
>>> os.symlink('oops.txt', 'jeepers.txt')
>>> os.path.islink('jeepers.txt')
True

——————————————

http://www.shareditor.com/

——————————————

https://github.com/warmheartli/FullStackDeveloperCourse/blob/master/README.md

——————————————

import sys
import os
import subprocess

EXEC = sys.executable #local pythonw.exe

def run_py_file(py_path):
    result = subprocess.run([EXEC, py_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
    if result.returncode == 0:
        return str(result.stdout)
    else:
        return 'error'

def run_py_codes(py_codes):
    codes = str(py_codes)
    if codes.count('print(')==0 and codes.count('import ')==0:
        result = str(eval(codes))
        return result
    else:
        py_path = os.path.dirname(os.path.realpath(__file__)) + '\\codes.txt'
        with open(py_path, 'w') as out:
            out.write(codes)
        result = str(run_py_file(py_path))
        return result



from flask import Flask, request
app = Flask(__name__)

@app.route('/')
def home_page(): #http://127.0.0.1:5000
    return 'POST codes to http://127.0.0.1:5000/Python/'
    
@app.route('/Python/', methods = ['POST', 'GET'])
def run_python():
    if request.method == 'GET': #http://127.0.0.1:5000/Python
        return 'Only support POST!'

    elif request.method == 'POST': #POST codes to http://127.0.0.1:5000/Python/
        codes = request.data.decode('utf-8')
        return run_py_codes(codes)

if __name__ == '__main__':
    app.run()

——————————————

from flask import Flask, request
app = Flask(__name__)

@app.route('/')
def home_page():
    return 'Welcome to your own web server!'
    #http://127.0.0.1:5000

@app.route('/Python/', methods = ['POST', 'GET'])
def run_python():
    if request.method == 'GET':
        return 'Only support POST!'
        #http://127.0.0.1:5000/Python

    elif request.method == 'POST':
        return "Here's your codes:\n\n" +  request.data.decode('utf-8')
        #POST text to http://127.0.0.1:5000/Python/

if __name__ == '__main__':
    app.run()

——————————————

Quickstart:

http://flask.pocoo.org/docs/0.11/quickstart/#quickstart



Core sytanx:

http://flask.pocoo.org/docs/0.11/quickstart/#the-request-object
http://flask.pocoo.org/docs/0.11/api/#flask.request

——————————————

So easy to understand.

——————————————

from flask import Flask, request
app = Flask(__name__)

@app.route('/')
def api_root():
    return 'Welcome'

@app.route('/articles/<articleid>')
def api_article(articleid):
    return 'You are reading ' + articleid

@app.route('/echo', methods = ['GET', 'POST', 'PATCH', 'PUT', 'DELETE'])
def api_echo():
    if request.method == 'GET':
        return "ECHO: GET\n"

    elif request.method == 'POST':
        return "ECHO: POST\n"

    elif request.method == 'PATCH':
        return "ECHO: PACTH\n"

    elif request.method == 'PUT':
        return "ECHO: PUT\n"

    elif request.method == 'DELETE':
        return "ECHO: DELETE"

if __name__ == '__main__':
    app.run()

——————————————

Guys, you should look at this:

http://blog.luisrei.com/articles/flaskrest.html

——————————————

The real important thing is how to use it, and make it work in reality. Reading and understanding are just the first step.

——————————————

said

——————————————

You may couldn't remember all those knowledge. Don't worry, just regard it as a dictionary. Then all you need to do, is simply remember its title and what they say.

Truly speaking, the real important thing is how to use it, and make it into reality work. Reading and understanding are just the first step to begin.

——————————————

Its

——————————————

This chapter is a mistake I made, so if you really want to know how to construct a API, please visit it's official website:

http://flask.pocoo.org/

——————————————

RESTful Web Services with Flask


Flask makes it very easy to create RESTful web services. The familiar route() decorator along with its methods optional argument can be used to declare the routes that handle the resource URLs exposed by the service. Working with JSON data is also simple, as JSON data included with a request is automatically exposed as a request.json Python dictionary and a response that needs to contain JSON can be easily generated from a Python dictionary using Flask’s jsonify() helper function.

The following sections show how Flasky can be extended with a RESTful web service that gives clients access to blog posts and related resources.

——————————————

You may couldn't remember all those knowledge. Don't worry, just regard it as a dictionary. Then all you need to do, is simply remember its title and what they say.

Truly speaking, the real important thing is how to use it, and make it into reality work. Reading and understanding are just the first step to begin.

——————————————

http://docs.mathjax.org/en/latest/start.html
http://asciimath.org/

——————————————

tolerant
宽容

organized
有组织的

maintenance
维护

burden
负担

deployments
部署

——————————————

Versioning


In a traditional server-centric web application, the server has full control of the application. When an application is updated, installing the new version in the server is enough to update all users because even the parts of the application that run in the user’s web browser are downloaded from the server.

The situation with RIAs and web services is more complicated, because often clients are developed independently of the server—maybe even by different people. Consider the case of an application where the RESTful web service is used by a variety of clients including web browsers and native smartphone clients. The web browser client can be updated in the server at any time, but the smartphone apps cannot be updated by force; the smartphone owner needs to allow the update to happen. Even if the smartphone owner is willing to update, it is not possible to time the deployment of the updated smartphone applications to all the app stores to coincide exactly with the deployment of the new server.

For these reasons, web services need to be more tolerant than regular web applications and be able to work with old versions of its clients. A common way to address this problem is to version the URLs handled by the web service. For example, the first release of the blogging web service could expose the collection of blog posts at /api/v1.0/posts/.

Including the web service version in the URL helps keeps old and new features organized so that the server can provide new features to new clients while continuing to support old clients. An update to the blogging service could change the JSON format of blog posts and now expose blog posts as /api/v1.1/posts/, while keeping the older JSON format for clients that connect to /api/v1.0/posts/. For a period of time, the server handles all the URLs in their v1.1 and v1.0 variations.

Although supporting multiple versions of the server can become a maintenance burden, there are situations in which this is the only way to allow the application to grow without causing problems to existing deployments.

——————————————

forth
出来

negotiation
谈判

mechanisms
机制

ties
关系

——————————————

Request and Response Bodies


Resources are sent back and forth between client and server in the bodies of requests and responses, but REST does not specify the format to use to encode resources. The Content-Type header in requests and responses is used to indicate the format in which a resource is encoded in the body. The standard content negotiation mechanisms in the HTTP protocol can be used between client and server to agree on a format that both support.

The two formats commonly used with RESTful web services are JavaScript Object Notation (JSON) and Extensible Markup Language (XML). For web-based RIAs, JSON is attractive because of its close ties to JavaScript, the client-side scripting language used by web browsers. Returning to the blog example API, a blog post resource could be represented in JSON as follows:

{

    "url": "http://www.example.com/api/posts/12345",

    "title": "Writing RESTful APIs in Python",

    "author": "http://www.example.com/api/users/2",

    "body": "... text of the article here ...",

    "comments": "http://www.example.com/api/posts/12345/comments"

}


Note how the url, author, and comments fields in the blog post above are fully qualified resource URLs. This is important because these URLs allow the client to discover new resources.

In a well-designed RESTful API, the client just knows a short list of top-level resource URLs and then discovers the rest from links included in responses, similar to how you can discover new web pages while browsing the Web by clicking on links that appear in pages that you know.

——————————————

Request Methods


The client application sends requests to the server at the established resource URLs and uses the request method to indicate the desired operation. 

Followling request methods are commonly used in RESTful APIs:

GET

POST

PUT

DELETE


If you have any questions, Google for yourself.

——————————————

I'm very happy to receive your e-mail in which you asked me about my life.

——————————————

As a Senior 3 student, I am now working very hard to preparing for the National College Entrance Examination.

考查动词不定式。此处 to 为动词不定式，后接动词原形，表目的，“我努力学习来准备高考”。故正确答案为将 preparing 改为 prepare。

As a Senior 3 student, I am now working very hard to prepare for the National College Entrance Examination.

——————————————

In class, I listen to the teachers attentively and take notes carefully.

——————————————

Out off class, I take an active part in various sport to keep healthy, which, I believe, is very important for my study.

考查固定搭配。out of class 意为“课外”，off 无此用法。故正确答案为将 off 改为 of。

考查名词。sport 为可数名词，它的前面是 various（各种各样的），显然此处要用 sport 的复数形式。故正确答案为将 sport 改为 sports。

Out of class, I take an active part in various sports to keep healthy, which, I believe, is very important for my study.

——————————————

Both my teachers and parents give me many support.

考查形容词。此处 support 为不可数名词，意为“支持”，故用 much 修饰。故正确答案为将 many 改为 much。

Both my teachers and parents give me much support.

——————————————

With their help and encouragement, I have been made great progress and been able to build up my confidence.

考查动词的语态。此处“我”和“取得进步”之间应该是主动关系而不是被动关系。故正确答案为把 been 删除。

With their help and encouragement, I have made great progress and been able to build up my confidence.

——————————————

I have decided to attend medical university.

考查名词。university 为可数名词，意为“大学”，此处“我”显然只能上一所大学，所以要在 university 前加 a。故正确答案为在 attend 和 medical 之间加 a。

I have decided to attend a medical university.

——————————————

I'm very happy to receive your e-mail in which you asked me about my life.

As a Senior 3 student, I am now working very hard to prepare for the National College Entrance Examination.

In class, I listen to the teachers attentively and take notes carefully.

Out of class, I take an active part in various spots to keep healthy, which, I believe, is very important for my study.

Both my teachers and parents give me much support.

With their help and encouragement, I have  made great progress and been able to build up my confidence.

I have decided to attend a medical university.

——————————————

Resources Are Everything


The concept of resources is core to the REST architectural style. In this context, a resource is an item of interest in the domain of the application. For example, in the blogging application, users, blog posts, and comments are all resources.

Each resource must have a unique URL that represents it. Continuing with the blogging example, a blog post could be represented by the URL /api/posts/12345, where 12345 is a unique identifier for the post such as the post’s database primary key. The format or contents of the URL do not really matter; all that matters is that each resource URL uniquely identifies a resource.

A collection of all the resources in a class also has an assigned URL. The URL for the collection of blog posts could be /api/posts/ and the URL for the collection of all comments could be /api/comments/.

An API can also define collection URLs that represent logical subsets of all the resources in a class. For example, the collection of all comments in blog post 12345 could be represented by the URL /api/posts/12345/comments/. It is a common practice to define URLs that represent collections of resources with a trailing slash, as this gives them a “folder” representation.


Tip

Be aware that Flask applies special treatment to routes that end with a slash. If a client requests a URL without a trailing slash and the only matching route has a slash at the end, then Flask will automatically respond with a redirect to the trailing slash URL. No redirects are issued for the reverse case.

——————————————

architectural
建筑式的

characteristics
特征

cacheable
Could be 缓存

noncacheable
Couldn't be 缓存

intermediaries
中介

optimization
优化

purposes
目的

consistent
一致的

Layered
分层的

scalability
可伸缩性

——————————————

Introduction to REST


Roy Fielding’s Ph.D. dissertation introduces the REST architectural style for web services by listing its six defining characteristics:

Client-Server 
There must be a clear separation between the clients and the server. 

Stateless 
A client request must contain all the information that is necessary to carry it out. The server must not store any state about the client that persists from one request to the next. 

Cache 
Responses from the server can be labeled as cacheable or noncacheable so that clients (or intermediaries between clients and servers) can use a cache for optimization purposes. 

Uniform Interface 
The protocol by which clients access server resources must be consistent, well defined, and standardized. The commonly used uniform interface of REST web services is the HTTP protocol. 

Layered System 
Proxy servers, caches, or gateways can be inserted between clients and servers as necessary to improve performance, reliability, and scalability. 

Code-on-Demand 
Clients can optionally download code from the server to execute in their context.

——————————————

Additional Chapter -1. Application Programming Interfaces


In recent years, there has been a trend in web applications to move more and more of the business logic to the client side, producing an architecture that is known as Rich Internet Application (RIA). In RIAs, the server’s main (and sometimes only) function is to provide the client application with data retrieval and storage services. In this model, the server becomes a web service or Application Programming Interface (API).

There are several protocols by which RIAs can communicate with a web service. Remote Procedure Call (RPC) protocols such as XML-RPC or its derivative Simplified Object Access Protocol (SOAP) were popular choices a few years ago. More recently, the Representational State Transfer (REST) architecture has emerged as the favorite for web applications due to it being built on the familiar model of the World Wide Web.

Flask is an ideal framework to build RESTful web services due to its lightweight nature. In this chapter, you will learn how to implement a Flask-based RESTful API.

——————————————

Change Name with rename()


This function does exactly what it says. In the example here, it renames ohno.txt to ohwell.txt:

>>> import os
>>> os.rename('ohno.txt', 'ohwell.txt')

——————————————

Copy with copy()


The copy() function comes from another module, shutil. This example copies the file oops.txt to the file ohno.txt:

>>> import shutil
>>> shutil.copy('oops.txt', 'ohno.txt')


The shutil.move() function copies a file and then removes the original.

——————————————

symbolic
象征性的

law-abiding file
守法的文件

shorthand
速记

fully qualified filenames
完全限定的文件名

——————————————

Check Type with isfile()


The functions in this section check whether a name refers to a file, directory, or symbolic link (see the examples that follow for a discussion of links).

The first function we’ll look at, isfile, asks a simple question: is it a plain old law-abiding file?

>>> name = 'oops.txt'
>>> os.path.isfile(name)
True


Here’s how you determine a directory:

>>> os.path.isdir(name)
False


A single dot (.) is shorthand for the current directory, and two dots (..) stands for the parent directory. These always exist, so a statement such as the following will always report True:

>>> os.path.isdir('.')
True


The os module contains many functions dealing with pathnames (fully qualified filenames, starting with / and including all parents). One such function, isabs(), determines whether its argument is an absolute pathname. The argument doesn’t need to be the name of a real file:

>>> os.path.isabs(name)
False
>>> os.path.isabs('/big/fake/name')
True
>>> os.path.isabs('big/fake/name/without/a/leading/slash')
False

——————————————

Check Existence with exists()


To verify whether the file or directory is really there or you just imagined it, you can provide exists(), with a relative or absolute pathname, as demonstrated here:

>>> import os
>>> os.path.exists('oops.txt')
True
>>> os.path.exists('./oops.txt')
True
>>> os.path.exists('waffles')
False
>>> os.path.exists('.')
True
>>> os.path.exists('..')
True

——————————————

Create with open()


File Input/Output introduced you to the open() function and explains how you can use it to open a file or create one if it doesn’t already exist. Let’s create a text file called oops.txt:

>>> fout = open('oops.txt', 'wt')
>>> print('Oops, I created a file.', file=fout)
>>> fout.close()


With that done, let’s perform some tests with it.

——————————————

patterned
有图案的

——————————————

Files


Python, like many other languages, patterned its file operations after Unix. Some functions, such as chown() and chmod(), have the same names, but there are a few new ones.

——————————————

__name__


__name__ is the name of the main module or package of the application.

——————————————

What is route?


Clients such as web browsers send requests to the web server, which in turn sends them to the Flask application instance. The application instance needs to know what code needs to run for each URL requested, so it keeps a mapping of URLs to Python functions. The association between a URL and the function that handles it is called a route.

——————————————

累了整理吧，自由的看看Flask Web Development这本书吧

我正在加餐(多吸收点后端程序设计的知识)

这几天可能无更，you could play by yourself.

——————————————

One thing a computer can do that most humans can’t is be sealed up in a cardboard box and sit in a warehouse.
电脑可以做的一件事,大多数人不能被密封在一个纸板盒,坐在一个仓库。

insomnia
失眠

——————————————

Chapter 10. Systems


In your everyday use of a computer, you do such things as list the contents of a folder or directory, create and remove files, and other housekeeping that’s necessary if not particularly exciting. You can also carry out these tasks, and more, within your own Python programs. Will this power drive you mad or cure your insomnia? We’ll see.

Python provides many system functions through a module named os (for “operating system”), which we’ll import for all the programs in this chapter.

——————————————

9.5. Modify your server’s home() function to use the home.html template. Provide it with three GET parameters: thing, height, and color.


Here comes flask3.py:

from flask import Flask, request, render_template

app = Flask(__name__)
@app.route('/')
def home():
    thing = request.values.get('thing')
    height = request.values.get('height')
    color = request.values.get('color')
    return render_template('home.html',
        thing=thing, height=height, color=color)

app.run(debug=True)


Go to this address in your web client:

http://localhost:5000/?thing=Octothorpe&height=7&color=green


You should see the following:

I'm of course referring to Octothorpe, which is 7 feet tall and green.

——————————————

Yesterday I met an old lady, with which I had a pleasant chat.

考查定语从句。分析本句句意可知，昨天“我”遇到了一位老太太，并和她进行了愉快的交谈。当介词放在关系代词的前面时，关系代词常用 which 或 whom，又由于前文中的先行词 “an old lady” 是人，所以此处应该填 whom。故正确答案为将 which 改为 whom。

Yesterday I met an old lady, with whom I had a pleasant chat.

——————————————

While she was leaving, I said to her, "Have a great day!" 

考查时间状语从句。分析本句句意可知，当她离开的时候，“我”对她说…。由于 while 引导时间状语从句时必须与延续性动词连接，而 leave 是短暂性动词，因此只能用 when 和 as 引导。故正确答案为将 While 改为 When/As。

When she was leaving, I said to her, "Have a great day!" 

——————————————

She looked up at me from his wheelchair, saying, "No, have a great life! It's not just today that are great!" 

考查形容词性物主代词。分析本句句意可知，老太太坐在轮椅上看着我…，显然老太太是一名女性，因此应该使用形容词性物主代词 her 而非 his。故正确答案为将 his 改为 her。

考查主谓一致。分析本句句意可知，不仅仅是今天要活得精彩，本句中 that 后面引导的定语从句修饰 today，显然 today 是单数名词，因此定语从句中的谓语动词应该用单数。故正确答案为将 are 改为 is。

She looked up at me from her wheelchair, saying, "No, have a great life! It's not just today that is great!" 

——————————————

Her words made me to smile.

考查固定搭配。分析本句句意可知，老太太的话使我会心一笑。make sb. do sth. 表示使某人做某事。因此应该直接填写 smile 的动词原形。故正确答案为把 to 去掉。

Her words made me smile.

——————————————

Yes, all of us should live every day to the fullest.

——————————————

Each day isn't another day filled with sadness or regret, and a special moment that can't be enjoying again.

考查连词。分析本句句意可知，每一天都不会是另一个充满悲伤和后悔的日子，而是一个永远都不会再经历的特殊时刻。显然前后句之间是转折关系，应该用转折连词 but 而非并列连词 and。故正确答案为将 and 改为 but。

考查被动语态。分析本句句意可知，每一天都是再也不会经历的特殊时刻。显然 each day 和 enjoy 之间是被动关系，因此应该使用 enjoy 的过去分词形式 enjoyed 而非 enjoying。故正确答案为将 enjoying 改为 enjoyed。

Each day isn't another day filled with sadness or regret, but a special moment that can't be enjoyed again.

——————————————

It is very important to accept that you are the one in control your life.

考查固定搭配。分析本句句意可知，每个人都是掌控自己人生的那个人。in control of ... 构成固定短语，意为“控制，管理，掌握”。除此以外，当 control 作动词时，可把 in 替换为 to。故正确答案为在 control 和 your 之间加 of 或将 in 替换为 to。

It is very important to accept that you are the one to control your life.

——————————————

So I share with you the message I got from an old lady with a sunny nature: Enjoy your life!

考查冠词。分析本句句意可知，“我”和你分享从那个有着开朗性格的老太太那里得到的经验。此处 old lady 特指这个和作者交谈过的有着开朗性格的老太太，因此应该使用定冠词 the 而非不定冠词 an/a。故正确答案为将 an 改为 the。

So I share with you the message I got from the old lady with a sunny nature: Enjoy your life!

——————————————

Yesterday I met an old lady, with whom I had a pleasant chat.

When she was leaving, I said to her, "Have a great day!" 

She looked up at me from her wheelchair, saying, "No, have a great life! It's not just today that is great!" 

Her words made me smile.

Yes, all of us should live every day to the fullest.

Each day isn't another day filled with sadness or regret, but a special moment that can't be enjoyed again.

It is very important to accept that you are the one to control your life.

So I share with you the message I got from the old lady with a sunny nature: Enjoy your life!

——————————————

9.4. Create a Jinja2 template file called home.html with the following contents:

<html>
<head>
<title>It's alive!</title>
<body>
I'm of course referring to {{thing}}, which is {{height}} feet tall and {{color}}.
</body>
</html>


Make a directory called templates and create the file home.html with the contents just shown. If your Flask server is still running from the previous examples, it will detect the new content and restart itself.

——————————————

9.3. Add a home() function to handle requests for the home page. Set it up to return the string It's alive!


from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
    return "It's alive!"

app.run(debug=True)


Start the server:

$ python flask2.py
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader

——————————————

9.2. Build a skeleton website, using Flask’s debug/reload development web server. Ensure that the server starts up for hostname localhost on default port 5000. If your computer is already using port 5000 for something else, use another port number.


Here’s flask1.py:

from flask import Flask

app = Flask(__name__)

app.run(port=5000, debug=True)


Gentlemen, start your engines:

$ python flask1.py
 * Running on http://127.0.0.1:5000/
 * Restarting with reloader

——————————————

complications
并发症；困难

destination
目的地

grunt work
枯燥工作

enumerate
列举

——————————————

Scrape HTML with BeautifulSoup


If you already have the HTML data from a website and just want to extract data from it, BeautifulSoup is a good choice. HTML parsing is harder than it sounds. This is because much of the HTML on public web pages is technically invalid: unclosed tags, incorrect nesting, and other complications. If you try to write your own HTML parser by using regular expressions (discussed in Chapter 7) you’ll soon encounter these messes.

To install BeautifulSoup, type the following command (don’t forget the final 4, or pip will try to install an older version and probably fail):

$ pip install beautifulsoup4


Now, let’s use it to get all the links from a web page. The HTML a element represents a link, and href is its attribute representing the link destination. In the following example, we’ll define the function get_links() to do the grunt work, and a main program to get one or more URLs as command-line arguments:

def get_links(url):
    import requests
    from bs4 import BeautifulSoup as soup
    result = requests.get(url)
    page = result.text
    doc = soup(page)
    links = [element.get('href') for element in doc.find_all('a')]
    return links

if __name__ == '__main__':
    import sys
    for url in sys.argv[1:]:
        print('Links in', url)
        for num, link in enumerate(get_links(url), start=1):
            print(num, link)
        print()


I saved this program as links.py and then ran this command:

$ python links.py http://boingboing.net


Here are the first few lines that it printed:

Links in http://boingboing.net/
1 http://boingboing.net/suggest.html
2 http://boingboing.net/category/feature/
3 http://boingboing.net/category/review/
4 http://boingboing.net/category/podcasts
5 http://boingboing.net/category/video/
6 http://bbs.boingboing.net/
7 javascript:void(0)
8 http://shop.boingboing.net/
9 http://boingboing.net/about
10 http://boingboing.net/contact

——————————————

Crawl
爬取

Scrape
刮析(切刮分析)

rating
评级

stock
股票

availability
可用性

extraneous
无关的

fetcher
取物者

unappealing
无吸引力的

haystack
干草堆

industrial
工业

——————————————

Crawl and Scrape


Sometimes, you might want a little bit of information—a movie rating, stock price, or product availability—but the information is available only in HTML pages, surrounded by ads and extraneous content.

You could extract what you’re looking for manually by doing the following:

Type the URL into your browser.

Wait for the remote page to load.

Look through the displayed page for the information you want.

Write it down somewhere.

Possibly repeat the process for related URLs.


However, it’s much more satisfying to automate some or all of these steps. An automated web fetcher is called a crawler or spider (unappealing terms to arachnophobes). After the contents have been retrieved from the remote web servers, a scraper parses it to find the needle in the haystack.

If you need an industrial-strength combined crawler and scraper, Scrapy is worth downloading:

$ pip install scrapy


Scrapy is a framework, not a module such as BeautifulSoup. It does more, but it’s more complex to set up. To learn more about Scrapy, read the online introduction.

——————————————

——————————————

My uncle is the owner of a restaurant close to that I live.

考查地点状语从句。restaurant 属于地点，关系副词应使用 where，而不是 that。故正确答案为将 that 改为 where。

My uncle is the owner of a restaurant close to where I live.

——————————————

Though not very big, but the restaurant is popular in our area.

考查连接词。though 和 but 不能同时出现，考虑到首字母大写的要求，应该删除 but。故正确答案为将 but 去掉。

Though not very big, the restaurant is popular in our area.

——————————————

It is always crowded with customers at meal times.

——————————————

Some people even had to wait outside.

考查时态。本句表述的是一般的现象，应该用一般现在时态，表示一些人不得不在外面排队等候。故正确答案为将 had 改为 have。

Some people even have to wait outside.

——————————————

My uncle tells me that the key to his success is honest.

考查名词。honest 是形容词，意为“诚实的”；honesty 为名词，意为“诚实”。本题中需要使用名词形式。故正确答案为将 honest 替换为 honesty。

My uncle tells me that the key to his success is honesty.

——————————————

Every day he makes sure that fresh vegetables and high quality oil are using for cooking.

考查固定搭配。be used for doing 为固定搭配，意为“被用来做…”。故正确答案为将 using 改为 used。

Every day he makes sure that fresh vegetables and high quality oil are used for cooking.

——————————————

My uncle says that he never dreams becoming rich in the short period of time.

考查固定搭配。dream of doing sth. 为固定搭配，意为“梦想做某事”。故正确答案为在 dreams 和 becoming 之间加上 of。

考查固定搭配。In a short period of time 为固定词组，意为“短时间内”，且此处并非特指。故将正确答案为将 the 改为 a。

My uncle says that he never dreams of becoming rich in a short period of time.

——————————————

Instead, he hopes that our business will grow steadily.

考查形容词性物主代词。根据上文可知，饭店是叔叔开的，故此处的 business 应为“叔叔的”，即他的生意（his business）。故正确答案为将 our 改为 his。

Instead, he hopes that his business will grow steadily.

——————————————

My uncle is the owner of a restaurant close to where I live.

Though not very big, the restaurant is popular in our area.

It is always crowded with customers at meal times.

Some people even have to wait outside.

My uncle tells me that the key to his success is honesty.

Every day he makes sure that fresh vegetables and high quality oil are used for cooking.

My uncle says that he never dreams of becoming rich in a short period of time.

Instead, he hopes that his business will grow steadily.

——————————————

——————————————

JSON


JSON is especially well suited to web client-server data interchange. It’s especially popular in web-based APIs, such as OpenStack.

——————————————

Representational
代表性的

Transfer
转移

consume
消费

doctoral
博士

thesis
论文

implies
暗示

retrieves
取回

——————————————

Web APIs and Representational State Transfer


Often, data is only available within web pages. If you want to access it, you need to access the pages through a web browser and read it. If the authors of the website made any changes since the last time you visited, the location and style of the data might have changed.

Instead of publishing web pages, you can provide data through a web application programming interface (API). Clients access your service by making requests to URLs and getting back responses containing status and data. Instead of HTML pages, the data is in formats that are easier for programs to consume, such as JSON or XML (refer to Chapter 8 for more about these formats).

Representational State Transfer (REST) was defined by Roy Fielding in his doctoral thesis. Many products claim to have a REST interface or a RESTful interface. In practice, this often only means that they have a web interface—definitions of URLs to access a web service.

A RESTful service uses the HTTP verbs in specific ways, as is described here:


HEAD 
Gets information about the resource, but not its data.

GET 
As its name implies, GET retrieves the resource’s data from the server. This is the standard method used by your browser. Any time you see a URL with a question mark (?) followed by a bunch of arguments, that’s a GET request. GET should not be used to create, change, or delete data.

POST 
This verb updates data on the server. It’s often used by HTML forms and web APIs.PUT This verb creates a new resource.

DELETE 
This one speaks for itself: DELETE deletes. Truth in advertising!


A RESTful client can also request one or more content types from the server by using HTTP request headers. For example, a complex service with a REST interface might prefer its input and output to be JSON strings.

——————————————

terminal
终端

enlightening
有启发性的

——————————————

The webbrowser Module


Let’s start begin a little surprise. Start a Python session in a terminal window and type the following:

>>> import antigravity


This secretly calls the standard library’s webbrowser module and directs your browser to an enlightening Python link.

You can use this module directly. This program loads the main Python site’s page in your browser:

>>> import webbrowser
>>> url = 'http://www.python.org/'
>>> webbrowser.open(url)
True


This opens it in a new window:

>>> webbrowser.open_new(url)
True


And this opens it in a new tab, if your browser supports tabs:

>>> webbrowser.open_new_tab('http://www.python.org/')
True


The webbrowser makes your browser do all the work.

——————————————

Automation
自动化

consuming
消耗

generating
生成

——————————————

Web Services and Automation


We’ve just looked at traditional web client and server applications, consuming and generating HTML pages. Yet the Web has turned out to be a powerful way to glue applications and data in many more formats than HTML.

——————————————

simultaneous
同时

concurrency
并发性

——————————————

Other Python Web Servers


Following are some of the independent Python-based WSGI servers that work like apache or nginx, using multiple processes and/or threads (see Concurrency) to handle simultaneous requests:

uwsgi
cherrypy
pylons


Here are some event-based servers, which use a single process but avoid blocking on any single request:

tornado
gevent
gunicorn


I have more to say about events in the discussion about concurrency in Chapter 11.

——————————————

peanut
花生

jelly
果冻

grew
增长

scope
范围

optimized
优化

performance
性能

gloss over
掩盖

demanding
要求

——————————————

Other Frameworks


Websites and databases are like peanut butter and jelly—you see them together a lot. The smaller frameworks such as bottle and flask do not include direct support for databases, although some of their contributed add-ons do.

If you need to crank out database-backed websites, and the database design doesn’t change very often, it might be worth the effort to try one of the larger Python web frameworks. The current main contenders include:

django 
This is the most popular, especially for large sites. It’s worth learning for many reasons, among them the frequent requests for django experience in Python job ads. It includes ORM code (we talked about ORMs in The Object-Relational Mapper) to create automatic web pages for the typical database CRUD functions (create, replace, update, delete) that I discussed in SQL. You don’t have to use django’s ORM if you prefer another, such as SQLAlchemy, or direct SQL queries.

web2py 
This covers much the same ground as django, with a different style.pyramid This grew from the earlier pylons project, and is similar to django in scope.

turbogears 
This framework supports an ORM, many databases, and multiple template languages.

wheezy.web 
This is a newer framework optimized for performance. It was faster than the others in a recent test.


You can compare the frameworks by viewing this online table.

If you want to build a website backed by a relational database, you don’t necessarily need one of these larger frameworks. You can use bottle, flask, and others directly with relational database modules, or use SQLAlchemy to help gloss over the differences. Then, you’re writing generic SQL instead of specific ORM code, and more developers know SQL than any particular ORM’s syntax.

Also, there’s nothing written in stone demanding that your database must be a relational one. If your data schema varies significantly—columns that differ markedly across rows—it might be worthwhile to consider a schemaless database, such as one of the NoSQL databases discussed in NoSQL Data Stores. I once worked on a website that initially stored its data in a NoSQL database, switched to a relational one, on to another relational one, to a different NoSQL one, and then finally back to one of the relational ones.

——————————————

——————————————

The summer holiday is coming. 

——————————————

My classmates and I are talking about what to do during the holiday.

——————————————

We can chose between staying at home and take a trip. 

考查情态动词。chose 是动词 choose 的过去式，表示选择。can 为情态动词，后面加动词的原形。故正确答案为将 chose 改为 choose。

考查动名词。between 为介词，意为“在…之间”。介词后面加动词 ing 形式，因此动词 take 应该写成 taking，与 staying 并列。故正确答案为将 take 改为 taking。

We can choose between staying at home and taking a trip. 

——————————————

If we stay at home, it is comfortable but there is no need to spend money. 

考查连词。连词 but 表示转折，而文中“他很舒服”与“没有必要花钱”之间并不是转折而是并列的关系，故应该用连词 and 连接。故正确答案为将 but 改为 and。

If we stay at home, it is comfortable and there is no need to spend money. 

——————————————

But in that case, we will learn little about the world. 

——————————————

If we go on a trip abroad, we can broaden our view and gain knowledges we cannot get from books. 

考查名词的单复数形式。knowledge 作为“知识”来讲时是不可数名词。故正确答案为将 knowledges 改为 knowledge。

If we go on a trip abroad, we can broaden our view and gain knowledge we cannot get from books. 

——————————————

Some classmates suggest we can go to places of interest nearby. 

考查虚拟语气。根据句意，此处的 suggest 意为“建议”，而 suggest 表示“建议”时，其后接的 that 从句中的谓语通常要用虚拟语气，即“should + 动词原形”，其中 should 可以省略。故正确答案为将 can 删掉，或将 can 改为 should。

Some classmates suggest we go to places of interest nearby. 

——————————————

I thought that it is a good idea. 

考查动词时态。同一句中的时态应该一致，而且根据全文中都用的是现在时态，故此处应该将过去时改为现在时。故正确答案为将 thought 改为 think。

I think that it is a good idea. 

——————————————

It does not cost many, yet we can still learn a lot.

考查形容词和不可数名词。cost 意为“花费（时间或金钱）”，结合此处句意，它不需要花很多钱，“我们”却仍能学到很多，可知，此处本应为 cost much money，money 为不可数名词，故此处应为 much。故正确答案为将 many 改为 much。

It does not cost much, yet we can still learn a lot.

——————————————

The summer holiday is coming. 

My classmates and I are talking about what to do during the holiday.

We can choose between staying at home and taking a trip. 

If we stay at home, it is comfortable and there is no need to spend money. 

But in that case, we will learn little about the world. 

If we go on a trip abroad, we can broaden our view and gain knowledge we cannot get from books. 

Some classmates suggest we go to places of interest nearby. 

I think that it is a good idea. 

It does not cost much, yet we can still learn a lot.

——————————————

——————————————

其实E4A也没想象中那么差

总比我连Android Studio的例程都加载失败好😂

——————————————

http://fir.im/YShelper

Make it better and add a auto translate function.

——————————————

configurable
可配置的

knobs
旋钮

——————————————

The nginx Web Server


The nginx web server does not have an embedded Python module. Instead, it communicates by using a separate WSGI server such as uWSGI. Together they make a very fast and configurable platform for Python web development.

You can install nginx from its website. You also need to install uWSGI. uWSGI is a large system, with many levers and knobs to adjust. A short documentation page gives you instructions on how to combine Flask, nginx, and uWSGI.

——————————————

For the following things, all you need to do is a glancing.

——————————————

preferred
首选

salamander
火蜥蜴

daemon
守护进程

directive
指令

——————————————

Apache


The apache web server’s best WSGI module is mod_wsgi. This can run Python code within the Apache process or in separate processes that communicate with Apache.

You should already have apache if your system is Linux or OS X. For Windows, you’ll need to install apache.

Finally, install your preferred WSGI-based Python web framework. Let’s try bottle here. Almost all of the work involves configuring Apache, which can be a dark art.

Create this test file and save it as /var/www/test/home.wsgi:

import bottle

application = bottle.default_app()

@bottle.route('/')
def home():
    return "apache and wsgi, sitting in a tree"


Do not call run() this time, because that starts the built-in Python web server. We need to assign to the variable application because that’s what mod_wsgi looks for to marry the web server and the Python code.

If apache and its mod_wsgi module are working correctly, we just need to connect them to our Python script. We want to add one line to the file that defines the default website for this apache server, but finding that file is a task in and of itself. It could be /etc/apache2/httpd.conf, or /etc/apache2/sites-available/default, or the Latin name of someone’s pet salamander.

Let’s assume for now that you understand apache and found that file. Add this line inside the <VirtualHost> section that governs the default website:

    WSGIScriptAlias / /var/www/test/home.wsgi


That section might then look like this:

<VirtualHost *:80>
    DocumentRoot /var/www

    WSGIScriptAlias / /var/www/test/home.wsgi

    <Directory /var/www/test>
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>


Start apache, or restart it if it was running to make it use this new configuration. If you then browse to http://localhost/, you should see:

apache and wsgi, sitting in a tree


This runs mod_wsgi in embedded mode, as part of apache itself.

You can also run it in daemon mode: as one or more processes, separate from apache. To do this, add two new directive lines to your apache config file:

$ WSGIDaemonProcess domain-name user=user-name group=group-name threads=25
WSGIProcessGroup domain-name


In the preceding example, user-name and group-name are the operating system user and group names, and the domain-name is the name of your Internet domain. A minimal apache config might look like this:

<VirtualHost *:80>
    DocumentRoot /var/www

    WSGIScriptAlias / /var/www/test/home.wsgi

    WSGIDaemonProcess mydomain.com user=myuser group=mygroup threads=25
    WSGIProcessGroup mydomain.com

    <Directory /var/www/test>
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

——————————————

stability
稳定

——————————————

Non-Python Web Servers


So far, the web servers we’ve used have been simple: the standard library’s http.server or the debugging servers in Bottle and Flask. In production, you’ll want to run Python with a faster web server. The usual choices are the following:

apache with the mod_wsgi module

nginx with the uWSGI app server


Both work well; apache is probably the most popular, and nginx has a reputation for stability and lower memory use.

——————————————

Flask(3)


Or, you can provide the arguments as GET parameters (save this as flask3b.py):

from flask import Flask, render_template, request

app = Flask(__name__)

@app.route('/echo/')
def echo():
    thing = request.args.get('thing')
    place = request.args.get('place')
    return render_template('flask3.html', thing=thing, place=place)

app.run(port=9999, debug=True)


Run the new server script:

$ python flask3b.py


This time, use this URL:

http://localhost:9999/echo?thing=Gorgo&place=Wilmerding


You should get back what you see here:

Say hello to my little friend: Gorgo. Alas, it just destroyed Wilmerding!


When a GET command is used for a URL, any arguments are passed in the form &key1=val1&key2=val2&...

You can also use the dictionary ** operator to pass multiple arguments to a template from a single dictionary (call this flask3c.py):

from flask import Flask, render_template, request

app = Flask(__name__)

@app.route('/echo/')
def echo():
    kwargs = {}
    kwargs['thing'] = request.args.get('thing')
    kwargs['place'] = request.args.get('place')
    return render_template('flask3.html', **kwargs)

app.run(port=9999, debug=True)


That **kwargs acts like thing=thing, place=place. It saves some typing if there are a lot of input arguments.

The jinja2 templating language does a lot more than this. If you’ve programmed in PHP, you’ll see many similarities.

——————————————

templating
模板

grab
抓取

render
渲染

dropping
下降；减少

——————————————

Flask(2)


So far, the Flask example just replicates what we did with bottle. What can Flask do that bottle can’t? Flask includes jinja2, a more extensive templating system. Here’s a tiny example of how to use jinja2 and flask together.

Create a directory called templates, and a file within it called flask2.html:

<html>
<head>
<title>Flask2 Example</title>
</head>
<body>
Say hello to my little friend: {{ thing }}
</body>
</html>


Next, we’ll write the server code to grab this template, fill in the value of thing that we passed it, and render it as HTML (I’m dropping the home() function here to save space). Save this as flask2.py:

from flask import Flask, render_template

app = Flask(__name__)

@app.route('/echo/<thing>')
def echo(thing):
    return render_template('flask2.html', thing=thing)
app.run(port=9999, debug=True)


That thing = thing argument means to pass a variable named thing to the template, with the value of the string thing.

Ensure that flask1.py isn’t still running, and start flask2.py:

$ python flask2.py


Now, type this URL:

http://localhost:9999/echo/Gamera


You should see the following:

Say hello to my little friend: Gamera


Let’s modify our template and save it in the templates directory as flask3.html:

<html>
<head>
<title>Flask3 Example</title>
</head>
<body>
Say hello to my little friend: {{ thing }}.
Alas, it just destroyed {{ place }}!
</body>
</html>


You can pass this second argument to the echo URL in many ways. 

Pass an argument as part of the URL path

Using this method, you simply extend the URL itself (save this as flask3a.py):

from flask import Flask, render_template

app = Flask(__name__)

@app.route('/echo/<thing>/<place>')
def echo(thing, place):
    return render_template('flask3.html', thing=thing, place=place)

app.run(port=9999, debug=True)


As usual, stop the previous test server script if it’s still running and then try this new one:

$ python flask3a.py


The URL would look like this:

http://localhost:9999/echo/Rodan/McKeesport


And you should see the following:

Say hello to my little friend: Rodan. Alas, it just destroyed McKeesport!

——————————————

ease
轻松

replicate
复写

prefix
前缀

intruders
入侵者

——————————————

Flask(1)


Bottle is a good initial web framework. If you need a few more cowbells and whistles, try Flask. It started in 2010 as an April Fools’ joke, but enthusiastic response encouraged the author, Armin Ronacher, to make it a real framework. He named the result Flask as a wordplay on bottle.

Flask is about as simple to use as Bottle, but it supports many extensions that are useful in professional web development, such as Facebook authentication and database integration. It’s my personal favorite among Python web frameworks because it balances ease of use with a rich feature set.

The Flask package includes the werkzeug WSGI library and the jinja2 template library. You can install it from a terminal:

$ pip install flask


Let’s replicate the final bottle example code in flask. First, though, we need to make a few changes:

■Flask’s default directory home for static files is static, and URLs for files there also begin with /static. We change the folder to '.' (current directory) and the URL prefix to '' (empty) to allow the URL / to map to the file index.html.

■In the run() function, setting debug=True also activates the automatic reloader; bottle used separate arguments for debugging and reloading.

Save this file to flask1.py:

from flask import Flask

app = Flask(__name__, static_folder='.', static_url_path='')

@app.route('/')
def home():
    return app.send_static_file('index.html')

@app.route('/echo/<thing>')
def echo(thing):
    return "Say hello to my little friend: %s" % thing

app.run(port=9999, debug=True)


Then, run the server from a terminal or window:

$ python flask1.py


Test the home page by typing this URL into your browser:

http://localhost:9999/


You should see the following (as you did for bottle):

My new and improved home page!!!


Try the /echo endpoint:

http://localhost:9999/echo/Godzilla


You should see this:

Say hello to my little friend: Godzilla


There’s another benefit to setting debug to True when calling run. If an exception occurs in the server code, Flask returns a specially formatted page with useful details about what went wrong, and where. Even better, you can type some commands to see the values of variables in the server program.


Warning

Do not set debug = True in production web servers. It exposes too much information about your server to potential intruders.

——————————————

这些代码最好自己打下并运行，这样理解更深，记得更牢。

——————————————

deploy
部署

route
路线；路径

——————————————

Bottle


Bottle consists of a single Python file, so it’s very easy to try out, and it’s easy to deploy later. Bottle isn’t part of standard Python, so to install it, type the following command:

$ pip install bottle


Here’s code that will run a test web server and return a line of text when your browser accesses the URL http://localhost:9999/. Save it as bottle1.py:

from bottle import route, run

@route('/')
def home():
return "It isn't fancy, but it's my home page"

run(host='localhost', port=9999)


Bottle uses the route decorator to associate a URL with the following function; in this case, / (the home page) is handled by the home() function. Make Python run this server script by typing this:

$ python bottle1.py


You should see this on your browser when you access http://localhost:9999:

It isn't fancy, but it's my home page


The run() function executes bottle’s built-in Python test web server. You don’t need to use this for bottle programs, but it’s useful for initial development and testing.

Now, instead of creating text for the home page in code, let’s make a separate HTML file called index.html that contains this line of text:

My <b>new</b> and <i>improved</i> home page!!!


Make bottle return the contents of this file when the home page is requested. Save this script as bottle2.py:

from bottle import route, run, static_file

@route('/')
def main():
    return static_file('index.html', root='.')

run(host='localhost', port=9999)


In the call to static_file(), we want the file index.html in the directory indicated by root (in this case, '.', the current directory). If your previous server example code was still running, stop it. Now, run the new server:

$ python bottle2.py


When you ask your browser to get http:/localhost:9999/, you should see:

My new and improved home page!!!


Let’s add one last example that shows how to pass arguments to a URL and use them. Of course, this will be bottle3.py:

from bottle import route, run, static_file

@route('/')
def home():
    return static_file('index.html', root='.')

@route('/echo/<thing>')
def echo(thing):
    return "Say hello to my little friend: %s!" % thing

run(host='localhost', port=9999)


We have a new function called echo() and want to pass it a string argument in a URL. That’s what the line @route('/echo/<thing>') in the preceding example does. That <thing> in the route means that whatever was in the URL after /echo/ is assigned to the string argument thing, which is then passed to the echo function. To see what happens, stop the old server if it’s still running, and start it with the new code:

$ python bottle3.py


Then, access http://localhost:9999/echo/Mothra in your web browser. You should see the following:

Say hello to my little friend: Mothra!


Now, leave bottle3.py running for a minute so that we can try something else. You’ve been verifying that these examples work by typing URLs into your browser and looking at the displayed pages. You can also use client libraries such as requests to do your work for you. Save this as bottle_test.py:

import requests

resp = requests.get('http://localhost:9999/echo/Mothra')
if resp.status_code == 200 and \
  resp.text == 'Say hello to my little friend: Mothra!':
    print('It worked! That almost never happens!')
else:
    print('Argh, got this:', resp.text)


Great! Now, run it:

$ python bottle_test.py


You should see this in your terminal:

It worked! That almost never happens!


This is a little example of a unit test. Chapter 8 provides more details on why tests are good and how to write them in Python.

There’s more to bottle than I’ve shown here. In particular, you can try adding these arguments when you call run():

■debug=True creates a debugging page if you get an HTTP error;

■reloader=True reloads the page in the browser if you change any of the Python code.


It’s well documented at the developer site.

——————————————

WSGI
Web Server Gateway Interface
PythonWeb服务器网关接口

Merge
合并

authorization
授权

permissions
权限

Sessions
会话

transient
短暂的

——————————————

Frameworks


Web servers handle the HTTP and WSGI details, but you use web frameworks to actually write the Python code that powers the site. So, we’ll talk about frameworks for a while and then get back to alternative ways of actually serving sites that use them.

If you want to write a website in Python, there are many Python web frameworks (some might say too many). A web framework handles, at a minimum, client requests and server responses. It might provide some or all of these features:


Routes 
Interpret URLs and find the corresponding server files or Python server code 

Templates 
Merge server-side data into pages of HTML 

Authentication and authorization 
Handle usernames, passwords, permissions 

Sessions 
Maintain transient data storage during a user’s visit to the website


In the coming sections, we’ll write example code for two frameworks (bottle and flask). Then, we’ll talk about alternatives, especially for database-backed websites. You can find a Python framework to power any site that you can think of.

——————————————

——————————————

allure
魅力

anew
重新

scale
规模

appreciable
可感知的

startup
启动

merging
合并

leap
飞跃

hood
罩

——————————————

Web Server Gateway Interface


All too soon, the allure of serving simple files wears off, and we want a web server that can also run programs dynamically. In the early days of the Web, the Common Gateway Interface (CGI) was designed for clients to make web servers run external programs and return the results. CGI also handled getting input arguments from the client through the server to the external programs. However, the programs were started anew for each client access. This could not scale well, because even small programs have appreciable startup time.

To avoid this startup delay, people began merging the language interpreter into the web server. Apache ran PHP within its mod_php module, Perl in mod_perl, and Python in mod_python. Then, code in these dynamic languages could be executed within the long-running Apache process itself rather than in external programs.

An alternative method was to run the dynamic language within a separate long-running program and have it communicate with the web server. FastCGI and SCGI are examples.

Python web development made a leap with the definition of Web Server Gateway Interface (WSGI), a universal API between Python web applications and web servers. All of the Python web frameworks and web servers in the rest of this chapter use WSGI. You don’t normally need to know how WSGI works (there really isn’t much to it), but it helps to know what some of the parts under the hood are called.

——————————————

——————————————

果然是我自己犯贱在QQ上写了自己电话🙈

——————————————

也好，有人整我就说明我处于成功的道路之上，

只要不死，总会出头！

——————————————

我只想知道原理😂

——————————————

我刚才在一个QQ群装了下逼，结果不知怎么他们就得到我手机号了😱

——————————————

被人短信轰炸了，怎么办？

——————————————

不好意思，急躁了

我还是好好学习Python吧


安卓只是一个装逼的副业😂😊

——————————————

感觉程序开发是条不归路呢

总是拘泥在不同语言之间

——————————————

我突然感觉想撞墙

——————————————

Thinking In Java
Java经典书籍，有中文版的，可能为了学习Android，你只掌握了Java基础，但是远远不够，你需要再重新系统的学习一下Java，这是一本值得反复看的书籍，针对有一定Java基础的人，会让你重新认识下Java。
http://book.douban.com/subject/1474824/

Effective Java
这是一本实用至上的书，78条建议，满满的干货。每一条都说明了为什么最好这样，Java进阶必备，目前为止看过这本书评价最好的一本。
http://book.douban.com/subject/3360807/

App研发录
从App架构的角度，重点总结了Android应用开发中常见的实用技巧和疑难问题解决方法，为打造高质量App提供有价值的实践指导，避免你在实际项目中踩坑，读完绝对有收获。
http://book.douban.com/subject/26649050/

Android开发艺术探索
这是一本Android进阶类书籍，采用理论、源码和实践相结合的方式来阐述高水准的Android应用开发要点，Android开发进阶值得拥有。
http://book.douban.com/subject/26599538/

AndroidUI设计

Material Design
在开发一款Android App之前，你需要了解下Android平台的设计规范，这里有Google最新推出的Material Design中文翻译版。
http://t.cn/RLrJg33

而且 Google 官方出了一个支持库 Android Design Support Library，具体用法见链接。
http://t.cn/R2orZH9

Sketch 3
这个工具只推荐给对UI感兴趣的开发者，这是一个专为设计移动端 UI 的设计工具，作为开发者，不用懂那么复杂的 PS 使用，也可以做非常专业设计。
https://designcode.io/sketch

AndroidApp源码推荐

当你已经做Android开发一段时间，并苦于进入瓶颈，这个时候阅读一些优秀App的源码是最好的学习进阶方式，借鉴一些优秀App源码的设计能获益很大。

iosched
iosched项目是Google I/O的官方app，绝佳的学习项目。
https://github.com/google/iosched

android-UniversalMusicPlayer
也是Google官方作品，代码量不大、注释清晰，简单但全功能的音乐播放器。
https://github.com/googlesamples/android-UniversalMusicPlayer

android-topeka
这个项目是Google前段时间刚发出来，通过这个app，你还可以学到如何设计你app的交互和视觉以更好的和MaterialDesign搭配。
https://github.com/googlesamples/android-topeka

Google的项目有些时候对于初学者有点困难，下面就推荐两个完整的轻量的学习项目。

9GAG
9GAG是我个人的开源练习项目，教你使用Studio、Gradle以及一些流行的开源库快速开发一个不错的Android客户端。
https://github.com/stormzhang/9GAG

AnimeTaste
代码家开源的一个线上关注动画的一个App，同样适合初学者学习。
https://github.com/daimajia/AnimeTaste

Android新技术

你需要了解Android有以下新兴的技术与框架，有些也许还不成熟，但是你应该去了解下，也许就是未来的方向。

Kotlin
作为 Android 领域的 Swift，绝对让你如沐新风。抛弃沉重的 Java 语法，Kotlin 融入了很多现代编程语言的思想，作为开发者，接受新的语言，了解新语言的发展趋势，更有利于开阔你的思路和加深对语言的理解。
http://t.cn/R2DK0SL

React Native
Facebook推出的针对移动应用的跨平台解决方案，目前还不成熟，但是由于Facebook推出，光环效应引起不少目光，这是不是未来暂且还没结论，但是有必要了解学习下。
http://t.cn/RbHmtOk

MVP
MVP越来越多的被Android社区所讨论，有点是能够让代码更清晰，但同时也会增加很多类，写起来更麻烦，不过对于一些不是很庞大的项目却是非常适合的。这里提供一个最先采用MVP模式的开源项目：
https://github.com/pedrovgs/EffectiveAndroidUI

MVVM
因为官方支持 DataBinding，把 MVVM 直接带到 Android 中。它非常高效的开发效率，让你只关心你的数据和业务，从此数据绑定会更加常见。
http://t.cn/RbHmnhE

插件化
一般App上线之后出现bug需要重新提交新版本才能解决，这个就太慢了，由于iOS的审核原因，插件化在iOS开发常见，阿里业务方面这个特别需要，比如双十一出了bug，不能眼睁睁的看着bug出现不管吧，所以阿里系衍生出了一系列热修复的框架，dexposed、AndFix，具体可以见这里详解。
http://lirenlong.github.io/hotfix/

RxJava
最近响应式编程框架RxJava越来越受大家待见，RxJava让你异步任务更简洁方便，以我对技术的敏感性认为RxJava可能会越来越普遍，推荐大家学习。这里有一系列详细的资料教你学习。
https://github.com/lzyzsd/Awesome-RxJava

当你下定决心，准备前行的时候，剩下的只有坚持了！

——————————————

如何自学Android编程
https://www.zhihu.com/question/26417244

今天废话就不多说，就来给大家推荐一份详细的自学教程，帮助你从入门到进阶到精通。

准备

自学之路是一项很苦逼的差事，自学的人很多，但能真正坚持下去的很少，在准备自学Android之前你需要具备以下基本能力能帮助你坚持到最后。

1、对Android开发、对互联网感兴趣，兴趣是最好的老师，只有发自内心的感兴趣才能真正坚持下去；
2、强大的学习能力，既然自学那学习能力肯定是必备，要有很强的求知欲，持续不断的学习能力才有机会走的更远，注意，是持续不断的学习能力；
3、解决问题的能力，自学过程中肯定会遇到各种各样的坑，这个时候不要急躁，不要气馁，不要怕耗时间，一步一个脚印去解决问题，这会为你今后走上工作岗位带来极大的优势；
4、设定一个目标，比如我当初测试转行开发，自学Android的目标简单直接，因为开发比测试工资高，我转行就是为了多挣钱。我想大部分人的目标应该都跟我同感。

Java基础

Android开发是基于Java语言的，所以毫无疑问的是必须要掌握Java基础，如果你完全没有任何Java基础，这步是必须要好好学习的，如果已经有Java基础的，这步可略过。

对于很多初学者来说入门往往是最难的，如果只看书完全看不下去，也很难理解，所以强烈推荐初学者以书籍结合视频的方式学习Java基础，所以给你推荐：

《Java语言程序设计》，优点是非常基础，适合初学者，建议只要看到前十四章就ok了，第十二章也可以略过。
http://book.douban.com/subject/6529833/

Mars老师的Java4Android视频课程结合学习，便于初学者很好的理解与入门。
http://pan.baidu.com/s/1c1beYo4

如果每天至少坚持学习3-4小时的话，这一阶段差不多花费1--2个月之间都算正常，范围因人以及花费的时间而异。

Android入门资料

经过上面的学习相信你已经掌握了Java基础了，是时候开始正式进入Android学习的阶段了。

Android学习之路 
我自己整理的Android开发详细资料，这篇博客影响了无数Android开发者，可谓Android开发必备，某种意义上来说，自学Android有这篇博客足够了。
http://t.cn/Rz79nfR

《第一行代码》
郭霖大神的最新力作，全书由浅入深、系统全面地讲解了Android软件开发的方方面面，而且是针对Android 4.0进行讲解的，非常适合Android入门。
http://book.douban.com/subject/25942191/

Mars老师的Android开发视频教程
http://marschen.com/portal.php

极客学院Android开发视频教程
http://www.jikexueyuan.com/path/android/

慕课网的Android视频教程
http://www.imooc.com/course/list?c=android

至于入门书籍我认为推荐一本适合你的就够了，而且大部分书籍内容大同小异，但是视频教程就就不一定讲解的内容都一样了，大家可自行选择视频教程。

Android开发工具

科学上网
科学上网可以说是程序员必备技能，身为Android开发者那更得会这项技能，不管你是使用Google也好，还是到Android官网查找资料，下载SDK都必须要翻墙。可以使用goagent也好，修改host，购买vps、vpn等等方式，这个技能不是本文重点，大家可自行搜索去配置。可以告诉大家的是对于新手来说最简单有效的方式是购买VPN，可以节省不少精力，至于哪个vpn比较好用不敢保证，我使用了两年的vpn个人感觉相对较稳定，感兴趣的可以到我博客主页去寻找。

Android Studio
虽然目前的很多学习资料与书籍都是Eclipse为主，但是Google已经明确未来Android会抛弃Eclipse，所以强烈建议大家直接使用AS，学习的初期花点时间熟悉使用，上手很快就可以对照eclipse方面的教程转到AS了。当让我也在AS1.0刚发布的时候就已经出了一个针对新手的Android Studio+Gradle详细教程，是一个系列，帮助你们更快的入门。
http://t.cn/RbH8Q3V

AndroidDevTools
我是强烈建议Android开发者一定要学会科学上网的，但是如果你觉得暂时还不需要接触外面的世界，那么我的一个朋友搭建的网站，可以让你们无须翻墙即可下载使用官方SDK。
http://www.androiddevtools.cn/

模拟器Genymotion
首先建议大家能不用模拟器都不要用，模拟器的启动速度简直是龟速，现在市面上安卓手机很便宜，打算做Android开发没个安卓手机真是说不过去。如果你非要用模拟器那就推荐你用Genymotion，目前来说最快的模拟器。具体可以看我下面的博客，最后还是要建议大家不要使用模拟器！！
http://t.cn/R4RvAQd

Google
问任何问题之前都要先去搜索引擎查一下，这会训练你的解决问题的能力，而等你以后工作，实际开发中可以知道，有一大半的时间你是在搜索度过的，很多问题都已经是前人遇到并总结的方案。对于新手来说可能百度勉强够用，但是建议一开始就养成使用Google的习惯，百度在娱乐八卦方面确实靠谱，但是技术方面查出来的东西基本千篇一律，有些答案甚至还会起到误导作用，直到有一天我的老大告诉我用Google，我才知道这个世界上原来还有另外一个搜索引擎，自此便成为脑残G粉，所以一定要用Google！一定要用Google！一定要用Google！！！（重要的事说三遍）

StackOverFlow
用Google之后搜索出来的东西还是习惯性的点击中文结果，直到有一天我发现基本每次搜索排名第一的都是这个网站，于是尝试着点进去用我蹩脚的英语阅读，之后真是相见恨晚的感觉啊，上面几乎能搜到你遇到的绝大部分问题，某种程度上来说推荐用Google搜索的原因之一是因为排名靠前的答案基本都在StackOverFlow上。

GitHub
现在是全球最知名的程序员开源社区，程序员几乎人手一个GitHub账号，在上面你可以找到各种各样牛人分享的开源项目，包括Google、Facebook、Twitter等开源的代码，简直是号称进阶必备，某种意义上看大牛的代码是最好的学习进阶方式。

Android开发资源

了解这些资源你绝对会接触另一个世界，这些资源大部分都是我圈中好友总结分享的项目，绝对干货！

Google Android官方教程中文版
http://t.cn/RvHtswy

Android 开发最佳实践
一些优秀Android开发者总结留下来的经验，了解这些能让你的学习之路事半功倍。
http://t.cn/RwgJoHm

Android开源汇总
GitHub上总结的最全的Android各大开源项目，让你大开眼界！
http://t.cn/R2LTQkN

Android Weekly
了解最新的Android相关的技术有哪些，时刻了解紧跟技术趋势，建议加入邮箱订阅。
http://androidweekly.net/

Android Weekly Cn
我一个朋友做的国内版的Android Weekly，更符合国情。
http://www.androidweekly.cn/

Android源码解析
我的朋友Trinea发起的一个专注于开源项目源码解析及优秀开源项目的分享的网站
http://p.codekk.com/

AndroidDeveloper
我自己的公众号，算是打个广告吧，作为国内Android界的精神领袖，我经常也会在我的微信公众号上分享一些干货，大多为个人原创，时刻紧跟趋势，并且只分享对你们有用的干货，可以微信公众号搜索googdev关注。

国内优秀Android开发者的博客

这里筛选一些有质量的博客给大家，大都是你们的前辈，绝对一线的博客。

stormzhang的博客
http://stormzhang.com/

郭霖的博客
http://blog.csdn.net/guolin_blog

Trinea的博客
http://www.trinea.cn/

魏祝林的博客
http://blog.csdn.net/android_tutor

恺风（Wei）之Android专栏
http://blog.csdn.net/column/details/flowingflying02.html

张鸿洋的博客
http://blog.csdn.net/lmj623565791

张兴业的博客
http://blog.csdn.net/xyz_lmn

更多国内优秀开发者的博客
http://t.cn/RPniqXI

国外著名优秀开发者博客
http://t.cn/RPni7a0

国内外优秀Andorid团体博客

Android Developers Blog （Android开发者官方博客，须翻墙）
http://android-developers.blogspot.tw/

美团点评技术团队
http://tech.meituan.com/

腾讯全端 AlloyTeam 团队 Blog
http://www.alloyteam.com/

Android进阶书籍

当你Android开发已经上手之后，突然发现一直进步很慢，处于一个瓶颈了，这个时候你需要这些书籍。

——————————————

http://mp.weixin.qq.com/s?__biz=MzA4NTQwNDcyMA==&mid=402784322&idx=1&sn=b28ae10f7f30db7918398a85923b65b5&scene=21#wechat_redirect

——————————————

In my mind, I could never fancy how ten second of life could change a person's view for his whole existence. 

考查名词。second 意为“秒”时是可数名词，ten 表示数量，应用 second 的复数形式。故正确答案为将 second 替换为 seconds。

考查介词。句意：我不能够想像生命中的10秒钟是怎样改变一个人对于整个生命过程的观点的，用介词 on 或者 about 表示“关于…的观点”。故正确答案为将 for 替换为 on/about。

In my mind, I could never fancy how ten seconds of life could change a person's view about his whole existence. 

——————————————

A few years ago I experience the worst moment in my life. 

考查动词时态。结合 A few years ago 可知 experience 这个动作发生在过去，应该用一般过去时。故正确答案为将 experience 替换为 experienced。

A few years ago I experienced the worst moment in my life. 

——————————————

I was driving home that afternoon. 

——————————————

Unfortunately, I didn't make it home as usually because I had a car accident. 

考查固定搭配。as usual 是固定搭配，意为“像往常一样”。故正确答案为将 usually 替换为 usual。

Unfortunately, I didn't make it home as usual because I had a car accident. 

——————————————

While I was driving, all of a sudden, but the car in front of me stopped. 

考查连词。While I was driving 是时间状语从句，all of a sudden 是插入语，the car 是主句主语，stop 是谓语，句子结构完整，也不存在转折关系，所以不需要添加 but。故正确答案为将 but 删除。

While I was driving, all of a sudden, the car in front of me stopped. 

——————————————

My car immediately ran into it. 

——————————————

Luckily, I wasn't serious hurt. 

考查副词。修饰动词 hurt 应用副词，故正确答案为将 serious 替换为 seriously。

Luckily, I wasn't seriously hurt.

——————————————

That accident changed way I drive and they taught me a valuable lesson. 

考查定冠词。定冠词 the 用来限定这个冠词后面的名词是某个特定的事物，此处特指作者之前的驾车方式，要加定冠词 the。故正确答案为在 way 之前添加 the。

考查主谓一致。主句主语是 That accident，and 表示并列，and 后的句子的主语指代的是 that accident，应用代词 it。或者 and 起并列两个动词的作用，即：那场意外改变了“我”驾驶的方式并给“我”上了有价值的一课，将 they 删除。故正确答案为将 they 替换为 it 或将 they 删除。

That accident changed the way I drive and taught me a valuable lesson. 

——————————————

I also came to the conclusion which life needs to be treasuring.

考查连词。引导同位语从句的连词应该用 that，且 that 只起到语法作用，在句中不作任何成分，而 which 引导的是定语从句。故正确答案为将 which 替换为 that。

考查被动语态。need 和 treasure 之间存在被动关系，且 treasure 之前有 be 动词，所以要用 treasure 的被动语态。故正确答案为将 treasuring 替换为 treasured。

I also came to the conclusion that life needs to be treasured.

——————————————

In my mind, I could never fancy how ten seconds of life could change a person's view about his whole existence. 

A few years ago I experienced the worst moment in my life. 

I was driving home that afternoon. 

Unfortunately, I didn't make it home as usual because I had a car accident. 

While I was driving, all of a sudden, the car in front of me stopped. 

My car immediately ran into it.

Luckily, I wasn't seriously hurt.

That accident changed the way I drive and taught me a valuable lesson. 

I also came to the conclusion that life needs to be treasured.

——————————————

我有点怕了，2060页。。

——————————————

http://avxhome.in/ebooks/programming_development

——————————————

http://www.foxebook.net/

——————————————

http://hukai.me/android-training-course-in-chinese/index.html

——————————————

What's

——————————————

What your job now?

——————————————

http://www.shiyanlou.com/courses/364

——————————————

You may wonder why I update so frequently.

That's easy to know, just imagine that power was off.

——————————————

——————————————

Serving
服务

plumbing
管道

synonyms
同义词

interpret
解释

parameters
参数

——————————————

The Simplest Python Web Server


You can run a simple web server by typing just one line of Python:

$ python -m http.server


This implements a bare-bones Python HTTP server. If there are no problems, this will print an initial status message:

Serving HTTP on 0.0.0.0 port 8000 ...


That 0.0.0.0 means any TCP address, so web clients can access it no matter what address the server has. There’s more low-level details on TCP and other network plumbing for you to read about in Chapter 11.

You can now request files, with paths relative to your current directory, and they will be returned. If you type http://localhost:8000 in your web browser, you should see a directory listing there, and the server will print access log lines such as this:

127.0.0.1 - - [20/Feb/2013 22:02:37] "GET / HTTP/1.1" 200 -


localhost and 127.0.0.1 are TCP synonyms for your local computer, so this works regardless of whether you’re connected to the Internet. You can interpret this line as follows:

■127.0.0.1 is the client’s IP address

■The first "-" is the remote username, if found

■The second "-" is the login username, if required

■[20/Feb/2013 22:02:37] is the access date and time

■"GET / HTTP/1.1" is the command sent to the web server:

The HTTP method (GET)

The resource requested (/, the top)

The HTTP version (HTTP/1.1)

■The final 200 is the HTTP status code returned by the web server


Click any file. If your browser can recognize the format (HTML, PNG, GIF, JPEG, and so on) it should display it, and the server will log the request. For instance, if you have the file oreilly.png in your current directory, a request for http://localhost:8000/oreilly.png should return the image of the unsettling fellow in Figure 7-1, and the log should show something such as this:

127.0.0.1 - - [20/Feb/2013 22:03:48] "GET /oreilly.png HTTP/1.1" 200 -


If you have other files in the same directory on your computer, they should show up in a listing on your display, and you can click any one to download it. If your browser is configured to display that file’s format, you’ll see the results on your screen; otherwise, your browser will ask you if you want to download and save the file.

The default port number used is 8000, but you can specify another:

$ python -m http.server 9999


You should see this:

Serving HTTP on 0.0.0.0 port 9999 ...


This Python-only server is best suited for quick tests. You can stop it by killing its process; in most terminals, press Ctrl+C.

You should not use this basic server for a busy production website. Traditional web servers such as Apache and Nginx are much faster for serving static files. In addition, this simple server has no way to handle dynamic content, which more extensive servers can do by accepting parameters.

——————————————

——————————————

——————————————

navigate
导航

templates
模板

inclusions
夹杂物

——————————————

Web Servers


Web developers have found Python to be an excellent language for writing web servers and server-side programs. This has led to such a variety of Python-based web frameworks that it can be hard to navigate among them and make choices—not to mention deciding what deserves to go into a book.

A web framework provides features with which you can build websites, so it does more than a simple web (HTTP) server. You’ll see features such as routing (URL to server function), templates (HTM with dynamic inclusions), debugging, and more.

I’m not going to cover all of the frameworks here—just those that I’ve found to be relatively simple to use and suitable for real websites. I’ll also show how to run the dynamic parts of a website with Python and other parts with a traditional web server.

——————————————

——————————————

——————————————

API
Application Programming Interface

browse
浏览

wordy
冗长的

——————————————

Beyond the Standard Library: Requests


At the beginning of Chapter 1, there’s a program that accesses a YouTube API by using the standard libraries urllib.request and json. Following that example is a version that uses the third-party module requests. The requests version is shorter and easier to understand.

For most purposes, I think web client development with requests is easier. You can browse the documentation (which is pretty good) for full details. I’ll show the basics of requests in this section and use it throughout this book for web client tasks.

First, install the requests library into your Python environment. From a terminal window (Windows users, type cmd to make one), type the following command to make the Python package installer pip download the latest version of the requests package and install it:

$ pip install requests


If you have trouble, read Appendix D for details on how to install and use pip.

Let’s redo our previous call to the quotes service with requests:

>>> import requests
>>> url = 'http://www.iheartquotes.com/api/v1/random'
>>> resp = requests.get(url)
>>> resp
<Response [200]>
>>> print(resp.text)
I know that there are people who do not love their fellow man, and I hate
people like that!

    -- Tom Lehrer, Satirist and Professor

[codehappy] http://iheartquotes.com/fortune/show/21465


It isn’t that different from using urllib.request.urlopen, but I think it feels a little less wordy.

——————————————

——————————————

import urllib.request as ur
url = 'https://www.baidu.com'
conn = ur.urlopen(url)
data = conn.read()
print(data)
print(conn.status)
print(conn.getheader('Content-Type'))
print('\n------××××-------\n')
for key, value in conn.getheaders():
    print(key, value)

——————————————

——————————————

scattered
分散

bundle
包；归拢

directory
目录

parse
解析

fortune
财富

chunk
块

peachy
桃色的

conveys
传达了

generic
通用的

whoops
哎呦

gateway
网关

backend
后端

sheer
纯粹的

curiosity
好奇心

Compatible
兼容的

revalidate
重新验证

straightforward
直截了当的

——————————————

Python’s Standard Web Libraries


In Python 2, web client and server modules were a bit scattered. One of the Python 3 goals was to bundle these modules into two packages (remember from Chapter 5 that a package is just a directory containing module files):


■http manages all the client-server HTTP details:

client does the client-side stuff

server helps you write Python web servers

cookies and cookiejar manage cookies, which save data between site visits


■urllib runs on top of http:

request handles the client request

response handles the server response

parse cracks the parts of a URL


Let’s use the standard library to get something from a website. The URL in the following example returns a random text quote, similar to a fortune cookie:

>>> import urllib.request as ur
>>> url = 'http://www.iheartquotes.com/api/v1/random'
>>> conn = ur.urlopen(url)
>>> print(conn)
<http.client.HTTPResponse object at 0x1006fad50>


In the official documentation, we find that conn is an HTTPResponse object with a number of methods, and that its read() method will give us data from the web page:

>>> data = conn.read()
>>> print(data)
b'You will be surprised by a loud noise.\r\n\n[codehappy]
http://iheartquotes.com/fortune/show/20447\n'


This little chunk of Python opened a TCP/IP connection to the remote quote server, made an HTTP request, and received an HTTP response. The response contained more than just the page data (the fortune). One of the most important parts of the response is the HTTP status code:

>>> print(conn.status)
200


A 200 means that everything was peachy. There are dozens of HTTP status codes, grouped into five ranges by their first (hundreds) digit:

1xx (information) The server received the request but has some extra information for the client. 

2xx (success) It worked; every success code other than 200 conveys extra details.

3xx (redirection) The resource moved, so the response returns the new URL to the client. 

4xx (client error) Some problem from the client side, such as the famous 404 (not found). 418 (I’m a teapot) was an April Fool’s joke. 

5xx (server error) 500 is the generic whoops; you might see a 502 (bad gateway) if there’s some disconnect between a web server and a backend application server.


Web servers can send data back to you in any format they like. It’s usually HTML (and usually some CSS and JavaScript), but in our fortune cookie example it’s plain text. The data format is specified by the HTTP response header value with the name Content-Type, which we also saw in our google.com example:

>>> print(conn.getheader('Content-Type'))
text/plain


That text/plain string is a MIME type, and it means plain old text. The MIME type for HTML, which the google.com example sent, is text/html. I’ll show you more MIME types in this chapter.

Out of sheer curiosity, what other HTTP headers were sent back to us?

>>> for key, value in conn.getheaders():
...     print(key, value)
...
Server nginx
Date Sat, 24 Aug 2013 22:48:39 GMT
Content-Type text/plain
Transfer-Encoding chunked
Connection close
Etag "8477e32e6d053fcfdd6750f0c9c306d6"
X-Ua-Compatible IE=Edge,chrome=1
X-Runtime 0.076496
Cache-Control max-age=0, private, must-revalidate


Remember that telnet example a little earlier? Now, our Python library is parsing all those HTTP response headers and providing them in a dictionary. Date and Server seem straightforward; some of the others, less so. It’s helpful to know that HTTP has a set of standard headers such as Content-Type, and many optional ones.

——————————————

——————————————

——————————————

telnet
远程登录

reassuring
让人安心

cue
提示

retrieves
检索

trimmed
修剪

track
跟踪

stranded
被困

——————————————

Test with telnet


HTTP is a text-based protocol, so you can actually type it yourself for web testing. The ancient telnet program lets you connect to any server and port and type commands.

Let’s ask everyone’s favorite test site, Google, some basic information about its home page. Type this:

$ telnet www.google.com 80


If there is a web server on port 80 at google.com (I think that’s a safe bet), telnet will print some reassuring information and then display a final blank line that’s your cue to type something else:

Trying 74.125.225.177...
Connected to www.google.com.
Escape character is '^]'.


Now, type an actual HTTP command for telnet to send to the Google web server. The most common HTTP command (the one your browser uses when you type a URL in its location bar) is GET. This retrieves the contents of the specified resource, such as an HTML file, and returns it to the client. For our first test, we’ll use the HTTP command HEAD, which just retrieves some basic information about the resource:

HEAD / HTTP/1.1


That HEAD / sends the HTTP HEAD verb (command) to get information about the home page (/). Add an extra carriage return to send a blank line so the remote server knows you’re all done and want a response. You’ll receive a response such as this (we trimmed some of the long lines using … so they wouldn’t stick out of the book):

HTTP/1.1 200 OK
Date: Sat, 26 Oct 2013 17:05:17 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=962a70e9eb3db9d9:FF=0:TM=1382807117:LM=1382807117:S=y...
  expires=Mon, 26-Oct-2015 17:05:17 GMT;
  path=/;
  domain=.google.com
Set-Cookie: NID=67=hTvtVC7dZJmZzGktimbwVbNZxPQnaDijCz716B1L56GM9qvsqqeIGb...
  expires=Sun, 27-Apr-2014 17:05:17 GMT
  path=/;
  domain=.google.com;
  HttpOnly
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts...
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic
Transfer-Encoding: chunked


These are HTTP response headers and their values. Some, like Date and Content-Type, are required. Others, such as Set-Cookie, are used to track your activity across multiple visits (we’ll talk about state management a little later in this chapter). When you make an HTTP HEAD request, you get back only headers. If you had used the HTTP GET or POST commands, you would also receive data from the home page (a mixture of HTML, CSS, JavaScript, and whatever else Google decided to throw into its home page).

I don’t want to leave you stranded in telnet. To close telnet, type the following:

q

——————————————

——————————————

——————————————

plumbing
管道

Transmission
传输

protocols
协议

initiate
发起

intended
目的

stateless
无状态的

simplifies
简化了

cart
车

Authentication
身份验证

——————————————

Web Clients


The low-level network plumbing of the Internet is called Transmission Control Protocol/Internet Protocol, or more commonly, simply TCP/IP (TCP/IP goes into more detail about this). It moves bytes among computers, but doesn’t care about what those bytes mean. That’s the job of higher-level protocols—syntax definitions for specific purposes. HTTP is the standard protocol for web data interchange.

The Web is a client-server system. The client makes a request to a server: it opens a TCP/IP connection, sends the URL and other information via HTTP, and receives a response.

The format of the response is also defined by HTTP. It includes the status of the request, and (if the request succeeded) the response’s data and format.

The most well-known web client is a web browser. It can make HTTP requests in a number of ways. You might initiate a request manually by typing a URL into the location bar or clicking on a link in a web page. Very often, the data returned is used to display a website—HTML documents, JavaScript files, CSS files, and images—but it can be any type of data, not just that intended for display.

An important aspect of HTTP is that it’s stateless. Each HTTP connection that you make is independent of all the others. This simplifies basic web operations but complicates others. Here are just a few samples of the challenges:

Caching 
Remote content that doesn’t change should be saved by the web client and used to avoid downloading from the server again. 

Sessions 
A shopping website should remember the contents of your shopping cart. 

Authentication 
Sites that require your username and password should remember them while you’re logged in.


Solutions to statelessness include cookies, in which the server sends the client enough specific information to be able to identify it uniquely when the client sends the cookie back.

——————————————

——————————————

——————————————

Untangled
解决

skeleton
骨架

Straddling
横跨

CERN
欧洲核子研究中心

lair
巢穴

villain
恶棍

quest
追求

domination
统治

prodigious
惊人的

amounts
量

circulated
散布

proposal
建议

disseminate
传播

distilled
蒸馏；提取精华

Hypertext
超文本

Protocol
协议

specification
规范

Markup
标记

presentation
陈述

Locator
定位器

term
术语

hiatus
中断

awareness
意识

Illinois
伊利诺斯州

released
发布

Mosaic
马赛克

Macintosh
麦金塔电脑

NCSA
美国国家计算机安全协会

noncommercial
非商业性

founded
创立

frenzy
狂暴

occurring
发生

explosive
爆炸

——————————————

Chapter 9. The Web, Untangled


Straddling the French-Swiss border is CERN—a particle physics research institute that would seem a good lair for a Bond villain. Luckily, its quest is not world domination but to understand how the universe works. This has always led CERN to generate prodigious amounts of data, challenging physicists and computer scientists just to keep up.

In 1989, the English scientist Tim Berners-Lee first circulated a proposal to help disseminate information within CERN and the research community. He called it the World Wide Web, and soon distilled its design into three simple ideas:

HTTP (Hypertext Transfer Protocol) 
A specification for web clients and servers to interchange requests and responses 

HTML (Hypertext Markup Language) 
A presentation format for results 

URL (Uniform Resource Locator) 
A way to uniquely represent a server and a resource on that server


In its simplest usage, a web client (I think Berners-Lee was the first to use the term browser) connected to a web server with HTTP, requested a URL, and received HTML.
He wrote the first web browser and server on a NeXT computer, invented by a short-lived company Steve Jobs founded during his hiatus from Apple Computer. Web awareness really expanded in 1993, when a group of students at the University of Illinois released the Mosaic web browser (for Windows, the Macintosh, and Unix) and NCSA httpd server. When I downloaded these and started building sites, I had no idea that the Web and the Internet would soon become part of everyday life. At the time, the Internet was still officially noncommercial; there were about 500 known web servers in the world. By the end of 1994, the number of web servers had grown to 10,000. The Internet was opened to commercial use, and the authors of Mosaic founded Netscape to write commercial web software. Netscape went public as part of the Internet frenzy that was occurring at the time, and the Web’s explosive growth has never stopped.

Almost every computer language has been used to write web clients and web servers. The dynamic languages Perl, PHP, and Ruby have been especially popular. In this chapter, I’ll show why Python is a particularly good language for web work at every level:

Clients, to access remote sites

Servers, to provide data for websites and web APIs

Web APIs and services, to interchange data in other ways than viewable web pages


And while we’re at it, we’ll build an actual interactive website in the exercises at the end of this chapter.

——————————————

——————————————

——————————————

8.11. Install the Redis server (see Appendix D) and the Python redis library (pip install redis) on your machine. Create a Redis hash called test with the fields count (1) and name ('Fester Bestertester'). Print all the fields for test.


>>> import redis
>>> conn = redis.Redis()
>>> conn.delete('test')
1
>>> conn.hmset('test', {'count': 1, 'name': 'Fester Bestertester'})
True
>>> conn.hgetall('test')
{b'name': b'Fester Bestertester', b'count': b'1'}

——————————————

8.12. Increment the count field of test and print it.


>>> conn.hincrby('test', 'count', 3)
4
>>> conn.hget('test', 'count')
b'4'

——————————————

——————————————

8.10. Use the sqlalchemy module to connect to the sqlite3 database books.db that you just made in exercise 8.6. As in 8.8, select and print the title column from the book table in alphabetical order.


>>> import sqlalchemy
>>> conn = sqlalchemy.create_engine('sqlite:///books.db')
>>> sql = 'select title from book order by title asc'
>>> rows = conn.execute(sql)
>>> for row in rows:
...     print(row)
...
('Perdido Street Station',)
('Small Gods',)
('The Spellman Files',)
('The Weirdstone of Brisingamen',)
('Thud!',)

——————————————

Look at it. It's doesn't matter whether or not you remember it because you'll find it in this book when you really want to use it.

——————————————

publication
出版

——————————————

8.9. Select and print all columns from the book table in order of publication.


>>> for row in db.execute('select * from book order by year'):
...     print(row)
...
('The Weirdstone of Brisingamen', 'Alan Garner', 1960)
('Small Gods', 'Terry Pratchett', 1992)
('Perdido Street Station', 'China Miéville', 2000)
('Thud!', 'Terry Pratchett', 2005)
('The Spellman Files', 'Lisa Lutz', 2007)


To print all the fields in each row, just separate with a comma and space:

>>> for row in db.execute('select * from book order by year'):
...     print(*row, sep=', ')
...
The Weirdstone of Brisingamen, Alan Garner, 1960
Small Gods, Terry Pratchett, 1992
Perdido Street Station, China Miéville, 2000
Thud!, Terry Pratchett, 2005
The Spellman Files, Lisa Lutz, 2007

——————————————

——————————————

8.7. Read books.csv and insert its data into the book table.


import csv
import sqlite3

conn = sqlite3.connect('/sdcard/yuanfudao/books.db')
curs = conn.cursor()

ins_str = 'insert into books values(?, ?, ?)'
with open('/sdcard/yuanfudao/books.csv', 'rt') as infile:
    books = csv.DictReader(infile)
    for book in books:
        curs.execute(ins_str, (book['title'], book['author'], book['year']))
conn.commit()

——————————————

alphabetical
字母顺序排列

——————————————

8.8. Select and print the title column from the book table in alphabetical order.


import sqlite3
db = sqlite3.connect('/sdcard/yuanfudao/books.db')
sql = 'SELECT title FROM books ORDER BY title asc'
for row in db.execute(sql):
    print(row)

——————————————

——————————————

😅C++ is the real problem

——————————————

我知道，就是资料太少

——————————————

那你能用C++ 和 QT做出安桌程序吗？

——————————————

不要那么麻烦，只要能让自己觉得自己的生命是有意义的就行。

——————————————

正在学python


过两天学Android studio

——————————————

8.7. Read books.csv and insert its data into the book table.


import csv
import sqlite3

conn = sqlite3.connect('/sdcard/yuanfudao/books.db')
curs = conn.cursor()

ins_str = 'insert into books values(?, ?, ?)'
with open('/sdcard/yuanfudao/books.csv', 'rt') as infile:
    books = csv.DictReader(infile)
    for book in books:
        curs.execute(ins_str, (book['title'], book['author'], book['year']))

——————————————

8.6. Use the sqlite3 module to create a SQLite database called books.db and a table called books with these fields: title (text), author (text), and year (integer).


import sqlite3
conn = sqlite3.connect('/sdcard/yuanfudao/books.db')
curs = conn.cursor()
curs.execute('''CREATE TABLE books(title TEXT,author TEXT,year INT)''')

——————————————

8.5. Create a CSV file called books.csv by using these lines:

title,author,year
The Weirdstone of Brisingamen,Alan Garner,1960
Perdido Street Station,China Miéville,2000
Thud!,Terry Pratchett,2005
The Spellman Files,Lisa Lutz,2007
Small Gods,Terry Pratchett,1992


text = '''title,author,year
The Weirdstone of Brisingamen,Alan Garner,1960
Perdido Street Station,China Miéville,2000
Thud!,Terry Pratchett,2005
The Spellman Files,Lisa Lutz,2007
Small Gods,Terry Pratchett,1992'''

with open('/sdcard/yuanfudao/books.csv', 'wt') as outfile:
    outfile.write(text)

——————————————

http://fir.im/YShelper

——————————————

3.E4A声明文本类型不支持中文引号

——————————————

我尼玛，，， 成功了


问题在于
1.E4A的数组下标从0开始

2.E4A的文本是用 & 连接的

——————————————

果然比易语言还让我揪心

十分钟做功能

5个小时做调试

各种错误啊😂😁😡😭😕😐

——————————————

这是一个不同，相对于易语言

——————————————

子程序
E4A的子程序包括3种：函数、过程、事件。
函数和过程都是可以自定义的子程序，两者不同之处在于，函数拥有返回值，而过程则没有。事件则是对象成员固有的，不能自定义。

——————————————

😔

——————————————

was a

——————————————

Ha ha~  I was gabage!!!

——————————————

8.4. Use the csv module and its DictReader method to read books.csv to the variable books. Print the values in books. Did DictReader handle the quotes and commas in the second book’s title?


import csv
with open('/sdcard/yuanfudao/books.csv', 'rt') as fin:
    cin = csv.DictReader(fin)
    books = [row for row in cin]
print(books)

——————————————

books.csv

——————————————

8.3. Save these text lines to a file called books.csv. Notice that if the fields are separated by commas, you need to surround a field with quotes if it contains a comma.

author,book
J R R Tolkien,The Hobbit
Lynne Truss,"Eats, Shoots & Leaves"


text = '''author,book
J R R Tolkien,The Hobbit
Lynne Truss,"Eats, Shoots & Leaves"
'''
with open('/sdcard/yuanfudao/test.csv', 'wt') as outfile:
outfile.write(text)

——————————————

8.2. Open the file test.txt and read its contents into the string test2. Are test1 and test2 the same?


test1 = 'This is a test of the emergency text system'

fout = open('/sdcard/yuanfudao/test.txt', 'rt')
test2 = fout.read()
print(test1==test2)

——————————————

Things to Do


8.1. Assign the string 'This is a test of the emergency text system' to the variable test1, and write test1 to a file called test.txt.


test1 = 'This is a test of the emergency text system'
fout = open('/sdcard/yuanfudao/test.txt', 'wt')
fout.write(test1)
fout.close()

——————————————

Redis(7)


Caches and expiration

All Redis keys have a time-to-live, or expiration date. By default, this is forever. We can use the expire() function to instruct Redis how long to keep the key. As is demonstrated here, the value is a number of seconds:

>>> import time
>>> key = 'now you see it'
>>> conn.set(key, 'but not for long')
True
>>> conn.expire(key, 5)
True
>>> conn.ttl(key)
5
>>> conn.get(key)
b'but not for long'
>>> time.sleep(6)
>>> conn.get(key)
>>>


The expireat() command expires a key at a given epoch time. Key expiration is useful to keep caches fresh and to limit login sessions.

——————————————

Redis(6)


Bits

This is a very space-efficient and fast way to deal with large sets of numbers. Suppose that you have a website with registered users. You’d like to track how often people log in, how many users visit on a particular day, how often the same user visits on following days, and so on. You could use Redis sets, but if you’ve assigned increasing numeric user IDs, bits are more compact and faster.

Let’s begin by creating a bitset for each day. For this test, we’ll just use three days and a few user IDs:

>>> days = ['2013-02-25', '2013-02-26', '2013-02-27']
>>> big_spender = 1089
>>> tire_kicker = 40459
>>> late_joiner = 550212


Each date is a separate key. Set the bit for a particular user ID for that date. For example, on the first date (2013-02-25), we had visits from big_spender (ID 1089) and tire_kicker (ID 40459):

>>> conn.setbit(days[0], big_spender, 1)
0
>>> conn.setbit(days[0], tire_kicker, 1)
0


The next day, big_spender came back:

>>> conn.setbit(days[1], big_spender, 1)
0


The next day had yet another visit from our friend, big_spender, and a new person whom we’re calling late_joiner:

>>> conn.setbit(days[2], big_spender, 1)
0
>>> conn.setbit(days[2], late_joiner, 1)
0


Let’s get the daily visitor count for these three days:

>>> for day in days:
...     conn.bitcount(day)
...
2
1
2


Did a particular user visit on a particular day?

>>> conn.getbit(days[1], tire_kicker)
0


So, tire_kicker did not visit on the second day.


How many users visited every day?

>>> conn.bitop('and', 'everyday', *days)
68777
>>> conn.bitcount('everyday')
1


I’ll give you three guesses who it was:

>>> conn.getbit('everyday', big_spender)
1


Finally, what was the number of total unique users in these three days?

>>> conn.bitop('or', 'alldays', *days)
68777
>>> conn.bitcount('alldays')
3

——————————————

Redis(5)


Sorted sets

One of the most versatile Redis data types is the sorted set, or zset. It’s a set of unique values, but each value has an associated floating point score. You can access each item by its value or score. Sorted sets have many uses:

Leader boards
Secondary indexes
Timeseries, using timestamps as scores


We’ll show the last use case, tracking user logins via timestamps. We’re using the Unix epoch value (more on this in Chapter 10) that’s returned by the Python time() function:

>>> import time
>>> now = time.time()
>>> now
1361857057.576483


Let’s add our first guest, looking nervous:

>>> conn.zadd('logins', 'smeagol', now)
1


Five minutes later, another guest:

>>> conn.zadd('logins', 'sauron', now+(5*60))
1


Two hours later:

>>> conn.zadd('logins', 'bilbo', now+(2*60*60))
1


One day later, not hasty:

>>> conn.zadd('logins', 'treebeard', now+(24*60*60))
1


In what order did bilbo arrive?

>>> conn.zrank('logins', 'bilbo')
2


When was that?

>>> conn.zscore('logins', 'bilbo')
1361864257.576483


Let’s see everyone in login order:

>>> conn.zrange('logins', 0, -1)
[b'smeagol', b'sauron', b'bilbo', b'treebeard']


With their times, please:

>>> conn.zrange('logins', 0, -1, withscores=True)
[(b'smeagol', 1361857057.576483), (b'sauron', 1361857357.576483),
(b'bilbo', 1361864257.576483), (b'treebeard', 1361943457.576483)]

——————————————

Redis(4)


Sets

Redis sets are similar to Python sets, as you can see in the series of examples that follow.
Add one or more values to a set:

>>> conn.sadd('zoo', 'duck', 'goat', 'turkey')
3


Get the number of values from the set:

>>> conn.scard('zoo')
3


Get all the set’s values:

>>> conn.smembers('zoo')
{b'duck', b'goat', b'turkey'}


Remove a value from the set:

>>> conn.srem('zoo', 'turkey')
True


Let’s make a second set to show some set operations:

>>> conn.sadd('better_zoo', 'tiger', 'wolf', 'duck')
0


Intersect (get the common members of) the zoo and better_zoo sets:

>>> conn.sinter('zoo', 'better_zoo')
{b'duck'}


Get the intersection of zoo and better_zoo, and store the result in the set fowl_zoo:

>>> conn.sinterstore('fowl_zoo', 'zoo', 'better_zoo')
1


Who’s in there?

>>> conn.smembers('fowl_zoo')
{b'duck'}


Get the union (all members) of zoo and better_zoo:

>>> conn.sunion('zoo', 'better_zoo')
{b'duck', b'goat', b'wolf', b'tiger'}


Store that union result in the set fabulous_zoo:

>>> conn.sunionstore('fabulous_zoo', 'zoo', 'better_zoo')
4
>>> conn.smembers('fabulous_zoo')
{b'duck', b'goat', b'wolf', b'tiger'}


What does zoo have that better_zoo doesn’t? Use sdiff() to get the set difference, and sdiffstore() to save it in the zoo_sale set:

>>> conn.sdiff('zoo', 'better_zoo')
{b'goat'}
>>> conn.sdiffstore('zoo_sale', 'zoo', 'better_zoo')
1
>>> conn.smembers('zoo_sale')
{b'goat'}

——————————————

Redis(3)


Hashes

Redis hashes are similar to Python dictionaries but can contain only strings. Thus, you can go only one level deep, not make deep-nested structures. Here are examples that create and play with a Redis hash called song:


Set the fields do and re in hash song at once by using hmset():

>>> conn.hmset('song', {'do': 'a deer', 're': 'about a deer'})
True


Set a single field value in a hash by using hset():

>>> conn.hset('song', 'mi', 'a note to follow re')
1


Get one field’s value by using hget():

>>> conn.hget('song', 'mi')
b'a note to follow re'


Get multiple field values by using hmget():

>>> conn.hmget('song', 're', 'do')
[b'about a deer', b'a deer']


Get all field keys for the hash by using hkeys():

>>> conn.hkeys('song')
[b'do', b're', b'mi']


Get all field values for the hash by using hvals():

>>> conn.hvals('song')
[b'a deer', b'about a deer', b'a note to follow re']


Get the number of fields in the hash by using hlen():

>>> conn.hlen('song')
3


Get all field keys and values in the hash by using hgetall():

>>> conn.hgetall('song')
{b'do': b'a deer', b're': b'about a deer', b'mi': b'a note to follow re'}


Set a field if its key doesn’t exist by using hsetnx():

>>> conn.hsetnx('song', 'fa', 'a note that rhymes with la')
1

——————————————

Redis(2)


Lists

Redis lists can contain only strings. The list is created when you do your first insertion. Insert at the beginning by using lpush():

>>> conn.lpush('zoo', 'bear')
1


Insert more than one item at the beginning:

>>> conn.lpush('zoo', 'alligator', 'duck')
3


Insert before or after a value by using linsert():

>>> conn.linsert('zoo', 'before', 'bear', 'beaver')
4
>>> conn.linsert('zoo', 'after', 'bear', 'cassowary')
5


Insert at an offset by using lset() (the list must exist already):

>>> conn.lset('zoo', 2, 'marmoset')
True
Insert at the end by using rpush():
>>> conn.rpush('zoo', 'yak')
6


Get the value at an offset by using lindex():

>>> conn.lindex('zoo', 3)
b'bear'


Get the values in an offset range by using lrange() (0 to -1 for all):

>>> conn.lrange('zoo', 0, 2)
[b'duck', b'alligator', b'marmoset']


Trim the list with ltrim(), keeping only those in a range of offsets:

>>> conn.ltrim('zoo', 1, 4)
True


Get a range of values (use 0 to -1 for all) by using lrange():

>>> conn.lrange('zoo', 0, -1)
[b'alligator', b'marmoset', b'bear', b'cassowary']


Chapter 10 shows you how you can use Redis lists and publish-subscribe to implement job queues.

——————————————

https://game.sobug.com

Fail in the first level.
It means I wouldn't be a Harker.

😄😁

——————————————

I'll do it tomorrow.

——————————————

Redis(1)


Strings

A key with a single value is a Redis string. Simple Python data types are automatically converted. Connect to a Redis server at some host (default is localhost) and port (default is 6379):

>>> import redis
>>> conn = redis.Redis()

redis.Redis('localhost') or redis.Redis('localhost', 6379) would have given the same result.


List all keys (none so far):

>>> conn.keys('*')
[]


Set a simple string (key 'secret'), integer (key 'carats'), and float (key 'fever'):

>>> conn.set('secret', 'ni!')
True
>>> conn.set('carats', 24)
True
>>> conn.set('fever', '101.5')
True


Get the values back by key:

>>> conn.get('secret')
b'ni!'
>>> conn.get('carats')
b'24'
>>> conn.get('fever')
b'101.5'


Here, the setnx() method sets a value only if the key does not exist:

>>> conn.setnx('secret', 'icky-icky-icky-ptang-zoop-boing!')
False


It failed because we had already defined 'secret':

>>> conn.get('secret')
b'ni!'


The getset() method returns the old value and sets it to a new one at the same time:

>>> conn.getset('secret', 'icky-icky-icky-ptang-zoop-boing!')
b'ni!'


Let’s not get too far ahead of ourselves. Did it work?

>>> conn.get('secret')
b'icky-icky-icky-ptang-zoop-boing!'


Now, get a substring by using getrange() (as in Python, offset 0=start, -1=end):

>>> conn.getrange('secret', -6, -1)
b'boing!'


Replace a substring by using setrange() (using a zero-based offset):

>>> conn.setrange('secret', 0, 'ICKY')
32
>>> conn.get('secret')
b'ICKY-icky-icky-ptang-zoop-boing!'


Next, set multiple keys at once by using mset():

>>> conn.mset({'pie': 'cherry', 'cordial': 'sherry'})
True


Get more than one value at once by using mget():

>>> conn.mget(['fever', 'carats'])
[b'101.5', b'24']


Delete a key by using delete():

>>> conn.delete('fever')
True


Increment by using the incr() or incrbyfloat() commands, and decrement with decr():

>>> conn.incr('carats')
25
>>> conn.incr('carats', 10)
35
>>> conn.decr('carats')
34
>>> conn.decr('carats', 15)
19
>>> conn.set('fever', '101.5')
True
>>> conn.incrbyfloat('fever')
102.5
>>> conn.incrbyfloat('fever', 0.5)
103.0


There’s no decrbyfloat(). Use a negative increment to reduce the fever:

>>> conn.incrbyfloat('fever', -2.0)
101.0

——————————————

How to learn English:


Google translation.

NCE and VOA Special English.

Yuantiku and self correction.

https://textranch.com/grammar-checker/

——————————————

——————————————

Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.

——————————————

Redis(0)


Redis is a data structure server. Like memcached, all of the data in a Redis server should fit in memory (although there is now an option to save the data to disk). Unlike memcached, Redis can do the following:

Save data to disk for reliability and restarts

Keep old data

Provide more data structures than simple strings


The Redis data types are a close match to Python’s, and a Redis server can be a useful intermediary for one or more Python applications to share data. I’ve found it so useful that it’s worth a little extra coverage here.

The Python driver redis-py has its source code and tests on GitHub, as well as online documentation. You can install it by using this command:

$ pip install redis


The Redis server itself has good documentation. If you install and start the Redis server on your local computer (with the network nickname localhost), you can try the programs in the following sections.

——————————————

——————————————

Memcached


memcached is a fast in-memory key-value cache server. It’s often put in front of a database, or used to store web server session data. You can download versions for Linux and OS X, and for Windows. If you want to try out this section, you’ll need a memcached server and Python driver.

There are many Python drivers; one that works with Python 3 is python3-memcached, which you can install by using this command:

$ pip install python-memcached


To use it, connect to a memcached server, after which you can do the following:

Set and get values for keys

Increment or decrement a value

Delete a key


Data is not persistent, and data that you wrote earlier might disappear. This is inherent in memcached, being that it’s a cache server. It avoids running out of memory by discarding old data.

You can connect to multiple memcached servers at the same time. In this next example, we’re just talking to one on the same computer:

>>> import memcache
>>> db = memcache.Client(['127.0.0.1:11211'])
>>> db.set('marco', 'polo')
True
>>> db.get('marco')
'polo'
>>> db.set('ducks', 0)
True
>>> db.get('ducks')
0
>>> db.incr('ducks', 2)
2
>>> db.get('ducks')
2

——————————————

The dbm Family


The dbm formats were around long before NoSQL was coined. They’re key-value stores, often embedded in applications such as web browsers to maintain various settings. A dbm database is like a Python dictionary in the following ways:

You can assign a value to a key, and it’s automatically saved to the database on disk.
You can get a value from a key.


The following is a quick example. The second argument to the following open() method is 'r' to read, 'w' to write, and 'c' for both, creating the file if it doesn’t exist:

>>> import dbm
>>> db = dbm.open('definitions', 'c')


To create key-value pairs, just assign a value to a key just as you would a dictionary:

>>> db['mustard'] = 'yellow'
>>> db['ketchup'] = 'red'
>>> db['pesto'] = 'green'


Let’s pause and check what we have so far:

>>> len(db)
3
>>> db['pesto']
b'green'


Now close, then reopen to see if it actually saved what we gave it:

>>> db.close()
>>> db = dbm.open('definitions', 'r')
>>> db['mustard']
b'yellow'


Keys and values are stored as bytes. You cannot iterate over the database object db, but you can get the number of keys by using len(). Note that get() and setdefault() work as they do for dictionaries.

——————————————

NoSQL Data Stores


Some databases are not relational and don’t support SQL. These were written to handle very large data sets, allow more flexible data definitions, or support custom data operations. They’ve been collectively labeled NoSQL (formerly meaning no SQL; now the less confrontational not only SQL).

——————————————

😊

——————————————

Sure, I uninstalled those useless things.

——————————————

No, just for you, for me, for everybody.

——————————————

我就是专科的。在天津上的一个软件学院的专科，后来专升本。
专科毕业的时候有一年的时间在找工作。后来还是回去上学了。
这个没什么特别的，主要还是项目经验。英语应该是主要的差别，不过在早期对工作影响不大。
还是能找到工资三四千的工作的。非常困难，碰壁很多，但是还是能找到糊口的工作的。
你碰到的问题，名校的也能碰到。
我专科毕业的时候拿到的最好的工作机会是在非洲做项目实施，我是低分过了六级，托福裸考69分的英语水平，出去说英语也能凑合。工资是一万多。但是公司太小，觉得不太正规。这个要求对技术了解，不过也不用太了解，会写照猫画虎写英文文档愿意出差就行。
专升本今年毕业，现在来看最好的offer是IBM南京。二线城市四千的工资。我就不去吐槽这个工资了。专升本了也就那样。作为java开发土鳖，能进IBM火星我也去。
现在的水平，在实习的公司框架是EJB2，太古老了。不过需求别太奇葩，遗留代码别一行注释都没有，也基本都能写出来。ssh该会的都会，就是那一套东西。


我个人的想法是即使你专科毕业能找到工作，如果不是家庭条件太差，还是建议你上专升本。以后再想办法补学历的问题。学历不行还是非常吃亏的。


刚毕业最头疼的是项目经验，这个没事，时间长了都有经验了。只要留在这个行业，经验也都是混出来的。我个人觉得除了英语，其实名校计算机能写出来编译器的大神也没几个。你自己闲着没事刷半年算法题补点数学，以后出来不会和名校的有什么差距。当然仅限计算机专业。就算还有什么差别，这个差别说实在点也就是少看两本书的差别，现补也来得及。

给我们学校打个广告，天津工业大学软件学院专升本，两百分也能进。我觉得混个学历避免简历一上来就被刷掉还是比较划算的。

——————————————

特辑:解析语言与思维、认知、行动等间的关系
 
 
人类语言发展历程：潜意识——肢体语言——口头语言——文字语言——定理公式。(准确的说，语言是相对于第三个人看两个人的交流而产生的)
 
注：
 
潜意识——非语言性的意识活动。
 
肢体语言——可理解为身体语言。
 
口头语言——纯语音，没有文字与之对应。
 
文字语言——如英语、汉语、法语等。
 
定理公式——由文字语言抽离出来的更精准的表达，如数学、物理、化学的表达等。
 
目前大多数人的可表述思维是由口语+文字构成的。
 
生物的认知相对，在认知过程中会产生差异信息，在欧美把它叫做心理模型。
 
像一棵树，这棵树与其它事物对比起来不同，这些不同就决定了它就是一棵树。
 
为什么要叫它“树”而不叫其它什么？这是有原因的。
 
在语言的形成过程中，社会契约起到了很大的作用，人们为了方便交流，约定成俗某个字词对应的差异信息。
 
像苹果这个物体，在欧美叫“apple”,而在中国叫“苹果”一样，不同的国家或社会群体会有不同的语言契约（英语、德语、法语等）。
 
定义这些文字契约是有原因的，即需求交换。
 
具体就是在生物捕食与被捕食活动中，为了个体与个体交流经验而订立，如对某地形情况进行交流，这种交流有利于同种群生物更好的生存。
 
如今，不同语言蕴含不同的思想，西方崇尚自由、个人主义，东方则崇尚专制、集体主义，这是由地形、环境等决定的。
 
世界上的事物本质上是动态的，是一个过程。
 
人们认识这些过程时，总是要将它拆分开，认识越深，拆分得越细。
 
拆分的过程，本质上是对比的过程。一个过程被拆分为很多方面，每个方面都相对于其它方面而存在。
 
给人的直接感觉是：它是一个循环(如四季、昼夜)
 
过程的每个方面或环节都由我们自己去定义，这个环节相对于上面、下面环节是怎样的。（对于哪个环节最重要，随个人所好。反正哪个环节没做好，过程就会出问题或不再是原过程。）
 
事实上环节的拆分是无穷无尽的，就是说对同一个过程，可以有无数个理解。对同一个事件，可以有很多种理论。
 
数学、物理、历史等都是从某方面看的世界。
 
在对过程的描述中，以任何一个环节为中心与其他部分进行比较都可以。
 
也就是说，不管什么东西都可以和世界上其他东西作比较，从而解释这个世界。
 
有人说:“这么多认识，我该学哪个？”
 
不急，在语言中，认知不光对于具体事物，也包括我们自己的行为。比如伸手、弹跳、逃跑等。
 
正如我们知道猎食者出现要逃跑，异性出现要追随一样，在某一理论中，会有自身行为与其它事物间的相互作用的描述。
 
因此在一种概括性思想中，不能只学总思想，要从上到下，直至量化到一种行动级别的思想（理论）为止。
 
我们要学的，是像那金字塔一样的知识结构或体系(是一个由抽象到具体的整体，是相互连接的有单一顶点、有多个基点的知识体系)。
 
不管对过程的认识如何，只要能引导我们做出有利于我们的行动就行。不在乎你是否用同一理论，你完全可以各种学科、理论知识混用，达到目的即可。
 
 
在婴幼儿时期人类是没有语言的，这时对世界的认知构成了我们的潜意识——童年时期以自我为中心，与外界交互的意识流，我们称为潜意识。
 
潜意识侧重于分析眼前利益(包括那些很明显的属于本能的东西)，而语言性思维则侧重于分析长远利益(不排除有人经过长期训练而练成瞬间分析利益的能力)。
 
这就是为什么小时候我们很难察觉到那些隐藏的可用语言表述为利益的关系的原因——幼时我们受潜意识或者说直觉支配，别人抢了自己东西就生气，给东西就高兴等。 
 
长大了潜意识会变复杂。
 
 
语言课程，如语文教学，意在帮助人们了解事物的差异并把这种差异以一种可表示的方法表示出来。
 
也就是让人们熟练的运用这些差异信息，掌握阅读、写作、交流等能力。（文言文与现代文不同，学习它只是为了更熟练的融合并得出正确的差异信息）
 
这种教学有时注重将这种差异体现到极致，也就是两极端，越极端，对事物的认识越彻底(要深入认识需学习两种对立的表达方式)。
 
 
对于一篇由众多差异信息构成的文章，越极端，越符合某一集团的利益。对人就越有震撼力。
 
为何有震撼力？因为在未与某集团发生利益关系时，人们会选择并支持更强大的集团（特别是与自身利益一致的集团）。
 
但不以个人或集体的利益来说，科学的认识应该把两极端都写出来，并指出它们之间的联系。(这样看来，辩证法是有用的，它把两边的利益关系都写出来，谁也不偏袒。)
 
 
真正的科学不涉及个人或团体的直接利益，它要揭示事物的真实情况。
 
这里的真实情况不是简单的你是对的我是错的，而是存在与不存在的区别。
 
就像一事物，我们能通过眼睛看到它，那么它就是存在的，也就是真实的(对比方式为眼睛观看，还有很多方式，如记量法——记长度、质量等能让我们以某种方式感觉到的方法)。
 
这就是科学理论的实质，极端认知有与无，或感知存在与否。（像暗物质，你能为它取名就说明你感到了它，通过物理）
 
 
常说的主观性就是利益立场的不同。
 
我们知道，语言可表述人们的利益立场、形态，能改变利益关系。同时，利益也可以改变具体语言（这是一个循环又不同的过程）。
 
就像用语言说服一个人，就是用现有的利益语言规范去让那个人相信做某事对他有利。（如“你信我吧！他要杀你！快逃！”可以让一个人逃跑。）
 
 
基本语言每隔一段时间就会大变更，与语言群体的存亡、迁徙等事件有关。（如朝代更换、民族融合、种族灭绝等）
 
其语言中的小变革更是经常，多是由个别利益冲突事件引起的(比如文字狱、大人物用错字)。
 
因此，语言在历史发展中难免会出现一词多义、古今异义、假字真用、随意造字等情况。
 
它实是代表某一社会、团体或个人的意志，不像由它抽离出的数学语言般固定。所以基础语言相对不精确是必然的。
 
但需注意，如果不保持某种语言的相对稳定，对于学了或正在学这门语言的人来说是个损害。(比如我才学好英语，你却告诉我你们改用火星文一样。)
 
语言实际上是一个巨大的思想库，是从人脑产生的外延产物。
 
它把人脑内部处理的信息用能让别人感到的东西(如视觉可感符号)代替，再输出。
 
它反映出使用这种语言的人群对世界的认知范围、深度等。
 
同时，语言的层级结构也反映了思维的层级结构。(具有共性)

——————————————

So I always do that.

——————————————

Change the website, then try again.

——————————————

https://www.google.com.hk/?gws_rd=ssl

——————————————

Mapper
制图人

declarative
宣言的；公布的

——————————————

ons. If the application is that simple, maybe you can just use straight SQL (or the SQL Expression Language), anyhow.

Or, you can try something simpler such as dataset. It’s built on SQLAlchemy and provides a simple ORM for SQL, JSON, and CSV storage.

——————————————

Relational Databases(9)


The Object-Relational Mapper

In the last section, the zoo object was a mid-level connection between SQL and Python. At the top layer of SQLAlchemy, the Object-Relational Mapper (ORM) uses the SQL Expression Language but tries to make the actual database mechanisms invisible. You define classes, and the ORM handles how to get their data in and out of the database. The basic idea behind that complicated phrase, “object-relational mapper,” is that you can refer to objects in your code, and thus stay close to the way Python likes to operate, while still using a relational database.

We’ll define a Zoo class and hook it into the ORM. This time, we’ll make SQLite use the file zoo.db so that we can confirm that the ORM worked.

As in the previous two sections, the snippets that follow are actually one program separated by explanations. Don’t worry if you don’t understand some if it. The SQLAlchemy documentation has all the details, and this stuff can get complex. I just want you to get an idea of how much work it is to do this, so that you can decide which of the approaches discussed in this chapter suits you.

The initial import is the same, but this time we need another something also:

>>> import sqlalchemy as sa
>>> from sqlalchemy.ext.declarative import declarative_base

Here, we make the connection:

>>> conn = sa.create_engine('sqlite:///zoo.db')

Now, we get into SQLAlchemy’s ORM. We define the Zoo class and associate its attributes with table columns:

>>> Base = declarative_base()
>>> class Zoo(Base):
...     __tablename__ = 'zoo'
...     critter = sa.Column('critter', sa.String, primary_key=True)
...     count = sa.Column('count', sa.Integer)
...     damages = sa.Column('damages', sa.Float)
...     def __init__(self, critter, count, damages):
...         self.critter = critter
...         self.count = count
...         self.damages = damages
...     def __repr__(self):
...         return "<Zoo({}, {}, {})>".format(self.critter, self.count, self.damages)


The following line magically creates the database and table:

>>> Base.metadata.create_all(conn)

You can then insert data by creating Python objects. The ORM manages these internally:

>>> first = Zoo('duck', 10, 0.0)
>>> second = Zoo('bear', 2, 1000.0)
>>> third = Zoo('weasel', 1, 2000.0)
>>> first
<Zoo(duck, 10, 0.0)>


Next, we get the ORM to take us to SQL land. We create a session to talk to the database:

>>> from sqlalchemy.orm import sessionmaker
>>> Session = sessionmaker(bind=conn)
>>> session = Session()

Within the session, we write the three objects that we created to the database. The add() function adds one object, and add_all() adds a list:

>>> session.add(first)
>>> session.add_all([second, third])

Finally, we need to force everything to complete:

>>> session.commit()

Did it work? Well, it created a zoo.db file in the current directory. You can use the command-line sqlite3 program to check it:

$ sqlite3 zoo.db
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
zoo
sqlite> select * from zoo;
duck|10|0.0
bear|2|1000.0
weasel|1|2000.0


The purpose of this section was to show what an ORM is and how it works at a high level. The author of SQLAlchemy has written a full tutorial. After reading this, decide which of the following levels would best fit your needs:

Plain DB-API, as in the earlier SQLite section

The SQLAlchemy engine room

The SQLAlchemy Expression Language

The SQLAlchemy ORM


It seems like a natural choice to use an ORM to avoid the complexities of SQL. Should you use one? Some people think ORMs should be avoided, but others think the criticism is overdone. Whoever’s right, an ORM is an abstraction, and all abstractions break down at some point; they’re leaky. When your ORM doesn’t do what you want, you must figure out both how it works and how to fix it in SQL. To borrow an Internet meme: Some people, when confronted with a problem, think, “I know, I’ll use an ORM.” Now they have two problems. Use ORMs sparingly, and mostly for simple applicati

——————————————

A programmer, not a mathematician, means not a great artist.

——————————————

gabage either

——————————————

gabage

——————————————

Relational Databases(8)


The SQL Expression Language

The next level up is SQLAlchemy’s SQL Expression Language. It introduces functions to create the SQL for various operations. The Expression Language handles more of the SQL dialect differences than the lower-level engine layer does. It can be a handy middle-ground approach for relational database applications.

Here’s how to create and populate the zoo table. Again, these are successive fragments of a single program.

The import and connection are the same as before:

>>> import sqlalchemy as sa
>>> conn = sa.create_engine('sqlite://')

To define the zoo table, we’ll begin using some of the Expression Language instead of SQL:

>>> meta = sa.MetaData()
>>> zoo = sa.Table('zoo', meta,
...     sa.Column('critter', sa.String, primary_key=True),
...     sa.Column('count', sa.Integer),
...     sa.Column('damages', sa.Float)
...    )
>>> meta.create_all(conn)

Check out the parentheses in that multiline call in the preceding example. The structure of the Table() method matches the structure of the table. Just as our table contains three columns, there are three calls to Column() inside the parentheses of the Table() method call.

Meanwhile, zoo is some magic object that bridges the SQL database world and the Python data structure world.

Insert the data with more Expression Language functions:

... conn.execute(zoo.insert(('bear', 2, 1000.0)))
<sqlalchemy.engine.result.ResultProxy object at 0x1017ea910>
>>> conn.execute(zoo.insert(('weasel', 1, 2000.0)))
<sqlalchemy.engine.result.ResultProxy object at 0x1017eab10>
>>> conn.execute(zoo.insert(('duck', 10, 0)))
<sqlalchemy.engine.result.ResultProxy object at 0x1017eac50>

Next, create the SELECT statement (zoo.select() selects everything from the table represented by the zoo object, such as SELECT * FROM zoo would do in plain SQL):

>>> result = conn.execute(zoo.select())

Finally, get the results:

>>> rows = result.fetchall()
>>> print(rows)
[('bear', 2, 1000.0), ('weasel', 1, 2000.0), ('duck', 10, 0.0)]

——————————————

Relational Databases(7)


The engine layer

First, we’ll try the lowest level of SQLAlchemy, which does little more than the base DB-API functions.

Let’s try it with SQLite, which is already built into Python. The connection string for SQLite skips the host, port, user, and password. The dbname informs SQLite as to what file to use to store your database. If you omit the dbname, SQLite builds a database in memory. If the dbname starts with a slash (/), it’s an absolute filename on your computer (as in Linux and OS X; for example, C:\\ on Windows). Otherwise, it’s relative to your current directory.

The following segments are all part of one program, separated here for explanation.

To begin, you need to import what we need. The following is an example of an import alias, which lets us use the string sa to refer to SQLAlchemy methods. I do this mainly because sa is a lot easier to type than sqlalchemy:

>>> import sqlalchemy as sa


Connect to the database and create the storage for it in memory (the argument string 'sqlite:///:memory:' also works):

>>> conn = sa.create_engine('sqlite://')

Create a database table called zoo that comprises three columns:

>>> conn.execute('''CREATE TABLE zoo
...     (critter VARCHAR(20) PRIMARY KEY,
...      count INT,
...      damages FLOAT)''')
<sqlalchemy.engine.result.ResultProxy object at 0x1017efb10>

Running conn.execute() returns a SQLAlchemy object called a ResultProxy. You’ll soon see what to do with it.

By the way, if you’ve never made a database table before, congratulations. Check that one off your bucket list.


Now, insert three sets of data into your new empty table:

>>> ins = 'INSERT INTO zoo (critter, count, damages) VALUES (?, ?, ?)'
>>> conn.execute(ins, 'duck', 10, 0.0)
<sqlalchemy.engine.result.ResultProxy object at 0x1017efb50>
>>> conn.execute(ins, 'bear', 2, 1000.0)
<sqlalchemy.engine.result.ResultProxy object at 0x1017ef090>
>>> conn.execute(ins, 'weasel', 1, 2000.0)
<sqlalchemy.engine.result.ResultProxy object at 0x1017ef450>

Next, ask the database for everything that we just put in:

>>> rows = conn.execute('SELECT * FROM zoo')

In SQLAlchemy, rows is not a list; it’s that special ResultProxy thing that we can’t print directly:

>>> print(rows)
<sqlalchemy.engine.result.ResultProxy object at 0x1017ef9d0>

However, you can iterate over it like a list, so we can get a row at a time:

>>> for row in rows:
...     print(row)
...
('duck', 10, 0.0)
('bear', 2, 1000.0)
('weasel', 1, 2000.0)


That was almost the same as the SQLite DB-API example that you saw earlier. The one advantage is that we didn’t need to import the database driver at the top; SQLAlchemy figured that out from the connection string. Just changing the connection string would make this code portable to another type of database. Another plus is SQLAlchemy’s connection pooling, which you can read about at its documentation site.

——————————————

yingshao xo:
I have never seen such an interesting world like programming. That's why I want to became a programmer.

——————————————

Relational Databases(6)


SQLAlchemy

SQL is not quite the same for all relational databases, and DB-API takes you only so far. Each database implements a particular dialect reflecting its features and philosophy. Many libraries try to bridge these differences in one way or another. The most popular cross-database Python library is SQLAlchemy.

It isn’t in the standard library, but it’s well known and used by many people. You can install it on your system by using this command:

$ pip install sqlalchemy


You can use SQLAlchemy on several levels:
The lowest level handles database connection pools, executing SQL commands, and returning results. This is closest to the DB-API.

Next up is the SQL expression language, a Pythonic SQL builder.

Highest is the ORM (Object Relational Model) layer, which uses the SQL Expression Language and binds application code with relational data structures.

As we go along, you’ll understand what the terms mean in those levels. SQLAlchemy works with the database drivers documented in the previous sections. You don’t need to import the driver; the initial connection string you provide to SQLAlchemy will determine it. That string looks like this:

dialect + driver :// user : password @ host : port / dbname


The values you put in this string are as follows:

dialect 
The database type

driver 
The particular driver you want to use for that database

user and password 
Your database authentication strings

host and port 
The database server’s location (: port is only needed if it’s not the standard one for this server)

dbname 
The database to initially connect to on the server

——————————————

#排列2,6,4,8,10,12,89,68,45,37


num_str = '2,6,4,8,10,12,89,68,45,37'

raw_items = [int(num) for num in num_str.split(',')]
print('Raw items:', str(raw_items))

ascending_items = sorted(raw_items)
print('Ascending items:', str(ascending_items))

——————————————

//用冒泡算法排列2,6,4,8,10,12,89,68,45,37。

//要求：使用指针


#include <iostream>

#include <iomanip> 

using namespace std;

void bubbleSort(int*,const int);

int main()

{

    const int arraySize = 10;

    int a[arraySize] = {2,6,4,8,10,12,89,68,45,37};

    int i;

    cout << "Data items in original order.\n";

    for (i = 0 ; i < arraySize ; i++)

        cout << setw(4) << a[i];

    bubbleSort(a,arraySize);

    cout << endl << "Data items in ascending order.\n";

    for (i = 0 ; i < arraySize ; i++)

        cout << setw(4) << a[i];

    cout << endl;

    return 0;

}

void bubbleSort(int* array,const int size)

{

    void swap (int*,int*);

    for (int pass = 0 ; pass < size - 1 ; pass++)

        for (int j = 0 ; j < size - 1 ; j++)

            if (array[j] > array[j + 1])

                swap(&array[j],&array[j+1]);

}

void swap (int* a,int* b)

{

    int hold  = *a;

    *a = *b;

    *b = hold;

}

——————————————

Relational Databases(5)


MySQL

MySQL is a very popular open source relational database. Unlike SQLite, it’s an actual server, so clients can access it from different devices across the network.
MysqlDB has been the most popular MySQL driver, but it has not yet been ported to Python 3. 


PostgreSQL

PostgreSQL is a full-featured open source relational database, in many ways more advanced than MySQL.

The most popular driver is psycopg2, but its installation requires the PostgreSQL client libraries.

——————————————

Relational Databases(4)


SQLite

SQLite is a good, light, open source relational database. It’s implemented as a standard Python library, and stores databases in normal files. These files are portable across machines and operating systems, making SQLite a very portable solution for simple relational database applications. It isn’t as full-featured as MySQL or PostgreSQL, but it does support SQL, and it manages multiple simultaneous users. Web browsers, smart phones, and other applications use SQLite as an embedded database.

You begin with a connect() to the local SQLite database file that you want to use or create. This file is the equivalent of the directory-like database that parents tables in other servers. The special string ':memory:' creates the database in memory only; this is fast and useful for testing but will lose data when your program terminates or if your computer goes down.

For the next example, let’s make a database called enterprise.db and the table zoo to manage our thriving roadside petting zoo business. The table columns are as follows:

critter 
A variable length string, and our primary key

count 
An integer count of our current inventory for this animal

damages 
The dollar amount of our current losses from animal-human interactions


>>> import sqlite3
>>> conn = sqlite3.connect('enterprise.db')
>>> curs = conn.cursor()
>>> curs.execute('''CREATE TABLE zoo
    (critter VARCHAR(20) PRIMARY KEY,
     count INT,
     damages FLOAT)''')
<sqlite3.Cursor object at 0x1006a22d0>

Python’s triple quotes are handy when creating long strings such as SQL queries.

Now, add some animals to the zoo:

>>> curs.execute('INSERT INTO zoo VALUES("duck", 5, 0.0)')
<sqlite3.Cursor object at 0x1006a22d0>
>>> curs.execute('INSERT INTO zoo VALUES("bear", 2, 1000.0)')
<sqlite3.Cursor object at 0x1006a22d0>

There’s a safer way to insert data, using a placeholder:

>>> ins = 'INSERT INTO zoo (critter, count, damages) VALUES(?, ?, ?)'
>>> curs.execute(ins, ('weasel', 1, 2000.0))
<sqlite3.Cursor object at 0x1006a22d0>


This time, we used three question marks in the SQL to indicate that we plan to insert three values, and then pass those three values as a list to the execute() function. Placeholders handle tedious details such as quoting. They protect you against SQL injection—a kind of external attack that is common on the Web that inserts malicious SQL commands into the system.

Now, let’s see if we can get all our animals out again:

>>> curs.execute('SELECT * FROM zoo')
<sqlite3.Cursor object at 0x1006a22d0>
>>> rows = curs.fetchall()
>>> print(rows)
[('duck', 5, 0.0), ('bear', 2, 1000.0), ('weasel', 1, 2000.0)]

Let’s get them again, but ordered by their counts:

>>> curs.execute('SELECT * from zoo ORDER BY count')
<sqlite3.Cursor object at 0x1006a22d0>
>>> curs.fetchall()
[('weasel', 1, 2000.0), ('bear', 2, 1000.0), ('duck', 5, 0.0)]

Hey, we wanted them in descending order:

>>> curs.execute('SELECT * from zoo ORDER BY count DESC')
<sqlite3.Cursor object at 0x1006a22d0>
>>> curs.fetchall()
[('duck', 5, 0.0), ('bear', 2, 1000.0), ('weasel', 1, 2000.0)]

Which type of animal is costing us the most?

>>> curs.execute('''SELECT * FROM zoo WHERE
...     damages = (SELECT MAX(damages) FROM zoo)''')
<sqlite3.Cursor object at 0x1006a22d0>
>>> curs.fetchall()
[('weasel', 1, 2000.0)]


You would have thought it was the bears. It’s always best to check the actual data.
Before we leave SQLite, we need to clean up. If we opened a connection and a cursor, we need to close them when we’re done:

>>> curs.close()
>>> conn.close()

——————————————

Relational Databases(2)


SQL

SQL is not an API or a protocol, but a declarative language: you say what you want rather than how to do it. It’s the universal language of relational databases. SQL queries are text strings, that a client sends to the database server, which figures out what to do with them.

There have been various SQL standard definitions, but all database vendors have added their own tweaks and extensions, resulting in many SQL dialects. If you store your data in a relational database, SQL gives you some portability. Still, dialect and operational differences can make it difficult to move your data to another type of database.


There are two main categories of SQL statements:

DDL (data definition language) Handles creation, deletion, constraints, and permissions for tables, databases, and uses 

DML (data manipulation language) Handles data insertions, selects, updates, and deletions


For more information, please search by yourself.

——————————————

Relational Databases(1)


Relational databases are only about 40 years old but are ubiquitous in the computing world. You’ll almost certainly have to deal with them at one time or another. When you do, you’ll appreciate what they provide:

Access to data by multiple simultaneous users

Protection from corruption by those users

Efficient methods to store and retrieve the data

Data defined by schemas and limited by constraints

Joins to find relationships across diverse types of data

A declarative (rather than imperative) query language: SQL (Structured Query Language)


These are called relational because they show relationships among different kinds of data in the form of tables (as they are usually called nowadays). For instance, in our menu example earlier, there is a relationship between each item and its price.

A table is a grid of rows and columns, similar to a spreadsheet. To create a table, name it and specify the order, names, and types of its columns. Each row has the same columns, although a column may be defined to allow missing data (called nulls). In the menu example, you could create a table with one row for each item being sold. Each item has the same columns, including one for the price.

A column or group of columns is usually the table’s primary key; its values must be unique in the table. This prevents adding the same data to the table more than once. This key is indexed for fast lookups during queries. An index works a little like a book index, making it fast to find a particular row.
Each table lives within a parent database, like a file within a directory. Two levels of hierarchy help keep things organized a little better.


Note

Yes, the word database is used in multiple ways: as the server, the table container, and the data stored therein. If you’ll be referring to all of them at the same time, it might help to call them database server, database, and data.


If you want to find rows by some non-key column value, define a secondary index on that column. Otherwise, the database server must perform a table scan—a brute-force search of every row for matching column values.

Tables can be related to each other with foreign keys, and column values can be constrained to these keys.

——————————————

Structured Binary Files


Some file formats were designed to store particular data structures but are neither relational nor NoSQL databases. The sections that follow present some of them.


Spreadsheets

Spreadsheets, notably Microsoft Excel, are widespread binary data formats. If you can save your spreadsheet to a CSV file, you can read it by using the standard csv module that was described earlier. If you have a binary xls file, xlrd is a third-party package for reading and writing.


HDF5

HDF5 is a binary data format for multidimensional or hierarchical numeric data. It’s used mainly in science, where fast random access to large datasets (gigabytes to terabytes) is a common requirement. Even though HDF5 could be a good alternative to databases in some cases, for some reason HDF5 is almost unknown in the business world. It’s best suited to WORM (write once/read many) applications for which database protection against conflicting writes is not needed. Here are a couple of modules that you might find useful:

h5py is a full-featured low-level interface. Read the documentation and code.

PyTables is a bit higher-level, with database-like features. Read the documentation and code.


Both of these are discussed in terms of scientific applications of Python in Appendix C. I’m mentioning HDF5 here in case you have a need to store and retrieve large amounts of data and are willing to consider something outside the box, as well as the usual database solutions. A good example is the Million Song dataset, which has downloadable song data in HDF5 format.

——————————————

获取目录下test.txt的文件长度


#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    fstream File;
    File.open("test.txt");
    int length = 0;
    char ch;
    File.get(ch);
    while (File.eof() == false)
    {
        length++;
        File.get(ch);
    }
    cout << "共有" << length << "个字符.\n";
    return 0;
}

——————————————

Serialize by Using pickle


Saving data structures to a file is called serializing. Formats such as JSON might require some custom converters to serialize all the data types from a Python program. Python provides the pickle module to save and restore any object in a special binary format.

Remember how JSON lost its mind when encountering a datetime object? Not a problem for pickle:

>>> import pickle
>>> import datetime
>>> now1 = datetime.datetime.utcnow()
>>> pickled = pickle.dumps(now1)
>>> now2 = pickle.loads(pickled)
>>> now1
datetime.datetime(2014, 6, 22, 23, 24, 19, 195722)
>>> now2
datetime.datetime(2014, 6, 22, 23, 24, 19, 195722)


pickle works with your own classes and objects, too. We’ll define a little class called Tiny that returns the string 'tiny' when treated as a string:

>>> import pickle
>>> class Tiny():
...     def __str__(self):
...        return 'tiny'
...
>>> obj1 = Tiny()
>>> obj1
<__main__.Tiny object at 0x10076ed10>
>>> str(obj1)
'tiny'
>>> pickled = pickle.dumps(obj1)
>>> pickled
b'\x80\x03c__main__\nTiny\nq\x00)\x81q\x01.'
>>> obj2 = pickle.loads(pickled)
>>> obj2
<__main__.Tiny object at 0x10076e550>
>>> str(obj2)
'tiny'

pickled is the pickled binary string made from the object obj1. We converted that back to the object obj2 to make a copy of obj1. Use dump() to pickle to a file, and load() to unpickle from one.


Note

Because pickle can create Python objects, the same security warnings that were discussed in earlier sections apply. Don’t unpickle something that you don’t trust.

——————————————

Other Interchange Formats


These binary data interchange formats are usually more compact and faster than XML or JSON:

MsgPack
Protocol Buffers
Avro
Thrift

Because they are binary, none can be easily edited by a human with a text editor.

——————————————

Configuration Files


Most programs offer various options or settings. Dynamic ones can be provided as program arguments, but long-lasting ones need to be kept somewhere. The temptation to define your own quick and dirty config file format is strong—but resist it. It often turns out to be dirty, but not so quick. You need to maintain both the writer program and the reader program (sometimes called a parser). There are good alternatives that you can just drop into your program, including those in the previous sections.

Here, we’ll use the standard configparser module, which handles Windows-style .ini files. Such files have sections of key = value definitions. Here’s a minimal settings.cfg file:

[english]
greeting = Hello

[french]
greeting = Bonjour

[files]
home = /usr/local
# simple interpolation:
bin = %(home)s/bin


Here’s the code to read it into Python data structures:

>>> import configparser
>>> cfg = configparser.ConfigParser()
>>> cfg.read('settings.cfg')
['settings.cfg']
>>> cfg
<configparser.ConfigParser object at 0x1006be4d0>
>>> cfg['french']
<Section: french>
>>> cfg['french']['greeting']
'Bonjour'
>>> cfg['files']['bin']
'/usr/local/bin'

Other options are available, including fancier interpolation. See the configparser documentation. If you need deeper nesting than two levels, try YAML or JSON.

——————————————

If you want to become a great programmer, reading 10.000 pages and coding 100.000 lines of code is essential.

——————————————

A Security Note


You can use all the formats described in this chapter to save objects to files and read them back again. It’s possible to exploit this process and cause security problems.

For example, the following XML snippet from the billion laughs Wikipedia page defines ten nested entities, each expanding the lower level ten times for a total expansion of one billion:

<?xml version="1.0"?>
<!DOCTYPE lolz [
 <!ENTITY lol "lol">
 <!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
<!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;">
 <!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
 <!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
 <!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;">
 <!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;">
 <!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;">
 <!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;">
 <!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">
]>
<lolz>&lol9;</lolz>


The bad news: billion laughs would blow up all of the XML libraries mentioned in the previous sections. Defused XML lists this attack and others, along with the vulnerability of Python libraries. The link shows how to change the settings for many of the libraries to avoid these problems. Also, you can use the defusedxml library as a security frontend for the other libraries:

>>> # insecure:
>>> from xml.etree.ElementTree import parse
>>> et = parse(xmlfile)
>>> # protected:
>>> from defusedxml.ElementTree import parse
>>> et = parse(xmlfile)

——————————————

——————————————

third-party library
第三方库


manipulate
操作；处理


YAML
一个可读性高，用来表达资料序列的格式

——————————————

YAML


Similar to JSON, YAML has keys and values, but handles more data types such as dates and times. The standard Python library does not yet include YAML handling, so you need to install a third-party library named yaml to manipulate it. load() converts a YAML string to Python data, whereas dump() does the opposite.

The following YAML file, mcintyre.yaml, contains information on the Canadian poet James McIntyre, including two of his poems:

name:
  first: James
  last: McIntyre
dates:
  birth: 1828-05-25
  death: 1906-03-31
details:
  bearded: true
  themes: [cheese, Canada]
books:
  url: http://www.gutenberg.org/files/36068/36068-h/36068-h.htm
poems:
  - title: 'Motto'
    text: |
      Politeness, perseverance and pluck,
      To their possessor will bring good luck.
  - title: 'Canadian Charms'
    text: |
      Here industry is not in vain,
      For we have bounteous crops of grain,
      And you behold on every field
      Of grass and roots abundant yield,
      But after all the greatest charm
      Is the snug home upon the farm,
      And stone walls now keep cattle warm.


Values such as true, false, on, and off are converted to Python Booleans. Integers and strings are converted to their Python equivalents. Other syntax creates lists and dictionaries:

>>> import yaml
>>> with open('mcintyre.yaml', 'rt') as fin:
>>>     text = fin.read()
>>> data = yaml.load(text)
>>> data['details']
{'themes': ['cheese', 'Canada'], 'bearded': True}
>>> len(data['poems'])
2

The data structures that are created match those in the YAML file, which in this case are more than one level deep in places. You can get the title of the second poem with this dict/list/dict reference:

>>> data['poems'][1]['title']
'Canadian Charms'


Warning

PyYAML can load Python objects from strings, and this is dangerous. Use safe_load() instead of load() if you’re importing YAML that you don’t trust. Better yet, always use safe_load(). Read war is peace for a description of how unprotected YAML loading compromised the Ruby on Rails platform.

——————————————

——————————————

JSON(2)


You might get an exception while trying to encode or decode some objects, including objects such as datetime (covered in detail in Calendars and Clocks), as demonstrated here.

>>> import datetime
>>> now = datetime.datetime.utcnow()
>>> now
datetime.datetime(2013, 2, 22, 3, 49, 27, 483336)
>>> json.dumps(now)
Traceback (most recent call last):
# ... (deleted stack trace to save trees)
TypeError: datetime.datetime(2013, 2, 22, 3, 49, 27, 483336) is not JSON serializable
>>>

This can happen because the JSON standard does not define date or time types; it expects you to define how to handle them. You could convert the datetime to something JSON understands, such as a string or an epoch value (coming in Chapter 10):

>>> now_str = str(now)
>>> json.dumps(now_str)
'"2013-02-22 03:49:27.483336"'
>>> from time import mktime
>>> now_epoch = int(mktime(now.timetuple()))
>>> json.dumps(now_epoch)
'1361526567'


If the datetime value could occur in the middle of normally converted data types, it might be annoying to make these special conversions. You can modify how JSON is encoded by using inheritance, which is described in Inheritance. Python’s JSON documentation gives an example of this for complex numbers, which also makes JSON play dead. Let’s modify it for datetime:

>>> class DTEncoder(json.JSONEncoder):
...     def default(self, obj):
...         # isinstance() checks the type of obj
...         if isinstance(obj, datetime.datetime):
...             return int(mktime(obj.timetuple()))
...         # else it's something the normal decoder knows:
...         return json.JSONEncoder.default(self, obj)
...
>>> json.dumps(now, cls=DTEncoder)
'1361526567'

The new class DTEncoder is a subclass, or child class, of JSONEncoder. We only need to override its default() method to add datetime handling. Inheritance ensures that everything else will be handled by the parent class.

The isinstance() function checks whether the object obj is of the class datetime.datetime. Because everything in Python is an object, isinstance() works everywhere:

>>> type(now)
<class 'datetime.datetime'>
>>> isinstance(now, datetime.datetime)
True
>>> type(234)
<class 'int'>
>>> isinstance(234, int)
True
>>> type('hey')
<class 'str'>
>>> isinstance('hey', str)
True


Note

For JSON and other structured text formats, you can load from a file into data structures without knowing anything about the structures ahead of time. Then, you can walk through the structures by using isinstance() and type-appropriate methods to examine their values. For example, if one of the items is a dictionary, you can extract contents through keys(), values(), and items().

——————————————

JSON(1)


JavaScript Object Notation (JSON) has become a very popular data interchange format, beyond its JavaScript origins. The JSON format is a subset of JavaScript, and often legal Python syntax as well. Its close fit to Python makes it a good choice for data interchange among programs. You’ll see many examples of JSON for web development in Chapter 9.

Unlike the variety of XML modules, there’s one main JSON module, with the unforgettable name json. This program encodes (dumps) data to a JSON string and decodes (loads) a JSON string back to data. In this next example, let’s build a Python data structure containing the data from the earlier XML example:

>>> menu = \
... {
... "breakfast": {
...         "hours": "7-11",
...         "items": {
...                 "breakfast burritos": "$6.00",
...                 "pancakes": "$4.00"
...                 }
...         },
... "lunch" : {
...         "hours": "11-3",
...         "items": {
...                 "hamburger": "$5.00"
...                 }
...         },
... "dinner": {
...         "hours": "3-10",
...         "items": {
...                 "spaghetti": "$8.00"
...                 }
...         }
... }
.


Next, encode the data structure (menu) to a JSON string (menu_json) by using dumps():

>>> import json
>>> menu_json = json.dumps(menu)
>>> menu_json
'{"dinner": {"items": {"spaghetti": "$8.00"}, "hours": "3-10"},
"lunch": {"items": {"hamburger": "$5.00"}, "hours": "11-3"},
"breakfast": {"items": {"breakfast burritos"
: "$6.00", "pancakes":
"$4.00"}, "hours": "7-11"}}'


And now, let’s turn the JSON string menu_json back into a Python data structure (menu2) by using loads():

>>> menu2 = json.loads(menu_json)
>>> menu2
{'breakfast': {'items': {'breakfast burritos': '$6.00', 'pancakes':
'$4.00'}, 'hours': '7-11'}, 'lunch': {'items': {'hamburger': '$5.00'},
'hours': '11-3'}, 'dinner': {'items': {'spaghetti': '$8.00'}, 'hours': '3-10'}}

menu and menu2 are both dictionaries with the same keys and values. As always with standard dictionaries, the order in which you get the keys varies.

——————————————

Enormous
巨大的；大量的

——————————————

HTML


Enormous amounts of data are saved as Hypertext Markup Language (HTML), the basic document format of the Web. The problem is so much of it doesn’t follow the HTML rules, which can make it difficult to parse. Also, much of HTML is intended more to format output than interchange data. Because this chapter is intended to describe fairly well-defined data formats, I have separated out the discussion about HTML to Chapter 9.

——————————————

XML(2)


XML is often used for data feeds and messages, and has subformats like RSS and Atom. Some industries have many specialized XML formats, such as the finance field.

XML’s über-flexibility has inspired multiple Python libraries that differ in approach and capabilities.


The simplest way to parse XML in Python is by using ElementTree. Here’s a little program to parse the menu.xml file and print some tags and attributes:

>>>import xml.etree.ElementTreeaset
>>>tree=et.ElementTree(file='menu.xml')
>>>root=tree.getroot()
>>>root.tag
'menu'
>>>for child in root:
...    print('tag:',child.tag,'attributes:',child.attrib)
...        for grandchild in child:
...            print('\ttag:',grandchild.tag,'attributes:',grandchild.attrib)
...
tag: breakfast attributes:{'hours':'7-11'}
tag: item attributes:{'price':'$6.00'}
tag: item attributes:{'price':'$4.00'}
tag: lunch attributes:{'hours':'11-3'}
tag: item attributes:{'price':'$5.00'}
tag: dinner attributes:{'hours':'3-10'}
tag: item attributes:{'price':'8.00'}
>>>len(root)# number of menu sections
3
>>>len(root[0])# number of breakfast items
2


For each element in the nested lists, tag is the tag string and attrib is a dictionary of its attributes. ElementTree has many other ways of searching XML-derived data, modifying it, and even writing XML files. The ElementTree documentation has the details.
Other standard Python XML libraries include:

xml.dom 

The Document Object Model (DOM), familiar to JavaScript developers, represents Web documents as hierarchical structures. This module loads the entire XML file into memory and lets you access all the pieces equally. 


xml.sax 

Simple API for XML, or SAX, parses XML on the fly, so it does not have to load everything into memory at once. Therefore, it can be a good choice if you need to process very large streams of XML.

——————————————

XML(1)


Delimited files convey only two dimensions: rows (lines) and columns (fields within a line). If you want to exchange data structures among programs, you need a way to encode hierarchies, sequences, sets, and other structures as text.

XML is the most prominent markup format that suits the bill. It uses tags to delimit data, as in this sample menu.xml file:

<?xml version="1.0"?>
<menu>
  <breakfast hours="7-11">
<item price="$6.00">breakfast burritos</item>
<item price="$4.00">pancakes</item>
  </breakfast>
  <lunch hours="11-3">
<item price="$5.00">hamburger</item>
  </lunch>
  <dinner hours="3-10">
<item price="8.00">spaghetti</item>
  </dinner>
</menu>


Following are a few important characteristics of XML:

• Tags begin with a < character. The tags in this sample were menu, breakfast, lunch, dinner, and item. 

• Whitespace is ignored. 

• Usually a start tag such as <menu> is followed by other content and then a final matching end tag such as </menu>. 

• Tags can nest within other tags to any level. In this example, item tags are children of the breakfast, lunch, and dinner tags; they, in turn, are children of menu. 

• Optional attributes can occur within the start tag. In this example, price is an attribute of item. 

• Tags can contain values. In this example, each item has a value, such as pancakes for the second breakfast item. 

• If a tag named thing has no values or children, it can be expressed as the single tag by including a forward slash just before the closing angle bracket, such as <thing/>, rather than a start and end tag, like <thing></thing>. 

• The choice of where to put data—attributes, values, child tags—is somewhat arbitrary. For instance, we could have written the last item tag as <item price="$8.00" food="spaghetti"/>.

——————————————

hierarchy
层级；阶层；层次结构


prominent
重要的; 突出的; 卓越的


derive
导出；派生；衍生

——————————————

CSV


Delimited files are often used as an exchange format for spreadsheets and databases. You could read CSV files manually, a line at a time, splitting each line into fields at comma separators, and adding the results to data structures such as lists and dictionaries. But it’s better to use the standard csv module, because parsing these files can get more complicated than you think.

• Some have alternate delimiters besides a comma: '|' and '\t' (tab) are common. 

• Some have escape sequences. If the delimiter character can occur within a field, the entire field might be surrounded by quote characters or preceded by some escape character. 

• Files have different line-ending characters. Unix uses '\n', Microsoft uses '\r\n', and Apple used to use '\r' but now uses '\n'. 

• There can be column names in the first line. 


First, we’ll see how to read and write a list of rows, each containing a list of columns:

>>>import csv
>>>villains=[
...    ['Doctor','No'],
...    ['Rosa','Klebb'],
...    ['Mister','Big'],
...    ['Auric','Goldfinger'],
...    ['Ernst','Blofeld'],
...    ]
>>>with open('villains','wt') as fout:# a context manager
...    csvout=csv.writer(fout)
...    csvout.writerows(villains)

This creates the file villains with these lines:

Doctor,No
Rosa,Klebb
Mister,Big
Auric,Goldfinger
Ernst,Blofeld


Now, we’ll try to read it back in:

>>>import csv
>>>with open('villains','rt') as fin:# context manager
...    cin=csv.reader(fin)
...    villains=[row for row in cin]# This uses a list comprehension
...
>>>print(villains)
[['Doctor','No'],['Rosa','Klebb'],['Mister','Big'],
['Auric','Goldfinger'],['Ernst','Blofeld']]

Take a moment to think about list comprehensions (To feel better you can go back to see comprehension syntax). We took advantage of the structure created by the reader() function. It obligingly created rows in the cin object that we can extract in a for loop.

Using reader() and writer() with their default options, the columns are separated by commas and the rows by line feeds.


The data can be a list of dictionaries rather than a list of lists. Let’s read the villains file again, this time using the new DictReader() function and specifying the column names:

>>>import csv
>>>with open('villains','rt') as fin:
...    cin=csv.DictReader(fin,fieldnames=['first','last'])
...    villains=[row for row in cin]
...
>>>print(villains)
[{'last':'No','first':'Doctor'},
{'last':'Klebb','first':'Rosa'},
{'last':'Big','first':'Mister'},
{'last':'Goldfinger','first':'Auric'},
{'last':'Blofeld','first':'Ernst'}]


Let’s rewrite the CSV file by using the new DictWriter() function. We’ll also call writeheader() to write an initial line of column names to the CSV file:

import csv
villains=[
{'first':'Doctor','last':'No'},
{'first':'Rosa','last':'Klebb'},
{'first':'Mister','last':'Big'},
{'first':'Auric','last':'Goldfinger'},
{'first':'Ernst','last':'Blofeld'},
]
with open('villains','wt') as fout:
cout=csv.DictWriter(fout,['first','last'])
cout.writeheader()
cout.writerows(villains)

That creates a villains file with a header line:

first,last
Doctor,No
Rosa,Klebb
Mister,Big
Auric,Goldfinger
Ernst,Blofeld


Now we’ll read it back. By omitting the fieldnames argument in the DictReader() call, we instruct it to use the values in the first line of the file (first,last) as column labels and matching dictionary keys:

>>>import csv
>>>with open('villains','rt') as fin:
...    cin=csv.DictReader(fin)
...    villains=[row for row in cin]
...
>>>print(villains)
[{'last':'No','first':'Doctor'},
{'last':'Klebb','first':'Rosa'},
{'last':'Big','first':'Mister'},
{'last':'Goldfinger','first':'Auric'},
{'last':'Blofeld','first':'Ernst'}]

——————————————

CSV
逗号分隔型取值格式（Comma Separated Values，简称CSV），是一种纯文本格式，用来存储数据。

——————————————

columns
纵列


rows
行列


omitting
省略

——————————————

obligingly
亲切地；勤快

——————————————

parsing
v.语法分析
n.分析; 解析

——————————————

Structured Text Files


With simple text files, the only level of organization is the line. Sometimes, you want more structure than that. You might want to save data for your program to use later, or send data to another program.

There are many formats, and here’s how you can distinguish them:

• A separator, or delimiter, character like tab ('\t'), comma (','), or vertical bar ('|'). This is an example of the comma-separated values (CSV) format. 

• '<' and '>' around tags. Examples include XML and HTML. 

• Punctuation. An example is JavaScript Object Notation (JSON). 

• Indentation. An example is YAML (which depending on the source you use means “YAML Ain’t Markup Language;” you’ll need to research that one yourself). 

• Miscellaneous, such as configuration files for programs. 

Each of these structured file formats can be read and written by at least one Python module.

——————————————

Change Position with seek()


As you read and write, Python keeps track of where you are in the file. The tell() function returns your current offset from the beginning of the file, in bytes. The seek() function lets you jump to another byte offset in the file. This means that you don’t have to read every byte in a file to read the last one; you can seek() to the last one and just read one byte.

For this example, use the 256-byte binary file 'bfile' that you wrote earlier:

>>>fin=open('bfile','rb')
>>>fin.tell()
0

Use seek() to one byte before the end of the file:

>>>fin.seek(255)
255

Read until the end of the file:

>>>bdata=fin.read()
>>>len(bdata)
1
>>>bdata[0]
255


seek() also returns the current offset.

You can call seek() with a second argument: seek( offset, origin ):

• If origin is 0 (the default), go offset bytes from the start 
• If origin is 1, go offset bytes from the current position 
• If origin is 2, go offset bytes relative to the end 


These values are also defined in the standard os module:

>>>importos
>>>os.SEEK_SET
0
>>>os.SEEK_CUR
1
>>>os.SEEK_END
2

So, we could have read the last byte in different ways:

>>>fin=open('bfile','rb')

One byte before the end of the file:

>>>fin.seek(-1,2)
255
>>>fin.tell()
255

Read until the end of the file:

>>>bdata=fin.read()
>>>len(bdata)
1
>>>bdata[0]
255


Note

You don’t need to call tell() for seek() to work. I just wanted to show that they both report the same offset.


Here’s an example of seeking from the current position in the file:

>>>fin=open('bfile','rb')

This next example ends up two bytes before the end of the file:

>>>fin.seek(254,0)
254
>>>fin.tell()
254

Now, go forward one byte:

>>>fin.seek(1,1)
255
>>>fin.tell()
255

Finally, read until the end of the file:

>>>bdata=fin.read()
>>>len(bdata)
1
>>>bdata[0]
255

These functions are most useful for binary files. You can use them with text files, but unless the file is ASCII (one byte per character), you would have a hard time calculating offsets. These would depend on the text encoding, and the most popular encoding (UTF-8) uses varying numbers of bytes per character.

——————————————

Close Files Automatically by Using with


If you forget to close a file that you’ve opened, it will be closed by Python after it’s no longer referenced. This means that if you open a file within a function and don’t close it explicitly, it will be closed automatically when the function ends. But you might have opened the file in a long-running function or the main section of the program. The file should be closed to force any remaining writes to be completed.

Python has context managers to clean up things such as open files. You use the form with expression as variable:

>>>with open('relativity','wt') as fout:
...    fout.write(poem)
...

That’s it. After the block of code under the context manager (in this case, one line) completes (normally or by a raised exception), the file is closed automatically.

——————————————

Read a Binary File with read()


This one is simple; all you need to do is just open with 'rb':

>>>fin=open('bfile','rb')
>>>bdata=fin.read()
>>>len(bdata)
256
>>>fin.close()

——————————————

Read a Text File with read(), readline(), or readlines()


You can call read() with no arguments to slurp up the entire file at once, as shown in the example that follows. Be careful when doing this with large files; a gigabyte file will consume a gigabyte of memory.

>>>fin=open('relativity','rt')
>>>poem=fin.read()
>>>fin.close()
>>>len(poem)
150

You can provide a maximum character count to limit how much read() returns at one time. Let’s read 100 characters at a time and append each chunk to a poem string to rebuild the original:

>>>poem=''
>>>fin=open('relativity','rt')
>>>chunk=100
>>>while True:
...    fragment=fin.read(chunk)
...    if not fragment:
...        break
...    poem+=fragment
...
>>>fin.close()
>>>len(poem)
150

After you’ve read all the way to the end, further calls to read() will return an empty string (''), which is treated as False in if not fragment. This breaks out of the while True loop.

You can also read the file a line at a time by using readline(). In this next example, we’ll append each line to the poem string to rebuild the original:

>>>poem=''
>>>fin=open('relativity','rt')
>>>while True:
...    line=fin.readline()
...    if not line:
...        break
...    poem+=line
...
>>>fin.close()
>>>len(poem)
150

For a text file, even a blank line has a length of one (the newline character), and is evaluated as True. When the file has been read, readline() (like read()) also returns an empty string, which is also evaluated as False.

The easiest way to read a text file is by using an iterator. This returns one line at a time. It’s similar to the previous example, but with less code:

>>>poem=''
>>>fin=open('relativity','rt')
>>>for line in fin:
...    poem+=line
...
>>>fin.close()
>>>len(poem)
150

All of the preceding examples eventually built the single string poem. The readlines() call reads a line at a time, and returns a list of one-line strings:

>>>fin=open('relativity','rt')
>>>lines=fin.readlines()
>>>fin.close()
>>>print(len(lines),'lines read')
5 linesread
>>>for line in lines:
...    print(line,end='')
...
There was a young lady named Bright,
Whose speed was far faster than light;
She started one day
In a relative way,
And returned on the previous night.>>>

We told print() to suppress the automatic newlines because the first four lines already had them. The last line did not, causing the interactive prompt >>> to occur right after the last line.

——————————————

Write a Text File with write()


For some reason, there aren’t many limericks about special relativity. This one will just have to do for our data source:

>>>poem='''There was a young lady named Bright,
... Whose speed was far faster than light;
... She started one day
... In a relative way,
... And returned on the previous night.'''
>>>len(poem)
150

The following code writes the entire poem to the file 'relativity' in one call:

>>>fout=open('relativity','wt')
>>>fout.write(poem)
150
>>>fout.close()

The write() function returns the number of bytes written. It does not add any spaces or newlines, as print() does. You can also print() to a text file:

>>>fout=open('relativity','wt')
>>>print(poem,file=fout)
>>>fout.close()

This brings up the question: should I use write() or print()? By default, print() adds a space after each argument and a newline at the end. In the previous example, it appended a newline to the relativity file. To make print() work like write(), pass the following two arguments:

• sep (separator, which defaults to a space, ' ') 
• end (end string, which defaults to a newline, '\n') 

print() uses the defaults unless you pass something else. We’ll pass empty strings to suppress all of the fussiness normally added by print():

>>>fout=open('relativity','wt')
>>>print(poem,file=fout,sep='',end='')
>>>fout.close()


If you have a large source string, you can also write chunks until the source is done:

>>>fout=open('relativity','wt')
>>>size=len(poem)
>>>offset=0
>>>chunk=100
>>>whileTrue:
...if offset>size:
...    break
...fout.write(poem[offset:offset+chunk])
...offset+=chunk
...
100
50
>>>fout.close()

This wrote 100 characters on the first try and the last 50 characters on the next.
If the relativity file is precious to us, let’s see if using mode x really protects us from overwriting it:

>>>fout=open('relativity','xt')
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
FileExistsError:[Errno17]Fileexists:'relativity'

You can use this with an exception handler:

>>>try:
...    fout=open('relativity','xt')]
...    fout.write('stomp stomp stomp')
...except FileExistsError:
...    print('relativity already exists! That was a close one.')
...
relativity already exists!That was a close one.

——————————————

File Input/Output


The simplest kind of persistence is a plain old file, sometimes called a flat file. This is just a sequence of bytes stored under a filename. You read from a file into memory and write from memory to a file. Python makes these jobs easy. Its file operations were modeled on the familiar and popular Unix equivalents.


Before reading or writing a file, you need to open it:

fileobj=open(filename,mode)


Here’s a brief explanation of the pieces of this call:

• fileobj is the file object returned by open() 
• filename is the string name of the file 
• mode is a string indicating the file’s type and what you want to do with it 


The first letter of mode indicates the operation:

• r means read. 
• w means write. If the file doesn’t exist, it’s created. If the file does exist, it’s overwritten. 
• x means write, but only if the file does not already exist. 
• a means append (write after the end) if the file exists. 


The second letter of mode is the file’s type:

• t (or nothing) means text. 
• b means binary. 

After opening the file, you call functions to read or write data; these will be shown in the examples that follow.
Last, you need to close the file.
Let’s create a file from a Python string in one program and then read it back in the next.

——————————————

Chapter 8. Data Has to Go Somewhere


An active program accesses data that is stored in Random Access Memory, or RAM. RAM is very fast, but it is expensive and requires a constant supply of power; if the power goes out, all the data in memory is lost. Disk drives are slower than RAM but have more capacity, cost less, and retain data even after someone trips over the power cord. Thus, a huge amount of effort in computer systems has been devoted to making the best tradeoffs between storing data on disk and RAM. As programmers, we need persistence: storing and retrieving data using nonvolatile media such as disks.

This chapter is all about the different flavors of data storage, each optimized for different purposes: flat files, structured files, and databases. File operations other than input and output are covered in Files.

——————————————

7.12. Use unhexlify() to convert this hex string (combined from two strings to fit on a page) to a bytes variable called gif:

'47494638396101000100800000000000ffffff21f9'+
'0401000000002c000000000100010000020144003b'


import binascii
hex_str='47494638396101000100800000000000ffffff21f9'+\
'0401000000002c000000000100010000020144003b'
gif=binascii.unhexlify(hex_str)

——————————————

7.11. Find all the words that contain exactly three vowels in a row.


import re
m = re.findall(r'\b\w*[aeiou]{3}\w*\b', mammoth)
print(m)

——————————————

英语中的元音字母有a,e,i,o,u五个。

——————————————

row
行，排

——————————————

7.10. Find all the words that end with r.


import re
m = re.findall(r'\w*r\b', mammoth)
print(m)

——————————————

7.9 Find all four-letter words that begin with c.


import re
m = re.findall(r'\bc\w{3}\b', mammoth)
print(m)

——————————————

http://docs.oracle.com/javase/8/

——————————————

https://zh.wikipedia.org/wiki/Java

——————————————

7.8 Import the re module to use Python’s regular expression functions. Use re.findall() to print all the words that begin with 'c'.


mammoth='''
We have seen thee, queen of cheese,
Lying quietly at your ease,
Gently fanned by evening breeze,
Thy fair form no flies dare seize.

All gaily dressed soon you'll go
To the great Provincial show,
To be admired by many a beau
In the city of Toronto.

Cows numerous as a swarm of bees,
Or as the leaves upon the trees,
It did require to make thee please,
And stand unrivalled, queen of cheese.

May you not receive a scar as
We have heard that Mr. Harris
Intends to send you off as far as
The great world's show at Paris.

Of the youth beware of these,
For some of them might rudely squeeze
And bite your cheek, then songs or glees
We could not sing, oh! queen of cheese.

We'rt thou suspended from balloon,
You'd cast a shade even at noon,
Folks would think it was the moon
About to fall and crush them soon.
'''
import re
m = re.findall(r'\bc\w*\b', mammoth)
print(m)

——————————————

7.6. Make a dictionary called response with values for the string keys 'salutation', 'name', 'product', 'verbed' (past tense verb), 'room', 'animals', 'percent', 'spokesman', and 'job_title'. Print letter with the values from response.


letter = '''Dear {salutation} {name},


Thank you for your letter. We are sorry that our {product} {verbed} in your
{room}. Please note that it should never be used in a {room}, especially
near any {animals}.


Send us your receipt and {amount} for shipping and handling. We will send
you another {product} that, in our tests, is {percent}% less likely to
have {verbed}.


Thank you for your support.


Sincerely,
{spokesman}
{job_title}'''
response = {
'salutation':'Colonel',
'name':'Hackenbush',
'product':'duck blind',
'verbed':'imploded',
'room':'conservatory',
'animals':'emus',
'amount':'$1.38',
'percent':'1',
'spokesman':'Edgar Schmeltz',
'job_title':'Licensed Podiatrist'
}

print(letter.format(**response))
#** can from dict get parameters.

——————————————

7.4. Write the following poem by using old-style formatting. Substitute the strings 'roast beef', 'ham', 'head', and 'clam' into this string:

My kitty cat likes %s,
My kitty cat likes %s,
My kitty cat fell on his %s
And now thinks he's a %s.


poem = '''My kitty cat likes %s,
My kitty cat likes %s,
My kitty cat fell on his %s
And now thinks he's a %s.'''%('roast beef','ham','head','clam')
print(poem)

——————————————

7.3. Using UTF-8, decode pop_bytes into the string variable pop_string. Print pop_string. Is pop_string equal to mystery?


mystery = '\U0001f4a9'
pop_bytes = mystery.encode('utf-8')
pop_string = pop_bytes.decode('utf-8')
print(pop_string)
print(pop_string==mystery)

——————————————

7.2. Encode mystery, this time using UTF-8, into the bytes variable pop_bytes. Print pop_bytes.


mystery = '\U0001f4a9'
pop_bytes = mystery.encode('utf-8')
print(pop_bytes)

——————————————

mystery = '\U0001f4a9'
print(mystery)

import unicodedata
name = unicodedata.name(mystery)
print(name)

——————————————

——————————————

——————————————

Things to Do

——————————————

7.1. Create a Unicode string called mystery and assign it the value '\U0001f4a9'. Print mystery. Look up the Unicode name for mystery.

——————————————

Other Binary Data Tools


Some third-party open source packages offer the following, more declarative ways of defining and extracting binary data:

• bitstring 
• construct 
• hachoir 
• binio

——————————————

The struct module:


Using struct, you can convert binary data to and from Python data structures.

——————————————

http://e.jikexueyuan.com/android.html?hmsr=stormzhang_index_word_03.20

——————————————

😂

——————————————

http://www.jianshu.com/collection/ee1275bb82ca

——————————————

原来 python 快速入门什么都是假的

Python 明明是个很大的语言好吗？

——————————————

越来越难，快到看不懂的地步了

——————————————

bytes and bytearray(2)


This next example demonstrates that you can’t change a bytes variable:

>>>the_bytes[1]=127
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
TypeError:'bytes'objectdoesnotsupportitemassignment

But a bytearray variable is mellow and mutable:

>>>the_byte_array=bytearray(blist)
>>>the_byte_array
bytearray(b'\x01\x02\x03\xff')
>>>the_byte_array[1]=127
>>>the_byte_array
bytearray(b'\x01\x7f\x03\xff')

Each of these would create a 256-element result, with values from 0 to 255:

>>>the_bytes=bytes(range(0,256))
>>>the_byte_array=bytearray(range(0,256))

When printing bytes or bytearray data, Python uses \x xx for non-printable bytes and their ASCII equivalents for printable ones (plus some common escape characters, such as \n instead of \x0a). Here’s the printed representation of the_bytes (manually reformatted to show 16 bytes per line):

>>>the_bytes
b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f
\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f
!"#$%&\'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\\]^_
`abcdefghijklmno
pqrstuvwxyz{|}~\x7f
\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f
\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f
\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf
\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf
\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf
\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf
\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef
\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'

This can be confusing, because they’re bytes (teeny integers), not characters.

——————————————

bytes and bytearray


Python 3 introduced the following sequences of eight-bit integers, with possible values from 0 to 255, in two types:

• bytes is immutable, like a tuple of bytes 
• bytearray is mutable, like a list of bytes 
Beginning with a list called blist, this next example creates a bytes variable called the_bytes and a bytearray variable called the_byte_array:

>>blist=[1,2,3,255]
>>>the_bytes=bytes(blist)
>>>the_bytes
b'\x01\x02\x03\xff'
>>>the_byte_array=bytearray(blist)
>>>the_byte_array
bytearray(b'\x01\x02\x03\xff')

——————————————

Binary Data


Text data can be challenging, but binary data can be, well, interesting. You need to know about concepts such as endianness (how your computer’s processor breaks data into bytes) and sign bits for integers. You might need to delve into binary file formats or network packets to extract or even change data. This section will show you the basics of binary data wrangling in Python.

——————————————

——————————————

pattern
式样,模板,模式

metacharacters
元字符

specifiers
量词

——————————————

If you want to know more about regular expressions, please looking for a book named Mastering.Python.Regular.Expressions.

——————————————

——————————————

后台脚本都用上了

——————————————

这家伙似乎没用任何三方库，我以后是要用Flask的。

——————————————

它这个为什么要联网？
而且这个作者的名字还不能改，一改就用不了

——————————————

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''

look from here:
http://local.liaoxuefeng.com:39093/

'''

import sys

def check_version():
    v = sys.version_info
    if v.major == 3 and v.minor >= 4:
        return True
    print('Your current python is %d.%d. Please use Python 3.4.' % (v.major, v.minor))
    return False

if not check_version():
    exit(1)

import os, io, json, subprocess, tempfile
from urllib import parse
from wsgiref.simple_server import make_server

EXEC = sys.executable
PORT = 39093
HOST = 'local.liaoxuefeng.com:%d' % PORT
TEMP = tempfile.mkdtemp(suffix='_py', prefix='learn_python_')
INDEX = 0

def main():
    httpd = make_server('127.0.0.1', PORT, application)
    print('Ready for Python code on port %d...' % PORT)
    httpd.serve_forever()

def get_name():
    global INDEX
    INDEX = INDEX + 1
    return 'test_%d' % INDEX

def write_py(name, code):
    fpath = os.path.join(TEMP, '%s.py' % name)
    with open(fpath, 'w', encoding='utf-8') as f:
        f.write(code)
    print('Code wrote to: %s' % fpath)
    return fpath

def decode(s):
    try:
        return s.decode('utf-8')
    except UnicodeDecodeError:
        return s.decode('gbk')

def application(environ, start_response):
    host = environ.get('HTTP_HOST')
    method = environ.get('REQUEST_METHOD')
    path = environ.get('PATH_INFO')
    if method == 'GET' and path == '/':
        start_response('200 OK', [('Content-Type', 'text/html')])
        return [b'<html><head><title>Learning Python</title></head><body><form method="post" action="/run"><textarea name="code" style="width:90%;height: 600px">print("hello world!")</textarea><p><button type="submit">Run</button></p></form></body></html>']
    if method == 'GET' and path == '/env':
        start_response('200 OK', [('Content-Type', 'text/html')])
        L = [b'<html><head><title>ENV</title></head><body>']
        for k, v in environ.items():
            p = '<p>%s = %s' % (k, str(v))
            L.append(p.encode('utf-8'))
        L.append(b'</html>')
        return L
    if host != HOST or method != 'POST' or path != '/run' or not environ.get('CONTENT_TYPE', '').lower().startswith('application/x-www-form-urlencoded'):
        start_response('400 Bad Request', [('Content-Type', 'application/json')])
        return [b'{"error":"bad_request"}']
    s = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
    qs = parse.parse_qs(s.decode('utf-8'))
    if not 'code' in qs:
        start_response('400 Bad Request', [('Content-Type', 'application/json')])
        return [b'{"error":"invalid_params"}']
    name = qs['name'][0] if 'name' in qs else get_name()
    code = qs['code'][0]
    headers = [('Content-Type', 'application/json')]
    origin = environ.get('HTTP_ORIGIN', '')
    if origin.find('.liaoxuefeng.com') == -1:
        start_response('400 Bad Request', [('Content-Type', 'application/json')])
        return [b'{"error":"invalid_origin"}']
    headers.append(('Access-Control-Allow-Origin', origin))
    start_response('200 OK', headers)
    r = dict()
    try:
        fpath = write_py(name, code)
        print('Execute: %s %s' % (EXEC, fpath))
        r['output'] = decode(subprocess.check_output([EXEC, fpath], stderr=subprocess.STDOUT, timeout=5))
    except subprocess.CalledProcessError as e:
        r = dict(error='Exception', output=decode(e.output))
    except subprocess.TimeoutExpired as e:
        r = dict(error='Timeout', output='执行超时')
    except subprocess.CalledProcessError as e:
        r = dict(error='Error', output='执行错误')
    print('Execute done.')
    return [json.dumps(r).encode('utf-8')]

if __name__ == '__main__':
    main()

——————————————

操了狗的文本老是出编码问题，只能再试试网络接口

——————————————

弄得我要崩溃了

——————————————

SB易语言

——————————————

恩，暂时完成了基于文本的非同步调用

——————————————

But we have local Internet or txt document.

——————————————

在谷歌搜了下，并没有关于调用pythonw.exe的资料，难道这只是为python做的无窗口解释器？

——————————————

😒

——————————————

你这么写和引入模块有什么区别

——————————————

In fact, I would say rubbish, me or that person.😁

——————————————

以前有人做过2.7版的，但我既看不懂也用不来

——————————————

I have no idea about that

——————————————

The problem is, I need return a string to E language.

——————————————

其他语言的程序可以利用这个调用python

——————————————

#OK

import sys
import subprocess

EXEC = sys.executable #local pythonw.exe

def py_run(py_path):
    result = subprocess.run([EXEC, py_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
    if result.returncode == 0:
        return result.stdout
    else:
        return result.returncode #smartctl returned error

print(py_run("C:\\Users\\Administrator\\Desktop\\codes\\Programming\\TRY\\hello.py"))

——————————————

#this is what I got, so pity is the result ugly enough.

import sys
import subprocess
import json

EXEC = sys.executable


def decode(s):
    try:
        return s.decode('utf-8')
    except UnicodeDecodeError:
        return s.decode('gbk')


def py_run(py_path):
    r = dict()
    try:
        print('Executing: %s | %s ...' % (EXEC, py_path))
        r['output'] = decode(subprocess.check_output([EXEC, py_path], stderr=subprocess.STDOUT, timeout=5))
    except subprocess.CalledProcessError as e:
        r = dict(error='Exception', output=decode(e.output))
    except subprocess.TimeoutExpired as e:
        r = dict(error='Timeout', output='执行超时')
    except subprocess.CalledProcessError as e:
        r = dict(error='Error', output='执行错误')
    print('Execute done.\n')
    return [r['output'].encode('utf-8')]

print(py_run("C:\\Users\\Administrator\\Desktop\\codes\\Programming\\TRY\\hello.py"))

——————————————

The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.

——————————————

看了它的代码，除了网络架设没看到我要找的东西，不知道它是怎么调用的Python并返回信息的

——————————————

我想在QQ上做代码编译器，不知道你在说什么，你以前做过的啊😢

——————————————

@MikumoConoHa 

http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432523496782e0946b0f454549c0888d05959b99860f000

这个运行器怎么做？它这个我在本地运行不了

——————————————

Version

——————————————

zd423 vision😅

——————————————

🙈

——————————————

That's the effect about hosts...

——————————————

http://prefiles.com/p8bt8ovqos4y/PP.Mastering.Python.Regular.Expressions.Feb.2014.epub

I can't see any captcha...

——————————————

Examples of Regular Expressions


In this section, I will show you some examples of regex to help you understand the concept further.

Say that you had this regex:

/abder/
This is simply telling us to match the word abder only.

What about this regex?

/a[nr]t/
You can read this regex as follows: find a text pattern such that the first letter is a and the last letter is t, and between those letters comes either n or r. So the matching words are ant and art.

Let me give you a small quiz at this point. How would you write a regular expression that starts with ca, and ends with one or all of the following characters tbr? Yes, this regex can be written as follows:

/ca[tbr]/
If you see a regex that starts with a circumflex accent ^, this means match the string that starts with the string mentioned after ^. So, if you had the regex below, it is matching the string that begins with This.

/^This/
Thus, in the following string:

My name is Abder
This is Abder
This is Tom

Based on the regex /^This/, the following strings will be matched:

This is Abder
This is Tom


What if we wanted to match a string that ends with some string? In this case, we use the dollar sign $. Here is an example:

Abder$
Thus, in the above string (the three lines), the following patterns would be matched using this regex:

My name is Abder
This is Abder


Well, what do you think about this regex?

^[A-Z][a-z]
I know it might seem complex at first glance, but let's go through it piece by piece.

We already saw what a circumflex accent ^ is. It means match a string which starts with some string. [A-Z] refers to the upper case letters. So, if we read this part of the regex: ^[A-Z], it is telling us to match the string which begins with an uppercase letter. The last part, [a-z], means that after finding a string that starts with an uppercase letter, it would be followed by lowercase letters from the alphabet.

So, which of the following strings will be matched using this regex? If you are not sure, you can use Python to figure out.

abder
Abder
ABDER
ABder


Regular expressions are a very broad topic, and those examples are just to give you a feel for what they are and why we use them. 

A nice reference to learn more about regular expressions and see more examples is http://www.rexegg.com/.

——————————————

自然语言处理和数据采集分析全需要它。。。😞

——————————————

接触它三年了，都没搞懂它的大致用法。

——————————————

Now, I feel upset with Regular Expression Syntax.😔

——————————————

but so hard too....

——————————————

sorry, this is what you should learn

https://docs.python.org/3/library/re.html

——————————————

https://docs.python.org/2/library/re.html

fuck, so hard to understand!!!

——————————————

——————————————

总有人会说你不是一个真正的程序员。

看看这些说法吧！

“HTML不是真正的编程语言。”

“如果你不用vi，你就不是真正的程序员。”

“真正的程序员得懂C语言。”

“有些人就是不适合编程。”

“有些人就是学不会。”

“你根本就不是真正的程序员，我才是。”

要我说，编程对于不同的人有不同的含义。同时，编程的含义随着时间的流逝也在变化。

有趣的是，那些能让初学者，甚至是编程老鸟，更快上手，更省事的工具，包，框架等往往会被贴上 “真正的程序员不该使用” 这样的标签。

这种贴标签行为背后是一种恐惧：如果任何人都能称自己为程序员，那这个头衔就将毫无意义。不过，我认为这种闭关自守的行为是有害的。

去用那些让写程序变得容易的工具吧。如果那意味着你用 Stencyl 或者 GameMaker 来写游戏，而不是从零开始写一个新的，没事，只管去做。

如果你第一次尝试编程是从HTML或者Excel宏开始，没事，只管去做。哪个（编程方式）你能坚持下去，你就用哪个。

随着你技术不断提升，你就会发现那些便利工具对你的限制大于对你的帮助。那时，你就会去寻找更强大的编程工具。

但大多数时候，很少有人会看你的代码，或者问你用什么编程工具。你的程序到底好不好用才是真正重要的。

——————————————

曾有一个段子说：一个妹子问一个程序猿如何让一帮不爱说话的程序猿活跃起来，那个程序猿说了一句PHP是最好的语言。。。很多程序猿都喜欢站队，所谓站队就是自己在玩某某语言的时候，就会觉得这个语言很强大，自然而然的就站了队了。

我们的身边充斥着写java的看不上写.net的，写c的看不上一切，node异军突起，python批评ruby垃圾性能，高富帅swift从天而降，PHP是最强语言等等。。。

十二年前，我刚工作的时候，写医疗软件，用VB写界面，用VC写功能封装dll，当时觉得VB，VC太强了，结果现在它们基本都死了。

同样的还有：

我写过Dephi，死了。。

我写过asp，死了。。

我写过塞班，死了。。

我们更应当做的是跳出语言的框框，编程注重的是思想，而非语言。

——————————————

——————————————

shit

——————————————

def OrganizeText(text):
    while (text[0:1] == '\n' or text[0:1] == ' ' or text[0:1] == '　'):#left
        text = text[1😏
    while (text[-1😏 == '\n' or text[-1😏 == ' ' or text[-1😏 == '　'):#right
        text = text[:-1]
    
    return text


def RemoveAllAdditionalLines(text):
    text = text.replace('\n\n', '\n')
    while (text[0:1] == '\n' and text[-1😏 == '\n'):
        text = text[1😏
        text = text[:-1]
    
    return text


print(OrganizeText('''
　　　　　　　　　　　　　　
　　　　　　　　　　　　　
　　　　　　　　　　　　　　　　　

                   
.版本 2

.判断循环首 (取文本左边 (FinalText, 2) ＝ #换行符)
    FinalText ＝ 取文本右边 (FinalText, 取文本长度 (FinalText) － 2)
.判断循环尾 ()
.判断循环首 (取文本右边 (FinalText, 2) ＝ #换行符)
    FinalText ＝ 取文本左边 (FinalText, 取文本长度 (FinalText) － 2)
.判断循环尾 ()
　　　　　　　　　　　　　　
　　　　　　　　　　　　　
　　　　　　　　　　　　　　　　　

                                            
'''))

——————————————

Patterns: using specifiers(2)


First, let’s define our source string:

>>>source='''I wish I may, I wish I might
... Have a dish of fish tonight.'''


First, find wish anywhere:

>>>re.findall('wish',source)
['wish','wish']


Next, find wish or fish anywhere:

>>>re.findall('wish|fish',source)
['wish','wish','fish']


Find wish at the beginning:

>>>re.findall('^wish',source)
[]


Find I wish at the beginning:

>>>re.findall('^I wish',source)
['I wish']


Find fish at the end:

>>>re.findall('fish$',source)
[]


Finally, find fish tonight. at the end:

>>>re.findall('fish tonight.$',source)
['fish tonight.']


The characters ^ and $ are called anchors: ^ anchors the search to the beginning of the search string, and $ anchors it to the end. .$ matches any character at the end of the line, including a period, so that worked. To be more precise, we should escape the dot to match it literally:


>>>re.findall('fish tonight\.$',source)
['fish tonight.']


Begin by finding w or f followed by ish:

>>>re.findall('[wf]ish',source)
['wish','wish','fish']


Find one or more runs of w, s, or h:

>>>re.findall('[wsh]+',source)
['w','sh','w','sh','h','sh','sh','h']


Find ght followed by a non-alphanumeric:

>>>re.findall('ght\W',source)
['ght\n','ght.']


Find I followed by wish:

>>>re.findall('I (?=wish)',source)
['I ','I ']


And last, wish preceded by I:

>>>re.findall('(?<=I) wish',source)
[' wish',' wish']


There are a few cases in which the regular expression pattern rules conflict with the Python string rules. The following pattern should match any word that begins with fish:

>>>re.findall('\bfish',source)
[]

Why doesn’t it? As is discussed in Chapter 2, Python employs a few special escape characters for strings. For example, \b means backspace in strings, but in the mini-language of regular expressions it means the beginning of a word. Avoid the accidental use of escape characters by using Python’s raw strings when you define your regular expression string. Always put an r character before your regular expression pattern string, and Python escape characters will be disabled, as demonstrated here:

>>>re.findall(r'\bfish',source)
['fish']

——————————————

anchor
锚

——————————————

Patterns: using specifiers(1)


Now, let’s make “punctuation pizza,” using the main pattern specifiers for regular expressions, which are presented in Table 7-4.

In the table, expr and the other italicized words mean any valid regular expression.

Table 7-4. Pattern specifiers


Pattern
Matches

abc
literal abc

( expr )
expr

expr1 | expr2
expr1 or expr2

.
any character except \n

^
start of source string

$
end of source string

prev ?
zero or one prev

prev *
zero or more prev, as many as possible

prev *?
zero or more prev, as few as possible

prev +
one or more prev, as many as possible

prev +?
one or more prev, as few as possible

prev { m }
m consecutive prev

prev { m, n }
m to n consecutive prev, as many as possible

prev { m, n }?
m to n consecutive prev, as few as possible

[ abc ]
a or b or c (same as a|b|c)

[^ abc ]
not (a or b or c)

prev (?= next )
prev if followed by next

prev (?! next )
prev if not followed by next

(?<= prev ) next
next if preceded by prev

(?<! prev ) next
next if not preceded by prev

Your eyes might cross permanently when trying to read these examples.

——————————————

Patterns: special characters


Many descriptions of regular expressions start with all the details of how to define them. I think that’s a mistake. Regular expressions are a not-so-little language in their own right, with too many details to fit in your head at once. They use so much punctuation that they look like cartoon characters swearing.

With these expressions (match(), search(), findall(), and sub()) under your belt, let’s get into the details of building them. The patterns you make apply to any of these functions.

You’ve seen the basics:

• Literal matches with any non-special characters 
• Any single character except \n with . 
• Any number (including zero) with * 
• Optional (zero or one) with ? 

First, special characters are shown in Table 7-3:


Table 7-3. Special characters

Pattern
Matches

\d
a single digit
\D
a single non-digit

\w
an alphanumeric character
\W
a non-alphanumeric character

\s
a whitespace character
\S
a non-whitespace character

\b
a word boundary (between a \w and a \W, in either order)
\B
a non-word boundary


The Python string module has predefined string constants that we can use for testing. We’ll use printable, which contains 100 printable ASCII characters, including letters in both cases, digits, space characters, and punctuation:

>>>import string
>>>printable=string.printable
>>>len(printable)
100
>>>printable[0:50]
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN'
>>>printable[50:]
'OPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'

Which characters in printable are digits?

>>>re.findall('\d',printable)
['0','1','2','3','4','5','6','7','8','9']

Which characters are digits, letters, or an underscore?

>>>re.findall('\w',printable)
['0','1','2','3','4','5','6','7','8','9','a','b',
'c','d','e','f','g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X',
'Y','Z','_']

Which are spaces?

>>>re.findall('\s',printable)
[' ','\t','\n','\r','\x0b','\x0c']

Regular expressions are not confined to ASCII. A \d will match whatever Unicode calls a digit, not just ASCII characters '0' through '9'. Let’s add two non-ASCII lowercase letters:

In this test, we’ll throw in the following:

• Three ASCII letters 
• Three punctuation symbols that should not match a \w 
• A Unicode LATIN SMALL LETTER E WITH CIRCUMFLEX (\u00ea) 
• A Unicode LATIN SMALL LETTER E WITH BREVE (\u0115) 

>>>x='abc'+'-/*'+'\u00ea'+'\u0115'

As expected, this pattern found only the letters:

>>>re.findall('\w',x)
['a','b','c','ê','ĕ']

——————————————

——————————————

Replace at matches with sub()


This is like the string replace() method, but for patterns rather than literal strings:

>>>m=re.sub('n','?',source)
>>>m# sub returns a string
'You?g Fra?ke?stei?'

——————————————

sub
替换

——————————————

——————————————

Split at matches with split()


The example that follows shows you how to split a string into a list by a pattern rather than a simple string (as the normal string split() method would do):

>>>m=re.split('n',source)
>>>m# split returns a list
['You','g Fra','ke','stei','']

——————————————

All matches with findall()


The preceding examples looked for one match only. But what if you want to know how many instances of the single-letter string 'n' are in the string?

>>>m=re.findall('n',source)
>>>m# findall returns a list
['n','n','n','n']
>>>print('Found',len(m),'matches')
Found 4 matches

How about 'n' followed by any character?

>>>m=re.findall('n.',source)
>>>m
['ng','nk','ns']

Notice that it did not match that final 'n'. We need to say that the character after 'n' is optional with ?:

>>>m=re.findall('n.?',source)
>>>m
['ng','nk','ns','n']

——————————————

First match with search()


You can use search() to find the pattern 'Frank' anywhere in the source string 'Young Frankenstein', without the need for the .* wildcards:

>>>m=re.search('Frank',source)
>>>if m:# search returns an object
...    print(m.group())
...
Frank

——————————————

wildcard
通配符

——————————————

Exact match with match()


Does the string 'Young Frankenstein' begin with the word 'You'? Here’s some code with comments:

>>>import re
>>>source='Young Frankenstein'
>>>m=re.match('You',source)# match starts at the beginning of source
>>>if m:# match returns an object; do this to see what matched
...    print(m.group())
...
You
>>>m=re.match('^You',source)# start anchor does the same
>>>if m:
...    print(m.group())
...
You

How about 'Frank'?

>>>m=re.match('Frank',source)
>>>if m:
...    print(m.group())
...

This time match() returned nothing and the if did not run the print statement. As I said earlier, match() works only if the pattern is at the beginning of the source. But search() works if the pattern is anywhere:

>>>m=re.search('Frank',source)
>>>if m:
...    print(m.group())
...
Frank

Let’s change the pattern:

>>>m=re.match('.*Frank',source)
>>>if m:# match returns an object
...    print(m.group())
...
YoungFrank

Following is a brief explanation of how our new pattern works:

• . means any single character. 
• * means any number of the preceding thing. Together, .* mean any number of characters (even zero). 
• Frank is the phrase that we wanted to match, somewhere. 

match() returned the string that matched .*Frank: 'Young Frank'.

——————————————

Match with Regular Expressions


Chapter 2 touched on simple string operations. Armed with that introductory information, you’ve probably used simple “wildcard” patterns on the command line, such as ls *.py, which means list all filenames ending in .py.

It’s time to explore more complex pattern matching by using regular expressions. These are provided in the standard module re, which we’ll import. You define a string pattern that you want to match, and the source string to match against. For simple matches, usage looks like this:

result=re.match('You','Young Frankenstein')

Here, 'You' is the pattern and 'Young Frankenstein' is the source—the string you want to check. match() checks whether the source begins with the pattern.

For more complex matches, you can compile your pattern first to speed up the match later:

youpattern=re.compile('You')

Then, you can perform your match against the compiled pattern:

result=youpattern.match('Young Frankenstein')

match() is not the only way to compare the pattern and source. Here are several other methods you can use:

• search() returns the first match, if any. 
• findall() returns a list of all non-overlapping matches, if any. 
• split() splits source at matches with pattern and returns a list of the string pieces. 
• sub() takes another replacement argument, and changes all parts of source that are matched by pattern to replacement.

——————————————

New style formatting with {} and format


Old style formatting is still supported. In Python 2, which will freeze at version 2.7, it will be supported forever. However, new style formatting is recommended if you’re using Python 3.

The simplest usage is demonstrated here:

>>>'{} {} {}'.format(n,f,s)
'42 7.03 string cheese'

Old-style arguments needed to be provided in the order in which their % placeholders appeared in the string. With new-style, you can specify the order:

>>>'{2} {0} {1}'.format(f,s,n)
'42 7.03 string cheese'

The value 0 referred to the first argument, f, whereas 1 referred to the string s, and 2 referred to the last argument, the integer n.
The arguments can be a dictionary or named arguments, and the specifiers can include their names:

>>>'{n} {f} {s}'.format(n=42,f=7.03,s='string cheese')
'42 7.03 string cheese'

In this next example, let’s try combining our three values into a dictionary, which looks like this:

>>>d={'n':42,'f':7.03,'s':'string cheese'}

In the following example, {0} is the entire dictionary, whereas {1} is the string 'other' that follows the dictionary:

>>>'{0[n]} {0[f]} {0[s]} {1}'.format(d,'other')
'42 7.03 string cheese other'

These examples all printed their arguments with default formats. Old-style allows a type specifier after the % in the string, but new-style puts it after a :. First, with positional arguments:

>>>'{0:d} {1:f} {2:s}'.format(n,f,s)
'42 7.030000 string cheese'

In this example, we’ll use the same values, but as named arguments:

>>>'{n:d} {f:f} {s:s}'.format(n=42,f=7.03,s='string cheese')
'42 7.030000 string cheese'

The other options (minimum field width, maximum character width, alignment, and so on) are also supported.

Minimum field width 10, right-aligned (default):

>>>'{0:10d} {1:10f} {2:10s}'.format(n,f,s)
' 42 7.030000 string cheese'

Same as the preceding example, but the > characters make the right-alignment more explicit:

>>>'{0:>10d} {1:>10f} {2:>10s}'.format(n,f,s)
' 42 7.030000 string cheese'

Minimum field width 10, left-aligned:

>>>'{0:<10d} {1:<10f} {2:<10s}'.format(n,f,s)
'42 7.030000 string cheese'

Minimum field width 10, centered:

>>>'{0:^10d} {1:^10f} {2:^10s}'.format(n,f,s)
' 42 7.030000 string cheese'

There is one change from old-style: the precision value (after the decimal point) still means the number of digits after the decimal for floats, and the maximum number of characters for strings, but you can’t use it for integers:

>>>'{0:>10.4d} {1:>10.4f} {2:10.4s}'.format(n,f,s)
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
ValueError:Precisionnotallowedinintegerformatspecifier

>>>'{0:>10d} {1:>10.4f} {2:>10.4s}'.format(n,f,s)
' 42 7.0300 stri'

The final option is the fill character. If you want something other than spaces to pad your output fields, put it right after the :, before any alignment (<, >, ^) or width specifiers:

>>>'{0:!^20s}'.format('BIG SALE')
'!!!!!!BIG SALE!!!!!!'

——————————————

调用users32中的

SetTimer
KillTimer

可实现无界面的时钟周期事件

——————————————

如何能循序渐进的学习某样东西呢？当然是把大任务化小。传统的方法要求我们建立一个数据库，保持进度。然而保证数据库的完整和永不丢失是一个大问题，所以我想到用自然日期间隔来代替。


易语言：
BaseNumber ＝ 到整数 (取时间间隔 (取现行时间 (), [2016年5月17日], 5))


Python：
import datetime

diff = datetime.date.today() - datetime.date(2016, 5, 17)
print(diff.days)

——————————————

Old style with %


The old style of string formatting has the form string % data. Inside the string are interpolation sequences. Table 7-2 illustrates that the very simplest sequence is a % followed by a letter indicating the data type to be formatted.


Table 7-2. Conversion types

%s
string
%d
decimal integer
%x
hex integer
%o
octal integer
%f
decimal float
%e
exponential float
%g
decimal or exponential float
%%
a literal %


Following are some simple examples. First, an integer:

>>>'%s'%42
'42'
>>>'%d'%42
'42'
>>>'%x'%42
'2a'
>>>'%o'%42
'52'

A float:

>>>'%s'%7.03
'7.03'
>>>'%f'%7.03
'7.030000'
>>>'%e'%7.03
'7.030000e+00'
>>>'%g'%7.03
'7.03'

An integer and a literal %:

>>>'%d%%'%100
'100%'

Some string and integer interpolation:

>>>actor='Richard Gere'
>>>cat='Chester'
>>>weight=28


>>>"My wife's favorite actor is %s" %actor
"My wife's favorite actor is Richard Gere"


>>>"Our cat %sweighs %spounds" %(cat,weight)
'Our cat Chester weighs 28 pounds'

That %s inside the string means to interpolate a string. The number of % appearances in the string needs match the number of data items after the %. A single data item such as actor goes right after the %. Multiple data must be grouped into a tuple (bounded by parentheses, separated by commas) such as (cat, weight).

Even though weight is an integer, the %s inside the string converted it to a string.
You can add other values between the % and the type specifier to designate minimum and maximum widths, alignment, and character filling:

For variables, let’s define an integer, n; a float, f; and a string, s:

>>>n=42
>>>f=7.03
>>>s='string cheese'

Format them using default widths:

>>>'%d %f %s' %(n,f,s)
'42 7.030000 string cheese'

Set a minimum field width of 10 characters for each variable, and align them to the right, filling unused spots on the left with spaces:

>>>'%10d %10f %10s' %(n,f,s)
' 42 7.030000 string cheese'

Use the same field width, but align to the left:

>>>'%-10d %-10f %-10s' %(n,f,s)
'42 7.030000 string cheese'

This time, the same field width, but a maximum character width of 4, and aligned to the right. This setting truncates the string, and limits the float to 4 digits after the decimal point:

>>>'%10.4d %10.4f %10.4s' %(n,f,s)
' 0042 7.0300 stri'

The same song as before, but right-aligned:

>>>'%.4d %.4f %.4s' %(n,f,s)
'0042 7.0300 stri'

Finally, get the field widths from arguments rather than hard-coding them:

>>>'%*.*d %*.*f %*.*s' %(10,4,n,10,4,f,10,4,s)
' 0042 7.0300 stri'

——————————————

Decoding


We decode byte strings to Unicode strings. Whenever we get text from some external source (files, databases, websites, network APIs, and so on), it’s encoded as byte strings. The tricky part is knowing which encoding was actually used, so we can run it backward and get Unicode strings.

The problem is that nothing in the byte string itself says what encoding was used. I mentioned the perils of copying and pasting from websites earlier. You’ve probably visited websites with odd characters where plain old ASCII characters should be.

Let’s create a Unicode string called place with the value 'café':

>>>place='caf\u00e9'
>>>place
'café'
>>>type(place)
<class'str'>

Encode it in UTF-8 format in a bytes variable called place_bytes:

>>>place_bytes=place.encode('utf-8')
>>>place_bytes
b'caf\xc3\xa9'
>>>type(place_bytes)
<class'bytes'>

Notice that place_bytes has five bytes. The first three are the same as ASCII (a strength of UTF-8), and the final two encode the 'é'. Now, let’s decode that byte string back to a Unicode string:

>>>place2=place_bytes.decode('utf-8')
>>>place2
'café'

This worked because we encoded to UTF-8 and decoded from UTF-8. What if we told it to decode from some other encoding?

>>>place3=place_bytes.decode('ascii')
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
UnicodeDecodeError:'ascii'codeccan't decode byte 0xc3 in position 3:
ordinalnotinrange(128)

The ASCII decoder threw an exception because the byte value 0xc3 is illegal in ASCII. There are some 8-bit character set encodings in which values between 128 (hex 80) and 255 (hex FF) are legal but not the same as UTF-8:

>>>place4=place_bytes.decode('latin-1')
>>>place4
'cafÃ©'
>>>place5=place_bytes.decode('windows-1252')
>>>place5
'cafÃ©'

The moral of this story: whenever possible, use UTF-8 encoding. It works, is supported everywhere, can express every Unicode character, and is quickly decoded and encoded.

——————————————

Encoding


You encode a string to bytes. The string encode() function’s first argument is the encoding name. The choices include those presented in Table 7-1.


Table 7-1. Encodings

'ascii'
Good old seven-bit ASCII

'utf-8'
Eight-bit variable-length encoding, and what you almost always want to use

'latin-1'
Also known as ISO 8859-1

'cp-1252'
A common Windows encoding

'unicode-escape'
Python Unicode literal format, \uxxxx or \Uxxxxxxxx


You can encode anything as UTF-8. Let’s assign the Unicode string '\u2603' to the name snowman:

>>>snowman='\u2603'

snowman is a Python Unicode string with a single character, regardless of how many bytes might be needed to store it internally:

>>>len(snowman)
1

Next let’s encode this Unicode character to a sequence of bytes:

>>>ds=snowman.encode('utf-8')

As I mentioned earlier, UTF-8 is a variable-length encoding. In this case, it used three bytes to encode the single snowman Unicode character:

>>>len(ds)
3
>>>ds
b'\xe2\x98\x83'

Now, len() returns the number of bytes (3) because ds is a bytes variable.

You can use encodings other than UTF-8, but you’ll get errors if the Unicode string can’t be handled by the encoding. For example, if you use the ascii encoding, it will fail unless your Unicode characters happen to be valid ASCII characters as well:

>>>ds=snowman.encode('ascii')
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
UnicodeEncodeError:'ascii'codeccan't encode character '\u2603'
inposition0:ordinalnotinrange(128)

The encode() function takes a second argument to help you avoid encoding exceptions. Its default value, which you can see in the previous example, is 'strict'; it raises a UnicodeEncodeError if it sees a non-ASCII character. There are other encodings. Use 'ignore' to throw away anything that won’t encode:

>>>snowman.encode('ascii','ignore')
b''

Use 'replace' to substitute ? for unknown characters:

>>>snowman.encode('ascii','replace')
b'?'

Use 'backslashreplace' to produce a Python Unicode character string, like unicode-escape:

>>>snowman.encode('ascii','backslashreplace')
b'\\u2603'

You would use this if you needed a printable version of the Unicode escape sequence.
The following produces character entity strings that you can use in web pages:

>>>snowman.encode('ascii','xmlcharrefreplace')
b'&#9731;'

——————————————

Encode and decode with UTF-8



You don’t need to worry about how Python stores each Unicode character when you do normal string processing.

However, when you exchange data with the outside world, you need a couple of things:

• A way to encode character strings to bytes 
• A way to decode bytes to character strings 

If there were fewer than 64,000 characters in Unicode, we could store each Unicode character ID in two bytes. Unfortunately, there are more. We could encode each ID in three or four bytes, but that would increase the memory and disk storage space needs for common text strings by three or four times.

Ken Thompson and Rob Pike, whose names will be familiar to Unix developers, designed the UTF-8 dynamic encoding scheme one night on a placemat in a New Jersey diner. It uses one to four bytes per Unicode character:

• One byte for ASCII 
• Two bytes for most Latin-derived (but not Cyrillic) languages 
• Three bytes for the rest of the basic multilingual plane 
• Four bytes for the rest, including some Asian languages and symbols 

UTF-8 is the standard text encoding in Python, Linux, and HTML. It’s fast, complete, and works well. If you use UTF-8 encoding throughout your code, life will be much easier than trying to hop in and out of various encodings.

——————————————

Python 3 Unicode strings(3)


How can we specify that final é character? If you look at character index for E, you see that the name E WITH ACUTE, LATIN SMALL LETTER has the value 00E9. Let’s check with the name() and lookup() functions that we were just playing with. First give the code to get the name:

>>>unicodedata.name('\u00e9')
'LATIN SMALL LETTER E WITH ACUTE'

Next, give the name to look up the code:

>>>unicodedata.lookup('E WITH ACUTE, LATIN SMALL LETTER')
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
KeyError:"undefined character name 'E WITH ACUTE, LATIN SMALL LETTER'"


Note

The names listed on the Unicode Character Name Index page were reformatted to make them sort nicely for display. To convert them to their real Unicode names (the ones that Python uses), remove the comma and move the part of the name that was after the comma to the beginning. Accordingly, change E WITH ACUTE, LATIN SMALL LETTER to LATIN SMALL LETTER E WITH ACUTE:

>>>unicodedata.lookup('LATIN SMALL LETTER E WITH ACUTE')
'é'

Now, we can specify the string café by code or by name:

>>>place='caf\u00e9'
>>>place
'café'
>>>place='caf\N{LATIN SMALL LETTER E WITH ACUTE}'
>>>place
'café'

In the preceding snippet, we inserted the é directly in the string, but we can also build a string by appending:

>>>u_umlaut='\N{LATIN SMALL LETTER U WITH DIAERESIS}'
>>>u_umlaut
'ü'
>>>drink='Gew'+u_umlaut+'rztraminer'
>>>print('Now I can finally have my',drink,'in a',place)
NowIcanfinallyhavemyGewürztraminerinacafé

The string len function counts Unicode characters, not bytes:

>>>len('$')
1
>>>len('\U0001f47b')
1

——————————————

Shit, it converted to the pictures of sentiment.

——————————————

Python 3 Unicode strings(2)


In the following example, we’ll write a test function that takes a Python Unicode character, looks up its name, and looks up the character again from the name (it should match the original character):

>>>def unicode_test(value):
...    import unicodedata
...    name=unicodedata.name(value)
...    value2=unicodedata.lookup(name)
...    print('value="%s", name="%s", value2="%s"'%(value,name,value2))
...

Let’s try some characters, beginning with a plain ASCII letter:

>>>unicode_test('A')
value="A",name="LATIN CAPITAL LETTER A",value2="A"

ASCII punctuation:

>>>unicode_test('$')
value="$",name="DOLLAR SIGN",value2="$"

A Unicode currency character:

>>>unicode_test('\u00a2')
value="¢",name="CENT SIGN",value2="¢"

Another Unicode currency character:

>>>unicode_test('\u20ac')
value="€",name="EURO SIGN",value2="€"

The only problem you could potentially run into is limitations in the font you’re using to display text. All fonts do not have images for all Unicode characters, and might display some placeholder character. For instance, here’s the Unicode symbol for SNOWMAN, like symbols in dingbat fonts:

>>>unicode_test('\u2603')
value="☃",name="SNOWMAN",value2="☃"

Suppose that we want to save the word café in a Python string. One way is to copy and paste it from a file or website and hope that it works:

>>>place='café'
>>>place
'café'

This worked because I copied and pasted from a source that used UTF-8 encoding (which you’ll see in a few pages) for its text.

——————————————

Python 3 Unicode strings(1)


Python 3 strings are Unicode strings, not byte arrays. This is the single largest change from Python 2, which distinguished between normal byte strings and Unicode character strings.

If you know the Unicode ID or name for a character, you can use it in a Python string. Here are some examples:

• A \u followed by four hex numbers[6] specifies a character in one of Unicode’s 256 basic multilingual planes. The first two are the plane number (00 to FF), and the next two are the index of the character within the plane. Plane 00 is good old ASCII, and the character positions within that plane are the same as ASCII. 

• For characters in the higher planes, we need more bits. The Python escape sequence for these is \U followed by eight hex characters; the leftmost ones need to be 0. 

• For all characters, \N{ name } lets you specify it by its standard name. The Unicode Character Name Index page lists these. 
The Python unicodedata module has functions that translate in both directions:

• lookup()—Takes a case-insensitive name and returns a Unicode character 
• name()—Takes a Unicode character and returns an uppercase name

——————————————

Chapter 7. Mangle Data Like a Pro


In this chapter, you’ll learn many techniques for taming data. Most of them concern these built-in Python data types:

strings 
Sequences of Unicode characters, used for text data. 

bytes and bytearrays 
Sequences of eight-bit integers, used for binary data.

——————————————

6.10. Define these classes: Laser, Claw, and SmartPhone. Each has only one method: does(). This returns 'disintegrate' (Laser), 'crush' (Claw), or 'ring' (SmartPhone). Then, define the class Robot that has one instance (object) of each of these. Define a does() method for the Robot that prints what its component objects do.

class Laser:
    def does(self):
        return 'disintegrate'
class Claw:
    def does(self):
        return 'crush'
class SmartPhone:
    def does(self):
        return 'ring'
class Robot:
    def does(self, Laser, Claw, SmartPhone):
        print(Laser.does(), Claw.does(), SmartPhone.does())

a = Laser()
b = Claw()
c = SmartPhone()
A_robot = Robot()
A_robot.does(a, b, c)

——————————————

6.9. Define three classes: Bear, Rabbit, and Octothorpe. For each, define only one method: eats(). This should return 'berries' (Bear), 'clover' (Rabbit), or 'campers' (Octothorpe). Create one object from each and print what it eats.

class Bear:
    def eats(self):
        return 'berries'
class Rabbit:
    def eats(self):
        return 'clover'
class Octothorpe:
    def eats(self):
        return 'campers'
a = Bear()
b = Rabbit()
c = Octothorpe()

print(a.eats(),b.eats(),c.eats())

——————————————

6.8. Modify Element to make the attributes name, symbol, and number private. Define a getter property for each to return its value.

class Element:
    def __init__(self, name, symbol, number):
        self.__name = name
        self.__symbol = symbol
        self.__number = number
    @property
    def name(self):
        return self.__name
    @property
    def symbol(self):
        return self.__symbol
    @property
    def number(self):
        return self.__number
    
hydrogen = Element('Hydrogen', 'H', 1)
print(hydrogen.name)
print(hydrogen.symbol)
print(hydrogen.number)

——————————————

http://www.runoob.com/

——————————————

6.7. In the definition of Element, change the name of method dump to __str__, create a new hydrogen object, and call print(hydrogen).

class Element:
    def __init__(self, name, symbol, number):
        self.name = name
        self.symbol = symbol
        self.number = number
    def __str__(self):
        return('name=%s, symbol=%s, number=%s'%(self.name,self.symbol,self.number))
    
hydrogen = Element('Hydrogen', 'H', 1)
print(hydrogen)

——————————————

6.6. For the Element class, define a method called dump() that prints the values of the object’s attributes (name, symbol, and number). Create the hydrogen object from this new definition and use dump() to print its attributes.

class Element:
    def __init__(self, name, symbol, number):
        self.name = name
        self.symbol = symbol
        self.number = number
    def dump(self):
        print(self.name, self.symbol, self.number)
    
hydrogen = Element('Hydrogen', 'H', 1)
hydrogen.dump()

——————————————

Things to Do



6.1. Make a class called Thing with no contents and print it. Then, create an object called example from this class and also print it. Are the printed values the same or different?

class thing:
    pass
    

print(thing)
example = thing()
print(example)

——————————————

6.2. Make a new class called Thing2 and assign the value 'abc' to a class attribute called letters. Print letters.

class thing2:
    def __init__(self, letters):
        print(letters)

thing2('abc')

——————————————

6.3. Make yet another class called, of course, Thing3. This time, assign the value 'xyz' to an instance (object) attribute called letters. Print letters. Do you need to make an object from the class to do this?

class thing3:
    def __init__(self, letters):
        self.letters = letters
    
example = thing3('xyz')
print(example.letters)

——————————————

6.4. Make a class called Element, with instance attributes name, symbol, and number. Create an object of this class with the values 'Hydrogen', 'H', and 1.

class Element:
    def __init__(self, name, symbol, number):
        self.name = name
        self.symbol = symbol
        self.number = number
    
example = Element('Hydrogen', 'H', 1)

——————————————

6.5. Make a dictionary with these keys and values: 'name': 'Hydrogen', 'symbol': 'H', 'number': 1. Then, create an object called hydrogen from class Element using this dictionary.

Adict = {'name': 'Hydrogen', 'symbol': 'H', 'number': 1}

class Element:
    def __init__(self, name, symbol, number):
        self.name = name
        self.symbol = symbol
        self.number = number
    
hydrogen = Element(**Adict)

——————————————

——————————————

Named Tuples



Because Guido just mentioned them and I haven’t yet, this is a good place to talk about named tuples. A named tuple is a subclass of tuples with which you can access values by name (with .name) as well as by position (with [ offset ]).

Let’s take the example from the previous section and convert the Duck class to a named tuple, with bill and tail as simple string attributes. We’ll call the namedtuple function with two arguments:

• The name 
• A string of the field names, separated by spaces 

Named tuples are not automatically supplied with Python, so you need to load a module before using them. We do that in the first line of the following example:

>>>from collections import namedtuple
>>>Duck=namedtuple('Duck','bill tail')
>>>duck=Duck('wide orange','long')
>>>duck
Duck(bill='wide orange',tail='long')
>>>duck.bill
'wide orange'
>>>duck.tail
'long'

You can also make a named tuple from a dictionary:

>>>parts={'bill':'wide orange','tail':'long'}
>>>duck2=Duck(**parts)
>>>duck2
Duck(bill='wide orange',tail='long')

In the preceding code, take a look at **parts. This is a keyword argument. It extracts the keys and values from the parts dictionary and supplies them as arguments to Duck(). It has the same effect as:

>>>duck2=Duck(bill='wide orange',tail='long')

Named tuples are immutable, but you can replace one or more fields and return another named tuple:

>>>duck3=duck2._replace(tail='magnificent',bill='crushing')
>>>duck3
Duck(bill='crushing',tail='magnificent')

We could have defined duck as a dictionary:

>>>duck_dict={'bill':'wide orange','tail':'long'}
>>>duck_dict
{'tail':'long','bill':'wide orange'}

You can add fields to a dictionary:

>>>duck_dict['color']='green'
>>>duck_dict
{'color':'green','tail':'long','bill':'wide orange'}

But not to a named tuple:

>>>duck.color='green'
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
AttributeError:'dict'objecthasnoattribute'color'

To recap, here are some of the pros of a named tuple:

• It looks and acts like an immutable object. 
• It is more space- and time-efficient than objects. 
• You can access attributes by using dot notation instead of dictionary-style square brackets. 
• You can use it as a dictionary key.

——————————————

+ plus 加号；正号

- minus 减号；负号

± plus or minus 正负号

× is multiplied by 乘号

÷ is divided by 除号

＝ is equal to 等于号

≠ is not equal to 不等于号

≡ is equivalent to 全等于号

≌ is equal to orapproximately equal to 等于或约等于号

≈ is approximately equal to 约等于号

＜ is less than 小于号

＞ is more than 大于号

≮ is not less than 不小于号

≯ is not more than 不大于号

≤ is less than or equal to 小于或等于号

≥ is more than or equal to 大于或等于号

% per cent 百分之...

‰ per mill 千分之...

∞ infinity 无限大号

∝ varies as 与...成比例

√ (square) root 平方根

∵ since; because 因为

∴ hence 所以

∷ equals, as(proportion) 等于，成比例

∠ angle 角

⌒ semicircle 半圆

⊙ circle 圆

○ circumference 圆周

π pi 圆周率

△ triangle 三角形

⊥ perpendicular to 垂直于

∪ union of 并，合集

∩ intersection of 交，通集

∫ the integral of ...的积分

∑ (sigma) summation of 总和

° degree 度

′ minute 分

″ second 秒

℃ Celsius system 摄氏度

{ open brace, open curly 左花括号

} close brace, close curly 右花括号

( open parenthesis, open paren 左圆括号

) close parenthesis, close paren 右圆括号

() brakets/ parentheses 括号

[ open bracket 左方括号

] close bracket 右方括号

[] square brackets 方括号

. period, dot 句号，点

| vertical bar, vertical virgule 竖线

& ampersand, and,reference, ref 和，引用

* asterisk, multiply, star, pointer 星号，乘号，星，指针

/ slash, divide, oblique 斜线，斜杠，除号

// slash-slash, comment 双斜线，注释符

# pound 井号

backslash, sometimes

escape 反斜线转义符，有时表示转义符或续行符

~ tilde 波浪符

. full stop 句号

, comma 逗号

: colon 冒号

; semicolon 分号

? question mark 问号

! exclamation mark (英式英语) exclamation point (美式英语)

' apostrophe 撇号

- hyphen 连字号

-- dash 破折号

... dots/ ellipsis 省略号

" single quotationmarks 单引号

"" double quotation marks 双引号

‖ parallel 双线号

& ampersand = and

～ swung dash 代字号

§ section; division 分节号

→ arrow 箭号；参见号

——————————————

Module just module, don't forget the way of import a module.

import requests

——————————————

When to Use Classes and Objects versus Modules



Here are some guidelines for deciding whether to put your code in a class or a module:

• Objects are most useful when you need a number of individual instances that have similar behavior (methods), but differ in their internal states (attributes). 

• Classes support inheritance, modules don’t. 

• If you want only one of something, a module might be best. No matter how many times a Python module is referenced in a program, only one copy is loaded. (Java and C++ programmers: if you’re familiar with the book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, you can use a Python module as a singleton.)
 
• If you have a number of variables that contain multiple values and can be passed as arguments to multiple functions, it might be better to define them as classes. For example, you might use a dictionary with keys such as size and color to represent a color image. You could create a different dictionary for each image in your program, and pass them as arguments to functions such as scale() or transform(). This can get messy as you add keys and functions. It’s more coherent to define an Image class with attributes size or color and methods scale() and transform(). Then, all the data and methods for a color image are defined in one place. 

• Use the simplest solution to the problem. A dictionary, list, or tuple is simpler, smaller, and faster than a module, which is usually simpler than a class. 

Guido’s advice:

Avoid overengineering datastructures. Tuples are better than objects (try namedtuple too though). Prefer simple fields over getter/setter functions … Built-in datatypes are your friends. Use more numbers, strings, tuples, lists, sets, dicts. Also check out the collections library, esp. deque.

— Guido van Rossum

——————————————

Composition



Inheritance is a good technique to use when you want a child class to act like its parent class most of the time (when child is-a parent). It’s tempting to build elaborate inheritance hierarchies, but sometimes composition or aggregation (when x has-a y) make more sense. A duck is-a bird, but has-a tail. A tail is not a kind of duck, but part of a duck. In this next example, let’s make bill and tail objects and provide them to a new duck object:

>>>class Bill():
...    def __init__(self,description):
...        self.description=description
...
>>>class Tail():
...    def __init__(self,length):
...        self.length=length
...
>>>class Duck():
...    def __init__(self,bill,tail):
...        self.bill=bill
...        self.tail=tail
...    def about(self):
...        print('This duck has a',bill.description,'bill and a',tail.length,'tail')
...
>>>tail=Tail('long')
>>>bill=Bill('wide orange')
>>>duck=Duck(bill,tail)
>>>duck.about()
This duck has a wide orange bill and a long tail

——————————————

Special Methods(2)


Tables 6-1 and 6-2 list the names of the most useful magic methods.

Table 6-1. Magic methods for comparison

__eq__( self, other )
self == other
__ne__( self, other )
self != other
__lt__( self, other )
self < other
__gt__( self, other )
self > other
__le__( self, other )
self <= other
__ge__( self, other )
self >= other

Table 6-2. Magic methods for math

__add__( self, other )
self + other
__sub__( self, other )
self - other
__mul__( self, other )
self * other
__floordiv__( self, other )
self // other
__truediv__( self, other )
self / other
__mod__( self, other )
self % other
__pow__( self, other )
self ** other

You aren’t restricted to use the math operators such as + (magic method __add__()) and - (magic method __sub__()) with numbers. For instance, Python string objects use + for concatenation and * for duplication.

Table 6-3. Other, miscellaneous magic methods

__str__( self )
str( self )
__repr__( self )
repr( self )
__len__( self )
len( self )

Besides __init__(), you might find yourself using __str__() the most in your own methods. It’s how you print your object. It’s used by print(), str(), and the string formatters that you can read about in Chapter 7. The interactive interpreter uses the __repr__() function to echo variables to output. If you fail to define either __str__() or __repr__(), you get Python’s default string version of your object:

>>>first=Word('ha')
>>>first
<__main__.Wordobjectat0x1006ba3d0>
>>>print(first)
<__main__.Wordobjectat0x1006ba3d0>

Let’s add both __str__() and __repr__() methods to the Word class to make it prettier:

>>>class Word():
...    def __init__(self,text):
...        self.text=text
...    def __eq__(self,word2):
...        return self.text.lower()==word2.text.lower()
...    def__str__(self):
...        returnself.text
...    def__repr__(self):
...        return'Word("'self.text'")'
...
>>>first=Word('ha')
>>>first    # uses __repr__
Word("ha")
>>>print(first)    # uses __str__
ha

——————————————

Special Methods(1)


You can now create and use basic objects, but now let’s go a bit deeper and do more.
When you type something such as a = 3 + 8, how do the integer objects with values 3 and 8 know how to implement +? Also, how does a know how to use = to get the result? You can get at these operators by using Python’s special methods (you might also see them called magic methods). You don’t need Gandalf to perform any magic, and they’re not even complicated.

The names of these methods begin and end with double underscores (__). You’ve already seen one: __init__ initializes a newly created object from its class definition and any arguments that were passed in.

Suppose that you have a simple Word class, and you want an equals() method that compares two words but ignores case. That is, a Word containing the value 'ha' would be considered equal to one containing 'HA'.
The example that follows is a first attempt, with a normal method we’re calling equals(). self.text is the text string that this Word object contains, and the equals() method compares it with the text string of word2 (another Word object):

>>>class Word():
...    def __init__(self,text):
...        self.text=text
...
...    def equals(self,word2):
...        return self.text.lower()==word2.text.lower()
...

Then, make three Word objects from three different text strings:

>>>first=Word('ha')
>>>second=Word('HA')
>>>third=Word('eh')

When strings 'ha' and 'HA' are compared to lowercase, they should be equal:

>>>first.equals(second)
True

But the string 'eh' will not match 'ha':

>>>first.equals(third)
False

We defined the method equals() to do this lowercase conversion and comparison. It would be nice to just say if first == second, just like Python’s built-in types. So, let’s do that. We change the equals() method to the special name __eq__() (you’ll see why in a moment):

>>>class Word():
...    def __init__(self,text):
...        self.text=text
...    def __eq__(self,word2):
...        return self.text.lower()==word2.text.lower()
...

Let’s see if it works:

>>>first=Word('ha')
>>>second=Word('HA')
>>>third=Word('eh')
>>>first==second
True
>>>first==third
False

Magic! All we needed was the Python’s special method name for testing equality, __eq__().

——————————————

implement
实施，执行;使生效，实现

concatenation
一系列互相关联的事物,连结

——————————————

Duck Typing


Python has a loose implementation of polymorphism; this means that it applies the same operation to different objects, regardless of their class.

Let’s use the same __init__() initializer for all three Quote classes now, but add two new functions:

• who() just returns the value of the saved person string 
• says() returns the saved words string with the specific punctuation 
And here they are in action:

>>>class Quote():
...    def __init__(self,person,words):
...        self.person=person
...        self.words=words
...    def who(self):
...        return self.person
...    def says(self):
...        return self.words+'.'
...
>>>class QuestionQuote(Quote):
...    def says(self):
...        return self.words+'?'
...
>>>class ExclamationQuote(Quote):
...    def says(self):
...    return self.words+'!'
...
>>>

We didn’t change how QuestionQuote or ExclamationQuote were initialized, so we didn’t override their __init__() methods. Python then automatically calls the __init__() method of the parent class Quote to store the instance variables person and words. That’s why we can access self.words in objects created from the subclasses QuestionQuote and ExclamationQuote.
Next up, let’s make some objects:

>>>hunter=Quote('Elmer Fudd',"I'm hunting wabbits")
>>>print(hunter.who(),'says:',hunter.says())
Elmer Fudd says:I'm hunting wabbits.


>>>hunted1=QuestionQuote('Bugs Bunny',"What's up, doc")
>>>print(hunted1.who(),'says:',hunted1.says())
Bugs Bunny says:What's up, doc?


>>>hunted2=ExclamationQuote('Daffy Duck',"It's rabbit season")
>>>print(hunted2.who(),'says:',hunted2.says())
Daffy Duck says:It's rabbit season!

Three different versions of the says() method provide different behavior for the three classes. This is traditional polymorphism in object-oriented languages. Python goes a little further and lets you run the who() and says() methods of any objects that have them. Let’s define a class called BabblingBrook that has no relation to our previous woodsy hunter and huntees (descendants of the Quote class):

>>>class BabblingBrook():
...    def who(self):
...        return 'Brook'
...    def says(self):
...        return'Babble'
...
>>>brook=BabblingBrook()

Now, run the who() and says() methods of various objects, one (brook) completely unrelated to the others:

>>>def who_says(obj):
...    print(obj.who(),'says',obj.says())
...
>>>who_says(hunter)
Elmer Fudd says I'm hunting wabbits.
>>>who_says(hunted1)
Bugs Bunny says What's up, doc?
>>>who_says(hunted2)
Daffy Duck says It's rabbit season!
>>>who_says(brook)
Brook says Babble

This behavior is sometimes called duck typing, after the old saying:
If it walks like a duck and quacks like a duck, it’s a duck.
— A Wise Person

——————————————

There is no way I could modify these presentations.
These presentations already good. And brief enough.

——————————————

Method Types


Some data (attributes) and functions (methods) are part of the class itself, and some are part of the objects that are created from that class.

When you see an initial self argument in methods within a class definition, it’s an instance method. These are the types of methods that you would normally write when creating your own classes. The first parameter of an instance method is self, and Python passes the object to the method when you call it.

In contrast, a class method affects the class as a whole. Any change you make to the class affects all of its objects. Within a class definition, a preceding @classmethod decorator indicates that that following function is a class method. Also, the first parameter to the method is the class itself. The Python tradition is to call the parameter cls, because class is a reserved word and can’t be used here. Let’s define a class method for A that counts how many object instances have been made from it:

>>>class A():
...    count=0
...    def __init__(self):
...        A.count+=1
...    def exclaim(self):
...        print("I'm an A!")
...    @classmethod
...    def kids(cls):
...        print("A has",cls.count,"little objects.")
...
>>>
>>>easy_a=A()
>>>breezy_a=A()
>>>wheezy_a=A()
>>>A.kids()
A has 3 little objects.

Notice that we referred to A.count (the class attribute) rather than self.count (which would be an object instance attribute). In the kids() method, we used cls.count, but we could just as well have used A.count.

A third type of method in a class definition affects neither the class nor its objects; it’s just in there for convenience instead of floating around on its own. It’s a static method, preceded by a @staticmethod decorator, with no initial self or class parameter. Here’s an example that serves as a commercial for the class CoyoteWeapon:

>>>class CoyoteWeapon():
...    @staticmethod
...    def commercial():
...        print('This CoyoteWeapon has been brought to you by Acme')
...
>>>
>>>CoyoteWeapon.commercial()
This CoyoteWeapon has been brought to you by Acme

Notice that we didn’t need to create an object from class CoyoteWeapon to access this method. Very class-y.

——————————————

Name Mangling for Privacy


In the Duck class example in the previous section, we called our (not completely) hidden attribute hidden_name. Python has a naming convention for attributes that should not be visible outside of their class definition: begin by using with two underscores (__).
Let’s rename hidden_name to __name, as demonstrated here:

>>>class Duck():
...    def __init__(self,input_name):
...        self.__name=input_name
...    @property
...    def name(self):
...        print('inside the getter')
...        return self.__name
...    @name.setter
...    def name(self,input_name):
...        print('inside the setter')
...        self.__name=input_name
...

Take a moment to see if everything still works:

>>>fowl=Duck('Howard')
>>>fowl.name
inside the getter
'Howard'
>>>fowl.name='Donald'
inside the setter
>>>fowl.name
inside the getter
'Donald'

Looks good. And, you can’t access the __name attribute:

>>>fowl.__name
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
AttributeError:'Duck'objecthasnoattribute'__name'

This naming convention doesn’t make it private, but Python does mangle the name to make it unlikely for external code to stumble upon it. If you’re curious and promise not to tell everyone, here’s what it becomes:

>>>fowl._Duck__name
'Donald'

Notice that it didn’t print inside the getter. Although this isn’t perfect protection, name mangling discourages accidental or intentional direct access to the attribute.

——————————————

Get and Set Attribute Values with Properties(4)



In both of the previous examples, we used the name property to refer to a single attribute (ours was called hidden_name) stored within the object. A property can refer to a computed value, as well. Let’s define a Circle class that has a radius attribute and a computed diameter property:

>>>class Circle():
...    def __init__(self,radius):
...        self.radius=radius
...    @property
...    def diameter(self):
...        return 2*self.radius
...

We create a Circle object with an initial value for its radius:

>>>c=Circle(5)
>>>c.radius
5

We can refer to diameter as if it were an attribute such as radius:

>>>c.diameter
10

Here’s the fun part: we can change the radius attribute at any time, and the diameter property will be computed from the current value of radius:

>>>c.radius=7
>>>c.diameter
14

If you don’t specify a setter property for an attribute, you can’t set it from the outside. This is handy for read-only attributes:

>>>c.diameter=20
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
AttributeError:can't set attribute

There’s one more big advantage of using a property over direct attribute access: if you ever change the definition of the attribute, you only need to fix the code within the class definition, not in all the callers.

——————————————

Get and Set Attribute Values with Properties(3)


Another way to define properties is with decorators. In this next example, we’ll define two different methods, each called name() but preceded by different decorators:

• @property, which goes before the getter method 
• @name.setter, which goes before the setter method 
Here’s how they actually look in the code:

>>>class Duck():
...    def __init__(self,input_name):
...        self.hidden_name=input_name
...@property
...def name(self):
...    print('inside the getter')
...    return self.hidden_name
...@name.setter
...def name(self,input_name):
...    print('inside the setter')
...    self.hidden_name=input_name

You can still access name as though it were an attribute, but there are no visible get_name() or set_name() methods:

>>>fowl=Duck('Howard')
>>>fowl.name
inside the getter
'Howard'
>>>fowl.name='Donald'
inside the setter
>>>fowl.name
inside the getter
'Donald'

——————————————

Get and Set Attribute Values with Properties(2)


In this example, we’ll define a Duck class with a single attribute called hidden_name. 

We don’t want people to access this directly, so we’ll define two methods: a getter (get_name()) and a setter (set_name()). I’ve added a print() statement to each method to show when it’s being called. Finally, we define these methods as properties of the name attribute:

>>>class Duck():
...    def __init__(self,input_name):
...        self.hidden_name=input_name
...    def get_name(self):
...        print('inside the getter')
...        return self.hidden_name
...    def set_name(self,input_name):
...        print('inside the setter')
...        self.hidden_name=input_name
...        name=property(get_name,set_name)

The new methods act as normal getters and setters until that last line; it defines the two methods as properties of the attribute called name. The first argument to property() is the getter method, and the second is the setter. Now, when you refer to the name of any Duck object, it actually calls the get_name() method to return it:

>>>fowl=Duck('Howard')
>>>fowl.name
inside the getter
'Howard'

You can still call get_name() directly, too, like a normal getter method:

>>>fowl.get_name()
inside the getter
'Howard'

When you assign a value to the name attribute, the set_name() method will be called:

>>>fowl.name='Daffy'
inside the setter
>>>fowl.name
inside the getter
'Daffy'

You can still call the set_name() method directly:

>>>fowl.set_name('Daffy')
inside the setter
>>>fowl.name
inside the getter
'Daffy'

——————————————

Get and Set Attribute Values with Properties(1)



Some object-oriented languages support private object attributes that can’t be accessed directly from the outside; programmers often need to write getter and setter methods to read and write the values of such private attributes.

Python doesn’t need getters or setters, because all attributes and methods are public, and you’re expected to behave yourself. If direct access to attributes makes you nervous, you can certainly write getters and setters. But be Pythonic—use properties.

——————————————

How to creat a website:

http://pan.baidu.com/s/1cDiPzS

——————————————

GitHub don't support Python.
That's a pity.

http://yingshaoxo.github.io/

——————————————

#Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.
#给出一个整数数组，判断该数组内是否有两个元素值是相同的，且他们的索引值相差不大于k，是则返回true，否则返回false

def containsNearbyDuplicate(nums, k):
    Adict = {}
    for counter, value in enumerate(nums):
        if Adict.get(value) is not None and (counter -  Adict.get(value) <= k):
            return True
        else:
            Adict[value] = counter
    return False

print(containsNearbyDuplicate([888,5,6,888],3))


#following will help you understand the enumerate()#
#
#for counter, value in enumerate([2,5,6,2]):
#    print(counter, value)

#following will help you understand the dict#
#
#Adict = {}
#Adict[555]=1
#print(Adict.get(555))
#print(Adict)

——————————————

self Defense


One criticism of Python is the need to include self as the first argument to instance methods. Python uses the self argument to find the right object’s attributes and methods.

——————————————

Get Help(codes) from Your Parent with super


class Person():
    def __init__(self,name):
        self.name=name*2

class EmailPerson1(Person):
    def __init__(self,name,email):
        super().__init__(name)
        self.email=email

class EmailPerson2(Person):
    def __init__(self,name,email):
        self.name=name*2
        self.email=email

A=EmailPerson1('YS', '1576570260@qq.com')
B=EmailPerson2('YS', '1576570260@qq.com')

print(A.name, A.email)
print(B.name, B.email)


What's the difference between  EmailPerson1 and EmailPerson2? 

EmailPerson1:
• The super() gets the definition of the parent class, Person. 
• The __init__() method calls the Person.__init__() method. It takes care of passing the self argument to the superclass, so you just need to give it any optional arguments. In our case, the only other argument Person() accepts is name.
• If the definition of Person changes in the future, using super() will ensure that the attributes and methods that EmailPerson inherits from Person will reflect the change.
• Obviously, we call this inheritance.

EmailPerson2:
• No inheritance

——————————————

——————————————

Inheritance
n.继承; 遗传; 遗产;

——————————————

Inheritance


When you’re trying to solve some coding problem, often you’ll find an existing class that creates objects that do almost what you need. What can you do? You could modify this old class or write a new class, cutting and pasting from the old one and merging your new code. But all you do will make it more complicated.

The solution is inheritance: creating a new class from an existing class but with some additions or changes. It’s an excellent way to reuse code. When you use inheritance, the new class can automatically use all the code from the old class but without copying any of it.

You define only what you need to add or change in the new class, and this overrides the behavior of the old class. The original class is called a parent, superclass, or base class; the new class is called a child, subclass, or derived class. These terms are interchangeable in object-oriented programming.

——————————————

instance
n.实例

——————————————

Let’s inherit something:


class Car():
    def exclaim(self):
        print("I'm a Car!")

class Yugo(Car):
     pass

give_me_a_car=Car()
give_me_a_yugo=Yugo()

>>>give_me_a_car.exclaim()
I'm a Car!
>>>give_me_a_yugo.exclaim()
I'm a Car!


The object named give_me_a_yugo is an instance of class Yugo, but it also inherits whatever a Car can do. 

(Without doing anything special, Yugo inherited the exclaim() method from Car.)

——————————————

Override
重写;重载;方法重写
覆盖了一个方法并且对其重写

——————————————

Override a Method


>>>class Car():
...    def exclaim(self):
...        print("I'm a Car!")
...
>>>class Yugo(Car):
...    def exclaim(self):
...        print("I'm a Yugo! Much like a Car, but more Yugo-ish.")
...

#Now, make two objects from these classes:

>>>give_me_a_car=Car()
>>>give_me_a_yugo=Yugo()

#What do they say?

>>>give_me_a_car.exclaim()
I'm a Car!
>>>give_me_a_yugo.exclaim()
I'm a Yugo! Much like a Car, but more Yugo-ish.


In these examples, we overrode the exclaim() method. We can override any methods, including __init__().

——————————————

Override __init__()


>>>class Person():
...    def __init__(self,name):
...        self.name=name
...
>>>class MDPerson(Person):
...    def __init__(self,name):
...        self.name="Doctor "+name
...
>>>class JDPerson(Person):
...    def __init__(self,name):
...        self.name=name+", SB"
...

In these cases, the initialization method __init__() takes the same arguments as the parent Person class but stores the value of name differently inside the object instance:

>>>person=Person('YS')
>>>doctor=MDPerson('YS')
>>>lawyer=JDPerson('YS')
>>>print(person.name)
YS
>>>print(doctor.name)
Doctor YS
>>>print(lawyer.name)
YS,SB

——————————————

Add a Method To Subclass


The child class can also add a method that was not present in its parent class. Going back to classes Car and Yugo, we’ll define the new method need_a_push() for class Yugo only:

>>>class Car():
...    def exclaim(self):
...        print("I'm a Car!")
...
>>>class Yugo(Car):
...    def exclaim(self):
...        print("I'm a Yugo! Much like a Car, but more Yugo-ish.")
...    def need_a_push(self):
...        print("A little help here?")
...

Next, make a Car and a Yugo:

>>>give_me_a_car=Car()
>>>give_me_a_yugo=Yugo()

A Yugo object can react to a need_a_push() method call:

>>>give_me_a_yugo.need_a_push()
A little help here?

But a generic Car(parent class) object cannot.

——————————————

——————————————

——————————————

initialization
n.设定初值，初始化

——————————————

Define a Class with class:


class OneClass():
    def __init__(self,name):
        self.get_name=name

OneObject=OneClass('YS')

print(OneObject.get_name)


Here’s what these codes does:

• Looks up the definition of the OneClass class 
• Instantiates (creates) a new object in memory 
• Calls the object’s __init__ method, passing this newly-created object as self and the other argument ('YS') as name 
• Stores the value of name in the object 
• Returns the new object 
• Attaches the name OneObject to the object

1.self is just represent the object itself.  You can use anything you like to replace it, like 'myself'.

2.The __init__ is short for initialization.

——————————————

——————————————

What Are Objects?


An object contains both data (variables, called attributes) and code (functions, called methods). It represents a unique instance of some concrete thing. For example, the integer object with the value 7 is an object that facilitates methods such as addition and multiplication, as is demonstrated in Numbers. 8 is a different object. This means there’s an Integer class in Python, to which both 7 and 8 belong. The strings 'cat' and 'duck' are also objects in Python, and have string methods that you’ve seen, such as capitalize() and replace().

When you create new objects no one has ever created before, you must create a class that indicates what they contain.

Think of objects as nouns and their methods as verbs. An object represents an individual thing, and its methods define how it interacts with other things.

Unlike modules, you can have multiple objects at the same time, each one with different values for its attributes. They’re like super data structures, with code thrown in.

——————————————

Chapter 6. Oh Oh: Objects and Classes


No object is mysterious. The mystery is your eye.
— Elizabeth Bowen 

Take an object. Do something to it. Do something else to it.
— Jasper Johns 

Up to this point, you’ve seen data structures such as strings and dictionaries, and code structures such as functions and modules. In this chapter, you’ll deal with custom data structures: objects.

——————————————

Third-party Python software:


https://pypi.python.org/pypi

——————————————

Print Nicely with pprint()


>>>from collections import OrderedDict
>>>from pprint import pprint
>>>quotes=OrderedDict([('Moe','A wise guy, huh?'),('Larry','Ow!'),('Curly','Nyuk nyuk!')])
>>>
>>>pprint(quotes)
OrderedDict([('Moe', 'A wise guy, huh?'),
             ('Larry', 'Ow!'),
             ('Curly', 'Nyuk nyuk!')])

——————————————

Iterate over Code Structures with itertools


itertools contains special-purpose iterator functions. Each returns one item at a time when called within a for … in loop, and remembers its state between calls.


chain() runs through its arguments as though they were a single iterable:

>>>import itertools
>>>for item in itertools.chain([1,2],['a','b']):
...    print(item)
...
1
2
a
b


cycle() is an infinite iterator, cycling through its arguments:

>>>import itertools
>>>for item in itertools.cycle([1,2]):
...    print(item)
...
1
2
1
2
.
.
.
…and so on.


accumulate() calculates accumulated values. By default, it calculates the sum:

>>>import itertools
>>>for item in itertools.accumulate([1,2,3,4]):
...    print(item)
...
1
3
6
10

You can provide a function as the second argument to accumulate(), and it will be used instead of addition. The function should take two arguments and return a single result. This example calculates an accumulated product:

>>>import itertools
>>>def multiply(a,b):
...    return a*b
...
>>>for item in itertools.accumulate([1,2,3,4],multiply):
...    print(item)
...
1
2
6
24


The itertools module has many more functions, notably some for combinations and permutations that can be time savers when the need arises.

——————————————

http://zetcode.com/

——————————————

——————————————

Order by Key with OrderedDict()


>>>from collections import OrderedDict
>>>quotes=OrderedDict([
... ('Moe','A wise guy, huh?'),
... ('Larry','Ow!'),
... ('Curly','Nyuk nyuk!'),
... ])
>>>
>>>for stooge in quotes:
...print(stooge)
...
Moe
Larry
Curly

——————————————

palindrome
n.回文（指顺读和倒读都一样的词语）

deque
双队列;队列;双端队列容器

Stack
栈（stack）在计算机科学中是限定仅在表尾进行插入或删除操作的线性表。

Queue
队列是一种特殊的线性表，它只允许在表的前端（front）进行删除操作，而在表的后端（rear）进行插入操作。

——————————————

Stack + Queue == deque


A deque (pronounced deck) is a double-ended queue, which has features of both a stack and a queue. It’s useful when you want to add and delete items from either end of a sequence. Here, we’ll work from both ends of a word to the middle to see if it’s a palindrome. The function popleft() removes the leftmost item from the deque and returns it; pop() removes the rightmost item and returns it. Together, they work from the ends toward the middle. As long as the end characters match, it keeps popping until it reaches the middle:

>>>def palindrome(word):
... from collections import deque
... dq=deque(word)
... while len(dq)>1:
...     if dq.popleft()!=dq.pop():
...         return False
... return True
...
...
>>>palindrome('a')
True
>>>palindrome('racecar')
True
>>>palindrome('')
True
>>>palindrome('radar')
True
>>>palindrome('halibut')
False

I used this as a simple illustration of deques. If you really wanted a quick palindrome checker, it would be a lot simpler to just compare a string with its reverse. Python doesn’t have a reverse() function for strings, but it does have a way to reverse a string with a slice, as illustrated here:

>>>def another_palindrome(word):
... return word==word[::-1]
...
>>>another_palindrome('radar')
True
>>>another_palindrome('halibut')
False

——————————————

——————————————

Count Items with Counter():


>>>from collections import Counter
>>>breakfast=['spam','spam','eggs','spam']
>>>breakfast_counter=Counter(breakfast)
>>>breakfast_counter
Counter({'spam':3,'eggs':1})


The most_common() function returns all elements in descending order, or just the top count elements if given a count:

>>>breakfast_counter.most_common()
[('spam',3),('eggs',1)]
>>>breakfast_counter.most_common(1)
[('spam',3)]


we’ll make a new list called lunch, and a counter called lunch_counter:

>>>lunch=['eggs','eggs','bacon']
>>>lunch_counter=Counter(lunch)
>>>lunch_counter
Counter({'eggs':2,'bacon':1})


The first way we combine the two counters is by addition, using +:

>>>breakfast_counter+lunch_counter
Counter({'spam':3,'eggs':3,'bacon':1})


Subtract one counter from another by using -:

>>>breakfast_counter-lunch_counter
Counter({'spam':3})


Okay, now what can we have for lunch that we can’t have for breakfast?

>>>lunch_counter-breakfast_counter
Counter({'bacon':1,'eggs':1})


You can get common items by using the intersection operator &:

>>>breakfast_counter & lunch_counter
Counter({'eggs':1})


You can get all items by using the union operator |:

>>>breakfast_counter | lunch_counter
Counter({'spam':3,'eggs':2,'bacon':1})

The item 'eggs' was again common to both. Unlike addition, union didn’t add their counts, but picked the one with the larger count.

——————————————

Handle dict with setdefault() and defaultdict()


setdefault() function is like get(), when key exists will return the original value.

If the key was not already in the dictionary, the new value is used.


defaultdict() specifies the default value for any new key up front, when the dictionary is created.

#from collections import defaultdict

The argument to defaultdict() is a function that returns the value to be assigned to a missing key.

——————————————

#!/usr/bin/python3
# -*- codeing : utf-8-*-
import requests
import json
import time

while True:

    html = requests.get("http://api.hitokoto.us/rand?encode=jsc&fun=yy&cat=a")
    try:
        html.encoding = 'utf-8'
        result = html.text[3:-2]
        Adict = json.loads(result)
        they_say = Adict['hitokoto']+'—'+Adict['source']+'\n\n'
        print (they_say)
    except:
        print ("slow down~")

    time.sleep(10)

——————————————

http://php-yingshaoxo.rhcloud.com/

ZhuangB ing

——————————————

——————————————

Import a Module or another .py files


Let’s simulate a weather station and print a weather report. One main program prints the report, and a separate module with a single function returns the weather description used by the report.

#report.py
def get_description():
    "Return random weather"
    from random import choice
    possibilities = ['rain', 'snow', 'fog', 'sun', 'who knows']
    return choice(possibilities)


#weatherman.py
import report

description = report.get_description()
print("Today's weather:", description)


If you have these two files in the same directory and instruct Python to run weatherman.py as the main program, it will access the report module and run its get_description() function.

——————————————

Import a Module with Another Name


import report as wr
description=wr.get_description()
print("Today's weather:", description)

——————————————

Import Only What You Want from a Module


from report import get_description
description = get_description()
print("Today's weather:", description)

——————————————

——————————————

Standalone Programs


你可以用文本编辑器写独立的后缀为.py的程序源码，运行它只需要在你的py终端上写上如下并回车：
python c:/test.py

即python+空格+文件绝对路径+回车键

——————————————

Command-Line Arguments


On your computer, create a file called test2.py that contains these two lines:

import sys
print('Program arguments:',sys.argv)


Now, use your version of Python to run this program:

$python test2.py tra la la
Programar guments:['test2.py','tra','la','la']

——————————————

——————————————

During your bottom-up climb, you’ve progressed from built-in data types to constructing ever-larger data and code structures. 

In following chapter, you’ll finally get down to brass tacks and learn how to write realistic, large programs in Python.

——————————————

Hey guys, 

am…

I totally think I'm an asshole.

——————————————

http://docs.python-requests.org/en/master/user/quickstart/#make-a-request

https://www.crummy.com/software/BeautifulSoup/bs4/doc/

以上为爬虫工具指南

——————————————

用try和except进行错误处理：


short_list=[1,2,3]
position=5
try:
    print (short_list[position])
except:
    print('Need a position between 0 and',len(short_list)-1,' but got ', position)

——————————————

首尾带有两个下划线的名称，如__main__不能用来创建自己的变量。

它们在python是被保留的关键字。

——————————————

嗯，有些细节还是要看书

——————————————

得到名称空间里的变量：

• locals() returns a dictionary of the contents of the local namespace. 
• globals() returns a dictionary of the contents of the global namespace.

——————————————

用global()定义全局变量


global i
i=999

def Afunction():
    print (i)

Afunction()

——————————————

Namespaces
名称空间


A name can refer to different things, depending on where it’s used. Python programs have various namespaces—sections within which a particular name is unique and unrelated to the same name in other namespaces.

Each function defines its own namespace. If you define a variable called x in a main program and another variable called x in a function, they refer to different things. But the walls can be breached: if you need to, you can access names in other namespaces in various ways.

——————————————

用Decorator对函数增加外部处理：


The function document_it() defines a decorator that will do the following:

• Print the function’s name and the values of its arguments 
• Run the function with the arguments 
• Print the result 
• Return the modified function for use 

Here’s what the code looks like:

def document_it(func):
    def new_function(*args,**kwargs):
        print('Running function:',func.__name__)
        print('Positional arguments:',args)
        print('Keyword arguments:',kwargs)
        result=func(*args,**kwargs)
        print('Result:',result)
        #return result
    return new_function


手动调用
def add_ints(a,b):
    return a+b

cooler_add_ints=document_it(add_ints)
cooler_add_ints(3,5)

用@自动调用
@document_it
def add_ints(a,b):
    return a+b

add_ints(3,5)

用@调用多个
同理在def上添加，只是离def越近越先执行

——————————————

Let’s write our own version of range():


def my_range(first=0,last=10,step=1):
    number=first
    while number<last:
        yield number
        number+=step

ranger=my_range(1,5)

for x in ranger:
    print(x)

#调用一次yield number就记一次数字，最后这个数字序列就被直接当成返回值了，类型是generator

——————————————

Generators


A generator is a Python sequence creation object.

Every time you iterate through a generator, it keeps track of where it was the last time it was called and returns the next value. 

This is different from a normal function, which has no memory of previous calls and always starts at its first line with the same state.

If you want to create a potentially large sequence, and the code is too large for a generator comprehension, write a generator function.

It’s a normal function, but it returns its value with a yield statement rather than return.

它只返回带yield状态的变量值。

——————————————

Anonymous Functions: the lambda() Function


def edit_story(words,func):
    for word in words:
        print(func(word))

stairs=['thud','meow','thud','hiss']


#traditional way
def enliven(word):# give that prose more punch
    return word.capitalize()+'!'

print (edit_story(stairs,enliven))


#points coming! same with the above.
edit_story(stairs,lambda word:word.capitalize()+'!')

——————————————

Inner Functions
内部函数


def outer(a,b):
    def inner(c,d):
        return c+d
    return inner(a,b)

print (outer(4,7)) #get 11

——————————————

传递函数名+其它类型：


普通类型
def add_args(arg1,arg2):
    print(arg1+arg2)

def run_something_with_args(func,arg1,arg2):
    func(arg1,arg2)

run_something_with_args(add_args,5,9) #get 14


*传递tuple类型的参数
def sum_args(*args):
return sum(args)

def run_with_positional_args(func,*args):
return func(*args)

run_with_positional_args(sum_args,1,2,3,4) #get 10

——————————————

用函数名传递函数


def answer():
print(77)

def run_something(func):
func()

run_something(answer) #will print 77


Notice that you passed answer, not answer(). In Python, those parentheses mean call this function. With no parentheses, Python just treats the function like any other object. That’s because, like everything else in Python, it is an object.

——————————————

给函数添加说明，并得到说明：


def echo(anything):
    'This is an introduction about the function: echo returns its input argument'
    return anything

print (help(echo)) #get help

print (echo.__doc__) #get pure help text

——————————————

参数的英文：


1. parameter是指函数定义中的参数，而argument指的是函数调用时传递的实际参数。

2. 简略描述为：parameter=形参(formal parameter)， argument=实参(actual parameter)。

——————————————

def print_kwargs(**kwargs):
    print('Keyword arguments:',kwargs)

print (print_kwargs(girl='Alice',place='bed',act='sleeping'))

——————————————

用*得到函数参数的tuples


def print_args(A, *args):
    print ('Positional argument tuple:',args)

print (print_args('first one')) #get nothing

print (print_args(3,2,1,'wait!','uh...')) #get a tuple

——————————————

我TM是怎么了

怎么什么事都坚持不了

——————————————

每次进入学校就熊心勃勃

回到家就软了、嘛也不做





一临到该回学校的时间，我就努力工作
一回家就止不住的堕落

——————————————

Specify Default Parameter Values
指定预设参数值


def division(dividend, divisor=2):
    return dividend/divisor

print (division(dividend=16)) #get 8

——————————————

利用参数名称调用函数：


def division(dividend, divisor):
    return dividend/divisor

print (division(divisor=2, dividend=8))

——————————————

None Is Useful


None is a special Python value that holds a place when there is nothing to say.

Remember that zero-valued integers or floats, empty strings (''), lists ([]), tuples ((,)), dictionaries ({}), and sets(set()) are all False, but are not equal to None.

——————————————

return something


>>>def echo(anything):
...    return anything + ' ' + anything
...
>>>echo('you know')
'you know you know'

——————————————

Define a Python function, and use it:


>>>def How_about_your_feeling():
...print('Feels great!')
...

>>>How_about_your_feeling()
Feels great!

——————————————

Functions


A function can take any number and type of input parameters and return any number and type of output results.

You can do two things with a function:

• Define it 
• Call it

——————————————

还有就是，专业的力量

——————————————

每次发那些文字意义也不大

行动是最能感召人的

——————————————

Set Comprehensions
{ expression for expression in iterable }


>>>a_set={number for number in range(1,6) if number%3==1}
>>>a_set
{1,4}

意为取1到5，除3得到的余数为1的数

——————————————

可以把以前的list comprehension看作是有理解力的，带表达式、带逻辑判断的list。

同理，dict comprehensions也是有"理解力"的dict

——————————————

Dictionary Comprehensions
(递推式构造字典)


Not to be outdone by mere lists, dictionaries also have comprehensions. The simplest form looks familiar:
{ key_expression : value_expression for expression in iterable }

Similar to list comprehensions, dictionary comprehensions can also have if tests and multiple for clauses:

>>>word='letters'
>>>letter_counts={letter : word.count(letter) for letter in word}
>>>letter_counts
{'l':1,'e':2,'t':2,'r':1,'s':1}

We are running a loop over each of the seven letters in the string 'letters' and counting how many times that letter appears. Two of our uses of word.count(letter) are a waste of time because we have to count all the e’s twice and all the t’s twice. But, when we count the e’s the second time, we do no harm because we just replace the entry in the dictionary that was already there; the same goes for counting the t’s. So, the following would have been a teeny bit more Pythonic:

>>>word='letters'
>>>letter_counts={letter : word.count(letter) for letter in set(word)}
>>>letter_counts
{'t':2,'l':1,'e':2,'r':1,'s':1}

The dictionary’s keys are in a different order than the previous example, because iterating set(word) returns letters in a different order than iterating the string word.

word.count(letter)的含义是，数letter表示的单一字符在word表示的字符串中出现的次数。

其中为什么不出现两个t和e？那是因为字典的key值不允许重复，重复就跳过它。

——————————————

iterable

网络可迭代的; 可重复的; 迭代的;

——————————————

comprehension

理解力
包含力
理解练习
领悟能力
包括
含蓄
概括公理
【逻】内包
【修辞学】推知法
【宗】包容政策
会意
综合
领悟
学问

——————————————

其实就是说，只有自己承受痛苦，才能给别人带来欢乐

别人才会反馈给你那份欢乐

——————————————

如果我能时刻谨记遵循如下的话，应该就没问题：

54.不断的寻找痛苦，得到的即是欢乐;不断的寻找欢乐，得到的即是痛苦。

55.理想为你指明方向，现实为你奠定路基。

Clean and neat, with efficient for someone else.

——————————————

我也想朝那个方向发展

——————————————

不过他们是有正业的，能力强才能无私分享

——————————————

稍等，我给个截图

——————————————

http://www.bilibili.com/video/av4038922/

最后几句，志同道合啊

——————————————

突然发现我为什么喜欢doyoudo了

——————————————

那些视频在B站点击率不高啊

http://space.bilibili.com/20503549/#!/index

——————————————

@PS_URINE    你从哪儿得知的doyoudo?

——————————————

不过还是觉得这个好一点

正能量：
http://www.bilibili.com/video/av3927496/

——————————————

https://static-s.bilibili.com/miniloader.swf?aid=3709035&page=1

——————————————

想把想把想把，算吧算吧算吧

空空等待无用

——————————————

哦，那个我也晕


似乎要演算经验丰富，才能找到那构思巧妙的解法

——————————————

我虽然做不来综合题


但是各种单个知识还是会的

——————————————

我教你啊

——————————————

两个嵌套的结构不同，结果确是一样的

为了好看懂，可以用原始的for嵌套

为了代码少，可以用comprehension形式

——————————————

以Comprehension的形式对for进行嵌套：
[表达式 for 得值变量 in 数组 ... ]


Now, let’s use a comprehension and assign it to the variable cells, making it a list of (row, col) tuples:

rows=range(1,4)
cols=range(1,3)
cells=[(row,col) for row in rows for col in cols]
for cell in cells:
    print(cell)

注意，这里的comprehension构造，在括号里是从左向右运行的。

——————————————

List Comprehensions
(递推式构造列表)


looking something like this:
[ expression for item in iterable if condition ]
[表达式 for 得值变量 in 数组 if 条件]

Let’s make a new comprehension that builds a list of only the odd numbers between 1 and 5 (remember that number % 2 is True for odd numbers and False for even numbers):

a_list=[number for number in range(1,6) if number%2==1]
print (a_list)

——————————————

对for进行嵌套：


rows=range(1,4)
cols=range(1,3)
for row in rows:
    for col in cols:
        print(row,col)

——————————————

List Comprehensions
(递推式构造列表)


looking something like this:
[ expression for item in iterable if condition ]

Let’s make a new comprehension that builds a list of only the odd numbers between 1 and 5 (remember that number % 2 is True for odd numbers and False for even numbers):

a_list=[number for number in range(1,6) if number%2==1]
print (a_list)

——————————————

Generate Number Sequences with range()
用range()得到普通的数字序列

range( start, stop, step )


for i in range(0,3):
    print (i)

——————————————

用zip()结合tuples，进而转为list或dict：


english='Monday','Tuesday','Wednesday'
french='Lundi','Mardi','Mercredi'

#Use zip() to pair these tuples.
A=list(zip(english,french))
print (A)

#Feed the result of zip() directly to dict()
B=dict(zip(english,french))
print (B)

——————————————

zip() stops when the shortest sequence is done. so no one gets any pudding unless we extend the other lists.

——————————————

Iterate Multiple Sequences with zip()
用zip()循环复合队列


days=['Monday','Tuesday','Wednesday']
fruits=['banana','orange','peach']
drinks=['coffee','tea','beer']
desserts=['tiramisu','ice cream','pie','pudding']

for day,fruit,drink,dessert in zip(days,fruits,drinks,desserts):
    print(day,": drink",drink,"- eat",fruit,"- enjoy",dessert)

——————————————

Check break Use with else
用else检测break


在while或for的循环中，If break was not called, the else statement is run.

for i in [1,2,3,4,5]:
    if (i==-99):
        break
    print (i)
else:
    print ('you finished it, no break, isn\'t it?')

——————————————

在for循环中依然可以使用break跳出整个循环；continue跳过其下的代码开始下一次循环。

——————————————

得到整个items
for someone in Adict.items():
    print (someone)

——————————————

用for来重复dict：


Adict={'A':1,'B':2,'C':3}

得到keys
for someone in Adict.keys():
    print (someone)

得到values
for someone in Adict.values():
    print (someone)

——————————————

用for来重复：


A=['S','B','is','not','me']
for i in A:
    print(i)

——————————————

以后的代码就不再以编辑框的形式展出，直接以源码的形式给出。
至于运行结果，需要你自己尝试。

——————————————

@xioxin 你也在这儿，太巧了

——————————————

用continue跳过下面的代码，进入新的一次循环


>>> x = 1
>>> while x< 10:
...     x += 1
...     if (x<=7):
...         continue
...     print (x)
...
8
9
10
>>>

——————————————

用break退出while循环：


>>> x = 1
>>> while x<= 100:
...     print (x)
...     if (x==7):
...         break
...     x += 1
...
1
2
3
4
5
6
7
>>>

——————————————

用while()来循环：


>>>count = 1
>>>while count <= 5:
...       print(count)
...       count += 1
...
1
2
3
4
5
>>>

判断为真继续循环，判断为假退出循环

——————————————

什么被判定为假？


boolean
False
null
None
zero integer
0
zero float
0.0
empty string
''
empty list
[]
empty tuple
()
empty dict
{}
empty set
set()

除此之外都是真

——————————————

比较运算符事例：


>>>x=7

Now, let’s try some tests:

>>>x==5
False
>>>x==7
True
>>>5<x
True
>>>x<10
True

>>>5<x and x<10
True
>>>5<x or x<10
True
>>>5<x and x>10
False

>>>5<x and not x>10
True

>>>5<x<10
True
>>>5<x<10<999
True

——————————————

Python’s comparison operators are:
Python中的比较运算符是：


equality
==
inequality
!=
less than
<
less than or equal
<=
greater than
>
greater than or equal
>=
membership
in …

——————————————

一般每个代码块前的空格以4为单位。

——————————————

Compare with if, elif, and else
比较if, elif,和else


只是如果，否则
>>>disaster=True
>>>if disaster:
...       print("Woe!")
...else:
...       print("Whee!")
...
Woe!


• Assigned the boolean value True to the variable named disaster 
• Performed a conditional comparison by using if and else, executing different code depending on the value of disaster 
• Called the print() function to print some text


如果，否则如果(else if)，否则如果…否则
>>>color="puce"
>>>if color=="red":
...       print("It's a tomato")
...   elif color=="green":
...       print("It's a green pepper")
...   elif color=="bee purple":
...      print("I don't know what it is, but only bees can see it")
...   else:
...       print("I've never heard of the color")
...
I've never heard of the color

——————————————

#!/usr/bin/python3
# -*- codeing : UTF-8 -*-
import requests#调用requests
from bs4 import BeautifulSoup#调用BeautifulSoup

import io
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')#改变本地标准输出的默认编码；p.s:易语言就是这么干的，支持多数中文，避免乱码（使用IDE就不用以上三行）


def from_web_get_html(goal_website, from_website):
       true_host = from_website.replace('https://','').replace('http://','')#得到没有http的网址
       headers = {'Host':true_host,'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36','Accept-Encoding':'gzip, deflate, sdch','Accept-Language':'zh-CN,zh;q=0.8'}#伪装成浏览器
       html = requests.get(from_website, headers)#从原始地址，
       old_cookie = html.cookies#得到cookie
       html = requests.get(goal_website, headers=headers, cookies=old_cookie, allow_redirects=False)#用旧的cookie访问新地址
       html.encoding = 'utf-8'#转换下编码 
       result = html.text
       return result#返回网页源码

html_text=from_web_get_html('https://www.baidu.com/s?wd=hello&gpc=stf%3D1428837022%2C1460459421%7Cstftype%3D1', 'https://www.baidu.com')#通过给目标地址，和老的跳转地址得到源码

soup = BeautifulSoup(html_text, "html.parser")#调用强大的BeautifulSoup进行网页源码处理
#print (soup.title.text)#得到标题
#print (soup.prettify())#得到整理后美观的源码
print (soup.body.text)#得到网页主体内容





#参考资料：
#https://jecvay.com/category/smtech/python3-webbug
#https://www.crummy.com/software/BeautifulSoup/bs4/doc/index.zh.html
#http://blog.csdn.net/jim7424994/article/details/22675759
#https://www.google.com

——————————————

Continue Lines with \
用反斜线继续执行该行代码


如果一行代码超过80个字符，显得太长，不妨在该行结尾加一个\，这样在下一行写代码也相当于在同一行写。
>>>1+2+\
...3
6

——————————————

Python is unusual in this use of white space to define program structure.
Python因使用空格来定义程序结构而显得不寻常。

——————————————

Now you’ll see how to structure Python code, not just data.
现在你将看到如何组织Python代码，而不只是数据。

——————————————

总结：

In this chapter, you saw more complex data structures: lists, tuples, dictionaries, and sets.

——————————————

Make Bigger Data Structures
创建更大的数据结构

>>>marxes=['Groucho','Chico','Harpo']
>>>pythons=['Chapman','Cleese','Gilliam','Jones','Palin']
>>>stooges=['Moe','Curly','Larry']

用list作元素，创建tuple
>>>tuple_of_lists=marxes,pythons,stooges
>>>tuple_of_lists
(['Groucho','Chico','Harpo'],
['Chapman','Cleese','Gilliam','Jones','Palin'],
['Moe','Curly','Larry'])

用list作元素，创建list
>>>list_of_lists=[marxes,pythons,stooges]
>>>list_of_lists
[['Groucho','Chico','Harpo'],
['Chapman','Cleese','Gilliam','Jones','Palin'],
['Moe','Curly','Larry']]

用list作元素，创建字典
>>>dict_of_lists={'Marxes':marxes,'Pythons':pythons,'Stooges':stooges}
>>dict_of_lists
{'Stooges':['Moe','Curly','Larry'],
'Marxes':['Groucho','Chico','Harpo'],
'Pythons':['Chapman','Cleese','Gilliam','Jones','Palin']}

——————————————

Compare Data Structures
比较几种数据结构

To review: you make a list by using square brackets ([]), a tuple by using commas, and a dictionary by using curly brackets ({}). In each case, you access a single element with square brackets:

>>>marx_list=['Groucho','Chico','Harpo']
>>>marx_tuple='Groucho','Chico','Harpo'
>>>marx_dict={'Groucho':'banjo','Chico':'piano','Harpo':'harp'}
>>>marx_list[2]
'Harpo'
>>>marx_tuple[2]
'Harpo'
>>>marx_dict['Harpo']
'harp'

For the list and tuple, the value between the square brackets is an integer offset. For the dictionary, it’s a key. For all three, the result is a value.

——————————————

总结下问问题的方式：

1.谷歌
2.英文谷歌
3.github
4.别找了，没答案，telegram里面没活人了

——————————————

一时疏忽，忘了GitHub

——————————————

如果python不能用来做爬虫，要它何用

——————————————

软件需求分析：

1.首先，设定搜索关键词

2.然后，从搜索引擎第10页往后遍历

3.如果页面检测到网页同时包含百度盘链接与关键字密码
就将该链接与密码记录并有序写入txt文本

4.假设限定采集到7条信息后停止采集

5.输出给用户


改进第3点：
必须只含一个百度盘链接和一个关键词密码。取关键词密码后4位，不满4位遇空格则舍弃该页。


改进第3点：
同时提取网页标题


~~~~~~~~~~~~~~~~~~~~~~~~~~~~


原理分析：

1.需要寻找文本中的某个特定字符，得到它出现的次数，得到它本身或其后字符；可考虑使用正则表达式或核心字符操作库

2.需要得到一个网址的源代码；考虑用自带网络库或requests中的GET函数

3.需要了解搜索引擎的翻页方式，以便正确得到10页后的网址


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

模块分解：

一、得到网页源码

import requests #导入某网络模块

html = requests.get('http://www.dydog.org/star.php') #填入某网址

html.encoding = 'utf-8' #转码

print(html.text) #输出网页源码

************************

import requests

def from_web_get_html(website):
       headers = {'Host':'www.baidu.com','Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36','Accept-Encoding':'gzip, deflate, sdch','Accept-Language':'zh-CN,zh;q=0.8'}
       html = requests.get(website, headers)
       html.encoding = 'utf-8' 
       result = html.text
       return result
       
       
~~~~~~~~~~~~~~~~~~~

二、判断一段文本中是否含有一个http://yunpan.cn/和“码”

A_text = ''''
http://pan.baidu.com/s/1dDnqRdB 
访问码l20i'''#只有一个百度盘地址
B_text = '''
http://pan.baidu.com/s/1dDnqRdB 
访问码l20i
http://pan.baidu.com/s/1dDnqRdB 
访问码l20i'''#有多个百度盘地址

test_text = B_text#测试哪个文本
web_number =test_text.count('http://pan.baidu.com/s/')#百度盘链接个数
pass_number = test_text.count('码')#“密码”出现的次数

if (web_number == 1 and pass_number == 1):
    print ('true')#满足条件则输出ture
else:
    print ('false')

************************

def include_i_want_or_not(text):
       web_number = text.count('http://pan.baidu.com/s/')
       pass_number = text.count('码')
       if (web_number == 1 and pass_number == 1):
           return True
       else:
           return False
           
三、提取该网页的标题，百度盘链接以及密码

import re #导入正则表达式库 

title=re.search('<title😠.*?)</title>',html_text,re.S).group(1)#用正则表达式取第一个标题

先用find()找到http://pan.baidu.com/s/第一次出现的位置，
然后该位置+22，得到22到30的字符

密码同理

text='''
456456http://pan.baidu.com/s/1bnF6G0n465453密码：6fme罚款或控股卡怪'''

first_num = text.find('http://pan.baidu.com/s/')#得到这个链接第一次出现的位置
goal_num = first_num+23#将这个位置加上它本身的字符数23
print (text[goal_num:goal_num+8])#然后取得从目标位置到其后8位的字符（独一无二的字符，我们只需要它，貌似是短链接）

print ('\n')#换个行再说

first_num = text.find('码')
goal_num = first_num+2#将这个位置加上它本身的字符数2
print (text[goal_num:goal_num+6])#然后取得从目标位置到其后6位的字符（也就是访问码啦?）


************************

import re

def get_title(html_text): 
    title=re.search('<title😠.*?)</title>',html_text,re.S).group(1)
    return title

def get_words_after_special_words(txt,words,number):
    words_len = len(words)
    first_num = txt.find(words)
    goal_num = first_num+words_len
    return txt[goal_num:goal_num+number]


四、研究如何利用搜索词爬取搜索引擎，得到无尽的网页地址

https://www.baidu.com/s?wd=hello
发现不管怎么伪装，都会被百度跳到首页，求大神解答

——————————————

问一下，为什么我用python伪装了heards后

Get百度搜索，仍然会跳到首页？

——————————————

原理分析：

1.需要寻找文本中的某个特定字符，得到它出现的次数，得到它本身或其后字符；可考虑使用正则表达式或核心字符操作库

2.需要得到一个网址的源代码；考虑用自带网络库或requests中的GET函数

3.需要了解搜索引擎的翻页方式，以便正确得到10页后的网址

——————————————

改进第3点：

同时提取网页标题

——————————————

改进第3点：

必须只含一个百度盘链接和一个关键词"密码"。取关键词密码后4位，不满4位遇空格则舍弃该页。

——————————————

5.输出给用户

——————————————

4.假设限定采集到50条信息后停止采集

——————————————

3.如果页面检测到网页同时包含百度盘链接与关键字"密码"

就将该链接与密码记录并有序写入txt文本

——————————————

2.然后，从搜索引擎第10页往后遍历

——————————————

1.首先，设定搜索关键词

——————————————

实在睡不着，我们来构思一个软件开发项目：

——————————————

睡前感悟：

不管是做动漫也好，编程也好

大多数人，不过是在重复造轮子

——————————————

学CG的第三天，晚安

——————————————

不对，删除软件配置文件后

又有了


可能是以前误操作导致没有的



诶，不说了，极累，睡

——————————————

不过那是教程，实际上在我的R17版本里并没有粒子发射器什么的

——————————————

它这个粒子系统，动力学引擎，类模型

都是很方便的

——————————————

今天把C4D入门教程看完了

http://www.bilibili.com/mobile/video/av1002575.html#page=94

——————————————

set中的功能函数：


>>>a={1,2}
>>>b={2,3}

两种方式得到交集：
>>>a&b
{2}
>>>a.intersection(b)
{2}


两种方式得到并集：
>>>a|b
{1,2,3}
>>>a.union(b)
{1,2,3}

a减去b后剩余的元素：
>>>a-b
{1}
>>>a.difference(b)
{1}

a⊆b?
>>>a<=b
False
>>>a.issubset(b)
False

a⊇b?
>>>a>=b
False
>>>a.issuperset(b)
False

——————————————

Then, some interesting things happened.

——————————————

Create with set():

>>>set_numbers={0,2,4,6,8}
>>>set_numbers
{0,8,2,4,6}

——————————————

A set is like a dictionary with its values thrown away, leaving only the keys.

——————————————

以后的笔记没必要发中文了

小学生水平的英语，看不懂也别学编程了

——————————————

额

——————————————

瞬间就明白靠电脑为生的人为什么要买苹果了

——————————————

C4D预设有裸女模型

里面还有整个家居的模型，一帧的渲染就可以把我电脑搞崩溃…

——————————————

那个按键精灵已有，叫按键盒子





刚才去百度找免费女性模型，屁都没有

一搜谷歌，第一个就可以直接下载

又对国内失望一分

——————————————

估计以后做动画，做完就得睡觉…

——————————————

C4D渲染好慢

——————————————

就是女性模型

——————————————

我终于搞定了，在c4d中运行了一个裸女

——————————————

前几天想用易语言做个高级"按键精灵"

结果发现有些窗口既无类名又无标题

然后放弃了

——————————————

看来还是有这么多小伙伴以前用过易语言😂

——————————————

http://appnee.com/

this is a good place to download some IT resouces.

——————————————

pdf不好的地方在于，认不到的单词查起来困难


似乎网上没有 C++.Primer.Fifth.Edition
或
C++.Primer.plus.Six.Edition
排版较好的epub

——————————————

oreilly根本不出针对新手的c++书籍

——————————————

不好意思，没

——————————————

这些语言到后期十分庞大，我只想看看核心语法

——————————————

我真的要看这本书吗？

1995年出的，那时我还没出生

——————————————

哪个不学都会让这一切毫无意义

——————————————

学的东西很多

——————————————

分析时要用到深度学习

——————————————

win7

安卓

类似吧，应该要利用搜索引擎

——————————————

python的界面在学会大数据采集与分析之前不考虑

还是功能重要吧

不能华而不实

——————————————

hex

我认为我又陷入信息缺陷了

有什么好的编程群，拉我进去吧😳

——————————————

额，我现在只认为易做点小软件可以

——————————————

不过没关系，只是用来跨平台

——————————————

估计那玩意儿写桌面程序很吃力

——————————————

我有个梦想，就是有一天能自己用c++，写出程序来😃

——————————————

有木有推荐的，入门级c++

oreily的

——————————————

找新鲜感，单学一本我现在就腻了(看电影能解一时，不是长期办法)

——————————————

话说我偷的那些英语书里面c++一个都没有

想换着学都没有书

——————————————

你用的高级语言不是可以自定义类型吗？

——————————————

我要崩溃了

明明一个数组就能解决的东西

python搞好多出来

诸如lists,tuples,dict,sets

——————————————

copy()对dict同样适用：


>>>a={1:'A',2:'B'}
>>>b=a.copy()
{1: 'A', 2: 'B'}

——————————————

得到dict所有的key或值：


>>>signals={'green':'go','yellow':'go faster','red':'smile for the camera'}

得到所有key:
>>>list(signals.keys())
['green','red','yellow']

得到所有的value：
>>>list(signals.values())
['go','smile for thecamera','go faster']

得到所有的key与value
>>>list(signals.items())
[('green','go'),('red','smile for the camera'),('yellow','go faster')]

——————————————

Test for a Key by Using in:
用in检查一个key是否存在：


>>>Adict={'A':1,'B':2}
>>>'A' in Adict
True

——————————————

用.clear()删除dict所有项目：


>>>Adict={'A':1,'B':2}
>>>Adict.clear()
>>>Adict
{}

——————————————

人生中该走的弯路一个都不能少

——————————————

删除一个项目通过del name.[key]：


>>>Adict={'A':1,'B':2}
>>>del Adict['A']
>>>Adict
{'B': 2}

——————————————

Combine Dictionaries with update():
用update()结合更新dict：


>>>dict1={'A':1,'B':2}
>>>dict2={'C':3,'D':4,'A':999}
>>>dict1.update(dict2)
>>>dict1
{'A': 999, 'C': 3, 'B': 2, 'D': 4}

——————————————

Add or Change an Item by [ key ]:
通过[key]添加或改变dict中的一项：


如果dict中没有你指定的key，添加
>>>Adict={'A':1,'B':2}
>>>Adict['C']=3
>>>Adict
{'A': 1, 'C': 3, 'B': 2}

如果dict中有你指定的key，更新
>>>Adict={'A':1,'B':2}
>>>Adict['A']=999
>>>Adict
{'A': 999, 'B': 2}

——————————————

将其它类型转为dict：


从list
>>> a=[[1,2],[3,4]]
>>> dict(a)
{1: 2, 3: 4}

从tuple
>>>tol=(['a','b'],['c','d'],['e','f'])
>>>dict(tol)
{'c':'d','a':'b','e':'f'}

从文本list
>>>los=['ab','cd','ef']
>>>dict(los)
{'c':'d','a':'b','e':'f'}

从文本tuple
>>>tos=('ab','cd','ef')
>>>dict(tos)
{'c':'d','a':'b','e':'f'}

——————————————

用{}创建一个dict：


>>>empty_dict={}
>>>empty_dict
{}

>>>about_me={'name':'YS','years':'18'}
>>>about_me
{'name': 'YS', 'years': '18'}

——————————————

Dictionaries
字典

A dictionary is similar to a list, but the order of items doesn’t matter, and they aren’t selected by an offset such as 0 or 1.
字典与列表相似，但是它的顺序并不重要，它们不是通过诸如0或1这样的下标确定的。

Instead, you specify a unique key to associate with each value.
作为代替的，你指定一个特别的key来连接每个值。

This key is often a string, but it can actually be any of Python’s immutable types: boolean, integer, float, tuple, string, and others that you’ll see in later chapters.
key通常是文本，但是它确实能是任何Python的类型，如：逻辑型、整数型、浮点型、元组、文本型，和一些你会在后面看到的其它类型。

Dictionaries are mutable, so you can add, delete, and change their key-value elements.
字典是可变的，所以你可以添加、删除，和改变它们的key值所对应的元素。

——————————————

用tuple()得到一个tuple：


>>>marx_list=['Groucho','Chico','Harpo']
>>>tuple(marx_list)
('Groucho','Chico','Harpo')

——————————————

tuple快速赋值：


>>>he_said='shit'
>>>I_meanings='wow'

>>>He,I=he_said,I_meanings
>>>He
'shit'
>>>I
'wow'

——————————————

利用tuple快速赋值同类型的值：


>>>Atuple=('good','well')
>>>a,b=Atuple
>>>a
'good'
>>>b
'well'

——————————————

通过()创建tuple：


>>>empty_tuple=()
>>>empty_tuple
()

>>>many_tuple='Groucho','Chico','Harpo'
>>>many_tuple
('Groucho','Chico','Harpo')

>>>mix_tuple=('Groucho',77,'Harpo')
>>>mix_tuple)
('Groucho',77,'Harpo')

——————————————

Tuples，类似固定的list：


Similar to lists, tuples are sequences of arbitrary items.
类似于列表，tuples也是一种任意类型的序列。

Unlike lists, tuples are immutable, meaning you can’t add, delete, or change items after the tuple is defined.
不同于列表，tuples是不可变的，意味着在序列被确定之后，你不能添加、删除，或者改变序列。

So, a tuple is similar to a constant list.
所以，一个tuple类似于一个固定的列表。

——————————————

妈的，弄得我想学c++

语法好蛋疼

——————————————

赋值列表的变与不变：


改变原列表
>>>a=[1,2,3]
>>>b=a
>>>b[0]='surprise'
>>>a
['surprise',2,3]

不改变原列表
a=[1,2,3]
b=a.copy()
b[0]='surprise'
a

a=[1,2,3]
b=list(a)
b[0]='surprise'
a

a=[1,2,3]
b=a[:]
b[0]='surprise'
a

——————————————

len()取列表总项数


>>>marxes=['Groucho','Chico']
>>>len(marxes)
2

——————————————

用sort()重排序列表：


改变原列表，默认升序、字母表排列
>>>Alist = ['C','B','A']
>>>Alist.sort()
>>>Alist
['A', 'B', 'C']

新建列表，默认升序、字母表排列
>>>Alist = ['C','B','A']
>>>new_list = sorted(Alist)
>>>new_list
['A', 'B', 'C']

只能用sort排序含不同类型的列表：
>>>numbers=[2,1,4.0,3]
>>>numbers.sort()
>>>numbers
[1,2,3,4.0]

反转，降序排列
>>>numbers=[2,1,4.0,3]
>>>numbers.sort(reverse=True)
>>>numbers
[4.0,3,2,1]

——————————————

重温join()与split()：


>>>friends=['C++','Python','E']

>>>separator=' ** '
>>>joined=separator.join(friends)
>>>joined
'C++ ** Python ** E'

>>>separated=joined.split(separator)
>>>separated
['C++','Python','E']

>>>separated==friends
True

——————————————

取得一个值在列表出现的次数：


>>>country=['China','Japan','germany']
>>>country.count('China')
1

——————————————

用in检测列表中的某个值是否存在：


>>>country=['China','Japan','germany']
>>>'Japan' in country
True

——————————————

Find an Item’s Offset by Value with index():
查明一个项目在列表的下标，通过index(值)：


>>>country=['China','Japan','germany']
>>>country.index('China')
0

——————————————

其实我每过一章会统一整理的

得到全局观后可能会好很多

——————————————

你的意思是本身语法乱，还是我写得乱？

——————————————

通过下标显示并删除列表中的一项：


>>>marxes = ['Groucho','Chico','Harpo']
>>>marxes.pop(1)
'Chico'
>>>marxes
['Groucho','Harpo']

——————————————

Delete an Item by Value with remove()
删除一个项目通过 .remove(值)


>>>human = ['woman','man','child']
>>>human.remove('man')
>>>human
['woman', 'child']

——————————————

Delete an Item by Offset with del:
删除一个项目通过，del list_name[下标]：

>>>human = ['woman','man','child']
>>>del human[1]
>>>human
['woman', 'child']

——————————————

Add an Item by Offset with insert():
用下标为列表添加一个项目：

>>>marxes=['Groucho','Chico','Harpo','Zeppo']
>>>marxes.insert(3,'Gummo')
>>>marxes
['Groucho','Chico','Harpo','Gummo','Zeppo']

——————————————

使用extend() 或 += 为list增加单个元素：


>>>marxes=['Groucho','Chico','Harpo','Zeppo']
>>>others=['Gummo','Karl']
>>>marxes.extend(others)
>>>marxes
['Groucho','Chico','Harpo','Zeppo','Gummo','Karl']

>>>marxes=['Groucho','Chico','Harpo','Zeppo']
>>>others=['Gummo','Karl']
>>>marxes+=others
>>>marxes
['Groucho','Chico','Harpo','Zeppo','Gummo','Karl']

——————————————

为list追加list

>>>Alist = ['A']
>>>another_list = ['GG', 'boy']
>>>Alist.append(another_list)
>>>print (Alist)
['A', ['GG', 'boy']]

——————————————

用append()为list添加元素：


>>>Alist = ['A','B','C']
>>>Alist.append('D')
>>>print (Alist)
['A', 'B', 'C', 'D']

——————————————

用[strat:end;step]取list中一部分：


>>>Alist = [1,2,3,4,5,6,7]

>>>Alist[0:1]
[1]

>>>Alist[0:7:2]
[1, 3, 5, 7]

——————————————

上次那个不是十几行吗

——————————————

tired

——————————————

改变list列表的某项值：


>>>Alist = ['Get', 'up!']
>>>Alist[1] = 'down!'

>>>print (Alist)
['Get', 'down!']

——————————————

多重列表：


>>>sky = ['sparrow', 'batterfly']
>>>ground = ['tiger', 'monkey']
>>>sea = ['whale', 'shark', 666]

>>>all = [sky, ground, sea]

>>>all[0][1]
'batterfly'

>>>all[2][2]
666

——————————————

从列表中取出元素：


>>>Man=['YS','XiaoLi','Pea']

>>>Man[0]
'YS'
>>>Man[1]
'XiaoLi'
>>>Man[2]
'Pea'

>>>Man[-1]
'Pea'
>>>Man[-2]
'XiaoLi'
>>>Man[-3]
'YS'

>>>Man[77]
IndexError:list index out of range

——————————————

将其它类型转为list：


从文本
>>>list('cat')
['c','a','t']

从元组
>>>a_tuple=('do','not','worry')
>>>list(a_tuple)
['do','not','worry']

用分割法
>>>birthday='1/6/1952'
>>>birthday.split('/')
['1','6','1952']

>>>splitme='a/b//c/d///e'
>>>splitme.split('/')
['a','b','','c','d','','','e']

>>>splitme='a/b//c/d///e'
>>>splitme.split('//')
['a/b','c/d','/e']

——————————————

用[]或list()创建列表：


>>>empty_list=[]

>>>weekdays=['Monday','Tuesday','Wednesday','Thursday','Friday']

>>>names=['Graham','John','Terry','Terry','Michael']

>>>another_empty_list=list()

——————————————

关于Lists


Lists are good for keeping track of things by their order, especially when the order and contents might change. 
列表是好的，对于一些按顺序排列的事物，尤其当数据顺序和数据内容有可能改变时。

lists are mutable. 
列表是可变的。

You can change a list in-place, add new elements, and delete or overwrite existing elements.
可以更改列表，添加新的元素，删除或重写现有元素。

The same value can occur more than once in a list.
在列表中同样的值可以出现多次。

——————————————

小练习：输出一天有多少秒


day.py

day = 60*60*24
print ('seconds of a single day is :' + str(day))

——————————————

文本对齐：


text = '>_<'

中对齐
>>>text.center(30)
'             >_<              '

左对齐
>>>text.ljust(30)
'>_<                           '

右对齐
>>>text.rjust(30)
'                           >_<'

——————————————

英文大小写处理：


>>>en = 'i love English'

大写第一个单词的第一个字母
>>>en.capitalize()
'I love English'

大写每个单词的第一个字母
>>>en.title()
'I Love English'

将所有字母变成大写
>>>en.upper()
'I LOVE ENGLISH'

将所有字母变成小写
>>>en.lower()
'i love english'

大小写反转
>>>en.swapcase()
'I LOVE eNGLISH'

——————————————

删除文本中指定字符串：


>>>text = 'Smile...'
>>>text.strip('.')
'Smile'

——————————————

安卓上不支持中文

——————————————

玩玩文本：


>>>poem='''Rain is falling all around, 
It falls on field and tree, 
It rains on the umbrella here, 
And on the ships at sea.'''

得到前15个字符
>>>poem[:15]

得到诗歌的总字符数，包括空格与换行符
>>>len (poem)

以Rain开始？
>>>poem.startswith('Rain')

以sea.结束？
>>>poem.endswith('sea.')

寻找on在文中第一次出现的位置
>>>poem.find('on')

寻找on在文中最后一次出现的位置
>>>poem.rfind('on')

on在文中出现了几次呢？
>>>poem.count('on')

文中只有字母或数字吗？
>>>poem.isalnum()

——————————————

我用10几行就行了

——————————————

果然

——————————————

/py

print ('hello')

——————————————

你这个不好，
在安卓上用Qpython3可以调试

——————————————

NameError: name 'reply' is not defined

——————————————

高中数学也是从1开始

——————————————

用[ start : end : step ]取字符：


假设从1开始数字符个数，
[ 所取字符首字母下标值-1 : 所取字符尾字母下标值 : 每隔多少字符取一个+1 ]

• [:] 取整个字符串
• [ start :] 从指定字符位置到全文结束位置
• [: end ] 从全文开始位置到指定字符位置
• [ start : end ] 从指定开始位置到指定结束位置
• [ start : end : step ] 从指定开始位置到指定结束位置，每隔step-1个字符取一个字符


ABC = 'abcdefghijklmnopqrstuvwxyz'

ABC[20:]为 'uvwxyz'
ABC[10:]为 'klmnopqrstuvwxyz'
ABC[12:15]为 'mno'
ABC[-3:]为 'xyz'
ABC[18:-3]为 'stuvw'
ABC[::7]为 'ahov'
ABC[4:20:3]为 'ehknqt'

>>>print (ABC[:7])
abcdefg

>>>print (ABC[1:2])
b

——————————————

还是用中国人思维来看：

——————————————

c++和py的数组下标都是从0开始的

而我们学的数学和易语言中的数组下标是从1开始的

——————————————

似乎还是有问题，我要继续测试下

——————————————

用[ start : end : step ]取字符
[ 所取字符首字母下标值 : 所取字符尾字母下标值 : 每隔多少字符取一个+1 ]
：


• [:] 取整个字符串
• [ start :] 从指定字符位置到全文结束位置
• [: end ] 从全文开始位置到指定字符位置
• [ start : end ] 从指定开始位置到指定结束位置
• [ start : end : step ] 从指定开始位置到指定结束位置，每隔step-1个字符取一个字符


ABC = 'abcdefghijklmnopqrstuvwxyz'

ABC[20:]为 'uvwxyz'
ABC[10:]为 'klmnopqrstuvwxyz'
ABC[12:15]为 'mno'
ABC[-3:]为 'xyz'
ABC[18:-3]为 'stuvw'
ABC[::7]为 'ahov'
ABC[4:20:3]为 'ehknqt'

>>>print (ABC[:6])
abcdef

——————————————

更正一个东西：

——————————————

tired

——————————————

Grand Master Turing once dreamed that he was a machine. When he awoke he 
exclaimed: 

超级大师图灵曾梦见自己是一台机器，醒后他这样回忆： 

"I don't know whether I am Turing dreaming that I am a machine, or a machine 
dreaming that I am Turing!" 

“我不知道是图灵梦见自己变成机器还是机器梦见自己变成图灵。”

——————————————

用join()把list变为文本：


Alist = ['dog','cat','bird']
Astring = '; '.join(Alist)
print (Astring)

输出 'dog; cat; bird'

——————————————

用split()分割文本：


text = 'dog,cat,bird'
Alist = text.split(',')
print (Alist)

输出 ['dog','cat','bird']

——————————————

列表的定义：


A list is a sequence of values, separated by commas and surrounded by square brackets.

list就是由多个值组成的序列，并且它被方括号所包含，每个值用逗号隔开。

like this ['YS','Pea']

——————————————

len()

取字符串长度

——————————————

[ start : end : step ]
[ 所取字符首字母下标值-1 : 所取字符尾字母下标值-1 : 每隔多少字符取一个+1 ]

对字符串切片：



• [:] 取整个字符串
• [ start :] 从指定字符位置到全文结束位置
• [: end ] 从全文开始位置到指定位置
• [ start : end ] 从指定开始位置到指定结束位置
• [ start : end : step ] 从指定开始位置到指定结束位置，每隔step-1个字符取一个字符


ABC = 'abcdefghijklmnopqrstuvwxyz'

ABC[20:]为 'uvwxyz'
ABC[10:]为 'klmnopqrstuvwxyz'
ABC[12:15]为 'mno'
ABC[-3:]为 'xyz'
ABC[18:-3]为 'stuvw'
ABC[::7]为 'ahov'
ABC[4:20:3]为 'ehknqt'

That's all, thanks.

——————————————

替换字符串中字符：


sex = 'woman'
sex = sex.replace('wo','')

print (sex)
输出man

——————————————

用[]从字符串提取一个字符：


Astr="do you do!"

Astr[0]表示d
Astr[1]表示o
Astr[3]表示y
…
Astr[-1]表示!

print ( Astr[0] + Astr[1] + Astr[-1] )
输出do!

——————————————

print ('ok ' * 3 +'you win!')

输出ok ok ok you win!

——————————————

print ('I ' + 'love ' + 'you.')

拼接字符串输出I love you.

——————————————

有道理，上面只是用我的方式把书上的核心发上来

——————————————

print ('\n')
输出换行符

print ('\t')
输出TAB符

print ('\'') 或 print ('\"')
输出' 或 "

print ('\\')
输出\

——————————————

str()

可将其它类型数值转化为string文本型

——————————————

好了，趁着停电

用手机学习下py吧

——————————————

讨厌编程，太烦了

windows上写的不能在ios上、Android上运行

也不能在unix上运行

更不能在php服务器上运行

——————————————

是我多心了

酷Q一个账号登多了，会提醒创建快捷登陆…

——————————————

内含自启登录助手，以后可以用自己的电脑做服务器

——————————————

你用的什么hosting?

——————————————

不支持日语...


又没有事做了

——————————————

刚才那个划词还可以，不用翻墙

——————————————

我目前有用蓝灯与tunnello vpn

——————————————

有官网介绍吗？

——————————————

那个插件会不会很难？

——————————————

哪里有更方便的？

——————————————

不能翻译整个网页，要翻墙

——————————————

我也刚好想写那个，因为中国的翻译插件不好用

——————————————

你不是要写个火狐插件吗？研究得怎么样了？

——————————————

我恨日语
https://github.com/myuon/AI

——————————————

git上有什么关于人工智能、深度学习、大数据分析的开源项目吗？最好python

——————————————

但没有智能类的

——————————————

那好了，现在有什么软件需求呢？

我觉得我需要的软件已经有了

比如安卓模拟器

——————————————

我发现易语言某些外部模块的函数不支持dll，在dll里会出错

所以要么使用纯api，要么使用核心库

——————————————

看英语呀看英语

编程不看英语别想有什么进步

——————————————

原来py机器人如此简单

——————————————

#!/usr/bin/python3
# -*- codeing : UTF-8 -*-
import telepot  #引入机器人模块；如果没有，请在命令行写入pip install telepot 和pip install telepot
import time  #引入时间模块；如果没有，请在命令行写入pip install time

#如出错，请在python的安装目录下寻找pip.exe，将其拖入cmd窗口，再加上空格+install+空格+模块名


bot = telepot.Bot('121899714:AAFyTKIRyn3u3MCi_7DUBIDHFoABcahPM-Y')  #设置密匙(访问令牌)
#print (bot.getMe())  #得到这个机器人的信息

def handle_message(msg):  #这个函数用来接收新信息
       content_type, chat_type, chat_id = telepot.glance(msg)  #分别得到消息类型、聊天场所、聊天id
       print(content_type, chat_type, chat_id)
       print(msg[u'chat'][u'id'])  #输出聊天id
       print(msg[u'text'])  #输出消息内容
       bot.sendMessage(msg[u'chat'][u'id'], msg[u'text'])  #回复发送同样的内容
       
       #f = open('C:\\YS.png', 'rb')  #打开某个本地文件，并取得字节集
       #bot.sendPhoto(msg[u'chat'][u'id'], f)  #然后发给别人，还有sendAudio(), sendDocument(), sendSticker(), sendVideo(), and sendVoice()


bot.notifyOnMessage(handle_message)  #关联上面那个def函数用到的代码



while 1:  #为了保持程序运转，十秒一次
    time.sleep(10)

——————————————

使用搜索引擎，最好设置1年内

——————————————

mobi的书好一点，至少可以查生词

——————————————

我估计你看不懂

——————————————

go 49

——————————————

next

——————————————

不然你看下面的

——————————————

考不上重点中学的只能学易语言

——————————————

先看你的学习能力

——————————————

没有，易语言够用了

——————————————

注：亚健康是一种虚弱的状态

——————————————

没跑几步，回来感觉异常疲劳

没想到亚健康这么严重了

——————————————

不过主要还是用来做题与背单词

——————————————

话说用安卓模拟器看tumblr的视频很爽呢（你懂的）

——————————————

这是我接下来要发的dll中的一个函数

——————————————

先试试这个

——————————————

我给你个易语言的dll，你可不可以再次调用，然后用C语言做个dll？

——————————————

还是我被监视了？

——————————————

难道是小米有特权？

——————————————

不对，我的红米不用翻墙，新授权的这个要

——————————————

主要是腾讯请不到 数学家程序员

——————————————

telegram

——————————————

并且可以两个安卓同步一个账号

——————————————

得出结论，只有注册及第一次同步数据需要翻墙

——————————————

手机好像被墙了

——————————————

夜神安卓模拟器，设置成512内存，在电脑运行很流畅

——————————————

http://youerning.blog.51cto.com/10513771/1733534

看得我心惊肉跳，感觉背后不简单

——————————————

一口气看了50页introducting python

真是很爽，原来读原作比那些翻译作品好多了

那些翻译作品，原作者的幽默、风趣都变没了，只剩下冰冷冷的专业术语(暗指c++)

——————————————

但不管怎么说，要学好什么东西，要不戒掉手淫，要不热爱锻炼

——————————————

我查"数学"二字，得到的结果和高中课本上的相去甚远

——————————————

数学似乎却与英语不同

——————————————

不过呢，除了要求底层、效率的软件

易语言还是不错的，可以做一些日常软件

——————————————

易语言做不了手机端，你还要学吗？

——————————————

你怎么知道telegram的？

——————————————

In fact, i want to ask you, have you learned E language?

——————————————

OK, do you speak English?

——————————————

1+1=2

——————————————

新概念英语、疯狂英语、慢速英语、百词斩、美语电影，各种英语学习资料应有尽有

而数学则不然，我在现实生活中似乎很难得知有某套教程能满足从基础到高深的要求

那对于在数学学习中掉了链子的我，实在是很恼人的

——————————————

我学了一周多数学

深深的发现，基础的薄弱

——————————————

豌豆

有没有想过收集关于数学的资料

——————————————

明天去学校2诊

估计政治会考个“好成绩”

——————————————

用双引号表示文本

也有类.的用法

还有，函数也是  函数名.(参数)

——————————————

入门基础课做完了

——————————————

https://www.shiyanlou.com/


我发现python与易语言在文字处理方面很相似

——————————————

垃圾其次，下载更烦

——————————————

决定以后再不看中文编程类书籍了

——————————————

建议你用手机，蓝灯在网络稳定的情况下，还是挺持久的

——————————————

我这边电信、移动都未墙

——————————————

互动百科竟然是他创建的

394020613

——————————————

我觉得担心书不够看是多余的

http://www.pdfshu.org/?fenlei/20

——————————————

for learning

——————————————

I think it's probably still have one hundred book have to send.

——————————————

让家人陪我学习真的不好吗？

可我就是希望有人陪着，并分享一些有意义的东西。

——————————————

我爸冲过来，差点要打我

——————————————

还是被机智的我发现了秘密，继续上传...

——————————————

shit, 刚才卡成无响应，无法续传

不知道从何开始，还有200本

——————————————

我在想我是不是搞错什么了，我只想传封面带动物的的书

我以为oreilly全是动物书

——————————————

这些东西只要传上来了，传到其它就是秒传

——————————————

给计算机大一新生的建议给计算机大一新生的建议
评论 分享
1. 核心课 （数据结构算法、组原、os、编译、网络（tcp/ip、http部分））一定要弄懂。最好写相关的项目，比如写个parser或者内核什么的都是极好的。

2. 不要追新的技术，而是追业界普遍使用的技术。比如你追了c#，却发现业界不少由c#转java的；你追了xamarin，也说发现人家还是用java+as开发应用。其实业界还是喜欢久经考验的稳定技术。语言学精一个，了解多个。每种类型的框架（比如前端css，前端js，后端orm，后端mvc，模板引擎）先学一个，其他的需要了边学边用。

3. 早点去leetcode刷题，国内公司特别爱装逼考算法，不少都是原题，切记。

4. 注重面向对象，注重架构方面的东西，特别是设计模式，不仅仅是为了可维护性。你以后代码可能是给别人提供支持的，你写的接口很难用的话，天天会被人问候祖宗。

5. 技术问题学会抛弃百度，使用goole，使用github，使用stackoverflow。学会使用bash和git，特别是后者，备份恢复的时候你就明白了。

6. 英语达到能阅读原版文档的水平。

7. 多写代码，有些东西做的多了才能从理性认识向感性飞跃。但不是让你写一万行hello world，也不是让你写一大堆app。你每学一个新的知识，都写个相关的demo出来。你想想你自己写了个http server，虽然实际业务中用不到，面试的时候这么说，然后解释一下自己怎么做的，是不是很爽。

8. 看书之前先去豆瓣看书评，不要看国产的一些烂书。多看最佳实践，比如effective系列。你一个学生没啥项目经验，又不看别人的最佳实践，写出来的代码能用？

——————————————

以前绕的弯路可真多

http://it-ebooks.flygon.net/developer/

——————————————

全高清应该不算盗版吧？

——————————————

早知道了，中文书不多

——————————————

400 files...

little by little sending...

——————————————

翻遍百度，没找到让我感兴趣的源码


一个关于人工智能的都没有，一个复杂点的（高科技的）东西都没有

——————————————

那应该和我一样大

我在家，他在学校

——————————————

but the first step is download to my computer.

——————————————

完蛋，那人2015.8高三

现在应该大学了

——————————————

fly这人估计也高中，要不然联系联系

——————————————

我知道啊，关键我是安卓

——————————————

智器阅读又不支持epub

——————————————

不支持自定义横屏

——————————————

安卓的kindle感觉不好呢

——————————————

你用什么看？

——————————————

偷完，准备传书，pdf和epub，传哪种格式好呢？

——————————————

嗯，你认识他？

——————————————

正在做小偷

——————————————

o

——————————————

http://pan.baidu.com/share/home?uk=2214641459#category/type=0

这是那网上被撤销的部分资源

——————————————

http://www.salttiger.com/archives/


这也是牛人

——————————————

昨天在网上下了一晚编程电子书

发现oreilly出版的电子书最好，几乎都是文字版

——————————————

这种强烈的对比，才是许多人放不下易的原因吧

——————————————

易语言一个点击就可以搞完的事

它写了几千字。。。

http://www.doc88.com/p-1778082773975.html

——————————————

手机要准备三个浏览器，
一个看手机版，
一个看桌面版，
一个看国外

我的配置是，
QQ浏览器
海外lite UC
自由浏览

——————————————

又见牛逼者


http://bestcbooks.com/

——————————————

我发现我们这些人都有一个特点，那就是接受了太多西方文化

特别是电影中的思想



而那些东西在本土(即我国)，又根本得不到

这种理想与现实之间的差距，会不断的折磨你，直到你放弃或…

——————————————

you could do it.

——————————————

en

——————————————

https://github.com/scalingexcellence/scrapybook#to-use-docker-directly-without-installing-vagrant

——————————————

https://github.com/yingshaoxo/age-and-gender-detection-in-real-time-with-tensorflowjs

I wrote this after I get into node.js

——————————————

Basically, npm is a package manager for node.js

node.js is a software which enables JavaScript running on local

You can run xx.js with node xx.js

——————————————

This is what I did:

https://github.com/yingshaoxo/ML/tree/master/5.image_classification

——————————————

On the very bottom, all you need to do is: do things with one way!

After you can do many things, you'll then think about how you could do one thing with different way based on different circumstances.

If you, at the beginning, only has been taught or struggled in solving one thing in different way, then, I could say, you are useless! 

Because all you got or all you can do is solving 1 problem which maybe 1 + 1 = 2, while others could solve 20 times problem than you do.

That's why we encourage people to start from little, go far with much. 
(E-language->C++->Python->JavaScript->Kotlin->Golang->AI(ML))
(Windows->Deepin->Ubuntu->Popos->Kali->Lubuntu)

Don't be silly that think you could learn all those stuff from scratch easily.

Just say no to those details, start from the main ideas, start from what's essential.

With that, you'll be good at learning everything!

——————————————

https://github.com/automl/auto-sklearn/

OK，It's definitely good for applying without thinking.

——————————————

http://www.americanrhetoric.com/speeches/barbarajordan1976dnc.html


This man's speaking is very attractive, it maybe the best one I'v ever heard.

By learning this, reading English book will be much easier.(with a nice inner voice)

——————————————

https://medium.com/@julsimon/10-steps-on-the-road-to-deep-learning-part-1-f9e4b5c0a459

——————————————

Clustering: This is a type of problem where we group similar things together.

——————————————

http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/


I have a limited brain, which is a shame.

——————————————

https://medium.com/waymo/google-i-o-recap-turning-self-driving-cars-from-science-fiction-into-reality-with-the-help-of-ai-89dded40c63

——————————————

Just get started yet

——————————————

OK

I'm on my way




Learning Google AI tutorial by living record.

——————————————

@Malgan 

Have any idea?

——————————————

The problem is how

——————————————

The more touches on other fields, the more I'd like to begin my journey on tensorflow(or real ML project)

——————————————

https://developers.google.com/machine-learning/crash-course/ml-intro

——————————————

Can I ask you a question?

Why your nickname have turned back to non-English?

——————————————

Brainstorming！ Can not think any of relationships that is formed by the number attributes, but an AI model need that datasets

It could be my first project of deep learning

——————————————

https://youtu.be/-mu3TYZ_udM

——————————————

TensorFlow (@TensorFlow) Tweeted:
⚙️🎹📝 Automatic piano music transcription, with Magenta! 

Check out the new project (w/ source code &amp; model) 👇 https://t.co/kRpUJgzg6K https://twitter.com/TensorFlow/status/963186566867898374?ref_src=twcamp%5Eshare%7Ctwsrc%5Em5%7Ctwgr%5Eemail%7Ctwcon%5E7046%7Ctwterm%5E1

——————————————

https://goo.gl/R1kBdb

——————————————

Haven't start yet.

——————————————

Hi, friend, long time no see.

Presently, I have been busy with network adjustment. 

China University Net is definitely terrible more than you've ever imagine.

——————————————

Don't worry, I'm still in AI learning. 

I won't give up anyway.

——————————————

Then?

——————————————

You mean Information Technology is not necessarily related to programming?

——————————————

You know, I hate politics.

——————————————

Computer Science


But trust me, you won't have much choice if you are a art student.

——————————————

No, because of my poor scores on high school, so I have no choice but that.

——————————————

OK, thank you for your advice.


I think I'm already know Python, JavaScript, C++，there's no need to learn a new language perhaps.

And yes, learning a new library like tensorflow could be a good option for me.


By the way, next month I'm gonna go to university, my major subject is Railway Communication and Information Technology.
I may learn how to handle hardware in there.

——————————————

@Malgan 


A little bit tired I am.

What I supposed to do if I already know a certain of programming language very well?

——————————————

Check out @Sentdex's Tweet: https://twitter.com/Sentdex/status/899057144884015104?s=09

——————————————

OK, welcome to here.

——————————————

I'm a python engineer.

——————————————

Hi, my name is yingshaoxo.

——————————————

It's said that AI technology will change in every five years.

——————————————

That's nice, thank you.

——————————————

What?

——————————————

Deep learning just like human learning, for example, I don't know how to learn English actually, but when I saw a lot of sentences, I'll find the right pattern hidden in it.

——————————————

Self-learning

——————————————

I guess that's the simplest one.

——————————————

I'm not the kind of rich person.

——————————————

China

——————————————

Of cause I love reading

——————————————

You know, my English ability is unstable.

So I can't use it sometime.

It all depends on whether my mother language on my mind is weak or not.

For example, now, it's weak. So I can talk freely without any limitation.

——————————————

It's hard to have a nice talking.

Even on telegram.

——————————————

hi

——————————————

Yeah

——————————————

I have been learning New Concept English 4th book.

It's great, although its content seems a little bit old right now.

——————————————

https://www.wired.com/story/a-sons-race-to-give-his-dying-father-artificial-immortality/?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website

——————————————

https://medium.com/towards-data-science/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9

——————————————

What I should say if I sing a lot of song?

——————————————

Sing a song

——————————————

https://kg2.qq.com/node/play?s=4cEqoU4csrxQT4C9&shareuid=609b9b8620283382&topsource=a0_pn201001006_z11_u26635549_l0_t1501256709__

——————————————

Me too

——————————————

You should have

It's great

——————————————

Oh no

——————————————

Did you have Twitter account?

——————————————

+1

——————————————

But it's official, I trust it.

——————————————

It's a movie?

——————————————

Nobody's here

——————————————

AI

English

——————————————

Definitely yes

——————————————

You could call me yingshao

——————————————

good

——————————————

How old are you then?

——————————————

I'm 19 and from China.

——————————————

😁

——————————————

Is that place keeping war?

——————————————

Why

——————————————

I agree

——————————————

Because It's doesn't make sense to a remote friend, especially on internet.

——————————————

But I'm afraid I don't wanna answer that.

——————————————

It's the most common questions person ask me.

——————————————

OK

——————————————

Wow, why you search this ID of this group?

——————————————

hi, little girl

——————————————

https://t.co/ETlJyup28f

——————————————

Building a Real-Time Object Recognition App with Tensorflow and OpenCV
https://medium.com/towards-data-science/building-a-real-time-object-recognition-app-with-tensorflow-and-opencv-b7a2b4ebdc32

——————————————

fine

——————————————

Maybe I spent very much time in front of computer.

——————————————

I got hemorrhoids suddenly somehow.

——————————————

I need surgery after tomorrow.

——————————————

Oh, today I went to hospital.

——————————————

yeah, me too.

But I also have to sleep now, sorry.

I'll see you tomorrow.

——————————————

https://www.google.com/webhp?doodle=32501999-0ACA0g0ACA0EIA0Q0I0C0A0CBA0AECcO0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A0A100a0

——————————————

https://youtu.be/5e0TbyCkbCY

——————————————

Because inception is just a picture classification.

——————————————

A few months ago, I trained a model for human recognize using inception 3.

It works fine, but the only problem is it can't find where the object is.

So simple classification is useless.

——————————————

And after learned it, you'll know how big the programming world is.

Algorithm, Math theory etc.

Then you'll feel like you want to start from foundation.

——————————————

Artificial Intelligence

——————————————

Telegram full of man

——————————————

I would be happy if you can invite some girl to here

@Shinohara_Rin

——————————————

@Malgan

Here

——————————————

He will help you in Java, Python, security etc.

——————————————

Malgan is a nice guy

——————————————

https://www.programiz.com/cpp-programming/virtual-functions

This website also provides good knowledge.

——————————————

https://www.tutorialspoint.com/cplusplus/

And 

Google

And

The C++ Programming Language 4th

——————————————

I choose C++ finally.

——————————————

If I want to learn a new language, which one you would recommend?

——————————————

good

——————————————

Are you single?

——————————————

You don't understand, I like quiet and peace.

——————————————

Did you feel sad?

——————————————

She is not independent

——————————————

Sorry, now i've kind of busy.

——————————————

no

——————————————

wow

——————————————

So you came from captital city?

——————————————

https://www.google.com/search?q=uzbekistan+people&newwindow=1&tbm=isch&tbo=u&source=univ&sa=X&ved=0ahUKEwiYs5Wo0vnTAhUO82MKHTpLC9wQsAQIIg&biw=1920&bih=936

They are just like Chinese...

——————————————

sleep in the day

——————————————

https://python-telegram-bot.org/
This would be better document

——————————————

https://github.com/eternnoir/pyTelegramBotAPI

——————————————

No, you should use python lib

——————————————

Telegram bot or Java or docker?

——————————————

What document?

——————————————

Recently, I've learned how to use docker.

——————————————

Don't mind, I just enjoy sharing things.

——————————————

Happy morning, sir.

——————————————

.

——————————————

I think so,

——————————————

OK, not Ok

——————————————

Forget about it, let's go and do our own job.

——————————————

I do not like fighting pictures, I am civilized

——————————————

Who brought this man?

——————————————

I like this kind of feeling

——————————————

Although I am not afraid

——————————————

I think I was threatened

——————————————

Oh, my fault

——————————————

girlfrind is not friend and woman?

——————————————

At present you are the girlfriend I have in telegram.

——————————————

I have not chatted with girls for a long time, I am very grateful to you.

——————————————

Do not you think it's hard to talk to us?

——————————————

https://translate.google.com.hk/#zh-CN/en/

——————————————

Google is good, anyway

——————————————

I used Huawei flat, the school in order to "wisdom classroom" unified request to buy. Originally the system is locked, can only be used to learn, I just crack it, you can when the normal machine (equipment) to play

——————————————

I can't believe you playing your Android device on classroom.

——————————————

Is it home?

——————————————

Maybe he didn't see your picture

You need to send it again

——————————————

Now you got me

——————————————

Because I haven't much confidence.

——————————————

You are beautiful.

——————————————

17

——————————————

next month

2017.6.9

——————————————

Here is a book I recommend to you:

——————————————

is it you?

——————————————

2 or 3 years.

——————————————

Or you guys just working alone.

——————————————

...
It's a long way to go, I guess.

——————————————

Sure, you should have some programmer friends too.

Can you invite them to this group?

——————————————

Wow, spend five years studying medicine.

——————————————

Which university you'd like to go if you already mastered Chinese?

——————————————

It's unbelievable

——————————————

Why you want to learn Chinese before?

——————————————

The main problem between you and me is language.

There are a lot of things I can't express in English freely.

——————————————

wow, what's your on youtube?

——————————————

I checked your twitter

——————————————

@Malgan came from USA.

He's a real programmer.

——————————————

oh, I see

——————————————

We'll be friends together!

——————————————

nice!

——————————————

He's you husband?

——————————————

night

——————————————

19

——————————————

I know😄

——————————————

yes

——————————————

Yes, if we get less features than a normal condition on a object, we may not correctly guess what it is.

——————————————

We human do the things as the same way.

——————————————

Exactly

——————————————

https://deeplearningsandbox.com/how-to-build-an-image-recognition-system-using-keras-and-tensorflow-for-a-1000-everyday-object-559856e04699

——————————————

https://leonardoaraujosantos.gitbooks.io/artificial-inteligence/content/object_localization_and_detection.html

——————————————

https://medium.com/@harvitronix/continuous-online-video-classification-with-tensorflow-inception-and-a-raspberry-pi-785c8b1e13e1

——————————————

When we do machine learning, actually, we are doing statistic.

——————————————

How to read this wordℓ?

——————————————

I fell great watching TV or movie in two time speed.

——————————————

you I we have

it he her has

——————————————

One thing is for sure: machine learning theory based on human learning theory.

So, most of the time, our learning life highly related with machine learning theory.

For example, testing: first you need to learn some example questions, which we called labeled data-set. Then you need  to solve some new questions which you has never seen before. Recical this process until you get good predictions.

——————————————

Yeah, I firmly believe this knowledge belongs to university.

——————————————

This picture just confusing.

——————————————

https://terrariumtv.com

Nice APP

——————————————

I don't think it's good at all.

You know, one man can't rely on one point to support the whole building.

——————————————

123moviesfree.com/watch/supergirl-s02-2015-i.2-online-free-123movies.html

——————————————

ML021: http://www.youtube.com/playlist?list=PLGXfJorQS7_Mv8FXfRRNYyxHl9kaP1zga

——————————————

When I really got into ML, I found that those ML nouns in Chinese become vivid in my mind.

——————————————

it looks like life satisfaction goes up more or less linearly as the country’s GDP per capita increases.

——————————————

I truly believe this just a basic linear function.

——————————————

A big challenge with online learning is that if bad data is fed to the system, the system’s performance will gradually decline. 


So now, I have evidence to say, our brain is a natural online learning system.

——————————————

One important parameter of online learning systems is how fast they should adapt to changing data: this is called the learning rate. If you set a high learning rate, then your system will rapidly adapt to new data, but it will also tend to quickly forget the old data (you don’t want a spam filter to flag only the latest kinds of spam it was shown). 




This explained why I'll gradually forget what I have learned. That's because I was learning something new.

——————————————

So I deleted it.

——————————————

No, the whole book.

——————————————

It's not easy to search one AI book that really benefit for learning.

——————————————

To be honest, I can't understand what it said.

——————————————

"Hands-on MachineLearning with scikit-learn and Tensorflow"

It's a book, and I can't find a eBook version.

——————————————

Neural layer simulation

——————————————

We call it deep learning

——————————————

https://youtu.be/nWJZ4w0HKz8

Cool, he almost completed it.

——————————————

Auto fowwlong people

——————————————

http://www.exhaustingacrowd.com/london

——————————————

no problem😁

——————————————

Can you give me your chrome bookmarks? 
Just convert it to html, then upload to this website.

http://yingshaoxo.cf:8888/main/

——————————————

https://aiexperiments.withgoogle.com/ 

Look at this, just amazing!

——————————————

Of course

——————————————

https://youtu.be/CLFp9D9-0Eo



So crazy about building an AI with GAT...

——————————————

If I do this job, I could living in my home with my computer, like a real programmer do.

——————————————

I have to live myself.

In China, it's illegal.

——————————————

If I told you I want to built a website severing NFSW things, would you think?

——————————————

Strange, somebody suddenly add me.

——————————————

Hey, it's you?

——————————————

Yeah, but I prefer to use model than original API.

——————————————

Nothing happened

——————————————

@XiaoyaBot

——————————————

test

——————————————

I drawed this.

——————————————

https://www.blog.google/topics/machine-learning/fast-drawing-everyone/

——————————————

I guess man should have dreams.

——————————————

I guess I'll use bot to delete all those messages which aren't English.

——————————————

557路

——————————————

学习的正确之道：在重复同一任务工作的每一个loop添加新东西

——————————————

社交圈真人头像

女按丑排名，越丑越前

男按帅

——————————————

认识朋友的局限

老是认识和自己相似的朋友，朋友能做的，自己能做，朋友帮不上忙

自己不能做的，朋友也不能做，朋友帮不上忙

——————————————

Learn by examples, learn by data, that's the only way which gonna work.

——————————————

Where am I in life


single: 20 years

no sex: very want

health: not great, but OK

student & programmer: bad student, medium programmer

poor family: very poor

——————————————

我无法表达的，

我也无法学会。 - inspired by deep learning

——————————————

这个问题我来回答：5-10本英文书; 巅峰时刻连续一个月每天看500+的英文网页或文章;自从我开眼后，每天都有那么几句是和美籍人士交流;我所有的阶段性知识获取都写了对应的英文blog;现在1/2的大脑被英文霸占，高数、编程、AI知识全部基于英文

——————————————

乐嘉

——————————————

AI万能学习大法

1. 花几个月瞎鸡巴学一气，熟悉各种专业名词的英文含义，也代表初略了解其原理

2. 看absolutely for beginners系列

3. 学skit-learn，掌握传统机器学习技术

4. deep learning( 运行各种 keras 实例

——————————————

When I saw those programmers, 

I'm not seeing some ordinary individuals, but instead, 

many great man who dare to fight the fate, 

who dare to fight the wrongs, 

who never easily give up,

who we can say that they are pioneers.

——————————————

The thing that really killing me is being normal, being ordinary.

Those shit will never understood what I'm looking for, what I'm dieing to achieve.

They are just live in their stupid numb life without knowing anything behind the lights.

——————————————

三、示爱艺术

直接法(痛快一点、面对面挑明，前提是有交往、有好感)

渐进法(占座、打饭、送粥、写东西、开车…)

暗示法(没好感的情况下可能无效)

情书法(实话、有文采、能被公开、能被看出志向、可信赖)

委托法(让人带话，不建议)

结论：艺术使人幸福、艺术“不可复制”、艺术需要创造

——————————————

二、择偶方式

自己结识
公开征婚(研究婚恋节目，从中学习)
委托介绍(对硬件要求高)
媒人介绍(有夸大之嫌)

——————————————

归零：原先的 1或0 用 10或01 表示

不归零：非0即1



双极性：1或-1

单极性：1或0

——————————————

恋爱之道 - 艾跃进


一、总体要求
注意事项: 
0.想清楚爱一个人的哪些地方(你了解对方多少)
1.找与自己价值观相近的人(有共同志趣)
2.遵守法律，不可强求
3.符合道德，有责任意识，忠一

具体要求：
1.人品高尚
2.学识相当
3.长相端庄
4.家教相当
5.性格相符
6.气味相投(闻香识*人(吸引你))

结论：此事古难全，(有3条就好)，仅供参考

——————————————

论精英阶层与平民阶级的和平共处

——————————————

开源的本质是：

开源者不需要从这个项目得到 Money，但他希望这个行业能够持续快速地发展。

——————————————

没有市场竞争谈创新是空想，根本没动力：这个可以用，继续用，反正没人和我抢饭碗(垄断)，为什么要大费周折搞创新？

你党就是没竞争，你党控制下不可能有创新


你党言论审查的重点就是扼杀一切可能和党管控的一切形成竞争的势力

——————————————

yingshao xo:
So what is intelligence?


正确的学习算法
+
足够且有效的数据资源
+
长时间勤奋地训练
+
一个可记忆的容器
+
可再次获得数据的传感器
+
可自由执行决策的身体

——————————————

服务器IP：104.207.129.40
主端口：12345
UUID：a993c921-10ee-4bdd-8441-950396d337ec
alter ID: 100
加密方式：None
传输方式：tcp
TLS：关闭

——————————————

腿部压力检测，如果超出自身重量太多，蹲下

每个攻击动作都要有起身的效果

头部360度检测(或用三个距离传感器检测正面)，储存最近满足距离条件的物体方位(没方位负数)；主loop负责其他低级传感器

没动作不能超过10秒，超时起身

后倒检测，防止倒下


黑传感器检测，前扑


抖动防御

——————————————

技术分析：

这里的代码，由于只用到了传感器，阈值就显得非常重要，因为`检测黑线`以及`碰到全黑前进`很重要，所以实际比赛把模拟值调高`30%到50%`是比较好的。。。。可惜当时我忘了。

——————————————

我们所做的事

无非是用技术对权力和财产进行重新分配

也就是用个人奋斗突破血缘亲族的枷锁

——————————————

https://raw.githubusercontent.com/yingshaoxo/driver/current/driver.ino

——————————————

现在我知道学校买的那块板是仿造的谁了

——————————————

两级分化严重

不学AI，被时代淘汰

学AI，远离SB，远离嘈杂的环境，一心扎进知识的海洋不要自拔

——————————————

task 1: AI learning, read book and do experiences

task 2: 三端融合 (Android, Web, Server)
yingshaoxo'app | Kotlin 做原生才能做到的事，APP框架
WebMathChat | JavaScript 在 web view 里配合 Kotlin 做离线界面与普通运算
KingChat | Python 在后端负责 API, database, AI 等复杂运算，为 web view 有网状态提供服务
Useful Golang | Golang 在后端负责 serve static files 与 替换 Apache 的功能

task 3: School knowledge, including English, Mathematics

task 4: Robot match


4个任务并行，由前到后重要性递减

——————————————

下一个安卓 APP，滑动化无设置风格

——————————————

针对同学们的问题做一个统一回答：
1.学制二年。课程全部在南铁院内完成。
2.13门课在前3个学期完成，第4个学期完成论文。
3.英语+3门学位课满足条件，可以申请学士学位。
4.报名表中“尚未取得学分课程”指的是挂科情况。
5.先填写报名表进行预报名。统一通知大家报名和缴费。
6.同学们如果已参加过自考，通过了的公共课程，英语二，马原，现代史等，成绩仍然有效。
7.马原，现代史2门公共课可以安排开设选修课，有合格成绩的可以免考
8.英语过四级可以免考。过四级满足学位条件
9.有3门课是校考课程，不需要参加统考。
10.一共13门课，期中校考3门，开设公选课2门，剩余8门课需要参加统考。若四级已过，则余7门统考课程。
11.统考课程成绩=统考成绩*70%+平时成绩*30%
12.毕业以后无法到校上课，可以自学，回南京考试。有平时成绩。
13.学历证书上盖两个章，南京大学和江苏省自考委员会。学位证书上盖一个章，南京邮电大学。

——————————————

我突然想到了

你们设备上的系统，没有一个是国产的

你们用的所有软件、玩的所有游戏，技术上全部基于国外开源

——————————————

我在无尽的时空穿梭却只为找到你，there's nothing I can change, 你是我的唯一

——————————————

18001565931

——————————————

45
285
45

床上高度

——————————————

职业程序员 never give up.

——————————————

https://youtu.be/iANOSneQN2k

先进的生产力(高效)会促进社会变革

过程：就模式产业工人失业→人们学习新技能、开拓新领域→就业

——————————————

机器学习的大训练策略叫做 总

中间过程的 data 叫做 分

最后结果 叫做 总

但两个 总 是不同的，前一个是表面的总，后一个是难以理解的混合了太多细节的 总

所以语文上的 总－分－总 构架恰恰勾勒出了人类学习的基本模式

——————————————

由 deep learning 的训练过程又可知，我们光有智力容器是不够的，需要有个更高智慧去指导你，教你训练策略和收集合适的 data

这个更高级智慧在当代，往远了说是社会，往近了讲是父母

如果没有这个更高级的智慧做指导，结局就像“狼孩”，有智力容器也没用

——————————————

If you go to grub terminal by accident, do this (* is the number of your system root driver): 

grub> set root=(hd0,gpt*) 
grub> linux /vmlinuz root=/dev/sda* 
grub> initrd /initrd.img 
grub> boot

——————————————

Kali installation, It's all about choice.


-1. format your disk using PE system, we need a clear disk, or something will going wrong

0. use refus  to make USB driver
 
1. just to be safe, use MBR based mix mode

2. use dd mode to defend Wi-Fi firmware missing (iso file belongs to Windows, and Windows is bad on drivers)

3. if you can disable secure boot, you can use UEFI in installation, else just use BIOS

4. if you failed, try more option in 3 step.

5. links may help
https://null-byte.wonderhowto.com/forum/fix-failed-detect-and-mount-cd-rom-problem-when-installing-kali-linux-0177158/
https://forums.kali.org/showthread.php?35926-Executing-grub-install-dummy-failed
https://wiki.deepin.org/index.php?title=Repair_Boot
https://www.linux.com/learn/how-rescue-non-booting-grub-2-Linux

——————————————

https://null-byte.wonderhowto.com/forum/fix-failed-detect-and-mount-cd-rom-problem-when-installing-kali-linux-0177158/

——————————————

iptables -t nat -A PREROUTING -p udp --dport 53 -m string --algo bm --from 20 --hex-string "|024a4a0364615000|" -j REDIRECT --to-ports 5353

——————————————

2001:19f0:5:29f1:5400:01ff:fe4c:348d

ssr://MTA4LjYxLjE1Ny4yNDM6MTA4ODphdXRoX2NoYWluX2E6Y2hhY2hhMjAtaWV0ZjpodHRwX3NpbXBsZTplV2x1WjNOb1lXOTRiekU1T1Rn

——————————————

remote aop.gd10010.cn 443
Host aop.gd10010.cn
http-proxy ip 8080
联通，免大部分省份！！！！！

——————————————

华为解锁:
1942481438189172

——————————————

【笔记本电脑支架 可折叠托架宿舍床上用多功能懒人电脑架增高架子】 http://v.cvz5.com/h.EEQkDi
60°
255°
75°


加上 【海贝丽懒人沙发榻榻米可折叠单人小沙发床上电脑靠背椅子地板沙发】 http://v.cvz5.com/h.EEkjIJ
120°


完美 coding 环境

——————————————

101.236.28.129

root

asdfjkl;


ssh root@101.236.28.129

——————————————

6236441371020081168

——————————————

561823

——————————————

新闻源

房产、互联网娱乐与交易
http://www.williamlong.info/archives/5123.html

——————————————

成人之所以为成人，是因为知道一样事情对他有利，即使不乐意，也会去做。

短期利益服从长期利益。

——————————————

斐讯PSG1208适用于斐讯K1和K2使用，之前分享的是去年的最稳定的版本，这里专门分享它的最新版，目前是今年7.1日版，改的华硕适用于7620老毛子Padavan固件。

新固件网关：192.168.123.1
管理页面：http://my.router/
管理账号：admin/admin
wifi:1234567890
刷机不恢复默认值

清除配置方法：
由于刷机不清除配置，如果按键10秒也不能清除配置，或者开机后不能启动，可能是配置冲突，需要手动清除配置(nvram)重置机器。

http://www.upantool.com/gujian/asus/11050.html

——————————————

hexchars="0123456789ABCDEF"

end=$( for i in {1..10} ; do echo -n ${hexchars:$(( $RANDOM % 16 )):1} ; done | sed -e 's/\(..\)/:\1/g' )

MAC=00$end

 

service network-manager stop

ifconfig eth2.2 down

ifconfig eth2.2 hw ether $MAC

ifconfig eth2.2 up

service network-manager start


if [[ $(wget www.qq.com -O-) ]] 2>/dev/null
then 
    echo "This page exists, so you got the right Internet accese"
else
    echo "This page does not exist, so you have to connect to Internet first."
    curl -XPOST -H 'Origin: http://192.168.138.180' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 Chrome/59.0.3071.109 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'DNT: 1' -H 'Referer: http://192.168.138.180/a70.htm' -H 'Accept-Encoding: gzip, deflate' -H 'Cookie: DDDDD=1756670231; md5_login=1756670231%7C; networkMode=3' -H 'Content-Length: 80' -H 'Cache-Control: max-age=0' -H 'Upgrade-Insecure-Requests: 1' -H 'Accept-Language: en-US,en;q=0.8' -d 'DDDDD=1756670231%40unicom&upass=199803292332&R1=0&R2=&R6=0&para=00&0MKKey=123456' 'http://192.168.138.180/a70.htm'
fi

——————————————

1756670231


199803292332

——————————————

Essence of linear algebra: http://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab

——————————————

Pea email: peashooter6426@gmail.com

——————————————

https://movie.douban.com/explore#!type=movie&tag=%E7%A7%91%E5%B9%BB&sort=time&page_limit=20&page_start=20

少于6分、电视剧、未引入中国的日本片 就别看了

——————————————

DNS: 139.199.219.25

——————————————

报名号：17511301121817
准考证：130113809
身份证：511602199803292332
学号：1756670231
密　码：1576570260

——————————————

Set proxy to docker


sudo vim /etc/default/docker
service docker restart

——————————————

Petitemarie

——————————————

但有时候人生是有点不公平


如果你认识一个英语大神，你会发现它每天都不看课本，全是课外自己搜集的资料，它也不听老师讲课，TED、NCE、美剧轮番轰炸


同理，你如果认识一个物理学大佬，他可能也不按常理出牌，每天想的事、故意接触的事也和你不一样，你和它的不同就完全取决于它接触的正确的事太多，你接触的错误的事太多。


很可惜，从小到大就没认识一个英语大神，除了误打误撞的李阳先生。现在我也变成了大神，然后就发现我身边全是大神，你说虐不虐？(成为大神能提高遇到大神的几率，而遇到大神会提高成为大神的几率)

——————————————

561823

passwd for money

——————————————

Future 是可以 cancel 的(充当 coroutine 实际执行中的控制小把手)


Loop 是可以 stop 的


Loop 停了还可以再运行，

一种方法是手动给 future 到 loop.run_until_complete()，
# 你给 coroutine 也行，会自动转换成 future

另一种方法是提前用 asyncio.ensure_future() 把 coroutine 转化为 future 并自动添加到 loop队列，再用 loop.run_forever() 开始循环任务
# 运行到你使用loop.stop()为止，并不是永远

——————————————

read: BV3QIPPRCKBSZG73BNRTRGDJ6C7N22LM5

read and write: AWBPM7YORLWG3JRNQLCZFNFBWPBFQUGUZ

——————————————

宽带信息

账号：94133001915
密码：006483

——————————————

我可能没病😂

——————————————

懦夫，不敢露脸

——————————————

只有公费和少劳多得的钱会被铺张浪费

——————————————

没了外网我什么也不是(没了资源我什么也不是


本来智能就是靠数据去堆(训练




专制政府把我们的下载速度降到几k一秒

本质上就是希望我们都变成笨蛋

——————————————

以前一直纠结周杰伦的 范特西 是什么意思


最近有一天突然明白了：fantasy

——————————————

精神病也需要听歌

——————————————

http://music.163.com/song/19292984/?userid=280429778 (来自@网易云音乐)

——————————————

穷人做不了硬件：没钱买元件

富人做不了软件：有钱买服务

——————————————

我突然觉得大学的考试是个笑话(一个努力学习一个学期的人和努力作弊2、3天的人 没差几分)

以后谁也别让我考 60<x<65

——————————————

That's good

——————————————

I'm so alone somehow

——————————————

1576570260

——————————————

Of course

——————————————

So why you have to chat?

——————————————

那你是感到无聊？

——————————————

放假了

——————————————

没有

——————————————

经过这几天的大学期末考试

我了解到了：通过 对机器学习基本原理的掌握 和 不断的学习训练 ，我们可以随意控制自己的学习行为，

快可在一个晚自习掌握 一整本书(documents)(但会快速忘记)，

慢可以一个学期入门 一个新领域(subject)(永生难忘)

——————————————

https://github.com/expectocode/telegram-export#telegram-export-vs-telegram-history-dump




I'll dig into it tomorrow.

——————————————

下一个 AI project 是 text classification

用来把我的言论和别人的言论分开(要是telegram可以得到我之前说过的所有话就好了

——————————————

Cookie 是保存于整个 namespace 的，而不是单一 page



我现在有底气了，这个方法可行

——————————————

https://parceljs.org/getting_started.html

parcel 确实高效


parcel index.html 自动重载 when codes has changed

parcel build index.js 可以只生成 index.js 在 dist目录，那就是我们要的单 js file

——————————————

https://youtu.be/tjsHSIG8I08

我看完了

智力创造方法，方法创造答案

例子产生类比，类比创造智力

——————————————

明天试试

如果可以



以后 web development 就轻松了

——————————————

Well

webpack defaulted building main.js





原来我以前都不是用的默认配置

——————————————

我去

JavaScript部分都写出来了

不知道怎么把它加在django

让每一次加载网页都运行一下那个 JS script





 话说唯一可行的办法就是用 node.js 生成不带 index.html 的纯JavaScript

然后让 django template 的 base.html 加载它

从而实现全站加载该 js script





我得去查查

——————————————

再苦再累也得做

谁叫我当初选择了这条路





不能当懦夫，不能半途而废

——————————————

想想还是灌数据炼model简单…

——————————————

这不是重点

重点是我一想到要用django构建一整套系统就头疼

——————————————

逛b站突然发现一个惊人的事实：B站也是用的bootstrap做界面

——————————————

1.2米感觉有点短

建议你们买1.6*0.6*0.75的桌子

——————————————

桌子到了

正在用 网线加synching 传输100G的视频


10M一秒的速度还可以





等会发实景图片，我准备家里的台式用Windows做音乐，笔电写代码


大概就是写代码累了拿着麦克风吼两句…(家里2G内存的台式连DNF都玩不了…

——————————————

回家了

等我买的1.2m电脑桌



配上我买的护腰椅 


在空调房里我们应该可以high一夏了

——————————————

讲解得还是比较细致

——————————————

我当初学 Machine Learning，很基础的一个原因是：我想终结智力天生论，证明就算是笨蛋也可以创造出智能。

现在看起来一切都如我所料，科学果然是一剂良药( 在黑暗的日子里寻找光明 。

——————————————

传统程序员的价值在缩水

——————————————

我想到了 binary search

7步必出结果

——————————————

人生第一次坐硬卧

有空调、有软床、有小姐姐可以看



还不错 actually

——————————————

等火车时看见有人卖这个

不到1个小时卖了7、8盒



他一共带了至少24盒






如果他每盒赚5元，那么24*5=120，我估计他赚得更多



两小时尽赚120+






而且没有回头客，人流量稳定爆满











搞得我有点怀疑我读那么多书干嘛

——————————————

http://nanshu.wang/post/2018-05-17/

羡慕

——————————————

在学校参加比赛的那些日子里


我慢慢认识到只有 极限开发 是完成团体项目最好的方法



https://wapbaike.baidu.com/item/极限编程

——————————————

昨天晚上我设计了本该一个月设计出来的车


队友神操作：倒数3天到齐材料，倒数一天组装完一个全钢(SB重死了、发现脚设计错了的仿生车)



然后我昨天晚上设计并和队友完成了这个，但还没测试，老师一顿乱喷，(没错，我就是藐视他们的一切设计；在我心中，简约高效是上帝

——————————————

爱迪生是机器学习的祖师爷

因为他 don't believe in 虚无缥缈的 model( method

But he believed in data( 实践带给他的大量可行与否的 data 给予他智力( experience

——————————————

https://github.com/yingshaoxo/auto_everything_scripts/raw/master/install_selenium.py

add selenium


突然想到 auto_everything 的新前途

apt包管理器…

——————————————

https://github.com/webpack-contrib/copy-webpack-plugin#usage


总算知道怎么在 build 的时候自动 copy models 等带有文件夹的静态文件到 dist 了

我的配置是:

new CopyWebpackPlugin([{from: 'models', to: 'models'}, {from: 'age_models', to: 'age_models'}])

——————————————

https://jiayi.space/post/scrapy-phantomjs-seleniumdong-tai-pa-chong

I'll look into it soon.

——————————————

But as I think

Scrapy 应该是没用的





因为我大概看了一会儿，它连处理 log in 的function都没有

——————————————

https://github.com/scalingexcellence/scrapybook#to-use-docker-directly-without-installing-vagrant

——————————————

程序员的宿命：


What their are thinking may not match what their are look like. 

At least nothing like me. 

So stop imagination no matter how beautiful their are.

——————————————

我一直觉得谷歌写文档的人是个SB

连 keras 这么简单的库也可以写得很复杂…




https://www.tensorflow.org/tutorials/keras/basic_classification











怪不得我一直学不会 tensorflow Python version

——————————————

接下来进入 model 爬虫阶段

——————————————

找到原因了

远程实体网址承载的网站可以用手机调用 camera





local host 不行





因为这个项目在本地手机没相机，这个网址可以：
https://storage.googleapis.com/tfjs-examples/webcam-transfer-learning/dist/index.html

——————————————

要是手机不支持

我做这一切都没有意义



谷歌这事儿做得不地道，自己的项目竟然不适配手机

——————————————

感觉灵感被掏空

为什么没有一个支持 有id 的 video tag 的 web camera package 呢？





We gonna have a problem here

——————————————

https://survivejs.com/webpack/developing/webpack-dev-server/#getting-started-with-wds

webpack-dev-server 真好用，堪比flask的debug模式

——————————————

我可能需要换一个更专业的 webcam js package

——————————————

Only fuck

为什么手机上会显示 no webcam




我记得以前谷歌有个演示我就用手机打开了webcam的啊！

——————————————

https://github.com/yingshaoxo/age-and-gender-detection-in-real-time-with-tensorflowjs

改了下名字


提高了准确度和显示效果

——————————————

Search engine optimization (SEO

——————————————

接下来要思考一堆事

包括怎么把静态网页与django融合、怎么做交叉验证等等



我只想把webpack生成的东西用作django项目的一小部分

——————————————

webpack确实可以把所有依赖文件传到 dist 目录


但你原来用到的 js 文件里的 url 文件结构必须在serve静态文件时保持一致才行

不然在dist里生成的 main.js 就无法使用

——————————————

已上传

——————————————

现在来看


只要是Python能用的 model

我都能用 tensorflow.js 调用




Google真聪明，先发Python package让我们帮它训练model

然后它再让 tensorflowjs 拿来直接用



从而构成一个生态链，以巩固 web 在 IT 界的地位、Google 在 Web 界的地位

——————————————

解决了

等会分享




寝室被新室友开空调搞没电了

我得赶紧去教室冲一波电，不然笔电没电了

——————————————

我去

直接喂图片进去效果非常差(人人都49岁




看来我还是得用 face-alignment 技术把脸弄正，

而不是直接暴力带着一些背景 resize picture to (64,64)

——————————————

It seems like after model.predict()

it returns a tf tensor

And you have to use dataSync() to get the real array

https://js.tensorflow.org/api/0.12.0/#tf.Tensor.dataSync




After that, you'll be cool to use []  to get value from an array

——————————————

事实证明还不如多写几个 webpack.config.js

用 webpack-serve --config ./webpack.config.js --open

——————————————

parcel 虽然可以指定运行哪个html

但是当遇到导入 model 的时候，表现像吃了 shit

怎么样都无法导入本地 tfjs model

——————————————

以前一直纠结周杰伦的 范特西 是什么意思


最近有一天突然明白了：fantasy

——————————————

于是你终于可以预测一个人老去会是什么样子了

——————————————

Check out @OpenAI’s Tweet: https://twitter.com/OpenAI/status/1016353021494583297?s=09

——————————————

把 keras h5 转到 tensorflow json后

成功用 tensorflow.js 调用并预测

就是不知道 model.predict() 后返回了什么鬼，好像是个数组




看了 age-gender detection 的 demo.py

照猫画虎，结果持续 
results[0] undefined



感觉这样下去不行

我怕是要自己写一个 keras model，再重复以上过程，看看tensorflow.js. 的 predict () 到底返回了什么鬼

——————————————

http://music.163.com/song/19292984/?userid=280429778 (来自@网易云音乐)

——————————————

其内在含义是：你需要承认你自己失败了3000次，然后你需要自我纠正3000次。

——————————————

什么样的人足以成功？

是那些失败3000次仍进行下一次实验的人。

——————————————

添加了 face extraction


其实别人的 example 早就写得清清楚楚的了：

https://github.com/justadudewhohacks/face-api.js/blob/master/src/extractFaces.ts

https://github.com/yingshaoxo/face_detector-for-tensorflow.js/blob/master/src/index.js

——————————————

https://github.com/yingshaoxo/face_detector-for-tensorflow.js

Feel free to try it out...

——————————————

在笔电 电力用完的情况下 写完了人脸检测部分

等会儿传github


感觉入门了node.js, webpack, parcel, npm, yarn

顺便学了 js 的 async function

会用 promise.then(func)


是比 Python 的异步库好用(I'm sure about that)

——————————————

npm

node.js package manager😡

——————————————

Basically, npm is a package manager for node.js

node.js is a software which enables JavaScript running on local

You can run xx.js with node xx.js

——————————————

靠自己倒腾了5、6个小时，最终报这个错：

Constructing tensor of shape (4608) should match the length of values (2530)`


明天准备参照这个包写调用webcam的版本
https://github.com/gbcreation/face-extraction-with-face-api.js

——————————————

JS一个项目可以导入几百个包…

我要吐了

——————————————

https://itnext.io/face-api-js-javascript-api-for-face-recognition-in-the-browser-with-tensorflow-js-bcc2a6c4cf07

I'll handle into it soon

——————————————

https://www.jianshu.com/p/dc91ce945955

明天继续：
keras h5 module 转 tensorflow.js json module 
寻找 tensorflow.js 或者  Javascript 上是否有类似 dlib 的切脸库

——————————————

sudo sysctl fs.inotify.max_user_watches=999999999
This solved my problem

——————————————

But just a few days ago, I get messed up trying to figure out how tensorflow.js get web camera images

It (means tensorflow.js) will ask you to use yarn and balabala...

https://js.tensorflow.org/tutorials/webcam-transfer-learning.html

It's just never get configured somehow. (Always get wrong somewhere after you typing yarn  watch and hit the enter key)

——————————————

在学校参加比赛的那些日子里


我慢慢认识到只有 极限开发 是完成团体项目最好的方法



https://wapbaike.baidu.com/item/极限编程

——————————————

昨天晚上我设计了本该一个月设计出来的车


队友神操作：倒数3天到齐材料，倒数一天组装完一个全钢(SB重死了、发现脚设计错了的仿生车)



然后我昨天晚上设计并和队友完成了这个，但还没测试，老师一顿乱喷，(没错，我就是藐视他们的一切设计；在我心中，简约高效是上帝

——————————————

其内在含义是：你需要承认你自己失败了3000次，然后你需要自我纠正3000次。

——————————————

什么样的人足以成功？

是那些失败3000次仍进行下一次实验的人。

——————————————

我突然觉得大学的考试是个笑话(一个努力学习一个学期的人和努力作弊2、3天的人 没差几分)

以后谁也别让我考 60<x<65

——————————————

经过这几天的大学期末考试

我了解到了：通过 对机器学习基本原理的掌握 和 不断的学习训练 ，我们可以随意控制自己的学习行为，

快可在一个晚自习掌握 一整本书(documents)(但会快速忘记)，

慢可以一个学期入门 一个新领域(subject)(永生难忘)

——————————————

老师叫 束元，创新学院院长



学生组长是大二的

像我这种大一的，感觉什么也没做😂

——————————————

不厉害，(几十个人的)团体赛



这个学校的比赛几乎是硬件的

我一个写代码的，基本没什么用

——————————————

6、7号

不过暑假有一个星期我要留校参加比赛

——————————————

越到期末越讨厌SB的、每晚发出噪音打扰我睡眠的、疯狂玩游戏的室友们

这周还有数学、模电、通信原理

考完就放假了

——————————————

我只是隐隐觉得，在现实生活中，很多人，你跟他说再多话也不会有提升、一起做的事通常是浪费时间。

而在国际网上，我做的事基本就是传播知识，做实际的事情，每天解锁一点新技能。

没准这才是某国落后的根本原因：封闭。

——————————————

Me: You know, I have never see someone like you, staying cool and beautiful at the same time

Her: 你想拽英文吗？

Me: No, I just want to express my thoughts

Her: 你可以和我讲中文

Me: But some times, 我觉得英文更能表达一些事情

... silence ...

Her: (Laughed out)



Anyway, this was the first time in my life.

——————————————

学习为重

不然我干嘛在图书馆找…



慢慢来，太快了人家会说我耍流氓

——————————————

这里人太少了，应该没人知道

——————————————

不不不，小姐姐还在考虑之中

——————————————

今天向一个图书馆小姐姐面对面表白了







我发现学校同学很不靠谱啊，基本都没有教授能力、老师也是很不负责任的、填鸭式大水漫灌式教育(肯定没有世界级网课那么高质量啦)


既然感觉上完课什么都没得到


要想不挂科就全靠自己啦



所以最后一个月，暂时放下Programming，投身到无尽的学习之中

——————————————

图书馆有很大几率看到情侣或漂亮单身小姐姐

——————————————

没有什么比看到心仪的女孩

却由于能力不够，无法追到

更让人产生动力的了




所以人才要努力奋斗啊

——————————————

你进了吗

——————————————

我接着讲啊


这个学校 天猫快递 不允许进校门(说是为了保护学校“卖得贵”商品)，校门离宿舍那么远(脸都绿了)


更不用说共享单车不允许进学校了(学校小还可以理解)

——————————————

都说了是 社会主义

你有自主权吗？

——————————————

还有

考进来的和自主招生的在一起



自主的人基本不学习，整天一有空就玩游戏，口出shit loudly with 低音炮 until deep midnight

要不是有我这股清流，整个寝室一起像一群sb一样hi你能忍吗？




我现在基本是早出晚归不呆在寝室，眼不见耳不闻心不烦

——————————————

对了



大学有晚自习

第一节课还给你放一节课的 新闻联播


这你能忍吗？

——————————————

事实上这个学校非常的 社会主义


学工处连 窗帘都不允许挂在寝室






还有什么半军事化管理，懂社会主义的人都知道

——————————————

不清楚

淘宝买的

——————————————

是的

电信无限流量卡

——————————————

不能外拉网



最后我想了想，还不如用无限流量卡

——————————————

搞垄断

宰人啥的




很符合社会主义

——————————————

不是走的学校网

是外包给了联通

——————————————

好像还封ip什么的

外网及其不稳定

——————————————

没有

——————————————

我知道为什么我v2ray在学校网络情况下无法访问了

因为它不支持ipv6

v2ray在vps支持的情况下，自动使用ipv6

——————————————

下午学会了 STC89C52 单片机



#include <reg52.h>

sbit pin1_0 = P1^0;  //define pin 1.0

void main()
{

pin1_0 = 1; //write or read, it depends on you

}

——————————————

哦，还早呢


英语可以提升

——————————————

怎么？


想来南铁上学？

——————————————

不是校园网，没有ip6


是联通网

——————————————

有

但我用了一个月就关了




禁ss、v2ray，超出两台设备连接就断网，还必须在宿舍才能连

在教室有教室专用的网




都要收费、都很贵

——————————————

好在最后有结果

——————————————

Thanks a lot

——————————————

I don't get it

Why suddenly came so many people

It's doesn't make sense

——————————————

我必须压制我的头脑去记忆新东西

不然很快把学校的东西忘完后就得挂科





这样对身心很不健康，没法体验巅峰(快速学习)状态

——————————————

hi there

——————————————

只要不吵，比如图书馆或空教室或家里



一呆就是一整天


写代码超有成就感和完全的逻辑性与可操作性

——————————————

大佬

考研和编程有什么关系？😳

——————————————

If you are good in English

网上资源一大把

——————————————

编程和考试没什么关系


我学完了高数照样做不了高考理科数学的应用题

——————————————

我不管分不分工作

我只管我三年时间有没有白费




要是什么本领都没有学到，分下来工作，过几年一改革、市场化也得给辞退了




再说我更喜欢编程化的学习方式，也就是随时随地可以用我的笔记本电脑写笔记、查资料




这个学校或者说国内的大学竟然不允许上课用电脑

连晚自习戴防噪耳机都不行(然而教室吵成一锅粥也不管，学生会部长前脚一走，后脚就闹得起飞(应该在教室安装噪声检测器，超过阀值就扣分))

我强烈怀疑我进了一个高中

——————————————

我觉得学校上晚自习简直是浪费生命

太吵了




还不如让谈恋爱的、聊天的 去外面狂热的做事


留我等傻子静静地学习

——————————————

最后吐槽一下

C没有class的概念

项目大了写着好困难

同时垃圾 Arduino 还不支持在一个文件夹放n个c文件互相调用

想专业化重构工程都不行😒

——————————————

https://github.com/yingshaoxo/driver/blob/current/driver.ino

1. 为了做这个我快拼了老命
2. 这个配套的传感器是垃圾，还不如淘宝几块钱的东西
3. 官方一个灰度传感器卖200（垃圾比赛不允许用三方零件）
4. 学校还不太愿意批钱
5. 傻逼吧，传感器都不够还敢参加比赛（本来要3个灰度传感器才能识别黑线，现在两组平分下来只有2个「黑脸」）

——————————————

难是省略太多步骤

复杂是有太多步骤

——————————————

每天都过着苦逼的写笔记生活：

https://yingshaoxo.gitbooks.io/university-notes/content/dc-stable-source-circuit-de-fen-xi-yu-ying-yong/zheng-liu-lv-bo-dian-lu-de-fen-xi-yu-ying-yong/rectifier-circuit.html

——————————————

https://codelabs.developers.google.com/codelabs/cloud-tensorflow-mnist/#0

——————————————

我的真实意思是

我学的专业和非网络世界遇到的人

比我学到的、接触到的新世界落后了三个时代

——————————————

AI definitely will change the art creating process.

https://youtu.be/6KHSPiYlZ-U





So stop doing art creating, learning ML instead.

——————————————

留恋一张图书馆的coding好环境

——————————————

你说我会不会死掉

还是每科都好好学吧

——————————————

https://ai.google/education#?modal_active=none

Let's go

——————————————

I don't know, maybe just try all different thing and find the better one.

https://developers.google.com/machine-learning/crash-course/ml-intro

——————————————

感觉又回到了原始社会

隔壁一群傻逼的感觉

深夜玩游戏扰民

——————————————

I have heard 世界科技潮流是这样的：

计算机⇉网络⇉智能手机⇉AI(人工智能)

——————————————

这可能是唯一一次站在世界潮流之巅的机会了

上次智能手机的潮流我没赶上😭

——————————————

https://youtu.be/I74ymkoNTnw

决定了

在保证服务器程序运行的情况下

专心学习ML在接下来的一个学期

——————————————

成为伟大的人物，克服的就是大人心理

你不能像大人一样畏首畏尾，没有一件事是蜻蜓点水能出成绩的

不下定决心在某一职业深耕，怎能有所建树？

怕付出是没用的，不能因为想保存以前付出得到的东西就停止付出

物质守恒定律规定了必须有付出才有回报

哪怕赌上变老的代价，(你不付出也会变老，时光不能倒流

这时小孩心理就出来帮你了：你还年轻就什么也不怕

——————————————

我这个年纪，是决定方向的时候

需要从能做的事中选一个出来，成为未来的方向

急躁、不知所措、自不量力都会出现在这个时刻


最终哪项事业能让你踏实做下去，那就是你的路

Keep confidence in yourself.

——————————————

大部分人从来没有【明确】地设定自己的发展目标，每天都是得过且过。等到几年过去了，才发现自己这些年啥也没学会，还是老样子，然后就感叹时光飞逝、岁月如梭。

——————————————

在聊天中学习

——————————————

最强机器人

——————————————

大学就是一个垃圾聚集场

但这里也是社会模拟场



这里有的只是不择手段，达成目的罢了(作弊、摇尾讨好)

所以我努力的重心还应该是不在意垃圾们的目光，去出其不意地想出解决方法，提升自己

随波逐流还不如现在就去跳河

——————————————

最后我没用CAD绘图，我用 latex 的电路插件 渲染电路图

——————————————

人生如此多娇，专业课学得想吐，关键是没英文资料(资源)

https://yingshaoxo.gitbooks.io/university-notes/content/electrical-engineering/response/yi-jie-dian-lu-de-quan-xiang-ying.html

——————————————

Girlfriend could be your best friend, even if you and she didn't share a same interesting.


When you feel sad, she's there waiting for you

When you get tired, she's there waiting for you

When your faith almost crash down, she's there waiting for you


It's not about what she can do for you, it's about what you and she can do for each other.

When you get inside a relationship, you are not just being alone anymore, you and she's fate probably already been connected.

——————————————

When you failed, dried, tired, and can't figure out the answer of a problem, all you need to do is: sleep.

Try to do it again after you waken up.

If still can't find the answer, maybe Google or your friends will help you.

——————————————

肯定没人告诉你世界上有个手机系统叫做 LineageOS

——————————————

在图书馆遇到美女的可能性比教室大多了😂

——————————————

图书馆才是学习睡觉写代码的好地方

没有傻逼的干扰，学得好睡得着

——————————————

这个群 isn't official, so I can say whatever I wanna say.

——————————————

。。。


越正式，越害怕讲话

讲出来的东西牵扯多方利益



所以多数人保持沉默

——————————————

There are no one career is easy.

——————————————

只有一线城市才有开发者群体

——————————————

行，👍

——————————————

学长

你目前在哪儿工作啊？

——————————————

要想批量维护只需把局域网架起来，所有系统基于Linux，然后Virtualbox所有操作都可以用命令行实现

——————————————

刚从学校官网看到这个，学校是不是疯了，5万买一个虚拟机

Virtualbox不是免费的吗？

——————————————

CAD

Computer-aided design (CAD), is the use of computer systems to assist in the creation, modification, analysis, or optimization of a design. CAD software is used to increase the productivity of the designer, improve the quality of design, improve communications through documentation, and to create a database for manufacturing. 



这样看来 CAD 有不同种类，我得选一个Lubuntu能用的，画电路图玩(做展示)

——————————————

观江苏省大学生机器人大赛有感：

清一色幼儿图形编程是什么鬼？😂

——————————————

事实是这样的

学校绑定学号的联通手机卡如果欠费了，送的无线账号将不被允许登录

与学号绑定的城市热点费用如不足，有线网络也不被允许登录

——————————————

最后网管一生气把关于我学号的上网账号全删了…😂

——————————————

我是临时被拉参加了一个江苏省书法机器人比赛

感慨多

——————————————

然后实验室还特别吵

科研环境不应该很安静吗

——————————————

假设比赛准备时间是一个月

他们可以先玩3周



然后拖一个人来工作，工作方式很简单，你一直待在那里，呆着

也不让你休息

中间还有个别2b老师来帮倒忙和装逼



你唯一的有价值的工作还是去实验室之前在寝室完成的🌚

——————————————

我指搞竞赛的

——————————————

有设备仍然是一群SB

还他妈让我累得像一条狗




作业没做、英语没念、网课没看

——————————————

学校网管还是挺厉害的

又封端口又封ip




I mean, have no effect to me.

——————————————

应该不在吧

看体育老师都比较年轻

——————————————

不知道，大一上基础课，没见到专业老师

——————————————

也只有学通信的才能到这里啦😁

——————————————

不是，我非本地人

不能去地铁



我在等国铁

——————————————

通信技术二级学院

铁道通信与信息化技术

——————————————

学长好

我是新生

——————————————

😏

——————————————

大学虽然累，但有个好处

不会遇到SB的老师(我指被专制主义完全洗脑的一心想充当权威而不是服务学生的顽固分子)

——————————————

Firstly I wanna say, all of you guys, including me, are garbage.


https://github.com/yingshaoxo/Nanjing_Institute_of_Railway_AutoLogin

——————————————

After that, we can going further.

——————————————

Just wait, there must have more people leaving.

——————————————

最近几天差得严

所以我临时开了第二台server换着用

——————————————

未来的路，我没想好，做网络架构，还是搞linux运维，还是搞前端开发呢？ 以后再决定了，也许fullstack可以成为一个我的目标~，引用《纪实72小时》里的一句话“规划好的人生，太没意思了。”

https://sakarahiroya.github.io/blog/#/post/你好大学/

——————————————

v2ray

——————————————

自己搭

——————————————

从接下来的思修课学到：不学历史的政治学家都是SB.


也不能怪它们→政党思想的宣传工具罢了，虽然讲的东西对我们这些人来说毫无意义。

——————————————

从思修课学到：

文科的精髓在于骗人，即如何行动能让人以为 我在为他谋福利，实际上是为自己汲取利益。

——————————————

PING 45.76.13.58 (45.76.13.58) 56(84) bytes of data.
From 112.80.105.200 icmp_seq=1 Destination Host Unreachable
From 112.80.105.200 icmp_seq=2 Destination Host Unreachable
From 112.80.105.200 icmp_seq=3 Destination Host Unreachable
From 112.80.105.200 icmp_seq=4 Destination Host Unreachable
^C
--- 45.76.13.58 ping statistics ---
13 packets transmitted, 0 received, +4 errors, 100% packet loss, time 12148ms
pipe 9

It indeed somehow stopped my SS connection in school network, but this is just a fight, and I'll win no matter what.

——————————————

等我连上有线网再说，昨天开户时管理员把我密码输错了，我现在连不上

目前校园联通营业厅还没人的，改不了密码

——————————————

有可能食堂那些地方是有检测SS

目前宿舍还好

不过校园网坑啊

——————————————

？

——————————————

http://www.neea.edu.cn/html1/folder/1607/298-1.htm

恩，4级报名没有江苏，计算机考试没看到

——————————————

有组队考证书的吗？

四六级、计算机等等



感觉这个学校不会成为考场，所以我们需要去其他学校考试

——————————————

早知道校园网这么坑，暑假的时候就应该研究下卫星上网或准备好免流的工具链(目前插卡手机就一个iPhone 4s，别说免流了，就是正常开热点电池都不够用)

——————————————

不，正常的无线路由

——————————————

我以前的高中是别人捐赠的路由器和带宽

——————————————

不够不够，离出国还有一段(很长的)距离

——————————————

本来打算花几天时间(军训晚自习)把本专业书籍大概看一遍

结果新生在图书馆借不了书

——————————————

我只是在思考那些教计算机或网络信息技术的老师会翻墙并刚好用 telegram 的可能性😏

——————————————

如果我在本群明目张胆地指出这个学校的缺点，被管理层知道了会不会给我处分啊？[害怕]😅

(干啥呀！有问题还不让人说啦？)

——————————————

If the school don't allow you using electrical plug all day, then you can't put a local server or PC or wireless router in your school bedroom.

——————————————

The training under the sun is hard.

——————————————

吐槽，8号去进不了宿舍，害我花50元改签9号

——————————————

你是什么专业？

——————————————

Right, 就要开学了

——————————————

下载后，发现要走很远，加上那么渣的UI设计(我都不会玩)

就卸载了

——————————————

因为我想看看这个学校有多少志同道合的 geek.

不然我连一个说话(讨论)的对象都没了

——————————————

事实上，之前打算卸了QQ上大学

突然发现又TM有专制班级QQ群

生气又无可奈何啊

——————————————

Great then.

——————————————

I'm a new baby of this school.

I thought someone could take me flying.

——————————————

表示不想说中文，Do you understand?

——————————————

把妹技术一流

——————————————

厉害了

——————————————

欢迎，介绍一下你自己呗

——————————————

南京铁道职业技术学院铁道通信与信息化技术专业学员接受贺电😂