weizhe.net
域名年龄: 15年6个月2天HTTP/1.1 301 永久重定向 服务器:nginx/1.2.1 访问时间:2015年09月19日 06:53:18 类型:text/html 文件大小:184 连接:keep-alive 目标网址:https://blog.weizhe.net/ HTTP/1.1 200 OK 服务器:nginx/1.2.1 访问时间:2015年09月19日 06:53:18 类型:text/html; charset=UTF-8 Transfer-Encoding: chunked 连接:keep-alive X-Pingback: https://blog.weizhe.net/xmlrpc.php 动作:Accept-Encoding Content-Encoding: gzip 网站编码:UTF-8
搜索:魏哲的空间关心python linux golangFeed Rss首页Golang 笔记快乐六一七月 18th, 2015Debian快捷搭建SAMBA服务No Comments, python, by 魏 哲, 102 views.# apt-get install samba# rm /etc/samba/smb.conf /etc/samba/smb.conf.bak# emacs /etc/samba/smb.conf[global]log file = /var/log/samba/log.%m[movie]comment = Moviepath = /pathto/Movieread only = yespublic = yes# smbpasswd -a myusername# /etc/init.d/samba restart七月 16th, 2015轻松搭建基于go1.5开发Android应用的环境No Comments, android, golang, linux, by 魏 哲, 2,025 views.示例链接(有兴趣的同学欢迎来一起玩):https://github.com/vzever/gomobileappgo1.5beta2已经发布,正式版将在8月份发布.而早在go1.4就已发布了golang/mobile项目用以实现Android应用的开发.当前gomobile的环境部署已经相对成熟了.但项目声明必须基于go1.5,所以go1.4的同学必须要升级.因为在go1.4执行gomobile init的时候是不能通过的.注:如果没有网络权限访问golang.org,请创建$GOPATH/src/github.com/golang的软链接为$GOPATH/src/golang.org/x,并且后续go get的时候把golang.org/x/* 替换为 github.com/golang/*第一步. 部署go1.5beta2官方网站(http://golang.org/doc/install)下载go1.5beta2的linux安装包,并按照官网部署到/usr/local. 配置/usr/local/go/bin 到$PATH中,如下写入/etc/profile 或$HOME/.profileexport PATH=$PATH:/usr/local/go/bin然后还需要将其他golang环境变量加入$HOME/.profileexprot GOPATH=$HOME/gocode/export PATH=$PATH:$GOPATH/bin第二步 部署golang/mobile参照golang/mobile文档(https://godoc.org/golang.org/x/mobile/cmd/gomobile)执行以下命令$ go get golang.org/x/mobile/cmd/gomobile$ gomobile init -v如果提示没有权限如下#Building standard library for android/arm.runtimego install runtime: mkdir /usr/local/go/pkg/android_arm/: permission deniedgomobile: go install std for android/arm failed: exit status 1需要授权/usr/local/go/pkg给当前用户# chown -R myname:myname /usr/local/go/pkg然后再次执行$ gomobile init -vDownloading https://dl.google.com/go/mobile/gomobile-ndk-r10e-linux-x86_64.tar.gz.Downloading https://dl.google.com/go/mobile/gomobile-openal-soft-1.16.0.1.tar.gz.Building standard library for android/arm.runtimeerrorssync/atomic...testing/quicknet/rpc/jsonrpcDone, build took 23s.第三步 使用go run 在桌面测试程序$ cd $GOPATH/src/golang.org/x/mobile/example/basic$ go run main.go第四步 使用gomobile直接生成apk格式Android应用.$ cd $GOPATH/src/golang.org/x/mobile/example/basic$ gomobile build$ lsmain.go basic.apk或者连接android手机,确保adb shell可以登录手机之后,直接编辑并安装APK$ cd $GOPATH/src/golang.org/x/mobile/example/basic$ gomobile install最后安装到Android L除network.apk无法启动外(代码更新后,已可正常运行.界面初始黑色,网络连接golang.org成功则为绿色,失败则为红色),basic audio和sprite都正常.甚至github.com/mmchugh/gomobile-examples的cube也运行正常.以下为截图手机截图 basic/audio/sprite/cubePC截图五月 24th, 2015golang 文件操作No Comments, golang, by 魏 哲, 133 views.文件操作golang的文件操作时在os包中的。所以用的时候要import os包包含以下的这些函数func Create(name string) (file *File, err error) 直接通过纹面创建文件func NewFile(fd uintptr, name string) *Filefunc Open(name string) (file *File, err error) 以只读方式打开一个存在的文件,打开就可以读取了。func OpenFile(name string, flag int, perm FileMode) (file *File, err error)以各种方式打开各种存在不存在的文件,具体怎么样看flag和perm。flag可选值(掩码):O_RDONLY int = syscall.O_RDONLY // 只读O_WRONLY int = syscall.O_WRONLY // 只写O_RDWR int = syscall.O_RDWR // 读写O_APPEND int = syscall.O_APPEND // 在文件末尾追加,打开后cursor在文件结尾位置O_CREATE int = syscall.O_CREAT // 如果不存在则创建O_EXCL int = syscall.O_EXCL //与O_CREATE一起
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-12-24 02:46, Process in 0.0057 second.