Tag congressvotes (6)
score your representative!
Posted on 2007-04-23 09:39:00
Tags: movies homepage congressvotes
So over the weekend I finished congressvotes - check it out! (I also prettied up my homepage a little bit...maybe I'll actually make it look nice some day)
We did see Hot Fuzz this weekend, and it was awesome. Like Shaun of the Dead it's a good mix between a comedy and a serious movie (cop drama/mystery in this case). Highly recommended!
happy birthday to meeee
Posted on 2007-04-20 09:39:00
Tags: movies congressvotes
Yay, I'm 25! I get a discount on my car insurance (I think at least), and I can rent a car without any problems! Also a perfect square, and the smallest hypotenuse squared in a Pythagorean triple. And (25 mod 10)^2 = 25. I think I'll stop now.
I hope I never get blasé about my birthday. I love special occasions! Tonight we're gonna eat at Copeland's (note to self: eat small lunch) and maybe see a movie. Hot Fuzz opens today, made by the same people who did Shaun of the Dead which I really liked, so we might go for that :-)
I joined Facebook yesterday, which probably makes me user #1 billion or something. It seems neat enough.
Article about long commutes and why people do it. Yikes!
Last night I worked on congressvotes and it's almost ready to go! The weirdest problem I had was that in most votes "Yea" and "Nay" are used, but some use "Aye" and "No", confusingly enough.
congressvotes moves forward
Posted on 2007-04-16 14:23:00
So it's been a while since I've had a lot of time to work on congressvotes, but with the holidays being over and hitting level 70 in WoW (yay! flying mount!) I've been a little less busy.
The previous hangup I had was parsing the XML files and getting data out in Haskell - I figured out how to do it with HaXML, but the code I had took like half an hour to run and a ridiculous amount of memory just to get some basic data out. Maybe it's because my code was bad, but I couldn't figure it out and got frustrated and took some time away from the project.
So, I kinda gave up and wrote a script in Python to convert the XML into a simple colon-delimited format, and everything works much faster now.
While I had some time off I thought about what exactly I wanted it to do, since I had a bunch of related ideas. My current plan is this: the user selects a year, and then picks from a list of interest groups that had opinions on votes that year. You can then decide whether you care about the votes or not (and whether to vote for or against the interest group's position!) and then you get a list of all representatives in congress sorted by how many times they agreed with you. (in a neat Yahoo! UI DataTable) You can then sort by state to see how your legislator did, etc.
Last night I wrote the code that actually compares the votes, and I also spent a bit of time this weekend gathering congressional scorecards from interest groups. I also did some work on the webpage, so it looks like I just need some glue pieces to tie it all together. Hopefully that won't take too long!
(oh, and I have to make the page work in Internet Explorer which always frustrates the hell out of me. Maybe I can set up IE debugging on David's computer...)
Posted on 2007-03-29 15:41:00
Tags: haskell congressvotes
Allergies seem to be on the retreat, thanks to a little extra sleep today and tons of tea and orange juice and hot chocolate.
I should have worked on congressvotes yesterday, but I didn't have the activation energy. The problem is that parsing the XML and extracting any sort of data gets really really really slow - like 37 minutes to do a little bit of stuff to all 600ish votes from 2006. I've looked at the code and I can't find anything in particular that's inefficient about it, but I'm pretty new at Haskell. The next strategy is to do an offline transform to some sort of friendlier text format with just the information I need, and hopefully the web service, etc. can just use those text files. Hopefully I'll give this a shot sometime soon. (for some reason this post about premature optimization spoke to me; it's a good general philosophy!)
Wow, are there really going to be Kwik-E-Marts? I could go for some Krusty-O's...
Extortion is profitable!
Posted on 2007-03-22 08:55:00
Tags: haskell congressvotes
Man, I feel productive! (not in a work sense, but in a doing stuff at home sense) Last night I wrote the LJ-Blog adapter for fairydust1 - as she mentioned, all of the posts on her blog will become friends-only posts on the account boltonblog, so friend it if you haven't already! It only took a couple of hours (partially because I had code from ljbackup for interacting with LJ, and partially because I backed off a little from my goal and just posted the summary text from the RSS feed here ), and I was happy I could knock it out and it seems to work. (and sorry for the flood of posts, but I was even more afraid as I went to bed that it would keep doing that every hour!)
I also made some more progress on my congress votes project. Learned how to download files in Haskell - as with anything involving IO, it's a little tricky and I haven't quite got the hang of it yet, but I managed to make it work. The next hard part is figuring out which votes are "important" and which aren't from the Reason on the bill, such as "On Motion to Suspend the Rules and Pass, as Amended", "On Motion to Recommit with Instructions", "On Agreeing to the Amendment", etc. Some of these I'm going to have to ignore if they deal with amendments because that information is hard to find. And I need to make sure voting "Yea" means voting for the bill and not against it!
Episcopal Bishops in U.S. Defy Anglican Communion - it's really nice to see the leaders of your church say this:
We proclaim the Gospel that in Christ all God's children, including gay and lesbian persons, are full and equal participants in the life of Christ's Church.
new project: congress ratings
Posted on 2007-03-19 18:48:00
Tags: haskell projects programming congressvotes
So my next project is fun and neat. I can't remember how exactly I got here, but I noticed that all roll-call votes in congress are accessable in a handy XML format (Here's an example vote - note that the page you see is that XML file after being processed with an XSLT stylesheet, so you'll have to hit View Source to see the raw data). My idea (a little vague at this point) is to take all of the votes, and then figure out which issues I care about and which way I would have voted, and then "rate" representatives as to how closely their votes align with mine. This is a little grand in scope.
Anyway, it took me a while to get HaXml (a Haskell XML parser) installed, because I kept not being able to compile it from source for various stupid reasons. Anyway, I finally figured out that it was in fact in Debian in the libghc6-haxml-dev package, which made my life about 5 times easier.
So I saved a sample vote and have it parsing and I'm extracting simple data from it, which is exciting! I have a few questions, though: does anyone know the answer to these?
- I have these two functions:
nothing :: Maybe a -> Bool
nothing Nothing = True
nothing (Just _) = False
findElementContent :: String -> Content -> Maybe Element
findElementContent target (CElem el) = findElement target el
findElementContent target _ = Nothing
findElementContents :: String -> [Content] -> Maybe Element
findElementContents _  = Nothing
findElementContents target (c:cs) = if (nothing (findElementContent target c))
then findElementContents target cs
else findElementContent target c
findElementContent takes in a target tag and some data (Content), and returns the element that has that tag name if it exists, and Nothing otherwise. (
findElementContents is just a helper function to do the same thing with a list of Content) But
findElementContents looks pretty ugly to me - what I want it to do is return
findElementContent target c if that isn't Nothing, and otherwise recur on the rest of the list. The code is correct, but is it inefficient since I'm calling
findElementContent target c twice? My limited understanding says no, since
findElementContent is referentially transparent since it doesn't use monads (i.e. if you call it again with the same inputs it will return the same thing, always), but I'm not entirely clear on this.
- As I mentioned,
findElementContents seems a little inelegant - is there a better way to do this? Is there some builtin
nothing that I couldn't find?
Resources I've been using:
- HaXml reference
- standard library reference, including the Prelude
This backup was done by LJBackup.