Using Sessions in Flask

In this post I’ll provide an example of using session management in Flask. This is useful when you need to recover persistent data across different endpoints in your application. In this example, we set the permanent attribute of the session object to True in order to ensure that the session data lasts indefinitely until it is cleared when the user accesses the root endpoint again. The best practice is to have a timeout on the session data.

Continue reading Using Sessions in Flask

Swift Optimization

I learned a hard lesson today: to make Swift really fast you have to know what you’re doing. You can’t just slap some code together and expect it to be zippy without understanding some of how Swift was designed and how it works. There is a very good presentation by some of the team members that built Swift here. My initial takeaway was that it was important to finalize any classes you didn’t plan on subclassing, incrementally check the timing analyzer, and finally, employ whole module optimization.

Continue reading Swift Optimization

Using MapKit in an XCode Playground

I saw some outdated material about using MapKit in an XCode Playground, so I thought I’d post an example for XCode 7.1.1 and Swift 2.1. Being able to access and manipulate a map this easily if freaking amazing. This code allows you to view the map in the timeline on the right-hand pane. You can press the diagonal Venn diagram at the top right-hand corner to toggle the timeline.

Continue reading Using MapKit in an XCode Playground