- 博客(90)
- 收藏
- 关注
原创 最简便的java-jdbc-mysql
0x001 环境介绍编写环境:win10编写工具:eclipse neonjdk:1.8数据库:mysql数据表创建语句:CREATE TABLE `score` ( `id` int(11) NOT NULL AUTO_INCREMENT, `teacher_id` varchar(10) NOT NULL, `student_id` varchar(10) NO...
2018-03-29 07:59:32
344
原创 java 多态接口的实现
//接口的定义interface eat{ void hand(); void mouth();}class Animal implements eat{ private String name; private String sex; private int age; public Animal() { // TODO Auto-generated constru...
2018-03-22 07:31:11
451
原创 java 重写和重载的区别
class Animal{ private String name; private String sex; private int age; public Animal() { // TODO Auto-generated constructor stub } public void move() { System.out.println("animal move...
2018-03-22 07:17:05
541
原创 java类继承案例
class Animal{ //shift+alt+s 选择generate getters and setters //自动生成属性 private String name; private String sex; private int age; public Animal(String dName, String dSex, int dAge) { // TO...
2018-03-21 09:44:35
1489
原创 go 语言for循环的使用
1、编写环境系统环境:win10编译工具:LiteIDE2、乘法口诀的编写// 2 project main.gopackage mainimport ( "fmt")func main() { var maxLayer int = 9 //申请整数变量 //for 循环的使用 for lay := 1; lay <= maxLayer; lay++ { for ...
2018-03-03 09:40:13
1041
原创 ubuntu 搭建 dotnet环境
微软的站点:https://www.microsoft.com/net/learn/get-started/linuxubuntuubuntu 安装dotnet 指令: sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" ...
2018-02-26 16:20:34
4728
原创 linux网络模型非阻塞i/o模型代码实现
#include #include #include #include #include #include #include #include #include #include #define ErrFlag -1#define ShowErrMsg(msg)\ do{ perror(msg); exit(1); }while(0)void* myFunc
2018-01-18 23:46:03
374
原创 linux网络模型-阻塞i/o代码实现
0x00 环境和编辑工具linux os:ubuntu 16.04editer:vim编译工具:g++0x01 代码实现#include #include #include #include #include #include #include #include #include using namespace std;#define ErrFla
2018-01-16 09:42:25
307
原创 ubuntu使用df指令查看磁盘使用情况
系统版本:ubuntu 16.04root@reacher:~/gethFile# df -h Filesystem Size Used Avail Use% Mounted onudev 2.0G 0 2.0G 0% /devtmpfs 396M 2.8M 393M 1% /run/dev/v
2018-01-15 16:37:55
8943
原创 C++ Primer 第五版第一章Sales_item.h源码
#ifndef SALESITEM_H // we're here only if SALESITEM_H has not yet been defined #define SALESITEM_H // Definition of Sales_item class and related functions goes here #include #include
2018-01-15 09:50:55
1994
原创 boost 的简单使用和编译
0x001 系统版本系统版本:Ubuntu 16.04boost 版本:1.58.00x002 实现代码#include #include #include using namespace std;int main(int argc, char* argv[]){ cout << BOOST_VERSION << endl; //boost版本号
2018-01-13 15:20:46
232
原创 程序函数的模型和解析
#include using namespace std;/*备注: 这里解析一下函数格式argc 指令数量argv 指令集合*///int 是函数处理结果返回类型//main 该函数的函数名//int argc, char*argv[] 函数形参,用于调用是传递进来做函数运算的参数int main(int argc, char*argv[]) {// //TOD
2018-01-12 10:39:21
270
原创 xshell上传文件linux
0x00 系统环境linux 系统:ubuntu 16.04xshell 版本: xshell5传输文件系统:win100x01 安装rz命令指令reacher@ubuntu:~$ sudo apt-get install -y lrzsz上传文件指令:reacher@ubuntu:~$ mkdir uploadreacher@ubuntu:~$
2018-01-03 11:36:25
300
原创 Redis C++编程实例string操作
0x00 编写代码环境操作系统:ubuntu linuxredis 版本:3.0.6查看redis版本指令: redis-server -v 0x01 具体编码实现#include #include #include #include #include #include #include // gcc redis.c -o re
2017-12-19 20:54:36
332
转载 欢乐斗地主玩法规则
欢乐斗地主是:一、发牌 一副牌 54 张,一人 17 张,留 3 张做底牌,在确定地主之前玩家不能看底牌。 扑克牌花色牌数介绍:另2张是副牌(大王和小王)。52张正牌又均分为13张一组,并以黑桃、红桃、梅花、方块四种花色表示各组,每组花色的牌包括从1-10(1通常表示为A)以及J、Q、K标示的13张牌 二、叫牌 叫牌按出牌的顺序轮流进行,叫牌时可以选择 “叫地主 ” 、“ 不叫 ” 。如果
2017-12-14 11:52:44
6657
原创 linux检测内存泄漏工具valgrind
0x00环境系统版本:ubuntu16.04检测工具:Valgrind 内存泄漏的产生:内存泄漏(Memory Leak)是指程序中己动态分配的堆内存由于某种原因程序未释放或无法释放,造成系统内存的浪费,导致程序运行速度减慢甚至系统崩溃等严重后果! Valgrind使用的目的:在人为编写代码不能预防消除内存泄漏的情况下,使用该工具对代码进行检测。0x01valrin
2017-12-13 16:09:12
1425
原创 c++练习-类对象对比大小
0x00 用到的知识点类的封装、有參构造函数、引用、 this指针0x01 代码class Number{public: Number(){}public: Number(const int& iValue) { this->m_Value = iValue; }public: /*两个数相比较大小 const Number& obj 比较数实
2017-12-08 18:27:29
2073
原创 c++函数重载的条件
0x00 函数重载的条件 函数重载的四个条件:函数名相同,形参数量不同,形参类型不一样,形参顺序不一样0x01 代码实现int ShowValue(int iValue){ cout << iValue << endl;}//函数名相同、形参个数不同int ShowValue(int iValue, int iValueA){ cout << iValue
2017-12-08 17:42:18
9253
原创 函数形参默认值
/*函数设置默认参数 IPAddress 数据库地址 port 端口号,默认3306*/bool ConnectDB(const std::string& IPAddress, int port = 3306){ if ( IPAddress.empty()|| (port < 0)) { return false; } //TODO: connect mysql ser
2017-12-08 12:01:33
574
原创 c++练习-构造学生类
#define IN#define OUTclass student{public: student() { }public: student(IN const std::string& strName, IN const int& iAge) { if ( (strName.empty())|| (iAge < 0)) { //用 log 记录错误
2017-12-08 11:29:53
695
原创 cpp函数传递值的三种方式
0x00 函数传递值的三种方式值传递、地址传递、引用传递 0x01 代码/* 通过解析mysql 的查询函数,来理解函数传递方式const char *query 地址传递unsigned long length*/int mysql_real_query(MYSQL *mysql, const char *query, unsigned long length)
2017-12-08 08:50:40
1588
原创 cpp引用的运用场景
0x00 引用的运用场景#define OUT //场景1:需要修改实参void TestChangeValue(OUT int& iNum){ iNum = 2;} //场景2:不需要改变实参void TestNoChangeValue(const int& iNum){ //iNum = 3; 报错 //只能用作参数进行加工数据,不能修改传进来的实参 int
2017-12-08 01:05:26
216
原创 cpp中类和struct的区别
0x00 代码struct tagDog{ std::string name; void ShowName() { cout name << endl; }};class Dog{ std::string name; void ShowName() { cout name << endl; }}; int main(){ tagDog dd;
2017-12-08 00:27:13
1591
原创 cpp全局变量和局部变量的使用
0x00代码int iValue = 100;int main(){ int iValue = 200; //就近原则,输出200的值 cout << iValue << endl; //输出全局参数使用::标记符 cout << ::iValue << endl; return 0;}0x01解析a.有一个问题就是两个变量名重复,这是一个不好的习惯,这里只
2017-12-07 23:56:46
906
原创 cpp笔试-virtual函数类继承问题
0x00笔试题class a{public: virtual void test() { cout << "a func" << endl; }};class b :public a{public: void func() { test(); } virtual void test() { cout << "b func" << endl; }
2017-12-07 23:30:22
301
原创 stl容器vector存储类对象及其使用方式
0x00 唠唠叨叨工作那么长时间stl容器很少去存储简单类型,一般都是利用stl容器的特性,去存储复杂类型,比如:类对象、结构体....0x01 实例操作class CheckInfo{public: CheckInfo(std::string _strTime, std::string _token) { if (!_strTime.empty()) {
2017-11-14 07:44:05
11200
原创 python 类定义和实例化使用
单方面的记录一下简单的python类对象创建和实例化0x00代码# coding=utf-8class Student(object): #构造函数 def __init__(self, _name, _age): #self 类似this指针 # self.name 定义类属性 self.name = _name; self.age
2017-11-13 08:09:55
7495
原创 tinyxml在windows环境下编译
0x00 编译环境系统环境:win10编译器:vs2015tinyxml版本:tinyxml_2_6_20x01 编译会遇到的问题1.1 高版本vs编译升级问题。旧版本vs编写的tinyxml,用高版本打开需要升级,默认确定就行1.2 xmltest.cpp报错//1142缺少",加上就行了 const char*
2017-10-14 23:20:24
1854
1
原创 C++不可继承类final
0x00触发场景经理丢了一份win服务器代码给我,看到一个类这样的写法class xxxx final ,懵了。默默记下来,回来查资料做实验,看一下到底是什么新姿势。0x01测试代码class System final{private: unsigned int version;};//这里winSystem继承System报错class WinSy
2017-10-13 07:14:46
1906
原创 lua_func.hpp
#ifndef __LUA_FUNC_H__#define __LUA_FUNC_H__#include #include #include #include #include #include #include using namespace std;#ifdef __cplusplusextern "C" {#endif#include "lua.h"#in
2017-10-06 19:48:16
302
原创 C/C++调用lua脚本函数
0x00 开发环境编译环境:ubuntu 16.04lua版本:5.20x01 吐槽很多哥们给出的代码都是随便一写,这里进行了一层简单的封装,希望可以帮到有需要的网友。这里先给出lua和主函数的实现,c调用lua的封装函数放在这里xxxxx0x02 lua和main.cpp#include "lua_func.hpp" int mai
2017-10-06 19:41:00
487
原创 segmentation fault (core dumped)调试
0x00环境预览linux环境:ubuntu 16.040x01.设置core文件reacher@ubuntu:~$ ulimit -c unlimited // 设置core大小为无限reacher@ubuntu:~$ ulimit unlimited //设置文件大小为无限0x02.再次编译和执行程reacher@ubuntu:~/luafunc$
2017-10-06 09:10:43
1629
原创 C/C++语言调用lua函数和编译问题
0x00环境和吐槽环境:lua安装版本:lua 5.2lua安装系统:ubuntu 16.04吐槽:网上找到代码开始进行测试C/C++ linux环境下调用lua脚本,各种错。网上给出的也是粘贴复制,没有对自己的问题进行剖析。神烦!!!!0x01开始进行排错1.1 lua API版本不兼容reacher@ubuntu:~/luafunc$ g++ -o ad
2017-10-05 23:22:02
708
原创 外部链接ubuntu环境mysql
0x00 环境预览mysql 安装环境 : ubuntu 16.04操作环境:win100x01 设置Ubuntu下mysql配置1.1 设置连接帐号和密码mysql -u root -root>use mysql;mysql>update user set host = '%' where user ='root';mysql>select host, use
2017-10-05 07:05:20
910
原创 超连接提交表单数据
0x00 场景还原 网上找了一套bootstrap的登录界面与http服务器通讯老是不能将表单数据提交给CGI,默默将框架代码刷了好几遍。之后定眼一看这套bootstrap使用的是标签提交表单,而不是submit。浪费了好多时间,大坑。0x01 源码1.1
2017-09-29 16:20:58
835
原创 ubuntu安装redis
0x00 环境 安装环境: ubuntu16.0.4 0x01 安装指令#使用命令安装redisreacher@ubuntu:~$ sudo apt-install redies-server#启动redis serverredis-server#检测redis是否在系统执行reacher@ubuntu:~$ redis-cli127
2017-09-23 19:34:28
251
原创 STL简介和实例代码
0x00 什么是STLSTL是Standard Template Library的简称,对数据结构的再一次封装。0x01 stl常用的三大组件1.1 容器序列容器关联式容器1.2 算法质变算法非质变算法1.3 迭代器输入迭代器输出迭代器向前迭代器双向迭代器随机访问迭代器0x02 实例代码以实例代码
2017-09-23 00:16:45
368
原创 lua协程
1.1 创建一个协程--创建一个协程cor_func = coroutine.create( function () print("hello world"); end);--查看一下coroutine.create的返回值print(cor_func);--[[thread: 001EC560 返回一个线程实例--]]1.2 启动协程cor_f
2017-09-19 20:28:39
297
原创 mysql检索数据
0x00 SELECT简介简单的来说SELECT 语句用于从表中选取数据。0x01 select的用法1.1 检索数据表内所有列数据SELECT * FROM city;IDNameCountryCodeDistrictPopulation1KabulAFGKabol17800002Q
2017-09-19 08:43:30
394
原创 c语言不定长形参
0x00 编写在看libevent的log模块时,log模块以不定长形参的样式进行获取参数,突然忘记了c怎么玩了,所以写个小例子来记录一下。0x01 编写代码/*******@Describe:叠加数值@Return: -1 存在问题x 返回值*/int ResultAddValue(int fValue, ...){ int result_value = 0;
2017-09-16 14:02:33
746
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人