Skip to content

Instantly share code, notes, and snippets.

@flashlib
flashlib / 设置cout补0
Created June 21, 2013 08:47
设置cout补0
#include<iostream.h>
void main()
{
int num;
num=5;
cout.fill('0');//设置填充字符
cout.width(5);//设置域宽
cout<<num<<endl;
}
@flashlib
flashlib / 系统背景色
Created June 28, 2013 06:51
设置为系统背景色
self.view.backgroundColor = [UIColor underPageBackgroundColor];
@flashlib
flashlib / XCode SVN配置
Created July 12, 2013 01:38
解决Xcode4.x Organizer SVN “Unable to load revisions”
1.打开Terminal
2. svn ls svn://192.168.0.5/client_iphone/ (此处地址可能是http或https类型)
3.重启xcode。完毕。
@flashlib
flashlib / RSA非对称数据加密算法使用示例
Created August 19, 2013 03:08
RSA非对称数据加密算法使用示例
#include <stdio.h>
#include <string.h>
#include <openssl/rsa.h>
#include <openssl/applink.c>
void print_buf_hex( unsigned char *buf, int len )
{
int i;
for( i = 0; i < len; i++ )
@flashlib
flashlib / Multi-line UITableViewCell using UILabel
Created September 2, 2013 10:25
Multi-line UITableViewCell using UILabel
static NSString *CellIdentifier = @"MyCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2
reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = @"Label';
cell.detailTextLabel.text = @"Multi-Line\nText";
cell.detailTextLabel.numberOfLines = 2;
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
@flashlib
flashlib / UIPickerView居中
Created September 3, 2013 02:52
UIPickerView居中
// 6.0以上
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
NSString *text = [NSString stringWithFormat:@"R%d C%d", row, component];
NSMutableAttributedString *as = [[NSMutableAttributedString alloc] initWithString:text];
NSMutableParagraphStyle *mutParaStyle=[[NSMutableParagraphStyle alloc] init];
mutParaStyle.alignment = NSTextAlignmentCenter;
[as addAttribute:NSParagraphStyleAttributeName value:mutParaStyle range:NSMakeRange(0,[text length])];
return as;
}
@flashlib
flashlib / 列出FTP所有文件
Created September 3, 2013 10:37
列出FTP所有文件
@echo off
ftp ftp的地址
login username password
ls >c:\a.txt
这样就把ftp的文件列到a.txt里面了。
@flashlib
flashlib / 解决svn copy flag问题
Created September 17, 2013 08:04
解决svn copy flag问题,错误提示如下: has copy flag but no copyfrom URL。
//先备份该文件
svn remove --force filename //强制删除
//再将无版本信息的备份文件拷贝回来
svn resolve --accept=working filename
svn commit
@flashlib
flashlib / MAC获取IP地址命令
Created September 22, 2013 02:54
比ifconfig命令获得的信息详细
#获取所有信息
ipconfig getpacket en0
#获取路由器ip
ipconfig getoption en0 router
@flashlib
flashlib / 后台运行任务
Created September 22, 2013 06:48
beginBackgroundTaskWithExpirationHandler
__block UIBackgroundTaskIdentifier backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
NSLog(@"Background Time:%f",[[UIApplication sharedApplication] backgroundTimeRemaining]);
[self endBackgroundTask:backgroundTaskIdentifier];
backgroundTaskIdentifier = backgroundTaskIdentifier;
}];