上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 32 下一页
摘要: python的跨平台让人很舒服,好吧,这次我们跨的再直接一点,来次穿越吧:写一个可以在windows、linux、mac(?我没有)、android(手机、平板)上可以同时运行的程序!其他也没有什么好说的,直接上代码吧:#-------------------------------------------------------------------------------#Name:pygameforandroid版helloworld!#Purpose:##Author:garfield##Created:22-12-2011#Copyright:(c)garfield2011#Lic 阅读全文
posted @ 2011-12-22 15:55 garfieldtom 阅读(3746) 评论(7) 推荐(0)
摘要: 没有什么好说的,直接上代码吧:#-------------------------------------------------------------------------------#Name:pygame版helloworld#Purpose:##Author:garfield##Created:22-12-2011#Copyright:(c)garfield2011#Licence:no#-------------------------------------------------------------------------------#!/usr/bin/envpytho 阅读全文
posted @ 2011-12-22 11:57 garfieldtom 阅读(522) 评论(0) 推荐(0)
摘要: 在网上看的,整理了一下:求10以内的偶数:首先这样写了:foriinrange(10):x=int(i%2)ifx==0:printi有人提出可以这样改进:foriinrange(10):ifi%2==0:printi再有人说,其实最简单是这样:[xforxinrange(10)ifx%2==0]代码可以简洁优美 :-) 阅读全文
posted @ 2011-12-05 15:41 garfieldtom 阅读(637) 评论(2) 推荐(0)
摘要: python做这个事情很轻松,如果省去不必要的参数输入部分,代码可以更简单 :-)直接上代码吧:#-------------------------------------------------------------------------------#Name:PortScan#Purpose:扫描目标主机的端口开放情况##Author:xxh##Created:05-12-2011#Copyright:(c)xxh2011#Licence:<yourlicence>#------------------------------------------------------ 阅读全文
posted @ 2011-12-05 15:31 garfieldtom 阅读(3098) 评论(5) 推荐(0)
摘要: 两个练习:1.info = [1,2,3,4,5],用两种方法,把列表变成:info=[5,4,3,2,1]2.x = "abc1z" 用两种方法,把字符串x变成 x="abc2z"试着做了一下:#-------------------------------------------------------------------------------#Name:模块1#Purpose:##Author:Administrator##Created:13-10-2011#Copyright:(c)Administrator2011#Licence:&l 阅读全文
posted @ 2011-10-13 14:54 garfieldtom 阅读(645) 评论(2) 推荐(0)
摘要: 从博客园或其它地方拷贝代码,经常前面有代码序号,像下面这个样子:1 wbContent.Navigate(vURL);2 3 Result:=GetHtml(wbContent);4 5 while not ContainsText(Result,'共找到') do6 begin7 Sleep(100);8 Application.ProcessMessages;9 Result:=GetHtml(wbContent);10 end;11 12 Result:=GetHtml(wbContent);可以使用Python的正则表达式来简单地去掉前面的序号:importre,sys 阅读全文
posted @ 2011-09-28 16:32 garfieldtom 阅读(1049) 评论(0) 推荐(0)
摘要: 一直使用SQL Server 2000 ,觉得安装方便快速,便不想升级到2005/2008.今天有个项目突然要用到2008,于是就在Windows7下安装了一下,没想到碰到一个1608错误,中间提示一大堆信息,上网搜索了一下,也好多遇到过这个错误,试了网上的方法都没有成功,郁闷中搜索到一个国外的方法:SQL Server 2008 Setup fails on Windows 7 Enterprise, Error code 1608To troubleshooting the issue, please try the following steps:1. Get the Product C 阅读全文
posted @ 2011-07-14 21:51 garfieldtom 阅读(1336) 评论(0) 推荐(0)
摘要: 这几天做一个项目,调用C的DLL,C里面传递字符串是char *,而Delphi中则是PChar,(从D2009开始支持Unicode后则对应的是PAnsiChar).使用过程中发现个问题需要注意,直接上代码吧:procedure TForm6.Button1Click(Sender: TObject);var s:AnsiString; p:PAnsiChar;begin s:=LabeledEdit1.Text; //LabeledEdit1.Text内容是123456 p:=PAnsiChar(s); ShowMessage(PAnsiChar('123456')); / 阅读全文
posted @ 2011-07-07 15:44 garfieldtom 阅读(604) 评论(0) 推荐(0)
摘要: 今天使用POST方式(GET方式也要注意)向PHP提交了一个JSON数据,比如:{"a":1,"b":2}在PHP中取出这个数据:$s=$_POST['data'];//or$_GET['data']然后这个串取出后是被转义的:{\"a\":1,\"b\":2}如果直接调用:$obj = json_decode($s); print_r($obj); echo $obj->a;是错误的,会报告错误.如果$s直接定义:$s='{"a":1," 阅读全文
posted @ 2011-06-21 21:11 garfieldtom 阅读(937) 评论(5) 推荐(0)
摘要: 使用Eclipse开发android,我并没有将bin目录加入到svn控制中.但每次编译,都会将src目录下的.svn和类包拷贝过去.所以在svn上总是有问题.上网搜索了一下,原来是Eclipse在编译的时候输出路径的问题:Eclipse结合SVN进行版本控制,进行开发时,即使在TortoiseSVN中设置bin目录设置为ignore目录,但是Eclipse还是会将代码目录中的.svn拷贝到bin,造成界面上显示bin发生变化,并且有可能影响项目编译。解决方法见:打开Eclipse中的Project->Properties->JavaBuildPath菜单,在右侧面板中的" 阅读全文
posted @ 2011-06-15 09:02 garfieldtom 阅读(2728) 评论(0) 推荐(1)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 32 下一页