我从我的来源获得了一堆不同的网址,我想要的是重定向到相同的网址,但将广告系列数据添加到网址(以跟踪推荐的点击次数).
例如,我有这些网址:
www.example.com/category/product/name.html
www.example.com/id_product=5
我想在最后添加以下内容:utm_source = SOURCE&utm_medium = MEDIUM&utm_campaign = CAMPAIGN
和URL成为
www.example.com/category/product/name.html?utm_source=SOURCE&utm_medium=MEDIUM&utm_campaign=CAMPAIGN
www.example.com/id_product=5&utm_source=SOURCE&utm_medium=MEDIUM&utm_campaign=CAMPAIGN
如果URL字符串有参数,如何正确检查和覆盖所有情况,并添加我的?我想在node.js中做到这一点
谢谢
我有一个查询,只有在外部引用(用户,会话)已经存在的情况下,才能在数据库中插入事件。
我收到此错误:
“ PHP警告:pg_query_params():查询失败:错误:” IF“或附近的语法错误
对于此查询:
BEGIN;
SELECT id FROM users WHERE mongoid = $1 (userid);
IF not found THEN
-- inserts user and should remember userid
INSERT INTO users (mongoid, shopid, idinshop, attributes)
VALUES ($1, $2, $3, $4) RETURNING id (userid);
END IF;
--looks for session and should remember sessionid
SELECT id FROM sessions WHERE mongoid = $5 (sessionid);
IF not found THEN
-- inserts session
INSERT INTO sessions (mongoid, shopid, userid, session, traffic, counts)
VALUES …Run Code Online (Sandbox Code Playgroud) 您支付每个查询数据大小的费用.那么,从成本的角度来看,使用视图会更好吗?
我有一个mongo文件的以下结构:
{
"_id": ObjectId("4fba2558a0787e53320027eb"),
"replies": {
"0": {
"email": ObjectId("4fb89a181b3129fe2d000000"),
"sentDate": "2012-05-21T11: 22: 01.418Z"
}
"1": {
"email": ObjectId("4fb89a181b3129fe2d000000"),
"sentDate": "2012-05-21T11: 22: 01.418Z"
}
"2" ....
}
}
Run Code Online (Sandbox Code Playgroud)
如何计算集合中所有文档的所有回复?谢谢!
angular.module("vtApp.directives").
directive('multirangeslider', function ($compile) {
return {
restrict: 'E',
replace: true,
link: function (scope, element, attrs) {
var variances, values, options, template, compile;
scope.variances = eval (attrs.variances);
scope.values = scope.$eval(attrs.values);
var htmlText = '<div id="'+attrs.id+'"><table class="CRC"><tbody><tr>';
for (var i=0; i<scope.values.length; i++) {
htmlText += '<td id="val' + i + '" style="width:' + scope.values[i] + '%;"> ' + scope.variances[i] + ': <strong>{{ranges[' + i + ']}}%</strong></td>';
}
htmlText += '</tr></tbody></table></div>';
template = angular.element(htmlText);
$compile(template)(scope);
element.replaceWith(htmlText);
}
}
});
Run Code Online (Sandbox Code Playgroud)
在视图中我有:
<multirangeslider values="ranges" …Run Code Online (Sandbox Code Playgroud) 我在Angular.js中有一个模型,可以从控制器和指令更新.如果我将该指令放在AngularUI bootstrap Tabs指令中,它不会更新模型.代码非常简单,应该可以工作.
请选择第二个选项卡,然后单击按钮.它没有更新它:这是一个Plunker:http://plnkr.co/edit/jdaniklxFNkdxAYaLtVQ?p = preview
我正在尝试通过他们的api从谷歌存储中下载文件,当我通过alt = media参数时,我得到如下响应:
object(GuzzleHttp\Psr7\Response)#72 (6) {
["reasonPhrase":"GuzzleHttp\Psr7\Response":private]=>
string(2) "OK"
["statusCode":"GuzzleHttp\Psr7\Response":private]=>
int(200)
["headers":"GuzzleHttp\Psr7\Response":private]=>
array(16) {
["x-guploader-uploadid"]=>
array(1) {
[0]=>
string(98) "AEnB2Uq5d_aKFnzd6d_DeJ_5P8vi9BiXOJpOzixs7mqU5_WK9SF0o9D-8vQiOQWLw"
}
["content-type"]=>
array(1) {
[0]=>
string(24) "application/octet-stream"
}
["content-disposition"]=>
array(1) {
[0]=>
string(10) "attachment"
}
["etag"]=>
array(1) {
[0]=>
string(16) "CODI1+sCEAE="
}
["vary"]=>
array(2) {
[0]=>
string(6) "Origin"
[1]=>
string(8) "X-Origin"
}
["x-goog-generation"]=>
array(1) {
[0]=>
string(16) "1458812108000"
}
["x-goog-hash"]=>
array(1) {
[0]=>
string(44) "crc32c=D0rU4U+yXOR8d0GKmxkDw=="
}
["x-goog-metageneration"]=>
array(1) {
[0]=>
string(1) "1"
}
["cache-control"]=>
array(1) {
[0]=>
string(46) "no-cache, no-store, …Run Code Online (Sandbox Code Playgroud) 这里是python的新手:
我正在尝试创建一个新列表,其中初始列表中的每个 dict 都删除了一个元素,它存在:
arraylist = [{"x":1, "y":2}, {"x":3, "y":2}, {"x":5, "y":2}, {"x":33, "y":2}, {"x":1, "y":8}]
arraylist = map(lambda d: del d["y"] if "y" in d, arraylist)
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用for,使用del 来完成。但我正在寻找新的东西。
我正在使用最新的Angular.js,1.1.5,它通过资源调用返回promise.当您有多个请求后,另一个请求依赖于这些请求时,什么是正确的实现?
$scope.save = function() {
var newids = [];
angular.forEach ($scope.template.children, function (value){
//saves the children as a new template and returns the ID
Template.$addNew(value).then(
function( value ){newids.push(value);},
function ( error ) {console.log ('error')}
)
});
//updates the root template
$scope.template.childrenIDs = newids;
Template.$update($scope.template).then(
function( value ){ console.log('successfully saved')},
function ( error ) {console.log ('error')}
)
}
Run Code Online (Sandbox Code Playgroud)
为此,我收到一个错误:
TypeError:对象#没有方法'然后'
模板是以下工厂返回资源:
mongoAPI.
factory('Template', ['$resource', '$http', 'CONSTANTS', 'security', function($resource, $http, CONSTANTS, security) {
var actions = {
'addNew': {method:'POST'},
}
var res …Run Code Online (Sandbox Code Playgroud) 我正在修改prestashop 1.4.9中的my-account.tpl,并希望在此页面中获取用户电子邮件地址.
但是,我只能访问{$ custmerName}.我把{debug}放在里面,似乎无法访问.此外,登录后{$ smarty.post}为空.
有什么建议?
我的代码生成下面的错误,即使ng-show隐藏了type ="number"的元素; https://docs.angularjs.org/error/ngModel/numfmt
Angular 1.4
在控制器中:
this.obj = {
a: {type:'string',value:'str'},
b: {type:'number',value:2}
}
this.selected = 'a';
Run Code Online (Sandbox Code Playgroud)
在模板中
<span ng-show="ctrl.obj[selected]=='number'"><input type="number" ng-model="ctrl.model" /></span>
<span ng-show="ctrl.obj[selected]=='string'"><input type="text" ng-model="ctrl.model" /></span>
Run Code Online (Sandbox Code Playgroud)
当我在"text"类型字段中输入文本时,我仍然在控制台中收到错误.怎么解决?Error: [ngModel:numfmt] http://errors.angularjs.org/1.4.1/ngModel/numfmt?p0=3
我有一个数组,其中的项目我不知道键或值.看起来像这样:
{"key1":true,"key2":true, "key3":'value'}
Run Code Online (Sandbox Code Playgroud)
如果我使用ng-repeat循环:ng-repeat="(k, v) in array"我不允许在转发器中获得重复项.
如何在角度模板中循环这种数组,我不知道键,值或它的长度?
angularjs ×5
javascript ×3
angular-ui ×1
google-api ×1
lambda ×1
mongodb ×1
node.js ×1
nosql ×1
plpgsql ×1
postgresql ×1
prestashop ×1
python ×1
q ×1
sql ×1
transactions ×1
url ×1