2011-11-18

Owned scan screen in ZBar

By studying the ZBar iPhone SDK document, I need to preview the camera on my own UIView, then, show the scanned image and text, that's all. All I need is to use ZBarReaderView and ZBarImageScanner, the mainly code snippet as below:
- (void) init_camera
{
ZBarReaderView * reader = [ZBarReaderView new];
ZBarImageScanner * scanner = [ZBarImageScanner new];
[scanner setSymbology:ZBAR_PARTIAL config:0 to:0];
[reader initWithImageScanner:scanner];
[scanner release];
reader.readerDelegate = self;
const float h = [UIScreen mainScreen].bounds.size.height;
const float w = [UIScreen mainScreen].bounds.size.width;
const float h_padding = w / 10.0;
const float v_padding = h / 10.0;
CGRect reader_rect = CGRectMake(h_padding, v_padding,
w - h_padding * 2.0, h / 3.0);
reader.frame = reader_rect;
reader.backgroundColor = [UIColor redColor];
[reader start];
[self.view addSubview: reader];
[reader release];
}
view raw gistfile1.m hosted with ❤ by GitHub
The screen result like below:
Check out the full sample from github.

2011-11-16

露天拍賣密碼

修改密碼網頁

希望使用者輸入至多 15 個字元,可是 html 語法卻寫成:


<input name="userpass1" type="password" size="15" class="f1">
view raw gistfile1.html hosted with ❤ by GitHub


正確寫法是:

<input name="userpass1" type="password" size="15" maxlength="15" class="f1">
view raw gistfile1.html hosted with ❤ by GitHub


另外,登入頁面


<input type="password" onkeypress="return noenter(event)" style="width: 150px; height: 16px" title="密碼" value="" size="24" name="userpass">
view raw gistfile1.html hosted with ❤ by GitHub


修改密碼規定 15 個字元,這裡卻限制 24 個字元,明顯裡外不一。