06 2018 档案

摘要:传送门 来自作者的PPT https://speakerdeck.com/mitsuhiko/advanced flask patterns?slide=46 阅读全文
posted @ 2018-06-30 11:44 Rocin 阅读(362) 评论(0) 推荐(0)
摘要:传送门 http://www.ruanyifeng.com/blog/2012/10/javascript_module.html 1. 原始写法 缺点:污染全局变量;可能和其他模块发生冲突;模块中的成员之间看不出关系。 2. 把模块写进去进对象里面 缺点:改变了模块内部状态;例如module1._ 阅读全文
posted @ 2018-06-28 13:01 Rocin 阅读(120) 评论(0) 推荐(0)
摘要:传送门 https://www.bilibili.com/bangumi/play/ep228777/ https://zh.wikipedia.org/wiki/%E8%82%AF%E5%BE%B7%E5%9F%BA https://zh.wikipedia.org/wiki/%E7%99%BE% 阅读全文
posted @ 2018-06-28 12:01 Rocin 阅读(589) 评论(0) 推荐(0)
摘要:传送门 1. http://flask.pocoo.org/docs/1.0/appcontext/ storing data 2. http://flask.pocoo.org/docs/1.0/appcontext 3. http://flask.pocoo.org/docs/1.0/appco 阅读全文
posted @ 2018-06-27 10:57 Rocin 阅读(787) 评论(0) 推荐(0)
摘要:传送门 1. https://www.zhihu.com/question/19998865/answer/26203965 2. https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface 3. https://www.liaoxuefen 阅读全文
posted @ 2018-06-26 19:34 Rocin 阅读(116) 评论(0) 推荐(0)
摘要:传送门 https://blog.csdn.net/jackfrued/article/details/79717727 在此基础上实践和改编某些点 1. 并发编程 1. 实现让程序同时执行多个任务也就是常说的“并发编程” 2. 使用Python实现并发编程主要有3种方式:多进程、多线程、多进程+多 阅读全文
posted @ 2018-06-25 23:06 Rocin 阅读(356) 评论(0) 推荐(0)
摘要:``` git init git add git add . git checkout -- git checkout -- . git status git config --global user.name git config --global user.email git commit -m 'reason' git log git reset --hard ... 阅读全文
posted @ 2018-06-25 17:21 Rocin 阅读(186) 评论(0) 推荐(0)
摘要:求n个数字的累加和 1. 递归实现 求一个数字的每个位数上的和 :如:23 5 1. 递归实现 function getnumberSum(x) { if (x 阅读全文
posted @ 2018-06-24 17:11 Rocin 阅读(95) 评论(0) 推荐(0)
摘要:传送门 https://kamranahmed.info/blog/2018/03/24/choice is yours/ 1. Our whole lives are driven by the choices we make. 2. I am talking about the little c 阅读全文
posted @ 2018-06-24 15:46 Rocin 阅读(122) 评论(0) 推荐(0)
摘要:传送门 https://github.com/jackfrued/Python 100 Days/blob/master/Day01 15/Day09/%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E8%BF%9B%E9%98%B6.md %E7%B1%BB%E4%B9% 阅读全文
posted @ 2018-06-24 15:08 Rocin 阅读(1247) 评论(0) 推荐(1)
摘要:传送门 1. https://github.com/jackfrued/Python 100 Days/blob/master/Day01 15/Day09/%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E8%BF%9B%E9%98%B6.md %E9%9D%99%E6% 阅读全文
posted @ 2018-06-23 22:10 Rocin 阅读(296) 评论(0) 推荐(0)
摘要:参考 1. https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/00143186739713011a09b63dcbd42cc87f907a778b3ac73000 概念 限制实例的属 阅读全文
posted @ 2018-06-23 21:50 Rocin 阅读(131) 评论(0) 推荐(0)
摘要:运行 1. mongod dbpath (mongod is the "Mongo Daemon") 2. 在shell用mongo或者用studio 3t可视化连接 创建用户 阅读全文
posted @ 2018-06-22 22:49 Rocin 阅读(85) 评论(0) 推荐(0)
摘要:参考 https://stackoverflow.com/questions/36834677/print success messages for asserts in python 总结 在assert后加上print 阅读全文
posted @ 2018-06-22 20:25 Rocin 阅读(683) 评论(0) 推荐(0)
摘要:参考 1. https://baike.baidu.com/item/%E6%B5%8B%E8%AF%95%E9%A9%B1%E5%8A%A8%E5%BC%80%E5%8F%91/3328831?fr=aladdin 2. https://en.wikipedia.org/wiki/Test dri 阅读全文
posted @ 2018-06-21 22:52 Rocin 阅读(357) 评论(0) 推荐(0)
摘要:参考 1. https://www.codementor.io/niladrisekhardutta/how to call apply and bind in javascript 8i1jca6jp 2. https://developer.mozilla.org/en US/docs/Web/ 阅读全文
posted @ 2018-06-19 15:52 Rocin 阅读(146) 评论(0) 推荐(0)
摘要:参考 1. https://stackoverflow.com/questions/9959727/proto vs prototype in javascript 区别 1. 构造函数中的prototype创建了实例对象中的属性:\__proto__(隐式原型,类比python语言的\__xx__ 阅读全文
posted @ 2018-06-18 10:08 Rocin 阅读(99) 评论(0) 推荐(0)
摘要:说明 代码片段来自网上搬运的或者自己写的 华氏温度转摄氏温度 输入圆的半径计算计算周长和面积 输入年份判断是不是闰年 英制单位与公制单位互换 掷骰子决定做什么 百分制成绩转等级制 输入三条边长如果能构成三角形就计算周长和面积 上面的代码中使用了math模块的sqrt函数来计算平方根。用边长计算三角形 阅读全文
posted @ 2018-06-16 16:40 Rocin 阅读(451) 评论(0) 推荐(0)
摘要:JSON with Padding参考 1. https://zh.wikipedia.org/wiki/JSONP 2. http://www.runoob.com/json/json jsonp.html 使用步骤 1. 在\中写一个回调函数callBackFunction(response)。 阅读全文
posted @ 2018-06-14 23:39 Rocin 阅读(167) 评论(0) 推荐(0)
摘要:现象 买洗衣机给的电子发票上面有增值税,很好奇为啥由消费者承担? 答案 1. https://www.zhihu.com/question/21030724 2. https://zhidao.baidu.com/question/584597942.html?qbl=relate_question 阅读全文
posted @ 2018-06-13 17:35 Rocin 阅读(141) 评论(0) 推荐(0)
摘要:1.1 如果导入的模块除了定义函数之外还中有可以执行代码,那么Python解释器在导入这个模块时就会执行这些代码。 module1.py: test.py: 1.2 模块编写的目的是被调用;一般来说,不是主程序入口;假如直接运行该模块,使用if \__name__ == '\__main__': m 阅读全文
posted @ 2018-06-13 15:44 Rocin 阅读(171) 评论(0) 推荐(0)
摘要:注册/移除事件的三种方式 1. onclick 2. addEventListener 3. attachEvent 兼容代码 阅读全文
posted @ 2018-06-12 08:55 Rocin 阅读(128) 评论(0) 推荐(0)
摘要:参考 1. https://stackoverflow.com/questions/7794301/window onunload is not working properly in chrome browser can any one help me 解决办法 1. 用onbeforeunloa 阅读全文
posted @ 2018-06-11 21:35 Rocin 阅读(1003) 评论(0) 推荐(0)
摘要:传送门 1. https://stackoverflow.com/a/20980488/5955399 区别 1. json:用于字符串(unicode text)和python基本数据类型间进行转换。优点:跨语言跨平台,应用范围大,体积小;缺点:只能支持 int/str/list/tuple/di 阅读全文
posted @ 2018-06-11 18:25 Rocin 阅读(145) 评论(0) 推荐(0)
摘要:参考 1. https://en.wikipedia.org/wiki/Serialization 2. https://en.wikipedia.org/wiki/Persistence_(computer_science) 3. https://www.zhihu.com/question/31 阅读全文
posted @ 2018-06-11 18:01 Rocin 阅读(767) 评论(0) 推荐(0)
摘要:1. 字符串 1.1 字符串的不可变性 1.2 创建字符串对象(包装类,里面有对字符串的操作方法) 2. 字符串的常用方法 字符串所有的方法,都不会修改字符串本身(字符串是不可变的),操作完成会返回一个新的字符串 3. 案例1. 截取字符串"我爱中华人民共和国",中的"中华" 方法1. substr 阅读全文
posted @ 2018-06-10 14:57 Rocin 阅读(593) 评论(0) 推荐(0)
摘要:1. 概念 1. 基本类型是没有方法的 2. 包装类型作用是为了 方便操作基本数据类型 阅读全文
posted @ 2018-06-10 13:28 Rocin 阅读(135) 评论(0) 推荐(0)
摘要:1. 创建数组 方式1. new关键字 方式2. 使用字面量创建数组对象 2. 检测一个对象是否是数组 1. instanceof(运算符),[] instanceof Array 2. Array.isArray(),HTML5方法,有兼容性问题 3. 数组常用方法 具体查MDN 4. 实现arr 阅读全文
posted @ 2018-06-10 12:02 Rocin 阅读(338) 评论(0) 推荐(0)
摘要:1 4对象创建方式 属性为对象的特征,方法(method)为对象的行为。 1. 对象字面量 2. new Object()创建对象 3. 工厂函数创建对象 4. 自定义构造函数 5. new关键字执行时的工作 1. 在内存中创建一个对象。 2. 让this指向这个新的对象。 3. 执行构造函数:给这 阅读全文
posted @ 2018-06-10 10:26 Rocin 阅读(88) 评论(0) 推荐(0)
摘要:1. 疑问 flask web狗书的 git reset hard 16b flask profile profile dir="./profile",生成了后缀为 .prof的文件,我怎么查看这些文件呢? 我发起了一个issue:https://github.com/miguelgrinberg/ 阅读全文
posted @ 2018-06-07 14:52 Rocin 阅读(1663) 评论(0) 推荐(0)
摘要:疑问 在JS的变量和声明式函数的提升看到了“预编译/预处理/预解释”中“预编译”这个字眼,产生了一个疑问:JS是熟知的解释性语言,但JS能被编译吗? 参考 1. https://developer.mozilla.org/en US/docs/Web/JavaScript : JavaScript 阅读全文
posted @ 2018-06-07 00:26 Rocin 阅读(1318) 评论(0) 推荐(0)
摘要:参考 https://www.jianshu.com/p/3b5f0cb59344 https://jingyan.baidu.com/article/4f34706e18745be386b56d46.html https://www.2cto.com/kf/201401/273825.html h 阅读全文
posted @ 2018-06-06 21:29 Rocin 阅读(331) 评论(0) 推荐(0)
摘要:第一集Intro to Economics: Crash Course Econ 1 传送门:https://www.youtube.com/watch?v=3ez10ADR_gM&list=PL8dPuuaLjXtPNZwz5_o_5uirJ8gQXnhEO 1. Economics is the 阅读全文
posted @ 2018-06-06 11:11 Rocin 阅读(889) 评论(0) 推荐(0)
摘要:参考,搬运 1. http://python web guide.readthedocs.io/zh/latest/idiom/idiom.html 2. 待定 1. Python支持链式比较 4. 格式化字符时多使用format函数 5. 使用列表或者字典comprehension(推导式) 6. 阅读全文
posted @ 2018-06-05 15:48 Rocin 阅读(362) 评论(0) 推荐(0)
摘要:概念 EAFP:easier to ask forgiveness than permission LBYL:look before you leap 代码 有点和缺点 EAFP优点是逻辑清晰,Python社区推荐使用。 LBYL拥有很多逻辑控制代码,使得结构混乱。 在高并发情况下,if条件如果是个 阅读全文
posted @ 2018-06-05 15:15 Rocin 阅读(246) 评论(0) 推荐(0)
摘要:参考 https://segmentfault.com/a/1190000006185954 1. Git的所有操作实际上是在操作这三个区域的状态(或内容) 2. 区别 checkout是会修改HEAD的指向,变更Index区域里的内容,修改Working Directory里的内容。 这看上去很像 阅读全文
posted @ 2018-06-04 23:28 Rocin 阅读(445) 评论(0) 推荐(0)
摘要:网址 http://docs.python guide.org/en/latest/ Reuqests库的作者写的经验 1. 项目需要一个好的结构 https://www.kennethreitz.org/essays/repository structure and python https:// 阅读全文
posted @ 2018-06-04 12:05 Rocin 阅读(548) 评论(0) 推荐(0)
摘要:token概念参考 1. https://ninghao.net/blog/2834 2. https://stackoverflow.com/questions/1592534/what is token based authentication 3. http://www.woshipm.com 阅读全文
posted @ 2018-06-02 13:56 Rocin 阅读(397) 评论(0) 推荐(0)
摘要:1. CSRF参考 1. https://www.ibm.com/developerworks/cn/web/1102_niugang_csrf/ 2. https://en.wikipedia.org/wiki/Cross site_request_forgery 3. http://itinde 阅读全文
posted @ 2018-06-02 10:13 Rocin 阅读(157) 评论(0) 推荐(0)
摘要:参考 1. https://segmentfault.com/q/1010000002898735 2. https://stackoverflow.com/questions/1338728/delete commits from a branch in git 方法一可行,但貌似不建议,留坑 1 阅读全文
posted @ 2018-06-01 20:27 Rocin 阅读(1549) 评论(0) 推荐(0)