Loading...
Logo
Processing Forum
augustoest's Profile
12 Posts
34 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    I'm running Processing 2.0b6 on a Mac, and I'm running the really helpful Keystone library (by David Bouchard). Problem is, the ks.load() insists on causing me a  NullPointerException .

    I've tried using a solution described in the old version of this forum:
    You can try and do:
    Locale locale = new Locale("EN");
    Locale.setDefault(locale);
    before doing the save.
    But to no avail. The file generated seems fine:
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <keystone>
    3.   <surface h="300" res="20" w="400" x="169.0" y="168.0">
    4.     <point i="0" u="0.0" v="0.0" x="-76.0" y="-124.0"/>
    5.     <point i="20" u="400.0" v="0.0" x="491.0" y="-121.0"/>
    6.     <point i="420" u="0.0" v="300.0" x="-168.0" y="572.0"/>
    7.     <point i="440" u="400.0" v="300.0" x="572.0" y="573.0"/>
    8.   </surface>
    9. </keystone>
    But I get this error when trying to load these settings (with ks.load() in setup() and the file in the data folder of the sketch):
    1. java.lang.NullPointerException at processing.mode.java.runner.Runner.findException(Runner.java:682) at processing.mode.java.runner.Runner.reportException(Runner.java:627) at processing.mode.java.runner.Runner.exception(Runner.java:570) at processing.mode.java.runner.EventThread.exceptionEvent(EventThread.java:367) at processing.mode.java.runner.EventThread.handleEvent(EventThread.java:255) at processing.mode.java.runner.EventThread.run(EventThread.java:89) Exception in thread "Animation Thread" java.lang.NullPointerException at processing.data.XML.getString(XML.java:575) at processing.data.XML.getString(XML.java:570) at processing.data.XML.getFloat(XML.java:639) at processing.data.XML.getFloat(XML.java:627) at deadpixel.keystone.CornerPinSurface.load(Unknown Source) at deadpixel.keystone.Keystone.load(Unknown Source) at deadpixel.keystone.Keystone.load(Unknown Source) at CornerPin.keyPressed(CornerPin.java:102) at processing.core.PApplet.handleKeyEvent(PApplet.java:2756) at processing.core.PApplet.dequeueKeyEvents(PApplet.java:2699) at processing.core.PApplet.handleDraw(PApplet.java:2140) at processing.opengl.PGL$PGLListener.display(PGL.java:2595) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:189) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177) at javax.media.opengl.awt.GLCanvas$DisplayAction.run(GLCanvas.java:928) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:425) at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:364) at javax.media.opengl.awt.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:945) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:702) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:663) at java.awt.EventQueue$2.run(EventQueue.java:661) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:672) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


    Hello,

    I'm using proXML to read and write an XML file, e.g.:

    1. <things>
    2.       <thing>
    3.             <posx>5.0</posx>
    4.             <posy>10.0</posy>
    5.       </thing>
    6. </things>

    During the execution of my code, I want to update both posx and posy, but how do I do it (without using attributes)?

    I've tried doing it like:

    1. proxml.XMLElement x = new proxml.XMLElement("posx");
    2. proxml.XMLElement y = new proxml.XMLElement("posy");

    3. things.removeChild(0);

    4. thing.removeChild(1);
    5. thing.removeChild(0);

    6. thing.addChild(x, 0);
    7. thing.addChild(y, 1);

    8. things.addChild(thing, 0);

    But how do I add the values to posx and posy? I read them using getChild(0), but addChild can only be used with an element, and not with floats or strings.


    I want to create a Processing library to record events on a multi-touch interface. I'm trying to achieve this by using SQLJet to easily record events on an SQLite database. I know about the SQLibrary for Processing, but I'm trying to avoid having write instructions on the Sketches' code.

    I'm using the Processing library template for Eclipse, and I've imported the OSGi bundle with SQLJet as an external JAR. I'm testing this simple code that only creates a database:

    1. package TUIrecorder;
    2. import java.io.File;
    3. import org.tmatesoft.sqljet.core.SqlJetException;
    4. import org.tmatesoft.sqljet.core.SqlJetTransactionMode;
    5. import org.tmatesoft.sqljet.core.table.ISqlJetTransaction;
    6. import org.tmatesoft.sqljet.core.table.SqlJetDb;
    7. import processing.core.*;
    8. public class TUIrecorder {
    9. // myParent is a reference to the parent sketch
    10. PApplet myParent;
    11. File dbFile;
    12. /**
    13. * Constructor, called in the setup() method in the Processing sketch to start the library.
    14. *
    15. * @example TUIrecExample
    16. * @param theParent
    17. */
    18. public TUIrecorder(PApplet theParent) {
    19. myParent = theParent;
    20. try {
    21. createDB();
    22. } catch (Exception e) {
    23. System.out.println("Failed to create the database.");
    24. }
    25. }
    26. /**
    27. * Prepares a table in the database to record pick ups and drop downs
    28. *
    29. * @example TUIrecExample
    30. * @throws SqlJetException
    31. */
    32. private void createDB() throws SqlJetException {
    33. dbFile = new File("db.interaction");
    34. dbFile.delete();
    35. // create database, table and two indices
    36. SqlJetDb db = SqlJetDb.open(dbFile, true);
    37. // set DB option that have to be set before running any transactions
    38. db.getOptions().setAutovacuum(true);
    39. // set DB option that have to be set in a transaction
    40. db.runTransaction(new ISqlJetTransaction() {
    41. public Object run(SqlJetDb db) throws SqlJetException {
    42. db.getOptions().setUserVersion(1);
    43. return true;
    44. }
    45. }, SqlJetTransactionMode.WRITE);
    46. // close DB
    47. db.close();
    48. }
    49. }
    It builds successfully, although I have a warning relating to the javadoc of SqlJetException.

    When I try to run the following code in Processing:

    1. import TUIrecorder.*;
    2. TUIrecorder tuiRec;
    3. void setup() {
    4. size(400,400);
    5. smooth();
    6. tuiRec = new TUIrecorder(this);
    7. }
    8. void draw() {
    9. background(0);
    10. }

    I get the following error:

    processing.app.debug.RunnerException: NoClassDefFoundError: org/antlr/runtime/RecognitionException
    at processing.app.Sketch.placeException(Sketch.java:1543)
    at processing.app.debug.Runner.findException(Runner.java:583)
    at processing.app.debug.Runner.reportException(Runner.java:558)
    at processing.app.debug.Runner.exception(Runner.java:498)
    at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
    at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
    at processing.app.debug.EventThread.run(EventThread.java:89)

    Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: org/antlr/runtime/RecognitionException
    at org.tmatesoft.sqljet.core.table.SqlJetDb$2.runWithLock(SqlJetDb.java:247)
    at org.tmatesoft.sqljet.core.table.SqlJetDb.runWithLock(SqlJetDb.java:305)
    at org.tmatesoft.sqljet.core.table.SqlJetDb.readSchema(SqlJetDb.java:242)
    at org.tmatesoft.sqljet.core.table.SqlJetDb.getOptions(SqlJetDb.java:509)
    at TUIrecorder.TUIrecorder.createDB(Unknown Source)
    at TUIrecorder.TUIrecorder. (Unknown Source)
    at TUIrecExample.setup(TUIrecExample.java:30)
    at processing.core.PApplet.handleDraw(PApplet.java:1583)
    at processing.core.PApplet.run(PApplet.java:1503) at java.lang.Thread.run(Thread.java:680)

    Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.RecognitionException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 10 more

    Any clue on what I'm doing wrong here?

    Following the post in the "old" forum, I developed a library for Processing that allows users to connect and read from cheap touchatag RFID readers on the Windows platform.

    This library affords the simultaneously connection of multiple readers, and up to three tags on each one (due to performance issues of the tags themselves on the touchatag reader). This project was tested on Windows 7 Professional and Windows XP SP3, with Processing 1.0.9.

    You can download it here. For this library to work, users only need to install the Windows CCID PCSC driver, the touchatag software client isn't necessary. For more information head to the library's page on Google code.

    Example:
    1. import touchatag.*;
    2. Touchatag rfid;

    3. // Defines the maximum number of touchatag
    4. // readers that might be connected to the computer 
    5. int numOfReaders = 3;

    6. // This library affords up to three touchatag
    7. // tags on each of the touchatag readers
    8. String[][] tags = new String[numOfReaders][3];

    9. void setup() {
    10.   // Optionally, if only one touchatag reader will
    11.   // be used: rfid = new Touchatag(this) 
    12.   rfid = new Touchatag(this, numOfReaders);
    13. }

    14. void draw() {
    15.   // Gets the number of touchatag readers connected
    16.   int readers = rfid.On();
    17.   
    18.   if (readers != 0) {
    19.      // Gets the tags for each of the touchatag readers
    20.      for (int i = 0; i < readers; i++) {
    21. tags[i] = rfid.tagsOnReader(i);
    22. println(tags[i]);
    23.      }  
    24.    }
    25. }