Skip to content

Instantly share code, notes, and snippets.

View jmwenda's full-sized avatar

Jude Mwenda jmwenda

View GitHub Profile
import requests
#this is a series of scripts to help in testing ODK Aggregate requests
print "Beggining of processing"
#we begin testing to see if we can get odk forms
url = 'http://localhost:8080/ODKAggregate/formUpload'
files = {'form_def_file': open('/Downloads/Birds.xml', 'rb'),'test': 'test'}
r = requests.post(url, files=files)
import pdb;pdb.set_trace()
print r.status_code
~
Jul 21, 2014 1:00:50 PM org.opendatakit.common.persistence.engine.mysql.DatastoreImpl deleteEntity
INFO: Executing DELETE FROM `odk_prod`.`_task_lock` WHERE `_URI` = ? with key e791d825-0f10-494f-abdc-34eb9714f6e9 by user anonymousUser
Jul 21, 2014 1:00:50 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet upload threw exception
java.lang.IllegalArgumentException: unexpected null values passed into method
at org.opendatakit.common.datamodel.BinaryContentManipulator.setValueFromByteArray(BinaryContentManipulator.java:536)
at org.opendatakit.aggregate.form.Form.setXFormMediaFile(Form.java:671)
at org.opendatakit.aggregate.parser.FormParserForJavaRosa.guardedInitHelper(FormParserForJavaRosa.java:444)
at org.opendatakit.aggregate.parser.FormParserForJavaRosa.initHelper(FormParserForJavaRosa.java:236)
at org.opendatakit.aggregate.parser.FormParserForJavaRosa.<init>(FormParserForJavaRosa.java:148)
@jmwenda
jmwenda / ODK API Sample requests
Last active August 29, 2015 14:04
ODK Form Post
import requests
from requests.auth import HTTPDigestAuth
#this is a series of scripts to help in testing ODK Aggregate requests
print "Beggining of processing"
#we begin testing to see if we can get odk forms
r = requests.get('https://promisetracker.appspot.com/formList')
#lets perfom and ODK authentication
#url = 'http://localhost:8080/ODKAggregate/formUpload'
url = 'https://promisetracker.appspot.com/formUpload'
files = {'form_def_file': open('/Users/jude/Downloads/Birds.xml', 'rb')}
@jmwenda
jmwenda / gist:d36ed51582540158e9ed
Created July 29, 2014 19:39
several attempts at looping through files
def addSubmissions(submission_data,media_files)
submission_post_url = URI.join(@url,"submission")
#params = { :xml_submission_file => File.open(submission_data), :datafile => media_files.select { |f| File.file?(f) }.map { |f| File.open(f) }}
#params = {:xml_submission_file => File.open(submission_data)}
mediafiles = []
x = Hash.new{|hsh,key| hsh[key] = [] }
#media_files.each { |file| mediafiles[:datafile] = File.open(file) }
media_files.each do|file|
#x['datafile'].push File.open(file)
#mediafiles.push(File.open(file))
#!/usr/bin/env python
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from math import floor, log
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from colorsys import hsv_to_rgb
import numpy as np
import os.path
<template name="map">
<div id="container">
<div id="map" class="map"></div>
</div>
</template>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Node.js app detected
remote: -----> Installing node
remote: -----> Installing meteor
remote: Downloading Meteor distribution
remote: ######################################################################## 100.0%
remote:
<<<<<<< HEAD
Django==1.5.5
dj-database-url==0.2.2
dj-static==0.0.5
django-appconf==0.5
django-forms-bootstrap==2.0.3.post1
django-jsonfield==0.8.12
-e git://github.com/agiliq/merchant.git@f5ebd361f00ce35e7cfee069ca79ffb0100bb30b#egg=django_merchant-v0.1
-e git+git://github.com/agiliq/merchant.git#egg=django-merchant
<!DOCTYPE html>
<html>
<head>
<title>WMTS example</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://openlayers.org/en/v3.8.2/css/ol.css" type="text/css">
<script src="http://openlayers.org/en/v3.8.2/build/ol.js"></script>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">