Fixing Facebook

Have you been thinking Facebook’s newsfeed sucks lately? I sure have. It’s been bad for a few years now, but in the last few months it’s gotten unbearable. Even worse is the new “Trending Stories” module, which seems to have been inspired by the New York Post. I started wishing, if only I could just get rid of them without losing Facebook’s other functionalities…

Read more...

Creating a Django Widget to Draw and Calculate Dimensions of Rectangles on Images

In my last post I talked about getting an image path and passing it into the next step of a Django form wizard for use in the canvas field. That was only the first piece of the challenge. The purpose of the canvas field is to hold a widget containing a canvas to allow users to draw a rectangle within the image. The placement and dimensions of the rectangle - specifically distance from top and left, and height and width, as a percentage of the image, need to be entered into the database to create a positioned ‘hotspot’.

Read more...

Passing Information Between Django Form Wizard Steps

For the project I’m working on, users need to be able to choose a page and surface and then view the image corresponding to that page and surface and add a hotspot to it. Since this requires hitting the database to get the requested image path, I decided to place these steps on different pages using the form wizard from Django’s form tools package. As with many things Django, passing information from one step to a later step where it will be used is a seemingly obvious but relatively undocumented use case.

Read more...

Validating File Types in Django

So, I recently picked up Python, and then Django, because expanding my world view or something. Mostly, it’s been awesome. And a bit of an adventure. When you dream up some crazy thing you’re trying to implement in Rails, you can usually just google your stream of conciousness and someone serves you up a gem on a silver platter and tells you exactly (more or less) how to use it. With Django, it’s just the wild, wild west out there, even when you’re doing something you’d think would be very simple and common. Uh, good luck!

Read more...

Using (and Testing) Rack::Attack to Improve the Security of Your Rails App

Rack::Attack is a rack middleware intended to protect Rails applications through customized throttling and blocking. I started using it after attending a talk from the person who created it, and I thought it was a brilliant option for developers who want to increase the security of their applications with minimal effort.

Read more...