在Perl和PHP中生成中文图片最关键的一点是需要设置一个可以显示中文的字体。在Linux平台上,我们可以把windows下的雅黑文件拷过去。在控制面板-字体里可以拷贝雅黑字体文件:放在Ubuntu的/usr/share/fonts/vista下。Perl的关键代码类似下面所示:GD::Image->trueColor(1);my $image = newFromPng GD::Image($imagepath) || die "can't open image: $!";my $white = $image->colorAllocate(255,255 Read More
posted @ 2010-04-16 20:18 javawebsoa Views(230) Comments(0) Diggs(0)
饭否的图片插件可用于论坛,博客,将用户的信息和一些最新动态用图片的形式表现出来。我们如果需要自行开发此功能的话,需要设置某种格式(或某个地址)的图片采用脚本来处理。在Perl中的话例如可以使用Apache的LocationMatch或者FilesMatch指令来进行设置,让某个Perl模块来进行处理。如果使用Mason的话,更为简单,不需要修改服务器,只需利用dhandler的特性,就可以让指定的脚本来处理。基本流程如下:主要代码如下: my $uri = $r->uri; if($uri =~ /.jpg$/) { $uid = substr($uid, 1, -4); # 从uri里 Read More
posted @ 2010-04-16 20:18 javawebsoa Views(201) Comments(0) Diggs(0)
我们平常Mason的开发环境都是部署在Ubuntu平台上的,因为通过新立得安装某些必要的软件时非常方便。以下是部署的经验总结:需要通过新立得安装的模块包括:Apache2 mod_perl2(libapache2-mod-perl2) dbi(libdbi-perl,即DBI模块,可通过cpan安装)dbd(libdbd-mysql-perl/libdbd-mysql)libapreq2(包括libapache2-mod-apreq2,libapache2-request-perl,Apache2::Request/Apache2::Upload/Apache2::Cookie模块)mason Read More
posted @ 2010-04-16 20:11 javawebsoa Views(216) Comments(0) Diggs(0)
UIImage+ColorAtPixelcategory#import <UIKit/UIKit.h>/*A category on UIImage that enables you to query the color value of arbitrarypixels of the image.*/@interface UIImage (ColorAtPixel)- (UIColor *)colorAtPixel:(CGPoint)point;@end#import <CoreGraphics/CoreGraphics.h>#import "UIImage+ Read More
posted @ 2010-02-09 09:54 javawebsoa Views(234) Comments(0) Diggs(0)
本人2007年大学毕业,为生计所迫,先就职于某世界大工厂,终日游手好闲,无所事事,料想如此三年五年下去,必定前程荒废,不得翻身。自觉对不住大学期间的学费,更无颜面对乡下日夜辛劳的父母。于是决定转战他行。遂于2008年10月结束合约,获得解放。 11月开始投身iPhone开发,算是国内较早的开发者。由于昔日的老本荒废已久,本来就没有太多编程经验,外加新生事物的参考资源甚少,中间困难重重。常混迹于国内外各大论坛和博客,每当发现一点有价值的东西总是迫不及待地收藏下来,万分珍惜。期间,感谢各位达人的鼓励,提点,砖拍,甚至冷嘲热讽。这样一年多下来,积累了一些经验,从构架到代码,从程序,发布到营销逐... Read More
posted @ 2010-02-08 16:18 javawebsoa Views(156) Comments(0) Diggs(0)
UIWindow *myWindow = [[UIWindow alloc] initWithFrame:[UIApplication sharedApplication].statusBarFrame]; [myWindow setBackgroundColor:[UIColor clearColor]]; [myWindow setWindowLevel:UIWindowLevelStatusBar]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(280.0f, 5.0f, 10.0f, .. Read More
posted @ 2010-02-08 16:11 javawebsoa Views(157) Comments(0) Diggs(0)
下面这段代码可以实现邻近检测功能,当你的身体靠近iPhone而不是触摸的时候,iPhone将会做出反应。(需要一定的面的影射,约5mm左右的时候就会触发)在程序初始化处,添加一个监听UIDevice *device = [UIDevice currentDevice];device.proximityMonitoringEnabled = YES;if (device.proximityMonitoringEnabled ==YES)[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(proximity Read More
posted @ 2010-02-08 15:47 javawebsoa Views(354) Comments(0) Diggs(0)
#import <Foundation/Foundation.h>@interface CheckButton : UIButton { BOOL _checked;}@property (nonatomic, setter=setChecked) BOOL checked;-(void) setChecked:(BOOL) check;@end#import "CheckButton.h"@implementation CheckButton@synthesize checked = _checked;-(id) init{ if( self=[super i Read More
posted @ 2010-02-08 15:40 javawebsoa Views(216) Comments(0) Diggs(0)
UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention" message: @"I'm a Chinese!" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Okay",nil] autorelease]; [theAlert show]; /* for(UIView *view in [theAlert subviews]){ ... Read More
posted @ 2010-02-08 15:38 javawebsoa Views(312) Comments(0) Diggs(0)
#import <Foundation/Foundation.h>@interface NSArray (DERandomization)+ (NSArray *)randomArrayFromArray:(NSArray *)sortedArray;@end#import "NSArray+DERandomization.h"@implementation NSArray (DERandomization)+ (NSArray *)randomArrayFromArray:(NSArray *)sortedArray { NSMutableArray *toR Read More
posted @ 2010-02-08 15:35 javawebsoa Views(141) Comments(0) Diggs(0)