windows下面可以主线程while loop接受input;但是觉得很丑。
linux没办法这样,可以用注册信号的办法。实现起来也不难:
#include "stdio.h"
#include "unistd.h"
#include "signal.h"
#include "error.h"
volatile bool isStop = false;
static void handl...
分类:
其他好文 时间:
2014-04-29 13:42:21
阅读次数:
418
有时候我们会需要在界面上拖动view;uiview是继承于uiresponder的,所以可以响应触摸相关的事件。
重点是以下一组方法:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent...
分类:
移动开发 时间:
2014-04-29 13:41:20
阅读次数:
485
冒泡排序,往两个方向泡,一个往小泡,一个网大泡
#include
#include
#include
void bubble_sort(int *a,int n){
int temp;
for(int i=0;i<n;i++)
for(int j=0;ja[j+1]){
temp=a[j];
a[j]=a[j+1];
...
分类:
其他好文 时间:
2014-04-29 13:28:21
阅读次数:
364
会话清除与过期
程序主动清除session数据
设置会话失效:session.invalidate()
移除会话中一个属性:
语法:public void removeAttribute(String name);
服务器主动清除长时间没有再次发出请求的session
设置会话过期时间
方法一:public void setMaxInactiveInterval(int interv...
分类:
编程语言 时间:
2014-04-28 10:36:41
阅读次数:
322
-------Handler + Runnable定时器------
privateHandler
mShowHandler;
private Runnable
mShowRunnable;
mShowHandler = new Handler();
mShowRunnable = new Runnable() {
public
void run ()...
分类:
移动开发 时间:
2014-04-28 10:34:40
阅读次数:
547
记录一下,自己用过的打开第三方应用的两种方法;
1.//根据包名类名启动第三方应用(要启动的应用的包名,要启动的activity)
openApp("com.xx.test", "com.xx.test.TestActivity");
private void openApp(String pname,String aname){
// changeInputSo...
分类:
其他好文 时间:
2014-04-28 10:25:41
阅读次数:
400
大数乘法的步骤(先戳我看看大数加法的思想):
首先我们输入要相乘的2个数字,然后逆序。用2层循环来相乘,把下标[i]*[j]计算的结果放在下标[i*j-1]中(下标从1开始),建议及时处理进位问题(char字符范围比较小)。
最后从高位开始输出。
#include
#include
#define MAX 1000
using namespace std;
void InputN...
分类:
其他好文 时间:
2014-04-28 10:24:42
阅读次数:
371
欢迎转载,转载请声明出处!
-----------------------------------------
前言:
java语言中,参数的传递只有一种机制,那就是值传递。
举例:
下面将通过几个例子来说明java中的参数传递机制,这些例子基本涵盖了所有参数传递的情况。
1.基本数据类型:
public static void testBase(int i)...
分类:
编程语言 时间:
2014-04-28 10:11:40
阅读次数:
379
program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Tst
{
class Program
{
static void Main(string[] arg...
分类:
移动开发 时间:
2014-04-27 21:35:59
阅读次数:
467
头文件:
#import
#import
@interface DirectionRouteUtils : NSObject
{
MKDirections *mDirections;
CLGeocoder *mGeocoder;
}
+ (instancetype)sharedInstance;
// 获取导航路线
- (void)findDirectionsFro...
分类:
移动开发 时间:
2014-04-27 21:35:59
阅读次数:
558