ITeye博客

wanglei0119

wanglei0119 · 共 10 篇文章

常用代码

**Degrees,Radians相互转换 ** CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}; CGFloat RadiansToDegrees(CGFloat radians) {return radians * 180 / M_PI;}; 精确的时间差 NSTimeInterval begin = CFAbsoluteTimeGetCurrent(); ... NSTimeInterval gap = (CFAbsoluteTimeGetCurrent() - begin); 得到yea…

2011-04-01T10:29:09Z · iPhone · 评论(0)

自己写的一个图片展示

MediaComponentView.h // // MediaComponentView.h // MediaComponent // // Created by Jason Wang on 10/7/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> @interface MediaComponentView : UIView <UITableViewDelegate,UITableViewDataSource> { NSArray *images; NSUInt…

2010-10-13T15:49:05Z · iPhone · 评论(0)

iPhone 彩色图片转变为黑白图片

CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height); // 创建gray的CGColorSpaceRef CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); // 创建CGContextRef CGContextRef context = CGBitmapContextCreate(nil, image.size.width, image.size.height, 8, 0, colorSpace, kCGImageAlphaNo…

2010-10-13T15:26:08Z · iPhone · 评论(1)

iphone 处理单击和双击Touch

如果以不同的方式响应单击和双击事件时,就会出现复杂的情况。那么如何知道一个单击不是另一个双击的起始部分呢?一下代码可以用来处理处理这种情况: 在你的UIView或UIViewController里重载touchesBegan和touchesEnded方法: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyobject]; if ([touch tapcount] == 2) { [nsobject cancelpreviousperformreque…

2010-09-24T00:40:10Z · iPhone · 评论(0)

ios4.0 uiwebview播放视频

在ios4.0以前的version,使用uiwebview播放视频只需要; UIWebView *videoView = [[uiwebview alloc] initWithFrame:CGRectMake(0,0,0,0)]; [self addsubview:videoview]; 但在ios4.0及以后,必须设置frame: UIWebView *videoView = [[uiwebview alloc] initWithFrame:CGRectMake(1,1,1,1)]; [self addsubview:videoview];

2010-09-22T15:52:50Z · iPhone · 评论(0)

hibernate hql(多对多 子查询)

现在有两张表,文章(Article) 和 目录(Category). 找出某些个目录中的所有文章的hql: from Article as a left join a.categories as c where c.id in(:ids) 找出某些目录中但不属于指定目录(id=xxx)的hql: from Article a where a in (select elements(c.articles) from Category c where c.id in (:ids)) and a not in (select elements(c.articles) from Category c…

2010-03-03T16:29:22Z · hibernate · 评论(0)

请求https错误: unable to find valid certification path to requested target

当java客户端请求实现https协议的服务时,出现异常:'unable to find valid certification path to requested target' 是因为服务期端的证书没有被认证,需要做的是把服务端证书导入到java keystore。可以附件中的java类实现。 使用方法: % java InstallCert web_site_hostname_ 这个java类会打开一个连接到你指定的host,开始握手过程。如果出现异常会打印到控制台并且会显示服务端所使用的证书,此时它会问你是否要把证书加入到你的keystore。如果你不想加,输入"q",否则输入"1"…

2010-03-03T16:15:49Z · java基础 · 评论(5)

axis2 + rampart  调用基于ws-trust的.net webservice 碰到的问题总结

首先请求是https或者需要证书签名的,需要把证书和private key导入java 的keystore。不过一般.net服务端给的证书是.pfx格式的,我也没找到太好的办法导入,于是就把证书转换成jks的,然后重命名为cacerts,此时你需要把keystore的密码改为"changeit"。 我用的是axis2 1.5.1 和 rampart 1.4 , 如果wsdl如果存在多个endpoint的时候,用wsdl2java工具生成客户端是会抛错: "can not determine the MEP ". 配置sts-config.xml <wsp:Policy wsu:Id="STS…

2010-02-21T10:55:49Z · webservice · 评论(0)

Comet学习笔记(一)Tomcat与Comet

客户端接收代码: function callback() //回调函数,对服务端的响应处理,监视response状态 { if(req.readystate==4) //请求状态为4表示成功 { if(req.status==200) //http状态200表示OK { //所有状态成功,执行此函数,显示数据 } } } 结果。。。。。没成功!!! 用IE或FF(firefox)连接发送信息,接收数据的的IE或FF并没有任何数据显示出来。于是用sinffer录了一下网络包,发现数据其实已经从tomcat推下来了,也就是浏览器已经接受到了数据。为什么浏览器没有显示呢?。。。 先研究一下tomc…

2009-11-22T20:53:22Z · Web技术 · 评论(1)

Java模拟HTTP的Get和Post请求

import org.apache.commons.httpclient.HttpClient; 2. import org.apache.commons.httpclient.HttpMethod; 3. import org.apache.commons.httpclient.HttpStatus; 4. import org.apache.commons.httpclient.URIException; 5. import org.apache.commons.httpclient.methods.GetMethod; 6. import org.apache.commons.http…

2009-11-22T20:48:38Z · java基础 · 评论(0)