我有一个简单的表,字段称为 "hash" VARCHAR 10 UNIQUE FIELD
现在我想运行一个查询并自动生成字段内的哈希值.
问题是哈希必须是字母数字,并且必须长10个字符和独特.
表结构:
CREATE TABLE `vouchers` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`hash` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `hash` (`hash`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)
所以我需要将哈希值插入到哈希字段中,它们应该看起来像随机的字母数字随机哈希值,我的意思是用户不应该仅仅查看一个哈希就能捕获下一个或上一个哈希值,它们也必须是10个字符长并且唯一.
有没有人知道这个?
如果我选择这样:
SELECT id FROM users WHERE id IN(3,4,8,1);
Run Code Online (Sandbox Code Playgroud)
默认情况下,将按此顺序选择用户
1,
3,
4,
8,
Run Code Online (Sandbox Code Playgroud)
我想按照我输入IN()值的顺序选择它们:
3,
4,
8,
1
Run Code Online (Sandbox Code Playgroud)
这可能吗?
无论如何要删除像这样的单词列表中的重复项?
Hey
Hello
Hey
Hey
Jhon
Mark
Salcaz
Run Code Online (Sandbox Code Playgroud)
我在macosx上,每个单词都在新行上,每行格式化1个单词
这是我的Angular js片段代码:
$http({
method:'POST',
withCredential:true,
url:$scope.config.app_ws+'auth/signup',
data:{user:$scope.auth}
}).success(function(status, response){
console.log(response);
}).error(function(status, response){
alert(response+'Bummer :( , an error occured plese retry later. ');
});
Run Code Online (Sandbox Code Playgroud)
这是我的Node.js片段后端:
var allow_cross_domain= function(req, res, next) {
res.header('X-Powered-By', 'hey.heyssssssss.org');
var oneof = false;
if(req.headers.origin) {
res.header('Access-Control-Allow-Origin', req.headers.origin);
oneof = true;
}
if(req.headers['access-control-request-method']) {
res.header('Access-Control-Allow-Methods', req.headers['access-control-request-method']);
oneof = true;
}
if(req.headers['access-control-request-headers']) {
res.header('Access-Control-Allow-Headers', req.headers['access-control-request-headers']);
oneof = true;
}
if(oneof) {
res.header('Access-Control-Max-Age', 60 * 60 * 24 * 365);
}
// intercept OPTIONS method
if …Run Code Online (Sandbox Code Playgroud) 嘿我如何缓存x时间这个我通过$ http($ rootScope.config.app_genres)设置的简单对象?
$http.get($rootScope.config.app_ws+'get/genres',{},{cache:true}).success(function(response) {
$rootScope.config.app_genres = response;
});
Run Code Online (Sandbox Code Playgroud)
我只想缓存它,以便每次http请求都不重复
我有两个简单的方法:
function do(x,y){
if(x){
XHR1().success();
}
if(y){
XHR2().success();
}
}
function done(){
return something;
}
Run Code Online (Sandbox Code Playgroud)
现在我只想确保done()在do()完成时调用(**do() 方法包含对 Mysql DB 的异步请求)
我怎样才能做到这一点?**
显然,这不会按顺序排列这些方法:
do(x=1,y=1);
done(); //this can run also if do() has not finished yet
Run Code Online (Sandbox Code Playgroud)
所以我尝试:
function do(x,y,_callback){
if(x){
XHR1().success();
}
if(y){
XHR2().success();
}
_callback();
}
function done(){
return something;
}
do(x=1,y=1,done()); // this won't work the same cause callback is not dependent by XHR response
Run Code Online (Sandbox Code Playgroud)
这是我用于承诺的内容https://github.com/tildeio/rsvp.js/#arrays-of-promises
我有一个像这样的网址:
site.co/asd#antani?id=9
Run Code Online (Sandbox Code Playgroud)
如何id动态地从此 url 获取值并在其更改时获取新值?
我尝试过:
console.log($routeParams);我进入Object {}了控制台
谢谢
我的代码非常简单:
<video ng-controller="Ctrl" ng-src="scopeSRC" autoplay></video>
.controller('Ctrl', function ($scope, $timeout) {
$scope.scopeSRC = 'a_src_url';
$timeout(function () {
$scope.scopeSRC = 'new_src_url';
}, 5000);
});
Run Code Online (Sandbox Code Playgroud)
现在当改变src我看到黑色视频.我想要做的是在加载新的src时将前一个src视频的最后一帧设置为缩略图.
你怎么认为我能做到这一点?
谢谢,任何帮助表示赞赏
我有这段代码:
window.addEventListener('keydown', function (e) {
console.log(e.which);
console.log(e.keyCode);
});
var evObj = new KeyboardEvent('keydown', {key:65});
window.dispatchEvent(evObj);
Run Code Online (Sandbox Code Playgroud)
为什么我在控制台看到0而不是65?
e.keyCode和e.which都是0而不是65,我在Chrome最新版本
非常感谢.
我想显示工具提示,input.val().length <= 3然后在> 3个字符时隐藏工具提示
看一下这个:
<input type="text" id="nav-search"/>
$('#nav-search').on('keyup',function(){
var _keys = $(this).val();
if(_keys.length <= 3){
$(this).tooltip({'trigger':'focus',position:'right'});
$(this).trigger('focusin');
}
});
Run Code Online (Sandbox Code Playgroud)
它显然不起作用:/
javascript ×7
angularjs ×4
mysql ×2
node.js ×2
asynchronous ×1
caching ×1
events ×1
hash ×1
http-headers ×1
input ×1
jquery ×1
keyboard ×1
param ×1
promise ×1
rootscope ×1
rsvp-promise ×1
select ×1
sql ×1
sql-order-by ×1
src ×1
sublimetext ×1
sublimetext2 ×1
thumbnails ×1
tooltip ×1
triggers ×1
unique ×1
url ×1
video ×1
words ×1