软件界面:
软件界面:
代码内容
# -*- coding: utf-8 -*- #从datetime模块引入3个类:date,timedelta,datetime from datetime import date,timedelta,datetime """ 时间日期的转换和对比,是比较常见的操作 """ today_date=date.today()#获取当前日期:datetime.date类型 print("today_date={}".format(today_date)) today_date_str=today_date.strftime('%Y-%m-%d')#datetime.date类型转换为字符串 print("today_date_str={}".format(today_date_str)) today_datetime=datetime.strptime(today_date.strftime('%Y-%m-%d'), '%Y-%m-%d')#datetime.date类型转换为字符串,再转换为datetime.datetime类型 select_date_str='2018-06-30' select_datetime = datetime.strptime(select_date_str,'%Y-%m-%d')#字符串类型转换为datetime.datetime类型 print(type(select_datetime)) future_diff=(select_datetime-today_datetime).days#判断日期之前相差的天数 isrealtime=False if future_diff >= 0:#选择日期大于或等于今日今天 isrealtime=True pass print("所选日期是否大于或等于今日:{}".format(isrealtime)) oneday = timedelta(days=1)#时间差对象数据 yes_datetime=select_datetime-oneday#日期类型时间操作 yes_datetime_str=yes_datetime.strftime('%Y-%m-%d')#昨日时间,字符串类型 print("yes_datetime_str={0}".format(yes_datetime_str)) #取年、月、日 print("year={},month={},day={}".format(select_datetime.year,select_datetime.month,select_datetime.day)) #判断每月最后一天:原日期加上一天,如果的天数为1,那原日期就是上个月最后一天 print("is lastday:{}".format((select_datetime+oneday).day==1))
虽然非专业人员不懂程序开发,但下面我用通俗的道理来说明一些事情,应该是每个人都能懂的,我可以豪不谦虚地说,下面的道理适合于任何公司、任何软件开发/网站开发,所以我认为,说过一次之后,应该不需要说第一遍。
软件开发/网站开发:
因为后台开发和界面美工(网站静态页面)是分工的,尽量把页面(需求)确定、做好再进行开发,不然太浪费时间,可能从零开始开发只要一天,之后要进行大幅度的修改,改个两三天,这种开发过程很纠结的,所以,就算是为了开发效率吧,我希望先真正的确定好静态页面效果(软件需求),以保证开始进行程序开发之后,需求不要频繁的大面积的修改。页面设计(需求确定)时要考虑全面一点。
全部以图片格式存储:
全部以图片格式存储:
//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
//在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
//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目录下,输入命令:
最近用MySQL,花时间写了一个过程用来生成EF的model类,有注释,挺方便,用EF类Entity自动生成的没有字段注释。
场景
现在公司的测试环境一些文本日志不让接触,提供一个网络http服务器让人直接访问,这文件大时,一般10MB一个文件,不在同一局域网,网速限制200K,要等很久,访问很慢。
.Net代码请求文本文件最新内容(类似于tail文件)
Powered By Z-BlogPHP 1.7.3
Copyright 2024-2027 pukuimin Rights Reserved.
粤ICP备17100155号