My First Web App

The holidays are here! This means that there is finally enough time to develop my first web app. Knowing how bad I still am at debugging weird errors and how little experience I have with frameworks, I prepared myself for a nerve-racking experience full of apparently insurmountable obstacles.

First of all, I researched a few popular python frameworks, services and tools to find the best options for me. Since I prefer lightweight and modern frameworks, Flask was an obvious choice. Flask also supports Jinja2 Templating out of the box, which is great. For deployment, I picked Heroku because it seems to be quite beginner friendly.

Continue reading “My First Web App”

Unique != Distinguishable

Had you asked me a week ago, “What’s the most difficult part about generating identicons?”, I would have answered, “Making them look good, obviously.”
Turns out I was wrong. It’s actually quite easy to configure an image generator to produce beautiful images: Take care your colors don’t clash and you should be fine.

The problem lies somewhere else. It’s obvious and easy to overlook at the same time: Images need to be complicated enough to make them unique. At the same time, complexity makes them harder to distinguish. Sadly, this only occurred to me when my image generator was fully implemented and I tested it with some strings.

Continue reading “Unique != Distinguishable”

SHA-1 Is Dead, but Not Quite Yet

Even though SHA-1 has been considered deprecated for many years now, it is still widely used. About a month ago, it was broken in practice, rendering it useless as a cryptographic hash function. At this point, most people will probably stop using it for security related purposes. An insecure “secure hash algorithm” is basically useless, isn’t it?

Well, I don’t think so. Obviously, it’s a very bad idea to rely on SHA-1 for security. However, the algorithm still converts input into a short binary or hex string of fixed length, which might be useful for some fun projects. You could map pretty much anything to a SHA-1 hash: color values, coordinates, musical notes, words,… – you get the idea.

Actually, that sounds like a great idea for a mini project: I will generate (almost) unique identicons with SHA-1 hashes. More stuff to blog about, yay!

MVC and Observer Pattern

Since I’m working on a rather small project, I decided to implement a simple version of the Model-View-Controller pattern. Here’s the basic idea:

trainer
|
\_ model
:  |_ app.py
:  |_ data.py
|
\_ view
:  |_ res
:  |_ view.py
|
|_ main.py

In the package model there are two modules: data, which knows relevant data (e.g. letter codes), and app, which contains logic. The class app.App should be used for requests from other modules.
Code related to the look of individual views can be found in view.view. Image resources are saved in the subfolder view.res.

The program is started by executing main.py, which contains the Controller. It loads app and view, instantiates classes and connects Observers with Observables.

Continue reading “MVC and Observer Pattern”

Quiz Design

When building a GUI, I tend to spend way too much time on style decisions. I’m pretty sure that there are ways to speed up that process, but I have yet to figure them out. For my Amino Acid Trainer project, I’m trying to make decisions faster by structuring objectives in a TODO list and working my way through.

My TODO List

  • Choose general style (modern, retro, funny, cute, professional,…)
  • Choose fonts
  • Find fitting color palette
  • Sketch layouts for most views (positions and sizes – no color!)
  • Decide how buttons should look (mostly shape, but also a few color ideas)
  • Color all elements on my sketches (revisions might be necessary)
  • Create images (buttons,…)
  • Implement most views with dummy data
  • Add missing parts

Doesn’t seem too complicated, does it? Let’s take a closer look at my objectives.

Continue reading “Quiz Design”

The Next Project

It’s time for a new project – let’s see if I can apply what I’ve learned.

Since I’m terrible at learning things by heart, I’ve always struggled with amino acid formulas and letter codes. However, when working with ion channels or similar biomolecules, you need to know these things really well. Therefore, I’ll build a small quiz to help me (and maybe some other people) memorize structures, one-letter and three-letter codes. Continue reading “The Next Project”