我有简单的页面用javascript验证输入中写的电子邮件:
email.html:
<!DOCTYPE html>
<html>
<head>
<title>Email validation</title>
<script src="email.js"></script>
</head>
<body>
<span style="padding: 5px;">
<input type="text" id="email-input" placeholder="Email..."></input>
</span>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
email.js:
var checkEmail = function() {
var regexp = /BIG_REGEX/;
var email = document.getElementById('email-input').value;
if (email === '')
removeFrame();
else if (regexp.test(email))
drawFrame('green');
else
drawFrame('red');
};
var removeFrame = function() {
var input = document.getElementById('email-input');
input.parentNode.style.backgroundColor = input.parentNode.parentNode.style.backgroundColor;
};
var drawFrame = function(color) {
var input = document.getElementById('email-input');
input.parentNode.style.backgroundColor = color;
};
window.onload = function() {
document.getElementById('email-input').onkeyup = …Run Code Online (Sandbox Code Playgroud) 我需要制作这个按钮:
通常当我需要使用渐变和边框制作箭头按钮时,我添加了.button:before具有绝对定位的元素,使用transform: rotate(-45deg) translate(%SOMETHING%);和添加background: linear-gradient(45deg, %COLORS%);.但现在我需要制作按钮,箭头角度不对.我该怎么做?
我需要读取我指定的文件的第一个字节,然后是第二个字节,第三个,依此类推.我怎么能在BASH上做到这一点?PS我需要得到这个字节的HEX
我有一些C++代码并尝试调试它.main.cpp中:
#include <iostream>
using namespace std;
int main() {
graph<int> a;
a.add(1);
a.addEdge(1,2);
std::vector<int> answ = a.getAdjacent(1);
for (unsigned int i = 0; i < answ.size(); i++)
std::cout<<answ[i]<<std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我在"图a;"上有一个断点.但是当我开始调试时,我得到:
The target endianness is set automatically (currently little endian)
No source file named C:\Users\home\workspace\graphcpp\main.cpp.
[New Thread 3552.0xdc8]
Run Code Online (Sandbox Code Playgroud)
有什么问题?
我需要拆分Django的开发和生产设置.我决定如果USKOVTASK_PROD设置了变量,那么app应该使用生产设置.我读了这篇文章并试图这样做.
我的片段:
/etc/apache2/sites-enabled/uskovtask.conf:
<VirtualHost *:80>
ServerName uskovtask.*.com
ServerAlias uskovtask.*.com
DocumentRoot /mnt/ebs/uskovtask
Alias /static /mnt/ebs/uskovtask/static/
<Directory /mnt/ebs/uskovtask/static>
Require all granted
</Directory>
#WSGIPythonPath /mnt/ebs/uskovtask
WSGIDaemonProcess uskovtask.*.com python-path=/mnt/ebs/uskovtask:/usr/lib/python2.7/site-packages
WSGIProcessGroup uskovtask.*.com
WSGIScriptAlias / /mnt/ebs/uskovtask/uskovtask/wsgi.py
SetEnv USKOVTASK_PROD 1
<Directory /mnt/ebs/uskovtask/uskovtask>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
wsgi.py:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "uskovtask.settings")
from django.core.wsgi import get_wsgi_application
_application = get_wsgi_application()
def application(environ, start_response):
if 'USKOVTASK_PROD' in environ:
os.environ.setdefault('USKOVTASK_PROD', environ['USKOVTASK_PROD'])
return _application(environ, start_response)
Run Code Online (Sandbox Code Playgroud)
settings.py的部分:
import os
if 'USKOVTASK_PROD' in os.environ:
from settings_prod …Run Code Online (Sandbox Code Playgroud) 我需要检查字符串是否包含除数字之外的任何内容.但我有一个问题.
echo bdfbdfd | findstr /R [^0123456789]
Run Code Online (Sandbox Code Playgroud)
什么都不返回,但它应该返回bdfbdfd.但
echo 123 | findstr /R [^0123456789]
返回'123'.为什么?反之亦然.
我用DrRacket.我有这个代码的问题:
(define (qweqwe n) (
(cond
[(< n 10) #t]
[(>= (lastnum n) (pochtilastnum n)) (qweqwe (quotient n 10))]
[else #f]
)
)
)
(define ( RTY file1 file2 )
(define out (open-output-file file2 #:mode 'text #:exists 'replace))
(define in (open-input-file file1))
(define (printtofile q) (begin
(write q out)
(display '#\newline out)
))
(define (next)
(define n (read in))
(cond
[(equal? n eof) #t]
[else (begin
((if (qweqwe n) (printtofile n) #f))
) (next)]
)
)
(next)
(close-input-port in)
(close-output-port …Run Code Online (Sandbox Code Playgroud) 我使用Mocha/Chai测试JavaScript前端代码,现在我们切换到TypeScript.我有几个我想测试的功能.但它们不应该是可出口的.我是否可以访问此功能并测试它而无需添加export它们?
我有这三个地方的NPM包:C:\projects\A,C:\projects\B和C:\projects\main.Main是使用Webpack构建的React应用程序.Main依赖于A和B,也A要看B.我们有自己的"全局"包管理器,可以保证包位于同一个父文件夹中.
我想适合这些:
Node(和webpack)require将解析本地包
我不需要npm install在Main我每次更改A或B
我是这样做Main的package.json:
....
"dependencies": {
"A": "file:../A",
"B": "file:../B",
"react": ...
.........
Run Code Online (Sandbox Code Playgroud)
但遇到了一个奇怪的问题:npm没有在A's和B's node_modules中安装所有软件包,所以Webpack构建失败了.我需要npm install每次都跑步.
我用google搜索并找到了linklocal,它将所有本地包替换为符号链接.但遇到了另一个问题:
linklocal不会安装链接依赖项的依赖项,因此您通常最终会安装两次链接依赖项的依赖项:一次在npm安装期间,然后再次在linklocal之后
所以我跑了linklocal然后npm install再用postinstall脚本.但是npm @ 3对符号链接文件夹没有任何作用:
npm WARN update-linked node_modules/A needs updating to 1.0.0 …Run Code Online (Sandbox Code Playgroud) 我正在编写使用 AnyEvent 计时器的 Perl/Tk 程序。如果计时器处于活动状态,我在关闭窗口时遇到问题。我做了这个窗口关闭处理程序:
$self -> {window} -> protocol( 'WM_DELETE_WINDOW' => sub {
undef $self -> {timer};
$self -> {window} -> destroy;
});
Run Code Online (Sandbox Code Playgroud)
如果关闭窗口时计时器处于活动状态,则计时器停止,窗口关闭,但 MainLoop 不会停止。怎么了?
javascript ×2
anyevent ×1
apache ×1
bash ×1
batch-file ×1
c++ ×1
casperjs ×1
chai ×1
cmd ×1
css ×1
css3 ×1
django ×1
eclipse ×1
eclipse-cdt ×1
gdb ×1
html ×1
mingw ×1
mocha.js ×1
mod-wsgi ×1
node.js ×1
npm ×1
npm-install ×1
perl ×1
phantomjs ×1
python ×1
racket ×1
regex ×1
scheme ×1
symlink ×1
tk-toolkit ×1
typescript ×1
webpack ×1
windows ×1