如何在Java中发送大于127的字节daha?(How can i send a byte daha which is greater than 127 in Java?)
我正在开发一个使用Java的RFID阅读器应用程序。 RFID阅读器的消息类型必须以0xA0开始。 这是强制性的。 它以十进制形式表示为160。 但是在java中,字节值不能大于127。
我该如何解决这个问题?
I am developing an RFID reader application using Java. The RFID reader's message type has to start with 0xA0. It is obligatory. It is represented as 160 in decimal form. But in java byte values can not be greater than 127.
How do I solve this?
原文:https://stackoverflow.com/questions/31907824
最满意答案
vagrant-omnibus插件允许您提供任何脚本来安装厨师。 因此,如果您将chef install放入Vagrantfile所在的文件夹中,您可以指向一个如下所示的安装脚本:
#!/usr/bin/env bash dpkg --install /vagrant/chef_11.14.6-1_amd64.deb
将它放在与Vagrantfile相同的文件夹中。 然后在你的Vagranfile中:
config.omnibus.chef_version = '11.14.6' config.omnibus.install_url = './chefinstall.sh'
这应该工作。 它足够聪明,它将检查盒子上安装的Chef版本,并且仅在缺少该脚本时运行脚本。
您还可以使用vagrant cachier插件,因此无需每次都下载,最新版本的omnibus插件挂钩到缓存中:
config.omnibus.cache_packages = true
因此,如果您的主要问题是必须重复下载,请查看vagrant-cachier
The vagrant-omnibus plugin allows you to give any script to install chef. So if you put the chef install into the folder where the Vagrantfile is, you could point to an install script that looks like:
#!/usr/bin/env bash dpkg --install /vagrant/chef_11.14.6-1_amd64.deb
Put it in the same folder as your Vagrantfile. Then in your Vagranfile:
config.omnibus.chef_version = '11.14.6' config.omnibus.install_url = './chefinstall.sh'
That should work. It's clever enough that it'll check what version of Chef is installed on the box, and only run the script if that's missing.
You could also use the vagrant cachier plugin, so it won't have to download everytime, the newest version of the omnibus plugin hooks into the cache:
config.omnibus.cache_packages = true
So if your main concern is having to download repeatably, check out vagrant-cachier
相关问答
更多-
答案是: Vagrant使用ssh作为'vagrant'用户登录guest框。 这会添加sshd_config安全路径。 在CentOS 6.4中,它是: /sbin:/bin:/usr/sbin:/usr/bin 然后它使用sudo成为'root'用户。 该配置文件来源于CentOS 6.4,这意味着sbin路径是前置的,而$HOME/bin是附加的。 然后执行chef-solo运行和道路健全。 路径健全性最后附加所有路径(如果不是现有$PATH ),从ruby_bindir和gem_bindir (引用 ...
-
与Berkshelf一起提供的流浪厨师无视环境版本(Vagrant chef provision with Berkshelf ignores environment versions)[2022-03-24]
Chef Zero中的版本约束求解器有意非常简单,并不像真正的Chef Server那样功能齐全。 环境级约束通常用于生产和覆盖等,而给定烹饪书实际需要的功能属于相关的metadata.rb文件。 您可能还需要查看berks apply命令以在另一个方向上运行同步。 The version constraint solver in Chef Zero is intentionally very simplistic and not as full-featured as the real Chef Serv ... -
厨师配置Vagrant(Chef provisioning with Vagrant)[2022-03-15]
Chef Provisioning不再是您应该开始新工作的项目,详情请参阅https://coderanger.net/provisioning/ 。 正如评论中所提到的,Test Kitchen是用于通过Vagrant本地设置开发和测试VM或使用各种云插件之一的正确工具。 Chef Provisioning is no longer a project you should probably start new work based on, see https://coderanger.net/provi ... -
我很确定这与盒子上安装的厨师版有关: ==> mybox: [2015-03-04T11:08:09+00:00] INFO: *** Chef 10.14.2 *** 我不能确定,但我打赌你在使用ssh时尝试使用不同的厨师版本。 无论如何10.14.2已经很老了,你会发现最近的食谱错误。 IIRC有一个流浪汉插件安装/ upadte厨师(vagrant-omnibus?) I'm pretty sure this has to do with the chef version installed on ...
-
流浪汉+厨师+主机名(Vagrant + Chef + Hostname)[2023-12-11]
如文档中所定义,您应该在节点级别设置属性,而不是在节点['hostname']中。 在你的情况下,它将是 chef.json = { set_fqdn: 'Olympus' } 您可以在主机名文档中找到更多信息 As defined in the documentation you should set the attribute at the node level, not in node['hostname']. In your case it will be chef.json = { se ... -
据我可以在那里阅读,你使用的ruby 1.9.1和错误消息是,你至少需要ruby 2.0的插件。 尝试更新ruby到更新的版本。 也可以尝试使用像rbenv这样的工具来管理多个ruby版本,以防将来的项目需要ruby 1.9.1 。 As far as I can read there, you are using ruby 1.9.1 and the error message is that you need at least ruby 2.0 for that plugin. Try updating ...
-
是的 - 这个过程记录在这个要点中 ,但总之: 在您的.kitchen.yml使用ERB: <% require 'socket' def local_ip @local_ip ||= begin # turn off reverse DNS resolution temporarily orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true UDPSocket.open do |s| ...
-
我能够做到这一点,下面是我的结果和结论。 正如我上面提到的,我的问题是我无法清除data_bag,因为我无法将vagrant创建的新密钥添加到pilot_key.json文件,因为我没有连接到厨师服务器并且无法运行刀库更新/更新。 我所要做的就是从已经可以访问pilot.json data_bag的服务器获取client.pem密钥。 我使用了我们的效用服务器密钥,因为它不会在不久的将来被销毁。 所以在我的本地PC上我的主目录下有一个.chef /目录,我从实用程序服务器复制了client.pem密钥,并将 ...
-
vagrant-omnibus插件允许您提供任何脚本来安装厨师。 因此,如果您将chef install放入Vagrantfile所在的文件夹中,您可以指向一个如下所示的安装脚本: #!/usr/bin/env bash dpkg --install /vagrant/chef_11.14.6-1_amd64.deb 将它放在与Vagrantfile相同的文件夹中。 然后在你的Vagranfile中: config.omnibus.chef_version = '11.14.6' config.omnib ...
-
代理背后的流浪汉综合(vagrant omnibus behind proxy)[2022-11-18]
事情1 ::最新不会在没有抓住工件时出错。 切换到命名版本开始无法找到导致我相信它没有通过代理的工件。 事2:我认为这是windows中的omnibus问题。 我发现这种拉力可能会解决它吗? https://github.com/schisamo/vagrant-omnibus/pull/89 。 我认为这个插件没有使用poxy-conf设置的设置。 目前使用此工作方式:在Windows cmd行中设置http代理 SET HTTP_PROXY=http://username:password@proxy: ...