Archive for category Tech

DROID X micro SD card speed test

Okay, so I know there must be 1k sites out there with this info already but I felt like finding out for myself.

Out of curiosity I wanted to know how fast manufacturer provided the micro SD card in my DROID X phone is. Today I did a test to figure that out.

Procedure:

  1. Copy contents of sd card to computer
  2. Reformat SD card using phone. For Droid X, go into settings -> SD card … -> Unmount -> Format
  3. Connect phone to PC in USB Mass Storage mode
  4. Download ATTO disk benchmark tool: http://www.attotech.com/products/product.php?sku=Disk_Benchmark
  5. Select the correct drive and test.
  6. Copy data back to phone (from step 1)

Results:

You can see that the write speed peaked at about 7.5MB/s and read peaked at just over 13MB/s. These speeds qualify this card as a class 6 card. Not bad considering the card is labeled as class 2. I expected far worse. So, if you are planning to replace this card and want one with at least the same performance buy class 6 or higher. Numerous forum users are reporting that cards higher than class 4 cause problems on the Droid X. I tried a class 10 and had to return it. Now I am using a class 4 with no problems.

Cross Compile libmysql

The key to cross-compiling libmysql is to google “cmake cross compile” instead of “libmysql cross compile”.  Took me a bit to think of this but it makes sense because cmake is the build system for libmysql.

My How-To

My how-to assumes you have a Linux system with standard development tools and compilers installed as well as GNU cross-compilers for the target platform.

  1. Download libmysql source: In the drop down box change to source. Otherwise you will be presented with pre-compiled binaries.
  2. Extract libmysql: tar -xzf mysql-connector-c-x.y.z.tar.gz
  3. run: cd mysql-connector-c-x.y.z
  4. Create a toolchain.cmake file (See section below)
  5. run: cmake -G “Unix Makefiles” -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCMAKE_TOOLCHAIN_FILE=toolchain-arm-linux.cmake
  6. run: make
  7. run: make install
  8. Your libs are in `pwd`/install/lib

Toolchain file

The toolchain file sets a few parameters for the cmake system to override the default behavior of searching for the system compilers. I modified a sample from vtk.org CMake wiki. Here is my modified sample that cross-compiles for an ARM processor running Linux.

# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER   /usr/local/bin/arm-linux-gcc)
SET(CMAKE_CXX_COMPILER /usr/local/bin/arm-linux-g++)
# where is the target environment
#SET(CMAKE_FIND_ROOT_PATH  /opt/eldk-2007-01-19/ppc_74xx /home/alex/eldk-ppc74xx-inst)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Enable OpenGL hardware acceleration for Java 2D

For a couple years now I have been disappointed that one of my 2D Java programs had HORRIBLE performance on my laptop. I noticed the problem got horrible when I upgraded to Vista and didn’t get fixed with my upgrade to Windows 7. The program is a 2D graphing application that draws multiple data streams as scrolling waveforms on the screen in real-time. It is written using Java Swing libraries and the Graphics2D API. On my laptop I was getting less than 1 update per second. On my work computer I was exceeding 200!

Over the last couple years I tried everything to no avail. Finally today I stumbled across this article that describes several unsupported Java system properties that affect the 2D graphics system.

I tried adding the following line to my program and voila! Awesome performance. Problem solved.

System.setProperty("sun.java2d.opengl","True");