Eclipse 3.5 (Galileo) on OS X: Speeding it up

I recently started using Eclipse on OS X and it was so unresponsive, it was almost unusable. Switching tabs was slow, switching perspectives was hella slow. I searched around the web for a solid hour for how to make it faster and finally found the solution. Maybe someone can use it.

My machine is running OS X 10.5, and I have 2 GB of RAM. (This is important because the solution requires messing with how Eclipse handles memory. If you have a different amount of RAM, these numbers may not work and you’ll need to fiddle with them.)

  • Save your work and quit Eclipse.
  • Open the Eclipse application package by right-clicking (or Control-clicking) on Eclipse.app and select “Show Package Contents.”
  • Navigate to Contents→MacOS→, and open “eclipse.ini” in your favorite text editor.
  • Edit the line that starts with -“XX:MaxPermSize” to say “-XX:MaxPermSize=128m”.
  • Before that line, add a line that says “-XX:PermSize=64m”.
  • Edit the line that starts with “-Xms” to say “-Xms40m”.
  • Edit the line that starts ith “-Xmx” to say “-Xmx768m”.
  • Save & relaunch Eclipse.

Worked like a charm for me.

Third party haptic keyboard for iPhone

A downloadable haptic keyboard for the iPhone.

Totally missing the point, Gizmodo asks, “Does anyone care?”, noting that users are already accustomed to the iPhone’s non-tactile keyboard, and that this particular haptic keyboard is buggy. Whatever; research clearly indicates that vibrotactile feedback for surface keyboards enhances interaction. Kudos to these folks at the University of Glasgow for beginning an open project on a popular platform to develop this much-needed software.

Snippets for a simple C state machine

While developing firmware for an LED-based user feedback system, I needed to implement a very simple state machine in C. After spending a few confused hours sweating in black and white, trying to keep track of state variables in my head “the old way”, I found this blog entry which proposes convenient and concise macro definitions for a simple state machine. Suddenly I was coding in full color, and the structure of the program fell into place quickly. Thanks, Jim!

The way a program like this works is by keeping track of the “previous”, “current”, and “next” states in variables. The code inside one of the states is continuously executed, until the “next” state changes. Each time a state is entered or exited, the variables are updated. But by moving the state variable housekeeping to the header file, our switch statement in main() is much more straightforward.

Here’s the code for the macros in the header file:
#define STATE_ENTRY_ACTION if ( currentState != previousState ) {
#define STATE_TRANSITION_TEST previousState = currentState; } if ( nextState == currentState ) {
#define STATE_TRANSITION_TEST_EXCLUSIVE } else if ( nextState == currentState ) {
#define STATE_EXIT_ACTION } if ( nextState != currentState ) {
#define STATE_EXIT_ACTION_EXCLUSIVE } else if ( nextState != currentState ) {
#define STATE_END currentState = nextState; } break;

The EXCLUSIVE macros are used if you want to ensure that the state machine is run at least three times per state, making the timing of the function call more predictable.

Now adding a state here or there, or inserting functions at the right point in the routine is easy:

void main() {
   while( true ) {
      switch ( state ) {
         case state_n:
            STATE_ENTRY_ACTION
               doColor();
            STATE_TRANSITION_TEST
               checkUserInput();
            STATE_EXIT_ACTION
               fadeColor();
            STATE_END
      }
   }
}

I did not include a default case in this example, but for a real application it’s a good idea to always include one.

Two essential posts from a man like Tom Igoe

Lots of great stuff at the blog of Tom Igoe, a physical interaction designer and new media artist. He points to a nice little .zip file of circuit schematic symbols in Illustrator format. But even more essential is his tutorial on how to generate graphs of sensor data with three lines of Wiring code. I could definitely see using this instead of MATLAB to create quick example images for presentations and the like. Plus, all the software you need is free and comes standard with OS X.

LaTeX: itemize bullet characters

Itemized lists in LaTeX automatically use a closed bullet point; first-level nested lists use dashes, followed by open bullets, etc. But what if you want to use different bullet characters?

First, specify which nested layer you want to change. {labelitemi} refers to the outermost nested list, followed by {labelitemii}, and so on. Then specify the character you want to use with its LaTeX command.

Here’s how to specify a closed bullet (the LaTeX default) in the outermost nested list:
begin{itemize}{labelitemi}{$bullet$}
item First item in the list
item Second item
item and so on
end{itemize}

Any character can be used as a bullet character by writing its command in place of bullet. Some characters that might be particularly useful:

circ — An open circle
cdot — A centered dot
star — A five-pointed star
ast — A centered asterisk
rightarrow — A short right-pointing arrow
diamondsuit — An open diamond

For a full list of character commands, see Hypertext Help with LaTeX: Binary and relational operators