Rotating the viewing platform in Java3d

The following code puts a cube at (0, 0, 0) and another at (0, .5, .5) and each cube is (.5, .5, .5) in dimension. I'm trying to rotate the view that the screen gets to one like this but instead I get this view . Also, I realize I got the colors backwards. Anyway, this is my code so far: import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.universe.*; import javax.media.j3d.

在Java3d中旋转观察平台

以下代码将立方体放在(0,0,0)和另一个放置在(0,.5,.5),并且每个立方体的维度都是(.5,.5,.5)。 我试图旋转屏幕到达这样的视图 但是我得到了这个观点 。 另外,我意识到我已经把颜色倒退了。 无论如何,这是我的代码到目前为止: import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.universe.*; import javax.media.j3d.*; import javax.vecmath.*; public class Positioning { private Colo

JMagick Error when trying to load a file

java.lang.UnsatisfiedLinkError: no JMagick in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1045) when trying to use the code ImageInfo info; try { info = new ImageInfo(); //image = new MagickImage(info); } catch (MagickException e) { logge

试图加载文件时出现JMagick错误

java.lang.UnsatisfiedLinkError:java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754)java.lang.Runtime.loadLibrary0(Runtime.java:823)java.lang.System中的java.library.path中的JMagick .loadLibrary(System.java:1045) 当试图使用代码时 ImageInfo info; try { info = new ImageInfo(); //image = new MagickImage(info); } catch (MagickException e) { logger.error(Insight

Best XML parser for Java

I need to read smallish (few MB at the most, UTF-8 encoded) XML files, rummage around looking at various elements and attributes, perhaps modify a few and write the XML back out again to disk (preferably with nice, indented formatting). What would be the best XML parser for my needs? There are lots to choose from. Some I'm aware of are: JDOM Woodstox XOM dom4j VTD-XML Xerces-J

Java的最佳XML解析器

我需要阅读小文件(最多几MB,UTF-8编码的)XML文件,翻看各种元素和属性,或许修改一些,然后再将XML写回到磁盘(最好使用漂亮的缩进格式) 。 根据我的需求,最适合的XML解析器是什么? 有很多可供选择的。 我知道的一些是: JDOM Woodstox XOM DOM4J VTD-XML 的Xerces-J 赤红 当然也是JDK中的一个(我正在使用Java 6)。 我熟悉Xerces,但发现它笨重。 建议? 如果速度和内存没有问题,dom4j是一个

What Java XML library do you recommend (to replace dom4j)?

I'm looking for something like dom4j, but without dom4j's warts, such as bad or missing documentation and seemingly stalled development status. Background: I've been using and advocating dom4j, but don't feel completely right about it because I know the library is far from optimal (example: see how methods in XSLT related Stylesheet class are documented; what would you pass to r

你推荐什么Java XML库(替换dom4j)?

我正在寻找类似dom4j的东西,但没有dom4j的瑕疵,比如文档不好或缺失以及看似停滞的开发状态。 背景:我一直在使用和倡导dom4j,但并不完全正确,因为我知道库很不理想(例如:请参阅XSLT相关Stylesheet类中的方法是如何记录的;您将传递什么来运行( )作为String mode参数?) 要求:该库应该比使用纯JDK( javax.xml和org.w3c.dom包)时更容易进行基本的XML处理。 像这样的事情: 将XML文档(从文件或字符串)读取到对

printing output from javax.xml.transform.Transformer with only standard java api (Indentation and Doctype positioning)

Using the following simple code: package test; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class TestOutputKeys { public static void main(String[] args) throws TransformerException { // Instantiate transformer input Source xmlInput = new StreamSource(new StringReader( "<!-- Document comment --><aaa>

仅使用标准java api从javax.xml.transform.Transformer打印输出(缩进和Doctype定位)

使用以下简单的代码: package test; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class TestOutputKeys { public static void main(String[] args) throws TransformerException { // Instantiate transformer input Source xmlInput = new StreamSource(new StringReader( "<!-- Document comment --><aaa><bbb/>

How to connect to JMX agent using python

I am working on custom monitoring system to my server. the application is developed using python and Django. The server is running java web applications and I need to monitor the JVM under which the application server is running, so I start the applications with enable the JMX. Now I need to connect my python application to the JVM JMX agent. Is there any way to get that? I have read ab

如何使用python连接到JMX代理

我正在自定义监视系统到我的服务器。 该应用程序是使用python和Django开发的。 服务器正在运行java web应用程序,我需要监视运行应用程序服务器的JVM,因此我启动了启用JMX的应用程序。 现在我需要将我的python应用程序连接到JVM JMX代理。 有什么办法可以得到吗? 我已阅读了关于HtmlAdapterServer的说明,它可以从特定的URL中管理JMX MBean,但我不知道该如何使用它? 在此先感谢和最好的问候 如何使用Jython?

Get parameters from velocity template

I have such problem. I'm writing integration tests for my app. In the app I send some mails for the users. When I create email I use Velocity templates. Example of template: Hi ${user}! Example of mail: Hi User! When I write my integration tests I want to parse parameters from received emails. If I have velocity template and mail which was created with using of this template. I

从速度模板获取参数

我有这样的问题。 我正在为我的应用程序编写集成测试。 在应用程序中,我为用户发送了一些邮件。 当我创建电子邮件时,我使用Velocity模板。 模板示例: Hi $ {user}! 邮件示例: 嗨用户! 当我编写集成测试时,我想解析收到的电子邮件中的参数。 如果我有使用此模板创建的速度模板和邮件。 我想要这样的方法 Map<String,String> getParameters(velocityTemplate, mailBody); 我如何从电子邮件文本解析参

Calling Macro function in Velocity template

I am trying to figure out how to return a value from a velocity macro call and assign it to a varaible my macro function looks something like this. its once in common shared macros files #macro(getBookListLink, $readingTrackerResult) $readingTrackerResult.getBookListLink() #end I am need to assign the result of this macro to a variable in another velocity template file I tried something

在速度模板中调用宏函数

我试图找出如何从速度宏调用中返回一个值并将其分配给变量 我的宏功能看起来像这样。 它曾经在共同的共享宏文件中 #macro(getBookListLink, $readingTrackerResult) $readingTrackerResult.getBookListLink() #end 我需要将此宏的结果分配给另一个速度模板文件中的变量 我尝试过这样的事情 #set($book_list_link = #getBookListLink( $readingTrackerResult )) 但没有工作。 我试着用#,$和在函数getBookListLink

Java Pass Method as Parameter

I am looking for a way to pass a method by reference. I understand that Java does not pass methods as parameters, however, I would like to get an alternative. I've been told interfaces are the alternative to passing methods as parameters but I don't understand how an interface can act as a method by reference. If I understand correctly an interface is simply an abstract set of methods

Java Pass方法作为参数

我正在寻找一种通过引用来传递方法的方法。 我明白,Java不会将方法作为参数传递,但是,我想获得替代方法。 我被告知接口是传递方法作为参数的替代方法,但我不明白接口如何作为引用的方法。 如果我理解正确,接口只是一组未定义的抽象方法。 我不想发送每次都需要定义的接口,因为几种不同的方法可以用相同的参数调用相同的方法。 我想要做的是类似于这样的事情: public void setAllComponents(Component[] myComponen

Usage of OpenMapStreet API/GoogleMap API in Java /Swing Application

I need to solve a simple problem regarding Showing Map on Swing based application in java. I am having list of latitudes and longitudes (GPS Tracks) , I need to draw some routes using these routes and probably want to draw maps like GoogleMaps. Is it possible to draw Google Maps using GPS info (latitude, longitude) via OpenMapStreet API. Based on different user selection over JFrame control (

在Java / Swing应用程序中使用OpenMapStreet API / GoogleMap API

我需要解决一个关于在Java中基于Swing的应用程序显示地图的简单问题。 我有经纬度列表(GPS轨道),我需要使用这些路线绘制一些路线,并且可能想绘制GoogleMaps之类的地图。 是否可以通过OpenMapStreet API使用GPS信息(纬度,经度)来绘制Google地图。 基于JFrame控件上的不同用户选择(例如包含路径信息的行),应绘制一个特定区域(面板)的地图(可能是Google Map)。 我读了OpenMapStreet API。 但是我没有找到一个