Author Topic: User Notes Whitespace  (Read 912 times)

0 Members and 1 Guest are viewing this topic.

Offline raybob

  • Insane poster
  • *****
  • Posts: 439
    • View Profile
    • FileSplat.com
User Notes Whitespace
« on: March 18, 2012, 10:40:56 PM »
Constant use of {.set account|n|notes key=a=b.} seems to fill up the user notes with huge amounts of whitespace.

Can someone else see if this happens to them also?

Offline Roessi

  • Tireless poster
  • ****
  • Posts: 107
    • ICQ Messenger - 314780875
    • View Profile
    • Email
Re: User Notes Whitespace
« Reply #1 on: March 19, 2012, 06:46:24 AM »
Yea i checked that and experienced the same problem, for every call a whitespace is added,

You can trim all the existing out by using

Code: [Select]
{.set account|$1|notes={.decodeuri|{.replace|%0A%0D||{.encodeuri|{.trim|{.get account|$1|notes.}.}.}.}.}.}

and to avoid it u have to set the entire notes again, but trimmed
ieither by adding a line after every call or adding an alias and using it instead , like :

Code: [Select]
[special:alias|private]
addnote={.set account|$1|notes key=$2=$3.}{.set account|$1|notes={.trim|{.get account|$1|notes.}.}.}

Offline raybob

  • Insane poster
  • *****
  • Posts: 439
    • View Profile
    • FileSplat.com
Re: User Notes Whitespace
« Reply #2 on: March 19, 2012, 07:34:13 PM »
Very nice!!  That works perfectly for removing whitespace.  I just put it in my sign in and sign out scripts so it's done once in a while for each account and will keep hfs.ini from expanding exponentially.  

I created my own ^notes function which is simpler to use and put your function in there so that my notes are always nice and tidy  ;)
« Last Edit: March 21, 2012, 08:09:14 PM by raybob »

Offline rejetto

  • Administrator
  • Insane programmer
  • *
  • Posts: 12440
    • View Profile
Re: User Notes Whitespace
« Reply #3 on: April 03, 2012, 03:54:46 PM »
the bug is clearly in this line
replace(s, val, i, findEOL(s,i));

in file utillib.pas:2740
sadly i cannot compile HFS at the moment, i will just put this in the to-do list.

Offline raybob

  • Insane poster
  • *****
  • Posts: 439
    • View Profile
    • FileSplat.com
Re: User Notes Whitespace
« Reply #4 on: April 05, 2012, 10:25:32 PM »
Glad you figured it out.  Here's the function I'm using:

Code: [Select]
{.set|notes|{:{.if|$3|{:{.set account|$1|notes key=$2=$3.}{.set account|$1|notes={.decodeuri|{.replace|%0A%0D||{.encodeuri|{.trim|{.get account|$1|notes.}.}.}.}.}.}:}.}{.if|{.and|$2|{.not|$3.}|{.not|$4.}.}|{:{.get account|$1|notes key=$2.}:}.}{.if|{.and|$2|{.not|$3.}|$4.}|{:{.set account|$1|notes={.decodeuri|{.replace|%0A%0D||{.encodeuri|{.trim|{.replace|$2={.^notes|$1|$2.}||{.get account|$1|notes.}.}.}.}.}.}.}:}.}:}.}

{.^notes|username|key.}            expands to its value
{.^notes|username|key|value.}    writes a new value
{.^notes|username|key||true.}    erases the key
« Last Edit: April 05, 2012, 10:27:12 PM by raybob »

Offline rejetto

  • Administrator
  • Insane programmer
  • *
  • Posts: 12440
    • View Profile
Re: User Notes Whitespace
« Reply #5 on: June 29, 2012, 06:25:30 PM »
fixed in #280