Skip to content

Instantly share code, notes, and snippets.

View livando's full-sized avatar

Don Livanec livando

View GitHub Profile
public class HelloAndroidTest extends ActivityInstrumentationTestCase2<Hello> {
private Hello mActivity;
private TextView mView;
private String resourceString;
public HelloAndroidTest() {
super("com.livando.hello", Hello.class);
}
@Override
class Tasks extends SQLiteOpenHelper implements DB {
private static final String DATABASE_NAME = "task.db";
private static final int DATABASE_VERSION = 1;
public Tasks(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
@livando
livando / average user input
Created April 6, 2011 19:24
calculates average user input in java. must be between 2 and 25 values.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class AverageNumber {
public static void main(String[] args) {
AverageNumber ave = new AverageNumber();
@livando
livando / row.html
Created October 14, 2011 20:17
Entermedia - data table
<!-- put asset into context -->
$context.putPageValue("data", $asset)
<!-- put view in context used to populate table, ../asset/previewlink.xml -->
$context.putPageValue("view", "asset/previewlink")
$context.putPageValue("searcher", $mediaarchive.getAssetSearcher())
$pages.include("/${applicationid}/components/xml/detaileditor.html?detailsreadonly=true", $context)
@livando
livando / live-releod-sop.txt
Created October 15, 2011 18:48
live-reload
#Gemfile
group :development, :test do
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-livereload'
end
#Command Line
guard init livereload
guard
#Chrome
select 'LR' button
@livando
livando / live-releod-sop.txt
Created October 15, 2011 18:58
live-reload
#Gemfile
group :development, :test do
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-livereload'
end
#Command Line
guard init livereload
guard
@livando
livando / no_special_chars.js
Created November 1, 2011 15:30
quick javascript snippet which uses jQuery and Regular expressions to not allow special characters.
var filename = jQuery("#uploadform #fileName").val();
var characterReg = /^\s*[a-zA-Z0-9\._,\s]+\s*$/;
if(!characterReg.test(filename))
alert("NOT OK " + filename);
@livando
livando / em_mac_setup.sh
Created November 3, 2011 14:37
EnterMedia Mac Setup
`echo "installing EnterMedia Digital Asset Management System"`
`brew install wget`
@livando
livando / ingest_metadata_test.java
Created December 27, 2011 19:52
EM ingest metadata service test
package org.visualdata.rest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.Iterator;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
@livando
livando / IngestTest.java
Created January 10, 2012 21:32
EnterMedia ingest without http
public void testVisualDataIngest() throws Exception {
String testname = "ingest";
String sourcepath = "test/" + testname + ".mp4";
PostMethod method = getIngestPostMethod(sourcepath, testname);
assertEquals(200, getClient().executeMethod(method));
Element root = getXml(method.getResponseBodyAsStream());
assertTrue(root.elements().size() > 0);