Wednesday, December 23, 2009

Desktop OAuth/Python Question

This post is slightly more tech-heavy than most of my recent posts. If that's not your thing, feel free to move on now.

[Update 20091223: NEVERMIND. I got it sorted. The url you re-direct a user to with OAuth doesn't need extra OAuth headers. So you really could just use webbrowser.open(). My bad.]

Suppose I want to interact with the twitter API via some python code running on my personal computer. Suppose, for grins, that instead of using the Basic Authentication I'd rather try OAuth (even though it's all running locally...). Part of the flow of OAuth authentication is that my script is supposed to direct the user to an address at twitter (oauth/authorize), with some OAuth specification headers in the HTTP request for that address (I hope I'm saying things within a few shades of correctly). Well, python provides the webbrowser module which should open up a url in the users browser of choice. And it does, pretty easily (based on my 1-test sample). The problem is that for the OAuth dealings, I'm supposed to pass additional HTTP headers, and I can't figure out how to do that with the webbrowser module. I tried creating a Request object, from the urllib2 module. If I were just making a url request using this library, I could make the Request object, with the extra headers, and things would go fine. But the webbrowser.open() method seems to want its url parameter to be a string, not a Request object.

So... how am I supposed to do this? Or am I not supposed to do this?

Am I supposed to use some other existing python based browser? How is the user supposed to feel like I'm not still in the middle of the authentication process? I mean, if my script displays a webpage using some graphical widget, and waits for the user's input, then I could just be grabbing their username and password while they log in to twitter, no? The point of having the user go to twitter and get a pin is that the user then tells me that pin. I don't put myself in the middle and grab the pin (or their username/password) somehow.

Does any of this make sense? Can somebody point me at a solution? Existing code that solves this problem?

Friday, December 11, 2009

Changing Calculus

Apparently toward the end of every semester I decide to write a post about changing calculus. At least, this is my second go at it. But today's attempt is more a follow-up to my most recent post, about the role of higher education.

My initial motivation in asking the questions in my last post was to provide some structure for what a calculus class should look like. Is the role of calculus really to make sure that all freshman know how to compute integrals by hand, and can use this to find the volume and surface area of a solid of revolution? That rising second years can go through mindless algebraic manipulations to arrive at an answer to a question that was asked without any context or applicability? Moreover, that they need to be able to do so by hand? Quick, find the antiderivative of $\sqrt{3-2x-x^2}$, no computers. Who gives a crap? How many times will that function, or one like it, actually show up in the lifetime of my student? I get paid to do math, and the only time I've ever cared about the answers to these algebraic questions was when I was taking or teaching a calculus course.

Looking back, I'm a little ashamed that the problem above was actually one I assigned as homework for my students this semester. What good does it do to have them work this integral by hand? Surely the answer depends on the students, right? My students going away from the sciences have gotten nothing out of this assignment. My students staying in the sciences have spent another... 5 minutes? 30?... practicing their algebra skills. Hurray‽

Look, I'm not saying algebra isn't useful. But I really do think it is over-emphasized in calculus courses (the ones I've encountered). My calc II course covered: techniques of integration, improper integrals, arc length and surface area of revolution, parametric curves, polar curves, multiple integrals, and infinite sequences and series. Lots of these are wonderfully fascinating and fun topics. Parametric and polar curves force students to start thinking about curves differently, to start re-interpreting functions and points in the plane. Infinite sequences and series are so unlike anything that's ever come before that they can't help but be interesting. Add up infinitely many things that get infinitely small, and produce an infinite value? Or a finite one? How the hell does that work? What does it even mean?

If not a single one of my students can do the integral mentioned above, I'm not sure that I'd feel bad about my semester. If not a significant portion of my students could tell me what was new about a parametric or polar curve, I think I'd be fairly upset (admittedly, now I'm a little afraid to ask).

My problem with my course is that algebraic manipulations are essentially given precedence over conceptual understanding. This is done by making exams that test algebraic nonsense, forcing instructors to make sure their students can do the algebraic nonsense, taking up valuable time that could be better used in other ways. With less time spent on algebra, more time could be spend on concepts, and more time could be spent on improving student's writing. The time spent on concepts makes it a more mathematically interesting and, I'd argue, worthwhile course. Whatever negative impact on my students is brought on by slightly less algebra practice will be more than compensated for by having them spend time thinking about ideas. More time spent teaching students how to write mathematics will force them to think more precisely about what they are saying and how to say it. How could this not be advantageous to students, whether they will be taking more math or not? Unless, of course, thinking about these ideas and how to write them is not aligned with the goals of my university. If the role of higher education isn't something that thinks this would be better, then I'm getting off this boat before it sinks.

So why not go for it? Spend drastically less time on techniques of integration and series convergence tests. Force students to turn in well-written assignments. Spend class time talking about what well-written math is. Spend time letting students play with computers to get a feel for parametric and polar curves. Computers will be faster and more accurate in plotting curves than any student ever will be. Give students time to plot lots of curves, changing parameters to see the effect on the graph. Make students look up resources online to learn how to find arc lengths or surface areas, instead of just telling them the formula (or even deriving it) and having them memorize it. Spend class time talking about how to read the resources they find, and how to evaluate them for quality.

My advisor pointed out, during our conversation mention in my last post, that there are some issues with trying new things. At the lowest level: who gets to teach such a course, and where does their funding come from? But I think better concerns that he mentioned are two that bring me back to some of my earlier questions.
  1. It is hard to test conceptual understanding. It is much easier to test if a student can do some algebra. With several hundred students going through calculus every semester, this is a practical concern. How does a university handle scale?
  2. Institutional inertia would have to be overcome. Change is hard. We do this because this is how we've done this for a while now, and it is clearly the best way to do things and it's going ok and nobody has complained.
So let me ask again, what is the role of the university, and how will the university adapt to the changing world? Is the role to grant degrees, and so is the role of my lowly calculus class to funnel students on to further classes until we can get them out of here with their paper in hand? What market are universities in? If we know, then we can see if our institutional inertia is good or bad. If we don't know, we should probably get on that.

These questions brought me back, full circle, to my initial desire for some formal guidelines for courses. I think it would be hasty to change all of our calculus courses around right away. I think a better solution involves some experimenting. Make a new course, make grad students apply to teach it, arguing for what they want to do differently, and require the instructor to report back on how it went. I think having formal guidelines for courses would aid the experimentation, because it gives an objective measure for comparing a newly designed course with a more traditional one.

I know that much of what I'm saying is oriented toward the way things are set up in my department. How is your department set up differently, and what does that mean about how calculus courses are structured?

Thoughts? Objections? (non-spammy) Links?

Higher Ed

I've been wrestling recently with identifying the role of higher education. I'm not much of a wrestler, physically or intellectually, so I thought I'd see what I could put into words and have you folks comment on. Thoughts of yours, or links to thoughts of others are much appreciated.

What brought on my recent concerns, or possibly made the pot boil over, as it were, was some frustration in making a final exam for my calculus course. The course I teach is one section among several, and we all have common exams. When we went to make the exam this semester, there was some disagreement about what should be tested. The lack of a prescribed vision for the course (at least, one I was aware of) started to upset me. And then I decided that such a vision should be accompanied by a broader vision of the math courses offered by the department. It should include formal indication of how the courses fit together, what is assumed of students coming in to each course, and what is assumed of students passing a course (I'm thinking something more formal and precise than the short list of pre-reqs for a course). And then I wondered where this vision came from, if it was internal to the department or how much say other departments had in what they wanted math classes to require. I'm not expecting the English department to care at all what is covered in Calc I or II. But perhaps Economics has some input for us? Or other departments? And then I wondered what the point of any of it was. What is the role of higher education, and how does my Calc I or II class fit into that?

Clearly things were getting out of hand.

Luckily, my thesis advisor turns out to have the title of Director of Undergraduate Affairs. Furthermore, he was happy to talk to me about these things, and brought a welcome level-headedness up against my relative insanity. Of course, I'm sure he won't mind much when I get back to research... :)

He pointed out that probably having formal guidelines for all courses is a bit much - that professors teaching upper level courses should be granted plenty of flexibility. I can't really argue with that. I have vast respect for all of my professors. But this flexibility doesn't really help in getting a vision for Calc I or II together. And if the courses are coordinated among several sections, there should be some vision backing it, right?

Part of my initial inquiry was if there was a curriculum review that happened periodically, and how long ago the most recent was. My guess was that if there was such a thing, it happened before nearly all of my students had personal laptops (or possibly even personal computers in their dorm room). I know I'm a bit of a nerd, but I really think it is important to adapt to the changes brought about by each student having their own computer (that they maybe can carry in their pocket!) connected to the internet. The explosion of infinite goods and real-time global communications, for "everybody" (yes, I know I live in a privileged region, or whatever is the PC way to say it. I'm sorry?), has been changing, is changing, and will continue to change... well... nearly everything. When the fundamentals of economics and communication change, what isn't impacted? [Side note: I know very little about economics, I'm probably saying things incorrectly]

Bringing things back down closer (somewhat) to the level of a graduate student who knows basically nothing about anything useful... how does the internet change higher ed? What happens when lectures become an infinite good, available to be watched freely online? What happens when the content that makes up our textbooks is available in a multitude of places online? What happens if students have direct access to experts in any field at campuses on the other side of the globe? Gah, I'm getting out of hand again.

Two recent posts online have been on my mind a bit as I think about this question:
  1. A post on ars technica about the difference between the movie industry and the music industry. For some reason this article made me realize that I probably wasn't thinking much about what was distinct about higher ed, as opposed to the entertainment or news industries, and what that meant about the impact of technology.
  2. A video on techdirt explaining the innovator's dilemma. This video makes me think that in order to adapt, universities should be asking what market they are in. I've been phrasing the question in terms of what role they play, but I think maybe they're pretty similar questions. Are we in the horse-and-buggy market, following the example in the video, or the transportation market? Are we in the market of churning out degrees? Are we in the certification market? Is that our primary goal and purpose?
I truly hope that I'm not saying anything surprising to people involved in higher education (or other fields!), or asking questions you've not heard before. I really do hope that I'm late to this conversation - that smart, dedicated people in the right places are asking these questions. Moreover, that they are coming up with some answers. I hope that I am just not seeing this conversation at my university, or at others, because I am not involved enough somewhere.

Anybody have some thoughts or links for me?

This post is somewhat of a part 1 in a series. The second focuses more on teaching calculus.

Monday, November 23, 2009

Phones

Today I made a few changes to the way I intend to interact with phones, and I thought I'd see if any folks out there had any advice for me about these changes.

I switched to a pay-per-minute plan for my mobile phone today, and also signed up for Google Voice (thanks to an invite from a twitter follower), with a new Google number. My mobile plan is now 1 dollar every day I make or receive (actually answer) a call, plus 10 cents for each minute of those calls.

So here's what I'm planning on doing: I'll tell people my Google number. They'll call that, and it'll call my phone, and I'll not (in general) answer it, but I'll notice that somebody called because my phone will ring. Then I can wait for them to leave a voicemail, and check it online (assuming I'm near a computer (which I probably am)). If it's important (and the person isn't online where I can just chat with them) I can then call them back.

Perhaps this is selfish and a hastle for the people that call me. But there simply aren't that many people that call me, and most of them (Mom, e.g.) probably won't mind or even notice the slight hastle. And if I know somebody will be calling (a friend arriving somewhere, say), I don't have to let the call go to voicemail. And I can tell folks that if they'd really like to reach me, now and on the phone, they can just call twice or something.

I thought I'd see if anybody out there does, or has done, or has had a friend do, something similar. If you've got any comments of feedback about my new scheme for being a cheap-ass hermit, please leave one below. Don't bother calling me :)

That's basically the end of this post. But my original version of the post started with the story behind making these changes, and it's all written out, so I thought I'd include it anyway. If you don't care, then go find something else to do, I won't be offended (I won't even notice, but even if I did, I wouldn't be offended). If you're bored... here's the story:

I think I've never really been a fan of talking to people on the phone. Certainly not recently. I'd almost invariably rather talk to somebody via email or instant message. But I've got a phone, because apparently you've gotta have one. And, I'll concede, they have their uses.

When I started grad school, I got my own mobile phone (look at me all grown up), and an individual phone plan. I've been on the cheapest mobile phone plan since then (5+ years now). I have never gotten particularly close to using anything like my allotted minutes. My most recent bill claims I used 6 minutes total. Not exactly something I was happy paying 50 dollars a month for, but I was too lazy to look into many other options.

The other day I accidentally left my phone in my pants pocket when I put those pants through a cycle in the laundry machine. It was an old phone that I'd gotten for free for signing up for whatever plan anyway, so I can't say I was too upset when it came out of the laundry and wouldn't turn on. I was mostly amused, and glad it didn't do any damage to the laundry machine (water and electronics being what they are... I figured).

After letting it sit for a few days on the hope it might sort itself out, with no luck, I decided it was time for something new. What I probably most wanted to do was get a Droid. This would mean paying more for my phone service, but it'd be paying for something I'd almost certainly use. Not the voice service, so much, but certainly data. However, I listened to the voice of reason (for now :)) and decided instead to switch to a pay-per-minute plan with AT&T (my current provider, inertia being what it is). I went and got a new phone (the cheapest), and am now (after some slight hastle with the SIM card, and having lost all of my contacts) on a plan where I pay 1 dollar every day that I make or receive a call plus 10 cents per minute that those calls take. While I certainly can see that some months will be more expensive than others (due to travel or getting stuck on hold doing something stupid), I have a hard time believing any will be more than the 50 dollars a month I was paying. That's something like 6 minutes of calls every day, or a couple of hour long calls scattered through the month. I'm not sure there's anybody I want to spend an hour on the phone with.

None of that is particularly interesting or exciting, I suppose. It's new for me, so a little exciting, but I can't see why you'd care. What's more exciting is Google Voice. Thanks to an invite from a twitter follower, I now have a Google number. In fact, it's HAM-BLET (in an area code that isn't where I am), which is a little fun (ANIDIOT wasn't available). And I guess the idea is I have the number... indefinitely. And then I can add any of my usual phone numbers (the one I've had for a while now, e.g.) to my Voice account, and whenever somebody calls my Google number, I see the call on my normal phone. And if I decide to not answer, Google will record the voicemail for me and send me an email (or text message, but I turned that off) with a transcript, or I can even listen to it online. That's probably the most exciting thing I've seen in... rather a while. Pressing some buttons online and having my phone ring is pretty magical.

Wednesday, November 18, 2009

Grade Eachother?

I started doing daily homework assignments for my calculus class when we got to series convergence tests. The idea is that they will read the section in the book and work some problems to turn in, before we talk about it in class. It isn't going well.

Mostly students are "getting the right answer," but the write-ups are fairly bad (mostly making me feel like understanding is pretty low). I spent about 20-30 minutes in class Monday telling them about the things they were doing that are driving me crazy.

We've got three more of these daily assignments due over the next week. I'm thinking about doing the following: During class, have the students gather themselves up in pairs and have each student write their name on their partner's paper. The students will spend time looking for mistakes on their partner's paper. And I'll tell them that whatever points I take off of a paper will also be taken off of the partner's paper.

Surely somebody out there has done something like this before. How does it go? Does it help? What do I need to watch out for? I'm a little worried that "correcting" won't happen as much as "copy down what is hopefully a better answer, without understanding it".

Tuesday, November 10, 2009

Solid

If you are still following this blog, after two months with no posts followed by a rambling personal post, then I owe you something. The best I have is the following...

A few weeks ago in a seminar, I was sitting behind a professor and noticed that his t-shirt had a pretty cool picture of a solid shape on it. I drew the picture, and decided I would love to have a 3-d version. My original (and, now, long-term) goal was to make the solid represented in the picture by a piece of wood. Wandering around the craft store, I decided foam was a bit more feasible for me right now. So anyway... I'll just give you a link to the album I put all of the pictures in (click the picture for the album):


I also made a little video of me spinning the thing, to give an idea what it looks like from more angles.


This was my first attempt at this project, and my first attempt carving something out of foam. I'm honestly fairly pleased with the result. Certainly I see room for improvement though, and plan on trying again soonish. I've got two more blocks of foam still...

Monday, November 9, 2009

Still Right Here

This post was inspired by my lack of having posted anything else here in a while (2 months, to the day, apparently). Of course, if you've got nothing to say, which I don't, then not posting isn't a bad thing. Another inspiration for this post is that when I sat down to do "real work" (research, toward my Ph.D.) today, I found that I was on the last page of yet another notebook. Seems like a good time for reflection. I wish I could say that I felt like this last notebook had useful ideas. Or that I felt that way about any of the previous notebooks. I guess if it were true I might be out of here by now, or on my way out in the spring.

This post is fairly personal. The only thing you'll learn about, from reading it, is me. And I'm not a particularly interesting subject, I promise. Go find something else to do, there's plenty out there.

For some reason this academic year has been a huge source of confusion and frustration for me. I'm now in my 6th year of graduate school (for math, in case you forgot that part). For the past 5 years, I knew why I was here: I wanted to be a math professor. Maybe I still do, but I'm not so sure any more. My thesis advisor says he thinks I'd make a good prof at some small school, which was always the goal. And yet, I have a hard time convincing myself that this is still what I want. It's sort of an odd feeling to have your main plan in life for... a decade?... not really matter to you any more. Or, to maybe not matter.

I only have some vague idea(s) why I don't care as much about being a professor as I used to. I'll see what I can put into words, as much (more) for my benefit as yours (hopefully you stopped reading around the end of the second paragraph).
  • Research sucks. Or I suck at research. Or... something like that. I've been reading math books for fun since high school (after I read all the books on sharks at the local library, and then decided I wasn't one for the water). I still do. And I love reading about math. But perhaps "doing math" is not something I care much for. I know, I know... math isn't a spectator sport, and... if you aren't reading with a pencil and paper and trying to guess what comes next, you're doing it wrong. But F that. I love reading math, the way I read math. If the way I read math means I'm not a "real mathematician", then maybe I shouldn't be here anyway, or shouldn't be teaching the next batch of math students.
  • How am I supposed to be a professor, and tell my students how to learn math, if I don't do it myself? How can I tell my students to go home and work more problems (a habit I never had), and bang their heads against problems for a while (when, every time I sit down to do research I find something else to do as quickly as possible)?
  • Sure, I can tell my students about math. I can tell them definitions and theorems and how to work problems, and maybe even tie it all together in some meaningful way. But lots of people have already done that, and their work exists in textbooks and, increasingly, online.
  • Speaking of online, I feel like (and I know I'm not the only one) higher ed. (and probably other ed., and plenty more) is going to be going through a bit of an upheaval in the near future. I'm not sure I see how small, private, liberal arts colleges (like the one I went to, and always envisioned myself teaching at) are in a sustainable position currently. They are too expensive, and for what? I believe that many people are going to start recognizing that the diploma you get from such an institution isn't as valuable as, say, an impressive online resume, which is now something anybody can create with little effort (besides the "doing things that go on the resume" part). People can show everything they are capable of online, for everybody to see. What good is another diploma in relation to that? (I know that a diploma is still good... I'm not going to argue any of the things I say here)
  • And also, while I'm on the subject of "online"... the experts are out there posting work online. Awesome teachers are posting full lesson plans, and all sorts of incredible resources. And my students could get to it as easily as I can. What extra value do I bring to the table? A convenient face to bounce ideas off of, to ask questions to (before thinking about the problem long enough alone)? Scheduled hours when I'll be around? I think there is a place for web collaboration tools in education, and I'm not sure how I complete with the sorts of individuals that my students have access to online.
  • And a final thought: even going in to grad school, I was making a choice between grad school for math, or grad school for computer science. By the time senior year rolled around I was decided on math. I know at least one of my closest friends at the time was surprised. I sort of wish I had talked to my advisor and my CS professors a bit more about my decision, before making it. These days, I feel like I was probably wrong. I can spend all day online reading about computer/tech/programming stuff. I'll work on Project Euler problems, happily, until I solve them - in contrast to research, which I have a very hard time convincing myself to spend even an hour a day "doing". I don't know, maybe this is just a case of "the grass is always greener". Also, Project Euler problems, from what I've seen, aren't meant to be long, whereas math Ph.D. problems are sort of meant to take a little while. But what gets me excited are the projects I want to work on as a programmer, not as a mathematician.
Earlier this year I was at a party, and eventually the group I was sitting with decided to play a "tell me about yourself" sort of game. Mine was "I've been thinking about quitting grad school". Somebody asked me why I was still in it. "Inertia". They thought this was a good answer. To stay 5 years in grad school, and leave before getting a Ph.D. sounds like a pretty stupid idea, all around. But I was seriously considering it. A lease that runs until next summer, and no job prospects if I left, though, made it hard to leave. Around the same time as this party I had several talks with my advisor about what I wanted to do, and such. Eventually we decided I'd stick around into my 7th year and finish up, and then I could re-evaluate "be a professor" or "don't be a professor" at that point. That worked for a while. I'm basically back to wishing I'd just quit. I've also re-adopted my anti-social role, skipping most of the parties I've been invited to since. There are simply more interesting things to do. Which is the same problem I have with doing research.

So, anyway. I don't really know where I am. I don't really know where I am going. I'm apparently in not too much of a hurry to find out. I've killed another hour that I should have spent on research.

And, yes, the title of this post is a nod to Tool.