代码改变世界

随笔档案-2012年3月21日

poj 2503 Babelfish ----二分

2012-03-21 20:37 by java环境变量, 297 阅读, 收藏,
摘要: BabelfishTime Limit:3000MSMemory Limit:65536KTotal Submissions:22730Accepted:9756DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of 阅读全文

qsort 与 bsearch 的魔力

2012-03-21 17:36 by java环境变量, 276 阅读, 收藏,
摘要: 转自http://185229677.itpub.net/post/25581/399796qsort函数声明如下:void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));参数说明如下:base: 要排序的数组nmemb: 数组中的元素数目size: 每个数组元素占用内存空间,可使用sizeof获得compar: 比较两个数组元素的比较函数。本比较函数的第一个参数值小于、等于、大于第二参数值时,本比较函数的返回值应分别小于、等于、大于零。也就说你要实现一个这样的函数: 阅读全文

qsort快速排序的整理

2012-03-21 16:32 by java环境变量, 581 阅读, 收藏,
摘要: 转自http://blog.csdn.net/eroswang/article/details/4075580最近用到了qsort,简单整理一下,方便以后的查找qsort,包含在stdlib.h头文件里,函数一共四个参数,没返回值.一个典型的qsort的写法如下qsort(s,n,sizeof(s[0]),cmp);其中第一个参数是参与排序的数组名(或者也可以理解成开始排序的地址,因为可以写&s[i]这样的表达式,这个问题下面有说明); 第二个参数是参与排序的元素个数; 第三个三数是单个元素的大小,推荐使用sizeof(s[0])这样的表达式,下面也有说明 :) ;第四个参数就是很多人 阅读全文

数据库大小分布情况

2012-03-21 14:58 by java环境变量, 269 阅读, 收藏,
摘要: ---数据库大小分布情况SET NoCount ONCREATE TABLE #DBsize ( [DatabaseName] [nvarchar](75) NOT NULL , [Size] [decimal] NOT NULL , [Name] [nvarchar](75) NOT NULL , [Filename] [nvarchar](300) NOT NULL )CREATE TABLE #drives ( [Drive] [char](5) NOT NULL , [MBFree] [decimal] NOT NULL )INSERT INTO #DBsize EXEC sp_MSf 阅读全文

SOUND SERVICE系统音效服务+震动功能实现

2012-03-21 13:57 by java环境变量, 383 阅读, 收藏,
摘要: 2010-9-26 22:19:18 上传下载附件(42.9 KB)PlaySoundDemo1ViewController.h#import <UIKit/UIKit.h>#include <AudioToolbox/AudioToolbox.h>@interface PlaySoundDemo1ViewController : UIViewController { IBOutlet UISwitch *swcallback; IBOutlet UIPickerView *soundPicker; NSArray *soundData; SystemSoundID s 阅读全文

[电源、屏保、闹钟、日程、墙纸] UILocalNotification实现本地的闹钟提醒的方法。

2012-03-21 13:36 by java环境变量, 341 阅读, 收藏,
摘要: UILocalNotification *notification=[[UILocalNotification alloc] init]; if (notification!=nil) { NSDate *now=[NSDate new]; //notification.fireDate=[now addTimeInterval:period]; notification.fireDate = [now dateByAddingTimeInterval:period]; NSLog(@"%d",period); notification.time... 阅读全文

实现 QQLive HD 界面的代码

2012-03-21 13:34 by java环境变量, 252 阅读, 收藏,
摘要: 实现 QQLive HD 界面的代码总的来说QQLive HD 的主界面分成几个部分:电视屏幕窗口 实现方法:使用UIPageControl和UIScrollView实现。//添加一个PageControl控件,显示热点图片 m_pPageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(340, 378, 200, 50)]; if(m_pPageControl == nil) { return; } [m_pPageControl setNumberOfPages:5]; [m_pPageControl ad... 阅读全文

窗口的简单动画

2012-03-21 13:28 by java环境变量, 359 阅读, 收藏,
摘要: 刚刚看到一个窗口动画,给弄个简单例子!创建一个基于view-based的工程,然后添加头文件#import <QuartzCore/QuartzCore.h>和其frameworks然后修改代码!代码实例如下:- (void)viewDidLoad { [super viewDidLoad]; //创建一个内框图 CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 200.0f); UIView *myView = [[UIView alloc] initWithFrame:myImageRect]; myView.b... 阅读全文

NSRunLoop的进一步理解

2012-03-21 13:24 by java环境变量, 263 阅读, 收藏,
摘要: 本文基于一篇网络文章,加入了一些自己的理解,希望对大家有所帮助iPhone应用开发中关于NSRunLoop的概述是本文要介绍的内容,NSRunLoop是一种更加高明的消息处理模式,他就高明在对消息处理过程进行了更好的抽象和封装,这样才能是的你不用处理一些很琐碎很低层次的具体消息的处理,在NSRunLoop中每一个消息就被打包在input source或者是timer source中了,来看详细内容。1.什么是NSRunLoop我们会经常看到这样的代码:- (IBAction)start:(id)sender{pageStillLoading = YES;[NSThread detachNewT 阅读全文

触发器-1

2012-03-21 09:14 by java环境变量, 243 阅读, 收藏,
摘要: ------------------------------------环境代码create table student(stuid varchar2(10) not null,stuname varchar2(10) not null,sex char(2));create table subject (subjectid int,subjectname varchar2(10));create table score(stuid int,subjectid int,score int);insert into student values (1001, 'wind', &# 阅读全文