尝试做类似的事情:
public interface Order {
public List<? extends OrderItem> getItems();
public void setItems(List<? extends OrderItem> items);
}
public interface OrderItem {
// stuff
}
public class OrderItemImp implements OrderItem {
// stuff for class impl
}
public class OrderImp implements Order {
public List<OrderItemImp> getItems() {
return items;
}
public void setItems(List<OrderItemImp> items) {
this.items = items;
}
}
Run Code Online (Sandbox Code Playgroud)
编译器抱怨setItems方法.我怎样才能做到这一点?谢谢.
跑步时......
python setup.py sdist register upload
Run Code Online (Sandbox Code Playgroud)
..我得到以下输出:
running register
We need to know who you are, so please choose either:
1. use your existing login,
2. register as a new user,
3. have the server generate a new password for you (and email it to you), or
4. quit
Your selection [default 1]: 1
Username: example
Password: ...
Registering mypackage to http://pypi.python.org/pypi
Server response (200): OK
I can store your PyPI login so future submissions will be faster.
(the login …Run Code Online (Sandbox Code Playgroud) 我有xml文件,其结构使用以下xsd定义:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://schemas.TEST.com/TEST/TEST.xsd" elementFormDefault="qualified" xmlns="http://schemas.TEST.com/TEST/TEST.xsd" xmlns:mstns="http://schemas.TEST.com/TEST/TEST.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Element">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Items">
<xs:complexType>
<xs:sequence>
<xs:element name="ItemName" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
现在我正在尝试基于先前定义的xsd创建一些测试xml数据:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Element xmlns="http://schemas.TEST.com/TEST/TEST.xsd">
<Name>John Blue</Name>
<Items>
<ItemName>test</ItemName>
</Items>
<Items>
<ItemName>test2</ItemName>
</Items>
<Items>
<ItemName>test3</ItemName>
</Items>
</Element>
Run Code Online (Sandbox Code Playgroud)
由于重复的"Items"元素,此xml文件被视为无效.有没有办法解决?
错误:未处理的异常类型IOException.
File imgLoc = new File("player.png");
BufferedImage img = ImageIO.read(imgLoc);
Run Code Online (Sandbox Code Playgroud)
如何从文件位置获取bufferedImage?
好吧,我认为我对MVVM有相当好的理解.但我需要一些澄清.
ViewModel是否负责调用相应的服务来保留模型信息?
如果是这样,那么ViewModel必须有一种干净的方法来确定它所拥有的数据是否有效.如果数据有效,它将相应地更新模型.最后,给定新更新的模型,将调用持久化模型的服务.那么问题是:我们如何验证ViewModel的信息并在View中轻松显示?
我已经看到了一些不同的验证方法.一个建议使用IDataErrorInfo,我认为是绝对令人作呕的.
另一个是将ValidationRule添加到Binding.ValidationRules.但是,使用这种方法不能在模型的整体环境中运行.ValidationRule对象只能对单个值执行验证.一个示例可能是确保值是整数或在特定范围内.
我刚开始研究的另一个想法是使用BindingGroup.但是我现在还不太了解这一点,因为我还在阅读它.
我希望能够在一个地方执行验证逻辑,供View和ViewModel使用.除了这个要求之外,我希望能够对ViewModel中的任何其他值执行验证.此外,如果ViewModel是无效状态,则能够阻止ViewModel持久化数据.这需要在View中轻松反映出来.
如果有人能指出我的一些文章或提供一些洞察我想要的方法,我将非常感激.
我有一个从服务返回的结果集,它给了我以下json
{
"ThreadCount":61,
"GroupList":[
{"userName":"KLT","count":2687},
{"userName":"KCameron","count":718},
{"userName":"IRG","count":156},{"userName":"JLB","count":123},{"userName":"HML","count":121},{"userName":"SMN","count":99},{"userName":"TBridges","count":68},{"userName":"ARF","count":65},{"userName":"MarkGreenway","count":61},{"userName":"SMC","count":55},{"userName":"EMD","count":52},{"userName":"PKP","count":41},{"userName":"KBounds","count":36},{"userName":"MAN","count":33},{"userName":"LAC","count":17},{"userName":"EPS","count":17},{"userName":"CAN","count":7},{"userName":"MAJ","count":3},{"userName":"CPC","count":2}]
}
Run Code Online (Sandbox Code Playgroud)
我想使用Jquery(或javascript将threadCount放在一个div中,并将用户名和counds添加到表中
success: function(result) {
$("#Unfiled").html(result.ThreadCount);
$.each(result.GroupList, function(user) {
$('#myTable > tbody').append(
'<tr><td>'
+ user.userName
+ '</td><td>'
+ user.count +
'</td></tr>'
);
});
}
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我在桌子上没有得到任何东西......
顺便说一句,我的HTML在这里:
<table>
<tr>
<td>
Unfiled Emails:
</td>
<td id="Unfiled">
-1
</td>
</tr>
<tr>
<td colspan="2">
<table id="myTable" border="2" cellpadding="3" cellspacing="3">
</table>
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我知道我错过了一些简单的事......
感谢您的帮助
我不知道这是否可能,但我只是想问一下。我的数学和算法技能有点让我失望:P
问题是我现在有这个类可以生成达到一定限制的素数:
public class Atkin : IEnumerable<ulong>
{
private readonly List<ulong> primes;
private readonly ulong limit;
public Atkin(ulong limit)
{
this.limit = limit;
primes = new List<ulong>();
}
private void FindPrimes()
{
var isPrime = new bool[limit + 1];
var sqrt = Math.Sqrt(limit);
for (ulong x = 1; x <= sqrt; x++)
for (ulong y = 1; y <= sqrt; y++)
{
var n = 4*x*x + y*y;
if (n <= limit && (n % 12 == 1 || n …Run Code Online (Sandbox Code Playgroud) 天儿真好,
我一直在努力提高自己作为开发人员的表现,在听了这个有趣的播客主题后,我想知道人们是否认为值得向同事寻求反馈.
我想通过使用Rypple网站以播客中建议的方式匿名获取反馈.通过询问一个简短的问题,直接解决我的工作或行为的特定方面.例如,我正在查看以下问题:
编辑:我不是在谈论一般方面,而是具体关于如何改进我作为开发人员的表现.沟通和与他人合作是与公司其他人合作的重要部分.
编辑:这些额外的问题是对JB King对我原来问题的评论的回应.
可以提供有用反馈以帮助您作为开发人员进行改进的可能问题的更多示例包括:
所有这些直接解决了我作为开发人员的个人进步.
干杯,