我按照本教程安装了量角器,当我使用webdriver-manager更新时,它说:
selenium standalone is up to date.
chromedriver is up to date.
Run Code Online (Sandbox Code Playgroud)
当你尝试进行量角器测试时,它说:
C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:42
throw new Error('Could not find chromedriver at ' +
^
Error: Could not find chromedriver at C:\Users\****\AppData\Roaming\npm\node_modules\protractor\selenium\chromedriver.exe
at LocalDriverProvider.addDefaultBinaryLocs_ (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:42:15)
at LocalDriverProvider.setupEnv (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\driverProviders\local.dp.js:59:8)
at Runner.run (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:308:31)
at process.<anonymous> (C:\Users\****\AppData\Roaming\npm\node_modules\protractor\lib\runFromLauncher.js:32:14)
at process.EventEmitter.emit (events.js:98:17)
at handleMessage (child_process.js:318:10)
at Pipe.channel.onread (child_process.js:345:11)
[launcher] Runner Process Exited With Error Code: 8
Run Code Online (Sandbox Code Playgroud)
我检查了local.dp.js并看到它试图从.. \node_modules\protractor\selenium\chromedriver加载chromedriver但是只有一个名为chromedriver_2.9的空zip文件.
所以我手动下载了chromedriver并将其复制到这个位置,产生了一个新的错误:
C:\Users\****\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1549
throw error;
^
Error: Server exited with 1 …Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码进行跨域JSONP调用:
jQuery.ajax({
async: true,
url: 'http://mnews.hostoi.com/test.json',
dataType: 'jsonp',
method: "GET",
error: function (jqXHR, textStatus, errorThrown) {
console.log(textStatus + ': ' + errorThrown);
},
success: function (data, textStatus, jqXHR) {
if (data.Error || data.Response) {
exists = 0;
}
}
});
Run Code Online (Sandbox Code Playgroud)
在Firebug中调试时,我收到以下错误:

SyntaxError: missing ; before statement
Run Code Online (Sandbox Code Playgroud)
但是,当我通过像jsonlint.com这样的工具传递我的json对象(通过JQ代码中的链接可用)时,它说它是有效的JSON.我也没有发现任何异常现象.怎么会返回语法错误?它是一些JSONP细节我没有得到或什么?
{"news":[ {
"sentences": [
"Neuroscientists have discovered abnormal neural activity...",
"The researchers found that these mice showed many symptoms...",
"\"Therefore,\" the study authors say, \"our findings provide a novel.."
],
"summaryId": "ZJEmY5", …Run Code Online (Sandbox Code Playgroud) 我尝试写一个非常灵活的指令.为此,我希望用户定义在返回的一部分中使用的模板(如ui-bootstrap typeahead指令中所示).
所以我定义我的模板如下:
<script type="text/ng-template" id="myDirectivesCustomTemplate.html">
<ul>
<li ng-repeat="value in values">
<a ng-click="doSomething(value.id)">
{{value.name}}
</a>
</li>
</ul>
</script>
Run Code Online (Sandbox Code Playgroud)
我在我的指令中设置了这个模板
<div
my-directive
my-directive-custom-template="myDirectivesCustomTemplate.html"
my-directive-data="someScopeData">
Run Code Online (Sandbox Code Playgroud)
现在在我的指令中,如何呈现自定义模板并将其与传递的数据一起使用?当我尝试使用它直接返回模板时,它会抛出一个ReferenceError: $scope is not defined错误.如果我在没有范围的情况下调用它,则表示ReferenceError: myDirectiveCustomTemplate is not defined错误.
如果我不想直接使用它作为回报,我在哪里以及如何使用我的模板?
编辑:让我们说,这是我的指示:
(function() {
'use strict';
var Combobox = function() {
var displayInputField = elem.find('input.dropdown');
scope.$watch(scope.nsdComboboxModel,function(newVal){
/* search for newVal in given data object */
scope.setDisplayInputValue(newVal);
});
scope.setDisplayInputValue = function(value)
{
displayInputField.val(value);
};
scope.elementSelected = function (item, model, label) {
scope.ComboboxCallback(item);
scope.setDisplayInputValue(label); …Run Code Online (Sandbox Code Playgroud) 我试图获得Doctrine2实体,按其ID排序,显然是一个字符串,即使它只包含数字.所以我想做的是这样的:
SELECT entity1, cast (entity1.id AS integer) AS orderId
FROM Namespace\Bla\MyEntity
ORDER BY orderId
Run Code Online (Sandbox Code Playgroud)
有没有办法在Doctrine2中做这样的事情?或者,如果我无法更改ID的类型(当然是由于客户要求),获得我的结果的最佳做法是什么?
注意:我不是在问SQL代码,我要求一个Doctrine2解决方案,最好是在DQL中
在用户使用FOSUserBundle的密码重置重置密码后,默认情况下,他被重定向到FOSUserProfile.我想重定向到另一条路线.这是可能的,如果可以,怎么样?
我试图为那些不解释输入元素的占位符属性的浏览器找到一个后备解决方案.我有这个简单的jQuery脚本,但它会抛出一个错误
SecurityError: "The operation is insecure.
this.value = val;"
Run Code Online (Sandbox Code Playgroud)
这是我的脚本:
$('document').ready(function(){
$('input').each(function() {
if ($(this).val() === '' || $(this).val() === undefined) {
$(this).val($(this).attr('placeholder'));
}
});
});
Run Code Online (Sandbox Code Playgroud)
任何想法我能做什么?或者我做错了什么?或者这个错误意味着什么?它发生在Firefox中,还没有在其他浏览器中测试过.
我需要设置symfony2表单元素的值.我在Controllers Action中使用了一个doctrine2实体,一个Symfony\Component\Form\AbstractType和createForm()方法.
$saleDataForm = $this->createForm(new SaleType(), $sale);
Run Code Online (Sandbox Code Playgroud)
现在,我如何从该表单中获取元素,以及如何设置它的值?我想做这样的事情,但它不起作用:
$saleDataForm->get('image')->setValue('someimapge.jpg');
Run Code Online (Sandbox Code Playgroud)
FYI:我需要这样做,以正确渲染场(使用这种方法,我像场总是空的,我需要将其设置为内容的ImagePath呈现上传图像的预览)
我正在使用带有主题的 Angular Material。
$my-theme-redish: (...
$my-theme-red: (...
$my-theme-celeste: (...
$my-theme-primary: mat-palette($my-theme-redish);
$my-theme-accent: mat-palette($my-theme-celeste);
$my-theme-warn: mat-palette($my-theme-red);
$my-app-theme: mat-light-theme((
color: (
primary: $my-app-primary,
accent: $my-app-accent,
warn: $my-app-warn,
)
));
Run Code Online (Sandbox Code Playgroud)
现在我也想主题/更改border-radius. 我可以在主题中做到这一点吗?我没有找到任何关于此的文档。
我尝试通过使用::ng-deep或直接寻址某些组件来进行主题化:
$my-theme-redish: (...
$my-theme-red: (...
$my-theme-celeste: (...
$my-theme-primary: mat-palette($my-theme-redish);
$my-theme-accent: mat-palette($my-theme-celeste);
$my-theme-warn: mat-palette($my-theme-red);
$my-app-theme: mat-light-theme((
color: (
primary: $my-app-primary,
accent: $my-app-accent,
warn: $my-app-warn,
)
));
Run Code Online (Sandbox Code Playgroud)
但没有任何效果。
我正在寻找一个方法或转换表,知道如何将变音符号和特殊字符转换为ascii中最可能的表示形式.
例:
Ärger = aerger
Bôhme = bohme
Søren = soeren
pjérà = pjera
Run Code Online (Sandbox Code Playgroud)
有人有什么想法?
更新:除了良好的接受答案,我还发现PECLs Normalizer非常有趣,虽然我不能使用它,因为服务器没有它并且没有为我更改.
如果此处的答案对您没有帮助,请查看此问题.
php ascii diacritics special-characters non-ascii-characters
我按照站点使用一次性数据库教程测试Symfony应用程序.我在我的测试用例中添加了Fixtures,并且在SetUp期间没有出现错误.如果我在灯具中添加一个错误(例如,将一个nullable = false字段留空),则会显示错误,因此该代码肯定会被执行.
我的配置:
doctrine:
dbal:
default_connection: memory
connections:
memory:
driver: pdo_sqlite
memory: true
charset: UTF8
Run Code Online (Sandbox Code Playgroud)
我的WebTestCase中的SetUp:
protected function setUp() {
parent::setUp();
self::bootKernel();
DatabasePrimer::prime(self::$kernel);
$this->loadFixtures([
'AppBundle\DataFixtures\ORM\UserData',
'AppBundle\DataFixtures\ORM\ArtistData'
]);
}
Run Code Online (Sandbox Code Playgroud)
然而,在我的WebTestCase中,似乎没有表存在.输出抛出一个Doctrine异常,说我的表不存在.
SQLSTATE[HY000]: General error: 1 no such table: my_user_table
Run Code Online (Sandbox Code Playgroud)
如果我在文件中切换到sql_lite,一切正常,没有任何其他更改:
dbal:
default_connection: file
connections:
file:
driver: pdo_sqlite
path: %kernel.cache_dir%/test.db
charset: UTF8
Run Code Online (Sandbox Code Playgroud)
任何人都有成功的说教程或使用sqlite内存数据库进行单元测试,并有任何提示或想法?
更新: 我将我的安装程序更改为此以确保内核不会在其间关闭.它没有帮助:
parent::setUp();
$this->client = $this->getClient();
MemoryDbPrimer::prime(self::$kernel);
$this->loadFixtures([
'AppBundle\DataFixtures\ORM\UserData',
'AppBundle\DataFixtures\ORM\ArtistData'
]);
Run Code Online (Sandbox Code Playgroud) symfony ×3
angularjs ×2
doctrine-orm ×2
javascript ×2
jquery ×2
ajax ×1
angular ×1
ascii ×1
casting ×1
diacritics ×1
doctrine ×1
dql ×1
forms ×1
image-upload ×1
json ×1
jsonp ×1
mat-dialog ×1
php ×1
phpunit ×1
protractor ×1
selenium ×1
sqlite ×1
templates ×1
url-routing ×1
windows ×1