inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Dec 7, 2014 11:34:32 GMT -8
I'm just about to start working with the new feature that allows us to push/set to super user keys that are not on the page, and I don't find the ProBoards API documentation helpful enough to suit my needs.
A few things I'd like to know are:
1) What happens if an attempt to push to a non-existent user happens? I'm guessing it will throw an error, but how do I check the error code?
2) Is it possible to check if a user actually exists before hand. (pretty sure I already know this is not possible)
3) Will pushing to the key overwrite new data like the set method? I've heard several times that it won't but the documentation does not state that so I just want to double check.
4) When would unsaved_changes actually return true? I'm guessing that it doesn't have anything to do with keys
4) Once I've gotten all this information how would I go about submitting it to ProBoards so that they can try to update the api documentation?
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 7, 2014 11:55:51 GMT -8
1. well you have to push using a user-id. so I guess if the id doesnt exist, it will return an error (which you can trap). 2. not in any way that is allowed. but feature requests are there for the making. 3. pushing to a key will append to the array. key already HAS to be an array type otherwise it will return an error. to delete from the array, you have to scan its contents then SET it again if the victim is in the middle, if at one of the ends, you can do unshift or pop 4. unsaved_changes I believe has to do with the proboards forms (like edit profile). returning true if any of the fields has changed a value 4 again. you have to tag Tim Camara in order for him to see changes need to be made
|
|
inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Dec 9, 2014 12:45:56 GMT -8
Wormopolis, well, that clears things up nicely. Thanks, I'll tag Tim if I come up with helpful information besides the stuff you already said. Heh, apparently I don't know how to count.
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Dec 9, 2014 17:11:56 GMT -8
4) When would unsaved_changes actually return true? I'm guessing that it doesn't have anything to do with keys 4) Once I've gotten all this information how would I go about submitting it to ProBoards so that they can try to update the api documentation? 4) The variable behind the API version of unsaved_changes at this point just gets incremented when an AJAX request is fired off to the server, and decremented when that AJAX request finishes, regardless of whether it returned a success or an error. 4) There's a long list of updates to the API page on my bigger list of changes to do. Unfortunately, as is typically the case these days, we have more feature requests than time. That being said, if you have specific things you'd like added, tag or PM me with them, and I'll do my best to add them in.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Dec 10, 2014 15:50:08 GMT -8
3. pushing to a key will append to the array. key already HAS to be an array type otherwise it will return an error. to delete from the array, you have to scan its contents then SET it again if the victim is in the middle, if at one of the ends, you can do unshift or pop I believe that using "set" would defeat the purpose of why these additional key operations were introduced. The pop/shift ops have a num_items option that can be used to remove multiple entries in a single call and the push has a values (with an "s") option to add multiple values back so a removal for a middle dweller would take two ops until a slice/splice op is added and would avoid overwriting data that someone else may have written to that key just seconds before you.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 11, 2014 1:51:57 GMT -8
I thought in the interest of conserving ajax calls, doing a set would cost less then a pop-then-push. otherwise I agree with you.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Dec 11, 2014 5:47:59 GMT -8
Slap a postage stamp on that bad boy and send it snail mail then if you want to conserve calls It was the network collision problem that prompted these new operations to be created in the first place: one page loads with the key data as it is represented at that point in time then waits for user action before setting a new key value. A second user in another browser on another page goes through the same process but the second user is more decisive and performs the necessary actions quickly and her key data gets sent off. The first user finally finishes and his key data gets sent off and promptly overwrites the key data that was just updated by the other user. If this scenario does not sufficiently plant a seed of doubt or even fear in your heart then I appeal to that respectable ideal of conservation and beg you to consider the wasted resource prompted by this decision when users flood all avenues for redressing grievances available to them demanding to know why the action they just performed didn't seem to have been successful. It would probably have been more humane and inline with the conservative ideal to just send off that second baby seal and let it find its mother on its own and not disrupt the ecosystem.
|
|
inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Dec 11, 2014 6:29:40 GMT -8
Chris, well now I'm really happy, this just turned out to make my life a lot easier. Thanks a million for that little bit of information.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 11, 2014 12:27:17 GMT -8
Slap a postage stamp on that bad boy and send it snail mail then if you want to conserve calls It was the network collision problem that prompted these new operations to be created in the first place: one page loads with the key data as it is represented at that point in time then waits for user action before setting a new key value. A second user in another browser on another page goes through the same process but the second user is more decisive and performs the necessary actions quickly and her key data gets sent off. The first user finally finishes and his key data gets sent off and promptly overwrites the key data that was just updated by the other user. If this scenario does not sufficiently plant a seed of doubt or even fear in your heart then I appeal to that respectable ideal of conservation and beg you to consider the wasted resource prompted by this decision when users flood all avenues for redressing grievances available to them demanding to know why the action they just performed didn't seem to have been successful. It would probably have been more humane and inline with the conservative ideal to just send off that second baby seal and let it find its mother on its own and not disrupt the ecosystem. in actuality, the collision problem could still exist. if you have one user pop 5 values off the array, and a second user pop values off an array, then each make their changes and push back, the array could end up with double entries
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Dec 11, 2014 13:46:10 GMT -8
That shouldn't be much of a problem since you're no longer losing data just gaining, and Proboards might have thought of that as well. There is a utility in jquery named $.unique() that is used to to remove duplicate DOM elements from jquery arrays but is not recommended for use on arrays not containing DOM elements but it appears Proboards has added their own solution (at least I assume it is Proboards) named $.unique_array() and it returns consistent results keeping the first and removing subsequent dupes: $.unique_array([1,2,3,4,2,6,7,2,2,4]). With that in mind you either prefer the unshift-pop combo or do a reverse before un-duping so you end up with the most recent entries
What makes the array key methods work is the fact that the order of entries is meaningless, any client can add to the recent end and do housekeeping by pruning from the older entries end, only the fact that it exists in the array should mean anything and that makes $.unique_array perfect for that situation. Pruning would eventually get rid of dupes.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 11, 2014 13:49:28 GMT -8
I had been putting some of that aleady into hashcloud, so I guess we wait to see if anyone notices weirdness.
|
|
inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Dec 23, 2014 18:06:23 GMT -8
Wormopolis, does a pop/shift preform an ajax call? (I'm not sure whether those were the right function names, but basically do the functions that remove the first/last value in the array preform an ajax call to get the newest data? Or is it just whatever data is currently loaded on the page?
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 23, 2014 21:47:50 GMT -8
I have been under the assumption that a pop/push/shift/unshift/set actually changes the key value, and therefore does an ajax call. get is the only command that just grabs from the currently loaded object. but I could be wrong. one way to tell, is have console open and execute one of those commands. the console will actually show the ajax call happening
|
|
inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Dec 24, 2014 4:38:25 GMT -8
Okay, yeah, I thought about that after I asked the question. I went and checked and I see a POST call but that's it, so I'm guessing that means it doesn't obtain any new data, because that would be a GET right?
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 24, 2014 11:03:14 GMT -8
POST means it sent a request to the server.
|
|