Forums > MaxMSP

clearing the coll and replacing the content of it

December 26, 2007 | 11:33 pm

I have the coll object taking a list of numbers (stocks). when I send a message to change the stocks (to use a differnt list of stocks), I want the old content i cleared and that the new content gets in. However, when i start with a list of 65 stocks, i change the list (by sending a message to another object that gets the numbers from the internet), and in the new list there are only 30 stocks. However, the coll object still gives 65 stocks. How can i change the coll-content to just keep 30 stocks there?


December 26, 2007 | 11:56 pm

id assume clear is what you want, but without a patch one only can
guess.
On Dec 26, 2007, at 6:33 PM, Samuel Van Ransbeeck wrote:

>
> I have the coll object taking a list of numbers (stocks). when I
> send a message to change the stocks (to use a differnt list of
> stocks), I want the old content i cleared and that the new content
> gets in. However, when i start with a list of 65 stocks, i change
> the list (by sending a message to another object that gets the
> numbers from the internet), and in the new list there are only 30
> stocks. However, the coll object still gives 65 stocks. How can i
> change the coll-content to just keep 30 stocks there?


December 27, 2007 | 12:05 am

At 4:33 PM -0700 12/26/07, Samuel Van Ransbeeck wrote:
>I have the coll object taking a list of numbers (stocks). when I send a message to change the stocks (to use a differnt list of stocks), I want the old content i cleared and that the new content gets in. However, when i start with a list of 65 stocks, i change the list (by sending a message to another object that gets the numbers from the internet), and in the new list there are only 30 stocks. However, the coll object still gives 65 stocks. How can i change the coll-content to just keep 30 stocks there?

The "clear" message to coll, which gets rid of the previous contents, is documented in the help file as well as the other documentation. But that said, you may be better served by using the refer message to have one coll instance refer to data stored in other coll instances.

-C


Chris Muir | "There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue." – Brian Eno


December 27, 2007 | 12:06 am

here you go

max v2;
#N vpatcher 226 44 1785 918;
#P window setfont "Andale Mono" 9.;
#P flonum 914 770 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 904 740 60 465436681 fromsymbol;
#P newex 907 708 50 465436681 zl nth 2;
#P user lcd 100 42 1002 43 1 1 0 0 0;
#P number 105 697 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 971 497 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 971 479 18 465436681 50;
#P button 971 461 15 0;
#P window linecount 7;
#P message 952 368 385 465436681 quotes ATVI ADBE AKAM ALTR AMZN AMGN AMLN APOL AAPL AMAT ADSK BIDU BEAS BBBY BIIB BRCM CHRW CDNS CELG CEPH CHKP CTAS CSCO CTXS CTSH CMCSA COST DELL XRAY DISCA EBAY DISH ERTS EXPE EXPD ESRX FAST FISV FLEX FMCN FWLT GRMN GENZ GILD GOOG HANS HSIC HOLX IACI INFY INTC INTU ISRG JOYG JNPR KLAC LRCX LAMR LEAP LVLT LBTYA LINTA LLTC LOGI MRVL MCHP MSFT MICC MNST NTAP NIHD NVDA ORCL PCAR PDCO PAYX PETM QCOM RIMM RYAAY SNDK SHLD SIAL SIRI SPLS SBUX STLD SRCL JAVA SYMC TLAB TEVA UAUA VRSN VRTX VMED WFM WYNN XLNX YHOO;
#P number 789 346 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 789 328 18 465436681 15;
#P button 789 310 15 0;
#P message 749 284 310 465436681 quotes AES AEP CNP ED D DUK EIX EXC FPL FE NI PCG PEG SO WMB;
#P number 695 325 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 701 305 18 465436681 65;
#P button 705 284 15 0;
#P number 886 207 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 892 187 18 465436681 20;
#P button 896 166 15 0;
#P number 1027 190 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 1033 170 18 465436681 30;
#P button 1037 149 15 0;
#P number 506 567 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 4;
#P message 638 235 345 465436681 quotes MMM AES AA ALEX MO AEP AIG AXP AMR T BA BNI CAT CNP CHRW C CNW KO ED CAL CSX D DUK EIX DD EXC EXPD XOM FDX FE GMT GE GM HPQ HD HON INTC IBM JBHT JBLU JPM JNJ LSTR MCD MRK MFT NI NSC OSG PFE PCG PG PEG R SO LUV TXU UNP UPS UTX VZ WMT DIS WMB YRCW;
#P window linecount 2;
#P comment 996 248 100 465436681 Dow Jones Composite Average (65);
#P window linecount 1;
#N vpatcher 150 62 750 462;
#P outlet 217 133 15 0;
#P inlet 60 33 15 0;
#P window setfont "Andale Mono" 9.;
#P window linecount 1;
#P newex 264 69 35 465436681 float;
#P newex 75 118 35 465436681 * 0.5;
#P number 75 138 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 60 64 185 465436681 if $f1 > 127 then $f1 else out2 $f1;
#P window linecount 3;
#P comment 318 60 100 465436681 makes the values fal between midi limits;
#P fasten 4 0 1 0 269 93 308 93 308 59 65 59;
#P connect 5 0 1 0;
#P connect 1 0 3 0;
#P connect 3 0 2 0;
#P connect 1 1 6 0;
#P connect 2 0 4 0;
#P pop;
#P newobj 282 662 80 465436681 p make smaller;
#N coll quotes;
#P newobj 190 704 65 465436681 coll quotes;
#P newex 190 685 55 465436681 pack 0 0.;
#N counter 0 1 65;
#X flags 0 0;
#P newobj 190 661 80 465436681 counter 0 1 65;
#P newex 190 642 35 465436681 t b f;
#P button 531 692 15 0;
#N vpatcher 150 62 750 462;
#P outlet 217 133 15 0;
#P inlet 60 33 15 0;
#P window setfont "Andale Mono" 9.;
#P window linecount 1;
#P newex 264 69 35 465436681 float;
#P newex 75 118 35 465436681 * 0.5;
#P number 75 138 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 60 64 185 465436681 if $f1 > 127 then $f1 else out2 $f1;
#P window linecount 3;
#P comment 318 60 100 465436681 makes the values fal between midi limits;
#P connect 5 0 1 0;
#P fasten 4 0 1 0 269 93 308 93 308 59 65 59;
#P connect 1 0 3 0;
#P connect 3 0 2 0;
#P connect 1 1 6 0;
#P connect 2 0 4 0;
#P pop;
#P newobj 106 661 80 465436681 p make smaller;
#P window linecount 2;
#P message 665 133 235 465436681 quotes ALEX AMR BNI CHRW CNW CAL CSX EXPD FDX GMT JBHT JBLU LSTR NSC OSG R LUV UNP UPS YCRW;
#P message 665 102 300 465436681 quotes MMM AA MO AXP AIG T BA CAT C KO DD XOM GE GM HPQ HD HON INTC IBM JNJ JPM MCD MRK MSFT PFE PG UTX VZ WMT DIS;
#P window linecount 1;
#N vpatcher 347 81 1680 576;
#P outlet 277 249 15 0;
#P outlet 252 249 15 0;
#P outlet 227 249 15 0;
#P outlet 202 249 15 0;
#P outlet 177 249 15 0;
#P outlet 152 249 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 576 182 84 196617 -0.12;
#P newex 576 153 61 196617 prepend set;
#P window setfont "Andale Mono" 9.;
#P newex 576 125 50 465436681 zl nth 5;
#P newex 399 153 60 465436681 fromsymbol;
#P flonum 399 184 68 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P message 479 182 84 196617 11/23/2007;
#P newex 479 153 61 196617 prepend set;
#P window setfont "Andale Mono" 9.;
#P newex 479 125 50 465436681 zl nth 3;
#P newex 399 124 50 465436681 zl nth 2;
#P window setfont "Sans Serif" 9.;
#P message 302 183 84 196617 -0.43;
#P newex 302 154 61 196617 prepend set;
#P window setfont "Andale Mono" 9.;
#P newex 302 126 50 465436681 zl nth 5;
#P newex 125 154 60 465436681 fromsymbol;
#P flonum 125 185 68 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P message 205 183 84 196617 12/26/2007;
#P newex 205 154 61 196617 prepend set;
#P window setfont "Andale Mono" 9.;
#P newex 205 126 50 465436681 zl nth 3;
#P newex 125 125 50 465436681 zl nth 2;
#P inlet 297 72 15 0;
#P inlet 272 72 15 0;
#P inlet 247 72 15 0;
#P inlet 222 72 15 0;
#P inlet 197 72 15 0;
#P inlet 172 72 15 0;
#P connect 0 0 6 0;
#P connect 6 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 24 0;
#P connect 9 0 25 0;
#P connect 14 0 26 0;
#P connect 1 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 9 0;
#P connect 19 0 27 0;
#P connect 18 0 28 0;
#P connect 23 0 29 0;
#P connect 2 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 14 0;
#P connect 3 0 15 0;
#P connect 15 0 20 0;
#P connect 20 0 19 0;
#P connect 4 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 18 0;
#P connect 5 0 21 0;
#P connect 21 0 22 0;
#P connect 22 0 23 0;
#P pop 1;
#P newobj 158 550 79 465436681 p sender;
#P toggle 445 573 18 0;
#P newex 445 642 55 465436681 metro 200;
#N counter 0 1 65;
#X flags 0 0;
#P newobj 445 661 80 465436681 counter 0 1 65;
#N coll quotes;
#P newobj 14 704 65 465436681 coll quotes;
#P newex 14 685 55 465436681 pack 0 0.;
#N counter 0 1 65;
#X flags 0 0;
#P newobj 14 660 80 465436681 counter 0 1 65;
#P window setfont "Sans Serif" 9.;
#P message 496 318 61 196617 viewsource;
#P number 682 369 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 682 390 60 196617 interval $1;
#P number 632 370 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 632 391 42 196617 size $1;
#P window linecount 2;
#P comment 599 197 135 196617 refresh interval in seconds (be considerate);
#P window linecount 1;
#P hidden newex 400 369 30 196617 t 0 s;
#P hidden newex 392 345 30 196617 t 1 b;
#P newex 394 452 30 196617 spell;
#P newex 149 389 82 196617 route BEGIN END;
#P newex 438 387 62 196617 prepend add;
#P message 575 387 32 196617 clear;
#P hidden newex 407 501 45 196617 loadbang;
#P message 407 532 201 196617 brgb 0 0 0 , frgb 64 255 0 , font Courier 25;
#P newex 516 441 20 196617 t b;
#P newex 516 463 58 196617 onebang;
#P newex 348 474 68 196617 prepend ascii;
#P message 516 490 95 196617 clear , moveto 0 25;
#P hidden toggle 407 393 15 0;
#P newex 475 421 320 196617 mxj StringScroller @loop 2 @charmode 1 @size 1024 @interval 150;
#P newex 742 371 31 196617 print;
#P number 534 184 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 534 207 60 196617 interval $1;
#P message 396 185 32 196617 clear;
#P message 408 323 27 196617 stop;
#P button 392 323 15 0;
#P newex 259 334 319 196617 mxj StockWatch @quotes SUNW AAPL INTC GTRC EBAY @interval 30;
#P comment 429 186 100 196617 remove all quotes;
#P comment 289 299 100 196617 bang to start;
#P window setfont "Andale Mono" 9.;
#P window linecount 3;
#P comment 245 557 100 465436681 sends out all the values of the stocks;
#P window linecount 1;
#P comment 971 103 100 465436681 DJ industrial;
#P comment 916 134 100 465436681 DJ transport;
#P window linecount 3;
#P comment 284 682 100 465436681 makes the values fal between midi limits;
#P window linecount 1;
#P comment 977 304 100 465436681 DJ utility;
#P fasten 53 0 34 0 1042 610 19 610;
#P connect 34 0 35 0;
#P fasten 53 0 36 0 1042 530 19 530;
#P fasten 38 0 36 0 450 681 19 681;
#P connect 35 0 36 0;
#P fasten 37 0 36 0 450 680 19 680;
#P fasten 43 0 35 1 111 681 64 681;
#P fasten 55 0 34 4 1032 228 87 228;
#P connect 17 0 71 0;
#P connect 20 0 71 0;
#P connect 16 0 71 0;
#P fasten 34 0 70 0 19 681 110 681;
#P fasten 40 0 43 0 163 589 111 589;
#P fasten 7 0 24 0 264 370 154 370;
#P fasten 24 2 40 0 226 478 163 478;
#P fasten 24 2 40 1 226 478 176 478;
#P fasten 24 2 40 2 226 478 189 478;
#P fasten 40 2 45 0 189 579 195 579;
#P fasten 45 0 46 0 195 659 195 659;
#P fasten 46 0 47 0 195 681 195 681;
#P fasten 53 0 48 0 1042 530 195 530;
#P fasten 38 0 48 0 450 681 195 681;
#P fasten 47 0 48 0 195 702 195 702;
#P fasten 49 0 47 1 287 681 240 681;
#P fasten 55 0 46 4 1032 611 263 611;
#P fasten 33 0 7 0 501 337 264 337;
#P fasten 11 0 7 0 539 278 264 278;
#P fasten 10 0 7 0 401 267 264 267;
#P hidden connect 27 1 7 0;
#P hidden connect 26 1 7 0;
#P fasten 51 0 7 0 643 292 264 292;
#P fasten 41 0 7 0 670 230 264 230;
#P fasten 42 0 7 0 670 289 264 289;
#P fasten 62 0 7 0 754 316 264 316;
#P connect 66 0 7 0;
#P fasten 40 2 49 0 189 610 287 610;
#P fasten 25 0 17 0 399 471 353 471;
#P hidden fasten 8 0 26 0 397 341 397 341;
#P fasten 14 0 25 0 480 445 399 445;
#P hidden fasten 9 0 27 0 413 368 405 368;
#P hidden fasten 27 0 15 0 405 389 412 389;
#P hidden fasten 26 0 15 0 397 392 412 392;
#P hidden fasten 21 0 20 0 412 525 412 525;
#P fasten 24 2 23 0 226 382 443 382;
#P fasten 39 0 38 0 450 592 450 592;
#P fasten 38 0 37 0 450 659 450 659;
#P fasten 31 0 14 0 687 413 480 413;
#P fasten 29 0 14 0 637 413 480 413;
#P fasten 22 0 14 0 580 411 480 411;
#P hidden fasten 15 0 14 0 412 414 480 414;
#P fasten 23 0 14 0 443 412 480 412;
#P fasten 52 0 38 1 511 586 495 586;
#P fasten 55 0 37 4 1032 611 518 611;
#P fasten 14 0 19 0 480 439 521 439;
#P fasten 19 0 18 0 521 460 521 460;
#P fasten 18 0 16 0 521 485 521 485;
#P fasten 37 3 44 0 519 684 536 684;
#P fasten 12 0 11 0 539 203 539 203;
#P fasten 14 1 18 1 635 450 569 450;
#P fasten 24 0 22 0 154 381 580 381;
#P fasten 30 0 29 0 637 388 637 388;
#P fasten 32 0 31 0 687 387 687 387;
#P fasten 60 0 61 0 706 322 700 322;
#P fasten 59 0 60 0 710 302 706 302;
#P fasten 51 0 59 0 643 281 710 281;
#P fasten 62 0 63 0 754 304 794 304;
#P fasten 63 0 64 0 794 326 794 326;
#P fasten 64 0 65 0 794 344 794 344;
#P fasten 57 0 58 0 897 204 891 204;
#P fasten 56 0 57 0 901 184 897 184;
#P fasten 42 0 56 0 670 161 901 161;
#P connect 72 0 73 0;
#P connect 73 0 74 0;
#P fasten 66 0 67 0 957 451 976 451;
#P fasten 67 0 68 0 976 477 976 477;
#P fasten 68 0 69 0 976 495 976 495;
#P connect 69 0 55 0;
#P connect 65 0 55 0;
#P connect 61 0 55 0;
#P connect 58 0 55 0;
#P fasten 54 0 55 0 1038 187 1032 187;
#P fasten 53 0 54 0 1042 167 1038 167;
#P connect 41 0 53 0;
#P pop;


December 27, 2007 | 2:16 am

I don’t have time to dissect this patch to figure out what your issue
with coll is, but I notice one thing that may be messing you up: In
the lower left, you have two colls named quotes that look like
they’re getting data written from different sources. Colls with the
same name share their data, so when you write to either one of them
you are writing to one shared collection of data.

-C


Chris Muir | "There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue." – Brian Eno


Viewing 5 posts - 1 through 5 (of 5 total)