首页 \ 问答 \ 如何在Java中发送大于127的字节daha?(How can i send a byte daha which is greater than 127 in Java?)

如何在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
更新时间:2023-03-31 11:03

最满意答案

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 (引用 ...
  • 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 ...
  • 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 ...
  • 如文档中所定义,您应该在节点级别设置属性,而不是在节点['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 ...
  • 事情1 ::最新不会在没有抓住工件时出错。 切换到命名版本开始无法找到导致我相信它没有通过代理的工件。 事2:我认为这是windows中的omnibus问题。 我发现这种拉力可能会解决它吗? https://github.com/schisamo/vagrant-omnibus/pull/89 。 我认为这个插件没有使用poxy-conf设置的设置。 目前使用此工作方式:在Windows cmd行中设置http代理 SET HTTP_PROXY=http://username:password@proxy: ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)