摘要: 这个错误是和调用相机摄像头相关的。产生这个错误的原因主要在于代码控制分辨率的显示和真机测试分辨率不一样。 一:解决办法WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);Display display... 阅读全文
posted @ 2014-07-09 08:58 Tinan 阅读(7521) 评论(1) 推荐(0) 编辑
摘要: AlertDialog的构造方法全部是Protected的,所以不能直接通过new一个AlertDialog来创建出一个AlertDialog。要创建一个AlertDialog,就要用到AlertDialog.Builder中的create()方法。使用AlertDialog.Builder创建对话... 阅读全文
posted @ 2014-04-27 10:48 Tinan 阅读(401) 评论(0) 推荐(0) 编辑
摘要: android的listview的addheaderView总是出现空指针的错误,网上的处理方法如下:// This doesn't work... nullPointerExceptionListView lv = (ListView) findViewById(R.id.my_list_view);TextView header = (TextView) findViewById(R.id.my_header);lv.addHeaderView(header);// This works fineListView lv = (ListView) findViewById(R.id. 阅读全文
posted @ 2014-03-27 19:32 Tinan 阅读(1077) 评论(0) 推荐(0) 编辑
摘要: 1.首先安装python, 我安装了Python2.7的版本,安装在了D:\Python25\2.接着安装django,我下载了django 1.6的版本。3. 安装完了之后,打开cmd,然后可以检验是否安装的顺利,输入python;接着输入import django;接着输入django.get_version()或者django.VERSION4. 记住,安装前一定要把以前的版本删除掉:If you are upgrading your installation of Django from a previous version, you will need to uninstall th 阅读全文
posted @ 2013-11-14 23:01 Tinan 阅读(1076) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8-*-import re##过滤HTML中的标签#将HTML中标签等信息去掉#@param htmlstr HTML字符串.def filter_tags(htmlstr):#先过滤CDATA re_cdata=re.compile('//]*//\]\]>',re.I) #匹配CDATA re_script=re.compile(']*>[^',re.I)#Script re_style=re.compile(']*>[^',re.I)#style re_br=re.compile( 阅读全文
posted @ 2013-11-12 16:57 Tinan 阅读(1375) 评论(0) 推荐(0) 编辑
摘要: Python匹配在我们使用的时候有很多的注意事项。我们在不断的学习中会遇到不少的问题。下面我们就详细的看看如何才能更好的掌握相关的Python匹配技术问题。用法2的正则表达式对象版本rereobj=re.compile(r"\Z") #正则表达式末尾以\Z结束 ifreobj.match(subject): do_something() else: do_anotherthing()创建一个正则表达式对象,然后通过该对象获得Python匹配细节rereobj=re.compile(regex) match=reobj.search(subject) ifmatch: #ma 阅读全文
posted @ 2013-10-04 15:06 Tinan 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 再用python爬取网页时,用模拟浏览器登陆,得到的中文字符出现乱码,该怎么解决呢?url = “http://newhouse.hfhouse.com/” req = urllib2.Request(url,headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0" }) reqHtml = urllib2.urlopen(req).read() #print reqHtml songtasteHtmlEncoding=' 阅读全文
posted @ 2013-09-29 18:57 Tinan 阅读(567) 评论(0) 推荐(0) 编辑