我正在使用swingJava 构建一个接口,我构建了一个middleware不断读取串口并保存所需内容的接口String,这就是我在做这个的方式:
public class RFID {
private static RFIDReader rReader;
private static boolean state;
public RFID(RFIDReader rReader) {
this.rReader = rReader;
this.state = true;
}
public void connect(String portName) throws Exception {
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if (portIdentifier.isCurrentlyOwned()) {
System.out.println("Error: Port is currently in use");
} else {
CommPort commPort = portIdentifier.open(this.getClass().getName(), 2000);
if (commPort instanceof SerialPort) {
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
InputStream in = serialPort.getInputStream();
OutputStream out = …Run Code Online (Sandbox Code Playgroud) <?php
function a($n){
return ( b($n) * $n);
}
function b(&$n){
++$n;
}
echo a(5);
?>
Run Code Online (Sandbox Code Playgroud)
我在星期天做了一个考试,想知道为什么这段代码的输出是0?
我不是PHP的开发人员所以任何帮助将不胜感激.
我正在尝试将CSS应用于我,<h:inputText>但到目前为止还没有成功:
<h:form id="contactform">
<h:panelGrid columns="3">
<h:outputLabel for="name">Name</h:outputLabel>
<h:inputText id="name" value="#{contact.client.name}" >
<f:ajax event="blur" render="nameMessage"></f:ajax>
</h:inputText>
<h:message id="nameMessage" for="name" />
<h:commandButton value="Send" action="#{contact.sendMessage}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<h:messages globalOnly="true" layout="table" />
</h:form>
Run Code Online (Sandbox Code Playgroud)
我的CSS:
#contactform .text-input{
background-color:#fbfbfb;
border:solid 10px #000000;
margin-bottom:8px;
width:178px;
padding:8px 5px;
color:#797979;
}
Run Code Online (Sandbox Code Playgroud)
如果我尝试在某些HTML输入字段中应用此CSS样式,它可以工作,但不适用于JSF 2.0.
编辑:
在JSF中更新我的代码的这部分:
<h:inputText id="name" styleClass="text-input" value="#{contact.client.name}" >
Run Code Online (Sandbox Code Playgroud)
将此代码插入我的CSS文件中:
text-input{
border:solid 1px #e0e0e0;
}
Run Code Online (Sandbox Code Playgroud)
但似乎同样的事情,没有任何改变.
输出:
<form id="j_idt35" name="j_idt35" method="post" action="/brainset/contact.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt35" value="j_idt35" />
<table class="contactform">
<tbody>
<tr>
<td><label …Run Code Online (Sandbox Code Playgroud) 如果我把:
<head>
//..
</head>
<body>
//..
</body>
Run Code Online (Sandbox Code Playgroud)
我的CSS样式正确应用,但当我改为:
<h:head>
//..
</h:head>
<h:body>
//..
</h:body>
Run Code Online (Sandbox Code Playgroud)
我的风格似乎错了CSS的某些部分.
为什么会这样?
更新: 为了简化我的问题,我将在下面显示两个图像:
没有
<h:head>.. <h:body>(这是正确的CSS样式)

同
<h:head>..<h:body>
Run Code Online (Sandbox Code Playgroud)

我只是改变了同样的事情,这个错误发生了.
我是关于JSF的新手,我必须做些什么?
更新2: 我正在使用Rich Faces 4,我意识到的一件事就是在标签的末尾出现了一个脚本:
<link type="text/css" rel="stylesheet" href="/brainset/rfRes/skinning.ecss.xhtml?db=eAHL6rC8BQAEkAIG">
Run Code Online (Sandbox Code Playgroud)
我没有把它,这只出现
> <h:head> ... <h:body>
Run Code Online (Sandbox Code Playgroud)
标签.我认为我的风格被RichFaces所取代,包括这个'skinning.ecss'.
我真的需要用这些技术创建一个简单的项目,我已经知道如何在Eclipse中创建一个JSF 2项目.但我不知道如何插入hibernate并使其工作.我在Netbeans中知道但我想明确地改为Eclipse.
我在谷歌搜索但没什么可靠的.
任何铅,小费,将非常感激.
谢谢
我有这个代码:
int main(){
char vector[52];
char i;
/* initialize the vector */
for (i ='a'; i < 'z'; i++){
vector[i] = i - 'a' + 1;
}
// vector is like vector['a'] = 1, vector['b'] = 2 .. vector['z'] = 26
for (i ='A'; i <= 'Z'; i++){
vector[i] = i - 'A' + 27;
}
// vector is like vector['A'] = 27, vector['B'] = 28 .. vector['z'] = 52
for (i ='a'; i <= 'z'; i++){
printf("letter %c : …Run Code Online (Sandbox Code Playgroud) 我有两个相同类型的对象,然后我试图看看它们是否相等,但似乎它们不是,我真的不明白为什么会发生这种情况,我从屏幕上拍了一张照片在哪里你们可以看到我想说的话:
在这里(高分辨率).
图像是为了向你们展示即使是重新布局也会发生什么.
这是代码和类:
private boolean checkForExpr(Type lowerExprType, Type upperExprType) {
boolean result = false;
if (lowerExprType == Type.undefinedType || upperExprType == Type.undefinedType){
return false;
}else{
result = (lowerExprType == upperExprType);
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
输入类
abstract public class Type {
public Type( String name ) {
this.name = name;
}
public static Type booleanType = new BooleanType();
public static Type integerType = new IntegerType();
public static Type charType = new CharType();
public static Type undefinedType = new UndefinedType(); …Run Code Online (Sandbox Code Playgroud) 我试图让我的应用程序保持活动状态,以便侦听来自我的queue. 但是,一旦我的应用程序收到SIGTERM,我想确保我的应用程序很好地关闭。这意味着,在关闭之前,确保内部的作业首先完成。
阅读后,我想出了这个:
@Component
public class ParserListenerStarter {
public static void main(final String[] args) throws InterruptedException {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(ParserReceiveJmsContext.class);
context.registerShutdownHook();
System.out.println("Listening...");
Runtime.getRuntime().addShutdownHook( //
new Thread() {
@Override
public void run() {
System.out.println("Closing parser listener gracefully!");
context.close();
}
});
while (true) {
Thread.sleep(1000);
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后我向kill我的应用程序发送一个命令;这是我的输出:
Listening...
// output from my other beans here
Closing parser listener gracefully!
Process finished with exit code 143 (interrupted by signal …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个浮点值列表,但它似乎不是这样:编辑:
public Supervisory() {
this.analogs = new ArrayList<Float>();
}
public void active() {
try {
for (ObjectIdentifier oi : ois) {
if (oi.getObjectType().intValue() == 2){
analogs.add(new Float(10));
}
}
} catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage());
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
我的最后一个代码只是一个片段来提出我的问题的想法.
这个实现有什么问题?