07 2015 档案

摘要:最近心血来潮,想看看自己平时写的乱七八糟的代码都有多少行了,就写了这个脚本。因为我的代码都写在了一个总目录里面,所以统计起来还算比较方便。统计脚本是用shell写的,支持4个参数,-[qQhd],其中h :为帮助参数,显示如下的帮助信息$ cntline.sh -hUsage : cntline.... 阅读全文
posted @ 2015-07-31 22:57 fengbohello 阅读(1272) 评论(0) 推荐(0) 编辑
摘要:1、代码 1 package main 2 3 import "fmt" 4 /* 5 #include 6 #include 7 void hello() 8 { 9 printf("Hello World !\n");10 }11 */12 import "C"13 14 func... 阅读全文
posted @ 2015-07-31 22:40 fengbohello 阅读(983) 评论(0) 推荐(0) 编辑
摘要:列举几个反射的例子:1)简单类型反射,2)复杂类型反射,3)对反射回来的数据的可修改属性1、简单类型反射 1.1)代码package mainimport ( "fmt" "reflect")func main() { var x float64 = 3.4 v := re... 阅读全文
posted @ 2015-07-31 22:36 fengbohello 阅读(601) 评论(0) 推荐(0) 编辑
摘要:1、rc.loacl的启动 /etc/rc.d/rc.local 阅读全文
posted @ 2015-07-31 22:06 fengbohello 阅读(207) 评论(0) 推荐(0) 编辑
摘要:1、安装Graphviz (windows 版本,后面说linux下的安装) 1.1)下载安装文件从graphviz官网下载http://www.graphviz.org/Download.php或者从我的百度网盘下载http://pan.baidu.com/s/1i3mzunV下载后双击安装,跟... 阅读全文
posted @ 2015-07-31 22:04 fengbohello 阅读(16634) 评论(1) 推荐(0) 编辑
摘要:1、C++ 中 string 类的 find 方法列表size_type std::basic_string::find(const basic_string &__str, size_type __pos);size_type std::basic_string::find(const _Char... 阅读全文
posted @ 2015-07-31 21:38 fengbohello 阅读(2930) 评论(0) 推荐(0) 编辑
摘要:1、使用了一个小程序输出所有的errno对应的error字符串,代码如下#include void showError(int err){ printf("errno : %5d , error : %s\n", err, strerror(err));}void showAllErr(){ i... 阅读全文
posted @ 2015-07-31 17:27 fengbohello 阅读(7108) 评论(0) 推荐(1) 编辑
摘要:1. dumpcap -i eth0 -q -n -b duration:120 -b files:5000 -s65535 -f "! ip broadcast and ! ip multicast and ! ether broadcast and ! ether multicast" -w /... 阅读全文
posted @ 2015-07-27 17:37 fengbohello 阅读(2722) 评论(0) 推荐(0) 编辑
摘要:自己制作ssl证书:自己签发免费ssl证书,为nginx生成自签名ssl证书 这里说下Linux 系统怎么通过openssl命令生成 证书。 首先执行如下命令生成一个keyopenssl genrsa -des3 -out ssl.key 1024 然后他会要求你输入这个key文件的密... 阅读全文
posted @ 2015-07-26 19:17 fengbohello 阅读(1055) 评论(0) 推荐(0) 编辑
摘要:1、代码结构2、运行实例1、代码结构$ tree.├── photoweb.go├── public│ ├── css│ ├── images│ └── js├── uploads└── views ├── list.html └── upload.html 1.1)photoweb.... 阅读全文
posted @ 2015-07-25 02:20 fengbohello 阅读(934) 评论(0) 推荐(0) 编辑
摘要:vim命令笔记a 插入insert 插入:%!xxd 以16进制方式进行编辑:%!xxd -r 从16进制还原 阅读全文
posted @ 2015-07-25 02:08 fengbohello 阅读(160) 评论(0) 推荐(0) 编辑
摘要:MAKE = g++ -g #MAKE = gcc -g FILES = tfall : $(FILES)#DYSRC = target.c #DYTGT = $(DYSRC:.c=.o) %.o : %.c $(MAKE) -c $^ -o $@%.o : %.cpp $(M... 阅读全文
posted @ 2015-07-24 11:10 fengbohello 阅读(236) 评论(0) 推荐(0) 编辑
摘要:1、linux下watch命令的基本用法# watch --helpUsage: watch [-dhntv] [--differences[=cumulative]] [--help] [--interval=] [--no-title] [--version] -d, --differenc... 阅读全文
posted @ 2015-07-22 17:56 fengbohello 阅读(635) 评论(0) 推荐(0) 编辑
摘要:1、mysql 客户端 开发 链接库 1.1)CentOS yum install mysql-devel 阅读全文
posted @ 2015-07-22 15:18 fengbohello 阅读(350) 评论(0) 推荐(0) 编辑
摘要:top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器。下面详细介绍它的使用方法。top - 01:06:48 up1:22,1 user,load average: 0.06, 0.60,0.48 Tasks:29 total,... 阅读全文
posted @ 2015-07-22 10:30 fengbohello 阅读(513) 评论(0) 推荐(0) 编辑
摘要:用Go语言实现一个最简单的http服务器端,主要用到了package io, log, net/http 这个3个库。用到的函数包括: http.Handle() http.HandlerFunc() http.ListenAndServe()目录:1、代码2、运行1、代码$ cat hell... 阅读全文
posted @ 2015-07-22 00:39 fengbohello 阅读(2465) 评论(0) 推荐(0) 编辑
摘要:本文介绍如何使用Go语言自带的库把对象转换为JSON格式,并在channel中进行传输后,并把JSON格式的信息转换回对象。1、Go语言的JSON 库 Go语言自带的JSON转换库为encoding/json 1.1)其中把对象转换为JSON的方法(函数)为json.Marshal(),其函数原... 阅读全文
posted @ 2015-07-21 22:51 fengbohello 阅读(91518) 评论(4) 推荐(0) 编辑
摘要:1、代码2、编译及运行1、网络编程 TCP 示例simplehttp.go 代码 1 package main 2 3 import ( 4 "net" 5 "os" 6 "io" 7 "bytes" 8 "fmt" 9 )10 11 func main()... 阅读全文
posted @ 2015-07-20 23:20 fengbohello 阅读(1044) 评论(0) 推荐(0) 编辑
摘要:1、代码2、编译及运行1、Go语言网络编程:ICMP示例代码icmptest.go 1 package main 2 3 import ( 4 "fmt" 5 "net" 6 "os" 7 "io" 8 "bytes" 9 )10 11 func main(... 阅读全文
posted @ 2015-07-20 23:14 fengbohello 阅读(1545) 评论(1) 推荐(0) 编辑
摘要:1、工程代码2、编译及运行1、工程目录结构$ tree cgsscgss├── cgss.go└── src ├── cg │ ├── centerclient.go │ ├── center.go │ └── player.go └── ipc ├── ... 阅读全文
posted @ 2015-07-19 22:38 fengbohello 阅读(1042) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行3、解析1、代码 1 package main 2 3 import ( 4 "time" 5 "fmt" 6 ) 7 8 func waitFor(ch chan int) { 9 fmt.Println(time.Now(), "writing ...... 阅读全文
posted @ 2015-07-19 00:38 fengbohello 阅读(1232) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行3、解析1、代码 buffer.go 1 package main 2 3 import ( 4 "fmt" 5 "time" 6 ) 7 8 func readThread(ch chan int) { 9 fmt.Println("read for r... 阅读全文
posted @ 2015-07-18 10:33 fengbohello 阅读(1936) 评论(5) 推荐(0) 编辑
摘要:一、添加规则#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT 然后保存: #/etc/rc.d/init.d/iptables sav... 阅读全文
posted @ 2015-07-15 00:17 fengbohello 阅读(844) 评论(0) 推荐(0) 编辑
摘要:1、代码2、编译及运行1、目录结构 1.1) 1 $ tree 2 . 3 ├── mplayer.go 4 └── src 5 ├── mlib 6 │ ├── manager.go 7 │ └── manager_test.go 8 └── mp 9 ... 阅读全文
posted @ 2015-07-13 22:45 fengbohello 阅读(1029) 评论(0) 推荐(0) 编辑
摘要:1、代码 1.1)test.l 1.2)test.y 1.3)Makefile (因为是在linux环境下,所以使用了Makefile)2、编译与运行 2.1)编译 2.2)运行1、代码(也可以在我的百度网盘下载:http://pan.baidu.com/s/1o65k7v8) 1.1... 阅读全文
posted @ 2015-07-09 19:43 fengbohello 阅读(1967) 评论(4) 推荐(1) 编辑
摘要:1、制作补丁包 命令格式 diff -uNr oldfile.c newfile.c > x.patch2、打补丁 命令格式 patch -p0 to-file.patchpatch –p0 to-docu.patchpatch –p1 < to-docu.patchpatch –R –p1... 阅读全文
posted @ 2015-07-09 11:05 fengbohello 阅读(942) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行 1 package main 2 3 import "fmt" 4 5 func testValue(){ 6 fmt.Println("for value") 7 var a = [3]int {1, 2, 3} 8 var b = a 9 ... 阅读全文
posted @ 2015-07-06 21:31 fengbohello 阅读(340) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行1、代码 1 package main 2 3 import "fmt" 4 5 type Base struct { 6 Name string 7 } 8 9 func (base * Base) Foo() {10 fmt.Println("Base Fo... 阅读全文
posted @ 2015-07-06 21:27 fengbohello 阅读(678) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行1、代码 1 package main 2 3 import "fmt" 4 5 type Rect struct { 6 x, y float64 7 width, height float64 8 } 9 10 func (r * Rect) Area() f... 阅读全文
posted @ 2015-07-06 21:25 fengbohello 阅读(593) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行1、代码 1 package main 2 3 import "fmt" 4 5 type Integer int 6 //给in类型添加 Less 方法,int原来的方法被Integer继承 7 func (a Integer) Less (b Integer) bool {... 阅读全文
posted @ 2015-07-06 21:20 fengbohello 阅读(1361) 评论(0) 推荐(0) 编辑
摘要:1、代码2、编译3、运行1、代码框架/home/fengbo/sorter$ tree.├── bin├── pkg├── readme.txt└── src ├── algorithms │ ├── bubblesort │ │ ├── bubblesort.go │ │ ... 阅读全文
posted @ 2015-07-04 14:31 fengbohello 阅读(644) 评论(1) 推荐(0) 编辑
摘要:1、代码2、运行1、代码package mainimport "fmt"func MyPrintf(args ...interface{}){ for _, arg := range args { switch arg.(type) { case int : ... 阅读全文
posted @ 2015-07-04 12:37 fengbohello 阅读(1046) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行1、代码 1 package main 2 import ( 3 "fmt" 4 "strconv" 5 ) 6 7 func getValue(n int) (float32, string) { 8 var x float32 = float32(n... 阅读全文
posted @ 2015-07-04 11:56 fengbohello 阅读(2068) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行1、代码 1 package main 2 import "fmt" 3 4 func main(){ 5 for k:= 0; k 5 { 10 break JLoop11 } 12 ... 阅读全文
posted @ 2015-07-03 00:31 fengbohello 阅读(608) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行1、代码 1 package main 2 import "fmt" 3 4 func switch_1(i int){ 5 switch i { 6 case 0 : 7 fmt.Println("0 --: i = ", i); 8 ... 阅读全文
posted @ 2015-07-03 00:22 fengbohello 阅读(722) 评论(0) 推荐(0) 编辑
摘要:1、代码2、运行1、代码 文件:map.go 1 package main 2 import "fmt" 3 4 type PersionInfo struct{ 5 ID string 6 Name string 7 Address string 8 } 9 10 fu... 阅读全文
posted @ 2015-07-02 23:58 fengbohello 阅读(845) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示