- 博客(174)
- 资源 (29)
- 收藏
- 关注
原创 golang.org 无法访问的问题
使用说明windows下git clone https://gitee.com/warrially/golang.org.git %GOPATH%/src/golang.orglinux下git clone https://gitee.com/warrially/golang.org.git $GOPATH/src/golang.org...
2019-09-29 13:55:18 416
原创 golang 解决SQL 空值Null 的问题
type TRows struct { rows *sql.Rows}func NewRows(rows *sql.Rows) *TRows { r := &TRows{} r.rows = rows return r}func (self *TRows) Scan(args ...interface{}) error { args2 := []interface...
2019-09-26 21:09:47 3140
原创 vcpkg 下载包
git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.bat ./vcpkg.exe install openssl:x86-windows zlib:x86-windows
2019-09-13 20:05:33 2227 1
原创 计算文件的MD5值
#include "stdafx.h"#include <string>#include <Windows.h>#include <wincrypt.h>using namespace std;string ComputeFileMD5(const TCHAR *szFilename){ HCRYPTPROV hCryptPro...
2019-08-31 10:39:09 409
原创 开机启动
把文件的快捷方式放在这个里面就可以了%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
2019-08-29 17:14:20 141
原创 golang unicode形态的[]byte, 转行成utf8形态的string
func u16To8(u16 []byte) string { log.Println("u16 = ", u16) if len(u16)%2 != 0 { log.Println("err len", len(u16)) return "" } var body bytes.Buffer for i := 0; i < len(u16)/2; i++ { ...
2019-08-23 21:07:54 10116
原创 Delphi 简单Post
unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdBaseComponent, IdComponent, ...
2019-07-16 15:30:29 1309
原创 Delphi 如何简单的做一个登录窗体
1. 在 工程文件里不要创建 loginFORM Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TMainForm, MainForm); Application.Run;2 在主窗体的FormCreateprocedure TMa...
2019-06-14 11:51:42 1578
原创 碰撞圆周率
#include "stdafx.h"#include <iostream>// 碰撞后速度void txpz(double m1, double m2, double & v1, double & v2){ double v1_ = ((m1-m2)* v1 + 2 * m2 * v2) / (m1 + m2); double v2_ = ((m2...
2019-04-17 11:19:44 2041 2
原创 golang制作一个斗地主游戏服务器[15]:再写打牌和跟牌(下)
本来两个文章想叠加写在一起的,发现内容有点多, 拆分一下前面讲了客户端发送协议的, 现在就要讲服务器如何接收到协议 // 大部分还是抄袭23协议的内容 case 26: // 26 是打掉具体手牌的 req := pack.GetOutCardReq() log.Println("玩家要求打牌", req) nTableIndex := req.GetTab...
2019-04-09 18:38:05 624
原创 golang制作一个斗地主游戏服务器[14]:再写打牌和跟牌(上)
golang制作一个斗地主游戏服务器[6]:打牌和跟牌前面叫地主和抢地主结束了, 本篇基本上就是属于打牌的范畴了.首先把超时的时间延长起来. 不要再超时了. 一定等着我们操作完再继续 select { case <-ch: log.Println("模拟打牌") case <-time.After(time.Second * 10000): // 临时改成10...
2019-04-03 18:59:31 1032
原创 golang制作一个斗地主游戏服务器[13]:再写叫地主抢地主
golang制作一个斗地主游戏服务器[4]:叫地主和抢地主之前的叫地主和抢地主, 都是通过golang 的协程去模拟的我们现在已经有正牌的客户端了. 首先要把超时时间从原先的5秒钟, 暂时延长到足够长的1000秒然后去掉协程中的模拟. 改成通过服务器收到客户端消息来判断模拟首先先在客户端 放两个按钮 一个叫 叫地主 一个叫不叫 self.Btn3 = vcl.New...
2019-03-29 18:38:24 548 3
原创 golang制作一个斗地主游戏服务器[12]:再写发牌
前面已经写过一个发牌的逻辑了golang制作一个斗地主游戏服务器[3]:斗地主给其他三家玩家发牌这时要在上面稍微添加一些逻辑.主要是1. 把实际玩家关联进去2. 给玩家发送手牌数据// dealcard 发牌阶段func (self *TDDZ) dealcard() { // 需要洗一副牌, 并且发送给三个玩家 pCardHeap := NewCards...
2019-03-27 18:03:33 838
原创 golang制作一个斗地主游戏服务器[11]:快速加入
//"服务器, 我想加入XXX号桌子 / 服务器, 帮我快速找一个空位座下吧?"message TJoinTableReq{ optional int32 TableIndex = 1; // 需要加入的桌子编号, 不填就快速加入 optional string NickName = 2; // 昵称 optional int32 Cash = 3; //...
2019-03-27 12:02:22 916 2
原创 golang制作一个斗地主游戏服务器[10]:房间、桌子、玩家
什么房间那些先暂时不管吧. 最简单的方法就是先快速加入桌子, 也不要准备了. 加入就算自动准备, 断线重连什么的也都不管, 现在的目标就是先跑通流程一个斗地主房间 (高级场 中级场 初级场, 通常是倍率不同) 里面有很多桌子package mainimport "log"// TRoom 房间类type TRoom struct {}// NewRoo...
2019-03-25 18:41:41 1911
原创 golang制作一个斗地主游戏服务器[9]:pb基础
根据前面文章的协议 golang制作一个斗地主游戏服务器[7]:服务器和协议的一些想法message TDDZ{ message THeader { 头部应该包含很多内容, 目前先不填 } optional THeader Header = 1; optional int32 Command =...
2019-03-25 17:30:12 671
原创 golang制作一个斗地主游戏服务器[8]:先开一个服务器再说
golang的游戏服务器框架有挺多的, 大体上一个游戏成品的客户端, 都需要接入账号系统和其他分类的系统.这里为了简单化, 先开一个最简单的TCPServer服务器端(网络上的各种服务器框架大同小异, 这里选择用266的tcp框架. 其实是一个意思)package mainimport ( "log" "time" connection "github.com/266ga...
2019-03-25 15:59:52 837
原创 golang制作一个斗地主游戏服务器[7]:服务器和协议的一些想法
一个客户端过来, 首先要校验自己的身份(去自己的账号系统里面校验), 校验结束以后数据暂时存在中心服务器里客户端这个时候进入斗地主的服务器,这个时候 客户端会先向斗地主服务器进行一些简单的交流"服务器你好, 请问你是什么版本的? 你里面现在大概有多少人?""我是斗地主服务器, 我的版本是1.0, 我现在里面有XX个桌子. 有XX个人""可以告诉我前100个桌子的情况...
2019-03-18 18:40:06 1253 5
原创 golang制作一个斗地主游戏服务器[6]:打牌和跟牌
终于到了最重要(其实也是最不重要)的打牌环节了.打牌的逻辑其实很简单选完地主以后 由地主开牌判断手牌是否消耗完毕 ->-> 开牌 -> 有人跟牌 -> 无人跟牌 -> 循环一圈会到自己 -> 本轮结束-> 游戏结束// playcard 出牌阶段func (self *TDDZ) pla...
2019-03-18 18:13:02 1339 3
原创 golang制作一个斗地主游戏服务器[5]:牌型
下面就该进入打牌环节了打牌之前, 首先应该定义牌的类型有哪些.斗地主里面分成单牌, 对子, 三不带, 三带一拖拉机, 顺子, 飞机王炸其中, 拖拉机最多10对, 顺子至少5张 最多12张飞机内容比较多我们先把所有可能出现的牌型列举出来// 牌型const ( cardTypeNIL int = iota // 留空 // 单牌 cardTy...
2019-03-18 11:36:49 860 1
原创 golang制作一个斗地主游戏服务器[4]:叫地主和抢地主
发牌结束以后, 就是三家依次进行叫地主和抢地主了所以逻辑是 叫地主/不要 -> 抢地主/不要 -> 抢地主/不要 -> 抢回来/不要在这里可以用golang 自身的一个特性就是, 通过select 来很方便的执行超时逻辑. 玩家正常选择的时候, 执行上面的chan逻辑. 超时执行下面的chan逻辑 // 叫地主 ch := make(chan in...
2019-03-15 10:13:19 870
原创 golang制作一个斗地主游戏服务器[3]:斗地主给其他三家玩家发牌
接下来需要做一个简单的给三家发牌的逻辑package main// TDDZ -----------------------------------------------------// 斗地主执行type TDDZ struct { pHandCardList1 TCards //第1家的手牌 pHandCardList2 TCards //第2家的手牌 pHandC...
2019-03-14 22:18:27 992
原创 golang制作一个斗地主游戏服务器[2]:一副扑克牌
前一章写的是单张的扑克牌, 这里要写一整副扑克牌首先定义一个扑克牌的切片// TCards type TCards []*TCard新建卡牌的时候, 分配空间, 并且随机洗牌package mainimport ( "log" "math/rand" "sort" "time")func init() { //以时间作为初始化种子 rand.Seed(t...
2019-03-14 22:10:52 1463
原创 golang制作一个斗地主游戏服务器[1]:从扑克牌开始
打牌, 首先就应该从最基础的扑克牌类入手单个牌来说 斗地主3最小, 然后依次是 ... K, A, 2, 小王, 大王// 花色const ( flowerNIL int = iota // 留空 flowerHEITAO // 黑桃(小王) flowerHONGTAO // 红桃(大王) flowerMEIH...
2019-03-14 19:08:09 6113 10
原创 golang制作一个斗地主游戏服务器[0]:前言
原先用C++写的服务器, 现在打算翻译一份golang版的, 顺带整理下思路代码会放在git上托管, 边写边更吧git 地址 http://github.com/后面你们猜--------------------------------------------------------------服务器大概的架构是这样的Client(客户端) <-----&...
2019-03-14 16:31:59 2101 2
转载 Delphi 的接口自动回收内存
unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;type TForm1 = ...
2019-02-25 10:48:05 644
原创 sublime 无法使用 package control 2019
An error occurred installing package control please check the Console for detailsvisit https://packagecontrol.io/docs/troubleshooting for help https://pan.baidu.com/s/1A9wMFVMs_pUByI...
2019-02-15 17:54:18 633
原创 error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
error C2447: “{”: 缺少函数标题(是否是老式的形式表?) 这个BUG是以为在win7上使用了 LF 的格式编码导致的. 使用Notepad++ 修改成 BOM-UTF8 和 windows 的 CR LF 格式一切正常...
2019-02-09 20:09:48 20653 2
原创 今天放了个低级失误
(_Ptr_user & (_BIG_ALLOCATION_ALIGNMENT - 1)) == 0 程序运行中报了这个错误上网查了下都说什么openCV的错误, 还有vector的错误. 结果是 返回值出了问题. 函数定义了返回值是 string 结果返回了 bool...
2019-01-29 11:08:16 353
原创 vs2015 未将对象引用设置到对象的实例
在控制面板-卸载或修复程序太麻烦,而且不一定保证解决,可以这样------打开--C:\Users\用户名\AppData\Local\Microsoft\VisualStudio\,然后把文件全部删了,再打开vs就恢复默认配置了,重新设置就ok 网上说的狗屁注册表, 根本就没用.vs2015 未将对象引用设置到对象的实例vs2015 未将对象引用设置到对象的实例vs20...
2019-01-04 17:34:38 8996 4
原创 Delphi 自带线程池
unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Threading, Vcl.StdCtrls;...
2018-12-28 16:39:05 5094 3
原创 golang八字库
go get github.com/warrially/BaziGohttps://github.com/warrially/BaziGo.gitgit clone https://github.com/warrially/BaziGo.gitGO 语言 八字算法 三清宫命理八字 golang 八字 四柱---------------------------------------------...
2018-04-25 09:34:04 904
翻译 GO下载地址备份百度网盘
百度网盘: https://pan.baidu.com/s/1lu4Y_LB_vplz-RaAu1iv3QStable versionsgo1.10.1 ▾File nameKindOSArchSizeSHA256 Checksumgo1.10.1.src.tar.gzSource 17MB589449ff6c3ccbff1d391d4e7ab5bb5d5643a5a41a04c99315e55...
2018-04-10 11:54:22 9437
原创 LUA轻量级DUMP
local function dump(t, n) n = n or ""; for k,v in pairs(t) do if type(v) ~= "table" then print(n,k.." = "..v) else print(n,k.." = {") dump(v...
2018-03-05 16:45:35 672
转载 Delphi 获取系统时间分隔符
这段代码本身是没有问题的,但是发现如果更改了系统日期分隔符(例如将系统日期分隔符更改为2016/4/11,“-”变为"/"),StrToDate就会报错,提示:'2016-4-11'不是有效日期类型,通过这个可以说明StrToDate函数是转换的依据就是系统当前日期分隔符,所以我们要像上面代码将字符串转换为日期类型,必须先同步当前系统日期分隔符,以让程序适应系统。//声明一个返回当前日期分隔符的函...
2018-02-27 12:02:45 1553
转载 git status 显示中文
原帖地址http://blog.csdn.net/cjopengler/article/details/46585319git status 显示中文原创 2015年06月21日 23:13:05标签:git3352在中文情况下 git status是 “\344\272\247\345\223\201\351\234\200\346\261\202” 差不多这样的。解决这个问题方法是:git c...
2018-02-27 10:15:44 621
转载 用go语言做一个普通的聊天服务器DEMO
package mainimport ( "fmt" "log" "net")var ConnMap map[string]*net.TCPConnfunc boradcastMessageString(message string) { b := []byte(message) for _, conn := range ConnMap { conn.Write(b)
2018-02-01 16:55:46 1205
原创 VerySimple.Lua 2.0 print 中文乱码问题
function TVerySimpleLua.Print(L: Lua_State): Integer;var N, I: Integer; S: MarshaledAString; Sz: size_t; Msg: String;begin Msg := ''; N := lua_gettop(L); //* number of arguments */
2018-01-18 19:24:16 1102
原创 LUA 排序算法和性能分析[6]:归并排序算法
选择排序算法时间开销:短稳定性:复杂度:math.randomseed(os.time());local real_print = print;local nLine = 0;function print(...) real_print(nLine, ...) nLine = nLine + 1;end;loca
2017-12-20 14:28:08 569
原创 LUA 排序算法和性能分析[5]:插入排序算法
插入排序算法时间开销:较长稳定性:复杂度:math.randomseed(os.time());local real_print = print;local nLine = 0;function print(...) real_print(nLine, ...) nLine = nLine + 1;end;local t = {};
2017-12-20 14:25:39 1774
Lua 版 Excel 工具
2018-01-24
Sublime插件--- C++代码自动格式化
2016-09-21
Raknet for Delphi 简单封装2
2013-11-11
Raknet 4.0
2013-10-15
GDI+相关应用例子源代码
2009-07-14
税率计算delphi代码
2009-06-27
乒乓台技术教程chm 日文版part3
2009-06-10
乒乓台技术教程chm 日文版part2
2009-06-10
乒乓台技术教程日文版chmpart1
2009-06-10
PHOTOVIEWER
2009-06-01
GIFImage22
2009-06-01
TRegware 4.02
2009-05-31
AviWriter 带demo
2009-05-31
FlashSDK230
2009-05-31
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人