现在位置: 首页 > bloodline发表的所有文章
  • 04月
  • 05日
综合 ⁄ 共 2329字 评论关闭
最小费用最大流 换模板。 #include <iostream> #include <cstdlib> #include <cstdio> #include <string> #include <cstring> #include <cmath> #include <vector> #include <queue> #include <algorithm> #include <map> using namespace std; const int maxn = 1010; const int INF = 0x3f3f3f3f; struct Edge { int from, to, cap, flow, cost; Edge(int from, int to, int cap, int flow, int cost): from(from), to(to), cap(cap), flow......
阅读全文
  • 09月
  • 04日
综合 ⁄ 共 975字 评论关闭
1.ActivityManager: Warning: Activity not started, its current task has been brought to the front  说明:模拟器中已经有一个实例在运行。  解决方法:退出模拟器中运行的程序,再次运行即可解决!  2.No grammar constraints (DTD or XML schema) detected for the document  说明:在编辑器中看到像这样关于缺少语法约束(DTD 或 XML 架构)的警告,尽管忽略这些警告。  解决方法:windows -> preferences -> xml -> xml files -> validation -> Indicate when no grammar is specified: 选择Ignore即可。 ......
阅读全文
  • 05月
  • 23日
综合 ⁄ 共 5585字 评论关闭
什么是多态?它的实现机制是什么呢?重载和重写的区别在那里?这就是这一次我们要回顾的四个十分重要的概念:继承、多态、重载和重写。 继承(inheritance) 简单的说,继承就是在一个现有类型的基础上,通过增加新的方法或者重定义已有方法(下面会讲到,这种方式叫重写)的方式,产生一个新的类型。继承是面向对象的三个基本特征--封装、继承、多态的其中之一,我们在使用JAVA时编写的每一个类都是在继承,因为在JAVA语言中,java.lang.Object类是所有类最根本的基类(或者叫父类、超类),如果我们新定义的一个类没有明确地指定......
阅读全文
  • 05月
  • 16日
综合 ⁄ 共 12090字 评论关闭
package android.util;      import java.util.LinkedHashMap;   import java.util.Map;      /**   * A cache that holds strong references to a limited number of values. Each time   * a value is accessed, it is moved to the head of a queue. When a value is   * added to a full cache, the value at the end of that queue is evicted and may   * become eligible for garbage collection.   * Cache保存一个强引用来限制内容数量,每当Item被访问的时候,此Item就会移动到队列的头部。  * 当cache已满......
阅读全文
  • 04月
  • 16日
综合 ⁄ 共 3348字 评论关闭
Android上的静默安装似乎是个很诱人的功能,好多人都问这个问题。今天分享下实现静默安装的两种方法,但当看完这篇文章后,仍会让一些人失望滴。       Android把所有的Permission依据其潜在风险(属性名为protectionLevel )划分为四个等级,即"normal "、"dangerous "、 "signature "、 "signatureOrSystem "。 INSTALL_PACKAGES属于后两者。让我们看一下官方文档对后两类的描述吧。   "signature ": A permission that the system grants only if the requesting application is signed with the same certificate as the appl......
阅读全文
  • 03月
  • 31日
综合 ⁄ 共 4256字 评论关闭
DvdPlayer is the main execution program the RTD1073 runs to enable everything from display, infra-red control, enable service, install application to control video and audio playback etc. DvdPlayer是RTD1073的主执行程序,它接管着开发板的一切,包括显示、红外遥控、启动服务、安装软件以控制音视频回放等。 It is started by the init process and is guarded by RootApp which will restart it once it is crashed. 它又init进程创建,并由RootApp看护,一旦崩溃由RootApp重启。(注:译者发现一个现象,结束了R......
阅读全文
  • 02月
  • 20日
综合 ⁄ 共 575字 评论关闭
http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?pid=1001&cid=542 #include <iostream> #include <string> #include <algorithm> #include <vector> #include <cstdio> using namespace std; int main() { int n ; while (scanf("%d", &n) != EOF) { int t1[n]; int t2[n]; for ( int i = 0 ; i < n ; ++i) cin >> t1[i] ; for ( int i = 0 ; i < n ; ++i) cin >> t2[i] ; sort(t1,t1+n); sort(t2,t2+n); int ......
阅读全文
  • 02月
  • 14日
综合 ⁄ 共 443字 评论关闭
自动旋转屏幕 -(BOOL)shouldAutorotate{     return YES; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {     return YES; } 重写父类方法适应屏幕 -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {     [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];     [self configureViewForOrientation:toInterfaceOrientation]; }
阅读全文
  • 01月
  • 30日
综合 ⁄ 共 4344字 评论关闭
我没事的时候写的自主实现Session功能的类,基于文件方式存储Session数据,测试基本通过,还比较好玩,实际应用没有意义,只不过是学习Session是如何实现的。 一般基于文件存储Session数据效率不是很高,毕竟跟磁盘IO是有关系的,如果需要多台服务器共享数据,可以考虑使用NFS来存储数据,如果需要比较快的速度,可以考虑使用共享内存(shm)来保存数据,直接把Session数据存储路径指定为/dev/shm,这样磁盘IO会提高不少,不过shm空间比较小,一般Linux下是60多M,所以不可能保存太多数据。 <?php //===========================......
阅读全文
  • 12月
  • 28日
综合 ⁄ 共 2655字 评论关闭
  2006-02-15 09:21作者:出处:IBM责任编辑:原野   该宏如果获得自旋锁lock,它也将保存标志寄存器的值到变量flags中,并且失效本地中断,如果没有获得锁,它什么也不做。   因此如果能够立即获得锁,它等同于spin_lock_irqsave,如果不能获得锁,它等同于spin_trylock。如果该宏获得自旋锁lock,那需要使用spin_unlock_irqrestore来释放。 spin_trylock_irq(lock)   该宏类似于spin_trylock_irqsave,只是该宏不保存标志寄存器。如果该宏获得自旋锁lock,需要使用spin_unlock_irq来释放。 spin......
阅读全文
  • 12月
  • 20日
综合 ⁄ 共 776字 评论关闭
数据的快速查找、判重和删除。   用12M的内存可以表示8位数的电话号码: 9999999 = 99M bit = 12M Bytes   ============================================================================== ==============================================================================   #define BITSPERWORD 32 #define SHIFT 5 #define MASK 0x1F #define N 10000000 int a[1 + N/BITSPERWORD]; void set (int i){a[i>>SHIFT] |=(1<<(i&MASK));} void clr (int i){a[i>>SHIFT] &=(1<<(i&MASK));} v......
阅读全文
  • 10月
  • 12日
综合 ⁄ 共 1913字 评论关闭
  在<<WINDOWS编程短平快>>(南京大学出版社)一书中是这么说的:句柄是WONDOWS用来标识被应用程序所建立或使用的对象的唯一整数,WINDOWS使用各种各样的句柄标识诸如应用程序实例,窗口,控制,位图,GDI对象等等。WINDOWS句柄有点象C语言中的文件句柄。  <<Microsoft Windows 3 Developer's Workshop>>(Microsoft Press,by Richard Wilton)一书中句柄的概念是这样的:在Windows环境中,句柄是用来标识项目的,这些项目包括:模块(module)、任务(task)、实例(instance)、文件(file)、内存块(block of mem......
阅读全文