Skip to content

Instantly share code, notes, and snippets.

View krusty's full-sized avatar

Lucas Sallovitz krusty

View GitHub Profile
{
"menu":[
"gobernador",
"diputado",
"senador",
"intendente",
"concejal"
],
"detalle":[
{
curl "http://localhost:8000/api/subsetdetail/?age__gte=50&age__lte=59&income_range__in=6&gender__in=M&membership_status__in=0&investment_score__in=1,2,3" -H "Pragma: no-cache" -H "Origin: http://localhost:8000" -H "Accept-Encoding: gzip,deflate,sdch" -H "Host: localhost:8000" -H "Accept-Language: en-US,en;q=0.8" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36" -H "Content-Type: application/json" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "Cache-Control: no-cache" -H "X-Requested-With: XMLHttpRequest" -H "Cookie: GUID=SXQArq6KqxeZgPKPTjUP" -H "Connection: keep-alive" -H "Referer: http://localhost:8000/static/mvp1.html" --data-binary "{\"name\":\"small subset\",\"quantity\":\"5\",\"records\":\"28736\",\"notes\":\"\",\"subsubsets\":[{\"name\":\"Sub-subset 0\",\"subset_type\":1,\"dates\":[\"\"],\"notes\":\"\",\"subset_state\":1},{\"name\":\"Sub-subset 1\",\"subset_type\":1,\"dates\":[\"\"],\"notes\":\"\",\"subset_state\":
SubsetType.Collection = Backbone.Collection.extend({
urlRoot: '/api/subsetType',
model: SubsetType.Model,
initialize: function () {
if (!SubsetType.subsetTypes) {
SubsetType.subsetTypes = this;
} else {
this.models = SubsetTypes.subsetTypes.models;
}
MariaDB []> explain select count(*) from api_person where age in (50,51) and state = 'OR';
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+--------+------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+--------+------------------------------------+
| 1 | SIMPLE | api_person | range | person_age_internet,person_age_status_internet_income_worth,person_age_status_income_stage_ma
MariaDB []> create table test (a int, b int)
-> ;
Query OK, 0 rows affected (0.33 sec)
MariaDB []> create index test1 on test (a)
-> ;
Query OK, 0 rows affected (0.15 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB []> explain select * from test where a=1
MariaDB [****]> explain select count(*) from api_person where age >= 50 and age <= 59;
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+----------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+----------+--------------------------+
| 1 | SIMPLE | api_person | range | person_age_internet,person_age_status_internet_income_worth,person_age_status_income_stage_master_internet,person3,person
def dict_to_set (dict_):
return set([(k, v) for k, v in dict_.iteritems()])
GENDER = {'M': 'Male',
'F': 'Female',
'U': 'Undefined'}
MEMBERSHIP_TYPE = {'1': 'Full member (age 50 or older)'}
MEMBERSHIP_STATUS = {'0': 'Full active member', '5': 'Expired'}
curl "http://localhost:8000/api/query/" -H "Pragma: no-cache" -H "Origin: http://localhost:8000" -H "Accept-Encoding: gzip,deflate,sdch" -H "Host: localhost:8000" -H "Accept-Language: en-US,en;q=0.8" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31" -H "Content-Type: application/json" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "Cache-Control: no-cache" -H "X-Requested-With: XMLHttpRequest" -H "Cookie: GUID=SXQArq6KqxeZgPKPTjUP" -H "Connection: keep-alive" -H "Referer: http://localhost:8000/static/mvp1.html" -H "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" --data-binary "{\"age_from\":\"50\",\"age_to\":\"59\",\"income_range\":\"6\",\"networth_range\":\"6\",\"gender\":\"M\",\"state\":\"AK\",\"membership_type\":\"1\",\"membership_status\":\"0\",\"secondary_member_age_from\":\"50\",\"secondary_member_age_to\":\"59\",\"internet_usage_from\":\"1\",\"internet_usage_to\":\"10\",\"completed_school_years_from\":\"14\",\"compl
krusty@kid-c ~/projects/ariel (git)-[tastypie] % cat .gitignore
*.pyc
django_backend/dev_env
django_backend/src/dev.db
krusty@kid-c ~/projects/ariel (git)-[tastypie] % git status
# On branch tastypie
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
krusty@kid-c ~/projects/ariel/django_backend/src (git)-[master] % ./manage.py runserver 0.0.0.0:8000
Validating models...
0 errors found
May 08, 2013 - 08:16:56
Django version 1.5.1, using settings 'aarp.settings'
Development server is running at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):