Test

Comments No Comments »

See here

http://stackoverflow.com/questions/4159802/how-can-i-restart-a-java-application

Comments No Comments »

Damit 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
—————————————–
1.) Unter [1] die KIES software herunterladen
[1] http://www.samsung.com/at/support/detail/supportPrdDetail.do?menu=SP00&prd_mdl_cd=BGT-I9000&prd_mdl_name=GT-I9000&prd_ia_sub_class_cd=P

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
3.) Diese Treiber .exe installieren
4.) Am Phone unter Einstellung -> Telefoninfo/Einstellung -> USB auf “KIES” oder “Massenspeicher” verwenden.
5.) Für Debugging unter Einstellungen -> Anwendungen -> Entwicklung >USB Debugging einschalten (achtung, diese Einstellung deaktiviert den Massenspeicher)

Ressource
http://www.pcwelt.de/start/mobility_handy_pda/pda_smartphone/praxis/2347606/samsung-galaxy-s-als-usb-speicher-ohne-kies-nutzen/
http://www.android-hilfe.de/root-hacking-modding-fuer-samsung-galaxy/6246-how-galaxy-adb-treiber-unter-vista-win7-32-64bit.html
http://adrianvintu.com/blogengine/post/How-to-Debug-on-the-Samsung-Galaxy-I7500-Android-Phone.aspx

hf jd

Comments No Comments »

Show /Hide hidden characters

Type > show hidden charcters

Comments No Comments »

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);
}
}

Comments No Comments »

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.

Comments Comments Off

10 things to know about web development nowadays

http://robcubbon.com/10-things-i-wish-i-had-known-about-web-designing-10-years-ago

Comments Comments Off

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/

Comments Comments Off

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
- Modify VID hex = 188A and PID Hex 1101 in Class USBPort
- Modify READ AND WRITE ENDPOINT in Class USBPort ,
since we get the Moeller endpoint ids from the helper tool  testlibusb-win.exe, we can see 2 endpoints
EP moeller 1 81h == 129  == READENDPOINT
P Moeller 2 02h == 2 == WRITERNDPOINT
From the Library LibUSBDotNet we see in class ReadEndpoints (start at 129 == 0×81 )and WriteEndpoints (start at 1), so it is clear which one has to be assigned
- in USBPort.openDevice() the lines device.SetConfiguration(1) and device.ClaimInterface(0) are crucial for working

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

Comments Comments Off

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;
for (var p = 0; p < this.numPages; p++)
cnt += getPageNumWords(p);
console.println(“There are ” + cnt + ” words in this doc.”);

Highlight the entire script, hold down the “Ctrl” key and press the keypad’s enter key and wait.

Comments Comments Off