Skip to content

Instantly share code, notes, and snippets.

@billdawson
billdawson / ex01-filestream-getfile.js
Created May 2, 2011 21:33
Examples - Stream blog post - FileStream
// Get the source file (this one is in Resources).
var infile = Titanium.Filesystem.getFile('emmy.jpg');
if (!infile.exists()) {
Ti.API.error("File not exists()");
return;
}
Ti.Media.showCamera({
success: function(e) {
// Open stream on blob.
var instream = Titanium.Stream.createStream({
mode: Titanium.Stream.MODE_READ,
source: e.media // e.media is a Blob
});
// Open an output stream for a file
// to hold the blob data.
var f =
var win = Titanium.UI.currentWindow;
// the following example orientationModes values would set orientation to sensor portrait
win.orientationModes = [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT];
@billdawson
billdawson / README.md
Created August 5, 2011 00:58
Delete git timob-* branches if they've been merged with your master branch

Purpose

Gets rid of your local and remote (origin) branches that have "timob-" in their name and that have already been merged into master (or into whatever other branch you want to specify.)

Not to be confused with the actual git prune command.

Usage

$ git branch --merged master | gprune.py
@billdawson
billdawson / desktop_perf_results.txt
Created August 24, 2011 20:06 — forked from marshall/desktop_perf_results.txt
Various V8 perf test results
Rhino (Interpreted)
-------------------
Score: 362
Richards: 425
DeltaBlue: 340
Crypto: 369
RayTrace: 535
EarleyBoyer: 474
RegExp: 108
@billdawson
billdawson / android_scons_speedups.md
Created January 11, 2012 21:41
Speeding up Titanium Build

Speeding up Titanium Mobile Build

(The command examples assume OS X).

Just about everything that happens when you enter scons is for Android. So anything you can do to speed up the Android part of our build will be useful.

  • Android NDK r7 can use ccache. We get huge improvements in build time with it. So install it (if you have HomeBrew, brew install ccache) then set a shell variable NDK_CCACHE to point to it. I.e., for me, having installed it with brew, it would be export NDK_CCACHE=/usr/local/bin/ccache.

  • NDK can also parallelize while compiling. Set a shell variable NUM_CPUS to (according to Opie) 2x the number of cores in your machine. A quick way to get the # cores on your machine in OS X is system_profiler | grep "Number Of Cores" in terminal. I have 2 cores, so my shell var setting is export NUM_CPUS=4.

@billdawson
billdawson / app_in_ddms.md
Created January 18, 2012 00:23
Seeing an app in DDMS

Seeing an app in DDMS

If the app is running on an emulator, you see it automatically in DDMS.

If the app is running on a device connected to your development machine, you will only see it in DDMS if the <application/> element in AndroidManifest.xml has the android:debuggable="true" attribute.

You can set that attribute using just tiapp.xml. Make the <android/> section of tiapp.xml look like this:

<android xmlns:android="http://schemas.android.com/apk/res/android">
[?1034hscons: Reading SConscript files ...
Building MobileSDK version 2.1.0, githash c7fc284
java -cp /Users/bill/src/titanium_mobile/android/build/lib/ant.jar:/Users/bill/src/titanium_mobile/android/build/lib/ant-launcher.jar:/Users/bill/src/titanium_mobile/android/build/lib/xercesImpl.jar:/Users/bill/src/titanium_mobile/android/build/lib/xml-apis.jar:/Users/bill/src/titanium_mobile/android/build/lib/ant-nodeps.jar org.apache.tools.ant.launch.Launcher -Dant.home=build -Dandroid.sdk=/opt/android-sdk-macosx -Dandroid.platform=/opt/android-sdk-macosx/platforms/android-8 -Dndk.build.args=JAVAH=javah -Dbuild.githash=c7fc284 -Dgoogle.apis=/opt/android-sdk-macosx/add-ons/addon-google_apis-google-8 -Dbuild.version=2.1.0 -buildfile build.xml full.build
Buildfile: /Users/bill/src/titanium_mobile/android/build.xml
clean.all:
[mkdir] Created dir: /Users/bill/src/titanium_mobile/dist/android/classes/ant-tasks
[javac] Compiling 7 source files to /Users/bill/src/titanium_mobile/dist/android/classes/ant-tasks
diff --git a/support/android/builder.py b/support/android/builder.py
index e1dfc6f..d8a75d8 100755
--- a/support/android/builder.py
+++ b/support/android/builder.py
@@ -1437,13 +1437,13 @@ class Builder(object):
for jar_file in self.android_jars:
add_resource_jar(jar_file)
- def add_native_libs(libs_dir):
+ def add_native_libs(libs_dir, exclude=[]):
diff --git a/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java b/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java
index 181debc..540f04a 100644
--- a/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java
+++ b/android/modules/map/src/java/ti/modules/titanium/map/ViewProxy.java
@@ -185,33 +185,29 @@ public class ViewProxy extends TiViewProxy
}
@Kroll.method
- @SuppressWarnings({"rawtypes", "unchecked"})
- public void addRoute(Object route)