Skip to content

Instantly share code, notes, and snippets.

View wboykinm's full-sized avatar

Bill Morris wboykinm

View GitHub Profile
@wboykinm
wboykinm / publicmapping
Created September 26, 2012 14:26
publicmapping apache config
<IfDefine !nobuilder>
<VirtualHost *:80>
ServerAdmin AzaveaDev@azavea.com
WSGIDaemonProcess geodjango user=www-data group=www-data processes=10 threads=1 display-name=publicmapping
WSGIProcessGroup geodjango
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /projects/DistrictBuilder/django/publicmapping.wsgi
Alias /static-media/ /projects/DistrictBuilder/django/publicmapping/static-media/
<Directory /projects//DistrictBuilder/django/publicmapping/static-media>
@wboykinm
wboykinm / publicmapping-error.log
Created September 26, 2012 15:13
DB apache errors
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] mod_wsgi (pid=2046): Exception occurred processing WSGI script '/projects/DistrictBuilder/django/publicmapping.wsgi'.
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] Traceback (most recent call last):
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 219, in __call__
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] self.load_middleware()
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 39, in load_middleware
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] for middleware_path in settings.MIDDLEWARE_CLASSES:
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 184, in inner
[Wed Sep 26 14:45:42 2012] [error] [client 196.2.88.162] self._setup()
[Wed Sep 26 1
@wboykinm
wboykinm / dbirc.log
Created September 26, 2012 15:43
dbirc
[15:15] == wboykinm [c40258a2@gateway/web/freenode/ip.196.2.88.162] has joined #districtbuilder
[15:15] <wboykinm> zwarg: Greetings! (and hi to you too, PubMapBot)
[15:16] <@zwarg> greetings!
[15:16] <wboykinm> zwarg: Indeed - I checked, and there's a "publicmapping" and "pblicmapping-apache" in the sites-enabled dir
[15:17] <wboykinm> zwarg: should I kill one of them?
[15:17] <@zwarg> Ah. Remove the oldest one.
[15:17] <@zwarg> or whichever one is pointing to the 1.1 AMI version of the software
[15:17] <@zwarg> that's in /projects/publicmapping/districtbuilder/trunk/, I think
[15:18] <wboykinm> zwarg: does it matter that they're both symlinks to sites-available?
[15:18] <@zwarg> are they both symlinks to the same thing in sites-available?
@wboykinm
wboykinm / getjson.php
Created September 26, 2012 16:29
get json from mysql
$geojson = array(
'type' => 'FeatureCollection',
'features' => $feature
);
while($row = mysql_fetch_assoc($dbquery)) {
$feature = array(
'type' => 'Feature',
'geometry' => array(
'type' => 'Point',
@wboykinm
wboykinm / getjson.php
Created September 27, 2012 08:51
MySQL to geojson parser
<?php
header('Content-type: text/plain');
$username = "[user]";
$password = "[password]";
$hostname = "localhost";
$database = "[database]";
// Opens a connection to a mySQL server
$connection=mysql_connect ($hostname, $username, $password);
@wboykinm
wboykinm / translate.html
Created September 27, 2012 16:10
google translate for morocco
<head>
<meta name="google-translate-customization" content="10701c8ff5e528b8-f356593069b70248-g85119c7a4b78e8bc-31"></meta>
</head>
<body>
<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'ar,fr'}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
@wboykinm
wboykinm / tooltipparse.js
Created October 4, 2012 17:30
parsed properties for a markerlayer tooltip
var interaction = mapbox.markers.interaction(markerLayer);
m.addLayer(markerLayer);
interaction.formatter(function (a) {
var b = "<p>" + a.properties.call_type + "</p>" + '<p style="font-size:12px;word-wrap: break-word;">' + "Date: " + a.properties.date2 + "<br />" + "Time: " + a.properties.call_time + "<br />" + "Responding Officer: " + a.properties.officer + "<br />" + "Incident ID: " + a.properties.incident_number + "</p>" + "</a>";
return b
});
@wboykinm
wboykinm / config.xml
Created October 7, 2012 00:51
DB config, validated to a functioning instance :)
<!-- The application element that contains all other elements. -->
<DistrictBuilder>
<!-- Define legislative bodies referenced in the system. -->
<LegislativeBodies>
<!-- A Legislative body has an ID (for referencing in GeoLevel
definitions later), a name, and a label for plan items
("District" for Council, etc) -->
<LegislativeBody id="council" name="Burlington City Council" short_label="%(district_id)s" long_label="Ward %(district_id)s" maxdistricts="7" sort_key="1"/>
</LegislativeBodies>
@wboykinm
wboykinm / dberrors.log
Created October 10, 2012 18:39
error log
Traceback (most recent call last):
File "./setup.py", line 176, in <module>
main()
File "./setup.py", line 161, in main
management.call_command('setup', config=args[1], verbosity=options.verbosity, database=database, geolevels=geolevels, views=views, geoserver=geoserver, templates=templates, nesting=nesting, static=static, languages=languages, bard=bard, bard_templates=bard_templates, force=options.force)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 150, in call_command
return klass.execute(*args, **defaults)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/projects/DistrictBuilder/django/publicmapping/redistricting/management/commands/setup.py", line 241, in handle
@wboykinm
wboykinm / config.xml
Created October 11, 2012 15:02
db config
<ScoreFunctions>
<ScoreFunction id="score1" type="district" calculator="publicmapping.redistricting.calculators.Interval" label="Tot Pop">
<SubjectArgument name="subject" ref="poptot"/>
<Argument name="target" value="6060" />
<Argument name="bound1" value="0.05"/>
<Argument name="bound2" value="0.1"/>
</ScoreFunction>
<ScoreFunction id="plan_all_blocks_assigned" type="plan"
calculator="publicmapping.redistricting.calculators.Interval"
label="All Blocks Assigned"