Code Spatter » Uncategorized http://codespatter.com Fri, 04 Sep 2009 14:59:15 +0000 http://wordpress.org/?v=2.8.4 en hourly 1 Getting Basecamp API Working with Python http://codespatter.com/2009/04/01/getting-basecamp-api-working-with-python/ http://codespatter.com/2009/04/01/getting-basecamp-api-working-with-python/#comments Wed, 01 Apr 2009 19:09:33 +0000 Greg Allard http://codespatter.com/?p=359 // = 0) { links[i].innerHTML = 'View Comments'; query += 'wpid' + i + '=' + encodeURIComponent(links[i].getAttribute('wpid')) + '&'; } } document.write(' I found one library that was linked everywhere, but it wasn’t working for me. I was always getting 400 Bad Request when using it. Chris Conover was able to get the following code working. import urllib2   protocol = 'https://' url = 'example.com' command = '/projects.xml' headers = {'Accept' : 'application/xml', 'Content-type' : 'applications/xml'} username = 'x' password = 'y'   # Setup password stuff passman [...] Related posts:
  1. Python Projects in Users’ Home Directories with wsgi Letting users put static files and php files in a...
  2. How to Add Locations to Python Path for Reusable Django Apps In my previous post I talk about reusable apps, but...
  3. Setting up Apache2, mod_python, MySQL, and Django on Debian Lenny or Ubuntu Hardy Heron Both Debian and Ubuntu make it really simple to get...
]]>
I found one library that was linked everywhere, but it wasn’t working for me. I was always getting 400 Bad Request when using it. Chris Conover was able to get the following code working.

import urllib2
 
protocol = 'https://'
url = 'example.com'
command = '/projects.xml'
headers = {'Accept' : 'application/xml', 
'Content-type' : 'applications/xml'}
username = 'x'
password = 'y'
 
# Setup password stuff
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, url, username, password)
authhandler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
 
# Send the request and get response
req = urllib2.Request(protocol + url + command, None, headers)
response = urllib2.urlopen(req)
results = response.read()
 
print results

I thought it was a problem with how the authorization was formed so based on the above code I modified the old basecamp.py file and I was able to get a response. The following is what I changed.

Around line 64

    def __init__(self, username, password, protocol, url):
        self.baseURL = protocol+url
        if self.baseURL[-1] == '/':
            self.baseURL = self.baseURL[:-1]
 
        passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
        passman.add_password(None, url, username, password)
        authhandler = urllib2.HTTPBasicAuthHandler(passman)
 
        self.opener = urllib2.build_opener(authhandler)

And around line 142

path = '/projects.xml'

With that I was able to use basecamp.py to retrieve a list of projects. Other modifications may be needed for other features, but that was all I planned on using.

Here is an example of using ElementTree to parse the XML response to get the names of all of the projects returned from basecamp.

import elementtree.ElementTree as ET
from basecamp import Basecamp
 
protocol = 'https://'
url = 'example.com'
username = 'x'
password = 'y'
 
bc = Basecamp(username, password, protocol, url)
projects = bc.projects()
tree = ET.fromstring(projects)
tags = tree.getiterator(tag='project')
 
for t in tags:
    project_name = t.findtext('name')

Related posts:

  1. Python Projects in Users’ Home Directories with wsgi Letting users put static files and php files in a...
  2. How to Add Locations to Python Path for Reusable Django Apps In my previous post I talk about reusable apps, but...
  3. Setting up Apache2, mod_python, MySQL, and Django on Debian Lenny or Ubuntu Hardy Heron Both Debian and Ubuntu make it really simple to get...
]]>
http://codespatter.com/2009/04/01/getting-basecamp-api-working-with-python/feed/ 5
The People Make SXSW Awesome http://codespatter.com/2009/03/25/the-people-make-sxsw-awesome/ http://codespatter.com/2009/03/25/the-people-make-sxsw-awesome/#comments Wed, 25 Mar 2009 18:04:46 +0000 Greg Allard http://codespatter.com/?p=283
  • Keep Friends Posted While on the Road Going on an amazing road trip used to mean that...
  • Just Heard About an Open-Source Database Conference Baron Schwartz, the lead author of High Performance MySQL 2nd...
  • ]]>
    I didn’t hear much about SXSW before going. I knew there would be a lot of presentations to see and there would be a few parties. I never expected the parties to be more valuable than the presentations and I was completely surprised by that.

    The evening events were a great chance to meet people that are doing awesome things. There was the unclasses guy and the awe.sm guy that I met through Tim. And then there was someone doing something more awesome than I ever could. He is a professional contest winner. He enters funny videos into contests and wins things like trips around the world where he will make more videos and win more contests.

    I met a lot of the Orlando crowd while in another city. I met and followed Eric a few months ago and through him I was able to meet some of the people that go to Florida Creatives happy hour. So that was a great chance to get to know everyone better.

    There was also a presentation from the rails envy podcast guy, Gregg Pollack from Orlando. Gregg’s was the only one I went to that wasn’t a panel. The panels could be a bit boring sometimes, but they gave a chance to hear from about 5 people with experience on the topic. The higher education panel started bad just like some of the other panels, but it got better as it went since they got into the important stuff. It would seem that I am still passionate about improving education and I hope that I will be able to work on something at UCF soon that will do just that.

    There were a few other panels that weren’t that bad like How to Rawk SXSW where the panelists were experienced SXSWers and gave advice to the noobs. After my visit, the advice I would give is “Be ready to network” because that is the most important part of the conference. And the last panel I attended was how to rawk the rest of the year which had some advice like keep in contact with the people that you’ve met here. One easy way of doing that is finding out who they are on twitter (everyone at the event was on twitter by the end). One other piece of advice from the panel was the parties aren’t the only place to meet people, hallways and streets work well too. Maybe that would have been better advice at the beginning, but it arose from a question.

    Hopefully I will get to run into a lot of the Orlando people again at the happy hours and of course I’ll be at BarCampOrlando on April 18th.

    Related posts:

    1. Keep Friends Posted While on the Road Going on an amazing road trip used to mean that...
    2. Just Heard About an Open-Source Database Conference Baron Schwartz, the lead author of High Performance MySQL 2nd...
    ]]>
    http://codespatter.com/2009/03/25/the-people-make-sxsw-awesome/feed/ 4
    PHP Developers, Keep me Sane http://codespatter.com/2008/08/30/php-developers-keep-me-sane/ http://codespatter.com/2008/08/30/php-developers-keep-me-sane/#comments Sun, 31 Aug 2008 00:59:15 +0000 Greg Allard http://codespatter.com/?p=116
  • Web-Based Version Management This is an idea to help with CyTE, but I’d...
  • How To Use Triggers to Track Changes in MySQL Setting constraints and rules in the database is better than...
  • Programming Analogies I like to think of programming languages as tools. It’s...
  • ]]>
    There has been one thing that has driven me crazy since the begining days of my php programming. I understand that using @ to suppress errors can be useful. But what I don’t understand is why php would ever want to suppress a fatal error. Normally if @function() causes a fatal error, the error will still be displayed. However, if you do @include(’file’) and there is a fatal error in that file, you get a blank page.

    So if you develop in php, please try to never suppress errors from an included file. There are other ways of catching warnings and displaying your own messages, but I need those fatal errors to help me to continue developing with your software.

    Related posts:

    1. Web-Based Version Management This is an idea to help with CyTE, but I’d...
    2. How To Use Triggers to Track Changes in MySQL Setting constraints and rules in the database is better than...
    3. Programming Analogies I like to think of programming languages as tools. It’s...
    ]]>
    http://codespatter.com/2008/08/30/php-developers-keep-me-sane/feed/ 5
    Just Heard About an Open-Source Database Conference http://codespatter.com/2008/08/27/just-heard-about-an-open-source-database-conference/ http://codespatter.com/2008/08/27/just-heard-about-an-open-source-database-conference/#comments Wed, 27 Aug 2008 14:30:39 +0000 Greg Allard http://codespatter.com/?p=113
  • The People Make SXSW Awesome I didn’t hear much about SXSW before going. I knew...
  • Updated Theme and Comments I ran across this skin while looking for new ones...
  • Server ATTACK I got an e-mail saying that a server I administrate...
  • ]]>
    Baron Schwartz, the lead author of High Performance MySQL 2nd Edition, has just announced OpenSQL Camp 2008 over at his blog.

    Despite the name, this will be different from other Camp conferences you’ve been to. This is a combination of a planned event (with great speakers and sessions), semi-planned spontaneity (sessions to be decided by attendees the night before), and a hackfest. It’s the best elements cherry-picked from all the conferences (and un-conferences) you’ve been to.

    The event is in Charlottesville, Virginia on Nov 14 to 16 which is Friday to Sunday. Travel and other important information is over at the event’s site.

    I don’t know if I’ll be able to make this one since I already have a few trips planned, but it sounds awesome.

    Related posts:

    1. The People Make SXSW Awesome I didn’t hear much about SXSW before going. I knew...
    2. Updated Theme and Comments I ran across this skin while looking for new ones...
    3. Server ATTACK I got an e-mail saying that a server I administrate...
    ]]>
    http://codespatter.com/2008/08/27/just-heard-about-an-open-source-database-conference/feed/ 5
    Updated Theme and Comments http://codespatter.com/2008/08/21/updated-theme-and-comments/ http://codespatter.com/2008/08/21/updated-theme-and-comments/#comments Thu, 21 Aug 2008 17:48:11 +0000 Greg Allard http://codespatter.com/?p=107
  • Implementing HaloScan Powered Comments For some time now, I’ve been using a Magic the...
  • New Stuff I installed WordPress since I didn’t have enough time to...
  • Real Blogging Power I feel like having WordPress installed has helped to give...
  • ]]>
    I ran across this skin while looking for new ones for a different blog. It happened to look similar to what I was hoping to create someday so I thought I would use it for a while. I’ve already modified a few small things to get it to look a little more to my liking, but it was overall very nice.

    A while ago I posted about using Haloscan for a commenting system. There were many reasons I didn’t want to use it on here so I tested it out on a project site . A few weeks later, I heard about Disqus and it seemed to do everything I could ask for. I’ve implemented their system on Code Spatter to see how I like it. The best thing is I can stop using it and go back to wordpress comments with no hassle since they are stored in my database as well as on the disqus server.

    Related posts:

    1. Implementing HaloScan Powered Comments For some time now, I’ve been using a Magic the...
    2. New Stuff I installed WordPress since I didn’t have enough time to...
    3. Real Blogging Power I feel like having WordPress installed has helped to give...
    ]]>
    http://codespatter.com/2008/08/21/updated-theme-and-comments/feed/ 6
    Keep Friends Posted While on the Road http://codespatter.com/2008/05/16/keep-friends-posted-while-on-the-road/ http://codespatter.com/2008/05/16/keep-friends-posted-while-on-the-road/#comments Fri, 16 May 2008 15:13:59 +0000 Greg Allard http://codespatter.com/?p=37
  • The People Make SXSW Awesome I didn’t hear much about SXSW before going. I knew...
  • Django Single Sign On or a Solution to Multi-domain Cookies I’ve been working on a project for a while and...
  • MTG:DB Updates I was looking at my google analytics account and saw...
  • ]]>
    Going on an amazing road trip used to mean that you couldn’t update your stay-at-home friends about the stupid things you’ve done on your adventures until you return. I am going on the BABE Rally with an old, ‘71 VW Van. My friends at home will all remain updated throughout the trip since with current technologies it is now possible to blog about long tales, twitter about quick stories, and keep friends updated on your location with GPS and Google Maps.

    Bloging From the Road

    There are many blog services that allow you to text message or e-mail in updates. With the advancement of smart phones, e-mailing posts in is getting even easier; you don’t need to stop and find a wifi spot for your laptop.

    Mobile Twitter

    You can create one account and name it after your trip, then have each of the members of the rally send messages @that_account (@ ricketyvan for us). Have the new account follow only the people on the trip so it won’t show updates from other people.

    Since some of us have iPhones we will be using an app called Twinkle which includes your location (and optionally a photo) in your post.

    GPS and Google Maps

    If you have a GPS unit that can create xml .gpx files, there are some scripts that will use Google Maps API and let you display waypoints based on those files. We will be using this to keep people up to date on our location.

    There are also a bunch of services that weren’t mentioned that we will probably take advantage of, like Flickr or Facebook Fan Pages. We’ve already started adding pictures of our preparation repairs to our group. Also, we created a page on the Facebook so that people can become fans.

    Related posts:

    1. The People Make SXSW Awesome I didn’t hear much about SXSW before going. I knew...
    2. Django Single Sign On or a Solution to Multi-domain Cookies I’ve been working on a project for a while and...
    3. MTG:DB Updates I was looking at my google analytics account and saw...
    ]]>
    http://codespatter.com/2008/05/16/keep-friends-posted-while-on-the-road/feed/ 1
    Real Blogging Power http://codespatter.com/2008/02/07/real-blogging-power/ http://codespatter.com/2008/02/07/real-blogging-power/#comments Thu, 07 Feb 2008 23:36:48 +0000 Greg Allard http://codespatter.com/2008/02/07/real-blogging-power/
  • Programming Analogies I like to think of programming languages as tools. It’s...
  • ]]>
    I feel like having WordPress installed has helped to give me real blogging power. I’ve written two articles that I haven’t published yet because I don’t feel like they are ready. These may have gone unwritten if I was still using the old, incomplete blog I wrote myself.

    Why this is worthy and the other two aren’t, I still don’t know.

    Related posts:

    1. Programming Analogies I like to think of programming languages as tools. It’s...
    ]]>
    http://codespatter.com/2008/02/07/real-blogging-power/feed/ 2
    Introducing MorfU g1 http://codespatter.com/2007/08/31/introducing-morfu-g1/ http://codespatter.com/2007/08/31/introducing-morfu-g1/#comments Fri, 31 Aug 2007 21:46:54 +0000 Greg Allard http://codespatter.com/?p=11
  • CyTE Updates Moved We’ve set up a google code account since they offer...
  • Web-Based Version Management This is an idea to help with CyTE, but I’d...
  • New Stuff I installed WordPress since I didn’t have enough time to...
  • ]]>
    The name MorfU is an anagram of the word forum. The goal of this project is to combine features of Weblogs, Wikis, and Forums. They all have similarities so the same code should be able to produce all three with little variance.

    Currently, MorfU only has blog features and the first version of it was tested when creating Code Spatter.

    It has now been packaged as a very special g-beta. All that means is, I don’t guarantee anything and good luck with it. Soon things will be flushed out and more features will be added.

    If you end up using this software and add features of your own, you are welcome to contribute to the project. I don’t have svn or anything set up, so we’ll figure it out when we get there.

    Feature List and very little info at http://morfu.com

    Package downloadable from [Link Removed (project abandoned at the moment)]

    Related posts:

    1. CyTE Updates Moved We’ve set up a google code account since they offer...
    2. Web-Based Version Management This is an idea to help with CyTE, but I’d...
    3. New Stuff I installed WordPress since I didn’t have enough time to...
    ]]>
    http://codespatter.com/2007/08/31/introducing-morfu-g1/feed/ 0
    Layout Upgrade http://codespatter.com/2007/06/12/layout-upgrade/ http://codespatter.com/2007/06/12/layout-upgrade/#comments Wed, 13 Jun 2007 02:39:13 +0000 Greg Allard http://codespatter.com/?p=7
  • JavaScript Lernen Earlier today I ventured out to begin my apprenticeship of...
  • CyTE g7 to CyTE g8 Change Log General Changes Error reporting is no longer set to E_ALL...
  • ]]>
    I didn’t want to go too Web 2.0 trendy, but went ahead and did the stripes anyways. After I spent hours working on making the image, I wanted to make a script that would do it automatically given some specifications. Then I thought of searching to see if someone else had done it. http://www.stripegenerator.com/ ended up having just what I needed and I am using that image now instead.

    So the navigation was moved to the top and the other crap was pushed to the right out of the way.

    I’m not sure if I want to do shiny buttons for the navigation or not since it seems to look fine now.

    Related posts:

    1. JavaScript Lernen Earlier today I ventured out to begin my apprenticeship of...
    2. CyTE g7 to CyTE g8 Change Log General Changes Error reporting is no longer set to E_ALL...
    ]]>
    http://codespatter.com/2007/06/12/layout-upgrade/feed/ 0