1.类的声明与实现Objective-C类的声明要写在@interface 与 @end之间,实现要写在@implementation 与 @end之间2.类的-方法和+方法类的-方法即类的实例方法,+方法即类方法(静态方法)3.消息机制[objectA sayHello]; 即,向objectA....
分类:
其他好文 时间:
2015-02-04 01:59:01
阅读次数:
114
题目:《编程之美》P223
string sub_string(const string &s, const int begin,const int end)
{
if (begin > end)
return "";
return s.substr(begin, end);
}
int strings_distance(string s1, string s2)
{
if ...
分类:
编程语言 时间:
2015-02-03 23:07:31
阅读次数:
235
KMP算法next[]深入了解,做到这题才真正明白next[]的用法,希望后面的题目能理解的更深刻。Problem Description CC always becomes very depressed at the end of this month, he has checked his cr...
分类:
其他好文 时间:
2015-02-03 22:43:20
阅读次数:
185
Root of a polynomial in one variableDAOYI PENGLinear algebraic equation $ax+b=0,\,a\neq0$.Solution:\begin{equation} x=-b/a. \end{equation}Quadratic eq...
分类:
其他好文 时间:
2015-02-03 22:41:02
阅读次数:
171
在开发一个平板点餐软件后台订单打印程序时,使用线程订单打印,为防打印阻塞使用临界区。类:type MYPARA=record title:pchar; //标题 str:pchar; flag:integer; //标志 end; PMYPARA=^MYPARA;变量: ThreadId1:DWOR...
// .h#import @interface NSMutableArray (VIMI)- (void)shuffle;@end#import "NSMutableArray+VIMI.h"@implementation NSMutableArray (VIMI)- (void)shuffle{ ...
分类:
其他好文 时间:
2015-02-03 16:42:46
阅读次数:
164
Q:Given a linked list, remove the nth node
from the end of list and return its head.
For example,
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the ...
分类:
其他好文 时间:
2015-02-03 13:20:16
阅读次数:
132
用一个SQL语句完成不同条件的分组(SELECT部分):select QuoteOrderId,SUM(case when(ApprovalStatus=1)then Amount else 0 end) AS CloseAmount,SUM(case when(ApprovalStatus=2)t...
分类:
数据库 时间:
2015-02-03 12:46:17
阅读次数:
199
思路:
先让p指向head,p往后移动n个节点,然后让q指向head,p和q一起后移直至p指向最后一个结点,则q指向的结点即是倒数第n个结点。当然,倒数第len(链表的长度)个结点是一个特殊情况,直接head=head.next即可。...
分类:
其他好文 时间:
2015-02-03 11:06:08
阅读次数:
144
问题是这样:原来代码.html.erb页面中有一个select元素,其每个item对应的是model中的类常量:
类中的常量定义如下:
class Order < ActiveRecord::Base
PAYMENT_TYPES = ["Check","Credit card","Purchase order"]
end
现在想把PAYMENT_TYPES重构至数据库中的表里去,于...
分类:
数据库 时间:
2015-02-03 11:05:10
阅读次数:
186