我有
<Model>
<Components>
<Component name="a" id="aaa" molarmass="60.05"/>
<Component name="b" id="bbb" molarmass="18.02"/>
<Component name="c" id="ccc" molarmass="32.04"/>
<Component name="d" id="ddd" molarmass="46.03"/>
</Components>
...
</Model>
Run Code Online (Sandbox Code Playgroud)
和班级
public class ChemieComponent
{
public string Name { get; set; }
public string Id { get; set; }
public double MolarMass { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我可以使用LINQ查询将此组件解析为对象吗?怎么样?我最终应该有一个IEnumerable,对吗?
编辑
<Points>
<Point name="P1" pressure="1">
<Fractions>
<Fraction id="aaa" value="0.15272159"/>
<Fraction id="bbb" value="0.15272159"/>
</Fractions>
more points...
</Points>
Run Code Online (Sandbox Code Playgroud) 我知道这个问题,但使用org.springframework.data:spring-data-jpa:1.7.0.RELEASE
我仍然有同样的问题(Either use @Param on all parameters except Pageable and Sort typed once, or none at all!
).我的班级是:
public interface BalanceHistoryRepository extends JpaRepository<BalanceHistory, Long> {
@Query("select bh from BalanceHistory bh where bh.account.id = :idAccount")
public BalanceHistory findCurrentBalanceByAccountNumber(PageRequest pageCriteira, @Param("idAccount") long idAccount);
}
Run Code Online (Sandbox Code Playgroud)
编辑
呼叫:
Pageable page = new PageRequest(0, 1, Sort.Direction.DESC, "date");
BalanceHistory bh = balanceHistoryRepository.findCurrentBalanceByAccountNumber(1,page);
Run Code Online (Sandbox Code Playgroud)
方法:
@Query("select bh from BalanceHistory bh where bh.account.id = :idAccount")
public BalanceHistory findCurrentBalanceByAccountNumber(@Param("idAccount") long idAccount, Pageable pageCriteira);
Run Code Online (Sandbox Code Playgroud) 我在这里问一个特定的话题 - 我在网上找到了很少有关于此的信息.我正在实现一个F#版本的Minimax算法.我现在遇到的问题是我要比较我的树叶(下面的数据结构).搜索VS给我的错误,我得到了这样的东西:
我曾经拥有的树类型:
type TreeOfPosition =
| LeafP of Position
| BranchP of Position * TreeOfPosition list
Run Code Online (Sandbox Code Playgroud)
和实施IComparable的流行
type staticValue = int
[<CustomEquality;CustomComparison>]
type TreeOfPosition =
| LeafP of Position * staticValue
| BranchP of Position * TreeOfPosition list
override x.Equals(yobj) =
match yobj with
| :? TreeOfPosition as y -> (x = y)
| _ -> false
override x.GetHashCode() = hash (x)
interface System.IComparable with
member x.CompareTo yobj =
match yobj with
| :? TreeOfPosition as y -> …
Run Code Online (Sandbox Code Playgroud) 我在获取机器的mac地址时遇到了问题,使用以下代码解决了这个问题:
Process p = Runtime.getRuntime().exec("getmac /fo csv /nh");
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
String line;
line = in.readLine();
String[] result = line.split(",");
System.out.println(result[0].replace('"', ' ').trim());
Run Code Online (Sandbox Code Playgroud)
但是,我想知道为什么这段代码不起作用.每次读取MAC地址时,它都会返回不同的值.首先我认为这是因为getHash,可能使用我不知道的时间戳......但即使删除它,结果也会改变.
码
public static byte[] getMacAddress() {
try {
Enumeration<NetworkInterface> nwInterface = NetworkInterface.getNetworkInterfaces();
while (nwInterface.hasMoreElements()) {
NetworkInterface nis = nwInterface.nextElement();
if (nis != null) {
byte[] mac = nis.getHardwareAddress();
if (mac != null) {
/*
* Extract each array of mac address and generate a
* hashCode for it
*/
return mac;//.hashCode(); …
Run Code Online (Sandbox Code Playgroud) 有没有办法在Eclipse中的结构化文本编辑器中编辑我的颜色选项以进行语法突出显示,就像我可以为Java源代码做的那样?我能做的最大值是改变字体......
谢谢您的帮助!
生成在XAML文件中的视口上透明的边框(用于Trackball事件)是微不足道的:
<Border Name="myElement" Background="Transparent" />
Run Code Online (Sandbox Code Playgroud)
但是我如何在.cs中做到这一点?
Border border = new Border();
**border.Background = (VisualBrush)Colors.Transparent;**
grid.Children.Add(viewport);
grid.Children.Add(border);
Run Code Online (Sandbox Code Playgroud)
这当然不起作用.
我想知道我怎样才能测试这种情况:
<foo>
<bla1>xxx</bla1>
<bla2>yyy</bla2>
<bla3>zzz</bla3>
</foo>
Run Code Online (Sandbox Code Playgroud)
在while(reader.Read())中,当我在foo和bla1,bla2,bla3时放入XmlNodeType.Element ...当放入xxx,yyy,zzz中的.TextElement时.但是我可以测试bla的内部是否有文本值?
非常感谢
佩德罗杜索
好,
当我阅读并尝试类似的每个主题没有成功时,我决定发表我自己的问题.我的解决方案有一个控制台应用程序和一个用于dataaccess的类库.Nhibernate配置位于控制台应用程序中的appconfig内部(我目前用于调试,因为我将创建Web应用程序并将所有配置迁移到web.config).
例外是众所周知的:
NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle.dll' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed. Solution: Confirm that your deployment folder contains one of the following assemblies: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll ---> System.IO.FileNotFoundException: Could not load file or assembly 'NHibernate.ByteCode.Castle.dll' or one of its dependencies. The system cannot find the file specified.
我试图解决它的步骤:
1)部署文件夹中的dll …
我刚刚获得了最后一个稳定的 Hadoop 版本 (2.4),然后按照此说明将其导入 Eclipse。
但是,我cannot be resolved to a type
在测试 src 文件夹中有几个构建错误。举个例子:
import org.apache.hadoop.ipc.protobuf.TestProtos.EchoRequestProto;
import org.apache.hadoop.ipc.protobuf.TestProtos.EchoResponseProto;
import org.apache.hadoop.ipc.protobuf.TestProtos.EmptyRequestProto;
import org.apache.hadoop.ipc.protobuf.TestProtos.EmptyResponseProto;
import org.apache.hadoop.ipc.protobuf.TestRpcServiceProtos.TestProtobufRpcProto;
import org.apache.hadoop.ipc.protobuf.TestRpcServiceProtos.TestProtobufRpc2Proto;
Run Code Online (Sandbox Code Playgroud)
Eclipse 找不到任何这些类,仅仅是因为org.apache.hadoop.ipc.protobuf包是空的。难道我做错了什么?缺少一些配置步骤?
@CompoundIndexes({
@CompoundIndex(name = "fertilizer_idx",
unique = true,
def = "{'name': 1, 'formula': 1, 'type': 1}")
})
public class Fertilizer extends Element implements Serializable {
//class stuff
}
Run Code Online (Sandbox Code Playgroud)
是否可以创建索引大小写不敏感?现在,它是从分化NAME
到NAMe
.保存第二个字段小写(或大写)不是我的可能.
谢谢,佩德罗
c# ×4
java ×4
eclipse ×2
apache ×1
compareto ×1
equals ×1
f# ×1
hadoop ×1
hibernate ×1
icomparable ×1
jpa ×1
jsp ×1
linq-to-xml ×1
mac-address ×1
minimax ×1
mongodb ×1
nhibernate ×1
oracle ×1
spring ×1
spring-data ×1
spring-mvc ×1
wpf ×1
wpf-controls ×1
xaml ×1
xml ×1
xmlnode ×1