wesley tanaka

Tech

Implied State Space Size

()

Consider these two if statements:

If statement #1

if (color == RED and has_thorns == TRUE)
  return "Roses are red"
else if (num_petals == 5)
  return "Violets are blue"

If statement #2

if (species == ROSE)
  return "Roses are red"
else if (species == VIOLET)
  return "Violets are blue"

The Architecture of Open Source Applications ePub download

()

You can download an ePub version of "The Architecture of Open Source Applications" (edited by Amy Brown and Greg Wilson) here.

The book is also available to read for free at http://aosabook.org/en/index.html under the Creative Commons Attribution 3.0 Unported license.

Using Eclipse with a Android project using the new gradle build system / project structure / layout

()

The Eclipse Android ADT plugin hard-codes paths for the AndroidManifest.xml file, the res directory and the gen directory.  If you migrate an Android project to the new Gradle project structure, it will stop working in Eclipse.  You can work around this by creating symbolic links from the new Gradle layout to the old locations expected by ADT.  For example, from the root of your project, if you have a android directory, you can run these commands:

WARNING: Class Joiner loaded from appengine.jar has a dependency which is not part of App Engine's supported API

()

Using optimizeWar = true in gradle-gae-plugin will cause it to run fatJarPrepareFiles and fatJar which expand all of your dependency .jar files into .class files and then re-combine them all into a single appengine.jar file. Depending on what you have in your dependencies block, this can sometimes cause:

bootstrap class path not set in conjunction with -source 1.6

()

Running a simple build.gradle file with sourceCompatibility = 1.6 with Oracle's JDK 1.7

apply plugin: 'java'
defaultTasks 'build'
sourceCompatibility = 1.6

repositories {
  mavenCentral()
}

dependencies {
  testCompile 'junit:junit:3.8'
}

will cause this warning to be emitted by the JVM:

Upgrading Gradle to the latest version 1.6 or 1.7 on Ubuntu 12.04 (Precise Pangolin)

()

Ubuntu 12.04.3 has an old version of Gradle (1.0-milestone-3 from September 2011) installed by default.  To upgrade to a later version of Gradle, you can use Cheng-Wei Chien's PPA for Gradle at https://launchpad.net/~cwchien/+archive/gradle by issuing the following commands:

sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update

Then, to install Gradle 1.6

Setting a system property in Gradle

()

Java system properties can be specified in Gradle by creating a file in one of these locations:

  • $HOME/.gradle/gradle.properties
  • $MAIN_PROJECT_DIR/gradle.properties

And creating a property name that's prefixed with systemProp. For example, to set a system property called appengine.sdk.root, you'd create a gradle.properties file with this contents:

systemProp.appengine.sdk.root=/path/to/your/appengine-java-sdk

What is Groovy?

()

I started looking at Groovy the other day while trying to understand how Gradle works.  Here are some initial impressions:

What is Gradle? (comparison of gradle vs ant vs make)

()

Gradle is a build tool similar to make or ant which is being adopted by the Android project as a replacement for ant scripts and the automated "build" step in Eclipse.

There's a useful book about Gradle available online for free at http://www.gradleware.com/registered/books/building-and-testing/

Here is a comparison between gradle and two other commonly used build tools:

Android SQLiteOpenHelper onUpgrade()

()

It's not necessary to wrap your SQLiteOpenHelper.onUpgrade() code in beginTransaction() and endTransaction() pairs, because ever since the earliest version of SQLiteOpenHelper, the Android source code has done this for you:

Syndicate content
by Wesley Tanaka