我从我的主目录运行以下命令:
python -m CGIHTTPServer
Run Code Online (Sandbox Code Playgroud)
这运行服务器,但是当我尝试访问cgi-bin目录中的脚本时,我得到:
Traceback (most recent call last):
File "/usr/lib/python2.7/CGIHTTPServer.py", line 251, in run_cgi
os.execve(scriptfile, args, env)
OSError: [Errno 13] Permission denied
Run Code Online (Sandbox Code Playgroud)
以root身份运行并没有什么不同.这些文件似乎具有所有正确的权限:
student@bandersnatch:~$ ls -lhR
.:
total 12K
drwxr-xr-x 2 student student 4.0K Jun 13 18:38 cgi-bin
drwxr--r-- 2 student student 4.0K Jun 10 2004 kalpy
-rwxrwxrwx 1 student student 2.0K Jun 13 12:37 test.html
./cgi-bin:
total 8.0K
-rwxr-xr-x 1 student student 31 Jun 13 18:38 test.py
Run Code Online (Sandbox Code Playgroud)
编辑:test.py的内容是:
#!/usr/bin/python
print "test"
Run Code Online (Sandbox Code Playgroud)
shebang有效:
~$ which python
/usr/bin/python
Run Code Online (Sandbox Code Playgroud) 我在Ubuntu上运行一个脚本,并测试它的时间:
$ time ./merger
./merger 0.02s user 0.03s system 99% cpu 0.050 total
Run Code Online (Sandbox Code Playgroud)
它花了不到1秒钟.但如果我使用cygwin:
$ time ./merger
real 3m22.407s
user 0m0.367s
sys 0m0.354s
Run Code Online (Sandbox Code Playgroud)
它花了超过3分钟.为什么会这样?我该怎么做才能提高cygwin的执行速度?
我在ac程序中使用scanf从STDIN读取一个int:
scanf("%d", &n);
Run Code Online (Sandbox Code Playgroud)
当我编译启用优化的c程序时,我收到一些警告:
gcc main.c -lm -lpthread -O2 -o main
main.c: In function ‘main’:
main.c:45: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
main.c:50: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
Run Code Online (Sandbox Code Playgroud)
但是当我删除优化选项时,为什么不收到这些警告?
gcc main.c -lm -lpthread -o main
Run Code Online (Sandbox Code Playgroud)
PS:我没有使用-Wall或类似的东西.
我有以下内容tomcat-users.xml:
<tomcat-users>
<role rolename="admin"/>
<role rolename="manager"/>
<user username="aname" password="apassword" roles="admin,manager"/>
</tomcat-users>
Run Code Online (Sandbox Code Playgroud)
如果我去http://localhost:8080/manager/html,我被问及用户名和密码(据我所知,关于这些tomcat-users.xml),但是当我输入它们时,我得到:
403 Access Denied
You are not authorized to view this page.
If you have already configured the Manager application to allow access and you have used your browsers back button...
Run Code Online (Sandbox Code Playgroud)
这种行为可能是什么原因?提前致谢.
我必须调试Windows DLL的问题,但我只是运行Linux,所以我想知道是否有(最好是命令行)工具来检查Linux下的Windows DLL.我正在寻找的主要是导出符号列表.
我想在本地向许多应用程序广播消息.为此,我认为UDP套接字是最好的IPC,如果我是狼,请纠正我.
为此,我使用以下代码:
用于广播:
/*
** broadcaster.c -- a datagram "client" that can broadcast
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#define SERVERPORT 4950 // the port users will be connecting to
int main(int argc, char *argv[])
{
int sockfd;
struct sockaddr_in their_addr; // connector's address information
struct hostent *he;
int numbytes;
int broadcast = 1;
//char broadcast = '1'; // if that doesn't work, try this …Run Code Online (Sandbox Code Playgroud) 具体来说,我想切换到内核版本2.6.32.41源代码.但是,在输出中
git tag -l
它显示以下内容:
v2.6.32-rc2
v2.6.32-rc3
v2.6.32-rc4
v2.6.32-rc5
v2.6.32-
rc6 v2.6.32-rc7
v2.6.32-rc8
其中哪一个是2.6.32.41 linux内核源码?
安装时可以将用户定义的参数传递给RPM.
例如:
~>rpm -i sample.rpm -license_path=/path/
Run Code Online (Sandbox Code Playgroud)
要么
~>rpm -i -license_path=/path/ sample.rpm
Run Code Online (Sandbox Code Playgroud)
要么
~>rpm -i -somearg sample.rpm
Run Code Online (Sandbox Code Playgroud)
-Sakthi
它总是让我感到困惑,如果一个文件夹具有读写权限,Apache + PHP就无法写入它.您必须结束授予apache执行权限才能在该文件夹中写入文件.为什么?
例如,使用chmod 664(其中构建组包含apache用户),apache将无法在此文件夹中写入临时缓存文件:
drw-rw-r-- 5 jenkins build 4096 Jun 15 13:05 cache
Run Code Online (Sandbox Code Playgroud)
而使用chmod 774 apache将能够将新文件写入该文件夹:
drwxrwxr-- 5 jenkins build 4096 Jun 29 11:44 cache
Run Code Online (Sandbox Code Playgroud) 我正在使用Ubuntu 12.04LTS Desktop来开发Shopify应用程序(使用shopify_app gem),我在处理回调URL时遇到了这个问题.
Faraday::Error::ConnectionFailed (Connection reset by peer - SSL_connect)
Run Code Online (Sandbox Code Playgroud)
看看这里和这里的shopify-app-discuss组,似乎问题出在Ubuntu 12.04及其OpenSSL上.我试图安装最新的OpenSSL,但没有.我发现的另一种选择是使用不同的旧版OpenSSL,即RVM提供的版本.
$ rvm remove 1.9.3 (or whatever version of ruby you are using)
$ rvm pkg install openssl
$ rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr
Run Code Online (Sandbox Code Playgroud)
现在Shopify App工作正常.它可以连接到API.(这个提示可能会帮助其他Ubuntu 12.04用户!)
所以,我的问题是:这是最好的解决方案吗?我有点担心旧的OpenSSL版本.它可能存在一些安全问题.使用它开发应用程序是否安全?
当我部署应用程序(例如Heroku)时,旧的OpenSSL会出现安全问题吗?
提前致谢!