小编Max*_*mov的帖子

打开redis端口进行远程连接

我可以在服务器上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?怎么做?

ubuntu redis

101
推荐指数
6
解决办法
9万
查看次数

git rm - 致命:pathspec与任何文件都不匹配

我偶然在项目文件夹中添加了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在我的项目中没有这么多垃圾照片.但从那时起我多次承诺并在代码中做了很多改变.

git git-filter-branch

60
推荐指数
5
解决办法
10万
查看次数

在调试输出窗口中禁用噪声消息 - visual studio 2012

如何在visual studio 2012的调试输出窗口中禁用消息?

线程''(0x2360)已退出,代码为0(0x0)

由于这些消息的数量如此之高,他们会打扰我并隐藏我使用的自定义调试信息Debug.Write.我应该使用红色突出显示我的自定义调试信息吗?

visual-studio visual-studio-debugging visual-studio-2012

56
推荐指数
2
解决办法
1万
查看次数

mongorestore失败:没有可访问的服务器

我试图从转储恢复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)

mongodb

43
推荐指数
5
解决办法
5万
查看次数

如何使用python3进行nosetests

我尝试使用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?

python nose

28
推荐指数
2
解决办法
1万
查看次数

找不到Python可执行文件"python"

当我安装iconvnpm出现以下错误:

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)

python ubuntu-server node.js npm

27
推荐指数
4
解决办法
4万
查看次数

错误:驱动程序可执行文件的路径必须由webdriver.chrome.driver系统属性设置

我正在尝试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)

node.js selenium-chromedriver selenium-webdriver

23
推荐指数
2
解决办法
3万
查看次数

如何使用process.hrtime来获取异步函数的执行时间

我正在试图获得异步函数的执行时间.貌似我可以使用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毫秒.

node.js

17
推荐指数
3
解决办法
1万
查看次数

两个dll中都存在"ModelClientValidationRule"类型

我下载了用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

15
推荐指数
2
解决办法
1万
查看次数

访问处理程序中的post参数

我可以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)

go mux

15
推荐指数
1
解决办法
1万
查看次数