interpret string max size

View: New views
3 Messages — Rating Filter:   Alert me  

interpret string max size

by Fredrik Olofsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

help,
i have problems with .interpret.  do any one have a workaround for  
strings longer that 8192 chars?

(
        var size= 100;
        var dict;
        var str= "('test' :"+($r.dup(size).join).quote+")";
        str.postln;
        dict= str.interpret;
        size-dict['test'].size
)
(
        var size= 8000;
        var dict;
        var str= "('test' :"+($r.dup(size).join).quote+")";
        str.postln;
        dict= str.interpret;
        size-dict['test'].size
)
(
        var size= 8192; //over maximum
        var dict;
        var str= "('test' :"+($r.dup(size).join).quote+")";
        str.postln;
        dict= str.interpret;
        size-dict['test'].size
)


related thread...
http://www.listarc.bham.ac.uk/lists/sc-users-2007/msg06289.html



   #|
      fredrikolofsson.com     klippav.org     musicalfieldsforever.com
   |#


_______________________________________________
sc-users mailing list

info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Re: interpret string max size

by thor-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Fredrik.

I can't remember how I solved my problem but I suspect it was rounding all those
floats I was using .round(0.002) so the setting could be interpreted.

But this is obviously a problem.

Also, I was testing your code and I realise that the dict is an Event and not a String
(probably because of the 'test') and it behaves differently. (allows for less characters
to be interpreted??). 

(
var size= 29952; //over maximum
var dict;
var str= "('test' :"+($r.dup(size).join).quote+")";
dict= str.interpret;
Post << dict;
dict.size.postln;
dict.class.postln; // Event
dict = dict.asString;
dict.size.postln;
dict.class
)


(
var size= 29952; //over maximum
var dict;
var str= "("+($r.dup(size).join).quote+")";
dict= str.interpret;
Post << dict;
dict.size.postln;
dict.class.postln; // String
dict = dict.asString;
dict.size.postln;
dict.class
)


So no workaround here, but just an observation.
thor



On 9 Jul 2008, at 11:23, Fredrik Olofsson wrote:

help,
i have problems with .interpret.  do any one have a workaround for strings longer that 8192 chars?

(
var size= 100;
var dict;
var str= "('test' :"+($r.dup(size).join).quote+")";
str.postln;
dict= str.interpret;
size-dict['test'].size
)
(
var size= 8000;
var dict;
var str= "('test' :"+($r.dup(size).join).quote+")";
str.postln;
dict= str.interpret;
size-dict['test'].size
)
(
var size= 8192; //over maximum
var dict;
var str= "('test' :"+($r.dup(size).join).quote+")";
str.postln;
dict= str.interpret;
size-dict['test'].size
)


related thread...



  #|
     fredrikolofsson.com     klippav.org     musicalfieldsforever.com
  |#


_______________________________________________
sc-users mailing list



Re: interpret string max size

by Fredrik Olofsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi Thor,
thanks but rounding won't help as this is a string with ascii data.
and the dictionary/event was there in my code on purpose.  but you're  
right, could have been a string also.  doesn't matter.  the same  
problems occur.

one ugly hack could be to analyse the string(s) start/end points, cut  
them in half and add ++ signs in between.  but i'm not going to do  
this - too rough.
(
        var size= 8192; //over maximum
        var dict;
        var str= "('test' :"+($r.dup(size).join).quote+")";
        //ugly hackaround. could be made smarter analysing where the string  
begins/ends and cut in to - also do this recursivly until less than  
8192 chars
        if(str.size>8000, { //threshold to split string
                str= str.copyFromStart(4000)++"\"++\""++str.copyToEnd(4001);
        });
        dict= str.interpret;
        dict['test'].postln;
        size-dict['test'].size
)


_f

9 jul 2008 kl. 21.42 skrev thor:

>
> Hi Fredrik.
>
> I can't remember how I solved my problem but I suspect it was  
> rounding all those
> floats I was using .round(0.002) so the setting could be interpreted.
>
> But this is obviously a problem.
>
> Also, I was testing your code and I realise that the dict is an  
> Event and not a String
> (probably because of the 'test') and it behaves differently.  
> (allows for less characters
> to be interpreted??).
>
> (
> var size= 29952; //over maximum
> var dict;
> var str= "('test' :"+($r.dup(size).join).quote+")";
> dict= str.interpret;
> Post << dict;
> dict.size.postln;
> dict.class.postln; // Event
> dict = dict.asString;
> dict.size.postln;
> dict.class
> )
>
>
> (
> var size= 29952; //over maximum
> var dict;
> var str= "("+($r.dup(size).join).quote+")";
> dict= str.interpret;
> Post << dict;
> dict.size.postln;
> dict.class.postln; // String
> dict = dict.asString;
> dict.size.postln;
> dict.class
> )
>
>
> So no workaround here, but just an observation.
> thor
>
>
>
> On 9 Jul 2008, at 11:23, Fredrik Olofsson wrote:
>
>> help,
>> i have problems with .interpret.  do any one have a workaround for  
>> strings longer that 8192 chars?
>>
>> (
>> var size= 100;
>> var dict;
>> var str= "('test' :"+($r.dup(size).join).quote+")";
>> str.postln;
>> dict= str.interpret;
>> size-dict['test'].size
>> )
>> (
>> var size= 8000;
>> var dict;
>> var str= "('test' :"+($r.dup(size).join).quote+")";
>> str.postln;
>> dict= str.interpret;
>> size-dict['test'].size
>> )
>> (
>> var size= 8192; //over maximum
>> var dict;
>> var str= "('test' :"+($r.dup(size).join).quote+")";
>> str.postln;
>> dict= str.interpret;
>> size-dict['test'].size
>> )
>>
>>
>> related thread...
>> http://www.listarc.bham.ac.uk/lists/sc-users-2007/msg06289.html

   #|
      fredrikolofsson.com     klippav.org     musicalfieldsforever.com
   |#


_______________________________________________
sc-users mailing list

info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
LightInTheBox - Buy quality products at wholesale price