git使用步骤
2017-3-13 C++
利用git进行代码版本管理步骤:
第一步:初始化版本库:
进入要进行版本控制的代码目录执行:git init .
第一步:从其他版本库克隆过来:
如要从远程机器的test.git克隆项目:
git clone http://xxx/test.git test
第二步:对代码进行修改
第三步:提交修改的代码
git add .(这是提交所有有修改的文件,如果只要提交特定的文件请参阅git帮助)
第四步:提交说明:
git commit -m "测试提交"
第五步:push代码到远程版本库:
git push origin master
git相关命令说明:
git remote [-v] :查看远程目录地址
标签: git
windows 利用apache + git 搭建远程版本仓库
2017-3-13 C++
需求:
局域网内电脑代码同步管理
环境:
mac osx/windows7
软件:
wamp:安装php + http + mysql 开发环境
git:git版本控制
步骤:参考http://blog.csdn.net/wangwei_cq/article/details/9379757
第一步:安装wamp:傻瓜化一步步就可以
第二步:安装git:基本也是傻瓜化看情况选择配置
第三步:配置Apache服务器
进入Apache安装目录下的conf目录,打开httpd.conf文件,找到<directory />节点,修改如下:
<directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</directory>
然后在httpd.conf文件的末尾追加:
# Set this to the root folder containing your Git repositories.
# 指定 Git 版本库的位置
SetEnv GIT_PROJECT_ROOT C:/workspace
# 该目录下的所有版本库都可以透过 HTTP(S) 的方式存取
SetEnv GIT_HTTP_EXPORT_ALL
# Route specific URLS matching this regular expression to the git http server.
# 令 Apache 把 Git 相关 URL 导向给 Git 的 http 处理程序
ScriptAliasMatch \
"(?x)^/(.*/(HEAD | \
info/refs | \
objects/(info/[^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
git-(upload|receive)-pack))$" \
"C:/Program Files/Git/libexec/git-core/git-http-backend.exe/$1"
#这边git-http-backend.exe安装路径又得时在c:/Program Files/Git/mingw64/libexec/git-core/git-http-backend.exe
<Location />
AuthType Basic
AuthName "GIT Repository"
AuthUserFile "C:/Program Files/Git/htpassword"
#密码需求,不需要可以注释掉
Require valid-user
</Location>
第四步:添加用户
进入Apache安装目录下的bin,执行
htpasswd -cmb htpassword abc 123456
把生成的htpassword放到c:/Program Files/Git(位置随意,跟上面的AuthUserFile对应就行)
第五步: 测试
进入c:/workspace 创建空版本库
git init --bare test.git
到目的电脑上执行命令上传版本
如:服务端ip为192.168.0.2
git push http://192.168.0.2/test.git master
windows android studio 下载地址
2017-3-12 android
developer.android.com需要翻墙才能访问!
最近google下载软件地址好像放开了!
windows 版本 android studio下载地址如下:
https://dl.google.com/dl/android/studio/install/2.3.0.8/android-studio-ide-162.3764568-windows.exe
PHP实现soap null wsdl服务端,android 实现android client访问
2017-3-11 android
利用php实现soap的服务端供app等客户端访问
服务端:
新建php文件testServer.php
<?php
class service
{
public function HelloWorld()
{
return "hello";
}
}
$s = new SoapServer(null, array('uri' => 'test'));
$s->setClass("service");
$s->handle();
?>
客户端:
PHP调用:
import urllib2
SM_TEMPLATE = """<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
</soap:Header>
<soap:Body>
<HelloWorld>
</HelloWorld>
</soap:Body>
</soap:Envelope>"""
url = "http://www.qs77.net/testServer.php"
http_headers = {
"Accept": "application/soap+xml,multipart/related,text/*",
"Cache-Control":"no-cache",
"Content-Type": "text/xml; charset=utf-8"
}
request = urllib2.Request(url, SM_TEMPLATE, http_headers)
response = urllib2.urlopen(request)
print response.read()
android调用:
new Thread(new Runnable() {
@Override public void run() {
try {
final String soaptemp = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" + " <soap:Header>" + " </soap:Header>" + " <soap:Body>" + " <HelloWorld>" + " </HelloWorld>" + " </soap:Body>" + "</soap:Envelope>";
URL url = new URL("http://www.qs77.net/testService.php"); HttpURLConnection urlCon = (HttpURLConnection) url.openConnection(); urlCon.setUseCaches(false); urlCon.setRequestProperty("Accept", "application/soap+xml,multipart/related,text/*"); urlCon.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); urlCon.setRequestProperty("Content-Length", "" + soaptemp.getBytes().length); urlCon.setRequestProperty("soapAction", "HelloWorld"); urlCon.setRequestMethod("POST"); urlCon.setDoOutput(true); urlCon.setDoInput(true); OutputStream out = urlCon.getOutputStream(); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8")); writer.write(soaptemp); writer.flush(); writer.close();
int status = urlCon.getResponseCode(); WolfLog.e(TAG, "" + status); InputStream in = null; if (status == 200) { in = urlCon.getInputStream(); } else { in = urlCon.getErrorStream(); } BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); String inputLine; StringBuilder input = new StringBuilder();
while ((inputLine = reader.readLine()) != null) { input.append(inputLine); } Document document = DocumentHelper.parseText(input.toString()); Element elementRoot = document.getRootElement(); Iterator<Element> iter = elementRoot.elementIterator();
while (iter.hasNext()) {
Element element = (Element)iter.next();
if ("Body".equals(element.getName())) { Iterator<Element> innerIter = element.elementIterator();
while (innerIter.hasNext()) { Element innerElement = (Element)innerIter.next(); WolfLog.e(TAG, innerElement.getName());
if ("HelloWorldResponse".equals(innerElement.getName())) { Iterator<Element> iinnerIter = innerElement.elementIterator();
while(iinnerIter.hasNext()) {
Element iinnerElement = (Element) iinnerIter.next();
if ("return".equals(iinnerElement.getName())) { Message msg = mHandler.obtainMessage(); Bundle bundle = new Bundle(); bundle.putString("msg", iinnerElement.getText()); msg.setData(bundle);
mHandler.sendMessage(msg);
}
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();