这是我的json:
{
"data": [
{
"comment": "3541",
"datetime": "2016-01-01"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是模型:
export class Job {
constructor(comment:string, datetime:Date) {
this.comment = comment;
this.datetime = datetime;
}
comment:string;
datetime:Date;
}
Run Code Online (Sandbox Code Playgroud)
查询:
getJobs() {
return this._http.get(jobsUrl)
.map((response:Response) => <Job[]>response.json().data)
}
Run Code Online (Sandbox Code Playgroud)
问题是在铸造之后Job[]我期待datetime属性Date但是它是字符串.它不应该转换为Date对象吗?我在这里失踪了什么?
为什么我们需要Task.ContinueWith()方法.我们不能只在Task体内写下"延续代码"吗?
c# parallel-processing multithreading conceptual task-parallel-library
如何在Sublime Text中格式化django模板.我的模板包括:
{{ variable }}和的django模板语言{% stuff %})有没有办法让PyCharm提供相同的格式?
我有引用ProjectB(ClassLibrary)的ProjectA(WPFApplication ).在ProjectB内部我有wpf窗口,它使用来自ThirdParty.dll的控件,因此我从ProjectB引用.
问题是它没有在ProjectA的输出文件夹中找到ThirdParty.dll,并且引发了xaml解析运行时异常.GAC中没有ThirdParty.dll."本地复制"设置为true.如果我在ProjectA的输出文件夹中手动添加该库,它也可以工作,如果我在我的cs文件中使用了ThirdParty.dll somwhere 它也可以工作.
我怎么解决这个问题?
我有两种方法:
BuildThing(Thing a);
BuildThings(IEnumerable<Thing> things);
Run Code Online (Sandbox Code Playgroud)
从干净的代码角度看这是好事吗?或者也许最好只使用BuildThings并只用一个东西传递IEnumerable?或者使用params?
谢谢.
我有这个:
class FooGenerator:IFooGenerator {
private object _generated;
public void Generate() {
// Generating
GenerateSmallPart();
GenerateOtherSmallPart();
GenerateTinyPart();
// A lot similar
}
private void GenerateSmallPart() {
//add small part to _generated
}
private void GenerateOtherSmallPart() {
//add small part to _generated
}
private void GenerateTinyPart() {
//add small part to _generated
}
}
internal interface IFooGenerator {
void Generate();
}
Run Code Online (Sandbox Code Playgroud)
在我的应用程序中,我只IFooGenerator使用IoC,但我想测试所有这些子方法.
正如我在这里找到的,一个选项是使用所有子方法提取类.但为什么我需要这样做.它只被用于FooGenerator.
您有什么建议我如何让我的课程更可测试?
我试图将changeset.yaml文件包含到Liquidbase的changelog.yaml中.
文件changelog.yaml
databaseChangeLog:
- include:
file: migrations/changeset.yaml
Run Code Online (Sandbox Code Playgroud)
changeset.yaml
changeset:
id: 1
author: vlad
Run Code Online (Sandbox Code Playgroud)
执行更新时获取此信息
Unexpected error running Liquibase: Could not find databaseChangeLog node
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?谢谢.
更新:如果我使用xml格式似乎是相同的.
我使用DTO来减少查询大小
<class name="Person" table="`APP_Person`">
<property name="FirstName" type="string" length="512" />
<property name="Age" type="int" />
<property name="SocialNumber" type="int" />
<property name="PassportId" type="int" />
<property name="Salary" type="int" />
</class>
<class name="PersonDTO" table="`APP_Person`">
<property name="FirstName" type="string" length="512" />
<property name="Age" type="int" />
</class>
Run Code Online (Sandbox Code Playgroud)我知道您可以使用#1234提交消息语法链接工作项。
有没有一种方法可以更改工作项状态。说,解决吗?
在 PyCharm 中运行测试时遇到问题。
manage.py test 工作正常。
但是,如果我在 PyCharm Django 测试中运行测试,则会出现以下错误:
AttributeError: 'module' object has no attribute 'ROOT_URLCONF'
DJANGO_SETTINGS_MODULE=project.settings.test
设置: project/settings/test.py
管理脚本: project/manage.py
from django.test import SimpleTestCase
from rest_framework import status
class AccountTestCase(SimpleTestCase):
def test_current_account(self):
url = '/api/accounts/current/'
response = self.client.get(url)
self.assertEqual(response.status_code, status.HTTP_301_MOVED_PERMANENTLY)
Run Code Online (Sandbox Code Playgroud)
Error
packages/django/core/handlers/base.py", line 113, in get_response
urlconf = settings.ROOT_URLCONF
File "/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__
return getattr(self._wrapped, name)
File "/lib/python2.7/site-packages/django/conf/__init__.py", line 173, in __getattr__
return getattr(self.default_settings, name)
AttributeError: 'module' object …Run Code Online (Sandbox Code Playgroud) c# ×4
.net ×2
django ×2
pycharm ×2
angular ×1
conceptual ×1
git ×1
json ×1
liquibase ×1
mapping ×1
methods ×1
msbuild ×1
nhibernate ×1
oop ×1
parameters ×1
refactoring ×1
reference ×1
sublimetext2 ×1
testing ×1
tfs ×1
tfs2013 ×1
typescript ×1
unit-testing ×1
yaml ×1