This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oracle: select * from table_name order by dbms_random.value | |
#扫描记录时给每条记录生成一个随机值,然后根据这个值进行排序 | |
mssql: select top N * from table_name order by newid() | |
mysql: select * from table_name order by rand() | |
#mysql用随机值更新记录 | |
update articles set views = rand()* 1000 | |
sqlite3: select * from table_name order by random() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSDate+Formatting.h" | |
#define SECONDS_PER_MINUTE 60.0 | |
#define SECONDS_PER_HOUR 3600.0 | |
#define SECONDS_PER_DAY 86400.0 | |
#define SECONDS_PER_MONTH 2592000.0 | |
#define SECONDS_PER_YEAR 31536000.0 | |
@implementation NSDate (formatting) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/CreatingBasicScrollViews/CreatingBasicScrollViews.html | |
contentSize是scrollview可以滚动的区域,比如frame = (0 ,0 ,320 ,480) contentSize = (320 ,960), | |
代表你的scrollview可以上下滚动,滚动区域为frame大小的两倍。 | |
contentOffset是scrollview当前显示区域顶点相对于frame顶点的偏移量,比如上个例子你拉到最下面, | |
contentoffset就是(0 ,480),也就是y偏移了480 | |
//与margin类似 | |
contentInset是scrollview的contentview的顶点相对于scrollview的位置,例如你的contentInset = (0 ,100),那么你的contentview就是从scrollview的(0 ,100)开始显示 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
有时复制一个已经存放在svn的项目时,会把里面的svn文件也复制了过去。所以再次提交到svn时会出现 under version control. | |
所以用以下命令清除项目下的svn文件。 | |
sudo find /Applications/MAMP/htdocs/jumpqsina/ -name ".svn" -exec rm -r {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Config.h | |
// ZanSe | |
// | |
// Created by dnnta on 12-12-13. | |
// Copyright (c) 2012年 NightWish. All rights reserved. | |
// | |
// | |
// Config.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16))/255.0 | |
green:((float)((hex & 0xFF00) >> 8))/255.0 | |
blue:((float)(hex & 0xFF))/255.0 alpha:1.0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* graphic_util.h | |
* radikker | |
* | |
* Created by saiten on 09/11/26. | |
* Copyright 2009 __MyCompanyName__. All rights reserved. | |
* | |
*/ | |
#ifndef __SYUN_GRAPHICS_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *htmlStr = @"This is a <br />string with html <strong>tag</strong>."; | |
NSRange range; | |
while ((range = [htmlStr rangeOfString:@"< [^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound){ | |
htmlStr = [htmlStr stringByReplacingCharactersInRange:range withString:@""]; | |
} | |
<p [stylealign]{5}=".*?">.*?<img.*?src="(.*?)".*?/>.*?</p>[\r\n]+<p [stylealign]{5}=".*?">[\r\n\s]*?(.*?)</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(BOOL)isEtalonDictionary:(NSDictionary *)etalonDictionary sameAs:(NSDictionary *)dictionary{ | |
BOOL res = NO; | |
for (id item in etalonDictionary){ | |
NSObject *secondObject = [dictionary objectForKey:item]; | |
if (secondObject == nil) | |
return NO; | |
else{ | |
NSObject *value = [etalonDictionary objectForKey:item]; | |
if ([value isKindOfClass:[NSString class]]){ | |
NSString *string = (NSString *) value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static bool debuggerRunning(void) | |
{ | |
int junk; | |
int mib[4]; | |
struct kinfo_proc info; | |
size_t size; | |
info.kp_proc.p_flag = 0; | |
mib[0] = CTL_KERN; |
OlderNewer