Left: home, Middle: Eniac@Penn, Right: ec2
May upload HD version later.
Left: home, Middle: Eniac@Penn, Right: ec2
May upload HD version later.
So it turns out that if you are using MyISAM as your MySQL engine, you just need to do a simple:
conn = MySQLdb.connect("""CONNECT ARGS""") cursor.execute(""" INSERT COMMANDS """)
And everything will be OK.
If, however, you decide to use InnoDB (which you probably should) or if for some reason you find that your INSERT commands are not saving you need to do the following...
conn = MySQLdb.connect("""CONNECT ARGS""") cursor.execute(""" INSERT COMMANDS """) conn.commit()
Here's a good explanation of how it all works if you just can't seem to be getting it right:
For those who are Django-ers, you know that in the beginning it's a hassle to modify your data tables when you change a field or two in your models. At least for me, I was so noob/lazy that whenever I made a change I just deleted my database and re-syncdb'd it. LULZ I know.
But I got fed up with it recently and also realized that's definitely not a sustainable method for a real company. So I asked the super-duper-helpful-I-owe-him-a-lot Armon Dadgar on what to do and he showed me a little thing called South which helps migrate these changes easier.
Here's a link to Armon's blog post about this (ctrl+f South to find the most useful thing you'll learn for a Django noob).
Finally got off my lazy butt to fix WhereMyFriendsBe (sorry guys who weren't able to use it while it was down...though if it didn't work you probably didn't bother to even care about the founders let alone their blogs).
It had been down for the past few weeks because Facebook, in their infinite wisdom, decided that if you did not comply and switch your code to implement their new OAuth system they would shut you out. Well the switch was much easier than I expected. Just replaced the old Facebook class with the new one, and changed a few things here and there (if anyone wants details let me know).
The other thing I did was port over WhereMyFriendsBe from our DreamHost account to our ec2 server running Nginx. Ran into the problem of getting PHP installed and using it. Here's a nice little link to the tutorial I followed essentially step by step to get it working.
I used to love Skyping with friends while at Penn. It was a great way to catch up and put a voice to a face. It was most fun when there were multiple friends all chiming in on one conversation! Then one day... I noticed you had to pay to call more than 1 person at a time. Then slowly, I also noticed the Skype connection would routinely lag terribly or get completely lost. At some point I had blamed our internet connection, but at some point I realized it was not just that at play.
I also had bought Skype premium in order to have meetings with people on the East Coast and another teammate if they were not on location. So I ended up paying infinitely more than when I started (any dollar amount is infinitely greater than 0 right?) and still paying for crappy service. I was pretty frustrated. Skype screwing over their employees when they got acquired by MSFT didn't help either.
Fortunately, a miracle occured! The ushering in of Google+ brought with it a new chat system, Google Hangouts. I switched back and forth with it and Skype for meetings and realized it was infinitely better and infinitely cheaper (according to the same math as before).
So as I've begun to take more and more remote meetings, I've started to develop a rule. Let's use Google Hangout not Skype.
I'm sorry if I seem persistent at times or a jerk for pushing that, but here are my reasons:
That third is probably all that needs to be said. Skype's connections just suck. Google Hangout is significantly better. This is because (I believe, but have not confirmed to be factual) Skype hosts connections on client PC's, but Google Hangout hosts it on their much better servers/connections.
So again, I really do apologize to those of you who I try to push to switch meeting venues from Skype to Google Hangout and I feel like I have good reason to. If someone really does prefer Skype though... I can handle it.
I recently treaded into the dreaded territory of the Facebook API to try to create a viral app on top of AvantCard. I ran into a lot of snags that I'll share, and luckily found the solutions (which I will share as well).
The big thing I learned the hard way was that Facebook is requiring OAuth 2.0 authentication by September 1, 2011 and their Python-SDK does not support that.
So I went into facebook.py and tweaked the cookie-getter function to look for "fbsr_" vs "fbs" and then discovered they were just completely different and even doing that wouldn't fix the problem.
So I did just that, and it allowed me to successfully, get a user to the log-in screen, and generate the cookie, and get the cookie to get access to the Facebook access_token for that user. The only thing I need to do is throw in some JQuery to let the user not have to physically switch web-pages to do a Facebook login, and simply have a pop-up.
The other handy-dandy thing I fell upon was a pre-made function to handle FQL queries in Python really easily by just adding some code into the facebook.py file in the Python-SDK. Here's the site. Even though the site has you put the function inside facebook.py, I just modified it slightly to work in my controllers file for my Django/Python app.
Hopefully if anyone else out there is trying to get their Python app to work with Facebook's new OAuth 2.0 authentication system, you found this helpful.
You now have access to all my accounts on the internet. True story.
But seriously... any guesses?
Tonight's coding escapade was a bag of mixed nuts - bad thing was one of our customers had to deal with errors on our live site and we honestly couldn't figuret out why, great thing was Stripe was right there for us holding our hand along the way until they helped us figure out the problem and then solve it.
It started when one of our customers told us he was consistently getting an error trying to process his transaction on Internet Explorer. We tested it on Chrome and it was fine. Then on Firefox and it wasn't fine. So we couldn't blame ol' Microsoft for this one. We put some flags in our code to be thrown if certain things acted up and we discovered that our Stripe Token just wasn't being generated.
Thus, naturally, I assumed it was something Stripe had done. I went to them and they walked me through debugging the Stripe portion of my code. After almost an hour we figured out that Stripe was working just fine... my code just wasn't even reaching the Stripe portion in I.E. or Firefox due to some crappy JS things I did. Then we spent the next hour or so debugging the rest of my code. Stripe helped me figure out the best place to but JS alert's etc and eventually we discovered the error was fairly simple.
Chrome let's you call elements in DOM by simply using the id of the element. So with an input with the id 'first_name' in chrome I can do:
var f_name = first_name.value;
But in almost every other browser you just have to do something like this (if you use JQuery):
var f_name = $("#first_name").val();
So we figured that out, and I had to make several changes and got to deploy the new code in production so tomorrow noone has to run into any of these issues.
But the big thing was how much help Stripe provided me. They could have easily figured out it wasn't their fault, and gone away. But instead they patiently booted up their VM just to test my site in I.E. and helped me walk through debugging and find the problem. I am super impressed and will forever be a cheerleader for Stripe (even though they DO charge quite a rate for transactions...).
They took customer service and brought it up to a whole other level for others to aspire to. I've always known that I want to make my customers as happy as possible, but now I know just what it takes to do that. Good job Stripe.
Oh and here's a rage/happy comic:
Recently I've really gotten into rage comics (see here: reddit.com/r/f7u12). Even though I don't really have time to read them anymore, somehow I find myself thinking in rage comics and even expressing my emotions through rage comics.
I made Olark a rage comic to express my happiness and they loved it. I've decided to make one for Stripe and also for any other future companies I feel like I owe all my support to.
But first... here's an angry rage comic about cross-browser testing...