我可以在服务器上ping pong redis
# redis-cli ping
PONG
Run Code Online (Sandbox Code Playgroud)
但远程问题:
$ src/redis-cli -h REMOTE.IP ping
Could not connect to Redis at REMOTE.IP:6379: Connection refused
Run Code Online (Sandbox Code Playgroud)
在配置中我得到了标准端口:
# Accept connections on the specified port, default is 6379.
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
Run Code Online (Sandbox Code Playgroud)
那么也许我应该在远程ubuntu机器上打开端口6379?怎么做?
我偶然在项目文件夹中添加了9000多张照片.并承诺他们.然后从磁盘中删除它们.承诺.
现在我尝试将更改推送到git服务器.但它需要太长时间并尝试发送12 Gb的数据.
我检查了磁盘上的文件大小,看到真正的.git
文件夹需要12 Gb.
如何从那里删除照片?我试过了git rm
,但失败了:
? git rm public/photos
fatal: pathspec 'public/photos' did not match any files
Run Code Online (Sandbox Code Playgroud)
因为我已经从磁盘上删除了它们,但它们仍然在.git
文件夹中.
我试图添加public/photos
到.gitignore
:
public/photos/
*.zip
Run Code Online (Sandbox Code Playgroud)
但没有结果.当然,我可以hard reset head
在我的项目中没有这么多垃圾照片.但从那时起我多次承诺并在代码中做了很多改变.
如何在visual studio 2012的调试输出窗口中禁用消息?
线程''(0x2360)已退出,代码为0(0x0)
由于这些消息的数量如此之高,他们会打扰我并隐藏我使用的自定义调试信息Debug.Write
.我应该使用红色突出显示我的自定义调试信息吗?
我试图从转储恢复mongo但失败了:
mongorestore --port 27133 dump
2015-05-07T09:39:11.760+0300 Failed: no reachable servers
Run Code Online (Sandbox Code Playgroud)
虽然我可以毫无问题地连接到它:
$ mongo --port 27133
MongoDB shell version: 3.0.1
connecting to: 127.0.0.1:27133/test
Run Code Online (Sandbox Code Playgroud)
在日志文件中没有什么特别的:
2015-05-07T09:37:00.350+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44901 #1 (1 connection now open)
2015-05-07T09:37:13.935+0300 I NETWORK [conn1] end connection 127.0.0.1:44901 (0 connections now open)
2015-05-07T09:39:08.752+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44906 #2 (1 connection now open)
2015-05-07T09:39:11.763+0300 I NETWORK [conn2] end connection 127.0.0.1:44906 (0 connections now open)
2015-05-07T09:39:52.365+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:44907 #3 …
Run Code Online (Sandbox Code Playgroud) 我尝试使用nosetests
❯nosetests'/ pathTo/test'
但它python 2.7
用于我的测试:
sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0)
Run Code Online (Sandbox Code Playgroud)
所以有些人失败了,因为他们写的是python 3.3
.
我解决它并安装虚拟环境:
pyvenv-3.3 py3env
Run Code Online (Sandbox Code Playgroud)
激活它:
source ~/py3env/bin/activate
Run Code Online (Sandbox Code Playgroud)
检查虚拟环境中的python virsion:
? python --version ?
Python 3.3.3
(py3env)
Run Code Online (Sandbox Code Playgroud)
好.但是nosetest仍然python2.7
在虚拟环境中使用:
sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0)
Run Code Online (Sandbox Code Playgroud)
所以我的测试失败了. 如何让鼻子使用python3?
当我安装iconv
时npm
出现以下错误:
iconv@2.1.0 install/root/Dropbox/nodeApps/nodeApp/node_modules/iconv node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:103:14)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:42:11
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:25)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Linux 3.8.0-19-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/Dropbox/nodeApps/nodeApp/node_modules/iconv
gyp ERR! …
Run Code Online (Sandbox Code Playgroud) 我正在尝试node.js selenium web驱动程序示例 ...
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().
usingServer('http://localhost:4444/wd/hub').
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(function() {
return driver.getTitle().then(function(title) {
return title === 'webdriver - Google Search';
});
}, 1000);
driver.quit();
Run Code Online (Sandbox Code Playgroud)
......但是得到了错误
promise.js:1542
throw error;
^
UnknownError: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list
at new bot.Error (/Users/maks/Dropbox/nodeApps/orgi/node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
Run Code Online (Sandbox Code Playgroud)
我猜想设置PATH变量:
$ cat .bashrc
export …
Run Code Online (Sandbox Code Playgroud) 我正在试图获得异步函数的执行时间.貌似我可以使用process.hrtime.我创建了简单的例子:
console.log("starting");
var start = process.hrtime();
console.log("start");
console.log(start);
setTimeout(function(){
console.log("HELLO");
var end = process.hrtime();
console.log("end");
console.log(end);
}, 1000);
Run Code Online (Sandbox Code Playgroud)
它输出
starting
start
[ 131806, 731009597 ]
HELLO
end
[ 131807, 738212296 ]
Run Code Online (Sandbox Code Playgroud)
但我不明白在几分之一的时间里,执行时间在哪里?我期望在这个例子中得到1000毫秒.
我下载了用asp.net mvc3 visual studio 2010编写的示例源代码
visual studio 2012打开解决方案文件.它将源代码转换为2012并打开解决方案.
当我构建解决方案得到错误:
错误1'c:\ Program Files(x86)\ Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll'和'c'中存在类型'System.Web.Mvc.ModelClientValidationRule' :\ Program Files(x86)\ Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll'C:\ studyCode\MVCDemo-Part12\MVCDemo-Part12\MVCDemo\Attributes \验证\ EqualAttribute.cs 54 28 MVCDemo
asp.net asp.net-mvc visual-studio-2010 asp.net-mvc-3 visual-studio-2012
我可以GET
使用mux访问参数:
import (
"github.com/gorilla/mux"
)
func main(){
rtr := mux.NewRouter()
rtr.HandleFunc("/logon", logonGet).Methods("GET")
}
func logonGet(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
login := params["login"]
}
Run Code Online (Sandbox Code Playgroud)
但无法弄清楚如何访问 POST
params
func main(){
rtr := mux.NewRouter()
rtr.HandleFunc("/logon", logonPost).Methods("POST")
}
func logonPost(w http.ResponseWriter, r *http.Request) {
// how to get POST parameters from request
}
Run Code Online (Sandbox Code Playgroud)