I installed the 32 bit version of Mingw 4.7.2 (using the installer) on my Windows 7 64 bit. I use MinGW in an Eclipse C++ project in order to build a .dll file. So far everything works.
However I use this .dll to be included in a java project via JNI. And when I call a function of the .dll in the java project the exception "Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\path\mylib.dll: Can't load IA 32-bit .dll on a AMD …
我想比较一个变量与另一个变量减去linux shell脚本中的常量.
在cpp中,这将是这样的:
int index = x;
int max_num = y;
if (index < max_num - 1) {
// do whatever
} else {
// do something else
}
Run Code Online (Sandbox Code Playgroud)
在shell中我尝试了以下内容:
index=0
max_num=2
if [ $index -lt ($max_num - 1) ]; then
sleep 20
else
echo "NO SLEEP REQUIRED"
fi
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
if [ $index -lt ($max_num-1) ]; then
...
if [ $index -lt $max_num - 1 ]; then
...
if [ $index -lt $max_num-1 ]; then
...
Run Code Online (Sandbox Code Playgroud)
但这些版本不起作用.你怎么正确地写这样的条件?
问候
我有一个JFrame,它包含JScrollPane.JScrollPane本身包含一个派生自JPanel的类.我使用JPanel类在其上绘制Image和一些其他基元.遗憾的是,即使JPanel扩展到JSrollPane大小,也不会出现JScrollPane的滚动条.
我创建了一些运行的测试代码:
这是主要类:
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
class ScrolledPane extends JFrame{
private JScrollPane scrollPane;
public ScrolledPane()
{
setTitle( "Scrolling Pane Application" );
setSize( 300, 200 );
setBackground( Color.gray );
TestPanel testPanel = new TestPanel();
testPanel.setLayout( new BorderLayout() );
scrollPane = new JScrollPane(testPanel);
this.getContentPane().add(scrollPane, BorderLayout.CENTER);
}
public static void main( String args[] )
{
// Create an instance of the test application
ScrolledPane mainFrame = new ScrolledPane();
mainFrame.setVisible( true );
}
}
Run Code Online (Sandbox Code Playgroud)
这是从JPanel派生的类的代码:
import java.awt.BorderLayout;
import java.awt.Color; …Run Code Online (Sandbox Code Playgroud) 我有一个.sh(start_sim.sh)和一个.bash(sim_sources.bash)文件.该sim_sources.bash文件是从内部调用的start_sim.sh,应该将环境变量$ROBOT设置为某个值.但是,ROBOT当我打电话时变量永远不会改变./start_sim.sh.我尝试这样做的方式是否存在根本性错误?
start_sim.sh 包含:
#!/bin/bash
echo -n "sourcing sim_sources.bash..."
source /home/.../sim_sources.bash
echo "done."
Run Code Online (Sandbox Code Playgroud)
sim_sources.bash 包含:
# set the robot id
export ROBOT=robot
Run Code Online (Sandbox Code Playgroud)
编辑:你能提出解决这个问题的方法吗?我仍然需要在.bash文件中设置变量.
EDIT2:谢谢你的回复!最后,我最终用屏幕和填充命令来解决它:
echo -n "starting screen..."
screen -dmS "sim_screen"
sleep 2
screen -S "sim_screen" -p 0 -X stuff "source /home/.../sim_sources.bash$(printf \\r)"
sleep 5
screen -S "sim_screen" -p 0 -X stuff "source /home/.../start_sim.sh$(printf \\r)"
Run Code Online (Sandbox Code Playgroud) 我有两个3D点(但z坐标始终为零)并且想要计算从这些点创建的方向向量的偏航.我已经找到了这篇文章,并尝试了以下代码:
double p1_x, p1_y, p2_x, p2_y;
//initialize vars...
double dx = p2_x - p1_x;
double dy = p2_y - p1_y;
double yaw = atan(dx/-dy);
Run Code Online (Sandbox Code Playgroud)
但是,如果我测试这种方法,我似乎会得到奇怪的结果.此外,这种方法似乎并不考虑dy为零的情况.我的问题是我不完全了解基础数学,所以我无法适应代码.
我的问题是:这种方法如何适应以恢复适当的偏航?为什么它不是在ints curent状态下工作?
谢谢你的帮助和问候,scr