跳至主要内容

博文

目前显示的是 五月, 2017的博文

Android 获取SD卡路径: get sdcard path

//内置sd卡路径 String sdcardPath = System.getenv( "EXTERNAL_STORAGE" ); //内置sd卡路径 String sdcardPath = Environment.getExternalStorageDirectory().getAbsolutePath(); //外置置sd卡路径 String extSdcardPath = System.getenv( "SECONDARY_STORAGE" ); 在Enviroment类的源码中获得sd卡路径其实也是通过 System.getnv() 方法来实现的,如隐藏的方法:   /** {@hide} */ public static File getLegacyExternalStorageDirectory() {    return new File(System.getenv(ENV_EXTERNAL_STORAGE)); }

http form transfer/upload multiple files to golang server

//http   POST http://localhost/upload HTTP/1.1 Host: localhost Proxy-Connection: keep-alive Content-Length: 468 Cache-Control: max-age=0 Origin: null Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary5hABI1kzSBUwtzsB Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 DNT: 1 Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4 ------WebKitFormBoundary5hABI1kzSBUwtzsB Content-Disposition: form-data; name="files"; filename="a.txt" Content-Type: text/plain 5522H-HY5KC-VL6QQ-IGCHV-YJP2H ------WebKitFormBoundary5hABI1kzSBUwtzsB Content-Disposition: form-data; name="files"; filename="b.txt" Content-Type: text/plain asd sadfa dga df g ------WebKitFormBoundary5hABI1kzSBUwtzsB Content-D

websocket javascript golang

//javascript <html> <head>     <title>title</title>     <script type="text/javascript">         var ws=new WebSocket("ws://127.0.0.1:9999/echo")         ws.onopen=function(evt){             ws.send("hello from client\n")         }         ws.onmessage=function(evt){             document.write(evt.data)         }         ws.onclose=function(evt){             alert("closed")         }         ws.onerror=function(evt){             alert(evt.data)         }     </script> </head> <body> </body> </html> //main.go 针对浏览器 package main import ( "bufio" f "fmt" "golang.org/x/net/websocket" "net/http" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { f.Fprint(w, "hello home") }) http.Handle("/echo", websocket.Handler (echohandl

golang io

//import "bufio" reader:=bufio.NewReader(conn) reader.ReadLine() //import "io" io.Copy(&dst , src) //import "io/ioutil" ioutil.ReadAll(Conn) File.Read(buf) con.Write(buf)

fedora setup

安装RPM Fusion源 将以下保存为  fedora-ustc.repo  : [fedora] name=Fedora $releasever - $basearch - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/ #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch enabled=1 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch [fedora-debuginfo] name=Fedora $releasever - $basearch - Debug - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/releases/$releasever/Everything/$basearch/debug/ #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch [fedora-source] name=Fedora $releasever - Source - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/releases/$releasever/Everything/source/SRPMS/ #mirrorlist=https://mir

android listview multi choice arrayadapter

import  android.app.Activity;   import  android.os.Bundle;   import  android.view.View;   import  android.widget.AdapterView;   import  android.widget.AdapterView.OnItemClickListener;   import  android.widget.AdapterView.OnItemSelectedListener;   import  android.widget.ArrayAdapter;   import  android.widget.ListView;   public   class  ListCheckbox  extends  Activity  implements  OnItemClickListener,OnItemSelectedListener{        private  String contentString[];       ArrayAdapter arrayAdapter;       ListView mylist;        protected   void  onCreate(Bundle savedInstanceState) {            // TODO Auto-generated method stub             super .onCreate(savedInstanceState);           setContentView(R.layout.main);           contentString =  new  String[] {                     "示例" ,  "透明动画" ,                    "伸缩动画" ,  "移动动画" ,                    "旋转动画" ,  "透明_伸缩" ,                    "透明_移动" ,  &