Test
|
Sep
18
2011
Java Tips: How to restart a Java Program /JVMPosted by Administrator in misc, tags: java/eclipseDamit ihr nicht durch die selbe Konfigurationshölle bei der USB-Verbindung zwischen Samsung Galaxy S I9000 und PC geht, hier ein kleines Tutorial. Das braucht man sowohl für den Massenspeicher als auch für USB debugging ohne dabei das ganze Software Bundle namens Samsung KIES zu installieren USB Treiber für Massenspeicher und USB Debugging 2.) KIESxxx.exe in KIESxxx.zip umbenennen und mit Zip Programm öffnen und in Kies_1.5.1.10074_2_6\CabFile\USB Driver\SAMSUNG_USB_Driver_for_Mobile_Phones.exe.cab die Exe File extrahieren Ressource hf jd Show /Hide hidden characters Type > show hidden charcters JFreeChart is a very handy charting API for Java. Here are some hints on how to use it correctly. ScatterPlot Fast version verus XYPlot The fast scatter plot is easily created but cannot change the data item shape size and color, it is always 1×1 pixel. The data format is a 2d float array
package temp;
import java.awt.RenderingHints;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.FastScatterPlot;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
public class ScatterPlotFast extends ApplicationFrame {
private float[][] data;
public ScatterPlotFast(final String title) {
super(title);
}
public void setData(float scatterData[][]) {
this.data = scatterData;
}
public void renderAndDisplay() {
final NumberAxis domainAxis = new NumberAxis("X");
domainAxis.setAutoRangeIncludesZero(false);
final NumberAxis rangeAxis = new NumberAxis("Y");
rangeAxis.setAutoRangeIncludesZero(false);
final FastScatterPlot plot = new FastScatterPlot(data, domainAxis, rangeAxis);
final JFreeChart chart = new JFreeChart("Fast Scatter Plot", plot);
// force aliasing of the rendered content..
chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderChartInPanel(chart);
}
private void renderChartInPanel(final JFreeChart chart) {
final ChartPanel panel = new ChartPanel(chart, true);
panel.setPreferredSize(new java.awt.Dimension(500, 270));
// panel.setHorizontalZoom(true);
// panel.setVerticalZoom(true);
panel.setMinimumDrawHeight(10);
panel.setMaximumDrawHeight(2000);
panel.setMinimumDrawWidth(20);
panel.setMaximumDrawWidth(2000);
setContentPane(panel);
pack();
RefineryUtilities.centerFrameOnScreen(this);
setVisible(true);
}
}
The slow version is a XYPlot and uses XYSeries to collect data tuplets.
package temp;
import java.awt.Color;
import java.awt.RenderingHints;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
public class ScatterPlotSlow extends ApplicationFrame {
private static final long serialVersionUID = -5045238125844119782L;
XYSeries data;
public ScatterPlotSlow(String title) {
super(title);
}
public void setData(float scatterData[][]) {
data = new XYSeries("Midi Note Values");
int size = 0;
if (scatterData.length > 0) {
size = scatterData[0].length;
for (int i = 0; i < size; i++) {
final double x = scatterData[0][i];
final double y = scatterData[1][i];
data.add(x, y);
}
}
}
public void renderAndDisplay() {
final XYDataset dataSet = new XYSeriesCollection(data);
final JFreeChart chart = ChartFactory.createScatterPlot("Slow Scatter Plot", "X", "Y",
dataSet, PlotOrientation.VERTICAL, true, false, false);
final XYPlot plot = chart.getXYPlot();
//dot renderer cannot be set because it has only 1 pixel dot size
// plot.setRenderer(new XYDotRenderer());
plot.setBackgroundPaint(Color.WHITE);
XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) plot.getRenderer();
xylineandshaperenderer.setSeriesShape(0, new java.awt.Rectangle(-2, -2, 2, 2));
xylineandshaperenderer.setSeriesPaint(0, Color.BLUE);
// force aliasing of the rendered content..
chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderChartInPanel(chart);
}
private void renderChartInPanel(final JFreeChart chart) {
final ChartPanel panel = new ChartPanel(chart, true);
panel.setPreferredSize(new java.awt.Dimension(500, 270));
// panel.setHorizontalZoom(true);
// panel.setVerticalZoom(true);
panel.setMinimumDrawHeight(10);
panel.setMaximumDrawHeight(2000);
panel.setMinimumDrawWidth(20);
panel.setMaximumDrawWidth(2000);
setContentPane(panel);
pack();
RefineryUtilities.centerFrameOnScreen(this);
setVisible(true);
}
}
EclipseAuto Format Define a Formatter File once according to your preferred settings and use it to auto format in Eclipse after save. Enable the following settings for each project desired.
10 things to know about web development nowadays http://robcubbon.com/10-things-i-wish-i-had-known-about-web-designing-10-years-ago
One of my favorite musician in a free concert web stream – John Butler Trio @ ARTE http://liveweb.arte.tv/fr/video/John_Butler_Trio_au_Printemps_de_Bourges/
Interfacing with the control gateway Device CKOZ 00/03 we got an API from Moeller to communicate to their wireless dimmer actuators. The device offers a RS232/RJ11 connector or per default a USB one. The USB connection however does not work on a COM Port but offers only standard USB HID connection. We needed a library to open up a connection to this USB Devices and talk to it. We used the Sourceforge LibUSBDotNet library for this ( http://libusbdotnet.sourceforge.net/ ) in an older version as described later in the belower forum entry. Problems arise not while connecting to a device but while finding and communicating with the right device endpoints. Here is a tutorial on how to do that: - Read on FROM http://community.sharpdevelop.net/forums/p/7995/22800.aspx#22800 and take experimental source code from ttp://sourceforge.net/projects/xcom-hp When it all stopped working Right the day after, the solution with the LibUSBDotNet Lib was not working anymore without a single code change tested on three Win XP PCs. The crucial line [code lang="java"]device.SetConfiguration(1)[code] freezes the PC and requires a reboot to even close the application and reaccess the Moeller gateway once again. However the SimpleHID Write test application still could communicate to the Moller gateway. So set a broken device apart, we needed a new solution. We found the very handy Jan Axelson Lakeview Research - http://www.lvr.com/usb.htm that offers a bunch of resources to the USB topic. With generic_hid_cs and usbhidio_V2.3.cs it offers free c# src for accessing generic USB devices. Both seem quite similar and are working with the obove Vendor and ProductID for our purpose. Finally this resolved the USB communication odyssey
How to count words in Acrobat One can use Acrobat JavaScript. Once you have opened the JavaScript debugging console, enter the following script: var cnt=0; Highlight the entire script, hold down the “Ctrl” key and press the keypad’s enter key and wait.
|


Entries (RSS)