我尝试在默认设置之外设置虚拟主机localhost.每当我尝试调用我的虚拟主机时,http://test我都会获得位于目录中的默认Apache2索引文件http://localhost.此外,apache在禁用(a2dissite)两个VirtualHost文件和重新加载apache(service apache2 reload)之后仍然返回此页面.
虚拟主机无法正常工作会出现什么问题?
组态:
我的目录结构如下:
/var/www/html # Default localhost dir
/var/www/html7index.html # Apache2 default index
/var/www/test # HTML dir for the virtual host
/var/www/test/index.html # My "website"
Run Code Online (Sandbox Code Playgroud)
内容/etc/hosts:
127.0.0.1 localhost
127.0.1.1 Laptop
127.0.0.1 test
Run Code Online (Sandbox Code Playgroud)
目录内容/etc/apache2/sites-available:
000-default.conf
default-ssl.conf
test.conf
Run Code Online (Sandbox Code Playgroud)
档案000-default.conf:
<VirtualHost localhost:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
档案test.conf:
<VirtualHost test:80>
ServerAdmin test@localhost
ServerName test
NameVirtualHost …Run Code Online (Sandbox Code Playgroud) 这是有效的:
$(".my_dragging_class").each( makeDraggable($(this).get()[0]) );
var makeDraggable = function (el){
el.draggable = 'true';
el.addEventListener('dragstart', function(e){
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/html', 'test');
console.log('dragstart');
},
false);
}
Run Code Online (Sandbox Code Playgroud)
这不起作用:
$(".my_dragging_class").makeDraggable();
$.fn.makeDraggable(){
$(this).attr('draggable','true');
$(this).bind('dragstart', function(e){
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/html', 'test');
console.log('dragstart');
},
false);
}
Run Code Online (Sandbox Code Playgroud)
错误信息:我收到一个"e.dataTransfer未定义"为线e.dataTransfer.effectAllowed = 'move';.我的浏览器是FireFox 10.0.2
是否有可能以这种方式使用带有jQuery的dataTransfer?
我有一个像这样的补丁文件:
Index: dir/file.xml
===================================================================
--- dir/file.xml (revision 178)
+++ dir/file.xml (working copy)
@@ -7,7 +7,7 @@
<markup>
- <markup />
+ <markup></markup>
<markup>
<markup>
@@ -20,6 +20,7 @@
<markup>
<markup>
+ <tag>
<markup>
Run Code Online (Sandbox Code Playgroud)
要将它应用于SVN工作副本,我使用以下方法对其进行分支:
$ svn copy -r 178 trunk/component/dir branches/mybranch
Run Code Online (Sandbox Code Playgroud)
然后我试了一下
$ cd branches/mybranch
$ ls -R
./dir:
file.xml
$ patch -p0 -i ~/patchfile.patch
Run Code Online (Sandbox Code Playgroud)
但SVN的输出是
(Stripping trailing CRs from patch.)
patching file dir/file.xml
Hunk #1 FAILED at 7.
Hunk #2 FAILED at 20.
2 out of 2 hunks FAILED …Run Code Online (Sandbox Code Playgroud) 我想在数据库中存储不同商店的营业时间.目前我正在使用最简单的解决方案:
CREATE TABLE opening_times(
shop_id int(3) NOT NULL,
times varchar(1000) NOT NULL
);
INSERT INTO opening_times VALUES(3,"Mon-Fri 8:30 to 18:00
Sat 9:00 to 12:00");
INSERT INTO opening_times VALUES(4,"24/7");
INSERT INTO opening_times VALUES(5,"Mon-Sun 8am-8pm");
Run Code Online (Sandbox Code Playgroud)
我的下一个改进想法是:
CREATE TABLE opening_times(
shop_id int(3) NOT NULL,
monday varchar(11) NOT NULL,
tuesday varchar(11) NOT NULL,
wednesday varchar(11) NOT NULL,
thursday varchar(11) NOT NULL,
friday varchar(11) NOT NULL,
saturday varchar(11) NOT NULL,
sunday varchar(11) NOT NULL
);
INSERT INTO opening_times VALUES(
3,
"09:30-18:30",
"09:30-18:30",
"09:30-18:30",
"09:30-18:30",
"09:30-18:30", …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用XMLHttpRequest对象从表单发送JSON数据.我可以使用以下函数发送数据.FireBug中没有显示错误,请求中的JSON数据显示为FireBug.
但是,我将数据发送到echo.php,简单地返回内容:
<?php
print_r($_POST);
print_r($_GET);
foreach (getallheaders() as $name => $value) {
echo "$name: $value\n";
}
echo file_get_contents('php://input');
?>
Run Code Online (Sandbox Code Playgroud)
POST数组总是为空,但我可以看到返回的JSON字符串file_get_contents.这是怎么发生的?我究竟做错了什么?
echo.php的输出
Array
(
)
Array
(
)
Host: localhost
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: eo,de-de;q=0.8,de;q=0.6,en-us;q=0.4,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Referer: http://localhost/form.html
Content-Length: 88
Cookie: {{..to much data..}}
Pragma: no-cache
Cache-Control: no-cache
{"type":"my_type","comment":"commented"}
Run Code Online (Sandbox Code Playgroud)
发送功能:
function submit(){
var data={};
data.type=document.form.type.value;
data.comment=document.form.comment.value;
//get right XMLHttpRequest object for current …Run Code Online (Sandbox Code Playgroud) 我希望用户输入一个单位,例如"cm","kg"或"$".这可以在jQuery UI中完成:示例

但是,我想在纯HTML中实现它,例如:
input{
display: inline;
}
div.euro-sign::after{
content: "€";
margin-left: -40px;
}Run Code Online (Sandbox Code Playgroud)
<div><input placeholder="5 €" type="number" step="1"></div>
<div><input placeholder="5 €" type="number" step="1" unit="€"></div><!-- NOT working -->
<div class="euro-sign"><input placeholder="5" type="number" step="1"></div><!-- Workaround -->Run Code Online (Sandbox Code Playgroud)
是否有更原生的方式(如示例2)或我是否必须实施变通方法(示例3)?
我可以使用条件格式更改单元格的样式.但在那里,我最多只能处理3个案件.
我想要做的是获取单元格的值,以某种方式转换它并将结果设置为单元格背景颜色.
最简单的例子是值为0到10的单元格,导致白色和黑色之间的灰色步骤.
这可能吗?有没有办法自动设置单元格的背景颜色?
谢谢!
我尝试使用redux和react-router-dom在typescript中构建一个react应用程序.当我将redux添加到我的应用程序时,我遇到了输入问题.因此,我创建了以下最小的示例,只有一个页面测试页面:
App.jsx
import * as React from 'react';
import { Route, Redirect } from 'react-router-dom'
import Test from './containers/test-page'
import './App.css';
class App extends React.Component {
render() {
return (
<div className="ui container" id="main">
<Route exact path="/" render={() => <Redirect to="/test" />}/>
<Route exact path="/test" component={Test} />
</div>
);
}
}
export default App;
Run Code Online (Sandbox Code Playgroud)
测试页面的容器看起来像这样.它在连接调用中产生输入错误.
集装箱/测试页/ index.tsx
import { Dispatch } from 'redux'
import { connect } from 'react-redux'
import TestPage from './test-page'
function mapDispatchToProps(dispatch: Dispatch<any>) …Run Code Online (Sandbox Code Playgroud) 我不知道我的瓷砖线是否足够清晰...我的问题是:我有一个需要等待服务器上的事件的JS应用程序.目前,它每秒通过XMLHttpRequest轮询连续的服务器数据.
我在想的是:是否有可能让调用等到例如PHP中的变量发生变化?
我希望我的问题足够清楚.
谢谢!
我有这样的文件结构:
因此,有8位数字的文件夹包含一个或多个文件,名称以8位数字开头.但是这些文件名 - 比方说 - 不同步.所以现在我尝试在bash中递归地重命名它们来存档:
我的脚本看起来像:
#! /bin/bash
find * -maxdepth 1 -name "*" -type d | while read -r dir
do
rename 's/$dir\/[0-9]{8}/$dir/' *
done
Run Code Online (Sandbox Code Playgroud)
但这不起作用,并给出错误
全局符号"$ dir"需要在(eval 1)第1行显式包名.
我怎么能写它来根据文件夹名重命名文件?
谢谢你的帮助!
我正在运营一个小型的在线社区.它都是自编码而不是常见的CMS ......几年后我学到了很多东西,并且不得不意识到我在一开始就犯了很多错误.这就是为什么我计划重新启动整个项目,希望学习更多,但也希望能够移植大部分代码和数据库.
这就是为什么我的问题出现了:
谢谢!
我对pm2还是很陌生,目前正在尝试运行节点应用程序。除应用程序无缘无故地重新启动外,此方法工作正常。
该应用程序运行良好,在开发计算机上没有崩溃。日志文件不显示任何崩溃。(已经证明日志文件将记录崩溃。)
我将pm2配置错误吗?
{
"name" : "app1",
"cwd" : "/home/pm2/apps/app1/prod",
"script" : "dist/main.js",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"error_file" : "/home/pm2/apps/app1/logs/stderr.log",
"out_file" : "/home/pm2/apps/app1/logs/stdout.log",
"pid_file" : "/home/pm2/apps/app1/pids/app1.pid",
"instances" : 1, //or 0 => 'max'
"min_uptime" : "200s", // 200 seconds, defaults to 1000
"max_restarts" : 10, // defaults to 15
"max_memory_restart": "1M", // 1 megabytes, e.g.: "2G", "10M", "100K", 1024 the default unit is byte.
"cron_restart" : "1 0 * * *",
"watch" : false, …Run Code Online (Sandbox Code Playgroud)