小编Cob*_*les的帖子

打开场景构建器出错

我正在使用Javafx Eclipse创建一个程序,当我使用Scene Builder打开程序时出现错误

这是错误:

Opening the file with SceneBuilder failed. 
Try setting the absolute path to scenebuilder in your preferences
Run Code Online (Sandbox Code Playgroud)

java eclipse javafx

22
推荐指数
4
解决办法
6万
查看次数

Android Studio - 增加撤消量

我想知道是否有办法增加在Android Studio中使用撤消按钮的次数.我在设置中找不到它.在几次撤消后,它停止允许更多的.

android-studio

11
推荐指数
2
解决办法
3374
查看次数

libGDX And​​roid使用netbeans - 任务菜单对于屏幕来说太大了

libGDX netbeans运行指南中它说要在android上运行,去吧Tasks -> installDebug.但是在netbeans中,任务菜单太长了,installDebug没有显示,也无法向下滚动列表.其他人肯定有这个问题,但谷歌没有给我带来任何结果.所以我的问题是,我如何安装调试,我是否必须创建自定义任务?谢谢

在此输入图像描述

java swing netbeans

7
推荐指数
2
解决办法
492
查看次数

找到最接近一个数字的因子,一个数字

我正在尝试自动查找一个数字与另一个数字的最接近因子;

例子:

700 到 30 的最近因数是 28(30 不能进入 700,但 28 可以)。

一个明显的解决方案是获取 700 的所有因子并进行简单的距离计算以找到最接近 30 的因子,但这似乎效率低下。

另一种解决方案是找到所有的基本质因数,例如:

private List<Integer> getPrimeFactors(int upTo) {
    List<Integer> result = new ArrayList<>();
    for (int i = 2; i <= upTo; i++) {
        if (upTo % i == 0) {
            result.add(i);
        }
    }
    return result;
}
Run Code Online (Sandbox Code Playgroud)

并将这些数字中的每一个相乘以获得所有组合,从而找到最接近的。

我正在尝试对其进行编程,使其自动化。有什么更好的解决方案吗?

java algorithm math

5
推荐指数
1
解决办法
3455
查看次数

Tensorflow 可以计算积分近似的梯度吗?

我正在尝试使用 Hamiltonian Monte Carlo(HMC,来自 Tensorflow Probability),但我的目标分布包含一个难以处理的一维积分,我用梯形规则近似。我对 HMC 的理解是它计算目标分布的梯度以构建更有效的过渡内核。我的问题是 Tensorflow 能否根据函数的参数计算出梯度,它们是否有意义?

例如,这是目标分布的对数概率,其中“A”是模型参数:

# integrate e^At * f[t] with respect to t between 0 and t, for all t

t = tf.linspace(0., 10., 100)
f = tf.ones(100)
delta = t[1]-t[0]
sum_term = tfm.multiply(tfm.exp(A*t), f)
integrals = 0.5*delta*tfm.cumsum(sum_term[:-1] + sum_term[1:], axis=0) 
pred = integrals
sq_diff = tfm.square(observed_data - pred)
sq_diff = tf.reduce_sum(sq_diff, axis=0)
log_lik = -0.5*tfm.log(2*PI*variance) - 0.5*sq_diff/variance
return log_lik
Run Code Online (Sandbox Code Playgroud)

这个函数的梯度在 A 方面有意义吗?

python montecarlo tensorflow

5
推荐指数
1
解决办法
229
查看次数

fetchUuidsWithSdp 中奇怪的 UUID 反转

我有一个在树莓派上运行的 python 蓝牙服务器(使用 PyBluez)。我在服务器中使用的 uuid 是:

8f86d132-4ab8-4c15-b8df-0b70cf10ea56

device.fetchUuidsWithSdp()在我的 Android 应用程序中调用蓝牙服务器。当它最终获取 uuid 时,它们以两个为一组反转(似乎字节序已更改)。

在广播接收器中:

Parcelable[] uuids = intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);
if (uuids != null) {
    if (uuids.length > 0) {
         for (Parcelable uuid : uuids) {
              Utilities.err(uuid.toString());
         }
    } else {
         Utilities.err("no uuids");
    }
} 
Run Code Online (Sandbox Code Playgroud)

例如:

8f86d132-4ab8-4c15-b8df-0b70cf10ea56 -> 56ea10cf-700b-dfb8-154c-b84a32d1868f

看前两个字符8f,它们是反向uuid的最后两个字符。

看后两个字符86,它们是反向uuid的倒数第二个字符

这是什么原因造成的?

这与 UUID 是小端还是大端有什么关系吗?

python uuid android bluetooth endianness

4
推荐指数
1
解决办法
1083
查看次数

JavaFx TableView错误

我是JavaFX的新手.我正在使用TableView并尝试将用户输入的数据从用户名和密码字段放入表中.它只是一个测试程序.我收到以下错误.

SEVERE: javafx.scene.control.Control loadSkinClass Failed to load skin 'StringProperty [bean: TableRow[id=null, styleClass=cell indexed-cell table-row-cell], name: skinClassName, value: com.sun.javafx.scene.control.skin.TableRowSkin]' for control TableRow[id=null, styleClass=cell indexed-cell table-row-cell]
java.lang.ClassCastException: javafx.scene.control.TableColumn cannot be cast to javafx.scene.control.TableColumn$CellDataFeatures
    at javafx.scene.control.cell.PropertyValueFactory.call(PropertyValueFactory.java:93)
    at com.sun.javafx.scene.control.skin.TableRowSkin.recreateCells(TableRowSkin.java:224)
    at com.sun.javafx.scene.control.skin.TableRowSkin.<init>(TableRowSkin.java:87)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at javafx.scene.control.Control.loadSkinClass(Control.java:992)
    at javafx.scene.control.Control.access$500(Control.java:71)
    at javafx.scene.control.Control$12.invalidated(Control.java:920)
    at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:127)
    at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:161)
    at com.sun.javafx.css.StyleableStringProperty.set(StyleableStringProperty.java:71)
    at javafx.scene.control.Control$12.set(Control.java:912)
    at com.sun.javafx.css.StyleableStringProperty.applyStyle(StyleableStringProperty.java:59)
    at com.sun.javafx.css.StyleableStringProperty.applyStyle(StyleableStringProperty.java:31)
    at com.sun.javafx.css.StyleableProperty.set(StyleableProperty.java:70)
    at com.sun.javafx.css.StyleHelper.transitionToState(StyleHelper.java:902)
    at javafx.scene.Node.impl_processCSS(Node.java:7415)
    at javafx.scene.Parent.impl_processCSS(Parent.java:1146)
    at javafx.scene.control.Control.impl_processCSS(Control.java:1102)
    at com.sun.javafx.scene.control.skin.VirtualFlow.setCellIndex(VirtualFlow.java:1598)
    at com.sun.javafx.scene.control.skin.VirtualFlow.getCell(VirtualFlow.java:1500)
    at com.sun.javafx.scene.control.skin.VirtualFlow.getCellLength(VirtualFlow.java:1523) …
Run Code Online (Sandbox Code Playgroud)

javafx tableview

2
推荐指数
1
解决办法
3921
查看次数

如何在netebeans中的java fxml应用程序中删除编译时的警告

我有一个使用fxml和JavaFX Scene Builder 1.1的JavaFX应用程序.当我在Netbeans中编译项目时,它会为项目中包含的每个jar文件发出警告,这使得编译需要更多时间.例如:

Warning: 
The signer certificate will expire within six months.
Enter Passphrase for keystore: Enter key password for nb-jfx: 
Signing JAR: E:\Project\Client\Development\Mednet\dist\lib\activation.jar to E:\Project\Client\Development\Mednet\dist\lib\activation.jar as nb-jfx

Warning: 
The signer certificate will expire within six months.
Enter Passphrase for keystore: Enter key password for nb-jfx: 
Signing JAR: E:\Project\Client\Development\Mednet\dist\lib\antlr-2.7.7.jar to E:\Project\Client\Development\Mednet\dist\lib\antlr-2.7.7.jar as nb-jfx

Warning: 
The signer certificate will expire within six months.
Enter Passphrase for keystore: Enter key password for nb-jfx: 
Signing JAR: E:\Project\Client\Development\Mednet\dist\lib\asm-3.1.jar to E:\Project\Client\Development\Mednet\dist\lib\asm-3.1.jar as nb-jfx

Warning: …
Run Code Online (Sandbox Code Playgroud)

java javafx javafx-2 fxml javafx-8

1
推荐指数
1
解决办法
1511
查看次数