08
2014
06

qtday03 简单版的贪吃蛇游戏

//snakegame.h

#ifndef SNAKEGAME_H
#define SNAKEGAME_H
#include<QList>
#include<QtWidgets/QLabel>
#include<QtWidgets/QDialog>
#include<QKeyEvent>
#include<QTimer>
/*枚举,表示方向*/
enum Direction{D_UP,D_DOWN,D_LEFT,D_RIGHT};
class SnakeGame:public QDialog
{
    Q_OBJECT
public:
    SnakeGame() ;
    ~SnakeGame();
public slots:
    void snakemove();/*移动*/
public:
    QLabel* getfood();/*产生新食物*/
    void keyPressEvent(QKeyEvent *key);
private:
    QList<QLabel*> snake;/*蛇*/
    QLabel * food;/*食物*/
    Direction dire;/*方向*/
    int foodlen;/*食物长度*/
    int maxlen;/*最大长度*/
    QTimer * timer;/*定时器*/
};
#endif // SNAKEGAME_H


08
2014
06

qtday02 qt做简单的加法器和模拟登陆功能

//在3t2目录下

//adder.h

/*
qt简单加法计算器
*/
#ifndef ADDER_H
#define ADDER_H
#include<QDialog>
#include<QLineEdit>
#include<QtWidgets/QPushButton>
#include<QtWidgets/QLabel>
class Adder:public QDialog{
    Q_OBJECT//让自定义的槽函数生效
    private:
        QLineEdit * add1;
        QLabel * oper;
        QLineEdit *add2;
        QPushButton * equ;
        QLineEdit * res;
        QPushButton * bclose;
    public:
        Adder();
        ~Adder();
        /*自定义槽函数*/
    public slots:
        void getres();
    
};
#endif


08
2014
06

qtday01 ubuntu 下手动编写第一个qt程序

//qt 5.2.1

//1t目录下

//1t.cpp

/*
 第一个qt程序
 */
#include <QApplication>
#include<QtWidgets/QLabel>
#include<QString>
#include<QTextCodec>
int main(int argc,char** argv){
    /*构造一个对象*/
    QApplication app(argc,argv);
    QTextCodec* coder=QTextCodec::codecForName("utf-8");
    /*设置编码对象*/
//    QTextCodec::setCodecForTr(coder);
    //set code to the words
    //QLabel qlab(QObject::tr("hello qt你好 ,today is a nice day!"));
    QLabel qlab(coder->toUnicode("hello qt你好 ,today is a nice day!"));
    qlab.show();
    /*让程序进入事件循环*/
    return app.exec();
}

//在1t目录下,输入命令:

12
2014
05

mssql数据库游标批量修改符合条件的记录

//需求:由于项目刚上传,没有票数,为了表现出一定的人气,需要在一开始把各项目的票数赋一个值 ,

但每个项目不能一样,否则容易看出问题,呵呵 。

08
2014
05

[译]asp.net错误解决:Unable to Validate Data in ASP.NET website

原文:http://www.codeproject.com/Articles/43637/Weird-Error-Unable-to-Validate-Data-in-ASP-NET-web


03
2014
05

UC编程9-管道pipe操作和共享内存段shm操作

//myuc.h

#include<stdio.h>//io流
#include<stdlib.h>//标准库
#include<unistd.h>//uc标准头文件
#include<fcntl.h>//文件控制
#include<string.h>//c字符串
#include<sys/types.h>
#include<sys/mman.h>//内存映射
#include<sys/stat.h>//文件状态信息
#include<sys/wait.h>//进程等等
#include<dirent.h>//目录操作
#include<signal.h>//信号
#include<sys/time.h>//时间,计时器
#include<sys/ipc.h>//ipc进程间通信
#include<sys/shm.h>//共享内存段
#include<sys/msg.h>//消息队列


//9piperead.c

03
2014
05

UC编程8-信号发送函数kill/raise/setitimer/alarm和信号集函数segprocmask

//myuc.h

#include<stdio.h>//io流
#include<stdlib.h>//标准库
#include<unistd.h>//uc标准头文件
#include<fcntl.h>//文件控制
#include<string.h>//c字符串
#include<sys/types.h>
#include<sys/mman.h>//内存映射
#include<sys/stat.h>//文件状态信息
#include<sys/wait.h>//进程等等
#include<dirent.h>//目录操作
#include<signal.h>//信号
#include<sys/time.h>//时间,计时器
#include<sys/ipc.h>//ipc进程间通信
#include<sys/shm.h>//共享内存段
#include<sys/msg.h>//消息队列

//8itimer.c

02
2014
05

UC编程7-进程创建函数fork/vfork 和 execl/信号signal的使用1

//myuc.h

#include<stdio.h>//io流
#include<stdlib.h>//标准库
#include<unistd.h>//uc标准头文件
#include<fcntl.h>//文件控制
#include<string.h>//c字符串
#include<sys/types.h>
#include<sys/mman.h>//内存映射
#include<sys/stat.h>//文件状态信息
#include<sys/wait.h>//进程等等
#include<dirent.h>//目录操作
#include<signal.h>//信号
#include<sys/time.h>//时间,计时器
#include<sys/ipc.h>//ipc进程间通信
#include<sys/shm.h>//共享内存段
#include<sys/msg.h>//消息队列

//exitwiat7.h

02
2014
05

UC编程6-目录操作和创建子进程fork()函数1

//myuc.h

#include<stdio.h>//io流
#include<stdlib.h>//标准库
#include<unistd.h>//uc标准头文件
#include<fcntl.h>//文件控制
#include<string.h>//c字符串
#include<sys/types.h>
#include<sys/mman.h>//内存映射
#include<sys/stat.h>//文件状态信息
#include<sys/wait.h>//进程等等
#include<dirent.h>//目录操作
#include<signal.h>//信号
#include<sys/time.h>//时间,计时器
#include<sys/ipc.h>//ipc进程间通信
#include<sys/shm.h>//共享内存段
#include<sys/msg.h>//消息队列


02
2014
05

UC编程5-fcntl函数获取文件状态和加锁解锁/dup函数和文件映射

//myuc.h

#include<stdio.h>//io流
#include<stdlib.h>//标准库
#include<unistd.h>//uc标准头文件
#include<fcntl.h>//文件控制
#include<string.h>//c字符串
#include<sys/types.h>
#include<sys/mman.h>//内存映射
#include<sys/stat.h>//文件状态信息
#include<sys/wait.h>//进程等等
#include<dirent.h>//目录操作
#include<signal.h>//信号
#include<sys/time.h>//时间,计时器
#include<sys/ipc.h>//ipc进程间通信
#include<sys/shm.h>//共享内存段
#include<sys/msg.h>//消息队列