10 Mar 2015

ROOT MOTO G running Lollipop

收藏到CSDN网摘




Just got back to 4.4.4 stock rom and then update through OTA to lollipop. There's a couple of improvements as well. The bad side is that I lost root on my device. Due to last imperfect rooting process, I am not going to do this again. Fortunately, I found this page and root my Moto G (Lollipop 5) successfully. This method seems work without any problem.

MOTO G flash back to stock rom

收藏到CSDN网摘



I got OTA for Lollipop 5.0 this morning. Unfortunately, it requires restart to install the updates. My moto g has this cannot-restart problem for long time since root. I have to use the "fastboot mode->normal start" technique to get it start properly. No luck at all, it stuck while it was restarting. Surprisingly, after using the old method, it would power-off again automatically. I assume the OTA may write something to the system to force the updates.

It seems that there's no other way to get the phone working. I HAVE TO flash the stock rom to make it right. Here we go!

12 Sept 2014

如何检测一个参数是Generator类型?

收藏到CSDN网摘


遇到一个问题,需要检测输入参数类型,如果是list,tuple,dict,set等内置类型,可以很容易使用isinstance(arg,list)这样的函数来测试,但是如果输入参数是generator呢?例如foo(abs(i) for i in range(-10, 10)),这时如何检测?

31 Dec 2013

页面禁止复制,右键,全选 - 兼容各种浏览器

收藏到CSDN网摘



转载自: http://www.moonlit.me/%E7%A6%81%E6%AD%A2%E8%A4%87%E8%A3%BD%E9%8E%96%E5%8F%B3%E9%8D%B5%E7%A6%81%E6%AD%A2%E5%85%A8%E9%81%B8-1623.html

网页利用JS禁止右键,禁止选择文本,禁止复制文本,支持Opera,IE,Chrome和Firefox等各种主流浏览器,兼容性绝对超过网上搜索的其他JS代码。
虽说锁定右键和禁止复制是不好的,但是有时候出于一些特殊原因考虑,我们不得不进行这些限定。

到百度或者Google上去搜索看看,保证你会失望,网上找到的方法不是不支持Google Chrome就是不支持Opera,就是能够屏蔽用鼠标选取内容就是不能禁止从浏览器的菜单栏的“复制”按钮复制,总之就是漏洞百出,无法实现对文本复制的限制。

下面的方法可以实现:

1 Sept 2013

命令行开启xming server

收藏到CSDN网摘



当前项目需要运行unix程序,后台需要x server支持.免费的Xming刚好可用.不过每次都需要手动开启xlaunch wizard,然后点3-4次下一步才能完成启动,这里找到一个命令行开启的方法,可以实现全自动.调用代码如下