fluid-work IRC Logs-2009-06-16
[07:18:17 EDT(-0400)] * heidi_ (n=thesumme@bas5-oshawa95-1176470261.dsl.bell.ca) has joined #fluid-work <laurel> so if I point the browser to the jsonParser.php file with var=blah, I get back what I expect...var = blah ; <colinclark> $concatJSON = "var ".$varName." = ;";
[08:14:49 EDT(-0400)] * Justin_o (n=Justin@142.150.154.171) has joined #fluid-work
[08:25:14 EDT(-0400)] * laurel (n=Laurel@142.150.154.178) has joined #fluid-work
[08:28:03 EDT(-0400)] * jsilvaa (n=jsilva@142.150.82.73) has joined #fluid-work
[08:36:24 EDT(-0400)] * athena (n=athena@99.129.100.66) has joined #fluid-work
[09:07:18 EDT(-0400)] * yura (n=yura@142.150.82.64) has joined #fluid-work
[09:09:42 EDT(-0400)] * fj4000 (n=Jacob@142.150.154.106) has joined #fluid-work
[09:28:08 EDT(-0400)] * colinclark (n=colin@user145-209.wireless.utoronto.ca) has joined #fluid-work
[09:35:02 EDT(-0400)] * michelled (n=team@142.150.154.193) has joined #fluid-work
[09:45:21 EDT(-0400)] * clown (n=clown@142.150.154.121) has joined #fluid-work
[10:11:46 EDT(-0400)] * alisonbenjamin (n=alisonbe@142.150.154.101) has joined #fluid-work
[10:23:02 EDT(-0400)] * jessm (n=Jess@user145-32.wireless.utoronto.ca) has joined #fluid-work
[11:06:28 EDT(-0400)] * mackrauss (n=armin@142.150.154.101) has joined #fluid-work
[11:22:13 EDT(-0400)] * alisonbenjamin (n=alisonbe@user147-130.wireless.utoronto.ca) has joined #fluid-work
[11:34:41 EDT(-0400)] * colinclark (n=colin@user145-209.wireless.utoronto.ca) has joined #fluid-work
[12:18:46 EDT(-0400)] * alisonbenjamin_ (n=alisonbe@user147-130.wireless.utoronto.ca) has joined #fluid-work
[12:56:19 EDT(-0400)] * colinclark (n=colin@user145-209.wireless.utoronto.ca) has joined #fluid-work
[13:18:11 EDT(-0400)] * jessm (n=Jess@user145-32.wireless.utoronto.ca) has joined #fluid-work
[14:13:19 EDT(-0400)] <jamon> wiki/jira should be back up, i'm standing at the box so let me know if y'all still can't reach it?
[14:13:41 EDT(-0400)] <jessm> i can't
[14:13:45 EDT(-0400)] <Justin_o> i can't either
[14:13:52 EDT(-0400)] <jessm> jamon: ^
[14:14:12 EDT(-0400)] <jamon> ok
[14:15:07 EDT(-0400)] <jamon> it's up
[14:15:13 EDT(-0400)] <colinclark> Justin_o: Did you and laurel get your jsonp issue resolved?
[14:15:34 EDT(-0400)] <jessm> jamon: roger that – works for me now
[14:15:49 EDT(-0400)] <Justin_o> jamon: i'm getting jira saying that the database is locked
[14:16:04 EDT(-0400)] <Justin_o> colinclark: not quite... the error is gone, but the variable is still undefined
[14:16:26 EDT(-0400)] <colinclark> Justin_o: Got some code you can paste bin me?
[14:17:28 EDT(-0400)] <jamon> checking jira then Justin_o, thanks
[14:17:50 EDT(-0400)] <Justin_o> colinclark: http://fluid.pastebin.com/m6453aa98
[14:17:55 EDT(-0400)] <Justin_o> that is the jsonp like part
[14:19:11 EDT(-0400)] <Justin_o> laurel: has some more code on her machine if you would like to see something else
[14:21:19 EDT(-0400)] <jamon> up
[14:21:48 EDT(-0400)] <colinclark> Justin_o: just reading it now
[14:22:03 EDT(-0400)] <laurel> let me know if you want the php too
[14:22:13 EDT(-0400)] <colinclark> Justin_o: That semi-colon on the end of your URL seems a bit weird to me.
[14:22:23 EDT(-0400)] <colinclark> Why is it there?
[14:22:30 EDT(-0400)] <colinclark> laurel: Yep, I'll need to see the PHP code.
[14:22:39 EDT(-0400)] <laurel> it is weird but removed an error that firebug threw without it
[14:22:50 EDT(-0400)] <laurel> something about a missing semicolon
[14:23:38 EDT(-0400)] <colinclark> It really shouldn't be needed. Something smells there a bit.
[14:24:35 EDT(-0400)] <laurel> want the whole php file or just a bit?
[14:24:59 EDT(-0400)] <colinclark> laurel: Paste me whatever you think is relevant.
[14:25:32 EDT(-0400)] <laurel> http://fluid.pastebin.com/m5ae6ddec
[14:25:54 EDT(-0400)] <laurel> i've left out the functions basically.
[14:26:03 EDT(-0400)] <jessm> jamon: both are up now – THANKS
[14:26:26 EDT(-0400)] <Justin_o> jamon: thanks
[14:26:55 EDT(-0400)]
[14:27:34 EDT(-0400)] <colinclark> laurel: can you send me the output?
[14:28:54 EDT(-0400)] <colinclark> i think i may see the bug, but i'd like to see the output
[14:29:49 EDT(-0400)] <laurel> sure
[14:31:38 EDT(-0400)] <laurel> http://fluid.pastebin.com/m36e3c919
[14:32:04 EDT(-0400)] <laurel> I'll be thrilled if you can find this...been looking at it for too long
[14:32:46 EDT(-0400)] <colinclark> looks pretty clear to me
[14:32:58 EDT(-0400)] <colinclark> let's take a look at that first line in the output
[14:33:06 EDT(-0400)] <colinclark> and think through what we're trying to do
[14:33:50 EDT(-0400)] <colinclark> so, Justin_o, your component template is requesting that the data be assigned to a particular variable, right?
[14:34:18 EDT(-0400)] <Justin_o> colinclark: yes it will pass along the variable
[14:34:28 EDT(-0400)] <Justin_o> in that <script> at the top
[14:34:32 EDT(-0400)] <colinclark> right
[14:34:43 EDT(-0400)] <colinclark> so check out the value you've specified
[14:35:30 EDT(-0400)] <colinclark> you're saying "please stuff this data into a property called dependences which lives inside an object called customBuild, which in turns lives inside an object called 'fluid'"
[14:35:31 EDT(-0400)] <colinclark> right?
[14:35:37 EDT(-0400)] <colinclark> Justin_o, laurel: yes/no?
[14:35:46 EDT(-0400)] <Justin_o> colinclark: oh... that is probably my mistake
[14:35:50 EDT(-0400)] <Justin_o> i see what you are saying
[14:36:05 EDT(-0400)] <colinclark> Justin_o: Can you reiterate, just so we're all on the same page.
[14:36:06 EDT(-0400)] <colinclark> ?
[14:37:22 EDT(-0400)] <Justin_o> okay... maybe i'm wrong... thought it was a namespace issue
[14:37:25 EDT(-0400)] <colinclark>
[14:37:27 EDT(-0400)] <colinclark> it sort of is
[14:37:30 EDT(-0400)] <Justin_o> okay..
[14:37:30 EDT(-0400)] <colinclark> I'll continue...
[14:37:43 EDT(-0400)] <colinclark> So if you look at this code in the PHP, we're doing something interesting:
[14:37:55 EDT(-0400)]
[14:38:19 EDT(-0400)] <colinclark> Notice that "var $varName =" part?
[14:38:35 EDT(-0400)] <laurel> yes we notice
[14:39:10 EDT(-0400)] <colinclark> Ok, so that part of the statement would be valid JavaScript if your property was actually just a variable name.
[14:39:24 EDT(-0400)] <colinclark> But in fact, you're passing a "path of properties."
[14:39:47 EDT(-0400)] <Justin_o> so we can't use namespacing
[14:39:53 EDT(-0400)] <colinclark> In that case, the var statement isn't valid
[14:40:05 EDT(-0400)] <colinclark> So you can use namespacing, but you'll have to either:
[14:40:15 EDT(-0400)] <colinclark> 1. Make an assumption that the value of varName is a valid path to a set of existing objects
[14:40:22 EDT(-0400)] <colinclark> 2. Rework your code to be more robust
[14:40:30 EDT(-0400)] <colinclark> So, if you can guarantee that a fluid object already exists...
[14:40:54 EDT(-0400)] <colinclark> and you can also guarantee that the "customBuild" object exists within it...
[14:41:10 EDT(-0400)] <laurel> so colin - i'm not sure why still...should i keep bugging you or can justin fill me in
[14:41:15 EDT(-0400)] <colinclark> then you could just chop off the "var" part, and assign the value directly.
[14:41:26 EDT(-0400)] <laurel> is it the var part that is the problem?
[14:41:37 EDT(-0400)] <colinclark> laurel: Simple. Your code isn't syntactically correct.
[14:41:56 EDT(-0400)] <colinclark> You are trying to define a variable, but the name you are giving it isn't valid, because it has dots in it.
[14:42:35 EDT(-0400)] <Justin_o> so we would have to do something like this then... fluid.customBuild.dependencies = fluid.customBuild.dependencies || {};
[14:43:02 EDT(-0400)] <Justin_o> colinclark: ^
[14:43:03 EDT(-0400)] <colinclark> Justin_o: Close.
[14:43:15 EDT(-0400)] <colinclark> Ideally, you'd do something like this...
[14:43:22 EDT(-0400)] <colinclark> var fluid = fluid || {};
[14:43:40 EDT(-0400)] <colinclark> fluid.customBuild = fluid.customBuild || {};
[14:43:52 EDT(-0400)] <colinclark> fluid.customBuild.dependencies = <blob of json>
[14:44:12 EDT(-0400)] <Justin_o> oh okay... i see.. we have to build it up first
[14:44:13 EDT(-0400)] <Justin_o> okay
[14:44:21 EDT(-0400)] <colinclark> Yeah, but it's not entirely ideal.
[14:44:30 EDT(-0400)] <colinclark> I'm just thinking through if there's something easier we can do
[14:44:38 EDT(-0400)] <colinclark> I'll think out loud for a second...
[14:45:16 EDT(-0400)] <colinclark> We have to assume that this <script> tag will always be included after Infusion and after the Builder's own JavaScript, right?
[14:45:27 EDT(-0400)] <Justin_o> that is correct
[14:45:51 EDT(-0400)] <colinclark> so, you could live dangerously
[14:45:56 EDT(-0400)] <colinclark> and just do this:
[14:46:03 EDT(-0400)] <colinclark> $varName = ...
[14:46:26 EDT(-0400)] <colinclark> Just omit the var. In the case where the varName is a path, it'll work.
[14:46:35 EDT(-0400)] <colinclark> And if it's just a global variable that needs to be defined, it'll work too.
[14:46:41 EDT(-0400)] <colinclark> This is nasty, of course.
[14:47:03 EDT(-0400)] <Justin_o> colinclark: i was sort of thinking that when we put it together, but made the mistake with the var.
[14:47:18 EDT(-0400)] <Justin_o> i can see how it could be problematic for people looking at the template
[14:47:21 EDT(-0400)] <colinclark> Lemme see if there's something cooler
[14:48:23 EDT(-0400)] <colinclark> Justin_o: I'm thinking fluid.model.setBeanValue() will do it for you.
[14:48:46 EDT(-0400)] <colinclark> It's sort of weird...
[14:49:53 EDT(-0400)] <colinclark> but you could essentially generate, out of your PHP, a call to fluid.model.setBeanValue(window, $varName, <blob of JSON>);
[14:50:28 EDT(-0400)] <Justin_o> i was just reading up on setBeanValue
[14:50:31 EDT(-0400)] <colinclark> Take a look at the implementation of setBeanValue real quick and tell me what you think.
[14:50:43 EDT(-0400)] <colinclark> Because otherwise, in PHP, you'll end up essentially writing the same code...
[14:50:56 EDT(-0400)] <colinclark> tokenize the path on dots, then generate statements like this:
[14:51:05 EDT(-0400)] <colinclark> var $token = $token || {};
[14:51:07 EDT(-0400)] <colinclark> and so on
[14:51:21 EDT(-0400)] <Justin_o> i see... so basically in the <script> part we would just pass in the variable name and in php return fluid.model.setBeanValue(window, $varName, <blob of JSON>);
[14:51:35 EDT(-0400)] <colinclark> ype
[14:51:49 EDT(-0400)] <colinclark> in other words, your <script> tag stays the same
[14:52:10 EDT(-0400)] <Justin_o> okay... so the only assumption really is that fluid has already been loaded on the page
[14:52:18 EDT(-0400)] <colinclark> and your php writes out a call to setBeanValue() instead of directly assigning to the variable
[14:52:19 EDT(-0400)] <colinclark> yep
[14:52:46 EDT(-0400)] <colinclark> out of curiosity, what do you use the fluid.customBuild property for?
[14:52:59 EDT(-0400)] <colinclark> Do you actually assign the creator function of the component to that property?
[14:53:16 EDT(-0400)] <Justin_o> yes.
[14:53:33 EDT(-0400)] <colinclark> Yeah, so there's another implicit assumption there--one that i think is reasonable
[14:53:44 EDT(-0400)] <Justin_o> okay... thanks
[14:53:54 EDT(-0400)] <colinclark> this jsonp block must be included after the component's own javascript
[14:54:22 EDT(-0400)] <colinclark> since, otherwise, you'll end up squashing the original value assigned to fluid.customBuild when you go to define your creator.
[14:54:28 EDT(-0400)] <colinclark> anyway, that's a fairly academic point
[14:54:38 EDT(-0400)] <colinclark> laurel, Justin_o: You're both clear now?
[14:55:29 EDT(-0400)] <Justin_o> colinclark: i'm good
[14:55:42 EDT(-0400)] <laurel> me sort of but I'll get there
[15:04:29 EDT(-0400)] <laurel> it works!
[15:04:36 EDT(-0400)] <laurel> thx colin
[15:04:48 EDT(-0400)] <colinclark> great
[15:05:01 EDT(-0400)] <colinclark> laurel: Can I see the output, just for fun?
[15:05:19 EDT(-0400)] <laurel> well, it's a console log...so maybe not quite yet
[15:05:33 EDT(-0400)] <laurel> or do you mean the php output
[15:06:07 EDT(-0400)] <colinclark> i meant whatever shows up in the browser
[15:06:14 EDT(-0400)] <colinclark> but no worries if it's not there yet
[15:06:26 EDT(-0400)] <colinclark> I was just excited.
[15:07:28 EDT(-0400)] <laurel> no, it only shows up in the console...and not very prettily...but we are a step closer...thx so much
[15:08:39 EDT(-0400)] <colinclark> cool
[15:18:48 EDT(-0400)] <colinclark> Hey Justin_o
[15:19:01 EDT(-0400)] <Justin_o> colinclark: hello
[15:19:15 EDT(-0400)] <colinclark> Just thinking about that insane semicolon at the end of your url
[15:19:24 EDT(-0400)] <colinclark> and the code you have in the PHP to then strip the freaking thing out
[15:19:33 EDT(-0400)] <laurel> i agree it is a pain
[15:19:40 EDT(-0400)] <colinclark> I wonder if FireBug is just trying to be too clever
[15:19:54 EDT(-0400)] <laurel> perhaps...i'll pull it out and then see what happens
[15:19:57 EDT(-0400)] <colinclark> What if you renamed the "var" form variable to something else
[15:20:08 EDT(-0400)] <colinclark> like "property"
[15:20:12 EDT(-0400)] <colinclark> or "propPath" or whatever
[15:21:39 EDT(-0400)] <laurel> ha...took out the ; as is and the error is not showing up now
[15:21:48 EDT(-0400)] <Justin_o> colinclark: oh interesting... Firebug is just conspiring against us
[15:21:57 EDT(-0400)] <colinclark> lol
[15:22:09 EDT(-0400)] <colinclark> that's a line of code we can toast
[15:22:10 EDT(-0400)] <colinclark> always a good thing
[15:22:14 EDT(-0400)] <laurel> maybe a combination of that ; and then the other var issues
[15:22:59 EDT(-0400)] <laurel> thx for the reminder to look into that.
[15:37:26 EDT(-0400)] * yura (n=yura@142.150.82.64) has joined #fluid-work
[17:01:37 EDT(-0400)] * clown (n=clown@142.150.154.121) has left #fluid-work
[21:40:10 EDT(-0400)] * colinclark (n=colin@bas2-toronto09-1176130825.dsl.bell.ca) has joined #fluid-work
[22:42:28 EDT(-0400)] * colinclark (n=colin@bas2-toronto09-1176130825.dsl.bell.ca) has joined #fluid-work