Permalink
Browse files

Examples and help patches, small bugfixes.

  • Loading branch information...
residuum committed Sep 25, 2012
1 parent ab64480 commit 3872a382c5d310c56d25a4886d33dce50b14498f
Showing with 451 additions and 426 deletions.
  1. +1 −0 Makefile
  2. +1 −1 examples/purest-json-test.pd
  3. +37 −33 examples/statistics.pd
  4. +65 −61 examples/the-sound-of-money.pd
  5. +41 −39 examples/twitter-visualization.pd
  6. +1 −1 json-decode.c
  7. +1 −1 json-encode.c
  8. +36 −0 oauth-help.pd
  9. +10 −9 oauth.c
  10. +2 −2 purest_json.c
  11. +4 −4 purest_json.h
  12. +246 −0 rest-help.pd
  13. +6 −275 rest-json-help.pd
View
@@ -266,6 +266,7 @@ all: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB)
%.$(EXTENSION): %.o $(SHARED_LIB)
$(CC) $(ALL_LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(ALL_LIBS) $(SHARED_LIB)
chmod a-x "$*.$(EXTENSION)"
+ chmod a-x "$(SHARED_LIB)"
# this links everything into a single binary file
$(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o lib$(LIBRARY_NAME).o
@@ -1,4 +1,4 @@
-#N canvas 61 51 1002 589 10;
+#N canvas 59 51 1002 589 10;
#X declare -lib purest_json;
#X msg 9 38 url http://127.0.0.1:5984/;
#X obj 363 136 json-encode;
View
@@ -1,4 +1,4 @@
-#N canvas 395 51 964 694 10;
+#N canvas 393 51 964 694 10;
#X declare -lib purest_json;
#X obj 143 145 version;
#X obj 104 94 bng 15 250 50 0 empty empty Warning:_Clicking_here_will_send_data_about_your_Pd_version_to_an_open_databas*
@@ -12,13 +12,13 @@
#X msg 207 271 add distribution \$1;
#X msg 228 295 add compilation-date \$1;
#X msg 247 319 add compilation-time \$1;
-#X obj 104 540 print raw-return;
+#X obj 18 540 print raw-return;
#X obj 6 484 print command;
-#X text 452 482 Parameter 1: Base Url;
-#X text 452 470 Using 4 parameters to get authentication cookie:;
-#X text 452 493 Parameter 2: Path to Login;
-#X text 452 516 Parameter 4: Password;
-#X text 452 505 Parameter 3: Username;
+#X text 488 482 Parameter 1: Base Url;
+#X text 488 470 Using 4 parameters to get authentication cookie:;
+#X text 488 493 Parameter 2: Path to Login;
+#X text 488 516 Parameter 4: Password;
+#X text 488 505 Parameter 3: Username;
#X text 200 143 We get version information about Puredata for the statistics
;
#X text 184 382 We create a JSON object from the version information
@@ -28,44 +28,41 @@ The example sends data to a BigCouch instance hosted by http://cloudant.com/.
;
#X text 26 43 The data will only include information from the output
of [version] \, and nothing else.;
-#X obj 413 568 print status-information;
+#X obj 449 555 print status-information;
#X obj 104 119 t b b;
#X text 240 445 We store the data;
-#X obj 104 473 rest-json http://ix.residuum.org/ login.php puredata
-statistics;
#X msg 104 424 PUT statistics.php \$1;
#X text 682 55 Different possibilities for authentication:;
#N canvas 44 51 511 356 init 0;
#X obj 32 281 print;
#X text 31 51 Set base url \, login path \, username and password on
initialization;
-#X obj 32 220 rest-json https://residuum.cloudant.com/ _session nownestortedidirevinesti
-dBukE2WR07A7PtE8FIXECl8c;
#X msg 71 157 GET purest-json-stat/_design/statistics/_view/usage_by_distribution?group=true
;
#X msg 32 85 GET purest-json-stat/_design/statistics/_view/usage_by_version?group=true
;
-#X connect 2 0 0 0;
-#X connect 3 0 2 0;
-#X connect 4 0 2 0;
+#X obj 32 220 rest https://residuum.cloudant.com/ _session nownestortedidirevinesti
+dBukE2WR07A7PtE8FIXECl8c;
+#X connect 2 0 4 0;
+#X connect 3 0 4 0;
+#X connect 4 0 0 0;
#X restore 684 74 pd init with parameters;
-#N canvas 571 65 493 359 use 0;
+#N canvas 567 61 493 359 use 0;
#X obj 41 280 print;
-#X obj 41 227 rest-json;
#X text 21 42 Use the url method to set the parameters;
#X msg 22 66 url https://residuum.cloudant.com/ _session nownestortedidirevinesti
dBukE2WR07A7PtE8FIXECl8c;
#X msg 88 162 GET purest-json-stat/_design/statistics/_view/usage_by_distribution?group=true
;
#X msg 63 110 GET purest-json-stat/_design/statistics/_view/usage_by_version?group=true
;
-#X connect 1 0 0 0;
-#X connect 3 0 1 0;
-#X connect 4 0 1 0;
-#X connect 5 0 1 0;
+#X obj 41 227 rest;
+#X connect 2 0 5 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 0;
+#X connect 5 0 0 0;
#X restore 685 99 pd use url method;
-#N canvas 233 403 538 332 basic 0;
-#X obj 43 267 rest-json;
+#N canvas 229 399 538 332 basic 0;
#X obj 43 294 print;
#X msg 43 89 GET https://nownestortedidirevinesti:dBukE2WR07A7PtE8FIXECl8c@residuum.cloudant.com/purest-json-stat/_design/statistics/_view/usage_by_version?group=true
;
@@ -74,22 +71,27 @@ dBukE2WR07A7PtE8FIXECl8c;
#X text 39 27 Other possibilities for basic HTTP authentication: send
the username and password seperated by a colon (:) after the specification
of the protocol \, followed by an at sign (@) and the url.;
-#X connect 0 0 1 0;
-#X connect 2 0 0 0;
-#X connect 3 0 0 0;
+#X obj 43 267 rest;
+#X connect 1 0 4 0;
+#X connect 2 0 4 0;
+#X connect 4 0 0 0;
#X restore 685 124 pd basic http authentication;
-#N canvas 795 401 493 359 basic 0;
+#N canvas 791 397 493 359 basic 0;
#X obj 34 269 print;
#X text 29 38 The trick with : and @ also works for the base url.;
#X msg 77 101 GET usage_by_distribution?group=true;
#X msg 34 64 GET usage_by_version?group=true;
-#X obj 34 144 rest-json https://nownestortedidirevinesti:dBukE2WR07A7PtE8FIXECl8c@residuum.cloudant.com/purest-json-stat/_design/statistics/_view/
+#X obj 34 144 rest https://nownestortedidirevinesti:dBukE2WR07A7PtE8FIXECl8c@residuum.cloudant.com/purest-json-stat/_design/statistics/_view/
;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 4 0 0 0;
#X restore 685 148 pd basic http authentication in base url;
#X obj 25 583 import purest_json;
+#X obj 104 473 rest http://ix.residuum.org/ login.php puredata statistics
+;
+#X obj 159 531 json-decode;
+#X obj 159 577 print json-data;
#X connect 0 0 2 0;
#X connect 1 0 23 0;
#X connect 2 0 3 0;
@@ -102,13 +104,15 @@ of the protocol \, followed by an at sign (@) and the url.;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
-#X connect 6 0 26 0;
+#X connect 6 0 25 0;
#X connect 8 0 6 0;
#X connect 9 0 6 0;
#X connect 10 0 6 0;
#X connect 23 0 6 0;
#X connect 23 1 0 0;
-#X connect 25 0 11 0;
-#X connect 25 2 22 0;
-#X connect 26 0 12 0;
-#X connect 26 0 25 0;
+#X connect 25 0 12 0;
+#X connect 25 0 32 0;
+#X connect 32 0 11 0;
+#X connect 32 0 33 0;
+#X connect 32 1 22 0;
+#X connect 33 0 34 0;
@@ -1,69 +1,73 @@
-#N canvas 448 51 756 544 10;
+#N canvas 446 51 756 644 10;
#X declare -lib zexy -lib purest_json;
-#X obj 156 36 rest-json;
-#X obj 188 462 dac~;
-#X obj 193 173 fifop;
-#X msg 349 111 stop;
-#X obj 195 382 *~ 0;
-#X msg 368 327 0;
-#X msg 406 329 1;
+#X obj 188 521 dac~;
+#X obj 193 232 fifop;
+#X msg 349 170 stop;
+#X obj 195 441 *~ 0;
+#X msg 368 386 0;
+#X msg 406 388 1;
#X obj 12 99 print original-data;
-#X obj 193 288 phasor~ 100;
-#X obj 194 348 bp~ 200 5;
-#X obj 193 201 t f f;
-#X obj 253 146 metro 500;
-#X obj 193 314 -~ 0.5;
-#X obj 193 258 line \$1 20;
-#X obj 266 259 line \$1 20;
+#X obj 193 347 phasor~ 100;
+#X obj 194 407 bp~ 200 5;
+#X obj 193 260 t f f;
+#X obj 253 205 metro 500;
+#X obj 193 373 -~ 0.5;
+#X obj 193 317 line \$1 20;
+#X obj 266 318 line \$1 20;
#X msg 156 -44 GET http://api.scraperwiki.com/api/1.0/datastore/sqlite?format=jsondict&name=daily_bitcoin_prices&query=select%20datetime(Date%2C%20%22unixepoch%22)%20as%20date%2C%20USD%2C%20EUR%20from%20swdata
;
-#X obj 156 64 list trim;
-#X obj 156 90 route EUR USD;
-#X obj 253 91 spigot 1;
-#X obj 349 259 t b b b;
-#X obj 253 113 t b b b;
-#X msg 348 50 0;
-#X msg 388 50 1;
-#X text 392 84 start metro only once \, as each json object from the
+#X obj 156 123 list trim;
+#X obj 156 149 route EUR USD;
+#X obj 253 150 spigot 1;
+#X obj 349 318 t b b b;
+#X obj 253 172 t b b b;
+#X msg 348 109 0;
+#X msg 388 109 1;
+#X text 392 143 start metro only once \, as each json object from the
array outputs a bang at the right outlet of rest-json;
-#X text 400 171 use a fifo buffer for the values (from zexy);
-#X obj 266 232 * 20;
-#X obj 193 230 * 10;
-#X obj 19 241 import zexy purest_json;
-#X obj 196 406 *~ 0;
-#X obj 492 242 vsl 15 128 0 1 0 0 empty empty volume 0 -9 0 10 -262144
+#X text 400 230 use a fifo buffer for the values (from zexy);
+#X obj 266 291 * 20;
+#X obj 193 289 * 10;
+#X obj 19 300 import zexy purest_json;
+#X obj 196 465 *~ 0;
+#X obj 492 301 vsl 15 128 0 1 0 0 empty empty volume 0 -9 0 10 -262144
-1 -1 0 1;
-#X connect 0 0 7 0;
-#X connect 0 0 16 0;
-#X connect 0 1 18 0;
+#X obj 156 36 rest;
+#X obj 156 71 json-decode;
+#X obj 31 183 print decoded-data;
+#X connect 1 0 9 0;
+#X connect 1 1 18 0;
#X connect 2 0 10 0;
-#X connect 2 1 19 0;
-#X connect 3 0 11 0;
-#X connect 4 0 28 0;
-#X connect 5 0 4 1;
-#X connect 6 0 4 1;
-#X connect 8 0 12 0;
-#X connect 9 0 4 0;
-#X connect 10 0 26 0;
-#X connect 10 1 25 0;
-#X connect 11 0 2 0;
-#X connect 12 0 9 0;
-#X connect 13 0 8 0;
-#X connect 14 0 9 1;
-#X connect 15 0 0 0;
-#X connect 16 0 17 0;
-#X connect 17 1 2 0;
-#X connect 18 0 20 0;
-#X connect 19 0 3 0;
+#X connect 3 0 27 0;
+#X connect 4 0 3 1;
+#X connect 5 0 3 1;
+#X connect 7 0 11 0;
+#X connect 8 0 3 0;
+#X connect 9 0 25 0;
+#X connect 9 1 24 0;
+#X connect 10 0 1 0;
+#X connect 11 0 8 0;
+#X connect 12 0 7 0;
+#X connect 13 0 8 1;
+#X connect 14 0 29 0;
+#X connect 15 0 16 0;
+#X connect 16 1 1 0;
+#X connect 17 0 19 0;
+#X connect 18 0 2 0;
+#X connect 18 1 4 0;
+#X connect 18 2 21 0;
+#X connect 19 0 10 0;
#X connect 19 1 5 0;
-#X connect 19 2 22 0;
-#X connect 20 0 11 0;
-#X connect 20 1 6 0;
-#X connect 20 2 21 0;
-#X connect 21 0 18 1;
-#X connect 22 0 18 1;
-#X connect 25 0 14 0;
-#X connect 26 0 13 0;
-#X connect 28 0 1 1;
-#X connect 28 0 1 0;
-#X connect 29 0 28 1;
+#X connect 19 2 20 0;
+#X connect 20 0 17 1;
+#X connect 21 0 17 1;
+#X connect 24 0 13 0;
+#X connect 25 0 12 0;
+#X connect 27 0 0 1;
+#X connect 27 0 0 0;
+#X connect 28 0 27 1;
+#X connect 29 0 6 0;
+#X connect 29 0 30 0;
+#X connect 30 0 15 0;
+#X connect 30 0 31 0;
+#X connect 30 1 17 0;
@@ -1,21 +1,20 @@
-#N canvas 434 51 756 544 10;
+#N canvas 432 51 756 544 10;
#X declare -lib gem -lib purest_json;
-#X obj 156 85 rest-json;
#X obj 12 148 print original-data;
-#X obj 156 113 list trim;
+#X obj 156 126 list trim;
#X msg 156 51 GET http://search.twitter.com/search.json?q=%23puredata
;
-#X obj 156 142 route results;
-#X obj 156 169 l2s;
-#X obj 156 192 json-decode;
+#X obj 156 155 route results;
+#X obj 156 182 l2s;
+#X obj 156 205 json-decode;
#X obj 50 228 print results;
-#X obj 156 218 list trim;
-#X obj 156 275 l2s;
-#X obj 214 276 l2s;
-#X obj 123 307 symbol;
-#X obj 169 334 pack s s;
+#X obj 156 231 list trim;
+#X obj 156 288 l2s;
+#X obj 214 289 l2s;
+#X obj 123 320 symbol;
+#X obj 169 347 pack s s;
#X obj 53 371 print packed;
-#X obj 156 242 route from_user text;
+#X obj 156 255 route from_user text;
#X obj 487 231 gemwin;
#X obj 487 122 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
@@ -39,35 +38,38 @@
;
#X obj 343 367 t b a;
#X obj 528 46 import gem purest_json;
-#X connect 0 0 1 0;
-#X connect 0 0 2 0;
-#X connect 2 0 4 0;
-#X connect 3 0 0 0;
+#X obj 156 78 rest;
+#X obj 156 102 json-decode;
+#X connect 1 0 3 0;
+#X connect 2 0 34 0;
+#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
-#X connect 6 0 7 0;
-#X connect 6 0 8 0;
-#X connect 6 1 11 0;
-#X connect 8 0 14 0;
+#X connect 5 0 7 0;
+#X connect 5 1 10 0;
+#X connect 7 0 13 0;
+#X connect 8 0 10 1;
#X connect 9 0 11 1;
-#X connect 10 0 12 1;
+#X connect 10 0 11 0;
#X connect 11 0 12 0;
-#X connect 12 0 13 0;
-#X connect 12 0 21 0;
-#X connect 14 0 9 0;
-#X connect 14 1 10 0;
-#X connect 16 0 18 0;
-#X connect 17 0 15 0;
-#X connect 18 0 15 0;
-#X connect 18 1 17 0;
-#X connect 20 0 19 0;
-#X connect 21 0 26 1;
-#X connect 22 0 28 0;
-#X connect 23 0 33 0;
+#X connect 11 0 20 0;
+#X connect 13 0 8 0;
+#X connect 13 1 9 0;
+#X connect 15 0 17 0;
+#X connect 16 0 14 0;
+#X connect 17 0 14 0;
+#X connect 17 1 16 0;
+#X connect 19 0 18 0;
+#X connect 20 0 25 1;
+#X connect 21 0 27 0;
+#X connect 22 0 32 0;
+#X connect 23 0 22 0;
#X connect 24 0 23 0;
-#X connect 25 0 24 0;
-#X connect 26 0 20 0;
-#X connect 27 0 26 0;
-#X connect 28 0 19 0;
-#X connect 33 0 27 0;
-#X connect 33 1 19 0;
+#X connect 25 0 19 0;
+#X connect 26 0 25 0;
+#X connect 27 0 18 0;
+#X connect 32 0 26 0;
+#X connect 32 1 18 0;
+#X connect 34 0 0 0;
+#X connect 34 0 35 0;
+#X connect 35 0 1 0;
View
@@ -6,7 +6,7 @@
static t_class *json_decode_class;
-void json0x2ddecode_setup(void) {
+void setup_json0x2ddecode(void) {
json_decode_class = class_new(gensym("json-decode"), (t_newmethod)json_decode_new,
0, sizeof(t_json_decode), 0, A_GIMME, 0);
class_addsymbol(json_decode_class, (t_method)json_decode_string);
Oops, something went wrong.

0 comments on commit 3872a38

Please sign in to comment.