Raised This Month: $12 Target: $400
 3% 

clientprefs cookie size limited?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PersianMG
Member
Join Date: Dec 2014
Old 06-28-2015 , 06:56   clientprefs cookie size limited?
Reply With Quote #1

So I'm exporting a list of floats to a list, separated by a ';' as a cookie.

Example output:
-1.000000;0.899999;-1.000000;-1.000000;-1.000000;-1.000000;-1.000000;-1.000000;-1.000000;-1.000000;

Issue is I need to do this for like 50 floats but it seems like the cookie string is limited to 100 bytes (100 characters). Is this actually a limitation or am I doing something wrong?

If so is my only option to split up everything into 100 byte strings and save each and every one as a cookie?
PersianMG is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 06-28-2015 , 08:39   Re: clientprefs cookie size limited?
Reply With Quote #2

I wouldn't call it a limitation but yes, cookie values can only have a maximum of 100 chars. I suggest you use the dbi api instead of cookies for this. What are those floats used for?
__________________

Last edited by Impact123; 06-28-2015 at 08:44.
Impact123 is offline
PersianMG
Member
Join Date: Dec 2014
Old 06-28-2015 , 09:37   Re: clientprefs cookie size limited?
Reply With Quote #3

Quote:
Originally Posted by Impact123 View Post
I wouldn't call it a limitation but yes, cookie values can only have a maximum of 100 chars. I suggest you use the dbi api instead of cookies for this. What are those floats used for?
Ah okay. Already went ahead and split up the cookies so no no worries :p
PersianMG is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 06-28-2015 , 11:33   Re: clientprefs cookie size limited?
Reply With Quote #4

Alternately, if you dont need the full precision, you could truncate the text through formatting.

e.g. %5.1f instead of %f would truncate it to 5 characters max, with only 1 after the decimal. In your case, 1 appears to be the max, so maybe %5.3f (I seem to recall it counts the decimal, so that would be 5 char: 0.345). Alternately, a less-recommended method would be to round it.
__________________

Last edited by ThatOneGuy; 06-28-2015 at 11:34.
ThatOneGuy is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 06-28-2015 , 17:17   Re: clientprefs cookie size limited?
Reply With Quote #5

I still like to know what you use those floats for. I'm sure these is a better way to store them.
__________________

Last edited by Impact123; 06-28-2015 at 17:18.
Impact123 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode