2014年2月28日
摘要: 在 javadoc location path中添加file:/D:/Android_SDK/sdk/docs/reference/在 source attachment中添加为 External folder然后定位到下载的sdk source目录D:/Android_SDK/sdk/sources/android-14 阅读全文
posted @ 2014-02-28 17:56 强巴拉 阅读(296) 评论(0) 推荐(0) 编辑
  2014年1月19日
摘要: 今天用linux的crontab -e编辑定时脚本的时候。遇到No space left on device的错误。 网上找了半天终于知道原因了,昨天晚上我的一个任务因为路径没写对,到时crontab任务启动后一直会发报错邮件,导致/var/spool/mail目录下面日志文件过大导致crontab自己无法再创建新的文件出来。 最后解决办法:将/var/spool/mail目录下面的大文件全部清空cat /dev/null > bvc 和cat /dev/null > root再次使用crontab -e 一切OK了。 阅读全文
posted @ 2014-01-19 14:18 强巴拉 阅读(1244) 评论(0) 推荐(0) 编辑
  2014年1月3日
摘要: 1)// 在手机中创建文件 FileOutputStream phone_outStream =this.openFileOutput("1.txt", Context.MODE_PRIVATE); phone_outStream.write("HELLO".getBytes()); FileOutputStream phone_outStream1 =openFileOutput("1.txt", Context.MODE_APPEND); //追加模式继续写 phone_outStream1.write(" world& 阅读全文
posted @ 2014-01-03 15:22 强巴拉 阅读(645) 评论(0) 推荐(0) 编辑
  2013年12月17日
摘要: 乱码原因:因为你的文件声明为utf-8,并且也应该是用utf-8的编码保存的源文件。但是windows的本地默认编码是cp936,也就是gbk编码,所以在控制台直接打印utf-8的字符串当然是乱码了。 解决方法:在控制台打印的地方用一个转码就ok了,打印的时候这么写:print myname.decode('UTF-8').encode('GBK') 比较通用的方法应该是:import systype = sys.getfilesystemencoding()print myname.decode('UTF-8').encode(type) 阅读全文
posted @ 2013-12-17 17:15 强巴拉 阅读(7732) 评论(0) 推荐(0) 编辑
  2013年12月16日
摘要: 最近用python urllib2写一个爬虫工具,碰到运行一会程序后就会出现scoket connection peer reset错误。经过多次试验发现原来是在每次request open以后没有及时的去close,才导致此问题的出现。所以今天记录一下希望对其他有人有用。直接上代码: request = urllib2.Request(self.url) request.add_header('Cookie','PHPSESSID=79lo60cmtl1ck70h4ufruq6n53; mmf_searchhotkeyandroid=%E5%A4%A9%E6%B6%A 阅读全文
posted @ 2013-12-16 23:17 强巴拉 阅读(8558) 评论(1) 推荐(0) 编辑
  2013年12月8日
摘要: Python 如何处理server返回gzip压缩过的内容,代码如下:from StringIO import StringIOimport gziprequest = urllib2.Request('http://outofmemory.cn/')request.add_header('Accept-encoding', 'gzip')response = urllib2.urlopen(request)if response.info().get('Content-Encoding') == 'gzip': 阅读全文
posted @ 2013-12-08 20:58 强巴拉 阅读(884) 评论(0) 推荐(0) 编辑
  2013年11月29日
摘要: 最近用Python做一个crawler工具的时候,发现用一个正则表达式可以匹配到个数据的时候用match.group()只能打印出第一个数据,其它数据不能打印出来。最后找到解决方法,现在记录一下,直接贴代码:P = re.compile(r'<a(\s)href=\"/android/info/([0-9]*)\.html\?fw=([0-9]*)\"', re.M) match = p.findall(txt) if match: print match在初始化正则的时候一定要加上参数re.M这个参数的意思是去匹配多行,如果没有加re.M的话程序匹配 阅读全文
posted @ 2013-11-29 14:17 强巴拉 阅读(2108) 评论(0) 推荐(0) 编辑
  2013年11月26日
摘要: Steps1Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below.Type/Copy/Paste:file /sbin/initNote the bit version of your Ubuntu Linux operating system architecture it will display whether it is 32-bit or 64-bit.2Che 阅读全文
posted @ 2013-11-26 17:02 强巴拉 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 想在电脑上装个ubuntu 12.04来个双系统。就在win7下用U盘制作了个安装程序。但是U盘启动安装后一直无法开始安装。网上找了大半天才有个结论解决了。步骤如下:去ubuntu官网下载安装的iso文件。http://www.ubuntu.com/download/zh-CN用工具UltraISO制作USB安装系统。“UITraISO”打开iso文件 -》“启动” -》“写入硬盘镜像”到U盘修改syslinux文件夹下的syslinux.cfg文件:在default vesamenu.c32前面加上#注释掉然后使用U盘启动就可以完成安装了。特此记录一下,希望能帮主到其它朋友。 阅读全文
posted @ 2013-11-26 14:12 强巴拉 阅读(311) 评论(0) 推荐(0) 编辑
  2013年11月19日
摘要: public void sendFileToServer (String url, File logFiles) { HttpURLConnection connection = null; OutputStream os = null; DataInputStream is = null; try {// StringBuilder fullUrl = new StringBuilder(url); connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestM... 阅读全文
posted @ 2013-11-19 17:38 强巴拉 阅读(768) 评论(0) 推荐(0) 编辑