斯坦福大学有一套公开的免费的iphone编程教程,称作CS 193P iphone applicatioon programming,包括上课的ppt、程序例子、作业等,都是免费下载,喜欢iphone编程,有一定英语基础的可以看看,是从object c的语法开始说的,比较适合初学者。链接地址在这里,目前已经到第十八课了。
Archive for the '编程' Category
delphi 2010和rad 2010都已经问世了,所以你或许会需要DelphiDistiller这个有趣的程序,DelphiDistiller的最新版本已经出到了1.75,支持最新的delphi 2010。
大米盘下载:DelphiDistiller.v1.75.rar(支持电驴、迅雷、旋风下载)
相关内容
我的一个delphi应用中需要彻底删除一个临时路径,delphi自带的文件和路径操作函数基本不行,因为现在的windows系统很奇怪,路径会删除不干净,并且delphi默认的函数要用递归来写,比较麻烦。网上搜索了不少,逐一试验下载,下面的代码是有效的,我在windows xp下测试了,没有在vista下测试(不知道会否影响vista的权限控制)
该代码还是通过调用winapi来实现彻底强行删除一个路径,包括下面的所有文件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | function ForceDeleteDir(lhandle: THandle; APath: AnsiString): Boolean; var lpFileOp: TSHFileOpStruct; begin with lpFileOp do begin wnd := lhandle; wFunc := FO_Delete; pFrom := PChar(APath); pTo := nil; fFlags := FOF_ALLOWUNDO+FOF_NOCONFIRMATION+FOF_NOERRORUI;//标志表明允许恢复,无须确认并不显示出错信息 hNameMappings := nil; lpszProgressTitle := nil; fAnyOperationsAborted := False; end; if SHFileOperation(lpFileOp) = 0 then result := True else result := False; end; |
相关内容
云计算是个IT界火热的词汇,开源云计算更是被认为是IT的趋势。我们熟知的几个IT巨头的云计算平台,如亚马逊EC2和S3、IBM的蓝云、微软的Azure、Sun Cloud等,那么开源云计算的平台又有哪些呢?以下列举了开源中国社区收录的5款知名的开源云计算平台。
1 AbiCloud企业级开源云计算平台
Abiquo公司推出的一款开源的云计算平台——“abiCloud”,使公司能够以快速、简单和可扩展的方式创建和管理大型、复杂的IT基础设施(包括虚拟服务器,网络,应用,存储设备等等)。AbiCloud较之同类其他产品的一个主要的区别在于其强大的Web界面管理。你可以通过拖拽一个虚拟机来部署一个新的服务。这个版本允许通过VirtualBox部署实例,它还支持VMware,KVM和Xen。
2 Eucalyptus 开源云计算平台
Eucalyptus 项目(Elastic Utility Computing Architecture for LinkingYour Programs To Useful Systems)是 Amazon EC2 的一个开源实现,它与商业服务接口兼容。和 EC2一样,Eucalyptus 依赖于 Linux 和 Xen 进行操作系统虚拟化。Eucalyptus 是加利福尼亚大学(SantaBarbara)为进行云计算研究而开发的。您可以从该大学的网站上下载它,或者通过 Eucalyptus Public Cloud体验它,不过后者有一些限制。
3 10gen MongoDB 开源高性能存储平台
10gen MongoDB 既是一个云平台,又是一个可下载的开放源代码包,可用于创建您自己的私有云。10gen 是类似于 App Engine的一个软件栈,它提供与 App Engine 类似的功能 — 但有一些不同之处。通过 10gen,可以使用 Python 以及JavaScript 和 Ruby编程语言开发应用程序。该平台还使用沙盒概念隔离应用程序,并且使用它们自己的应用服务器的许多计算机(当然,是在 Linux上构建)提供一个可靠的环境。
4 Enomalism 弹性计算平台
Enomaly’s Elastic Computing Platform (ECP)是一个可编程的虚拟云架构,ECP平台可以简化在云架构中发布应用的操作。Enomalism 是一个开放源代码项目,它提供了一个功能类似于 EC2的云计算框架。Enomalism 基于 Linux,同时支持 Xen 和 Kernel Virtual Machine(KVM)。与其他纯IaaS 解决方案不同的是,Enomalism 提供了一个基于 TurboGears Web 应用程序框架和 Python 的软件栈。
5 云计算平台 Nimbus
Nimbus由网格中间件Globus提供,Virtual Workspace演化而来,与Eucalyptus 一样,提供EC2的类似功能和接口。
相关内容
因为我的c语言基础很不好,或者说基本等于没有学习过c,大家也可以想象我熟悉的pascal和c还是有很大的差别的。python、php、perl等很多脚本语言都受到了c的影响。我并不是很喜欢这种类c的语言的语法,当然还是因为不习惯和曾经太多与强大的delphi的根深蒂固的影响。
但是我看到基于google app engine的这段简单的python语言之后,我还是惊讶于pyhon的简洁,以及google的强大。(倒是很希望baidu可以推出类似的竞争产品,这样就可以不担心被屏蔽了)
import cgi from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class MainPage(webapp.RequestHandler): def get(self): self.response.out.write(""" <html> <body> <form action="/sign" method="post"> <div><textarea name="content" rows="3" cols="60"></textarea></div> <div><input type="submit" value="Sign Guestbook"></div> </form> </body> </html>""") class Guestbook(webapp.RequestHandler): def post(self): self.response.out.write('<html><body>You wrote:') self.response.out.write(cgi.escape(self.request.get('content'))) self.response.out.write('</body></html>') application = webapp.WSGIApplication( [('/', MainPage), ('/sign', Guestbook)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main()
非常清楚的URL映射架构和相关的函数方法,清晰的html输出(虽然还很简单),一个主函数。
相关内容
从这里看到,再加一个发送邮件,可以做msn好友邀请了,我相信这样的病毒是营销多少还是有些作用的。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
<title>MSN 测试</title>
<meta name="generator" content="Bluefish 1.0.6"/>
<meta name="keywords" content="MSN"/>
<meta name="description" content="MSN test"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">
<!--
div {
font-family: arial, helvetica, sans-serif;
font-size : 13px ;
margin: 10px;
padding: 2px 10px 1px;
background-color: #C60;
color: #FFFFFF;
border-top: 1px solid #C90;
border-left: 1px solid #C90;
border-bottom: 1px solid #333;
border-right: 1px solid #333;
}prom dresses
a:link {
color: #00FFBE;
}
--></style>
</head>
<body>
<div>
<?php
# filename: fm.php
# purpose: get MSN contact list
# author: http://qartis.com/?qmsn modified by Druggo
$username = $_POST['username'];
$password = $_POST['password'];
$debug = 0;
$trid = 0;
$proto = "MSNP10";
# start here
echo "通讯协议 $proto<br/>";
echo "开始登录<br/>";
# login nowloctite
$sbconn = fsockopen("messenger.hotmail.com",1863) or die("Can't connect to MSN server");
flush();
data_out("VER $trid $proto CVR0");
data_in();
data_out("CVR $trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $username");
data_in();
data_out("USR $trid TWN I $username");
$temp = data_in();
if (!stristr($temp,":")){
if (substr($temp,0,3)==601){
#echo "Error: The MSN servers are currently unavailable.";
echo "很不幸,MSN的服务器又挂了 >.<<br/>";
die();
} else {
echo "连接失败!<br/>";
fclose($sbconn);
die();
}
}guangzhou massage
@fclose($sbconn);
$temp_array = explode(" ",$temp);
$temp_array = explode(":",$temp_array[3]);
flush();
$sbconn = fsockopen($temp_array[0],$temp_array[1]) or die("error -_-#");
data_out("VER $trid $proto CVR0");
data_in();
flush();
data_out("CVR $trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $username");
data_in();
data_out("USR $trid TWN I $username");
$temp = data_in();
$temp_array = explode(" ",$temp);
flush();
$TOKENSTRING = trim(end($temp_array));
#echo "authenticating";
echo "身份验证中……<br/>";
flush();
$nexus_socket = fsockopen("ssl://nexus.passport.com",443);
fputs($nexus_socket,"GET /rdr/pprdr.asp HTTP/1.0rnrn");
while ($temp != "rn"){
$temp = fgets($nexus_socket,1024);
if (substr($temp,0,12)=="PassportURLs"){
$urls = substr($temp,14);
}shanghai escort
}
$temp_array = explode(",",$urls);
$temp = $temp_array[1];
$temp = substr($temp,8);
$temp_array = explode("/",$temp);
@fclose($nexus_socket);
$ssl_conn = fsockopen("ssl://".$temp_array[0],443);
fputs($ssl_conn,"GET /{$temp_array[1]} HTTP/1.1rn");
fputs($ssl_conn,"Authorization: Passport1.4 orgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRINGrn");
fputs($ssl_conn,"User-Agent: MSMSGSrn");
fputs($ssl_conn,"Host: {$temp_array[0]}rn");
fputs($ssl_conn,"Connection: Keep-Alivern");
fputs($ssl_conn,"Cache-Control: no-cachernrn");
$temp = fgets($ssl_conn,512);
if (rtrim($temp) == "HTTP/1.1 302 Found"){
#echo "redirection";
echo "开始重定向<br/>";
flush();
while ($temp != "rn"){
$temp = fgets($ssl_conn,256);
if (substr($temp,0,9)=="Location:"){
$temp_array = explode(":",$temp);
$temp_array = explode("/",trim(end($temp_array)));
break;
}
}
@fclose($ssl_conn);
$ssl_conn = fsockopen("ssl://".$temp_array[2],443);
fputs($ssl_conn,"GET /{$temp_array[3]} HTTP/1.1rn");
fputs($ssl_conn,"Authorization: Passport1.4 orgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRINGrn");
fputs($ssl_conn,"User-Agent: MSMSGSrn");
fputs($ssl_conn,"Host: {$temp_array[2]}rn");
fputs($ssl_conn,"Connection: Keep-Alivern");
fputs($ssl_conn,"Cache-Control: no-cachernrn");
} elseif (rtrim($temp)=="HTTP/1.1 401 Unauthorized"){
#echo "invalidcreds";
echo "验证失败!<br/>";
@fclose($ssl_conn);
die();
} else {
if (rtrim($temp) != "HTTP/1.1 200 OK"){
#echo "Unknown HTTP status code: $temp<br>";
echo "未知状态码 $temp<br/>";
flush();
die();
} else {
#echo "set_bar_len30?";
}massage shanghai
}
while ($temp != "rn"){
$temp = fgets($ssl_conn,1024);
if (substr($temp,0,19)=="Authentication-Info"){
$auth_info = $temp;
$temp = fgets($ssl_conn,1024);
if (substr($temp,0,14)!="Content-Length"){
$auth_info.= fgets($ssl_conn,1024);
}
break;
}
}
@fclose($ssl_conn);
$temp_array = explode("'",$auth_info);
flush();
data_out("USR $trid TWN S {$temp_array[1]}");
flush();
$temp=data_in();
flush();
$time_since_initmsg = time();
while(!strstr($temp,"ABCHMigrated") && is_string(trim($temp))){
if (substr($temp,0,3)=="sid"){
$sid = trim(substr($temp,5));
}
if (substr($temp,0,2)=="kv"){
$kv = trim(substr($temp,4));
}
if (substr($temp,0,7)=="MSPAuth"){
$mspauth = trim(substr($temp,9));
flush();
}
$temp = data_in();
}
$temp = data_in();
#echo "authenticated<br />";
echo "验证通过!<br/>";
flush();shanghai massage
#data_out("LST 9 RL");
#data_in();
data_out("SYN $trid 0 0");
#echo "retreiving_contact_list<br />";
echo "正在获取好友列表……<br/><br/>";
flush();
stream_set_timeout($sbconn,0,125000);
/* a lazy man doing this :D */
for($i=0;$i<160;$i++) # some say max is 150
{
$temp = data_in();
switch (substr($temp, 0, 3))
{
case "LST":
$temp_array = explode(" ",$temp);
$un = substr($temp_array[1], 2);
$nn = substr($temp_array[2], 2);
$nn1 = substr($temp_array[2], 0, 1);
if($nn1 == "F")
{
echo "<a href="mailto:$un">$nn</a><br/>";
}
else
{
echo "曾经的好友: $un<br/>";
}barbed wire
#echo $temp."<br/>";
break;
default:
# no nothing
break;
}
}
echo "列表结束";
@fclose($sbconn);
# end here
# functions
function data_out($data){
global $sbconn,$debug,$trid;
fputs($sbconn,$data."rn");
$trid++;
if ($debug && !empty($data)){ echo "> ".$data."<br>rn";}
}
function data_in(){
global $sbconn,$debug;
$temp = fgets($sbconn,256);
if ($debug && !empty($temp)){echo "< ".$temp."<br>rn";}
return $temp;
}chain link fencing
?>
</div>
</body>
</html>相关内容
这两天碰到一个非常麻烦的问题,就是我试图小小的修改一下按钮,将submit修改为中文的提交,却显示了满屏幕的出错信息,也看不太懂这些出错信息想要说什么。(至今怀念第一次看到turbo pascal 5.0的时候,惊讶于borland的出错信息可以做的这么智能化)。
其实问题解决很简单,我用notepad++存盘py文件的时候,默认是ANSI,只要修改为UTF-8就可以了。我用各种搜索条件怎么也找不到这样简单问题的答案,可能所有的人都认为我应该默认就用UTF-8来保存的。在程序头部加入coding说明,如果保存格式不是UTF-8,一样是没有用的。
在尝试解决这个问题的时候,也下载了据说是最好的pyton集成开发环境的wing ide,对于多年使用delphi的我来说,只能笑笑了。怪不得经常会看到某某ide是某某语言中的delphi开发环境,borland当年的delphi神话看来是太难以突破了。或许脚本语言还有很大的发展空间。

最新评论