2015.02.27 – CSS Is Not My Friend

I really try to be friends with CSS but CSS is not reciprocating. I’m sure it’s just my lack of understanding so I’ll have to mess with it some more but this is exactly how I feel about it –

 

Thanks to my mentor for sending me that!

He also showed me how to add content to the side bar so that I can also see that my stars are out of place in a completely different way than in live events. Yay!

Andrew was working downtown again since the demolition is still going on but none of his co-workers were going to be there so I suggested he come and work with me. He agreed and I promised not to bug him too much. Barbara also showed up! It was nice to see her and talk about how her project is going. I forgot that I’m on a different schedule and that she is done in about 2 weeks. I have five weeks. Maybe four. I dunno. Whatever it is it’s not long enough.

I continued worked on the JavaScript trying to get it to post properly but had the incorrect URL. Once I figured out how to format the correct URL I got a 403 Forbidden. Grrr! But this was Django so I remembered I had messed with a CSRF token issue before. Maybe this was the problem. I did a bit of poking around and also ran it by Peter who agreed that was the issue. We talked about a few ways to get/pass the token and I ended up just returning it as part of my JavaScript sync since I was already returning the event ID. That worked perfectly although Andrew had to help me with the code. So much for not bothering him!

My CSRF token issue was solved but now I kept getting an empty array whenever I would post. One thing after another! Andrew showed me how to use the developer tools to show me exactly what was happening (bothering him again). Firefox Developer Edition is super cool by the way. I spent quite some time being totally confused about what was going on because I just don’t really know JavaScript and jQuery that well. I fought with it for a while and decided to just go mess with my tests instead since they would need to be updated.

I ran my tests and yep they were failing. I needed to account for the CSRF token now so I added that in but everything was still failing. Hmmm…….Ah! It helps a lot to use a fresh test DB. Once I did that I still had failing tests but they made a LOT more sense and I was able to get them fixed right up. Whew!

It was time for lunch. Pizza from Sizzle Pie. Yum! Unfortunately Andrew was going to have to get his own food but I told him I’d walk to the food carts with him after I ate since he wasn’t ready to go anyway. I ate lunch with the Mozillians and then went to get Andrew. I guess Katt had offered he and Barbara pizza because there was plenty so that worked out.

Since my tests were passing and were not showing an empty array it was definitely something in my JavaScript/jQuery. I pretty much spent the remainder of the day trying all sorts of things to figure it out but I was stuck. 17:30 rolled around and it was time to go home.

Katt had given me the leftover vegan pizza and a yummy quinoa/apple salad so we scrounged for dinner.

Andrew sat with me after dinner and we looked at my code to see if he could figure out this empty array issue. Sure enough he tracked it down to a change in jQuery’s $.param() method since version 1.4. It seems the change was made to help out PHP, Ruby and Rails developers with the serialization of deep objects. Long story short, it was now returning my array with square brackets so I was getting []”31″ instead of [“31”]. Not so handy. My temporary fix until I talk to Peter is to get ‘ids[]’ instead of ‘ids’ from my view and change that in my tests as well. I can also manually convert to and from JSON but I’ll see what he thinks is best.

After Andrew figured that out I went over the JavaScript functions and explained what everything was doing to him so that he could correct me when I was wrong or explain things I didn’t understand. I find this to be one of the most helpful things for me. I learn so much when I verbalize what the code is doing and get immediate feedback and correction. I feel like I understand JavaScript so much better than ever. This method of “story telling” just really cements things for me. Thanks Andrew!

Today I learned that Leonard Nimoy passed away. Sad day 🙁