我听说VS 2015支持新的js语法但是当我在这个IDE中打开一个使用aurelia.js编写的项目时,intellisense会抱怨很多很多东西,例如.
export class UpperValueConverter {
toView(value){
return value && value.toUpperCase();
}
}
Run Code Online (Sandbox Code Playgroud)
我安装了WebEssentials 2015.似乎仍然没有任何工作...可能一个重要的信息是我目前的VS安装是一个新的,所以我没有弄乱任何设置.
这是路线:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
closeModal: function () {
alert('asdf');
}
}
});
Run Code Online (Sandbox Code Playgroud)
组件js代码:
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
closeModal: function () {
this.sendAction('closeModal');
}
}
});
Run Code Online (Sandbox Code Playgroud)
我想做的是(如代码所暗示的那样;))从组件到路由发送一个动作,以便路由可以对其进行操作.但是上面的代码不起作用 - 组件正确处理动作,但是sendAction
它内部的调用方法没有做任何事情.
编辑:
我解决了这个问题:
this._controller.send('closeModal');
在组件的动作方法中,然而这个解决方案并不满足我.Ember的作者说在ember 2.0中将删除控制器,因此在我的代码中我不想对它们进行任何引用.建议?
我的问题如下:
我有一个汽车经销商A和一个名为的db表sold_cars
.当汽车正在出售时,我在此表中创建了条目.
Table有一个名为的整数列order_no
.它应该是经销商销售的汽车中独一无二的.
因此,如果经销商A出售汽车a, b and c
,那么这一栏应该是1, 2, 3
.我必须使用这个列,而不是主键,因为我不想在我的数字中有任何漏洞 - 经销商A和B(可能会在以后添加)应该有订单号1,2,3,而不是A :1,3,5和B:2,4,6.所以...我为给定的经销商选择最后一个最大的order_no,将其增加1并保存.
问题是两个人在同一毫秒内从经销商A购买了汽车,两个订单都获得了相同的订单号.有什么建议?我正在考虑在事务块中关闭此进程,并锁定此表直到事务完成,但无法找到有关如何执行此操作的任何信息.
我不明白.如果我将Accept-Language
标题设置为除"en"(de,pl,es)之外的任何内容,或者甚至是不存在的内容(如xxs),则应用程序不会吐出此错误,但是当我将其设置为"恩".它只发生在Windows(最新的gettext工具)上.这是堆栈跟踪:
Traceback (most recent call last):
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\core\han
dlers\exception.py", line 39, in inner
response = get_response(request)
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\core\han
dlers\base.py", line 244, in _legacy_get_response
response = middleware_method(request)
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\middlewa
re\locale.py", line 29, in process_request
translation.activate(language)
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\utils\tr
anslation\__init__.py", line 161, in activate
return _trans.activate(language)
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\utils\tr
anslation\trans_real.py", line 238, in activate
_active.value = translation(language)
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\utils\tr
anslation\trans_real.py", line 227, in translation
_translations[language] = DjangoTranslation(language)
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\utils\tr
anslation\trans_real.py", line 129, in __init__
self._add_installed_apps_translations()
File "E:\projekty\python\myapp_api\_env\lib\site-packages\django\utils\tr
anslation\trans_real.py", line 176, in _add_installed_apps_translations …
Run Code Online (Sandbox Code Playgroud) 我正在使用angular-cli来运行我的打字机动力angular2应用程序.我有这样的AppComponent
定义:
import { Component } from '@angular/core';
import { ServersListComponent } from './servers-list/servers-list.component';
@Component({
moduleId: module.id,
selector: 'app',
templateUrl: 'app.component.html',
styleUrls: ['app.component.css'],
directives: []
})
export class AppComponent {
}
Run Code Online (Sandbox Code Playgroud)
angular-cli无法编译此文件,因为它会在行中提出此问题主题中提到的错误moduleId: module.id
.
我的tsconfig.json
文件定义如下:
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../dist/",
"rootDir": ".",
"sourceMap": true,
"target": "es5",
"inlineSources": true
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
Run Code Online (Sandbox Code Playgroud) 如何从基类中的派生类获取属性?
基类:
public abstract class BaseModel {
protected static readonly Dictionary<string, Func<BaseModel, object>>
_propertyGetters = typeof(BaseModel).GetProperties().Where(p => _getValidations(p).Length != 0).ToDictionary(p => p.Name, p => _getValueGetter(p));
}
Run Code Online (Sandbox Code Playgroud)
派生类:
public class ServerItem : BaseModel, IDataErrorInfo {
[Required(ErrorMessage = "Field name is required.")]
public string Name { get; set; }
}
public class OtherServerItem : BaseModel, IDataErrorInfo {
[Required(ErrorMessage = "Field name is required.")]
public string OtherName { get; set; }
[Required(ErrorMessage = "Field SomethingThatIsOnlyHereis required.")]
public string SomethingThatIsOnlyHere{ get; set; }
} …
Run Code Online (Sandbox Code Playgroud) 你们中有人知道可以关闭标题中提到的行为的解决方法吗?每次我在测试步骤中做错事时,异常都会如下所示:
Test method
FunctionalTests.Features.Parties.PartyAddingFeature.FeatureTitle threw exception:
TechTalk.SpecFlow.BindingException: Error calling binding method 'FunctionalTests:FunctionalTests.Steps.PartiesSteps.GivenLegacyPartyUpsertedIntegrationEventCameInWithData(String, Table)': Object of type 'System.String' cannot be converted to type 'System.Int32'.
at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) in D:\a\1\s\TechTalk.SpecFlow\Bindings\BindingInvoker.cs:line 69
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 395
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 316
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 132
at FunctionalTests.Features.Parties.PartyAddingFeature.ScenarioCleanup()
at FunctionalTests.Features.Parties.PartyAddingFeature.FeatureTitle() in C:\Project\test\Services\FunctionalTests\Features\Parties\PartyAdding.feature:line 25
Run Code Online (Sandbox Code Playgroud) 我使用MVVM模式创建了一个项目(或者我认为;)).为了简化我的案例:
型号:
public class Model {
public string Name { get; set; }
public bool IsDefective { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
ViewModel - 扩展MvvmLight ViewModelBase
:
public class ViewModel : ViewModelBase {
private ObservableCollection<Model> models;
public ObservableCollection<Model> Models {
get {
if (_models== null) {
_models= new ObservableCollection<Models>();
}
return _models;
}
set {
RaisePropertyChanged("Models");
_models= value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
查看 - 我正在显示文本框列表:
<TextBlock Text="{Binding Name}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=.IsDefective}" Value="True">
<Setter Property="Foreground" Value="Red" /> …
Run Code Online (Sandbox Code Playgroud) 我在使以下布局在所有浏览器中看起来都相同时遇到问题:
.wrapper {
margin-top: 100px;
position: relative;
height: 400px;
width: 400px;
border: 1px solid black;
}
.icon {
position: absolute;
width: 40;
height: 40px;
border: 1px solid black;
background-color: white;
top: -20px;
right: 10px;
}
Run Code Online (Sandbox Code Playgroud)
<fieldset class="wrapper">
<legend>Legendary!</legend>
<div class="icon">icon</div>
</fieldset>
Run Code Online (Sandbox Code Playgroud)
问题是当legend
元素存在时,div.icon
在firefox上向下拉几个像素,在chrome上向上拉几个像素.当我删除legend
元素时,它工作正常,但我不能这样做.关于如何让它在任何地方看起来都一样的想法?
我已经设置了以下日志记录配置:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': '%(asctime)s %(levelname)s [%(name)s:%(lineno)s] %(module)s %(process)d %(thread)d %(message)s'
}
},
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'stream': sys.stdout,
'formatter': 'verbose'
}
},
'loggers': {
'gunicorn.errors': {
'level': 'INFO',
'handlers': ['console'],
'propagate': True,
},
}
}
Run Code Online (Sandbox Code Playgroud)
它似乎根本没有作用。当该标志DEBUG
设置True
为时,我可以在控制台中看到一些错误。但是,将其设置为时False
,我不能。因此,尽管DEBUG
以一种方式或其他方式设置了标志,如何将错误记录到控制台?
c# ×3
django ×3
javascript ×2
angular ×1
aurelia ×1
css ×1
ecmascript-6 ×1
ecmascript-7 ×1
ember.js ×1
gunicorn ×1
html ×1
locking ×1
logging ×1
mvvm ×1
oop ×1
orm ×1
python ×1
reflection ×1
specflow ×1
translation ×1
wpf ×1