As you can tell, I’ve changed my blog. A lot. I’ve completely migrated away from Wordpress and onto Octopress. It’s been fantastic. The migration to Octopress was made easy by ExitWP which I used to move over the contents of my blog. There were some little things (no support for tags, so now they are categories) but nothing game breaking. I am very happy!
I was indirectly convinced by a friend of mine to get my butt back to work releasing The Beer Stash. Development has been slow lately for various reasons but there were a few things I’ve completed but just never had the time to post. Today, I got home and finished up the last few remaining tasks that I wanted for this build. Today’s post is the penultimate post before I open up registration, so you early adopters out there really should get to work!
There are two main changes in today’s post. First off, we have inline Beer Stash editing! Before today’s post, getting to your Beer Stash to edit it took you out of where I would have liked the logged in users to be. Let’s call it the dashboard. This is the page that has your Beer Stream and all created Stashes. You’ll be happy to see that whatever Beer Stash you click opens to the right of the navigation:
The second change here is really the reason why this post took so long for me to get up - I decided to change the links to public facing user Beer Stashes. What used to be /stash/USERNAME/STASH_SLUG/ has now become /users/USERNAME/STASH_SLUG/. It felt really weird having the one off /stash/ URL, and I feel this just works better. I firmly believe that Cool URIs Don’t Change, but I felt this was necessary. All URLs in the form of the old style automatically get 301’ed to the new URL scheme, so hopefully this doesn’t break anything.
There are a few other minor tweaks here and there but I’ll leave those as exercices for our readers to find. Enjoy!
A productive few nights of coding brings a new feature to The Beer Stash! This was a feature that I’ve been most interested in getting done - Beer Streams!
Think of it as Twitter for Beer. I guess. I wanted a way for users to keep up with what other users are stashing, and this seemed like the best way. Each user page now has a “Add to Beer Stream” button. On the user is already in your Beer Stream, then the button will be used to remove them.
There is a new “Beer Stream” menu link which takes you back to the Beer Stream.
Here is an interesting thing to happen while working with Django. I don’t have a clear cut answer for why it happened, but at least I’ve found a work around until I get more information. I think I have an answer for this - connections are open and held through the life of a request. The isolation (I) in ACID keeps other connections isolated from what has happend. I think. That explains why closing the database connection fixes everything. But more on that later…
I have one handler that pulls in data from a 3rd party source and then saves it into a database. This source has their own primary key, so I am using that as the primary key for my table. Last night I ran into something funny.
Two requests come in to pull and save the exact same data. Request 1 comes in, pulls the data and saves it with no problem. Request 2 comes in, pulls the data, tries to save and Django raises and IntegrityError (since the primary key is already in the database). Fine, that’s no problem. I have the key I want, I should be able to just pull the data from my database then, right? Wrong.
When request 2 tries to pull the record, Django raises a Matching query does not exist error, even though the record I want is in the database (presumably, i mean why else would Django first throw that IntegrityError?).
I can get around this by closing the database connection manually and THEN pulling the info i need from the database.
Manually close the database connection
1 2 3
from django import db db.close_connection() obj = ObjectIWant.objects.get(pk=id)
Closing the database connect and having Django reopen it doesn’t cause the Matching query does not exist error. Like I said, I don’t know why this happened. I have hypotheses. I hope to find an answer and come back to share it.
For reference, here is the Reddit /r/django post I did to try to solicit answers.
Users of The Beer Stash have been through a lot with this site. It still very much is in the prototype phase. I am very thankful that I still continue to have active users despite the fact that they’ve been using a prototype product, but that is what being an early adopter is all about - dealing with crap to be the first user of a new technology. Today’s update is one of my more prototype of prototypes, and one that seems to have been causing a bit of confusion on the site. In order to start gathering feedback, I present to you your home page navigation!
People expected something to be on the page that you get redirected to after you log in, and I kept getting questions about that. They’re right, obviously, being redirected to a blank page absolutely sucks, so I decided that I should clean up the navigation work that I’ve been doing and post it. At least this way I can start getting feedback about it. Note the “Stash” drop down, now gone from the top bar.
One of the two reasons why I released as early as I did is because I wanted to start getting feedback as soon as I can. That has been absolute magic. My good friend Andrew Piccardo (AndyNardo on The Beer Stash) had a few suggestions for me today, so three usability changes star in tonight’s update:
1) Remove that pesky “Feedback” tab
The tab on the right has been replaced with a link in the footer which takes you to the Feedback form. If you have anything to say, feel free to use it! This tab was extremely annoying on iOS devices.
2) Clear button for the search input
This was a no-brainer. I don’t know how I forgot it. As part of this change, the search form gets a face lift. The ordering of the search results are switched too. Before it was Brewery and Beer. That didn’t make sense. So now they are in what I think the proper order is.
3) Sorting your Beer Stash
You can’t really tell but clicking the headers Beer, Brewery etc.. sorts that column. It is actually pretty poorly done right now. There is no visible indication of which column is sorted. That will be fixed in a later release. I may default to sorting by beer name next time too. As another part of this update, the ordering of the columns were changed here too as well as header name updates.