我正在寻找一个独立于平台的每台计算机独有的值.这用于将计算机注册到帐户,因此您无法从未注册的计算机登录.我不想使用MAC地址,因为这很容易改变.我想知道可能从几个硬件组件中获取ID并将它们组合起来以获得该机器的唯一ID.但是,我不确定如何使用Java从所述组件获取ID.我做了一些研究,发现了一种检索CPU序列号的方法,但这只适用于windows,因为它只是运行一个临时的可视化基本命令/脚本/等等.任何信息都表示赞赏,谢谢.
是否可以在CSS中设置不可编辑文本字段的外观?我希望不可编辑的文本字段看起来像标签。我找不到对此(或类似问题)问题的任何答案,我尝试了以下方法:
.text-input:editable {
-fx-background-color: transparent;
}
Run Code Online (Sandbox Code Playgroud)
但这显然没有用。
服务器代码:
public static void main(String[] args) {
try {
ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
bootstrap.setPipelineFactory(new PipelineFactory());
bootstrap.bind(new InetSocketAddress("localhost", port));
System.out.println("Listening on " + port);
} catch(Exception exception) {
exception.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
管道:
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.DefaultChannelPipeline;
import org.jboss.netty.handler.codec.serialization.ClassResolvers;
import org.jboss.netty.handler.codec.serialization.ObjectDecoder;
public class PipelineFactory implements ChannelPipelineFactory {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = new DefaultChannelPipeline();
try {
pipeline.addLast("decoder", new ObjectDecoder(ClassResolvers.cacheDisabled(getClass().getClassLoader())));
pipeline.addLast("messagehandler", new MessageHandler());
} catch(Exception exception) {
exception.printStackTrace();
}
return pipeline;
}
} …Run Code Online (Sandbox Code Playgroud)