Category Archives: Phil

Phil 4.25.12

8:00 – 4:30 FP

  • Working with my various implementations of JSON
  • Working on the parser for the arduino. It’s a 4 state machine that looks for ‘>>’ to signify a new message and ‘<<‘ to signal the end of a new message. The memory for the string to be processed starts at 128 bytes and gets incremented by 128 bytes each time it runs out of space. Done.
  • Got the parser up on the arduino running, but I seem to have messed up the serial port and made it block. Am able to reset by running the terminal program…
  • Code runs fine on the Arduino when I send the string from the console. Need to figure out what’s wrong with my serial code.

Phil 4.24.12

8:00 – 4:30

  • My lungs have turned into a petri dish. Need to make an appointment to kill these things. Call at 9:00
  • Got an LCD shield for debugging: http://www.diybin.com/products/DFRobot-LCD-Arduino-Shield.html
  • Have a good non-blocking read working
  • Have a block write working
  • Think I’m going to try using JSON for communication – there’s a library for the Arduino
    • Downloaded aJson for Arduino
    • Downloaded cJson which it’s based on for the PC side. Integrating now
    • Had to change the cJSON.c to cJSON.cpp for the compilation to work correctly. This may actually make more sense to make into a static library. Going to play around a bit more before making a decision.

Phil 4.23.12

8:00 – 5:30 FP

Phil 12.20.12

8:00 – FP

  • Installing arduino drivers and generally setting up environment.Done
  • Working on understanding ASCII serial communications
  • Serial echo:
    const unsigned int BAUD_RATE = 9600;
    
    void setup(){
      Serial.begin(BAUD_RATE);
    }
    
    void loop(){
      int numChars = Serial.available();
      if(numChars > 0){
        Serial.print("numChars = [");
        Serial.print(numChars);
        Serial.print("] string = ");
        for(int i = 0; i < numChars; ++i){
          // Serial.read returns the first byte (int?) of incoming serial data
          // available (or -1 if no data is available) - int
          char inp = Serial.read();
          Serial.print(inp);
        }
        Serial.println();
        Serial.println("ready");
      }
    }
  • Turns out that I don’t have Visual Studio here. Talking from C++ will have to wait until this afternoon.
  • The arduino book references arduino-serial.c for example c code. The book’s code is here.

Phil 4.19.12

8:00 – FP

Phil 4.17.12

8:00 – 4:00 FP

  • Moved the texture file name for TexturedCollisionCube to the constructor. I’m going to have multiple cubes to interact with, and need to be able to show different “surfaces’. I need a ‘soft’ looking texture.
  • Found some soft looking textures. Next, I need to have some way of determining what the properties of each type of collision are.
  • Adding CollisionTone class. Nah, I need to integrate that into the FingerIO class. We’ll do that tomorrow. I also want to add some kind of state output. Maybe use the soundText field?

Phil 4.16.12

8:00 – 4:00 FP

  • Dealing with a few left over paper issues. Then on to integrating the code? Otherwise, I’ll work on getting TexturedCollisionCube working and handling rotations.
  • Textures work. Checking through rotations. Fixed! It turns out that I was multiplying the model matrix and the collision matrix in the wrong order. Took a while to find, but it seems to be working nicely now.

Phil 4.13.12

8:30 – 2:30 FP

  • Getting re-acquainted with the rendering code
  • Fixed my base class problem with calling setup in the derived class. Still not sure why I can’t call the subclass from the superclass in C++.
  • Paper is done and submitted!

Phil 4.12.12

8:00 – 12:30 CSIP

  • Started the day trying to hook up hibernate to the information_instance.TABLES table and got the following error:
  • This is attempting to use the following class
    package com.sample.information_schema;
    
    import java.math.BigInteger;
    import java.util.Date;
    
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Table;
    import javax.persistence.Temporal;
    import javax.persistence.TemporalType;
    
    @Entity
    @Table(name = "TABLES")
    public class TableMySql {
    	@Column(name = "version")
    	private BigInteger version;
    
    	@Column(name = "table_rows")
    	private BigInteger table_rows;
    
    	@Column(name = "avg_row_length")
    	private BigInteger avg_row_length;
    
    	@Column(name = "data_length")
    	private BigInteger data_length;
    
    	@Column(name = "max_data_length")
    	private BigInteger max_data_length;
    
    	@Column(name = "index_length")
    	private BigInteger index_length;
    
    	@Column(name = "data_free")
    	private BigInteger data_free;
    
    	@Column(name = "auto_increment")
    	private BigInteger auto_increment;
    
    	@Column(name = "checksum")
    	private BigInteger checksum;
    
    	@Temporal(TemporalType.DATE)
    	@Column(name = "create_time")
    	private Date create_time;
    
    	@Temporal(TemporalType.DATE)
    	@Column(name = "update_time")
    	private Date update_time;
    
    	@Temporal(TemporalType.DATE)
    	@Column(name = "check_time")
    	private Date check_time;
    
    	@Column(name = "table_catalog")
    	private String table_catalog;
    
    	@Column(name = "table_schema")
    	private String table_schema;
    
    	@Column(name = "table_name")
    	private String table_name;
    
    	@Column(name = "table_type")
    	private String table_type;
    
    	@Column(name = "engine")
    	private String engine;
    
    	@Column(name = "row_format")
    	private String row_format;
    
    	@Column(name = "table_collation")
    	private String table_collation;
    
    	@Column(name = "create_options")
    	private String create_options;
    
    	@Column(name = "table_comment")
    	private String table_comment;
    
    	public BigInteger getVersion() {
    		return version;
    	}
    
    	public BigInteger getTable_rows() {
    		return table_rows;
    	}
    
    	public BigInteger getAvg_row_length() {
    		return avg_row_length;
    	}
    
    	public BigInteger getData_length() {
    		return data_length;
    	}
    
    	public BigInteger getMax_data_length() {
    		return max_data_length;
    	}
    
    	public BigInteger getIndex_length() {
    		return index_length;
    	}
    
    	public BigInteger getData_free() {
    		return data_free;
    	}
    
    	public BigInteger getAuto_increment() {
    		return auto_increment;
    	}
    
    	public BigInteger getChecksum() {
    		return checksum;
    	}
    
    	public Date getCreate_time() {
    		return create_time;
    	}
    
    	public Date getUpdate_time() {
    		return update_time;
    	}
    
    	public Date getCheck_time() {
    		return check_time;
    	}
    
    	public String getTable_catalog() {
    		return table_catalog;
    	}
    
    	public String getTable_schema() {
    		return table_schema;
    	}
    
    	public String getTable_name() {
    		return table_name;
    	}
    
    	public String getTable_type() {
    		return table_type;
    	}
    
    	public String getEngine() {
    		return engine;
    	}
    
    	public String getRow_format() {
    		return row_format;
    	}
    
    	public String getTable_collation() {
    		return table_collation;
    	}
    
    	public String getCreate_options() {
    		return create_options;
    	}
    
    	public String getTable_comment() {
    		return table_comment;
    	}
    }
  • to talk to hibernate using the following configuration file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
    <session-factory name="MySqlInformationSchema">
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/information_schema</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.password">edge</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.default_schema">information_schema</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hbm2ddl.auto">update</property>
    <property name="show_sql">true</property>
    <property name="connection.pool_size">1</property>
    
    <!-- List all the annotated classes we're using -->
    <mapping class="com.sample.information_schema.tableMySql"/>
    
    </session-factory>
    </hibernate-configuration>
  • Well, connecting to the db with jdbc instead of running through Hibernate got things up to speed quite quickly. I am running arbitrary queries against the databases (including information_schema, which Hibernate chokes on). The results are wrapped in objects that rules can be run against.
    •  Handle what happens when a null is returned by WrappedMap.getObjectByName().
    • Determine primitive type and handle accordingly
  • Looks like my ability to charge the CSIP contract ran out on the 9th. Need to figure out what to do with the 12 hours I charged since then. Jim is working on it. Ok. Charge half of today and all of yesterday and stop.

12:30 – 4:30 FP

  • Worked on paper, then lost the ability to scroll past page one. Going to try this at home…

7:00 – 9:30 FP

  • Finished incorporating paper changes and sent back to Dr. Kuber.

Phil 4.11.12

8:00 – 4:00 CSIP

  • Working on building a Drools test case structured around wrapped Maps.
  • Built the wrapped objects and Maps, and have the sandbox created
  • And here’s how you do it. Probably not as efficient as it could be, but pretty general case.
    #created on: Apr 11, 2012
    package com.sample
    
    #list any import classes here.
    import com.sample.WrappedObject;
    import com.sample.WrappedMap;
    
    #declare any global variables here
    
    dialect "java"
    
    rule "rule Floats less than six"
    
        when
    
            WrappedMap($wo:getObjectByName("myFloat")) // condition
            eval($wo.NumericLessThan(6))
        then
            System.out.println("n--------------------------------n"+$wo.toString());
    
    end
  • Need to add some methods for handling String compares and for other types of objects
  • Working on getting Hibernate to talk to information_schema in mySql. I’m trying to use the eclipse tools, and I get this error:
  • Stopping for the day. Will talk to Dong about this tomorrow.

Phil 4.10.12

8:00 – 4:30 CSIP

  • Now that I have my Hibernate Eclipse plugins working, back to chapter 9.
  • Well, the plugins work fine, but when I tried to add an element to a query, the build broke and I was unable to get it to work again, even after restoring to the earliest version. Went on to chapter 12, but the DB appears to broken there too.
  • According to Dong, this is because the HSQL instance is not persisted in the test, so all the data drops out. Switching the dialect to MySQL, which runs as a service on my box fixed all problems but one – an exception that said the DB couldn’t be reached. Which was odd, because it was accessed and the tables were created and populated. Go figure.
  • Talked to Mike about his experience with dynamic object creation using Hibernate. It looks pretty straightforward, as long as you have a ‘generic’ object that is wrapped around Map(s) (Collections?) of some kind. Now I need to see if I can build a Drools engine that will reason over elements in a collection contained in an object.

Phil 4.9.12

7:30 – 1:30 FP

  • Seminar. Discovered I can resubmit the CHI paper to UIST. Started working on that.
  • Ordering parts for the boards, which came in Friday

1:30 – 4:30 CSIP

  • Continuing to Hibernate
  • Chapter 8
  • Chapter 9, with a short trip to chapter 11. I finally found out how to install Hibernate Tools without crashing and burning. Go here, and drag the link to somewhere on your eclipse workspace that doesn’t have text entry (it’s an URL), like the border. Presto! Magically installing plugins.
  • For reference, because I think this may be the way this effort finally goes. And hey, I always wanted to write code that generated bytecode…
    • ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex transformations and code analysis tools.
    • ASM offers similar functionality as other bytecode frameworks, but it is focused on simplicity of use and performance. Because it was designed and implemented to be as small and as fast as possible, it makes it very attractive for using in dynamic systems.

Phil 4.6.12

8:00 – 3:30 CSIP

  • Hibernate chapter 6
  • Chapter 7. Learning about annotations like all the other cool kids. Done. Chapter 8 on Monday.

Phil 4.5.12

8:00 – 4:00 CSIP

  • Hibernate Chapter 3. Working on getting to chapter 8, which covers dynamic creation. “Chapter 8 discusses criteria queries, an interesting mechanism that lets you express the constraints on the entities you want, using a natural Java API. This lets you build Java objects to represent the data you want to find, which is easier for people who aren’t database experts to understand; lets you leverage your IDE’s code completion as a memory aid; and even gives you compile-time checking of your syntax. It also supports a form of “query by example,” where you can supply objects that are similar to the ones you’re searching for, which is particularly handy for implementing search interfaces in an application.
  • Chapter 4
    • Tried to change a query from foo = :upper(mySearchTerm) to foo like ‘%upper(mySearchTerm)%’ and failed completely. Dong suggested restrictions, but I don’t see how to do that in the hbm.xml <![CDATA[…]]> section.
  • Chapter 5
  • Chapter 6