所以我试图从这个promise的解析中获取一个元素值返回的字符串值.我想将原始字符串值传递给我在量角器测试中构建的另一个函数.
这是元素:
<div style='hidden' >
<input id="group-sendgrid-hidden-input" ng-model='groupCode' value='dangyo' >
</div>
Run Code Online (Sandbox Code Playgroud)
我正在寻找一种方法来获得模型值或属性值(两者都可以).模型值甚至可能更好.
这是我尝试在这里解决一个承诺并返回一个结果:
// first get the element driver object
var groupCode = element(by.id('group-sendgrid-hidden-input'));
// next resolve a promise provided by this element
groupCode.getAttribute('value').then(function(value){
console.log( 'should be a string: ' + value);
return value;
});
Run Code Online (Sandbox Code Playgroud)
在这里console.log( 'should be a string: ' + value);总是返回null,value而我无能为力似乎解决了这个问题.我确定我做错了,因为我不熟悉量角器,这看起来很简单.有没有其他人遇到这种行为?
我正在尝试创建一个非常简单的别名.我想要别名以下命令:
git log --oneline --graph --all -- decorate
Run Code Online (Sandbox Code Playgroud)
我发现此命令是查看日志文件的一种非常有用的方法.我想将此行别名,git l因为它是我希望查看日志文件的主要方式.这是我尝试创建别名:
git config --global alias .l "git log --oneline --graph --all -- decorate"
Run Code Online (Sandbox Code Playgroud)
此行执行时没有错误,但任何尝试调用都会git l导致以下错误消息.
Expansion of alias 'l' failed; 'git' is not a git command
Run Code Online (Sandbox Code Playgroud)
据解释,工作环境,Windows 7,minGW32和git版本1.8.3.msysgit.0可能与此问题有关,但我不知道如何解决这个问题.感谢任何帮助过的人.
CakePHP创建一个div,它自动包装使用formhelper构建的任何输入标记,如下所示:
$this->formhelper->input('something');
Run Code Online (Sandbox Code Playgroud)
这样输出看起来如下:
<div class='input'>
<input />
</div>
Run Code Online (Sandbox Code Playgroud)
我知道有一种方法可以将类添加到输入标记,即
$this->formhelper->input('text', array('class' => 'some_css'));
Run Code Online (Sandbox Code Playgroud)
但是如何为CakePHP自动创建的div添加样式.这可能是核心需要被黑客入侵的东西,但我想知道是否有更好的方法来做到这一点,所以我得到了如下内容:
<div class='input other_class_I_want_here'>
<input />
</div>
Run Code Online (Sandbox Code Playgroud)
感谢任何能提供帮助的人.
我正在尝试构建一个正则表达式,它返回逗号分隔列表中最后一个逗号后的所有内容.
// So if my list is as followed
var tag_string = "red, green, blue";
// Then my match function would return
var last_tag = tag_string.match(A_REGEX_I_CANNOT_FIGURE_OUT_YET);
// Then in last tag I should have access to blue
// I have tried the following things:
var last_tag = tag_string.match(",\*");
// I have seen similar solutions, but I cannot figure out how to get the only the last string after the last comma.
Run Code Online (Sandbox Code Playgroud) 我有3个表,一个称为订阅者,一个用户,一个称为博客.他们每个人都看起来如下.
CREATE TABLE IF NOT EXISTS `subscribers` (
`user_id` int(11) NOT NULL,
`blog_id` int(11) NOT NULL,
);
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL,
`name` varchar(255)
);
CREATE TABLE IF NOT EXISTS `blogs` (
`id` int(11) NOT NULL,
`name` varchar(255),
`user_id` int(11)
);
Run Code Online (Sandbox Code Playgroud)
我有一种情况,即API会自动在我们的数据库中创建博客记录,这些自动创建的博客都被分配了相同的用户ID(在本例中为123),以便知道它们真正来自并属于导入API.现在,需要为这些API发起的博客创建用户以便照顾它们.我使用基本插入创建了用户123,但现在我必须通过插入或一系列插入将此用户订阅到他们拥有的每个博客.我想知道是否可以使用一个查询执行此操作.像这样的东西,但我意识到我写的东西不起作用:
INSERT INTO `subscribers` (`user_id`,`blog_id`)
VALUES
(123, (SELECT id FROM `blogs` WHERE `user_id` = 123));
Run Code Online (Sandbox Code Playgroud)
是否有可能以某种方式基于可变数量的行进行多插入,我已经研究过,但我还没有找到答案.谢谢您的帮助.
我正在CakePHP中构建一个API.我有一个功能,作为其执行的一部分首先破坏与会话相关的cookie.我使用以下代码来执行此操作.
public function new_thing () {
// I first call another controller to use functions from that controller
App::import('Controller', 'Person');
$PersonsController = new PersonsController;
// This function call is the problem
// This does not throw any errors but does not destroy the cookie as requested
$PersonsController->_kill_auth_cookie()
}
// This is from the Person controller, these are the functions used in the API
// This is the function that sets the cookies
public function _set_auth_cookie( $email ) {
setcookie(Configure::read('auth_cookie_name'), $email); …Run Code Online (Sandbox Code Playgroud) cakephp ×2
cakephp-2.0 ×2
javascript ×2
alias ×1
angularjs ×1
api ×1
cookies ×1
css ×1
git ×1
html-input ×1
insert ×1
mingw32 ×1
mysql ×1
php ×1
protractor ×1
regex ×1
sql ×1
subquery ×1
windows ×1