Skip to content

Instantly share code, notes, and snippets.

View caseycrites's full-sized avatar

Casey W Crites caseycrites

  • San Francisco, CA
View GitHub Profile
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.simplegeo</groupId>
<artifactId>java-simplegeo</artifactId>
<version>2.2</version>
<packaging>jar</packaging>
<url>https://simplegeo.com</url>
<licenses>
<license>
@caseycrites
caseycrites / simplegeo-pom.xml
Created August 9, 2011 17:42
Adding SimpleGeo to your pom.xml
<dependencies>
...
<dependency>
<groupId>com.simplegeo</groupId>
<artifactId>java-simplegeo</artifactId>
<version>3.0</version>
</dependency>
...
</dependencies>
@caseycrites
caseycrites / gist:1134691
Created August 9, 2011 17:44
Generating a simplegeo jar with dependencies
$ cd ~/path/to/java-simplegeo
$ mvn package -Dmaven.test.skip=true
@caseycrites
caseycrites / gist:1405859
Created November 29, 2011 18:32
Sound file as an asset failure
1318 NotificationService W error loading sound for file:///android_asset/cat.wav
1318 ion: Prepare failed. W status=0x1
1318 NotificationService W at android.media.MediaPlayer.prepare(Native Method)
1318 NotificationService W at com.android.server.NotificationPlayer$CreationAndCompletionThread.run(NotificationPlayer.java:90)
11:31 AM S3nsat10n
Do you have to create an IDL in order to interact with a service running in another process inside your own app? Or can you bind to it like you would a service running in the main process?
11:31 AM evancharlton
you can just bind to it
11:31 AM lov
S3nsat10n: it depends.
11:31 AM pfn
S3nsat10n, another process = need idl
11:31 AM evancharlton
IDL is pretty much just for IPC as far as I know
caseycrites@montana:~/ua% curl -X POST -u "gmho5E0CRsOnWr1kPzEFcQ:jZ1ZAxqyQgqzusCeUlh4Hw" -H "Content-type: application/json" --data '{"aliases": ["homecoming_ua_demo"], "android": {"alert": "command line, bitches."}}' https://go.urbanairship.com/api/push/
Forbidden%
if (fileSize < 1024) {
response = parseFloat(fileSize).toFixed(2) + " bytes"
} else if (fileSize < 1048576) {
response = (parseFloat(fileSize)/1024).toFixed(2) + " KB"
} else {
response = (parseFloat(fileSize)/1048576).toFixed(2) + " MB"
}
DroidCafe cafe = new DroidCafe(new BasicAuth("key", "secret"));
cafe.get("https://go.urbanairship.com/api/apids/d17d5a62-a937-4375-9207-b50f5901ba35/", new Handler() {
@Override
public void handleMessage(Message message) {
HttpResponse result = (HttpResponse) message.obj;
switch (message.what) {
case (DroidCafe.REQUEST_RESULT):
try {
Log.e(TAG, EntityUtils.toString(result.getEntity()));
} catch (IllegalStateException e) {
>>> def divide():
... return 5/0
...
>>> def go():
... try:
... return divide()
... except ZeroDivisionError:
... return "divided by zero"
...
>>> go()
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip" >
<LinearLayout
android:id="@+id/unread_indicator"
android:layout_width="4dp"
android:layout_height="fill_parent"