« first day    last day (27 days later) » 
00:00 - 20:0020:00 - 00:00

12:00 AM
np take your time ^^
 
check out my answer
i changed it
let me know if that works
 
what is the purchaseLockSlot.js file doing in there?
 
ignore that
i just copy and pasted an example
look at the answer here
 
oh you posted it on the site?
 
0
A: Parse, Set Data to User by ObjectID

DehliI think you'd do it this way. If it doesn't work, let me know. userQuery = new Parse.Query("User"); userQuery.equalTo("objectId", uniqueID); userQuery.first().then(function(user){ //Do stuff with user });

no
 
12:05 AM
oh I see
 
i just found an example
 
ok let me give that a try
 
kk
 
userQuery.first().then(function(user){
userQuery.set('money',20);
});
it says it's no a function
"Uncaught TypeError: undefined is not a function"
 
oh
you have to do
user.set
 
12:11 AM
hmm...no errors but nothing is being changed in the Data Browser
   here is my full code :
$('.btn').click(function(){
var query =  new Parse.Query(Parse.User);
     var userInput = $('#inputObject').val();
     query.equalTo("objectId", userInput);
     query.find({
       success: function(results) {
       	  console.log(results[0].get('objectId'));
          console.log("found a user..");
          var sendTo = userInput;
          userQuery = new Parse.Query("User");
          userQuery.equalTo("objectId", userInput);
          userQuery.first().then(function(user){
oh woops
userQuery.equalTo("objectId", userInput); // I already queried for the user
 
yeah
so then you can just do
userInput.set('money', 20)
right?
 
but the userInput = $('#inputObject').val();
so wouldn't it be query.set
this is confusing haha
uh
 
no
wait
sorry
results.set('money', 20)
 
ignore that sendTo (that was just a placeholder)
right results!!!
let me give that a try
so something like this:
success: function(results) {
       	  console.log(results[0].get('objectId'));
          results.set('money', 20)
        },
?
 
yup
just like that
wait
no
results.object.set('money', 20)
i think
 
12:19 AM
I get a
Cannot read property 'set' of undefined
 
did you do the results.object?
or just results
do the other one
 
I did results.object and I got the error I posted above
 
right
so just results.set
 
and then I did results and got another error
:D
 
i was thinking of something else
haha
:)
 
12:21 AM
xD
I get a "Uncaught TypeError: undefined is not a function " with results.set
maybe results[0]
hmm
nope
 
wait
do this
query.first
rather than query.find
it would be safer
 
ok then what should I change inside the code?
because results[0] won't output to the console if I use query.first
so just results
?
 
yeah
just results when you use first
 
ok good I don't get any errors with that but results.set is not working :/
 
hmmmm
could you send me your whole code again?
 
12:28 AM
actually esults.get('objectId') is displaying 'undefined' to the console
and yes sure
$('btn').click(function() {
	  var query =  new Parse.Query(Parse.User);
     var userInput = $('#inputObject').val();
     query.equalTo("objectId", userInput);
     query.first({
       success: function(results) {
       	  console.log(results.get('objectId'));
          results.set('money', 20);
        },
       error: function(results, error) {
            console.log("None found.");
        }
    });
 });
 
hmmmm
 
I know that the ObjectID is being retrieved here so that's not the issue, but what seems to be the problem is the 'results'
 
yeah
why don't we try find again
and then use results[0]
 
and results[0].set?
 
yup
 
12:35 AM
it does the same as the .find
 
do you mean first?
 
displaying 'undefined' to the console and not changing anything in the Data Browser
yes .first
query.find({
       success: function(results) {
       	  console.log(results[0].get('objectId'));
          results[0].set('money', 20);
        },
that does the same as previously
 
ok
would you add
console.log(results.length)
 
sure
 
no wait
i know what to do
 
12:38 AM
ok
 
updated the answer
0
A: Parse, Set Data to User by ObjectID

DehliI think you'd do it this way. If it doesn't work, let me know. var query = new Parse.Query(Parse.User); query.equalTo("objectId", uniqueID); query.first({ success: function(result) { result.set('money', 20); result.save(); }, error: function(results, error) { ...

i hope that works
 
let me give it a try
oh the .save!!
hold on
 
kk :)
 
you sir are a genius.
it works great but the only thing that puts me off is the 'Uncaught TypeError: Cannot read property 'set' of undefined '
 
yeahhh
try this
console.log(results.id);
did that work?
 
12:48 AM
you mean result.id ?
 
yeah
sorry
 
'Uncaught TypeError: Cannot read property 'id' of undefined '
oh shit!
also I just noticed that if I change the variable in the id to match another user in my Data Browser, it gives me a 'POST api.parse.com/1/classes/_User/z4kvGAMJsG 400 (Bad Request)'
 
hmmmm
that's weird
could you show me all the code again?
 
it only seems to work for one user now, this is really weird
yeah np
$('btn').click(function() {
	 var query =  new Parse.Query(Parse.User);
     var userInput = $('#inputObject').val();
     query.equalTo("objectId", userInput);
query.first({
    success: function(result) {
console.log(result.id);
        result.set('money', 20);
        result.save();
    },
    error: function(results, error) {
        console.log("None found.");
    }
});
 });
 
It's a amazing place.
 
12:55 AM
what do you mean?
and what do you mean it only works for one user?
can userInput be multiple users?
 
see how I am getting the value from a input $('#inputObject').val();
 
yeah
 
if I type something other than the ObjectID I have been typing ever since, it gives me a Post 400 error
 
StackOverflow is amazing if that's what you were talking about :)
 
It sure is
 
12:56 AM
what else would you type?
 
another ObjectID belonging to another user
it should work theoretically, weird...
 
yeah
what's the error when you type in another objectId?
 
hmm
after the _User
is the new objectID I typed in
/z4kvGAMJsG
when I use the one I've been using ever since it works correctly and sets the money to 20
any other objectID that I enter (belonging to another user in the Data Browser) gives me that same error + /objectID
 
is the first one you entered the currently logged in user?
 
yes!
I was about to say that after I had just checked it. But yes, it is the currently logged user.
 
1:02 AM
okay
so you probably have some ACL set
what you can do is this
Parse.Cloud.useMasterKey();
 
ACL is set to (undefined) in the db
 
oh
for all of them?
 
yup
yes
 
that's weird then
 
yeah haha
 
1:05 AM
what's the whole error you get
is it just bad request?
 
at the top of my code I have a var currentUser = Parse.User.current();
and
// currentUser.fetch().then(function(fetchedUser){
and yes it's a bad request
 
so that's commented out
 
no it's not
 
so it shouldn't be doing anything
oh
 
I just put comments because stack was misinterpreting it
 
1:06 AM
ohhhh
 
maybe that is interfering with the code?
 
maybe try commenting it out
and seeing what happens
 
ok
nope :/
 
hmmmm
this is weird
would you send me the whole thing again?
 
$('.btn').click(function() {
	          var query =  new Parse.Query(Parse.User);
     var userInput = $('#inputObject').val();
     query.equalTo("objectId", userInput);
query.first({
    success: function(result) {
console.log(result.id);
        result.set('money', 20);
        result.save();
    },
    error: function(results, error) {
        console.log("None found.");
    }
});
 });
 
1:13 AM
does it log the id when you have the current user?
also it should be error: function(error)
results wouldn't be passed
but that shouldn't make a difference
also would you try doing:
query.equalTo("objectId", "z4kvGAMJsG");
instead of userInput
just for testing
 
ok let me give that a try
nope still nothing
wait
 
hey sorry, i went and made dinner
any luck?
 
nope :/ same old thing
let me try one more thing
 
would you show me your current code now?
kk
 
        var query =  new Parse.Query(Parse.User);
     var userInput = $('#inputObject').val();
     query.equalTo("objectId", "uBkMaKRSvs");
query.first({
    success: function(result) {
console.log(result.id);
        result.set('money', 20);
        result.save();
    },
    error: function(error) {
        console.log("None found.");
    }
});
still the same error
uBkMaKRSvs is an objectID of another user
 
1:22 AM
okay
 
it is displaying to the console like it should
but it won't set the money
 
where does it give the post request?
in console?
post error*
 
yes
 
could you copy the entire error message?
 
uBkMaKRSvs
POST https://api.parse.com/1/classes/_User/uBkMaKRSvs 400 (Bad Request)
 
1:23 AM
kk
ty
 
np :D
maybe retrieving the user based on the objectID and setting it for the user, instead of setting it for the objectID?
hmm idk..
 
what do you mean?
 
not exactly sure what I mean haha. But at the moment the result = objectID of the user, and not actually the user itself. Not sure what I'm saying makes much sense but it's just a hunch.
 
could you try adding this
Parse.Cloud.useMasterKey() ;
just to be sure
 
where too?
 
1:29 AM
before you create the query
after the button is clicked
maybe
or maybe before you set the result
try it in one, and if doesn't work, try the other
 
'Uncaught TypeError: undefined is not a function '
that's the only error I get
let me try before I set the result
 
okay
 
same error
 
kk
didn't think you could do that
 
my code:
 
1:32 AM
but wanted to make sure
 
    var query =  new Parse.Query(Parse.User);
     var userInput = $('#inputObject').val();
     query.equalTo("objectId", "uBkMaKRSvs");
     	           	Parse.Cloud.useMasterKey() ;
query.first({
    success: function(result) {
console.log(result.id);
        result.set('money', 20);
        result.save();
    },
    error: function(error) {
        console.log("None found.");
    }
});
ok
this is weird, everything looks fine
 
yeahhh
remove the masterkey thing
 
ok
weird how it is only working for the current USer
 
yeah very weird
 
'new Parse.Query(Parse.User)' ? maybe Parse.User is the problem since at the top we did var currentUser = Parse.User.current();
idk lol...
nah
 
1:34 AM
no, parse.user doesn't refer to currentuser
 
yeah
 
this is very peculiar
i'm going to test it out on my app
 
ok
thank you.
 
of course
i don't think it's a problem with that code
it must be with some other part of the project
do you have this in your code?
byte[] buffer = Encoding.GetEncoding("UTF-8").GetBytes(bundleString);
string result = Convert.ToBase64String(buffer);
StreamWriter requestWriter = new StreamWriter(httpWebRequest.GetRequestStream());
requestWriter.Write(result, 0, result.Length);
requestWriter.Flush();
requestWriter.Close();
 
no I do not
 
1:47 AM
oh nvm
is there any other code in your file?
 
I'll paste my full code now
 
alright
 
 $(document).ready(function(){

            Parse.initialize("xxx", "xxx");


            var currentUser = Parse.User.current();


            if(currentUser == null) { window.location.replace("main.html"); }

            currentUser.fetch().then(function(fetchedUser){
                var name = fetchedUser.getUsername();
            $('.here').html('<ul class="nav pull-right"><li><a id="nametag" href="#" > ' + name + '</a></li></ul>');
            });

            $('#aid').one('click',function(){ // only allow one click
it's a bit messy lol
this might make things easier to see: jsfiddle.net/node4mnt
 
ty
would you try that?
 
ok one sec
nope still nothing
so it's probably not a problem with the rest of the code
 
1:57 AM
yeah
did it give the post error?
 
um let me check again
yes it did...
 
k, well i think we should still just use minimal code
to isolate the problem
we can do this
i hoope
would you add this
{"*":{"read":true,"write":true}}
using data browser
to the user with objectId of uBkMaKRSvs
 
ok
to the ACL correct?
 
yup
 
'Error: user objects cannot allow writes from other users'
 
2:05 AM
when did it say that?
 
on the Data Browser
 
the error appeared at the bottom
 
you're gonna have to rethink your structure
or write a cloud function
because users cannot modify other users
wait, would you create another question saying that the function only works for the current user
 
sure
 
2:07 AM
so if somebody else runs into the problem, they'll be saved the hassle
i'll help you figure this out though
haha
 
ok np, thank you very much I appreciate all the help
 
of course
would you link the question once you post it
 
0
Q: Parse, Function only works for the current user

NotToBragThe following function seems to only work for my Current user, any other ObjectId that I type into the input will return a Post (Bad Request) error in the console. var query = new Parse.Query(Parse.User); var userInput = $('#inputObject').val(); query.equalTo("objectId", userInput);...

 
okay, so you're going to have to add cloud code
do you know how to do that?
 
No :/
 
2:13 AM
okay, look up how to commit cloud code
there's a parse tutorial
it's very easy
do you have a mac or windows
 
Ok sure
Windows
 
okay, i'm not sure how to do it for windows
i have a mac
 
yup
 
It seems to explain how to do it
 
2:15 AM
yeah
 
So I'll follow that :D
 
perfect
let me know when you have main.js on your computer
(you'll know what i'm talking about when you get there)
 
Ok sure
It's getting late here, do you mind if we continue this conversation some other time? Again I really appreciate your help! I wouldn't have gotten close to as far as this
 
sure
hold on
you have to create a cloud function like that
and then call it from javascript
 
Ok that doesn't seem to difficult
 
2:18 AM
i updated my answer on SO
just comment on the answer if you get stuck
 
Ok sure, thanks again!!
 
of course! have a good night!
 
 
17 hours later…
7:47 PM
hey there
 
hey sorry about that I think I have to move the parse exe files into the directory I just created?
 
nope
i don't think so
i do it on a mac
 
I get the error
parse.exe should run in a directory containing a Parse Project
 
oh then yeah
do that
 
ok
 
7:51 PM
:)
 
I actually like the space where I extracted the exes, can I just move the created directories to that directory? instead of moving the exes
the parse new files I mean*]
 
probably
i'm not sure
 
ok I'll just give it a try
nope that path stays fixed... weird
 
kk
 
ok let me try again
damn hmm
 
7:55 PM
haha
we can figure this out
do you have a main.js?
inside of parse.exe folder?
 
yup
 
modify main.js
 
parse/cloud/main.js
ok
to what?
 
what my answer was
the cloud code function
 
ok
what next
 
00:00 - 20:0020:00 - 00:00

« first day    last day (27 days later) »