Skip to content

Instantly share code, notes, and snippets.

@astachelek
astachelek / AP-711.log
Created November 8, 2013 23:06
Logcat output illustrating that SOURCE_NOT_PLAYABLE does not fully shut down the video load process.
D/EventLogger(19520): didChangeList { list: [Video{name: "I'm Shipping Up to Boston", shortDescription: "I'm Shipping Up to Boston", sourceCollections: 1, cuePoints: 0}] }
D/EventLogger(19520): willChangeVideo { currentVideo: null nextVideo: Video{name: "I'm Shipping Up to Boston", shortDescription: "I'm Shipping Up to Boston", sourceCollections: 1, cuePoints: 0} index: -1 uuid: cc1177d1-1aa0-4690-823f-705fe9ea2a33 }
D/EventLogger(19520): willChangeVideo { currentVideo: null nextVideo: Video{name: "I'm Shipping Up to Boston", shortDescription: "I'm Shipping Up to Boston", sourceCollections: 1, cuePoints: 0} index: -1 uuid: 7e12cb09-1541-4c21-b3b8-a3834542a6f9 }
D/EventLogger(19520): setVideo { video: Video{name: "I'm Shipping Up to Boston", shortDescription: "I'm Shipping Up to Boston", sourceCollections: 1, cuePoints: 0} }
D/EventLogger(19520): setVideoStill { video_still: http://www.mtv.com/shared/promoimages/bands/d/dropkick_murphys/im_shipping_up_to_boston/281x211.jpg }
D/EventLogger(19520): selectSource
@astachelek
astachelek / TestRig-Build.md
Last active December 25, 2015 19:39
Instructions on how to build the TestRig using Maven from the command line.

Fixing parent pom.xml reference

Currently the pom.xml file in TestRigVerify has an invalid parent reference. To fix this update the parent artifactId from testrig-parent to testrig-coordinator.

Compiling via Maven

Use this command to build the TestRig, but be sure to include the correct path to your local install of the Android SDK.

$ mvn -Dandroid.sdk.path=path/to/Android/SDK/root android:deploy -Dmaven.test.skip=true -DtestDir=TestRigVerify clean install
@astachelek
astachelek / SoManyWaysToGetScreenSizeInAndroid.java
Created May 8, 2013 18:59
In case you ever wanted to see a list of the various approaches to get the size of the screen in Android, here are a bunch. Many of these return slightly different values.
// This causes some IPC to the WindowManager, so use with caution as its slow
Rect displayArea = new Rect();
Window window = activity.getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(displayArea);
Log.d(TAG, "Visible Display Frame Method: " + displayArea.width() + "x" + displayArea.height());
// This is not immediately available as the full view layout needs to happen
View root = window.getDecorView().findViewById(android.R.id.content);
Log.d(TAG, "Root Content View Method: " + root.getMeasuredWidth() + "x" + root.getMeasuredHeight());
@astachelek
astachelek / database.yml
Created January 30, 2012 19:09
Sample Database Config
development:
adapter: mysql2
database: database_name
username: root
password:
pool: 5
timeout: 5000
test:
adapter: sqlite3
@astachelek
astachelek / Gemfile
Created January 30, 2012 19:01
Sample Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.0'
gem 'sqlite3'
gem 'mysql2'
gem 'devise'
@astachelek
astachelek / BaseIntegrationTestCase.groovy
Created September 9, 2011 22:03
Reusable base unit test class that launches the FTP server
import org.junit.Before
import grails.test.GrailsUnitTestCase
/**
* Common base class for all integration tests starts an FTP server and ensures FTP folders exist
*/
class BaseIntegrationTestCase extends GrailsUnitTestCase {
// Load our configured FTP server
def testFtpServer
@astachelek
astachelek / resources.groovy
Created September 9, 2011 21:56
Include the FTP server configuration into the Grails Spring context
import grails.util.*
beans = {
switch(Environment.current) {
case Environment.TEST:
importBeans('file:grails-app/conf/spring/test-ftp.xml')
break
}
}
@astachelek
astachelek / user.properties
Created September 9, 2011 21:54
Define a user with which the application can authenticate during testing
ftpserver.user.admin.userpassword=21232F297A57A5A743894A0E4A801FC3
ftpserver.user.admin.homedirectory=./target/test-ftp
ftpserver.user.admin.enableflag=true
ftpserver.user.admin.writepermission=true
ftpserver.user.admin.maxloginnumber=0
ftpserver.user.admin.maxloginperip=0
ftpserver.user.admin.idletime=0
ftpserver.user.admin.uploadrate=0
ftpserver.user.admin.downloadrate=0
@astachelek
astachelek / test-ftp.xml
Created September 9, 2011 21:53
Basic configuration of the FTP server
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd"
id="testFtpServer">
<listeners>
<nio-listener name="default" port="2121">
</nio-listener>
</listeners>
<file-user-manager file="./grails-app/conf/users.properties" />
@astachelek
astachelek / BuildConfig.groovy
Created September 9, 2011 21:49
Add FtpServer dependencies to BuildConfig.groovy
dependencies {
// other dependencies for your application go here
....
// test-only dependencies for our FTP server
test 'org.apache.mina:mina-core:2.0.4'
test 'org.apache.ftpserver:ftplet-api:1.0.6'
test 'org.apache.ftpserver:ftpserver-core:1.0.6'
}